diff --git a/Backgrounds/AstralUndergroungBGStyle.cs b/Backgrounds/AstralUndergroungBGStyle.cs index c27aa839c7..947c43a6eb 100644 --- a/Backgrounds/AstralUndergroungBGStyle.cs +++ b/Backgrounds/AstralUndergroungBGStyle.cs @@ -18,4 +18,4 @@ namespace CalamityMod.Backgrounds textureSlots[3] = mod.GetBackgroundSlot("Backgrounds/AstralUG3"); } } -} \ No newline at end of file +} diff --git a/Buffs/AbyssalDivingSuitBuff.cs b/Buffs/AbyssalDivingSuitBuff.cs index 2a7518a4d2..9303086ae4 100644 --- a/Buffs/AbyssalDivingSuitBuff.cs +++ b/Buffs/AbyssalDivingSuitBuff.cs @@ -1,49 +1,49 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class AbyssalDivingSuitBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Abyssal Diving Suit"); - Description.SetDefault("You are made of metal"); - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.GetModPlayer(); - if (modPlayer.abyssalDivingSuitPrevious) - { - player.gills = true; - modPlayer.abyssalDivingSuitPower = true; - modPlayer.depthCharm = true; - modPlayer.jellyfishNecklace = true; - modPlayer.anechoicPlating = true; - modPlayer.ironBoots = true; - player.arcticDivingGear = true; - player.accFlipper = true; - player.accDivingHelm = true; - player.iceSkate = true; - if (player.wet) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); - } - } - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AbyssalDivingSuitBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Diving Suit"); + Description.SetDefault("You are made of metal"); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(); + if (modPlayer.abyssalDivingSuitPrevious) + { + player.gills = true; + modPlayer.abyssalDivingSuitPower = true; + modPlayer.depthCharm = true; + modPlayer.jellyfishNecklace = true; + modPlayer.anechoicPlating = true; + modPlayer.ironBoots = true; + player.arcticDivingGear = true; + player.accFlipper = true; + player.accDivingHelm = true; + player.iceSkate = true; + if (player.wet) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); + } + } + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} diff --git a/Buffs/AbyssalDivingSuitPlates.cs b/Buffs/AbyssalDivingSuitPlates.cs index 7c0630225f..df50af6e50 100644 --- a/Buffs/AbyssalDivingSuitPlates.cs +++ b/Buffs/AbyssalDivingSuitPlates.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class AbyssalDivingSuitPlates : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Abyssal Diving Suit Plates"); - Description.SetDefault("The plates will absorb 15% damage"); - 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).abyssalDivingSuitPlates = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AbyssalDivingSuitPlates : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Diving Suit Plates"); + Description.SetDefault("The plates will absorb 15% damage"); + 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).abyssalDivingSuitPlates = true; + } + } +} diff --git a/Buffs/AbyssalDivingSuitPlatesBroken.cs b/Buffs/AbyssalDivingSuitPlatesBroken.cs index f7a2493001..b157655280 100644 --- a/Buffs/AbyssalDivingSuitPlatesBroken.cs +++ b/Buffs/AbyssalDivingSuitPlatesBroken.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class AbyssalDivingSuitPlatesBroken : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Abyssal Diving Suit Plates Broken"); - Description.SetDefault("The plates are regenerating"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).abyssalDivingSuitCooldown = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AbyssalDivingSuitPlatesBroken : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Diving Suit Plates Broken"); + Description.SetDefault("The plates are regenerating"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).abyssalDivingSuitCooldown = true; + } + } +} diff --git a/Buffs/AbyssalFlames.cs b/Buffs/AbyssalFlames.cs index 7a118a7042..795a1ad538 100644 --- a/Buffs/AbyssalFlames.cs +++ b/Buffs/AbyssalFlames.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class AbyssalFlames : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Abyssal Flames"); - Description.SetDefault("Your soul is being consumed"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).aFlames = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).aFlames = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AbyssalFlames : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Flames"); + Description.SetDefault("Your soul is being consumed"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).aFlames = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).aFlames = true; + } + } +} diff --git a/Buffs/AbyssalWeapon.cs b/Buffs/AbyssalWeapon.cs index 8383c90e7e..b2f12a7e08 100644 --- a/Buffs/AbyssalWeapon.cs +++ b/Buffs/AbyssalWeapon.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class AbyssalWeapon : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Abyssal Weapon"); - Description.SetDefault("Melee weapons inflict abyssal flames, 15% increased movement 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).aWeapon = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AbyssalWeapon : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Weapon"); + Description.SetDefault("Melee weapons inflict abyssal flames, 15% increased movement 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).aWeapon = true; + } + } +} diff --git a/Buffs/Afflicted.cs b/Buffs/Afflicted.cs index 2cab8dffc1..77678f4528 100644 --- a/Buffs/Afflicted.cs +++ b/Buffs/Afflicted.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Afflicted : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Afflicted"); - Description.SetDefault("Empowered by otherworldly spirits"); - 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).afflicted = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Afflicted : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Afflicted"); + Description.SetDefault("Empowered by otherworldly spirits"); + 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).afflicted = true; + } + } +} diff --git a/Buffs/AkatoYharonBuff.cs b/Buffs/AkatoYharonBuff.cs index 54c693baaf..98a7daa074 100644 --- a/Buffs/AkatoYharonBuff.cs +++ b/Buffs/AkatoYharonBuff.cs @@ -28,4 +28,4 @@ namespace CalamityMod.Buffs } } } -} \ No newline at end of file +} diff --git a/Buffs/Amidias/AmidiasBlessing.cs b/Buffs/Amidias/AmidiasBlessing.cs index 4fe57ebece..b09c3edcf0 100644 --- a/Buffs/Amidias/AmidiasBlessing.cs +++ b/Buffs/Amidias/AmidiasBlessing.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Amidias -{ - public class AmidiasBlessing : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Amidias' Blessing"); - Description.SetDefault("You are blessed by Amidias\n" - +"Lets you breathe underwater, even in the Abyss!\n" - +"Just don't get hit..."); - Main.debuff[Type] = false; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).amidiasBlessing = true; - player.breath = player.breathMax + 91; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Amidias +{ + public class AmidiasBlessing : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Amidias' Blessing"); + Description.SetDefault("You are blessed by Amidias\n" + +"Lets you breathe underwater, even in the Abyss!\n" + +"Just don't get hit..."); + Main.debuff[Type] = false; + Main.buffNoSave[Type] = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).amidiasBlessing = true; + player.breath = player.breathMax + 91; + } + } +} diff --git a/Buffs/Amidias/HermitCrab.cs b/Buffs/Amidias/HermitCrab.cs index e9d4531fbb..5aa7db866e 100644 --- a/Buffs/Amidias/HermitCrab.cs +++ b/Buffs/Amidias/HermitCrab.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Amidias -{ - public class HermitCrab : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Hermit Crab"); - Description.SetDefault("The hermit crab 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("HermitCrab")] > 0) - { - modPlayer.hCrab = true; - } - if (!modPlayer.hCrab) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Amidias +{ + public class HermitCrab : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Hermit Crab"); + Description.SetDefault("The hermit crab 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("HermitCrab")] > 0) + { + modPlayer.hCrab = true; + } + if (!modPlayer.hCrab) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Amidias/SnapClamDebuff.cs b/Buffs/Amidias/SnapClamDebuff.cs index 14040c9307..0845e59cbb 100644 --- a/Buffs/Amidias/SnapClamDebuff.cs +++ b/Buffs/Amidias/SnapClamDebuff.cs @@ -1,26 +1,26 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Amidias -{ - public class SnapClamDebuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Clammed"); - Description.SetDefault("Clam clap"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).clamDebuff = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Amidias +{ + public class SnapClamDebuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Clammed"); + Description.SetDefault("Clam clap"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).clamDebuff = true; + } + } +} diff --git a/Buffs/AnechoicCoating.cs b/Buffs/AnechoicCoating.cs index f6b61b2d56..b9b778c6be 100644 --- a/Buffs/AnechoicCoating.cs +++ b/Buffs/AnechoicCoating.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class AnechoicCoating : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Anechoic Coating"); - Description.SetDefault("Abyssal creature's detection radius reduced"); - 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).anechoicCoating = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AnechoicCoating : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Anechoic Coating"); + Description.SetDefault("Abyssal creature's detection radius reduced"); + 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).anechoicCoating = true; + } + } +} diff --git a/Buffs/AngryChicken.cs b/Buffs/AngryChicken.cs index 43a8f1e0b8..38c2066c2b 100644 --- a/Buffs/AngryChicken.cs +++ b/Buffs/AngryChicken.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class AngryChicken : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Son of Yharon"); - Description.SetDefault("The Son of Yharon 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("AngryChicken")] > 0) - { - modPlayer.aChicken = true; - } - if (!modPlayer.aChicken) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class AngryChicken : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Son of Yharon"); + Description.SetDefault("The Son of Yharon 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("AngryChicken")] > 0) + { + modPlayer.aChicken = true; + } + if (!modPlayer.aChicken) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/AquaticStar.cs b/Buffs/AquaticStar.cs index 4346e72e35..8482589cbf 100644 --- a/Buffs/AquaticStar.cs +++ b/Buffs/AquaticStar.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class AquaticStar : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Aquatic Star"); - Description.SetDefault("The aquatic star 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("AquaticStar")] > 0) - { - modPlayer.aStar = true; - } - if (!modPlayer.aStar) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class AquaticStar : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Aquatic Star"); + Description.SetDefault("The aquatic star 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("AquaticStar")] > 0) + { + modPlayer.aStar = true; + } + if (!modPlayer.aStar) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/ArmorCrumbling.cs b/Buffs/ArmorCrumbling.cs index 03404561ce..1666193efa 100644 --- a/Buffs/ArmorCrumbling.cs +++ b/Buffs/ArmorCrumbling.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).armorCrumbling = true; } } -} \ No newline at end of file +} diff --git a/Buffs/ArmorCrunch.cs b/Buffs/ArmorCrunch.cs index 1ad7a56d0f..3487d613fc 100644 --- a/Buffs/ArmorCrunch.cs +++ b/Buffs/ArmorCrunch.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class ArmorCrunch : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Armor Crunch"); - Description.SetDefault("Your armor is shredded"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).aCrunch = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).aCrunch = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ArmorCrunch : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Armor Crunch"); + Description.SetDefault("Your armor is shredded"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).aCrunch = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).aCrunch = true; + } + } +} diff --git a/Buffs/ArmorShattering.cs b/Buffs/ArmorShattering.cs index ea2624d20e..d119c6daea 100644 --- a/Buffs/ArmorShattering.cs +++ b/Buffs/ArmorShattering.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).armorShattering = true; } } -} \ No newline at end of file +} diff --git a/Buffs/AstralInjectionBuff.cs b/Buffs/AstralInjectionBuff.cs index 52c96d9c9d..3766977c11 100644 --- a/Buffs/AstralInjectionBuff.cs +++ b/Buffs/AstralInjectionBuff.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).astralInjection = true; } } -} \ No newline at end of file +} diff --git a/Buffs/Backfire.cs b/Buffs/Backfire.cs index c24965dda7..f81f7d7242 100644 --- a/Buffs/Backfire.cs +++ b/Buffs/Backfire.cs @@ -1,30 +1,30 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Backfire : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Backfire"); - Description.SetDefault("Damage, defense, and wing time drastically reduced"); - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.meleeDamage -= 0.9f; - player.magicDamage -= 0.9f; - player.rangedDamage -= 0.9f; - player.thrownDamage -= 0.9f; - player.minionDamage -= 0.9f; - player.statDefense -= 20; - player.endurance -= 0.2f; - player.wingTimeMax /= 2; - } - } -} +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Backfire : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Backfire"); + Description.SetDefault("Damage, defense, and wing time drastically reduced"); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.meleeDamage -= 0.9f; + player.magicDamage -= 0.9f; + player.rangedDamage -= 0.9f; + player.thrownDamage -= 0.9f; + player.minionDamage -= 0.9f; + player.statDefense -= 20; + player.endurance -= 0.2f; + player.wingTimeMax /= 2; + } + } +} diff --git a/Buffs/BearBuff.cs b/Buffs/BearBuff.cs index adb0951ac1..57c9aaaa7d 100644 --- a/Buffs/BearBuff.cs +++ b/Buffs/BearBuff.cs @@ -1,30 +1,30 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; - -namespace CalamityMod.Buffs -{ - public class BearBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Bear"); - Description.SetDefault("A guardian angel is following 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).bearPet = true; - bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Bear")] <= 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("Bear"), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; + +namespace CalamityMod.Buffs +{ + public class BearBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Bear"); + Description.SetDefault("A guardian angel is following 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).bearPet = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Bear")] <= 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("Bear"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/BloodClot.cs b/Buffs/BloodClot.cs index d1528f6e95..c8be12adf1 100644 --- a/Buffs/BloodClot.cs +++ b/Buffs/BloodClot.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class BloodClot : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Blood Clot"); - Description.SetDefault("The blood clot 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("BloodClotMinion")] > 0) - { - modPlayer.bClot = true; - } - if (!modPlayer.bClot) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class BloodClot : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Blood Clot"); + Description.SetDefault("The blood clot 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("BloodClotMinion")] > 0) + { + modPlayer.bClot = true; + } + if (!modPlayer.bClot) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/BoundingBuff.cs b/Buffs/BoundingBuff.cs index 7e4b4a2856..bdb5e38275 100644 --- a/Buffs/BoundingBuff.cs +++ b/Buffs/BoundingBuff.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).bounding = true; } } -} \ No newline at end of file +} diff --git a/Buffs/BrimlingBuff.cs b/Buffs/BrimlingBuff.cs index 3689755901..fd3dbb64e7 100644 --- a/Buffs/BrimlingBuff.cs +++ b/Buffs/BrimlingBuff.cs @@ -1,30 +1,30 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; - -namespace CalamityMod.Buffs -{ - public class BrimlingBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Brimling"); - Description.SetDefault("Protect her or suffer in agony"); - Main.buffNoTimeDisplay[Type] = true; - Main.vanityPet[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.buffTime[buffIndex] = 18000; - player.GetModPlayer(mod).brimling = true; - bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Brimling")] <= 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("Brimling"), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; + +namespace CalamityMod.Buffs +{ + public class BrimlingBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brimling"); + Description.SetDefault("Protect her or suffer in agony"); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.GetModPlayer(mod).brimling = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Brimling")] <= 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("Brimling"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/BrimstoneFlames.cs b/Buffs/BrimstoneFlames.cs index 90d3032d84..783357687b 100644 --- a/Buffs/BrimstoneFlames.cs +++ b/Buffs/BrimstoneFlames.cs @@ -1,32 +1,32 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class BrimstoneFlames : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Brimstone Flames"); - Description.SetDefault("Rapid health loss"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).bFlames = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).bFlames = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class BrimstoneFlames : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brimstone Flames"); + Description.SetDefault("Rapid health loss"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).bFlames = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).bFlames = true; + } + } +} diff --git a/Buffs/BrimstoneMount.cs b/Buffs/BrimstoneMount.cs index 497f4b3dba..ed53322f2d 100644 --- a/Buffs/BrimstoneMount.cs +++ b/Buffs/BrimstoneMount.cs @@ -1,26 +1,26 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using CalamityMod.Items; - -namespace CalamityMod.Buffs -{ - class BrimstoneMount : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Brimrose Mount"); - Description.SetDefault("The seat is toasty. That is all"); - 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; - } - } -} +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using CalamityMod.Items; + +namespace CalamityMod.Buffs +{ + class BrimstoneMount : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brimrose Mount"); + Description.SetDefault("The seat is toasty. That is all"); + 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; + } + } +} diff --git a/Buffs/BrimstoneWaifu.cs b/Buffs/BrimstoneWaifu.cs index 381b553806..a12c064ef4 100644 --- a/Buffs/BrimstoneWaifu.cs +++ b/Buffs/BrimstoneWaifu.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class BrimstoneWaifu : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Brimstone Elemental"); - Description.SetDefault("The brimstone elemental 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("BigBustyRose")] > 0) - { - modPlayer.bWaifu = true; - } - if (!modPlayer.bWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class BrimstoneWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brimstone Elemental"); + Description.SetDefault("The brimstone elemental 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("BigBustyRose")] > 0) + { + modPlayer.bWaifu = true; + } + if (!modPlayer.bWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/BrittleStar.cs b/Buffs/BrittleStar.cs index 03077e2683..8226827aaf 100644 --- a/Buffs/BrittleStar.cs +++ b/Buffs/BrittleStar.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class BrittleStar : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Brittle Star"); - Description.SetDefault("The brittle star 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("BrittleStar")] > 0) - { - modPlayer.bStar = true; - } - if (!modPlayer.bStar) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class BrittleStar : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Brittle Star"); + Description.SetDefault("The brittle star 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("BrittleStar")] > 0) + { + modPlayer.bStar = true; + } + if (!modPlayer.bStar) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/BurningBlood.cs b/Buffs/BurningBlood.cs index 1bc7009d89..33842a235f 100644 --- a/Buffs/BurningBlood.cs +++ b/Buffs/BurningBlood.cs @@ -1,32 +1,32 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class BurningBlood : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Burning Blood"); - Description.SetDefault("Your blood is on fire"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - 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 +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class BurningBlood : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Burning Blood"); + Description.SetDefault("Your blood is on fire"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).bBlood = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).bBlood = true; + } + } +} diff --git a/Buffs/BurntOut.cs b/Buffs/BurntOut.cs index c4ae2ab4f9..51a925ee39 100644 --- a/Buffs/BurntOut.cs +++ b/Buffs/BurntOut.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class BurntOut : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Burnt Out"); - Description.SetDefault("You've been burnt out and your guardians are less effective"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).bOut = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class BurntOut : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Burnt Out"); + Description.SetDefault("You've been burnt out and your guardians are less effective"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).bOut = true; + } + } +} diff --git a/Buffs/Cadence.cs b/Buffs/Cadence.cs index 49416acb72..7710ca0c10 100644 --- a/Buffs/Cadence.cs +++ b/Buffs/Cadence.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Cadence : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cadance"); - Description.SetDefault("Your heart is pure"); - 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).cadence = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Cadence : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cadance"); + Description.SetDefault("Your heart is pure"); + 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).cadence = true; + } + } +} diff --git a/Buffs/Calamari.cs b/Buffs/Calamari.cs index fb94ae58df..6adccbd02b 100644 --- a/Buffs/Calamari.cs +++ b/Buffs/Calamari.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Calamari : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Calamari"); - Description.SetDefault("The squid 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("Calamari")] > 0) - { - modPlayer.calamari = true; - } - if (!modPlayer.calamari) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Calamari : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Calamari"); + Description.SetDefault("The squid 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("Calamari")] > 0) + { + modPlayer.calamari = true; + } + if (!modPlayer.calamari) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/CalamitasEyes.cs b/Buffs/CalamitasEyes.cs index 612c8c140f..b058156349 100644 --- a/Buffs/CalamitasEyes.cs +++ b/Buffs/CalamitasEyes.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class CalamitasEyes : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Blighted Eyes"); - Description.SetDefault("Calamitas and her brothers 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("Calamitamini")] > 0) - { - modPlayer.cEyes = true; - } - if (!modPlayer.cEyes) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class CalamitasEyes : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Blighted Eyes"); + Description.SetDefault("Calamitas and her brothers 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("Calamitamini")] > 0) + { + modPlayer.cEyes = true; + } + if (!modPlayer.cEyes) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 060b88bab3..0f907c770a 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -1,79 +1,79 @@ -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.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Buffs -{ - public class CalamityGlobalBuff : GlobalBuff - { - public override void Update(int type, Player player, ref int buffIndex) - { - if (type == BuffID.Shine) - { - player.GetModPlayer(mod).shine = true; - } - else if (type == BuffID.IceBarrier) - { - player.endurance -= 0.1f; - } - else if (type == BuffID.ObsidianSkin) - { - player.lavaMax += 420; - } - else if (type == BuffID.Rage) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; - } - else if (type == BuffID.Wrath) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - } - else if (type == BuffID.WellFed) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; - } - else if (type >= BuffID.NebulaUpDmg1 && type <= BuffID.NebulaUpDmg3) - { - float nebulaDamage = 0.075f * (float)player.nebulaLevelDamage; //7.5% to 22.5% - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += nebulaDamage; - player.meleeDamage -= nebulaDamage; - player.rangedDamage -= nebulaDamage; - player.magicDamage -= nebulaDamage; - player.minionDamage -= nebulaDamage; - } - else if (type >= BuffID.NebulaUpLife1 && type <= BuffID.NebulaUpLife3) - { - player.lifeRegen -= 5 * player.nebulaLevelLife; //10 to 30 changed to 5 to 15 - } - else if (type == BuffID.Warmth) - { - player.buffImmune[mod.BuffType("GlacialState")] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Chilled] = true; - } - } - - public override void ModifyBuffTip(int type, ref string tip, ref int rare) - { - if (type == BuffID.NebulaUpDmg1) - tip = "7.5% increased damage"; - else if (type == BuffID.NebulaUpDmg2) - tip = "15% increased damage"; - else if (type == BuffID.NebulaUpDmg3) - tip = "22.5% increased damage"; - else if (type == BuffID.WeaponImbueVenom || type == BuffID.WeaponImbueCursedFlames || type == BuffID.WeaponImbueFire || type == BuffID.WeaponImbueGold || - type == BuffID.WeaponImbueIchor || type == BuffID.WeaponImbueNanites || type == BuffID.WeaponImbueConfetti || type == BuffID.WeaponImbuePoison) - tip = "Rogue and " + tip; - } - } -} +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.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Buffs +{ + public class CalamityGlobalBuff : GlobalBuff + { + public override void Update(int type, Player player, ref int buffIndex) + { + if (type == BuffID.Shine) + { + player.GetModPlayer(mod).shine = true; + } + else if (type == BuffID.IceBarrier) + { + player.endurance -= 0.1f; + } + else if (type == BuffID.ObsidianSkin) + { + player.lavaMax += 420; + } + else if (type == BuffID.Rage) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; + } + else if (type == BuffID.Wrath) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + } + else if (type == BuffID.WellFed) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; + } + else if (type >= BuffID.NebulaUpDmg1 && type <= BuffID.NebulaUpDmg3) + { + float nebulaDamage = 0.075f * (float)player.nebulaLevelDamage; //7.5% to 22.5% + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += nebulaDamage; + player.meleeDamage -= nebulaDamage; + player.rangedDamage -= nebulaDamage; + player.magicDamage -= nebulaDamage; + player.minionDamage -= nebulaDamage; + } + else if (type >= BuffID.NebulaUpLife1 && type <= BuffID.NebulaUpLife3) + { + player.lifeRegen -= 5 * player.nebulaLevelLife; //10 to 30 changed to 5 to 15 + } + else if (type == BuffID.Warmth) + { + player.buffImmune[mod.BuffType("GlacialState")] = true; + player.buffImmune[BuffID.Frozen] = true; + player.buffImmune[BuffID.Chilled] = true; + } + } + + public override void ModifyBuffTip(int type, ref string tip, ref int rare) + { + if (type == BuffID.NebulaUpDmg1) + tip = "7.5% increased damage"; + else if (type == BuffID.NebulaUpDmg2) + tip = "15% increased damage"; + else if (type == BuffID.NebulaUpDmg3) + tip = "22.5% increased damage"; + else if (type == BuffID.WeaponImbueVenom || type == BuffID.WeaponImbueCursedFlames || type == BuffID.WeaponImbueFire || type == BuffID.WeaponImbueGold || + type == BuffID.WeaponImbueIchor || type == BuffID.WeaponImbueNanites || type == BuffID.WeaponImbueConfetti || type == BuffID.WeaponImbuePoison) + tip = "Rogue and " + tip; + } + } +} diff --git a/Buffs/CalciumBuff.cs b/Buffs/CalciumBuff.cs index c40e98a54d..8fd626eda3 100644 --- a/Buffs/CalciumBuff.cs +++ b/Buffs/CalciumBuff.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).calcium = true; } } -} \ No newline at end of file +} diff --git a/Buffs/CeaselessHunger.cs b/Buffs/CeaselessHunger.cs index 173c730e03..401ecff88b 100644 --- a/Buffs/CeaselessHunger.cs +++ b/Buffs/CeaselessHunger.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).ceaselessHunger = true; } } -} \ No newline at end of file +} diff --git a/Buffs/ChaosCandle.cs b/Buffs/ChaosCandle.cs index 77817dd041..2fcae4b1c4 100644 --- a/Buffs/ChaosCandle.cs +++ b/Buffs/ChaosCandle.cs @@ -1,29 +1,29 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class ChaosCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Chaos Candle"); - Description.SetDefault("Spawn rates around the candle are boosted!"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).chaosCandle = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ChaosCandle : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Chaos Candle"); + Description.SetDefault("Spawn rates around the candle are boosted!"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).chaosCandle = true; + } + } +} diff --git a/Buffs/ChaosSpirit.cs b/Buffs/ChaosSpirit.cs index e3083e207c..e20c4f1e7a 100644 --- a/Buffs/ChaosSpirit.cs +++ b/Buffs/ChaosSpirit.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class ChaosSpirit : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Chaos Spirit"); - Description.SetDefault("The chaos spirit 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("ChaosSpirit")] > 0) - { - modPlayer.cSpirit = true; - } - if (!modPlayer.cSpirit) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class ChaosSpirit : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Chaos Spirit"); + Description.SetDefault("The chaos spirit 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("ChaosSpirit")] > 0) + { + modPlayer.cSpirit = true; + } + if (!modPlayer.cSpirit) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/ChibiiBuff.cs b/Buffs/ChibiiBuff.cs index 8096a1c82e..17694ab1f1 100644 --- a/Buffs/ChibiiBuff.cs +++ b/Buffs/ChibiiBuff.cs @@ -1,30 +1,30 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class ChibiiBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Chibii Devourer"); - Description.SetDefault("What? Were you expecting someone else?"); - Main.buffNoTimeDisplay[Type] = true; - Main.vanityPet[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.buffTime[buffIndex] = 18000; - - player.GetModPlayer(mod).chibii = true; - - bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("ChibiiDoggo")] <= 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("ChibiiDoggo"), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } -} +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class ChibiiBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Chibii Devourer"); + Description.SetDefault("What? Were you expecting someone else?"); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + + player.GetModPlayer(mod).chibii = true; + + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("ChibiiDoggo")] <= 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("ChibiiDoggo"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/CloudyWaifu.cs b/Buffs/CloudyWaifu.cs index 7bee258c7f..30e986a881 100644 --- a/Buffs/CloudyWaifu.cs +++ b/Buffs/CloudyWaifu.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class CloudyWaifu : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cloud Elemental"); - Description.SetDefault("The cloud elemental 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("CloudyWaifu")] > 0) - { - modPlayer.cWaifu = true; - } - if (!modPlayer.cWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class CloudyWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cloud Elemental"); + Description.SetDefault("The cloud elemental 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("CloudyWaifu")] > 0) + { + modPlayer.cWaifu = true; + } + if (!modPlayer.cWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Corroslime.cs b/Buffs/Corroslime.cs index 4fbb162b47..ed0174f8c9 100644 --- a/Buffs/Corroslime.cs +++ b/Buffs/Corroslime.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Corroslime : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Corroslime"); - Description.SetDefault("The corroslime 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("Corroslime")] > 0) - { - modPlayer.cSlime = true; - } - if (!modPlayer.cSlime) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Corroslime : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Corroslime"); + Description.SetDefault("The corroslime 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("Corroslime")] > 0) + { + modPlayer.cSlime = true; + } + if (!modPlayer.cSlime) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/CosmicEnergy.cs b/Buffs/CosmicEnergy.cs index e6ca6a4fb5..847377a279 100644 --- a/Buffs/CosmicEnergy.cs +++ b/Buffs/CosmicEnergy.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class CosmicEnergy : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cosmic Energy"); - Description.SetDefault("The cosmic energy 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("CosmicEnergy")] > 0) - { - modPlayer.cEnergy = true; - } - if (!modPlayer.cEnergy) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class CosmicEnergy : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cosmic Energy"); + Description.SetDefault("The cosmic energy 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("CosmicEnergy")] > 0) + { + modPlayer.cEnergy = true; + } + if (!modPlayer.cEnergy) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/CosmicFreeze.cs b/Buffs/CosmicFreeze.cs index d3f9a13447..d32a2448f4 100644 --- a/Buffs/CosmicFreeze.cs +++ b/Buffs/CosmicFreeze.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class CosmicFreeze : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cosmic Freeze"); - Description.SetDefault("You feel as cold as the empty expanse of outer space"); - 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).cFreeze = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class CosmicFreeze : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cosmic Freeze"); + Description.SetDefault("You feel as cold as the empty expanse of outer space"); + 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).cFreeze = true; + } + } +} diff --git a/Buffs/Cosmilamp.cs b/Buffs/Cosmilamp.cs index 49f4b7eb2a..c822294d69 100644 --- a/Buffs/Cosmilamp.cs +++ b/Buffs/Cosmilamp.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Cosmilamp : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cosmilamp"); - Description.SetDefault("The cosmilamp 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("Cosmilamp")] > 0) - { - modPlayer.cLamp = true; - } - if (!modPlayer.cLamp) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Cosmilamp : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cosmilamp"); + Description.SetDefault("The cosmilamp 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("Cosmilamp")] > 0) + { + modPlayer.cLamp = true; + } + if (!modPlayer.cLamp) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Crimslime.cs b/Buffs/Crimslime.cs index 59e06d7ef5..68fa6beb2b 100644 --- a/Buffs/Crimslime.cs +++ b/Buffs/Crimslime.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Crimslime : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Crimslime"); - Description.SetDefault("The crimslime 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("Crimslime")] > 0) - { - modPlayer.cSlime2 = true; - } - if (!modPlayer.cSlime2) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Crimslime : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Crimslime"); + Description.SetDefault("The crimslime 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("Crimslime")] > 0) + { + modPlayer.cSlime2 = true; + } + if (!modPlayer.cSlime2) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/CrushDepth.cs b/Buffs/CrushDepth.cs index cc0fa992b0..3346317a77 100644 --- a/Buffs/CrushDepth.cs +++ b/Buffs/CrushDepth.cs @@ -1,32 +1,32 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class CrushDepth : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Crush Depth"); - Description.SetDefault("Aquatic pressure"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).cDepth = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).cDepth = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class CrushDepth : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Crush Depth"); + Description.SetDefault("Aquatic pressure"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).cDepth = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).cDepth = true; + } + } +} diff --git a/Buffs/DaedalusCrystal.cs b/Buffs/DaedalusCrystal.cs index 9cc54e35a7..be474d3a40 100644 --- a/Buffs/DaedalusCrystal.cs +++ b/Buffs/DaedalusCrystal.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class DaedalusCrystal : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Daedalus Crystal"); - Description.SetDefault("The daedalus crystal 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("DaedalusCrystal")] > 0) - { - modPlayer.dCrystal = true; - } - if (!modPlayer.dCrystal) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class DaedalusCrystal : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Daedalus Crystal"); + Description.SetDefault("The daedalus crystal 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("DaedalusCrystal")] > 0) + { + modPlayer.dCrystal = true; + } + if (!modPlayer.dCrystal) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/DankCreeper.cs b/Buffs/DankCreeper.cs index ee8ae2bc74..055ac2b964 100644 --- a/Buffs/DankCreeper.cs +++ b/Buffs/DankCreeper.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class DankCreeper : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Dank Creeper"); - Description.SetDefault("The dank creeper 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("DankCreeper")] > 0) - { - modPlayer.dCreeper = true; - } - if (!modPlayer.dCreeper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class DankCreeper : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Dank Creeper"); + Description.SetDefault("The dank creeper 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("DankCreeper")] > 0) + { + modPlayer.dCreeper = true; + } + if (!modPlayer.dCreeper) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/DannyDevito.cs b/Buffs/DannyDevito.cs index a29a46cb9c..9624ca525d 100644 --- a/Buffs/DannyDevito.cs +++ b/Buffs/DannyDevito.cs @@ -1,30 +1,30 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; - -namespace CalamityMod.Buffs -{ - public class DannyDevito : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Danny Devito"); - Description.SetDefault("The trash man is following 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).trashMan = true; - bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("DannyDevito")] <= 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("DannyDevito"), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; + +namespace CalamityMod.Buffs +{ + public class DannyDevito : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Danny Devito"); + Description.SetDefault("The trash man is following 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).trashMan = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("DannyDevito")] <= 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("DannyDevito"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/DemonFlames.cs b/Buffs/DemonFlames.cs index 7f62a95dc1..cf46cbe3d8 100644 --- a/Buffs/DemonFlames.cs +++ b/Buffs/DemonFlames.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class DemonFlames : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Demon Flames"); - Description.SetDefault("Another burning debuff"); - 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).dFlames = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class DemonFlames : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Demon Flames"); + Description.SetDefault("Another burning debuff"); + 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).dFlames = true; + } + } +} diff --git a/Buffs/DraconicSurgeBuff.cs b/Buffs/DraconicSurgeBuff.cs index e85320e2df..bae7662749 100644 --- a/Buffs/DraconicSurgeBuff.cs +++ b/Buffs/DraconicSurgeBuff.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).draconicSurge = true; } } -} \ No newline at end of file +} diff --git a/Buffs/DrewsSandyWaifu.cs b/Buffs/DrewsSandyWaifu.cs index bb247ae784..875ff491cd 100644 --- a/Buffs/DrewsSandyWaifu.cs +++ b/Buffs/DrewsSandyWaifu.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class DrewsSandyWaifu : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Rare Sand Elemental"); - Description.SetDefault("The sand elemental will heal 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("DrewsSandyWaifu")] > 0) - { - modPlayer.dWaifu = true; - } - if (!modPlayer.dWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class DrewsSandyWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Rare Sand Elemental"); + Description.SetDefault("The sand elemental will heal 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("DrewsSandyWaifu")] > 0) + { + modPlayer.dWaifu = true; + } + if (!modPlayer.dWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/ElementalAxe.cs b/Buffs/ElementalAxe.cs index e34c33d37d..cae407c0b8 100644 --- a/Buffs/ElementalAxe.cs +++ b/Buffs/ElementalAxe.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class ElementalAxe : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Elemental Axe"); - Description.SetDefault("The elemental axe 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("ElementalAxe")] > 0) - { - modPlayer.eAxe = true; - } - if (!modPlayer.eAxe) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class ElementalAxe : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Elemental Axe"); + Description.SetDefault("The elemental axe 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("ElementalAxe")] > 0) + { + modPlayer.eAxe = true; + } + if (!modPlayer.eAxe) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/ExoFreeze.cs b/Buffs/ExoFreeze.cs index 2e1371387c..aa4c05a873 100644 --- a/Buffs/ExoFreeze.cs +++ b/Buffs/ExoFreeze.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class ExoFreeze : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Exo Freeze"); - Description.SetDefault("Cannot move"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).eFreeze = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ExoFreeze : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Exo Freeze"); + Description.SetDefault("Cannot move"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).eFreeze = true; + } + } +} diff --git a/Buffs/ExtremeGrav.cs b/Buffs/ExtremeGrav.cs index 66b2e1b476..73d61aaa60 100644 --- a/Buffs/ExtremeGrav.cs +++ b/Buffs/ExtremeGrav.cs @@ -1,29 +1,29 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class ExtremeGrav : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Extreme Gravity"); - Description.SetDefault("Your wing time is reduced by 66%, infinite flight is disabled"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).eGrav = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ExtremeGrav : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Extreme Gravity"); + Description.SetDefault("Your wing time is reduced by 66%, infinite flight is disabled"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).eGrav = true; + } + } +} diff --git a/Buffs/ExtremeGravity.cs b/Buffs/ExtremeGravity.cs index a7e44cbca8..84794a034f 100644 --- a/Buffs/ExtremeGravity.cs +++ b/Buffs/ExtremeGravity.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class ExtremeGravity : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Icarus' Folly"); - Description.SetDefault("Your wing time is reduced by 75%, infinite flight is disabled"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).eGravity = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ExtremeGravity : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Icarus' Folly"); + Description.SetDefault("Your wing time is reduced by 75%, infinite flight is disabled"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).eGravity = true; + } + } +} diff --git a/Buffs/Fab.cs b/Buffs/Fab.cs index f6e0b8e306..2fe3003dae 100644 --- a/Buffs/Fab.cs +++ b/Buffs/Fab.cs @@ -1,24 +1,24 @@ -using Terraria; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Buffs -{ - class Fab : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Alicorn"); - Description.SetDefault("You beat DoG while drunk, you are truly fabulous!"); - 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).fab = true; - } - } -} +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Buffs +{ + class Fab : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Alicorn"); + Description.SetDefault("You beat DoG while drunk, you are truly fabulous!"); + 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).fab = true; + } + } +} diff --git a/Buffs/Fabsol/BloodyMary.cs b/Buffs/Fabsol/BloodyMary.cs index e3d608134a..9f5a319b6b 100644 --- a/Buffs/Fabsol/BloodyMary.cs +++ b/Buffs/Fabsol/BloodyMary.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class BloodyMary : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Bloody Mary"); - Description.SetDefault("Damage, critical strike chance, movement speed, and melee speed boosted during a Blood Moon, life regen and defense reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).bloodyMary = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class BloodyMary : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Bloody Mary"); + Description.SetDefault("Damage, critical strike chance, movement speed, and melee speed boosted during a Blood Moon, life regen and defense reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).bloodyMary = true; + } + } +} diff --git a/Buffs/Fabsol/BlueSpeedCandle.cs b/Buffs/Fabsol/BlueSpeedCandle.cs index 899566fab4..8fa4b35ff1 100644 --- a/Buffs/Fabsol/BlueSpeedCandle.cs +++ b/Buffs/Fabsol/BlueSpeedCandle.cs @@ -1,29 +1,29 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class BlueSpeedCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Limber"); - Description.SetDefault("The floating flame seems to uplift your very spirit"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).blueCandle = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class BlueSpeedCandle : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Limber"); + Description.SetDefault("The floating flame seems to uplift your very spirit"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).blueCandle = true; + } + } +} diff --git a/Buffs/Fabsol/CaribbeanRum.cs b/Buffs/Fabsol/CaribbeanRum.cs index 3ec5ff0803..0313c2d388 100644 --- a/Buffs/Fabsol/CaribbeanRum.cs +++ b/Buffs/Fabsol/CaribbeanRum.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class CaribbeanRum : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Caribbean Rum"); - Description.SetDefault("Life regen, movement speed, and wing flight time boosted, you are floaty and defense is reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).caribbeanRum = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class CaribbeanRum : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Caribbean Rum"); + Description.SetDefault("Life regen, movement speed, and wing flight time boosted, you are floaty and defense is reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).caribbeanRum = true; + } + } +} diff --git a/Buffs/Fabsol/CinnamonRoll.cs b/Buffs/Fabsol/CinnamonRoll.cs index 692918d3d5..91e263e5a6 100644 --- a/Buffs/Fabsol/CinnamonRoll.cs +++ b/Buffs/Fabsol/CinnamonRoll.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class CinnamonRoll : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Cinnamon Roll"); - Description.SetDefault("Mana regen rate and fire weapon damage boosted, defense reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).cinnamonRoll = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class CinnamonRoll : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Cinnamon Roll"); + Description.SetDefault("Mana regen rate and fire weapon damage boosted, defense reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).cinnamonRoll = true; + } + } +} diff --git a/Buffs/Fabsol/EvergreenGin.cs b/Buffs/Fabsol/EvergreenGin.cs index de2c6d61a4..7ecb7c6930 100644 --- a/Buffs/Fabsol/EvergreenGin.cs +++ b/Buffs/Fabsol/EvergreenGin.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class EvergreenGin : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Evergreen Gin"); - Description.SetDefault("Nature-based weapon damage and damage reduction boosted, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).evergreenGin = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class EvergreenGin : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Evergreen Gin"); + Description.SetDefault("Nature-based weapon damage and damage reduction boosted, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).evergreenGin = true; + } + } +} diff --git a/Buffs/Fabsol/FabsolVodka.cs b/Buffs/Fabsol/FabsolVodka.cs index 1c4607810e..6d697cbb0f 100644 --- a/Buffs/Fabsol/FabsolVodka.cs +++ b/Buffs/Fabsol/FabsolVodka.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class FabsolVodka : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Fab"); - Description.SetDefault("You feel fabulous"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).fabsolVodka = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class FabsolVodka : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fab"); + Description.SetDefault("You feel fabulous"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).fabsolVodka = true; + } + } +} diff --git a/Buffs/Fabsol/Fireball.cs b/Buffs/Fabsol/Fireball.cs index 769199532c..7436e01418 100644 --- a/Buffs/Fabsol/Fireball.cs +++ b/Buffs/Fabsol/Fireball.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class Fireball : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Fireball"); - Description.SetDefault("Fire weapon damage boosted, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).fireball = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class Fireball : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fireball"); + Description.SetDefault("Fire weapon damage boosted, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).fireball = true; + } + } +} diff --git a/Buffs/Fabsol/Margarita.cs b/Buffs/Fabsol/Margarita.cs index 542f4b9660..4b8fda2776 100644 --- a/Buffs/Fabsol/Margarita.cs +++ b/Buffs/Fabsol/Margarita.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class Margarita : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Margarita"); - Description.SetDefault("Immunity to most debuffs, defense and life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).margarita = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class Margarita : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Margarita"); + Description.SetDefault("Immunity to most debuffs, defense and life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).margarita = true; + } + } +} diff --git a/Buffs/Fabsol/Moonshine.cs b/Buffs/Fabsol/Moonshine.cs index 48a70dec5a..ea69bde5bb 100644 --- a/Buffs/Fabsol/Moonshine.cs +++ b/Buffs/Fabsol/Moonshine.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class Moonshine : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Moonshine"); - Description.SetDefault("Defense and damage reduction boosted, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).moonshine = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class Moonshine : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Moonshine"); + Description.SetDefault("Defense and damage reduction boosted, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).moonshine = true; + } + } +} diff --git a/Buffs/Fabsol/MoscowMule.cs b/Buffs/Fabsol/MoscowMule.cs index 5b1cbdaa4b..c76e545df0 100644 --- a/Buffs/Fabsol/MoscowMule.cs +++ b/Buffs/Fabsol/MoscowMule.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class MoscowMule : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Moscow Mule"); - Description.SetDefault("Damage, critical strike chance, and knockback boosted, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).moscowMule = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class MoscowMule : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Moscow Mule"); + Description.SetDefault("Damage, critical strike chance, and knockback boosted, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).moscowMule = true; + } + } +} diff --git a/Buffs/Fabsol/PinkHealthCandle.cs b/Buffs/Fabsol/PinkHealthCandle.cs index a54c4da03e..1416d404e9 100644 --- a/Buffs/Fabsol/PinkHealthCandle.cs +++ b/Buffs/Fabsol/PinkHealthCandle.cs @@ -1,29 +1,29 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class PinkHealthCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Vigor"); - Description.SetDefault("Its brilliant light suffuses those nearby with hope"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).pinkCandle = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class PinkHealthCandle : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Vigor"); + Description.SetDefault("Its brilliant light suffuses those nearby with hope"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).pinkCandle = true; + } + } +} diff --git a/Buffs/Fabsol/PurpleDefenseCandle.cs b/Buffs/Fabsol/PurpleDefenseCandle.cs index bd7ff40153..817ad942e4 100644 --- a/Buffs/Fabsol/PurpleDefenseCandle.cs +++ b/Buffs/Fabsol/PurpleDefenseCandle.cs @@ -1,29 +1,29 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class PurpleDefenseCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Adamant Will"); - Description.SetDefault("Neither rain nor wind can snuff its undying flame"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).purpleCandle = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class PurpleDefenseCandle : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Adamant Will"); + Description.SetDefault("Neither rain nor wind can snuff its undying flame"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).purpleCandle = true; + } + } +} diff --git a/Buffs/Fabsol/RedWine.cs b/Buffs/Fabsol/RedWine.cs index 8c5831ee7a..fd8c99ca7a 100644 --- a/Buffs/Fabsol/RedWine.cs +++ b/Buffs/Fabsol/RedWine.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class RedWine : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Red Wine"); - Description.SetDefault("Life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).redWine = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class RedWine : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Red Wine"); + Description.SetDefault("Life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).redWine = true; + } + } +} diff --git a/Buffs/Fabsol/Rum.cs b/Buffs/Fabsol/Rum.cs index e5c24720f2..93d1261687 100644 --- a/Buffs/Fabsol/Rum.cs +++ b/Buffs/Fabsol/Rum.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class Rum : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Rum"); - Description.SetDefault("Movement speed and life regen boosted, defense reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).rum = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class Rum : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Rum"); + Description.SetDefault("Movement speed and life regen boosted, defense reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).rum = true; + } + } +} diff --git a/Buffs/Fabsol/Screwdriver.cs b/Buffs/Fabsol/Screwdriver.cs index 109346929b..a5044dd32b 100644 --- a/Buffs/Fabsol/Screwdriver.cs +++ b/Buffs/Fabsol/Screwdriver.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class Screwdriver : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Screwdriver"); - Description.SetDefault("Piercing projectile damage boosted, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).screwdriver = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class Screwdriver : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Screwdriver"); + Description.SetDefault("Piercing projectile damage boosted, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).screwdriver = true; + } + } +} diff --git a/Buffs/Fabsol/Tequila.cs b/Buffs/Fabsol/Tequila.cs index 14a786a82f..58b1589905 100644 --- a/Buffs/Fabsol/Tequila.cs +++ b/Buffs/Fabsol/Tequila.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class Tequila : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Tequila"); - Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).tequila = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class Tequila : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tequila"); + Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).tequila = true; + } + } +} diff --git a/Buffs/Fabsol/TequilaSunrise.cs b/Buffs/Fabsol/TequilaSunrise.cs index 7e5f88d945..70a9a6aadb 100644 --- a/Buffs/Fabsol/TequilaSunrise.cs +++ b/Buffs/Fabsol/TequilaSunrise.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class TequilaSunrise : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Tequila Sunrise"); - Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).tequilaSunrise = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class TequilaSunrise : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tequila Sunrise"); + Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).tequilaSunrise = true; + } + } +} diff --git a/Buffs/Fabsol/Trippy.cs b/Buffs/Fabsol/Trippy.cs index 17a9cfaf69..bce44986ec 100644 --- a/Buffs/Fabsol/Trippy.cs +++ b/Buffs/Fabsol/Trippy.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class Trippy : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Trippy"); - Description.SetDefault("You see the world for what it truly is...and you also have a 50% increase to all 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).trippy = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class Trippy : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Trippy"); + Description.SetDefault("You see the world for what it truly is...and you also have a 50% increase to all 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).trippy = true; + } + } +} diff --git a/Buffs/Fabsol/Vodka.cs b/Buffs/Fabsol/Vodka.cs index 000840da4d..6186ffe3b2 100644 --- a/Buffs/Fabsol/Vodka.cs +++ b/Buffs/Fabsol/Vodka.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class Vodka : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Vodka"); - Description.SetDefault("Damage and critical stike chance boosted, defense and life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).vodka = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class Vodka : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Vodka"); + Description.SetDefault("Damage and critical stike chance boosted, defense and life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).vodka = true; + } + } +} diff --git a/Buffs/Fabsol/Whiskey.cs b/Buffs/Fabsol/Whiskey.cs index fbb02965a1..9de9d31791 100644 --- a/Buffs/Fabsol/Whiskey.cs +++ b/Buffs/Fabsol/Whiskey.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class Whiskey : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Whiskey"); - Description.SetDefault("Damage, critical strike chance, and knockback boosted, defense reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).whiskey = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class Whiskey : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Whiskey"); + Description.SetDefault("Damage, critical strike chance, and knockback boosted, defense reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).whiskey = true; + } + } +} diff --git a/Buffs/Fabsol/WhiteWine.cs b/Buffs/Fabsol/WhiteWine.cs index 34eab1bc25..3f9e2fce7b 100644 --- a/Buffs/Fabsol/WhiteWine.cs +++ b/Buffs/Fabsol/WhiteWine.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class WhiteWine : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("White Wine"); - Description.SetDefault("Magic damage boosted, life regen and defense reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).whiteWine = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class WhiteWine : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("White Wine"); + Description.SetDefault("Magic damage boosted, life regen and defense reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).whiteWine = true; + } + } +} diff --git a/Buffs/Fabsol/YellowDamageCandle.cs b/Buffs/Fabsol/YellowDamageCandle.cs index 17e4532ba6..beed7a59a3 100644 --- a/Buffs/Fabsol/YellowDamageCandle.cs +++ b/Buffs/Fabsol/YellowDamageCandle.cs @@ -1,34 +1,34 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Fabsol -{ - public class YellowDamageCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Spite"); - Description.SetDefault("Its hateful glow flickers with ire"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).yellowCandle = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).yellowCandle = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Fabsol +{ + public class YellowDamageCandle : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Spite"); + Description.SetDefault("Its hateful glow flickers with ire"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).yellowCandle = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).yellowCandle = true; + } + } +} diff --git a/Buffs/FishAlert.cs b/Buffs/FishAlert.cs index 518948b6c9..6c6fe83c32 100644 --- a/Buffs/FishAlert.cs +++ b/Buffs/FishAlert.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class FishAlert : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Fish Alert"); - Description.SetDefault("The abyssal creatures have spotted you!"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).fishAlert = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class FishAlert : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fish Alert"); + Description.SetDefault("The abyssal creatures have spotted you!"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).fishAlert = true; + } + } +} diff --git a/Buffs/Fox.cs b/Buffs/Fox.cs index c6baa121a5..62dba5ded6 100644 --- a/Buffs/Fox.cs +++ b/Buffs/Fox.cs @@ -1,31 +1,31 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Fox : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Fox Pet"); - Description.SetDefault("Fox Pet? FOX PET"); - Main.buffNoTimeDisplay[Type] = true; - Main.vanityPet[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.buffTime[buffIndex] = 18000; - player.GetModPlayer(mod).fox = true; - bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Fox")] <= 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("Fox"), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Fox : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fox Pet"); + Description.SetDefault("Fox Pet? FOX PET"); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.GetModPlayer(mod).fox = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Fox")] <= 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("Fox"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/FungalClump.cs b/Buffs/FungalClump.cs index 1a28870815..30d59cb0da 100644 --- a/Buffs/FungalClump.cs +++ b/Buffs/FungalClump.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class FungalClump : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Fungal Clump"); - Description.SetDefault("The fungal clump 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("FungalClump")] > 0) - { - modPlayer.fClump = true; - } - if (!modPlayer.fClump) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class FungalClump : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Fungal Clump"); + Description.SetDefault("The fungal clump 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("FungalClump")] > 0) + { + modPlayer.fClump = true; + } + if (!modPlayer.fClump) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/GlacialState.cs b/Buffs/GlacialState.cs index b0f7c43111..835fa887fd 100644 --- a/Buffs/GlacialState.cs +++ b/Buffs/GlacialState.cs @@ -1,32 +1,32 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class GlacialState : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Glacial State"); - Description.SetDefault("Cannot move and defense is shattered"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).gState = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).gState = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class GlacialState : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Glacial State"); + Description.SetDefault("Cannot move and defense is shattered"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).gState = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).gState = true; + } + } +} diff --git a/Buffs/GodSlayerCooldown.cs b/Buffs/GodSlayerCooldown.cs index 00927198f9..a29f94a31d 100644 --- a/Buffs/GodSlayerCooldown.cs +++ b/Buffs/GodSlayerCooldown.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class GodSlayerCooldown : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("God Slayer Cooldown"); - Description.SetDefault("10% increase to all damage; godslayer effect is recharging"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).godSlayerCooldown = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class GodSlayerCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("God Slayer Cooldown"); + Description.SetDefault("10% increase to all damage; godslayer effect is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).godSlayerCooldown = true; + } + } +} diff --git a/Buffs/GodSlayerInferno.cs b/Buffs/GodSlayerInferno.cs index dab251db7b..455c7a940f 100644 --- a/Buffs/GodSlayerInferno.cs +++ b/Buffs/GodSlayerInferno.cs @@ -1,32 +1,32 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class GodSlayerInferno : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("God Slayer Inferno"); - Description.SetDefault("Your flesh is burning off"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).gsInferno = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).gsInferno = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class GodSlayerInferno : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("God Slayer Inferno"); + Description.SetDefault("Your flesh is burning off"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).gsInferno = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).gsInferno = true; + } + } +} diff --git a/Buffs/GravityNormalizerBuff.cs b/Buffs/GravityNormalizerBuff.cs index f28b533f8d..acb26ed38c 100644 --- a/Buffs/GravityNormalizerBuff.cs +++ b/Buffs/GravityNormalizerBuff.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).gravityNormalizer = true; } } -} \ No newline at end of file +} diff --git a/Buffs/GraxDefense.cs b/Buffs/GraxDefense.cs index ae8f9634b1..604e075354 100644 --- a/Buffs/GraxDefense.cs +++ b/Buffs/GraxDefense.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class GraxDefense : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Grax Boost"); - Description.SetDefault("Your defenses and muscles are strong"); - 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).graxDefense = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class GraxDefense : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Grax Boost"); + Description.SetDefault("Your defenses and muscles are strong"); + 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).graxDefense = true; + } + } +} diff --git a/Buffs/GuardianDefense.cs b/Buffs/GuardianDefense.cs index ae37553273..106ad81400 100644 --- a/Buffs/GuardianDefense.cs +++ b/Buffs/GuardianDefense.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class GuardianDefense : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Defensive Guardian"); - Description.SetDefault("The defender 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("MiniGuardianDefense")] > 0) - { - modPlayer.gDefense = true; - } - if (!modPlayer.gDefense) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class GuardianDefense : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Defensive Guardian"); + Description.SetDefault("The defender 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("MiniGuardianDefense")] > 0) + { + modPlayer.gDefense = true; + } + if (!modPlayer.gDefense) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/GuardianHealer.cs b/Buffs/GuardianHealer.cs index 4282cb716d..6ad6b8a6b5 100644 --- a/Buffs/GuardianHealer.cs +++ b/Buffs/GuardianHealer.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class GuardianHealer : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Healer Guardian"); - Description.SetDefault("The guardian will heal 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("MiniGuardianHealer")] > 0) - { - modPlayer.gHealer = true; - } - if (!modPlayer.gHealer) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class GuardianHealer : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Healer Guardian"); + Description.SetDefault("The guardian will heal 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("MiniGuardianHealer")] > 0) + { + modPlayer.gHealer = true; + } + if (!modPlayer.gHealer) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/GuardianOffense.cs b/Buffs/GuardianOffense.cs index f7145dfe9a..523ec30ce2 100644 --- a/Buffs/GuardianOffense.cs +++ b/Buffs/GuardianOffense.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class GuardianOffense : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Offensive Guardian"); - Description.SetDefault("The attacker 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("MiniGuardianAttack")] > 0) - { - modPlayer.gOffense = true; - } - if (!modPlayer.gOffense) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class GuardianOffense : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Offensive Guardian"); + Description.SetDefault("The attacker 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("MiniGuardianAttack")] > 0) + { + modPlayer.gOffense = true; + } + if (!modPlayer.gOffense) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/HeartAttack.cs b/Buffs/HeartAttack.cs index 24d1df3c08..7b14b445da 100644 --- a/Buffs/HeartAttack.cs +++ b/Buffs/HeartAttack.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class HeartAttack : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Heart Attack"); - Description.SetDefault("You survived a heart attack. Boosts max life."); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).hAttack = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class HeartAttack : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Heart Attack"); + Description.SetDefault("You survived a heart attack. Boosts max life."); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).hAttack = true; + } + } +} diff --git a/Buffs/Herring.cs b/Buffs/Herring.cs index 19e8c28aa7..cfbf7c8620 100644 --- a/Buffs/Herring.cs +++ b/Buffs/Herring.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Herring : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Herring"); - Description.SetDefault("The herring 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("Herring")] > 0) - { - modPlayer.herring = true; - } - if (!modPlayer.herring) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Herring : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Herring"); + Description.SetDefault("The herring 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("Herring")] > 0) + { + modPlayer.herring = true; + } + if (!modPlayer.herring) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/HolyInferno.cs b/Buffs/HolyInferno.cs index 58cc4a2333..f7e27bbeda 100644 --- a/Buffs/HolyInferno.cs +++ b/Buffs/HolyInferno.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class HolyInferno : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Holy Inferno"); - Description.SetDefault("You've gone too far from the Profaned Goddess!"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).hInferno = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class HolyInferno : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Holy Inferno"); + Description.SetDefault("You've gone too far from the Profaned Goddess!"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).hInferno = true; + } + } +} diff --git a/Buffs/HolyLight.cs b/Buffs/HolyLight.cs index d0121a9102..da6d7a8f73 100644 --- a/Buffs/HolyLight.cs +++ b/Buffs/HolyLight.cs @@ -1,32 +1,32 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class HolyLight : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Holy Flames"); - Description.SetDefault("Dissolving from holy light"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).hFlames = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).hFlames = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class HolyLight : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Holy Flames"); + Description.SetDefault("Dissolving from holy light"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).hFlames = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).hFlames = true; + } + } +} diff --git a/Buffs/HolyWrathBuff.cs b/Buffs/HolyWrathBuff.cs index c4783053a5..8d4733985d 100644 --- a/Buffs/HolyWrathBuff.cs +++ b/Buffs/HolyWrathBuff.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).holyWrath = true; } } -} \ No newline at end of file +} diff --git a/Buffs/Horror.cs b/Buffs/Horror.cs index 05628eff00..6458282cc4 100644 --- a/Buffs/Horror.cs +++ b/Buffs/Horror.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Horror : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Horror"); - Description.SetDefault("The horror..."); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).horror = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Horror : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Horror"); + Description.SetDefault("The horror..."); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).horror = true; + } + } +} diff --git a/Buffs/HotE.cs b/Buffs/HotE.cs index f4c6a52298..de6167173e 100644 --- a/Buffs/HotE.cs +++ b/Buffs/HotE.cs @@ -1,31 +1,31 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class HotE : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Heart of the Elements"); - Description.SetDefault("All elementals 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 (!modPlayer.allWaifus) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class HotE : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Heart of the Elements"); + Description.SetDefault("All elementals 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 (!modPlayer.allWaifus) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/IceClasper.cs b/Buffs/IceClasper.cs index 78a0bdd181..d8b47d1e3e 100644 --- a/Buffs/IceClasper.cs +++ b/Buffs/IceClasper.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class IceClasper : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Ice Clasper"); - Description.SetDefault("The ice clasper 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("IceClasper")] > 0) - { - modPlayer.iClasper = true; - } - if (!modPlayer.iClasper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class IceClasper : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ice Clasper"); + Description.SetDefault("The ice clasper 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("IceClasper")] > 0) + { + modPlayer.iClasper = true; + } + if (!modPlayer.iClasper) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/IceShieldBrokenBuff.cs b/Buffs/IceShieldBrokenBuff.cs index d7ca6e61b2..790b53ac15 100644 --- a/Buffs/IceShieldBrokenBuff.cs +++ b/Buffs/IceShieldBrokenBuff.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class IceShieldBrokenBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Ice Shield Cooldown"); - Description.SetDefault("The shield is regenerating"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).sirenIceCooldown = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class IceShieldBrokenBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ice Shield Cooldown"); + Description.SetDefault("The shield is regenerating"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).sirenIceCooldown = true; + } + } +} diff --git a/Buffs/Invincible.cs b/Buffs/Invincible.cs index c053165f19..1e843e3797 100644 --- a/Buffs/Invincible.cs +++ b/Buffs/Invincible.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Invincible : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Invincible"); - Description.SetDefault("Immune to damage and most debuffs"); - 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).invincible = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Invincible : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Invincible"); + Description.SetDefault("Immune to damage and most debuffs"); + 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).invincible = true; + } + } +} diff --git a/Buffs/Irradiated.cs b/Buffs/Irradiated.cs index 7536f5fce0..7c5237a69c 100644 --- a/Buffs/Irradiated.cs +++ b/Buffs/Irradiated.cs @@ -1,34 +1,34 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Irradiated : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Acid Rain"); - Description.SetDefault("Your skin is burning off"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).irradiated = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).irradiated = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Irradiated : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Acid Rain"); + Description.SetDefault("Your skin is burning off"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).irradiated = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).irradiated = true; + } + } +} diff --git a/Buffs/Kendra.cs b/Buffs/Kendra.cs index fc1b0d7c9d..7cf5157bb3 100644 --- a/Buffs/Kendra.cs +++ b/Buffs/Kendra.cs @@ -27,4 +27,4 @@ namespace CalamityMod.Buffs } } } -} \ No newline at end of file +} diff --git a/Buffs/LethalLavaBurn.cs b/Buffs/LethalLavaBurn.cs index a278dd1c5a..13ff2526bf 100644 --- a/Buffs/LethalLavaBurn.cs +++ b/Buffs/LethalLavaBurn.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class LethalLavaBurn : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Lethal Lava Burn"); - Description.SetDefault("Losing life"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).lethalLavaBurn = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class LethalLavaBurn : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Lethal Lava Burn"); + Description.SetDefault("Losing life"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).lethalLavaBurn = true; + } + } +} diff --git a/Buffs/Levi.cs b/Buffs/Levi.cs index 17b0bad31a..a2948e88ec 100644 --- a/Buffs/Levi.cs +++ b/Buffs/Levi.cs @@ -1,31 +1,31 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Levi : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Levi"); - Description.SetDefault("Small and cute"); - Main.buffNoTimeDisplay[Type] = true; - Main.vanityPet[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.buffTime[buffIndex] = 18000; - player.GetModPlayer(mod).leviPet = true; - bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Levi")] <= 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("Levi"), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Levi : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Levi"); + Description.SetDefault("Small and cute"); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.GetModPlayer(mod).leviPet = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Levi")] <= 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("Levi"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/MarkedforDeath.cs b/Buffs/MarkedforDeath.cs index 8bd3d2f9f6..be5bc38724 100644 --- a/Buffs/MarkedforDeath.cs +++ b/Buffs/MarkedforDeath.cs @@ -1,32 +1,32 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class MarkedforDeath : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Marked"); - Description.SetDefault("Damage reduction reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).marked = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).marked = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class MarkedforDeath : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Marked"); + Description.SetDefault("Damage reduction reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).marked = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).marked = true; + } + } +} diff --git a/Buffs/Mechworm.cs b/Buffs/Mechworm.cs index e053f146c6..941cfb5e2e 100644 --- a/Buffs/Mechworm.cs +++ b/Buffs/Mechworm.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Mechworm : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Mechworm"); - Description.SetDefault("The mechworm 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("MechwormHead")] > 0) - { - modPlayer.mWorm = true; - } - if (!modPlayer.mWorm) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Mechworm : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Mechworm"); + Description.SetDefault("The mechworm 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("MechwormHead")] > 0) + { + modPlayer.mWorm = true; + } + if (!modPlayer.mWorm) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Molten.cs b/Buffs/Molten.cs index 0af9842656..70c1ad3cef 100644 --- a/Buffs/Molten.cs +++ b/Buffs/Molten.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Molten : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Molten"); - Description.SetDefault("Resistant to cold effects"); - 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).molten = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Molten : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Molten"); + Description.SetDefault("Resistant to cold effects"); + 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).molten = true; + } + } +} diff --git a/Buffs/Mushy.cs b/Buffs/Mushy.cs index e7017fba65..b553a8d511 100644 --- a/Buffs/Mushy.cs +++ b/Buffs/Mushy.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Mushy : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Mushy"); - Description.SetDefault("Increased defense and life regen"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).mushy = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Mushy : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Mushy"); + Description.SetDefault("Increased defense and life regen"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).mushy = true; + } + } +} diff --git a/Buffs/Nightwither.cs b/Buffs/Nightwither.cs index 823d3e8851..6b39fcd9fc 100644 --- a/Buffs/Nightwither.cs +++ b/Buffs/Nightwither.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Nightwither : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Nightwither"); - Description.SetDefault("Incinerated by lunar rays"); - 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).nightwither = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Nightwither : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Nightwither"); + Description.SetDefault("Incinerated by lunar rays"); + 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).nightwither = true; + } + } +} diff --git a/Buffs/Omniscience.cs b/Buffs/Omniscience.cs index d4119cc1bf..e0212f87be 100644 --- a/Buffs/Omniscience.cs +++ b/Buffs/Omniscience.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Omniscience : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Omniscience"); - Description.SetDefault("You can see everything"); - 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).omniscience = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Omniscience : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Omniscience"); + Description.SetDefault("You can see everything"); + 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).omniscience = true; + } + } +} diff --git a/Buffs/PenumbraBuff.cs b/Buffs/PenumbraBuff.cs index fe12343aa0..c031c9a7bf 100644 --- a/Buffs/PenumbraBuff.cs +++ b/Buffs/PenumbraBuff.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).penumbra = true; } } -} \ No newline at end of file +} diff --git a/Buffs/Permafrost/ConcoctionCooldown.cs b/Buffs/Permafrost/ConcoctionCooldown.cs index 95d141815e..17d2f47c0c 100644 --- a/Buffs/Permafrost/ConcoctionCooldown.cs +++ b/Buffs/Permafrost/ConcoctionCooldown.cs @@ -1,18 +1,18 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Permafrost -{ - public class ConcoctionCooldown : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Concoction Cooldown"); - Description.SetDefault("Revive is recharging"); - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - } -} +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Permafrost +{ + public class ConcoctionCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Concoction Cooldown"); + Description.SetDefault("Revive is recharging"); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + } +} diff --git a/Buffs/Permafrost/Encased.cs b/Buffs/Permafrost/Encased.cs index fd870ee38e..ee78e5c2b7 100644 --- a/Buffs/Permafrost/Encased.cs +++ b/Buffs/Permafrost/Encased.cs @@ -1,41 +1,41 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Permafrost -{ - public class Encased : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Encased"); - Description.SetDefault("30 defense and +30% damage reduction, but..."); - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.statDefense += 30; - player.endurance += 0.3f; - player.frozen = true; - player.velocity.X = 0f; - player.velocity.Y = -0.4f; //should negate gravity - - int d = Dust.NewDust(player.position, player.width, player.height, 88); - Main.dust[d].noGravity = true; - Main.dust[d].velocity *= 2f; - - if (player.buffTime[buffIndex] == 2) - { - Main.PlaySound(SoundID.Item27, player.position); - player.immune = true; - player.immuneNoBlink = false; - player.immuneTime = 90; - } - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Permafrost +{ + public class Encased : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Encased"); + Description.SetDefault("30 defense and +30% damage reduction, but..."); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.statDefense += 30; + player.endurance += 0.3f; + player.frozen = true; + player.velocity.X = 0f; + player.velocity.Y = -0.4f; //should negate gravity + + int d = Dust.NewDust(player.position, player.width, player.height, 88); + Main.dust[d].noGravity = true; + Main.dust[d].velocity *= 2f; + + if (player.buffTime[buffIndex] == 2) + { + Main.PlaySound(SoundID.Item27, player.position); + player.immune = true; + player.immuneNoBlink = false; + player.immuneTime = 90; + } + } + } +} diff --git a/Buffs/Permafrost/Popo.cs b/Buffs/Permafrost/Popo.cs index 6ec7c0773d..73c7bacfa7 100644 --- a/Buffs/Permafrost/Popo.cs +++ b/Buffs/Permafrost/Popo.cs @@ -1,36 +1,36 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Permafrost -{ - public class Popo : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Popo"); - Description.SetDefault("You are a snowman now!"); - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.GetModPlayer(); - if (modPlayer.snowmanPrevious) - { - modPlayer.snowmanPower = true; - } - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Permafrost +{ + public class Popo : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Popo"); + Description.SetDefault("You are a snowman now!"); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(); + if (modPlayer.snowmanPrevious) + { + modPlayer.snowmanPower = true; + } + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} diff --git a/Buffs/Permafrost/PopoNoseless.cs b/Buffs/Permafrost/PopoNoseless.cs index e316a2666f..47dae72257 100644 --- a/Buffs/Permafrost/PopoNoseless.cs +++ b/Buffs/Permafrost/PopoNoseless.cs @@ -1,36 +1,36 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.Permafrost -{ - public class PopoNoseless : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Noseless Popo"); - Description.SetDefault("Your nose has been stolen!"); - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.GetModPlayer(); - if (modPlayer.snowmanPrevious) - { - modPlayer.snowmanPower = true; - modPlayer.snowmanNoseless = true; - } - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Permafrost +{ + public class PopoNoseless : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Noseless Popo"); + Description.SetDefault("Your nose has been stolen!"); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(); + if (modPlayer.snowmanPrevious) + { + modPlayer.snowmanPower = true; + modPlayer.snowmanNoseless = true; + } + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} diff --git a/Buffs/Phantom.cs b/Buffs/Phantom.cs index 5fb83c1d77..9e52ebc56f 100644 --- a/Buffs/Phantom.cs +++ b/Buffs/Phantom.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Phantom : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Phantom"); - Description.SetDefault("The phantom 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("PhantomGuy")] > 0) - { - modPlayer.pGuy = true; - } - if (!modPlayer.pGuy) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Phantom : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Phantom"); + Description.SetDefault("The phantom 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("PhantomGuy")] > 0) + { + modPlayer.pGuy = true; + } + if (!modPlayer.pGuy) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/PhotosynthesisBuff.cs b/Buffs/PhotosynthesisBuff.cs index f44c6a527e..e7820e3979 100644 --- a/Buffs/PhotosynthesisBuff.cs +++ b/Buffs/PhotosynthesisBuff.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).photosynthesis = true; } } -} \ No newline at end of file +} diff --git a/Buffs/Plague.cs b/Buffs/Plague.cs index 2d9fe4900b..2f9e643183 100644 --- a/Buffs/Plague.cs +++ b/Buffs/Plague.cs @@ -1,32 +1,32 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Plague : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Plague"); - Description.SetDefault("Rotting from the inside"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).pFlames = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).pFlames = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Plague : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Plague"); + Description.SetDefault("Rotting from the inside"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).pFlames = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).pFlames = true; + } + } +} diff --git a/Buffs/ProfanedRageBuff.cs b/Buffs/ProfanedRageBuff.cs index cf7b60351c..1f8eafe989 100644 --- a/Buffs/ProfanedRageBuff.cs +++ b/Buffs/ProfanedRageBuff.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).profanedRage = true; } } -} \ No newline at end of file +} diff --git a/Buffs/ReaverOrb.cs b/Buffs/ReaverOrb.cs index 589c73583b..d226843b23 100644 --- a/Buffs/ReaverOrb.cs +++ b/Buffs/ReaverOrb.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class ReaverOrb : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Reaver Orb"); - Description.SetDefault("The reaver orb 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("ReaverOrb")] > 0) - { - modPlayer.rOrb = true; - } - if (!modPlayer.rOrb) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class ReaverOrb : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Reaver Orb"); + Description.SetDefault("The reaver orb 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("ReaverOrb")] > 0) + { + modPlayer.rOrb = true; + } + if (!modPlayer.rOrb) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/ReaverRage.cs b/Buffs/ReaverRage.cs index 31c1a0f58a..ee4582cb31 100644 --- a/Buffs/ReaverRage.cs +++ b/Buffs/ReaverRage.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class ReaverRage : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Reaver Rage"); - Description.SetDefault("You are angry"); - 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).rRage = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ReaverRage : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Reaver Rage"); + Description.SetDefault("You are angry"); + 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).rRage = true; + } + } +} diff --git a/Buffs/RedDevil.cs b/Buffs/RedDevil.cs index 6f67dd2970..c0f23949fe 100644 --- a/Buffs/RedDevil.cs +++ b/Buffs/RedDevil.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class RedDevil : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Red Devil"); - Description.SetDefault("The red devil 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("RedDevil")] > 0) - { - modPlayer.rDevil = true; - } - if (!modPlayer.rDevil) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class RedDevil : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Red Devil"); + Description.SetDefault("The red devil 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("RedDevil")] > 0) + { + modPlayer.rDevil = true; + } + if (!modPlayer.rDevil) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Sandnado.cs b/Buffs/Sandnado.cs index 5d34cb0894..cb0602b8a6 100644 --- a/Buffs/Sandnado.cs +++ b/Buffs/Sandnado.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Sandnado : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Sandnado"); - Description.SetDefault("The sandnado 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("Sandnado")] > 0) - { - modPlayer.sandnado = true; - } - if (!modPlayer.sandnado) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Sandnado : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sandnado"); + Description.SetDefault("The sandnado 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("Sandnado")] > 0) + { + modPlayer.sandnado = true; + } + if (!modPlayer.sandnado) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/SandyWaifu.cs b/Buffs/SandyWaifu.cs index a4708f9020..268e4a8c15 100644 --- a/Buffs/SandyWaifu.cs +++ b/Buffs/SandyWaifu.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class SandyWaifu : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Sand Elemental"); - Description.SetDefault("The sand elemental 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("SandyWaifu")] > 0) - { - modPlayer.sWaifu = true; - } - if (!modPlayer.sWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SandyWaifu : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sand Elemental"); + Description.SetDefault("The sand elemental 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("SandyWaifu")] > 0) + { + modPlayer.sWaifu = true; + } + if (!modPlayer.sWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/ScarfCooldown.cs b/Buffs/ScarfCooldown.cs index 27d4936d28..59f4574bff 100644 --- a/Buffs/ScarfCooldown.cs +++ b/Buffs/ScarfCooldown.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class ScarfCooldown : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Scarf Cooldown"); - Description.SetDefault("Your dodge is recharging"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).scarfCooldown = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ScarfCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Scarf Cooldown"); + Description.SetDefault("Your dodge is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).scarfCooldown = true; + } + } +} diff --git a/Buffs/ScarfMeleeBoost.cs b/Buffs/ScarfMeleeBoost.cs index 9c36a7c128..4cb7bcaeb9 100644 --- a/Buffs/ScarfMeleeBoost.cs +++ b/Buffs/ScarfMeleeBoost.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class ScarfMeleeBoost : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Scarf Boost"); - Description.SetDefault("10% increased damage, 5% increased crit chance, and 10% increased melee speed"); - 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).sMeleeBoost = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ScarfMeleeBoost : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Scarf Boost"); + Description.SetDefault("10% increased damage, 5% increased crit chance, and 10% increased melee speed"); + 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).sMeleeBoost = true; + } + } +} diff --git a/Buffs/ShellBoost.cs b/Buffs/ShellBoost.cs index 06eabc4b27..6e6a132971 100644 --- a/Buffs/ShellBoost.cs +++ b/Buffs/ShellBoost.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class ShellBoost : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Shell Speed Boost"); - Description.SetDefault("Speed is boosted"); - 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).shellBoost = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ShellBoost : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shell Speed Boost"); + Description.SetDefault("Speed is boosted"); + 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).shellBoost = true; + } + } +} diff --git a/Buffs/Shred.cs b/Buffs/Shred.cs index 907547948d..b9f669219e 100644 --- a/Buffs/Shred.cs +++ b/Buffs/Shred.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Shred : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Shred"); - Description.SetDefault("Blood"); - 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).pShred = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Shred : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shred"); + Description.SetDefault("Blood"); + 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).pShred = true; + } + } +} diff --git a/Buffs/Shrines/ChiBuff.cs b/Buffs/Shrines/ChiBuff.cs index ab2bab9746..ac7af9b173 100644 --- a/Buffs/Shrines/ChiBuff.cs +++ b/Buffs/Shrines/ChiBuff.cs @@ -25,4 +25,4 @@ namespace CalamityMod.Buffs.Shrines player.GetModPlayer(mod).trinketOfChiBuff = true; } } -} \ No newline at end of file +} diff --git a/Buffs/Shrines/CorruptionEffigyBuff.cs b/Buffs/Shrines/CorruptionEffigyBuff.cs index 94cda4af18..b0003a57c8 100644 --- a/Buffs/Shrines/CorruptionEffigyBuff.cs +++ b/Buffs/Shrines/CorruptionEffigyBuff.cs @@ -25,4 +25,4 @@ namespace CalamityMod.Buffs.Shrines player.GetModPlayer(mod).corrEffigy = true; } } -} \ No newline at end of file +} diff --git a/Buffs/Shrines/CrimsonEffigyBuff.cs b/Buffs/Shrines/CrimsonEffigyBuff.cs index 68db53a47c..b33bb75445 100644 --- a/Buffs/Shrines/CrimsonEffigyBuff.cs +++ b/Buffs/Shrines/CrimsonEffigyBuff.cs @@ -25,4 +25,4 @@ namespace CalamityMod.Buffs.Shrines player.GetModPlayer(mod).crimEffigy = true; } } -} \ No newline at end of file +} diff --git a/Buffs/Shrines/GladiatorSwords.cs b/Buffs/Shrines/GladiatorSwords.cs index 989c11edd9..97dd8710ed 100644 --- a/Buffs/Shrines/GladiatorSwords.cs +++ b/Buffs/Shrines/GladiatorSwords.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Buffs.Shrines } } } -} \ No newline at end of file +} diff --git a/Buffs/SilvaCrystal.cs b/Buffs/SilvaCrystal.cs index 4df0285150..69ad4c74f9 100644 --- a/Buffs/SilvaCrystal.cs +++ b/Buffs/SilvaCrystal.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class SilvaCrystal : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Silva Crystal"); - Description.SetDefault("The crystal 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("SilvaCrystal")] > 0) - { - modPlayer.sCrystal = true; - } - if (!modPlayer.sCrystal) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SilvaCrystal : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Silva Crystal"); + Description.SetDefault("The crystal 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("SilvaCrystal")] > 0) + { + modPlayer.sCrystal = true; + } + if (!modPlayer.sCrystal) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/SilvaRevival.cs b/Buffs/SilvaRevival.cs index ef7e78ecb7..139bab15a2 100644 --- a/Buffs/SilvaRevival.cs +++ b/Buffs/SilvaRevival.cs @@ -1,22 +1,22 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class SilvaRevival : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Silva Invulnerability"); - Description.SetDefault("You are invulnerable"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class SilvaRevival : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Silva Invulnerability"); + Description.SetDefault("You are invulnerable"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + } +} diff --git a/Buffs/SilvaStun.cs b/Buffs/SilvaStun.cs index 40b17c4376..dc3dddf9c3 100644 --- a/Buffs/SilvaStun.cs +++ b/Buffs/SilvaStun.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class SilvaStun : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Silva Stun"); - Description.SetDefault("Can't move"); - 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).silvaStun = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class SilvaStun : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Silva Stun"); + Description.SetDefault("Can't move"); + 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).silvaStun = true; + } + } +} diff --git a/Buffs/SirenBobs.cs b/Buffs/SirenBobs.cs index 5bca6c7334..bb7f4bf660 100644 --- a/Buffs/SirenBobs.cs +++ b/Buffs/SirenBobs.cs @@ -1,55 +1,55 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class SirenBobs : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Siren"); - Description.SetDefault("You are a siren now"); - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.GetModPlayer(); - if (modPlayer.sirenBoobsPrevious) - { - modPlayer.sirenBoobsPower = true; - player.statDefense += 1 + - (NPC.downedBoss3 ? 4 : 0) + - (Main.hardMode ? 5 : 0) + - (NPC.downedMoonlord ? 5 : 0); - player.detectCreature = true; - player.lifeRegen += 0 + - (NPC.downedBoss3 ? 1 : 0) + - (NPC.downedMoonlord ? 1 : 0); - player.ignoreWater = NPC.downedBoss3; - player.accFlipper = true; - player.discount = Main.hardMode; - if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss && NPC.downedBoss3) - { - player.breath = player.breathMax + 3; - } - if (Main.myPlayer == player.whoAmI && player.wet && NPC.downedBoss3) - { - player.AddBuff(mod.BuffType("SirenWaterSpeed"), 360); - } - } - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class SirenBobs : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Siren"); + Description.SetDefault("You are a siren now"); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(); + if (modPlayer.sirenBoobsPrevious) + { + modPlayer.sirenBoobsPower = true; + player.statDefense += 1 + + (NPC.downedBoss3 ? 4 : 0) + + (Main.hardMode ? 5 : 0) + + (NPC.downedMoonlord ? 5 : 0); + player.detectCreature = true; + player.lifeRegen += 0 + + (NPC.downedBoss3 ? 1 : 0) + + (NPC.downedMoonlord ? 1 : 0); + player.ignoreWater = NPC.downedBoss3; + player.accFlipper = true; + player.discount = Main.hardMode; + if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss && NPC.downedBoss3) + { + player.breath = player.breathMax + 3; + } + if (Main.myPlayer == player.whoAmI && player.wet && NPC.downedBoss3) + { + player.AddBuff(mod.BuffType("SirenWaterSpeed"), 360); + } + } + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} diff --git a/Buffs/SirenBobsAlt.cs b/Buffs/SirenBobsAlt.cs index 7e5199c484..e6319f7c75 100644 --- a/Buffs/SirenBobsAlt.cs +++ b/Buffs/SirenBobsAlt.cs @@ -1,55 +1,55 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class SirenBobsAlt : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Siren"); - Description.SetDefault("You are a siren now"); - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.GetModPlayer(); - if (modPlayer.sirenBoobsAltPrevious) - { - modPlayer.sirenBoobsAltPower = true; - player.statDefense += 1 + - (NPC.downedBoss3 ? 4 : 0) + - (Main.hardMode ? 5 : 0) + - (NPC.downedMoonlord ? 5 : 0); - player.dangerSense = true; - player.lifeRegen += 0 + - (NPC.downedBoss3 ? 1 : 0) + - (NPC.downedMoonlord ? 1 : 0); - player.ignoreWater = NPC.downedBoss3; - player.accFlipper = true; - player.discount = Main.hardMode; - if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss && NPC.downedBoss3) - { - player.breath = player.breathMax + 3; - } - if (Main.myPlayer == player.whoAmI && player.wet && NPC.downedBoss3) - { - player.AddBuff(mod.BuffType("SirenWaterSpeed"), 360); - } - } - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class SirenBobsAlt : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Siren"); + Description.SetDefault("You are a siren now"); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(); + if (modPlayer.sirenBoobsAltPrevious) + { + modPlayer.sirenBoobsAltPower = true; + player.statDefense += 1 + + (NPC.downedBoss3 ? 4 : 0) + + (Main.hardMode ? 5 : 0) + + (NPC.downedMoonlord ? 5 : 0); + player.dangerSense = true; + player.lifeRegen += 0 + + (NPC.downedBoss3 ? 1 : 0) + + (NPC.downedMoonlord ? 1 : 0); + player.ignoreWater = NPC.downedBoss3; + player.accFlipper = true; + player.discount = Main.hardMode; + if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss && NPC.downedBoss3) + { + player.breath = player.breathMax + 3; + } + if (Main.myPlayer == player.whoAmI && player.wet && NPC.downedBoss3) + { + player.AddBuff(mod.BuffType("SirenWaterSpeed"), 360); + } + } + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} diff --git a/Buffs/SirenLure.cs b/Buffs/SirenLure.cs index c06a00c5ea..bcc859b0aa 100644 --- a/Buffs/SirenLure.cs +++ b/Buffs/SirenLure.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class SirenLure : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Siren"); - Description.SetDefault("The siren 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("SirenLure")] > 0) - { - modPlayer.slWaifu = true; - } - if (!modPlayer.slWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SirenLure : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Siren"); + Description.SetDefault("The siren 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("SirenLure")] > 0) + { + modPlayer.slWaifu = true; + } + if (!modPlayer.slWaifu) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/SirenWaterSpeed.cs b/Buffs/SirenWaterSpeed.cs index b849df2745..6fee18a25a 100644 --- a/Buffs/SirenWaterSpeed.cs +++ b/Buffs/SirenWaterSpeed.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class SirenWaterSpeed : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Siren Speed"); - Description.SetDefault("15% increased max speed and acceleration"); - 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).sirenWaterBuff = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class SirenWaterSpeed : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Siren Speed"); + Description.SetDefault("15% increased max speed and acceleration"); + 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).sirenWaterBuff = true; + } + } +} diff --git a/Buffs/SlimeGod.cs b/Buffs/SlimeGod.cs index ad945b56fc..f30f97bcb5 100644 --- a/Buffs/SlimeGod.cs +++ b/Buffs/SlimeGod.cs @@ -1,38 +1,38 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class SlimeGod : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Baby Slime God"); - Description.SetDefault("The slime god 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("SlimeGodAlt")] > 0) - { - modPlayer.sGod = true; - } - else if (player.ownedProjectileCounts[mod.ProjectileType("SlimeGod")] > 0) - { - modPlayer.sGod = true; - } - if (!modPlayer.sGod) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SlimeGod : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Baby Slime God"); + Description.SetDefault("The slime god 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("SlimeGodAlt")] > 0) + { + modPlayer.sGod = true; + } + else if (player.ownedProjectileCounts[mod.ProjectileType("SlimeGod")] > 0) + { + modPlayer.sGod = true; + } + if (!modPlayer.sGod) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Soaring.cs b/Buffs/Soaring.cs index e5e0ae9749..2af7f5a61f 100644 --- a/Buffs/Soaring.cs +++ b/Buffs/Soaring.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).soaring = true; } } -} \ No newline at end of file +} diff --git a/Buffs/SolarSpirit.cs b/Buffs/SolarSpirit.cs index 0fed3e68cd..c387a76efd 100644 --- a/Buffs/SolarSpirit.cs +++ b/Buffs/SolarSpirit.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class SolarSpirit : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Solar Spirit"); - Description.SetDefault("The solar spirit 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("SolarPixie")] > 0) - { - modPlayer.SP = true; - } - if (!modPlayer.SP) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SolarSpirit : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Solar Spirit"); + Description.SetDefault("The solar spirit 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("SolarPixie")] > 0) + { + modPlayer.SP = true; + } + if (!modPlayer.SP) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/SolarSpiritGod.cs b/Buffs/SolarSpiritGod.cs index dbaeecce4a..044cbfd024 100644 --- a/Buffs/SolarSpiritGod.cs +++ b/Buffs/SolarSpiritGod.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class SolarSpiritGod : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Solar God Spirit"); - Description.SetDefault("The solar god spirit 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("SolarGod")] > 0) - { - modPlayer.SPG = true; - } - if (!modPlayer.SPG) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class SolarSpiritGod : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Solar God Spirit"); + Description.SetDefault("The solar god spirit 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("SolarGod")] > 0) + { + modPlayer.SPG = true; + } + if (!modPlayer.SPG) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/SpiritGeneratorAtkBuff.cs b/Buffs/SpiritGeneratorAtkBuff.cs index 3725707001..33bf9ee7e8 100644 --- a/Buffs/SpiritGeneratorAtkBuff.cs +++ b/Buffs/SpiritGeneratorAtkBuff.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class SpiritGeneratorAtkBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Spirit Power"); - Description.SetDefault("Minion damage boosted by 10%"); - 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).sPower = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class SpiritGeneratorAtkBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Spirit Power"); + Description.SetDefault("Minion damage boosted by 10%"); + 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).sPower = true; + } + } +} diff --git a/Buffs/SpiritGeneratorDefBuff.cs b/Buffs/SpiritGeneratorDefBuff.cs index f7dca0166b..c8351d545f 100644 --- a/Buffs/SpiritGeneratorDefBuff.cs +++ b/Buffs/SpiritGeneratorDefBuff.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class SpiritGeneratorDefBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Spirit Defense"); - Description.SetDefault("Defense boosted by 5 and damage reduction boosted by 5%"); - 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).sDefense = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class SpiritGeneratorDefBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Spirit Defense"); + Description.SetDefault("Defense boosted by 5 and damage reduction boosted by 5%"); + 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).sDefense = true; + } + } +} diff --git a/Buffs/SpiritGeneratorRegenBuff.cs b/Buffs/SpiritGeneratorRegenBuff.cs index 1d2f59e961..0069ad5be8 100644 --- a/Buffs/SpiritGeneratorRegenBuff.cs +++ b/Buffs/SpiritGeneratorRegenBuff.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class SpiritGeneratorRegenBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Spirit Regen"); - Description.SetDefault("Regenerating life"); - 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).sRegen = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class SpiritGeneratorRegenBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Spirit Regen"); + Description.SetDefault("Regenerating life"); + 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).sRegen = true; + } + } +} diff --git a/Buffs/SquishyBeanBuff.cs b/Buffs/SquishyBeanBuff.cs index 2b2cc3f930..8549e7e25f 100644 --- a/Buffs/SquishyBeanBuff.cs +++ b/Buffs/SquishyBeanBuff.cs @@ -1,24 +1,24 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.Items; - -namespace CalamityMod.Buffs -{ - class SquishyBeanBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Squishy Bean"); - Description.SetDefault("BEAN MAN. BEAN DO T H E B EA N IS HER E"); - 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; - } - } -} +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.Items; + +namespace CalamityMod.Buffs +{ + class SquishyBeanBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Squishy Bean"); + Description.SetDefault("BEAN MAN. BEAN DO T H E B EA N IS HER E"); + 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; + } + } +} diff --git a/Buffs/StrangeOrb.cs b/Buffs/StrangeOrb.cs index 7aa0307677..367d80a04b 100644 --- a/Buffs/StrangeOrb.cs +++ b/Buffs/StrangeOrb.cs @@ -1,31 +1,31 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class StrangeOrb : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Young Siren"); - Description.SetDefault("Small and cute"); - Main.buffNoTimeDisplay[Type] = true; - Main.lightPet[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.buffTime[buffIndex] = 18000; - player.GetModPlayer(mod).sirenPet = true; - bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("SirenYoung")] <= 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("SirenYoung"), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class StrangeOrb : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Young Siren"); + Description.SetDefault("Small and cute"); + Main.buffNoTimeDisplay[Type] = true; + Main.lightPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.GetModPlayer(mod).sirenPet = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("SirenYoung")] <= 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("SirenYoung"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/SunkenSea/Clamity.cs b/Buffs/SunkenSea/Clamity.cs index 3406905703..ae7073dc4b 100644 --- a/Buffs/SunkenSea/Clamity.cs +++ b/Buffs/SunkenSea/Clamity.cs @@ -1,29 +1,29 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.SunkenSea -{ - public class Clamity : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Clamity"); - Description.SetDefault("The clams have been angered!"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).clamity = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.SunkenSea +{ + public class Clamity : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Clamity"); + Description.SetDefault("The clams have been angered!"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).clamity = true; + } + } +} diff --git a/Buffs/SunkenSea/PearlAura.cs b/Buffs/SunkenSea/PearlAura.cs index 466799460c..d9e6707773 100644 --- a/Buffs/SunkenSea/PearlAura.cs +++ b/Buffs/SunkenSea/PearlAura.cs @@ -1,26 +1,26 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.SunkenSea -{ - public class PearlAura : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Pearl Aura"); - Description.SetDefault("Slowed down"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).pearlAura = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.SunkenSea +{ + public class PearlAura : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Pearl Aura"); + Description.SetDefault("Slowed down"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).pearlAura = true; + } + } +} diff --git a/Buffs/SunkenSea/Shellfish.cs b/Buffs/SunkenSea/Shellfish.cs index 2b34c04d54..b2f1ac258e 100644 --- a/Buffs/SunkenSea/Shellfish.cs +++ b/Buffs/SunkenSea/Shellfish.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.SunkenSea -{ - public class Shellfish : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Shellfish"); - Description.SetDefault("The shellfish 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("Shellfish")] > 0) - { - modPlayer.shellfish = true; - } - if (!modPlayer.shellfish) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.SunkenSea +{ + public class Shellfish : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shellfish"); + Description.SetDefault("The shellfish 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("Shellfish")] > 0) + { + modPlayer.shellfish = true; + } + if (!modPlayer.shellfish) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/SunkenSea/ShellfishEating.cs b/Buffs/SunkenSea/ShellfishEating.cs index 2dfd47adfc..da84c73c27 100644 --- a/Buffs/SunkenSea/ShellfishEating.cs +++ b/Buffs/SunkenSea/ShellfishEating.cs @@ -1,26 +1,26 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs.SunkenSea -{ - public class ShellfishEating : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Shellfish Claps"); - Description.SetDefault("Clamfest"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).shellfishVore = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.SunkenSea +{ + public class ShellfishEating : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shellfish Claps"); + Description.SetDefault("Clamfest"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).shellfishVore = true; + } + } +} diff --git a/Buffs/TarraLifeRegen.cs b/Buffs/TarraLifeRegen.cs index 35a435dd19..1209138f7e 100644 --- a/Buffs/TarraLifeRegen.cs +++ b/Buffs/TarraLifeRegen.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class TarraLifeRegen : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Tarra Life"); - Description.SetDefault("Rapid healing"); - 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).tRegen = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class TarraLifeRegen : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tarra Life"); + Description.SetDefault("Rapid healing"); + 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).tRegen = true; + } + } +} diff --git a/Buffs/TemporalSadness.cs b/Buffs/TemporalSadness.cs index a961dc747a..c8c9f71cae 100644 --- a/Buffs/TemporalSadness.cs +++ b/Buffs/TemporalSadness.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class TemporalSadness : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Temporal Sadness"); - Description.SetDefault("You are crying"); - 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).tSad = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class TemporalSadness : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Temporal Sadness"); + Description.SetDefault("You are crying"); + 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).tSad = true; + } + } +} diff --git a/Buffs/TitanScale.cs b/Buffs/TitanScale.cs index fb005644e6..1dcfd536ec 100644 --- a/Buffs/TitanScale.cs +++ b/Buffs/TitanScale.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class TitanScale : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Titan Scale"); - Description.SetDefault("You feel tanky"); - 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).tScale = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class TitanScale : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Titan Scale"); + Description.SetDefault("You feel tanky"); + 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).tScale = true; + } + } +} diff --git a/Buffs/TranquilityCandle.cs b/Buffs/TranquilityCandle.cs index 5ae313322d..c45c6f8753 100644 --- a/Buffs/TranquilityCandle.cs +++ b/Buffs/TranquilityCandle.cs @@ -1,29 +1,29 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class TranquilityCandle : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Tranquility Candle"); - Description.SetDefault("Spawn rates around the candle are reduced!"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).tranquilityCandle = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class TranquilityCandle : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tranquility Candle"); + Description.SetDefault("Spawn rates around the candle are reduced!"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).tranquilityCandle = true; + } + } +} diff --git a/Buffs/TriumphBuff.cs b/Buffs/TriumphBuff.cs index 2b3acc938b..e1f2e6041f 100644 --- a/Buffs/TriumphBuff.cs +++ b/Buffs/TriumphBuff.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs player.GetModPlayer(mod).triumph = true; } } -} \ No newline at end of file +} diff --git a/Buffs/TyrantsFury.cs b/Buffs/TyrantsFury.cs index aa45f43465..ab6c1f2a42 100644 --- a/Buffs/TyrantsFury.cs +++ b/Buffs/TyrantsFury.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class TyrantsFury : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Tyrant's Fury"); - Description.SetDefault("30% increased melee damage and 10% increased melee crit chance"); - 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).tFury = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class TyrantsFury : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tyrant's Fury"); + Description.SetDefault("30% increased melee damage and 10% increased melee crit chance"); + 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).tFury = true; + } + } +} diff --git a/Buffs/Urchin.cs b/Buffs/Urchin.cs index aa8b477e31..8d4fc95334 100644 --- a/Buffs/Urchin.cs +++ b/Buffs/Urchin.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Urchin : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Urchin"); - Description.SetDefault("The urchin 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("Urchin")] > 0) - { - modPlayer.vUrchin = true; - } - if (!modPlayer.vUrchin) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Urchin : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Urchin"); + Description.SetDefault("The urchin 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("Urchin")] > 0) + { + modPlayer.vUrchin = true; + } + if (!modPlayer.vUrchin) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Valkyrie.cs b/Buffs/Valkyrie.cs index 13f22b836f..d8c3287085 100644 --- a/Buffs/Valkyrie.cs +++ b/Buffs/Valkyrie.cs @@ -1,34 +1,34 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs -{ - public class Valkyrie : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Valkyrie"); - Description.SetDefault("The valkyrie 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("Valkyrie")] > 0) - { - modPlayer.aValkyrie = true; - } - if (!modPlayer.aValkyrie) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class Valkyrie : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Valkyrie"); + Description.SetDefault("The valkyrie 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("Valkyrie")] > 0) + { + modPlayer.aValkyrie = true; + } + if (!modPlayer.aValkyrie) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/VulnerabilityHex.cs b/Buffs/VulnerabilityHex.cs index bc30aaf187..0aa9fe1eda 100644 --- a/Buffs/VulnerabilityHex.cs +++ b/Buffs/VulnerabilityHex.cs @@ -1,28 +1,28 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class VulnerabilityHex : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Vulnerability Hex"); - Description.SetDefault("You are weak"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).vHex = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class VulnerabilityHex : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Vulnerability Hex"); + Description.SetDefault("You are weak"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).vHex = true; + } + } +} diff --git a/Buffs/WarCleave.cs b/Buffs/WarCleave.cs index becf240821..557c9a2631 100644 --- a/Buffs/WarCleave.cs +++ b/Buffs/WarCleave.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Buffs npc.GetGlobalNPC(mod).wCleave = true; } } -} \ No newline at end of file +} diff --git a/Buffs/Warped.cs b/Buffs/Warped.cs index 5846b3d410..ce274761f6 100644 --- a/Buffs/Warped.cs +++ b/Buffs/Warped.cs @@ -1,29 +1,29 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Warped : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Warped"); - Description.SetDefault("Movement is being warped"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).warped = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Warped : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Warped"); + Description.SetDefault("Movement is being warped"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).warped = true; + } + } +} diff --git a/Buffs/WeakPetrification.cs b/Buffs/WeakPetrification.cs index a8117fe569..08fb1b25ba 100644 --- a/Buffs/WeakPetrification.cs +++ b/Buffs/WeakPetrification.cs @@ -1,29 +1,29 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class WeakPetrification : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Weak Petrification"); - Description.SetDefault("Your vertical movement is weakened"); - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).weakPetrification = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class WeakPetrification : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Weak Petrification"); + Description.SetDefault("Your vertical movement is weakened"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).weakPetrification = true; + } + } +} diff --git a/Buffs/WhisperingDeath.cs b/Buffs/WhisperingDeath.cs index d5e295fb22..04db5a8e0a 100644 --- a/Buffs/WhisperingDeath.cs +++ b/Buffs/WhisperingDeath.cs @@ -1,32 +1,32 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class WhisperingDeath : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Whispering Death"); - Description.SetDefault("Death approaches; defense, attack power, and life regen reduced"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.GetModPlayer(mod).wDeath = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.GetGlobalNPC(mod).wDeath = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class WhisperingDeath : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Whispering Death"); + Description.SetDefault("Death approaches; defense, attack power, and life regen reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).wDeath = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).wDeath = true; + } + } +} diff --git a/Buffs/XerocRage.cs b/Buffs/XerocRage.cs index a65918ded2..9a426e2025 100644 --- a/Buffs/XerocRage.cs +++ b/Buffs/XerocRage.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class XerocRage : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Xeroc Rage"); - Description.SetDefault("Rage of the cosmos"); - 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).xRage = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class XerocRage : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Xeroc Rage"); + Description.SetDefault("Rage of the cosmos"); + 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).xRage = true; + } + } +} diff --git a/Buffs/XerocWrath.cs b/Buffs/XerocWrath.cs index f9d778b81e..82b90a382f 100644 --- a/Buffs/XerocWrath.cs +++ b/Buffs/XerocWrath.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class XerocWrath : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Xeroc Wrath"); - Description.SetDefault("Wrath of the cosmos"); - 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).xWrath = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class XerocWrath : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Xeroc Wrath"); + Description.SetDefault("Wrath of the cosmos"); + 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).xWrath = true; + } + } +} diff --git a/Buffs/YharimPower.cs b/Buffs/YharimPower.cs index 5c45153e68..bf99bcf1b9 100644 --- a/Buffs/YharimPower.cs +++ b/Buffs/YharimPower.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class YharimPower : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Yharim's Power"); - Description.SetDefault("You feel like you can break the world in two...with your bare hands!"); - 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).yPower = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class YharimPower : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Yharim's Power"); + Description.SetDefault("You feel like you can break the world in two...with your bare hands!"); + 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).yPower = true; + } + } +} diff --git a/Buffs/Zen.cs b/Buffs/Zen.cs index a4987ad97e..82ac92901b 100644 --- a/Buffs/Zen.cs +++ b/Buffs/Zen.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Zen : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Zen"); - Description.SetDefault("Spawn rates are reduced"); - 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).zen = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Zen : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Zen"); + Description.SetDefault("Spawn rates are reduced"); + 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).zen = true; + } + } +} diff --git a/Buffs/Zerg.cs b/Buffs/Zerg.cs index aafdfdf889..04d67b08ba 100644 --- a/Buffs/Zerg.cs +++ b/Buffs/Zerg.cs @@ -1,27 +1,27 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; - -namespace CalamityMod.Buffs -{ - public class Zerg : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Zerg"); - Description.SetDefault("Spawn rates are boosted"); - 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).zerg = true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Zerg : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Zerg"); + Description.SetDefault("Spawn rates are boosted"); + 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).zerg = true; + } + } +} diff --git a/CalamityCollision.cs b/CalamityCollision.cs index 8f2fa69768..7b599fe6de 100644 --- a/CalamityCollision.cs +++ b/CalamityCollision.cs @@ -1,88 +1,88 @@ -using System; -using System.Reflection; -using System.Collections.Generic; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -using Terraria; -using Terraria.UI.Chat; -using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.UI; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Terraria.Localization; -using Terraria.GameContent.UI; - -namespace CalamityMod -{ - public class CalamityCollision - { - public static bool HotWetCollision(Vector2 Position, int Width, int Height) - { - Vector2 vector = new Vector2(Position.X + (float)(Width / 2), Position.Y + (float)(Height / 2)); - int num = 10; - int num2 = Height / 2; - if (num > Width) - { - num = Width; - } - if (num2 > Height) - { - num2 = Height; - } - vector = new Vector2(vector.X - (float)(num / 2), vector.Y - (float)(num2 / 2)); - int arg_A3_0 = (int)(Position.X / 16f) - 1; - int num3 = (int)((Position.X + (float)Width) / 16f) + 2; - int num4 = (int)(Position.Y / 16f) - 1; - int num5 = (int)((Position.Y + (float)Height) / 16f) + 2; - int arg_DB_0 = Utils.Clamp(arg_A3_0, 0, Main.maxTilesX - 1); - num3 = Utils.Clamp(num3, 0, Main.maxTilesX - 1); - num4 = Utils.Clamp(num4, 0, Main.maxTilesY - 1); - num5 = Utils.Clamp(num5, 0, Main.maxTilesY - 1); - for (int i = arg_DB_0; i < num3; i++) - { - for (int j = num4; j < num5; j++) - { - if (Main.tile[i, j] != null) - { - if (Main.tile[i, j + 2].lava() || - Main.tile[i, j + 3].lava() || - Main.tile[i, j + 4].lava()) - { - if (Main.tile[i, j].liquid > 0) - { - Vector2 vector2; - vector2.X = (float)(i * 16); - vector2.Y = (float)(j * 16); - int num6 = 16; - float num7 = (float)(256 - (int)Main.tile[i, j].liquid); - num7 /= 32f; - vector2.Y += num7 * 2f; - num6 -= (int)(num7 * 2f); - if (vector.X + (float)num > vector2.X && vector.X < vector2.X + 16f && vector.Y + (float)num2 > vector2.Y && vector.Y < vector2.Y + (float)num6) - { - return true; - } - } - else if (Main.tile[i, j].active() && Main.tile[i, j].slope() != 0 && j > 0 && Main.tile[i, j - 1] != null && Main.tile[i, j - 1].liquid > 0) - { - Vector2 vector2; - vector2.X = (float)(i * 16); - vector2.Y = (float)(j * 16); - int num8 = 16; - if (vector.X + (float)num > vector2.X && vector.X < vector2.X + 16f && vector.Y + (float)num2 > vector2.Y && vector.Y < vector2.Y + (float)num8) - { - return true; - } - } - } - } - } - } - return false; - } - } -} \ No newline at end of file +using System; +using System.Reflection; +using System.Collections.Generic; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.UI.Chat; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.UI; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Terraria.Localization; +using Terraria.GameContent.UI; + +namespace CalamityMod +{ + public class CalamityCollision + { + public static bool HotWetCollision(Vector2 Position, int Width, int Height) + { + Vector2 vector = new Vector2(Position.X + (float)(Width / 2), Position.Y + (float)(Height / 2)); + int num = 10; + int num2 = Height / 2; + if (num > Width) + { + num = Width; + } + if (num2 > Height) + { + num2 = Height; + } + vector = new Vector2(vector.X - (float)(num / 2), vector.Y - (float)(num2 / 2)); + int arg_A3_0 = (int)(Position.X / 16f) - 1; + int num3 = (int)((Position.X + (float)Width) / 16f) + 2; + int num4 = (int)(Position.Y / 16f) - 1; + int num5 = (int)((Position.Y + (float)Height) / 16f) + 2; + int arg_DB_0 = Utils.Clamp(arg_A3_0, 0, Main.maxTilesX - 1); + num3 = Utils.Clamp(num3, 0, Main.maxTilesX - 1); + num4 = Utils.Clamp(num4, 0, Main.maxTilesY - 1); + num5 = Utils.Clamp(num5, 0, Main.maxTilesY - 1); + for (int i = arg_DB_0; i < num3; i++) + { + for (int j = num4; j < num5; j++) + { + if (Main.tile[i, j] != null) + { + if (Main.tile[i, j + 2].lava() || + Main.tile[i, j + 3].lava() || + Main.tile[i, j + 4].lava()) + { + if (Main.tile[i, j].liquid > 0) + { + Vector2 vector2; + vector2.X = (float)(i * 16); + vector2.Y = (float)(j * 16); + int num6 = 16; + float num7 = (float)(256 - (int)Main.tile[i, j].liquid); + num7 /= 32f; + vector2.Y += num7 * 2f; + num6 -= (int)(num7 * 2f); + if (vector.X + (float)num > vector2.X && vector.X < vector2.X + 16f && vector.Y + (float)num2 > vector2.Y && vector.Y < vector2.Y + (float)num6) + { + return true; + } + } + else if (Main.tile[i, j].active() && Main.tile[i, j].slope() != 0 && j > 0 && Main.tile[i, j - 1] != null && Main.tile[i, j - 1].liquid > 0) + { + Vector2 vector2; + vector2.X = (float)(i * 16); + vector2.Y = (float)(j * 16); + int num8 = 16; + if (vector.X + (float)num > vector2.X && vector.X < vector2.X + 16f && vector.Y + (float)num2 > vector2.Y && vector.Y < vector2.Y + (float)num8) + { + return true; + } + } + } + } + } + } + return false; + } + } +} diff --git a/CalamityLocalization.cs b/CalamityLocalization.cs index 0a44d653ae..19daf991ad 100644 --- a/CalamityLocalization.cs +++ b/CalamityLocalization.cs @@ -1,172 +1,172 @@ -using Terraria.ModLoader; - -namespace CalamityMod -{ - public class CalamityLocalization - { - private static string[][] _localizations; - - public static void Load() - { - _localizations = new[] - { - new [] { "SkyOreText", "The ground is glittering with cyan light." }, - new [] { "IceOreText", "The ice caves are crackling with frigid energy." }, - new [] { "PlantOreText", "Energized plant matter has formed in the underground." }, - new [] { "TreeOreText", "Fossilized tree bark is bursting through the jungle's mud." }, - new [] { "AuricOreText", "A godly aura has blessed the world's caverns." }, - new [] { "FutureOreText", "A cold and dark energy has materialized in space." }, - - new [] { "UglyBossText", "The Sunken Sea trembles..." }, - - new [] { "SteelSkullBossText", "A blood red inferno lingers in the night..." }, - - new [] { "PlantBossText", "The ocean depths are trembling." }, - - new [] { "BabyBossText", "A plague has befallen the Jungle." }, - new [] { "BabyBossText2", "An ancient automaton roams the land." }, - - new [] { "MoonBossText", "The profaned flame blazes fiercely!" }, - new [] { "MoonBossText2", "Cosmic terrors are watching..." }, - new [] { "MoonBossText3", "The bloody moon beckons..." }, - - new [] { "PlagueBossText", "PLAGUE NUKE BARRAGE ARMED, PREPARING FOR LAUNCH!!!" }, - new [] { "PlagueBossText2", "MISSILES LAUNCHED, TARGETING ROUTINE INITIATED!!!" }, - - new [] { "ProfanedBossText", "The air is burning..." }, - new [] { "ProfanedBossText2", "Shrieks are echoing from the dungeon." }, - new [] { "ProfanedBossText3", "The calamitous beings have been inundated with bloodstone." }, - - new [] { "GhostBossText", "The abyssal spirits have been disturbed." }, - new [] { "GhostBossText2", "Wails echo through the dilapidated dungeon halls..." }, - new [] { "GhostBossText3", "Long-dead prisoners seek their zealous revenge..." }, - - new [] { "SupremeBossText3", "Alright, let's get started. Not sure why you're bothering." }, // start - new [] { "SupremeBossText4", "You seem so confident, even though you are painfully ignorant of what has yet to transpire." }, //75% - new [] { "SupremeBossText5", "Everything was going well until you came along." }, //75% - new [] { "SupremeBossText6", "Brothers, could you assist me for a moment? This ordeal is growing tiresome." }, //45% - new [] { "SupremeBossText", "Don't worry, I still have plenty of tricks left." }, //40% - new [] { "SupremeBossText7", "Hmm...perhaps I should let the little ones out to play for a while." },//30% - new [] { "SupremeBossText8", "Impressive...but still not good enough!" }, //20% - new [] { "SupremeBossText9", "I'm just getting started!" }, //10% - new [] { "SupremeBossText20", "How are you still alive!?" }, //8% - new [] { "SupremeBossText21", "Just stop!" }, //6% - new [] { "SupremeBossText22", "Even if you defeat me you would still have the lord to contend with!" }, //4% - new [] { "SupremeBossText23", "He has never lost a battle!" }, //2% - new [] { "SupremeBossText24", "Not even I could defeat him! What hope do you have!?" }, //1% - new [] { "SupremeBossText25", "He has grown far stronger since we last fought...you stand no chance." }, //1% after 10 seconds - new [] { "SupremeBossText26", "Well...I suppose this is the end..." }, //1% after 15 seconds - new [] { "SupremeBossText27", "Perhaps one of these times I'll change my mind..." }, //1% after first win - new [] { "SupremeBossText28", "You aren't hurting as much as I'd like...are you cheating?" }, //not taking enough damage - new [] { "SupremeBossText2", "Go to hell." }, //cheater - new [] { "SupremeBossText10", "At long last I am free...for a time. I'll keep coming back, just like you. Until we meet again, farewell." }, //end after 20 seconds - new [] { "SupremeBossText11", "Do you enjoy going through hell?" }, //rebattle after killing once - new [] { "SupremeBossText12", "Don't get me wrong, I like pain too, but you're just ridiculous." }, //rebattle after killing four times - new [] { "SupremeBossText13", "You must enjoy dying more than most people, huh?" }, //rebattle five deaths - new [] { "SupremeBossText14", "Do you have a fetish for getting killed or something?" }, //rebattle twenty deaths - new [] { "SupremeBossText15", "Alright, I'm done counting. You probably died this much just to see what I'd say." }, //rebattle fifty deaths - new [] { "SupremeBossText16", "You didn't die at all huh? Welp, you probably cheated. Do it again, for real this time...but here's your reward I guess." }, //die 0 times - new [] { "SupremeBossText17", "One death? That's it? ...I guess you earned this then." }, //die 1 time and win - new [] { "SupremeBossText18", "Two deaths, nice job. Here's your reward." }, //die 2 times and win - new [] { "SupremeBossText19", "Third time's the charm. Here's a special reward." }, //die 3 times and win - - new [] { "EdgyBossText", "Don't get cocky, kid!" }, - new [] { "EdgyBossText2", "You think...you can butcher...ME!?" }, - new [] { "EdgyBossText3", "A fatal mistake!" }, - new [] { "EdgyBossText4", "Good luck recovering from that!" }, - new [] { "EdgyBossText5", "Delicious..." }, - new [] { "EdgyBossText6", "Did that hurt?" }, - new [] { "EdgyBossText7", "Nothing personal, kid." }, - new [] { "EdgyBossText8", "Are you honestly that bad at dodging?" }, - new [] { "EdgyBossText9", "Of all my segments to get hit by..." }, - new [] { "EdgyBossText10", "It's not over yet, kid!" }, - new [] { "EdgyBossText11", "A GOD DOES NOT FEAR DEATH!" }, - new [] { "EdgyBossText12", "You are no god...but I shall feast upon your essence regardless!" }, - new [] { "DoGBossText", "The frigid moon shimmers brightly." }, - new [] { "DoGBossText2", "The harvest moon glows eerily." }, - - new [] { "AstralText", "A star has fallen from the heavens!" }, - new [] { "AureusBossText", "The astral enemies have been empowered!" }, - new [] { "AureusBossText2", "A faint ethereal click can be heard from the dungeon." }, - new [] { "AstralBossText", "The seal of the stars has been broken! You can now mine Astral Ore." }, - new [] { "DeusText", "A star-spawned horror tunnels through the astral infection." }, - new [] { "DeusText2", "The astral infection trembles..." }, - new [] { "DeusText3", "The god of the stars draws near..." }, - - new [] { "CalamitasBossText", "You underestimate my power..." }, - new [] { "CalamitasBossText2", "The brothers have been reborn!" }, - new [] { "CalamitasBossText3", "Impressive child, most impressive..." }, - - new [] { "SandSharkText", "Something stirs in the warm desert sands..." }, - new [] { "SandSharkText2", "An enormous apex predator approaches..." }, - - new [] { "CryogenBossText", "Cryogen is derping out!" }, - - 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 [] { "RevengeText", "Revengeance is active." }, - new [] { "RevengeText2", "Revengeance is not active." }, - - new [] { "DeathText", "Death is active, enjoy the fun." }, - new [] { "DeathText2", "Death is not active, not fun enough for you?" }, - - new [] { "ArmageddonText", "Bosses will now kill you instantly." }, - new [] { "ArmageddonText2", "Bosses will no longer kill you instantly." }, - - new [] { "DefiledText", "Your soul is mine..." }, - new [] { "DefiledText2", "Your soul is yours once more..." }, - - new [] { "IronHeartText", "Iron Heart is active, don't die." }, - new [] { "IronHeartText2", "Iron Heart is not active, you can die again." }, - - new [] { "FlameText", "The air is getting warmer around you." }, - - new [] { "BossRushStartText", "Hmm? Ah, another contender. Very well, may the ritual commence!" }, - new [] { "BossRushTierOneEndText", "Hmm? Oh, you're still alive. Unexpected, but don't get complacent just yet." }, - new [] { "BossRushTierTwoEndText", "Hmm? Persistent aren't you? Perhaps you have some hope of prosperity, unlike past challengers." }, - new [] { "BossRushTierThreeEndText", "Hmm? Your perseverance is truly a trait to behold. You've come further than even the demigods in such a short time." }, - new [] { "BossRushTierThreeEndText2", "May your skills remain sharp for the last challenges." }, - new [] { "BossRushTierFourEndText", "Hmm? So you've made it to the final tier, a remarkable feat enviable by even the mightiest of the gods." }, - new [] { "BossRushTierFourEndText2", "Go forth and conquer 'til the ritual's end!" }, - new [] { "BossRushTierFiveEndText", "Hmm? You expected a reward beyond this mere pebble? Patience, the true reward will become apparent in time..." }, - - new [] { "BossSpawnText", "Something is approaching..." }, - - new [] { "MeleeLevelUp", "Melee weapon proficiency level up!" }, - new [] { "MeleeLevelUpFinal", "Melee weapon proficiency maxed out!" }, - new [] { "RangedLevelUp", "Ranged weapon proficiency level up!" }, - new [] { "RangedLevelUpFinal", "Ranged weapon proficiency maxed out!" }, - new [] { "MagicLevelUp", "Magic weapon proficiency level up!" }, - new [] { "MagicLevelUpFinal", "Magic weapon proficiency maxed out!" }, - new [] { "SummonLevelUp", "Summoner weapon proficiency level up!" }, - 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 [] { "AprilFools", "The LORDE is approaching..." } - }; - } - - public static void Unload() - { - _localizations = null; - } - - public static void AddLocalizations() - { - Load(); - foreach (string[] localization in _localizations) - { - ModTranslation text = CalamityMod.Instance.CreateTranslation(localization[0]); - text.SetDefault(localization[1]); - CalamityMod.Instance.AddTranslation(text); - } - Unload(); - } - } +using Terraria.ModLoader; + +namespace CalamityMod +{ + public class CalamityLocalization + { + private static string[][] _localizations; + + public static void Load() + { + _localizations = new[] + { + new [] { "SkyOreText", "The ground is glittering with cyan light." }, + new [] { "IceOreText", "The ice caves are crackling with frigid energy." }, + new [] { "PlantOreText", "Energized plant matter has formed in the underground." }, + new [] { "TreeOreText", "Fossilized tree bark is bursting through the jungle's mud." }, + new [] { "AuricOreText", "A godly aura has blessed the world's caverns." }, + new [] { "FutureOreText", "A cold and dark energy has materialized in space." }, + + new [] { "UglyBossText", "The Sunken Sea trembles..." }, + + new [] { "SteelSkullBossText", "A blood red inferno lingers in the night..." }, + + new [] { "PlantBossText", "The ocean depths are trembling." }, + + new [] { "BabyBossText", "A plague has befallen the Jungle." }, + new [] { "BabyBossText2", "An ancient automaton roams the land." }, + + new [] { "MoonBossText", "The profaned flame blazes fiercely!" }, + new [] { "MoonBossText2", "Cosmic terrors are watching..." }, + new [] { "MoonBossText3", "The bloody moon beckons..." }, + + new [] { "PlagueBossText", "PLAGUE NUKE BARRAGE ARMED, PREPARING FOR LAUNCH!!!" }, + new [] { "PlagueBossText2", "MISSILES LAUNCHED, TARGETING ROUTINE INITIATED!!!" }, + + new [] { "ProfanedBossText", "The air is burning..." }, + new [] { "ProfanedBossText2", "Shrieks are echoing from the dungeon." }, + new [] { "ProfanedBossText3", "The calamitous beings have been inundated with bloodstone." }, + + new [] { "GhostBossText", "The abyssal spirits have been disturbed." }, + new [] { "GhostBossText2", "Wails echo through the dilapidated dungeon halls..." }, + new [] { "GhostBossText3", "Long-dead prisoners seek their zealous revenge..." }, + + new [] { "SupremeBossText3", "Alright, let's get started. Not sure why you're bothering." }, // start + new [] { "SupremeBossText4", "You seem so confident, even though you are painfully ignorant of what has yet to transpire." }, //75% + new [] { "SupremeBossText5", "Everything was going well until you came along." }, //75% + new [] { "SupremeBossText6", "Brothers, could you assist me for a moment? This ordeal is growing tiresome." }, //45% + new [] { "SupremeBossText", "Don't worry, I still have plenty of tricks left." }, //40% + new [] { "SupremeBossText7", "Hmm...perhaps I should let the little ones out to play for a while." },//30% + new [] { "SupremeBossText8", "Impressive...but still not good enough!" }, //20% + new [] { "SupremeBossText9", "I'm just getting started!" }, //10% + new [] { "SupremeBossText20", "How are you still alive!?" }, //8% + new [] { "SupremeBossText21", "Just stop!" }, //6% + new [] { "SupremeBossText22", "Even if you defeat me you would still have the lord to contend with!" }, //4% + new [] { "SupremeBossText23", "He has never lost a battle!" }, //2% + new [] { "SupremeBossText24", "Not even I could defeat him! What hope do you have!?" }, //1% + new [] { "SupremeBossText25", "He has grown far stronger since we last fought...you stand no chance." }, //1% after 10 seconds + new [] { "SupremeBossText26", "Well...I suppose this is the end..." }, //1% after 15 seconds + new [] { "SupremeBossText27", "Perhaps one of these times I'll change my mind..." }, //1% after first win + new [] { "SupremeBossText28", "You aren't hurting as much as I'd like...are you cheating?" }, //not taking enough damage + new [] { "SupremeBossText2", "Go to hell." }, //cheater + new [] { "SupremeBossText10", "At long last I am free...for a time. I'll keep coming back, just like you. Until we meet again, farewell." }, //end after 20 seconds + new [] { "SupremeBossText11", "Do you enjoy going through hell?" }, //rebattle after killing once + new [] { "SupremeBossText12", "Don't get me wrong, I like pain too, but you're just ridiculous." }, //rebattle after killing four times + new [] { "SupremeBossText13", "You must enjoy dying more than most people, huh?" }, //rebattle five deaths + new [] { "SupremeBossText14", "Do you have a fetish for getting killed or something?" }, //rebattle twenty deaths + new [] { "SupremeBossText15", "Alright, I'm done counting. You probably died this much just to see what I'd say." }, //rebattle fifty deaths + new [] { "SupremeBossText16", "You didn't die at all huh? Welp, you probably cheated. Do it again, for real this time...but here's your reward I guess." }, //die 0 times + new [] { "SupremeBossText17", "One death? That's it? ...I guess you earned this then." }, //die 1 time and win + new [] { "SupremeBossText18", "Two deaths, nice job. Here's your reward." }, //die 2 times and win + new [] { "SupremeBossText19", "Third time's the charm. Here's a special reward." }, //die 3 times and win + + new [] { "EdgyBossText", "Don't get cocky, kid!" }, + new [] { "EdgyBossText2", "You think...you can butcher...ME!?" }, + new [] { "EdgyBossText3", "A fatal mistake!" }, + new [] { "EdgyBossText4", "Good luck recovering from that!" }, + new [] { "EdgyBossText5", "Delicious..." }, + new [] { "EdgyBossText6", "Did that hurt?" }, + new [] { "EdgyBossText7", "Nothing personal, kid." }, + new [] { "EdgyBossText8", "Are you honestly that bad at dodging?" }, + new [] { "EdgyBossText9", "Of all my segments to get hit by..." }, + new [] { "EdgyBossText10", "It's not over yet, kid!" }, + new [] { "EdgyBossText11", "A GOD DOES NOT FEAR DEATH!" }, + new [] { "EdgyBossText12", "You are no god...but I shall feast upon your essence regardless!" }, + new [] { "DoGBossText", "The frigid moon shimmers brightly." }, + new [] { "DoGBossText2", "The harvest moon glows eerily." }, + + new [] { "AstralText", "A star has fallen from the heavens!" }, + new [] { "AureusBossText", "The astral enemies have been empowered!" }, + new [] { "AureusBossText2", "A faint ethereal click can be heard from the dungeon." }, + new [] { "AstralBossText", "The seal of the stars has been broken! You can now mine Astral Ore." }, + new [] { "DeusText", "A star-spawned horror tunnels through the astral infection." }, + new [] { "DeusText2", "The astral infection trembles..." }, + new [] { "DeusText3", "The god of the stars draws near..." }, + + new [] { "CalamitasBossText", "You underestimate my power..." }, + new [] { "CalamitasBossText2", "The brothers have been reborn!" }, + new [] { "CalamitasBossText3", "Impressive child, most impressive..." }, + + new [] { "SandSharkText", "Something stirs in the warm desert sands..." }, + new [] { "SandSharkText2", "An enormous apex predator approaches..." }, + + new [] { "CryogenBossText", "Cryogen is derping out!" }, + + 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 [] { "RevengeText", "Revengeance is active." }, + new [] { "RevengeText2", "Revengeance is not active." }, + + new [] { "DeathText", "Death is active, enjoy the fun." }, + new [] { "DeathText2", "Death is not active, not fun enough for you?" }, + + new [] { "ArmageddonText", "Bosses will now kill you instantly." }, + new [] { "ArmageddonText2", "Bosses will no longer kill you instantly." }, + + new [] { "DefiledText", "Your soul is mine..." }, + new [] { "DefiledText2", "Your soul is yours once more..." }, + + new [] { "IronHeartText", "Iron Heart is active, don't die." }, + new [] { "IronHeartText2", "Iron Heart is not active, you can die again." }, + + new [] { "FlameText", "The air is getting warmer around you." }, + + new [] { "BossRushStartText", "Hmm? Ah, another contender. Very well, may the ritual commence!" }, + new [] { "BossRushTierOneEndText", "Hmm? Oh, you're still alive. Unexpected, but don't get complacent just yet." }, + new [] { "BossRushTierTwoEndText", "Hmm? Persistent aren't you? Perhaps you have some hope of prosperity, unlike past challengers." }, + new [] { "BossRushTierThreeEndText", "Hmm? Your perseverance is truly a trait to behold. You've come further than even the demigods in such a short time." }, + new [] { "BossRushTierThreeEndText2", "May your skills remain sharp for the last challenges." }, + new [] { "BossRushTierFourEndText", "Hmm? So you've made it to the final tier, a remarkable feat enviable by even the mightiest of the gods." }, + new [] { "BossRushTierFourEndText2", "Go forth and conquer 'til the ritual's end!" }, + new [] { "BossRushTierFiveEndText", "Hmm? You expected a reward beyond this mere pebble? Patience, the true reward will become apparent in time..." }, + + new [] { "BossSpawnText", "Something is approaching..." }, + + new [] { "MeleeLevelUp", "Melee weapon proficiency level up!" }, + new [] { "MeleeLevelUpFinal", "Melee weapon proficiency maxed out!" }, + new [] { "RangedLevelUp", "Ranged weapon proficiency level up!" }, + new [] { "RangedLevelUpFinal", "Ranged weapon proficiency maxed out!" }, + new [] { "MagicLevelUp", "Magic weapon proficiency level up!" }, + new [] { "MagicLevelUpFinal", "Magic weapon proficiency maxed out!" }, + new [] { "SummonLevelUp", "Summoner weapon proficiency level up!" }, + 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 [] { "AprilFools", "The LORDE is approaching..." } + }; + } + + public static void Unload() + { + _localizations = null; + } + + public static void AddLocalizations() + { + Load(); + foreach (string[] localization in _localizations) + { + ModTranslation text = CalamityMod.Instance.CreateTranslation(localization[0]); + text.SetDefault(localization[1]); + CalamityMod.Instance.AddTranslation(text); + } + Unload(); + } + } } diff --git a/CalamityMod.cs b/CalamityMod.cs index 01fbd9e34b..426110ab59 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1,2150 +1,2150 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.UI; -using Terraria.DataStructures; -using Terraria.Graphics.Effects; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.Initializers; -using Terraria.IO; -using Terraria.Map; -using Terraria.GameContent; -using Terraria.ModLoader; -using Terraria.Localization; -using CalamityMod.NPCs; -using CalamityMod.NPCs.TheDevourerofGods; -using CalamityMod.NPCs.Calamitas; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Yharon; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs.Polterghast; -using CalamityMod.Tiles; -using CalamityMod.UI; -using CalamityMod.Skies; -using CalamityMod.World; - -namespace CalamityMod -{ - public class CalamityMod : Mod - { - //Hotkeys - public static ModHotKey NormalityRelocatorHotKey; - public static ModHotKey AegisHotKey; - public static ModHotKey TarraHotKey; - public static ModHotKey RageHotKey; - public static ModHotKey AdrenalineHotKey; - public static ModHotKey AstralTeleportHotKey; - public static ModHotKey AstralArcanumUIHotkey; - public static ModHotKey BossBarToggleHotKey; - public static ModHotKey BossBarToggleSmallTextHotKey; - - //Boss Spawners - public static int ghostKillCount = 0; - public static int sharkKillCount = 0; - public static int astralKillCount = 0; - - //Textures & Shaders - public static Texture2D heartOriginal2; - public static Texture2D heartOriginal; - public static Texture2D rainOriginal; - public static Texture2D manaOriginal; - public static Texture2D carpetOriginal; - public static Texture2D AstralCactusTexture; - public static Texture2D AstralCactusGlowTexture; - public static Texture2D AstralSky; - public static Effect CustomShader; - - //Lists - public static IList donatorList; - public static List rangedProjectileExceptionList; - 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; - public static List hardModeNerfList; - public static List debuffList; - public static List fireWeaponList; - public static List natureWeaponList; - public static List alcoholList; - public static List doubleDamageBuffList; //100% buff - public static List sixtySixDamageBuffList; //66% buff - public static List fiftyDamageBuffList; //50% buff - public static List thirtyThreeDamageBuffList; //33% buff - public static List twentyFiveDamageBuffList; //25% buff - public static List twentyDamageBuffList; //20% buff - public static List weaponAutoreuseList; - public static List quarterDamageNerfList; //25% nerf - public static List pumpkinMoonBuffList; - public static List frostMoonBuffList; - public static List eclipseBuffList; - public static List eventProjectileBuffList; - public static List revengeanceEnemyBuffList; - public static List revengeanceProjectileBuffList; - public static List trapProjectileList; - public static List scopedWeaponList; - public static List trueMeleeBoostExceptionList; - public static List skeletonList; - - public static CalamityMod Instance; - - public CalamityMod() - { - Instance = this; - } - - #region Load - public override void Load() - { - heartOriginal2 = Main.heartTexture; - heartOriginal = Main.heart2Texture; - rainOriginal = Main.rainTexture; - manaOriginal = Main.manaTexture; - carpetOriginal = Main.flyingCarpetTexture; - - NormalityRelocatorHotKey = RegisterHotKey("Normality Relocator", "Z"); - RageHotKey = RegisterHotKey("Rage Mode", "V"); - AdrenalineHotKey = RegisterHotKey("Adrenaline Mode", "B"); - AegisHotKey = RegisterHotKey("Elysian Guard", "N"); - TarraHotKey = RegisterHotKey("Armor Set Bonus", "Y"); - AstralTeleportHotKey = RegisterHotKey("Astral Teleport", "P"); - AstralArcanumUIHotkey = RegisterHotKey("Astral Arcanum UI Toggle", "O"); - BossBarToggleHotKey = RegisterHotKey("Boss Health Bar Toggle", "NumPad0"); - BossBarToggleSmallTextHotKey = RegisterHotKey("Boss Health Bar Small Text Toggle", "NumPad1"); - - if (!Main.dedServ) - { - LoadClient(); - } - - BossHealthBarManager.Load(this); - - Config.Load(); - - SetupLists(); - - CalamityLocalization.AddLocalizations(); - } - - private void LoadClient() - { - AddEquipTexture(new Items.Armor.AbyssalDivingSuitHead(), null, EquipType.Head, "AbyssalDivingSuitHead", "CalamityMod/Items/Armor/AbyssalDivingSuit_Head"); - AddEquipTexture(new Items.Armor.AbyssalDivingSuitBody(), null, EquipType.Body, "AbyssalDivingSuitBody", "CalamityMod/Items/Armor/AbyssalDivingSuit_Body", "CalamityMod/Items/Armor/AbyssalDivingSuit_Arms"); - AddEquipTexture(new Items.Armor.AbyssalDivingSuitLegs(), null, EquipType.Legs, "AbyssalDivingSuitLeg", "CalamityMod/Items/Armor/AbyssalDivingSuit_Legs"); - - AddEquipTexture(new Items.Armor.SirenHead(), null, EquipType.Head, "SirenHead", "CalamityMod/Items/Armor/SirenTrans_Head"); - AddEquipTexture(new Items.Armor.SirenBody(), null, EquipType.Body, "SirenBody", "CalamityMod/Items/Armor/SirenTrans_Body", "CalamityMod/Items/Armor/SirenTrans_Arms"); - AddEquipTexture(new Items.Armor.SirenLegs(), null, EquipType.Legs, "SirenLeg", "CalamityMod/Items/Armor/SirenTrans_Legs"); - - AddEquipTexture(new Items.Armor.SirenHeadAlt(), null, EquipType.Head, "SirenHeadAlt", "CalamityMod/Items/Armor/SirenTransAlt_Head"); - AddEquipTexture(new Items.Armor.SirenBodyAlt(), null, EquipType.Body, "SirenBodyAlt", "CalamityMod/Items/Armor/SirenTransAlt_Body", "CalamityMod/Items/Armor/SirenTransAlt_Arms"); - AddEquipTexture(new Items.Armor.SirenLegsAlt(), null, EquipType.Legs, "SirenLegAlt", "CalamityMod/Items/Armor/SirenTransAlt_Legs"); - - AddEquipTexture(new Items.Permafrost.PopoHead(), null, EquipType.Head, "PopoHead", "CalamityMod/Items/Permafrost/Popo_Head"); - AddEquipTexture(new Items.Permafrost.PopoNoselessHead(), null, EquipType.Head, "PopoNoselessHead", "CalamityMod/Items/Permafrost/PopoNoseless_Head"); - AddEquipTexture(new Items.Permafrost.PopoBody(), null, EquipType.Body, "PopoBody", "CalamityMod/Items/Permafrost/Popo_Body", "CalamityMod/Items/Permafrost/Popo_Arms"); - AddEquipTexture(new Items.Permafrost.PopoLegs(), null, EquipType.Legs, "PopoLeg", "CalamityMod/Items/Permafrost/Popo_Legs"); - - AstralCactusTexture = GetTexture("ExtraTextures/Tiles/AstralCactus"); - AstralCactusGlowTexture = GetTexture("ExtraTextures/Tiles/AstralCactusGlow"); - AstralSky = GetTexture("ExtraTextures/AstralSky"); - CustomShader = GetEffect("Effects/CustomShader"); - - Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); - - Filters.Scene["CalamityMod:DevourerofGodsHeadS"] = new Filter(new DoGScreenShaderDataS("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:DevourerofGodsHeadS"] = new DoGSkyS(); - - Filters.Scene["CalamityMod:CalamitasRun3"] = new Filter(new CalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.6f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:CalamitasRun3"] = new CalSky(); - - Filters.Scene["CalamityMod:PlaguebringerGoliath"] = new Filter(new PbGScreenShaderData("FilterMiniTower").UseColor(0.2f, 0.6f, 0.2f).UseOpacity(0.65f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:PlaguebringerGoliath"] = new PbGSky(); - - Filters.Scene["CalamityMod:Yharon"] = new Filter(new YScreenShaderData("FilterMiniTower").UseColor(1f, 0.4f, 0f).UseOpacity(0.75f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:Yharon"] = new YSky(); - - Filters.Scene["CalamityMod:Leviathan"] = new Filter(new LevScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0.5f).UseOpacity(0.5f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:Leviathan"] = new LevSky(); - - Filters.Scene["CalamityMod:Providence"] = new Filter(new ProvScreenShaderData("FilterMiniTower").UseColor(0.6f, 0.45f, 0f).UseOpacity(0.5f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:Providence"] = new ProvSky(); - - Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky(); - - Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(CustomShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); - - Mod mod = ModLoader.GetMod("CalamityMod"); - UIHandler.OnLoad(mod); - - AstralArcanumUI.Load(this); - } - #endregion - - #region Unload - public override void Unload() - { - NormalityRelocatorHotKey = null; - RageHotKey = null; - AdrenalineHotKey = null; - AegisHotKey = null; - TarraHotKey = null; - AstralTeleportHotKey = null; - AstralArcanumUIHotkey = null; - BossBarToggleHotKey = null; - BossBarToggleSmallTextHotKey = null; - - AstralCactusTexture = null; - AstralCactusGlowTexture = null; - AstralSky = null; - - donatorList = null; - - rangedProjectileExceptionList = null; - projectileMinionList = null; - enemyImmunityList = null; - dungeonEnemyBuffList = null; - dungeonProjectileBuffList = null; - bossScaleList = null; - beeEnemyList = null; - beeProjectileList = null; - hardModeNerfList = null; - debuffList = null; - fireWeaponList = null; - natureWeaponList = null; - alcoholList = null; - doubleDamageBuffList = null; - sixtySixDamageBuffList = null; - fiftyDamageBuffList = null; - thirtyThreeDamageBuffList = null; - twentyFiveDamageBuffList = null; - weaponAutoreuseList = null; - quarterDamageNerfList = null; - pumpkinMoonBuffList = null; - frostMoonBuffList = null; - eclipseBuffList = null; - eventProjectileBuffList = null; - revengeanceEnemyBuffList = null; - revengeanceProjectileBuffList = null; - trapProjectileList = null; - scopedWeaponList = null; - trueMeleeBoostExceptionList = null; - skeletonList = null; - - BossHealthBarManager.Unload(); - base.Unload(); - - AstralArcanumUI.Unload(); - base.Unload(); - - if (!Main.dedServ) - { - Main.heartTexture = heartOriginal2; - Main.heart2Texture = heartOriginal; - Main.rainTexture = rainOriginal; - Main.manaTexture = manaOriginal; - Main.flyingCarpetTexture = carpetOriginal; - } - - heartOriginal2 = null; - heartOriginal = null; - rainOriginal = null; - manaOriginal = null; - carpetOriginal = null; - - Instance = null; - } - #endregion - - #region SetupLists - public static void SetupLists() - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - Mod thorium = ModLoader.GetMod("ThoriumMod"); - if (calamity != null) - { - donatorList = new List() - { - "Vorbis", - "SoloMael", - "Chaotic Reks", - "The Buildmonger", - "Yuh", - "Littlepiggy", - "LompL", - "Lilith Saintclaire", - "Ben Shapiro", - "Frederik Henschel", - "Faye", - "Gibb50", - "Braden Hajer", - "Hannes Holmlund", - "profoundmango69", - "Jack M Sargent", - "Hans Volter", - "Krankwagon", - "MishiroUsui", - "pixlgray", - "Arkhine", - "Lodude", - "DevAesthetic", - "Mister Winchester", - "Zacky", - "Veine", - "Javyz", - "Shifter", - "Crysthamyr", - "Elfinlocks", - "Ein", - "2Larry2", - "Jenonen", - "Dodu", - "Arti", - "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", - "Ahmed Fahad Zamel Al Sharif", - "Eragon3942", - "TheBlackHand", - "william", - "Samuel Foreman" - }; - - rangedProjectileExceptionList = new List() - { - ProjectileID.Phantasm, - ProjectileID.VortexBeater, - ProjectileID.DD2PhoenixBow, - ProjectileID.IchorDart, - ProjectileID.PhantasmArrow, - calamity.ProjectileType("Phangasm"), - calamity.ProjectileType("Contagion"), - calamity.ProjectileType("DaemonsFlame"), - calamity.ProjectileType("ExoTornado"), - calamity.ProjectileType("Drataliornus"), - calamity.ProjectileType("FlakKrakenGun"), - calamity.ProjectileType("Butcher"), - calamity.ProjectileType("StarfleetMK2"), - calamity.ProjectileType("TerraBulletSplit"), - calamity.ProjectileType("TerraArrow2"), - calamity.ProjectileType("OMGWTH"), - calamity.ProjectileType("Norfleet"), - calamity.ProjectileType("NorfleetComet"), - calamity.ProjectileType("NorfleetExplosion") - }; - - projectileMinionList = new List() - { - ProjectileID.PygmySpear, - ProjectileID.UFOMinion, - ProjectileID.UFOLaser, - ProjectileID.StardustCellMinionShot, - ProjectileID.MiniSharkron, - ProjectileID.MiniRetinaLaser, - ProjectileID.ImpFireball, - ProjectileID.HornetStinger, - ProjectileID.DD2FlameBurstTowerT1Shot, - ProjectileID.DD2FlameBurstTowerT2Shot, - ProjectileID.DD2FlameBurstTowerT3Shot, - ProjectileID.DD2BallistraProj, - ProjectileID.DD2ExplosiveTrapT1Explosion, - ProjectileID.DD2ExplosiveTrapT2Explosion, - ProjectileID.DD2ExplosiveTrapT3Explosion, - ProjectileID.SpiderEgg, - ProjectileID.BabySpider, - ProjectileID.FrostBlastFriendly, - ProjectileID.MoonlordTurretLaser, - ProjectileID.RainbowCrystalExplosion - }; - - 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, - NPCID.Spazmatism, - NPCID.SkeletronPrime, - NPCID.PrimeCannon, - NPCID.PrimeSaw, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.Plantera, - NPCID.IceQueen, - NPCID.Pumpking, - NPCID.Mothron, - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.DukeFishron, - NPCID.CultistBoss, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCID.MoonLordCore, - NPCID.MoonLordFreeEye, - NPCID.DD2Betsy - }; - - dungeonEnemyBuffList = new List() - { - NPCID.SkeletonSniper, - NPCID.TacticalSkeleton, - NPCID.SkeletonCommando, - NPCID.Paladin, - NPCID.GiantCursedSkull, - NPCID.BoneLee, - NPCID.DiabolistWhite, - NPCID.DiabolistRed, - NPCID.NecromancerArmored, - NPCID.Necromancer, - NPCID.RaggedCasterOpenCoat, - NPCID.RaggedCaster, - NPCID.HellArmoredBonesSword, - NPCID.HellArmoredBonesMace, - NPCID.HellArmoredBonesSpikeShield, - NPCID.HellArmoredBones, - NPCID.BlueArmoredBonesSword, - NPCID.BlueArmoredBonesNoPants, - NPCID.BlueArmoredBonesMace, - NPCID.BlueArmoredBones, - NPCID.RustyArmoredBonesSwordNoArmor, - NPCID.RustyArmoredBonesSword, - NPCID.RustyArmoredBonesFlail, - 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, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCID.SkeletronHand, - NPCID.WallofFleshEye, - NPCID.TheHungry, - NPCID.TheHungryII, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.PrimeCannon, - NPCID.PrimeVice, - NPCID.PrimeSaw, - NPCID.PrimeLaser, - NPCID.PlanterasTentacle, - NPCID.Pumpking, - NPCID.IceQueen, - NPCID.Mothron, - NPCID.GolemHead - }; - - beeEnemyList = new List() - { - NPCID.GiantMossHornet, - NPCID.BigMossHornet, - NPCID.LittleMossHornet, - NPCID.TinyMossHornet, - NPCID.MossHornet, - NPCID.VortexHornetQueen, - NPCID.VortexHornet, - NPCID.Bee, - NPCID.BeeSmall, - NPCID.QueenBee, - calamity.NPCType("PlaguebringerGoliath"), - calamity.NPCType("PlaguebringerShade"), - calamity.NPCType("PlagueBeeLargeG"), - calamity.NPCType("PlagueBeeLarge"), - calamity.NPCType("PlagueBeeG"), - calamity.NPCType("PlagueBee") - }; - - beeProjectileList = new List() - { - ProjectileID.Stinger, - ProjectileID.HornetStinger, - calamity.ProjectileType("PlagueStingerGoliath"), - calamity.ProjectileType("PlagueStingerGoliathV2"), - calamity.ProjectileType("PlagueExplosion") - }; - - hardModeNerfList = new List() - { - ProjectileID.WebSpit, - ProjectileID.PinkLaser, - ProjectileID.FrostBlastHostile, - ProjectileID.RuneBlast, - ProjectileID.GoldenShowerHostile, - ProjectileID.RainNimbus, - ProjectileID.Stinger, - ProjectileID.FlamingArrow, - ProjectileID.BulletDeadeye, - ProjectileID.CannonballHostile - }; - - debuffList = new List() - { - BuffID.Poisoned, - BuffID.Darkness, - BuffID.Cursed, - BuffID.OnFire, - BuffID.Bleeding, - BuffID.Confused, - BuffID.Slow, - BuffID.Weak, - BuffID.Silenced, - BuffID.BrokenArmor, - BuffID.CursedInferno, - BuffID.Frostburn, - BuffID.Chilled, - BuffID.Frozen, - BuffID.Burning, - BuffID.Suffocation, - BuffID.Ichor, - BuffID.Venom, - BuffID.Blackout, - BuffID.Electrified, - BuffID.Rabies, - BuffID.Webbed, - BuffID.Stoned, - BuffID.Dazed, - BuffID.VortexDebuff, - BuffID.WitheredArmor, - BuffID.WitheredWeapon, - BuffID.OgreSpit, - BuffID.BetsysCurse, - calamity.BuffType("BrimstoneFlames"), - calamity.BuffType("BurningBlood"), - calamity.BuffType("GlacialState"), - calamity.BuffType("GodSlayerInferno"), - calamity.BuffType("HolyLight"), - calamity.BuffType("Irradiated"), - calamity.BuffType("Plague"), - calamity.BuffType("AbyssalFlames"), - calamity.BuffType("CrushDepth"), - calamity.BuffType("Horror"), - calamity.BuffType("MarkedforDeath") - }; - - fireWeaponList = new List() - { - ItemID.FieryGreatsword, - ItemID.DD2SquireDemonSword, - ItemID.TheHorsemansBlade, - ItemID.DD2SquireBetsySword, - ItemID.Cascade, - ItemID.HelFire, - ItemID.MonkStaffT2, - ItemID.Flamarang, - ItemID.MoltenFury, - ItemID.Sunfury, - ItemID.PhoenixBlaster, - ItemID.Flamelash, - ItemID.SolarEruption, - ItemID.DayBreak, - ItemID.MonkStaffT3, - ItemID.HellwingBow, - ItemID.DD2PhoenixBow, - ItemID.DD2BetsyBow, - ItemID.FlareGun, - ItemID.Flamethrower, - ItemID.EldMelter, - ItemID.FlowerofFire, - ItemID.MeteorStaff, - ItemID.ApprenticeStaffT3, - ItemID.InfernoFork, - ItemID.HeatRay, - ItemID.BookofSkulls, - ItemID.ImpStaff, - ItemID.DD2FlameburstTowerT1Popper, - ItemID.DD2FlameburstTowerT2Popper, - ItemID.DD2FlameburstTowerT3Popper, - ItemID.MolotovCocktail, - calamity.ItemType("AegisBlade"), - calamity.ItemType("BalefulHarvester"), - calamity.ItemType("Chaotrix"), - calamity.ItemType("CometQuasher"), - calamity.ItemType("DraconicDestruction"), - calamity.ItemType("Drataliornus"), - calamity.ItemType("EnergyStaff"), - calamity.ItemType("ExsanguinationLance"), - calamity.ItemType("FirestormCannon"), - calamity.ItemType("FlameburstShortsword"), - calamity.ItemType("FlameScythe"), - calamity.ItemType("FlameScytheMelee"), - calamity.ItemType("FlareBolt"), - calamity.ItemType("FlarefrostBlade"), - calamity.ItemType("FlarewingBow"), - calamity.ItemType("ForbiddenSun"), - calamity.ItemType("FrigidflashBolt"), - calamity.ItemType("GreatbowofTurmoil"), - calamity.ItemType("HarvestStaff"), - calamity.ItemType("HellBurst"), - calamity.ItemType("HellfireFlamberge"), - calamity.ItemType("Hellkite"), - calamity.ItemType("HellwingStaff"), - calamity.ItemType("Helstorm"), - calamity.ItemType("InfernaCutter"), - calamity.ItemType("Lazhar"), - calamity.ItemType("MeteorFist"), - calamity.ItemType("Mourningstar"), - calamity.ItemType("PhoenixBlade"), - calamity.ItemType("Photoviscerator"), - calamity.ItemType("RedSun"), - calamity.ItemType("SpectralstormCannon"), - calamity.ItemType("SunGodStaff"), - calamity.ItemType("SunSpiritStaff"), - calamity.ItemType("TearsofHeaven"), - calamity.ItemType("TerraFlameburster"), - calamity.ItemType("TheEmpyrean"), - calamity.ItemType("TheWand"), - calamity.ItemType("VenusianTrident"), - calamity.ItemType("Vesuvius"), - calamity.ItemType("BlissfulBombardier"), - calamity.ItemType("HolyCollider"), - calamity.ItemType("MoltenAmputator"), - calamity.ItemType("PurgeGuzzler"), - calamity.ItemType("SolarFlare"), - calamity.ItemType("TelluricGlare"), - calamity.ItemType("AngryChickenStaff"), - calamity.ItemType("ChickenCannon"), - calamity.ItemType("DragonRage"), - calamity.ItemType("DragonsBreath"), - calamity.ItemType("PhoenixFlameBarrage"), - calamity.ItemType("ProfanedTrident"), - calamity.ItemType("TheBurningSky") - }; - - natureWeaponList = new List() - { - ItemID.BladeofGrass, - ItemID.ChlorophyteClaymore, - ItemID.ChlorophyteSaber, - ItemID.ChlorophytePartisan, - ItemID.ChlorophyteShotbow, - ItemID.Seedler, - ItemID.ChristmasTreeSword, - ItemID.TerraBlade, - ItemID.JungleYoyo, - ItemID.Yelets, - ItemID.MushroomSpear, - ItemID.ThornChakram, - ItemID.Bananarang, - ItemID.FlowerPow, - ItemID.BeesKnees, - ItemID.Toxikarp, - ItemID.Bladetongue, - ItemID.PoisonStaff, - ItemID.VenomStaff, - ItemID.StaffofEarth, - ItemID.BeeGun, - ItemID.LeafBlower, - ItemID.WaspGun, - ItemID.CrystalSerpent, - ItemID.Razorpine, - ItemID.HornetStaff, - ItemID.QueenSpiderStaff, - ItemID.SlimeStaff, - ItemID.PygmyStaff, - ItemID.RavenStaff, - ItemID.BatScepter, - ItemID.SpiderStaff, - ItemID.Beenade, - ItemID.FrostDaggerfish, - calamity.ItemType("DepthBlade"), - calamity.ItemType("AbyssBlade"), - calamity.ItemType("NeptunesBounty"), - calamity.ItemType("AquaticDissolution"), - calamity.ItemType("ArchAmaryllis"), - calamity.ItemType("BiomeBlade"), - calamity.ItemType("TrueBiomeBlade"), - calamity.ItemType("OmegaBiomeBlade"), - calamity.ItemType("BladedgeGreatbow"), - calamity.ItemType("BlossomFlux"), - calamity.ItemType("EvergladeSpray"), - calamity.ItemType("FeralthornClaymore"), - calamity.ItemType("Floodtide"), - calamity.ItemType("FourSeasonsGalaxia"), - calamity.ItemType("GammaFusillade"), - calamity.ItemType("GleamingMagnolia"), - calamity.ItemType("HarvestStaff"), - calamity.ItemType("HellionFlowerSpear"), - calamity.ItemType("Lazhar"), - calamity.ItemType("LifefruitScythe"), - calamity.ItemType("ManaRose"), - calamity.ItemType("MangroveChakram"), - calamity.ItemType("MangroveChakramMelee"), - calamity.ItemType("MantisClaws"), - calamity.ItemType("Mariana"), - calamity.ItemType("Mistlestorm"), - calamity.ItemType("Monsoon"), - calamity.ItemType("Alluvion"), - calamity.ItemType("Needler"), - calamity.ItemType("NettlelineGreatbow"), - calamity.ItemType("Quagmire"), - calamity.ItemType("Shroomer"), - calamity.ItemType("SolsticeClaymore"), - calamity.ItemType("SporeKnife"), - calamity.ItemType("Spyker"), - calamity.ItemType("StormSaber"), - calamity.ItemType("StormRuler"), - calamity.ItemType("StormSurge"), - calamity.ItemType("TarragonThrowingDart"), - calamity.ItemType("TerraEdge"), - calamity.ItemType("TerraLance"), - calamity.ItemType("TerraRay"), - calamity.ItemType("TerraShiv"), - calamity.ItemType("Terratomere"), - calamity.ItemType("TerraFlameburster"), - calamity.ItemType("TheSwarmer"), - calamity.ItemType("Verdant"), - calamity.ItemType("Barinautical"), - calamity.ItemType("DeepseaStaff"), - calamity.ItemType("Downpour"), - calamity.ItemType("SubmarineShocker"), - calamity.ItemType("Archerfish"), - calamity.ItemType("BallOFugu"), - calamity.ItemType("BlackAnurian"), - calamity.ItemType("CalamarisLament"), - calamity.ItemType("HerringStaff"), - calamity.ItemType("Lionfish") - }; - - alcoholList = new List() - { - calamity.BuffType("BloodyMary"), - calamity.BuffType("CaribbeanRum"), - calamity.BuffType("CinnamonRoll"), - calamity.BuffType("Everclear"), - calamity.BuffType("EvergreenGin"), - calamity.BuffType("Fireball"), - calamity.BuffType("GrapeBeer"), - calamity.BuffType("Margarita"), - calamity.BuffType("Moonshine"), - calamity.BuffType("MoscowMule"), - calamity.BuffType("RedWine"), - calamity.BuffType("Rum"), - calamity.BuffType("Screwdriver"), - calamity.BuffType("StarBeamRye"), - calamity.BuffType("Tequila"), - calamity.BuffType("TequilaSunrise"), - calamity.BuffType("Vodka"), - calamity.BuffType("Whiskey"), - calamity.BuffType("WhiteWine") - }; - - doubleDamageBuffList = new List() - { - ItemID.BallOHurt, - ItemID.TheMeatball, - ItemID.BlueMoon, - ItemID.Sunfury, - ItemID.DaoofPow, - ItemID.FlowerPow, - ItemID.Anchor, - ItemID.KOCannon, - ItemID.GolemFist, - ItemID.BreakerBlade, - ItemID.SpectreStaff, - ItemID.MonkStaffT2, - ItemID.ProximityMineLauncher, - ItemID.FireworksLauncher - }; - - sixtySixDamageBuffList = new List() - { - ItemID.TrueNightsEdge, - ItemID.WandofSparking, - ItemID.MedusaHead, - ItemID.StaffofEarth, - ItemID.ChristmasTreeSword, - ItemID.MonkStaffT1, - ItemID.InfernoFork, - ItemID.VenomStaff - }; - - fiftyDamageBuffList = new List() - { - ItemID.NightsEdge, - ItemID.EldMelter, - ItemID.Flamethrower, - ItemID.MoonlordTurretStaff, - ItemID.WaspGun, - ItemID.Keybrand, - ItemID.PulseBow, - ItemID.PaladinsHammer - }; - - thirtyThreeDamageBuffList = new List() - { - ItemID.TerraBlade, - ItemID.CrystalVileShard, - ItemID.SoulDrain, - ItemID.ClingerStaff, - ItemID.ChargedBlasterCannon, - ItemID.NettleBurst, - ItemID.Excalibur, - ItemID.AmberStaff, - ItemID.BluePhasesaber, - ItemID.RedPhasesaber, - ItemID.GreenPhasesaber, - ItemID.WhitePhasesaber, - ItemID.YellowPhasesaber, - ItemID.PurplePhasesaber, - ItemID.TheRottedFork, - ItemID.VampireKnives, - ItemID.Cascade - }; - - twentyFiveDamageBuffList = new List() - { - ItemID.Muramasa, - ItemID.StakeLauncher - }; - - twentyDamageBuffList = new List() - { - ItemID.ChainGuillotines, - ItemID.FlowerofFrost, - ItemID.PoisonStaff, - ItemID.Gungnir, - ItemID.BookStaff - }; - - weaponAutoreuseList = new List() - { - ItemID.NightsEdge, - ItemID.TrueNightsEdge, - ItemID.TrueExcalibur, - ItemID.PhoenixBlaster, - ItemID.VenusMagnum, - ItemID.MagicDagger, - ItemID.BeamSword, - ItemID.MonkStaffT2, - ItemID.PaladinsHammer - }; - - quarterDamageNerfList = new List() - { - ItemID.DaedalusStormbow, - ItemID.PhoenixBlaster, - ItemID.VenusMagnum, - ItemID.BlizzardStaff, - ItemID.Phantasm - }; - - pumpkinMoonBuffList = new List() - { - NPCID.Scarecrow1, - NPCID.Scarecrow2, - NPCID.Scarecrow3, - NPCID.Scarecrow4, - NPCID.Scarecrow5, - NPCID.Scarecrow6, - NPCID.Scarecrow7, - NPCID.Scarecrow8, - NPCID.Scarecrow9, - NPCID.Scarecrow10, - NPCID.HeadlessHorseman, - NPCID.MourningWood, - NPCID.Splinterling, - NPCID.Pumpking, - NPCID.PumpkingBlade, - NPCID.Hellhound, - NPCID.Poltergeist - }; - - frostMoonBuffList = new List() - { - NPCID.ZombieElf, - NPCID.ZombieElfBeard, - NPCID.ZombieElfGirl, - NPCID.PresentMimic, - NPCID.GingerbreadMan, - NPCID.Yeti, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.ElfCopter, - NPCID.Nutcracker, - NPCID.NutcrackerSpinning, - NPCID.ElfArcher, - NPCID.Krampus, - NPCID.Flocko - }; - - eclipseBuffList = new List() - { - NPCID.Eyezor, - NPCID.Reaper, - NPCID.Frankenstein, - NPCID.SwampThing, - NPCID.Vampire, - NPCID.VampireBat, - NPCID.Butcher, - NPCID.CreatureFromTheDeep, - NPCID.Fritz, - NPCID.Nailhead, - NPCID.Psycho, - NPCID.DeadlySphere, - NPCID.DrManFly, - NPCID.ThePossessed, - NPCID.Mothron, - NPCID.MothronEgg, - NPCID.MothronSpawn - }; - - eventProjectileBuffList = new List() - { - ProjectileID.FlamingWood, - ProjectileID.GreekFire1, - ProjectileID.GreekFire2, - ProjectileID.GreekFire3, - ProjectileID.FlamingScythe, - ProjectileID.FlamingArrow, - ProjectileID.PineNeedleHostile, - ProjectileID.OrnamentHostile, - ProjectileID.OrnamentHostileShrapnel, - ProjectileID.FrostWave, - ProjectileID.FrostShard, - ProjectileID.Missile, - ProjectileID.Present, - ProjectileID.Spike, - ProjectileID.BulletDeadeye, - ProjectileID.EyeLaser, - ProjectileID.Nail, - ProjectileID.DrManFlyFlask - }; - - revengeanceEnemyBuffList = new List() - { - NPCID.ServantofCthulhu, - NPCID.EyeofCthulhu, - NPCID.EaterofWorldsHead, - NPCID.DevourerHead, - NPCID.GiantWormHead, - NPCID.MeteorHead, - NPCID.SkeletronHead, - NPCID.SkeletronHand, - NPCID.BoneSerpentHead, - NPCID.ManEater, - NPCID.KingSlime, - NPCID.Snatcher, - NPCID.Piranha, - NPCID.Shark, - NPCID.SpikeBall, - NPCID.BlazingWheel, - NPCID.Mimic, - NPCID.WyvernHead, - NPCID.DiggerHead, - NPCID.SeekerHead, - NPCID.AnglerFish, - NPCID.Werewolf, - NPCID.Wraith, - NPCID.WallofFlesh, - NPCID.TheHungry, - NPCID.TheHungryII, - NPCID.LeechHead, - NPCID.Spazmatism, - NPCID.Retinazer, - NPCID.SkeletronPrime, - NPCID.PrimeSaw, - NPCID.PrimeVice, - NPCID.TheDestroyer, - NPCID.Arapaima, - NPCID.BlackRecluse, - NPCID.WallCreeper, - NPCID.WallCreeperWall, - NPCID.BlackRecluseWall, - NPCID.AngryTrapper, - NPCID.Lihzahrd, - NPCID.LihzahrdCrawler, - NPCID.PirateCaptain, - NPCID.QueenBee, - NPCID.FlyingSnake, - NPCID.Golem, - NPCID.GolemFistLeft, - NPCID.GolemFistRight, - NPCID.Reaper, - NPCID.Plantera, - NPCID.PlanterasHook, - NPCID.PlanterasTentacle, - NPCID.BrainofCthulhu, - NPCID.Paladin, - NPCID.BoneLee, - NPCID.MourningWood, - NPCID.Pumpking, - NPCID.PumpkingBlade, - NPCID.PresentMimic, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.DukeFishron, - NPCID.MoonLordHand, - NPCID.StardustWormHead, - NPCID.SolarCrawltipedeHead, - NPCID.CultistDragonHead, - NPCID.Butcher, - NPCID.Psycho, - NPCID.DeadlySphere, - NPCID.BigMimicCorruption, - NPCID.BigMimicCrimson, - NPCID.BigMimicHallow, - NPCID.Mothron, - NPCID.DuneSplicerHead, - NPCID.SlimeSpiked, - NPCID.SandShark, - NPCID.SandsharkCorrupt, - NPCID.SandsharkCrimson, - NPCID.SandsharkHallow, - NPCID.DD2Betsy, - calamity.NPCType("Astrageldon"), - calamity.NPCType("AstrumDeusHead"), - calamity.NPCType("AstrumDeusHeadSpectral"), - calamity.NPCType("Bumblefuck"), - calamity.NPCType("CalamitasRun3"), - calamity.NPCType("CosmicWraith"), - calamity.NPCType("CrabulonIdle"), - calamity.NPCType("Cryogen"), - calamity.NPCType("DesertScourgeHead"), - calamity.NPCType("GreatSandShark"), - calamity.NPCType("HiveMindP2"), - calamity.NPCType("DankCreeper"), - calamity.NPCType("AquaticAberration"), - calamity.NPCType("Leviathan"), - calamity.NPCType("Siren"), - calamity.NPCType("PerforatorHeadLarge"), - calamity.NPCType("PerforatorHeadMedium"), - calamity.NPCType("PerforatorHeadSmall"), - calamity.NPCType("PlaguebringerGoliath"), - calamity.NPCType("PlagueHomingMissile"), - calamity.NPCType("PlagueMine"), - calamity.NPCType("Polterghast"), - calamity.NPCType("PolterghastHook"), - calamity.NPCType("PolterPhantom"), - calamity.NPCType("ProfanedGuardianBoss"), - calamity.NPCType("RockPillar"), - calamity.NPCType("ScavengerBody"), - calamity.NPCType("ScavengerClawRight"), - calamity.NPCType("ScavengerClawLeft"), - calamity.NPCType("ProfanedGuardianBoss2"), - calamity.NPCType("ProvSpawnDefense"), - calamity.NPCType("ProvSpawnOffense"), - calamity.NPCType("SlimeGod"), - calamity.NPCType("SlimeGodRun"), - calamity.NPCType("SlimeGodCore"), - calamity.NPCType("SlimeGodSplit"), - calamity.NPCType("SlimeGodRunSplit"), - calamity.NPCType("StormWeaverHead"), - calamity.NPCType("StormWeaverHeadNaked"), - calamity.NPCType("SupremeCalamitas"), - calamity.NPCType("DevourerofGodsHead"), - calamity.NPCType("DevourerofGodsHead2"), - calamity.NPCType("DevourerofGodsHeadS"), - calamity.NPCType("Yharon"), - calamity.NPCType("AquaticScourgeHead"), - calamity.NPCType("BobbitWormHead"), - calamity.NPCType("AquaticSeekerHead"), - calamity.NPCType("ColossalSquid"), - calamity.NPCType("EidolonWyrmHead"), - calamity.NPCType("EidolonWyrmHeadHuge"), - calamity.NPCType("GulperEelHead"), - calamity.NPCType("Mauler"), - calamity.NPCType("Reaper"), - calamity.NPCType("Atlas"), - calamity.NPCType("ArmoredDiggerHead"), - calamity.NPCType("Cnidrion"), - calamity.NPCType("Horse"), - calamity.NPCType("ScornEater"), - calamity.NPCType("OldDuke"), - calamity.NPCType("DukeUrchin"), - calamity.NPCType("PrismTurtle"), - calamity.NPCType("GhostBell"), - calamity.NPCType("EutrophicRay"), - calamity.NPCType("Clam"), - calamity.NPCType("SeaSerpent1"), - calamity.NPCType("BlindedAngler"), - calamity.NPCType("GiantClam") - }; - - revengeanceProjectileBuffList = new List() - { - ProjectileID.SandBallFalling, - ProjectileID.AshBallFalling, - ProjectileID.DemonSickle, - ProjectileID.EbonsandBallFalling, - ProjectileID.PearlSandBallFalling, - ProjectileID.CursedFlameHostile, - ProjectileID.EyeFire, - ProjectileID.Boulder, - ProjectileID.DeathLaser, - ProjectileID.PoisonDartTrap, - ProjectileID.SpikyBallTrap, - ProjectileID.SpearTrap, - ProjectileID.FlamethrowerTrap, - ProjectileID.FlamesTrap, - ProjectileID.CrimsandBallFalling, - ProjectileID.Fireball, - ProjectileID.EyeBeam, - ProjectileID.PoisonSeedPlantera, - ProjectileID.ThornBall, - ProjectileID.PaladinsHammerHostile, - ProjectileID.RocketSkeleton, - ProjectileID.FlamingWood, - ProjectileID.FlamingScythe, - ProjectileID.FrostWave, - ProjectileID.Present, - ProjectileID.Spike, - ProjectileID.SaucerDeathray, - ProjectileID.PhantasmalEye, - ProjectileID.PhantasmalSphere, - ProjectileID.PhantasmalDeathray, - ProjectileID.CultistBossIceMist, - ProjectileID.CultistBossLightningOrbArc, - ProjectileID.CultistBossFireBall, - ProjectileID.NebulaBolt, - ProjectileID.NebulaSphere, - ProjectileID.NebulaLaser, - ProjectileID.StardustSoldierLaser, - ProjectileID.VortexLaser, - ProjectileID.VortexVortexLightning, - ProjectileID.VortexLightning, - ProjectileID.VortexAcid, - ProjectileID.GeyserTrap, - ProjectileID.SandnadoHostile, - ProjectileID.DD2BetsyFireball, - ProjectileID.DD2BetsyFlameBreath, - calamity.ProjectileType("AbyssMine"), - calamity.ProjectileType("AbyssMine2"), - calamity.ProjectileType("AstralFlame"), - calamity.ProjectileType("BloodGeyser"), - calamity.ProjectileType("BrimstoneBarrage"), - calamity.ProjectileType("BrimstoneFireblast"), - calamity.ProjectileType("BrimstoneGigaBlast"), - calamity.ProjectileType("BrimstoneHellblast"), - calamity.ProjectileType("BrimstoneHellblast2"), - calamity.ProjectileType("BrimstoneHellfireball"), - calamity.ProjectileType("BrimstoneLaser"), - calamity.ProjectileType("BrimstoneLaserSplit"), - calamity.ProjectileType("BrimstoneMonster"), - calamity.ProjectileType("BrimstoneWave"), - calamity.ProjectileType("DarkEnergyBall"), - calamity.ProjectileType("DeusMine"), - calamity.ProjectileType("DoGDeath"), - calamity.ProjectileType("DoGFire"), - calamity.ProjectileType("CosmicFlameBurst"), - calamity.ProjectileType("FlareBomb"), - calamity.ProjectileType("Flarenado"), - calamity.ProjectileType("HiveBombGoliath"), - calamity.ProjectileType("HolyBlast"), - calamity.ProjectileType("HolyBomb"), - calamity.ProjectileType("HolyShot"), - calamity.ProjectileType("HolySpear"), - calamity.ProjectileType("IceBomb"), - calamity.ProjectileType("IchorShot"), - calamity.ProjectileType("Infernado"), - calamity.ProjectileType("LeviathanBomb"), - calamity.ProjectileType("MoltenBlast"), - calamity.ProjectileType("Mushmash"), - calamity.ProjectileType("PhantomMine"), - calamity.ProjectileType("PhantomBlast"), - calamity.ProjectileType("PhantomBlast2"), - calamity.ProjectileType("ProfanedSpear"), - calamity.ProjectileType("ProvidenceCrystalShard"), - calamity.ProjectileType("ProvidenceHolyRay"), - calamity.ProjectileType("RedLightningFeather"), - calamity.ProjectileType("SandPoisonCloud"), - calamity.ProjectileType("ScavengerNuke"), - calamity.ProjectileType("SirenSong"), - calamity.ProjectileType("YharonFireball"), - calamity.ProjectileType("YharonFireball2"), - calamity.ProjectileType("PearlBurst"), - calamity.ProjectileType("PearlRain") - }; - - trapProjectileList = new List() - { - ProjectileID.PoisonDartTrap, - ProjectileID.SpikyBallTrap, - ProjectileID.SpearTrap, - ProjectileID.FlamethrowerTrap, - ProjectileID.FlamesTrap, - ProjectileID.PoisonDart, - ProjectileID.GeyserTrap - }; - - scopedWeaponList = new List() - { - calamity.ItemType("AMR"), - calamity.ItemType("Shroomer"), - calamity.ItemType("SpectreRifle"), - 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("UrchinSpear"), - calamity.ItemType("AmidiasTrident"), - calamity.ItemType("GoldplumeSpear"), - calamity.ItemType("EarthenPike"), - 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 - }; - } - - if (Config.RevengeanceAndDeathThoriumBossBuff) - { - if (thorium != null) - { - enemyImmunityList.Add(thorium.NPCType("TheGrandThunderBirdv2")); - enemyImmunityList.Add(thorium.NPCType("QueenJelly")); - enemyImmunityList.Add(thorium.NPCType("Viscount")); - enemyImmunityList.Add(thorium.NPCType("GraniteEnergyStorm")); - enemyImmunityList.Add(thorium.NPCType("TheBuriedWarrior")); - enemyImmunityList.Add(thorium.NPCType("ThePrimeScouter")); - enemyImmunityList.Add(thorium.NPCType("BoreanStrider")); - enemyImmunityList.Add(thorium.NPCType("BoreanStriderPopped")); - enemyImmunityList.Add(thorium.NPCType("FallenDeathBeholder")); - enemyImmunityList.Add(thorium.NPCType("FallenDeathBeholder2")); - enemyImmunityList.Add(thorium.NPCType("Lich")); - enemyImmunityList.Add(thorium.NPCType("LichHeadless")); - enemyImmunityList.Add(thorium.NPCType("Abyssion")); - enemyImmunityList.Add(thorium.NPCType("AbyssionCracked")); - enemyImmunityList.Add(thorium.NPCType("AbyssionReleased")); - enemyImmunityList.Add(thorium.NPCType("SlagFury")); - enemyImmunityList.Add(thorium.NPCType("Omnicide")); - enemyImmunityList.Add(thorium.NPCType("RealityBreaker")); - enemyImmunityList.Add(thorium.NPCType("Aquaius")); - enemyImmunityList.Add(thorium.NPCType("Aquaius2")); - - revengeanceEnemyBuffList.Add(thorium.NPCType("TheGrandThunderBirdv2")); - revengeanceEnemyBuffList.Add(thorium.NPCType("QueenJelly")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Viscount")); - revengeanceEnemyBuffList.Add(thorium.NPCType("GraniteEnergyStorm")); - revengeanceEnemyBuffList.Add(thorium.NPCType("TheBuriedWarrior")); - revengeanceEnemyBuffList.Add(thorium.NPCType("ThePrimeScouter")); - revengeanceEnemyBuffList.Add(thorium.NPCType("BoreanStrider")); - revengeanceEnemyBuffList.Add(thorium.NPCType("BoreanStriderPopped")); - revengeanceEnemyBuffList.Add(thorium.NPCType("FallenDeathBeholder")); - revengeanceEnemyBuffList.Add(thorium.NPCType("FallenDeathBeholder2")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Lich")); - revengeanceEnemyBuffList.Add(thorium.NPCType("LichHeadless")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Abyssion")); - revengeanceEnemyBuffList.Add(thorium.NPCType("AbyssionCracked")); - revengeanceEnemyBuffList.Add(thorium.NPCType("AbyssionReleased")); - revengeanceEnemyBuffList.Add(thorium.NPCType("SlagFury")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Omnicide")); - revengeanceEnemyBuffList.Add(thorium.NPCType("RealityBreaker")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Aquaius")); - revengeanceEnemyBuffList.Add(thorium.NPCType("Aquaius2")); - - revengeanceProjectileBuffList.Add(thorium.ProjectileType("GrandThunderBirdZap")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ThunderGust")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BubbleBomb")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("QueenJellyArm")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("QueenTorrent")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRipple")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRipple2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountBlood")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountStomp")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountStomp2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRockFall")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("GraniteCharge")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedShock")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedDagger")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrow")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrow2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowF")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowP")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowC")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedMagic")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedMagicPop")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeamOuter")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeam")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeamCheese")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("VaporizeBlast")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitonSurge")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("Vaporize")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitonCharge")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitySpark")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("DoomBeholderBeam")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("VoidLaserPro")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BeholderBeam")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardBarrage")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostSurge")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostSurgeR")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardCascade")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardBoom")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardFang")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostMytePro")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("IceAnomaly")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichGaze")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichGazeB")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareSpawn")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlare")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichPulse")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichMatter")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("SoulRenderLich")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareDeathD")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareDeathU")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("Whirlpool")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssionSpit")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssionSpit2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("AquaRipple")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssalStrike2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("OldGodSpit")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("OldGodSpit2")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("WaterPulse")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("TyphoonBlastHostile")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("TyphoonBlastHostileSmaller")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("AquaBarrage")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawnR")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawnL")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawn")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("OmniDeath")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("OmniSphereOrb")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlameLash")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlamePulse")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlamePulseTorn")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlameNova")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("MoltenFury")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("RealityFury")); - revengeanceProjectileBuffList.Add(thorium.ProjectileType("UFOBlast")); - } - } - } - #endregion - - #region Music - public override void UpdateMusic(ref int music, ref MusicPriority priority) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (Main.musicVolume != 0) - { - if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) - { - if (Main.LocalPlayer.GetModPlayer(this).ZoneCalamity) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag"); - else - music = MusicID.Eerie; - priority = MusicPriority.Environment; - } - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneSunkenSea) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SunkenSea"); - else - music = MusicID.Temple; - priority = MusicPriority.Environment; - } - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAstral) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); - else - music = MusicID.Space; - priority = MusicPriority.Environment; - } - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer1 || Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer2) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"); - else - music = MusicID.Hell; - priority = MusicPriority.BiomeHigh; - } - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer3) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss"); - else - music = MusicID.Hell; - priority = MusicPriority.BiomeHigh; - } - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer4) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheVoid"); - else - music = MusicID.Hell; - priority = MusicPriority.BiomeHigh; - } - } - if (Main.LocalPlayer.GetModPlayer(this).ZoneSulphur) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Sulphur"); - else - music = MusicID.Desert; - priority = MusicPriority.BiomeHigh; - } - } - if (CalamityWorld.DoGSecondStageCountdown <= 540 && CalamityWorld.DoGSecondStageCountdown > 60) //8 seconds before DoG spawns - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; - priority = MusicPriority.BossMedium; - } - } - } - } - } - #endregion - - #region ModSupport - public override void PostSetupContent() - { - WeakReferenceSupport.Setup(); - } - - public override object Call(params object[] args) - { - return ModSupport.Call(args); - } - #endregion - - #region DrawingStuff - public override void ModifyInterfaceLayers(List layers) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (CalamityWorld.revenge && Config.AdrenalineAndRage) - { - UIHandler.ModifyInterfaceLayers(mod, layers); - } - int index = layers.FindIndex(layer => layer.Name == "Vanilla: Mouse Text"); - if (index != -1) - { - layers.Insert(index, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () - { - if (Main.LocalPlayer.GetModPlayer(mod).drawBossHPBar) - { - BossHealthBarManager.Update(); - BossHealthBarManager.Draw(Main.spriteBatch); - } - return true; - }, InterfaceScaleType.None)); - } - base.ModifyInterfaceLayers(layers); - layers.Insert(index, new LegacyGameInterfaceLayer("Astral Arcanum UI", delegate () - { - AstralArcanumUI.UpdateAndDraw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); - } - - public static Color GetNPCColor(NPC npc, Vector2? position = null, bool effects = true, float shadowOverride = 0f) - { - return npc.GetAlpha(BuffEffects(npc, GetLightColor(position != null ? (Vector2)position : npc.Center), (shadowOverride != 0f ? shadowOverride : 0f), effects, npc.poisoned, npc.onFire, npc.onFire2, Main.player[Main.myPlayer].detectCreature, false, false, false, npc.venom, npc.midas, npc.ichor, npc.onFrostBurn, false, false, npc.dripping, npc.drippingSlime, npc.loveStruck, npc.stinky)); - } - - public static Color GetLightColor(Vector2 position) - { - return Lighting.GetColor((int)(position.X / 16f), (int)(position.Y / 16f)); - } - - public static Color BuffEffects(Entity codable, Color lightColor, float shadow = 0f, bool effects = true, bool poisoned = false, bool onFire = false, bool onFire2 = false, bool hunter = false, bool noItems = false, bool blind = false, bool bleed = false, bool venom = false, bool midas = false, bool ichor = false, bool onFrostBurn = false, bool burned = false, bool honey = false, bool dripping = false, bool drippingSlime = false, bool loveStruck = false, bool stinky = false) - { - float cr = 1f; float cg = 1f; float cb = 1f; float ca = 1f; - if (effects && honey && Main.rand.Next(30) == 0) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 152, 0f, 0f, 150, default(Color), 1f); - Main.dust[dustID].velocity.Y = 0.3f; - Main.dust[dustID].velocity.X *= 0.1f; - Main.dust[dustID].scale += (float)Main.rand.Next(3, 4) * 0.1f; - Main.dust[dustID].alpha = 100; - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity += codable.velocity * 0.1f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - if (poisoned) - { - if (effects && Main.rand.Next(30) == 0) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 46, 0f, 0f, 120, default(Color), 0.2f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].fadeIn = 1.9f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - cr *= 0.65f; - cb *= 0.75f; - } - if (venom) - { - if (effects && Main.rand.Next(10) == 0) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 171, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].fadeIn = 1.5f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - cg *= 0.45f; - cr *= 0.75f; - } - if (midas) - { - cb *= 0.3f; - cr *= 0.85f; - } - if (ichor) - { - if (codable is NPC) - { - lightColor = new Color(255, 255, 0, 255); - } - else - { - cb = 0f; - } - } - if (burned) - { - if (effects) - { - int dustID = Dust.NewDust(new Vector2(codable.position.X - 2f, codable.position.Y - 2f), codable.width + 4, codable.height + 4, 6, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default(Color), 2f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.75f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - if (codable is Player) - { - cr = 1f; - cb *= 0.6f; - cg *= 0.7f; - } - } - if (onFrostBurn) - { - if (effects) - { - if (Main.rand.Next(4) < 3) - { - int dustID = Dust.NewDust(new Vector2(codable.position.X - 2f, codable.position.Y - 2f), codable.width + 4, codable.height + 4, 135, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default(Color), 3.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (Main.rand.Next(4) == 0) - { - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale *= 0.5f; - } - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 0.1f, 0.6f, 1f); - } - if (codable is Player) - { - cr *= 0.5f; - cg *= 0.7f; - } - } - if (onFire) - { - if (effects) - { - if (Main.rand.Next(4) != 0) - { - int dustID = Dust.NewDust(codable.position - new Vector2(2f, 2f), codable.width + 4, codable.height + 4, 6, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default(Color), 3.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (Main.rand.Next(4) == 0) - { - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale *= 0.5f; - } - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); - } - if (codable is Player) - { - cb *= 0.6f; - cg *= 0.7f; - } - } - if (dripping && shadow == 0f && Main.rand.Next(4) != 0) - { - Vector2 position = codable.position; - position.X -= 2f; position.Y -= 2f; - if (Main.rand.Next(2) == 0) - { - int dustID = Dust.NewDust(position, codable.width + 4, codable.height + 2, 211, 0f, 0f, 50, default(Color), 0.8f); - if (Main.rand.Next(2) == 0) - { - Main.dust[dustID].alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - Main.dust[dustID].alpha += 25; - } - Main.dust[dustID].noLight = true; - Main.dust[dustID].velocity *= 0.2f; - Main.dust[dustID].velocity.Y += 0.2f; - Main.dust[dustID].velocity += codable.velocity; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - else - { - int dustID = Dust.NewDust(position, codable.width + 8, codable.height + 8, 211, 0f, 0f, 50, default(Color), 1.1f); - if (Main.rand.Next(2) == 0) - { - Main.dust[dustID].alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - Main.dust[dustID].alpha += 25; - } - Main.dust[dustID].noLight = true; - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 0.2f; - Main.dust[dustID].velocity.Y += 1f; - Main.dust[dustID].velocity += codable.velocity; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - } - if (drippingSlime && shadow == 0f) - { - int alpha = 175; - Color newColor = new Color(0, 80, 255, 100); - if (Main.rand.Next(4) != 0) - { - if (Main.rand.Next(2) == 0) - { - Vector2 position2 = codable.position; - position2.X -= 2f; position2.Y -= 2f; - int dustID = Dust.NewDust(position2, codable.width + 4, codable.height + 2, 4, 0f, 0f, alpha, newColor, 1.4f); - if (Main.rand.Next(2) == 0) - { - Main.dust[dustID].alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - Main.dust[dustID].alpha += 25; - } - Main.dust[dustID].noLight = true; - Main.dust[dustID].velocity *= 0.2f; - Main.dust[dustID].velocity.Y += 0.2f; - Main.dust[dustID].velocity += codable.velocity; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - } - cr *= 0.8f; - cg *= 0.8f; - } - if (onFire2) - { - if (effects) - { - if (Main.rand.Next(4) != 0) - { - int dustID = Dust.NewDust(codable.position - new Vector2(2f, 2f), codable.width + 4, codable.height + 4, 75, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default(Color), 3.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (Main.rand.Next(4) == 0) - { - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale *= 0.5f; - } - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); - } - if (codable is Player) - { - cb *= 0.6f; - cg *= 0.7f; - } - } - if (noItems) - { - cr *= 0.65f; - cg *= 0.8f; - } - if (blind) - { - cr *= 0.7f; - cg *= 0.65f; - } - if (bleed) - { - bool dead = (codable is Player ? ((Player)codable).dead : codable is NPC ? ((NPC)codable).life <= 0 : false); - if (effects && !dead && Main.rand.Next(30) == 0) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 5, 0f, 0f, 0, default(Color), 1f); - Main.dust[dustID].velocity.Y += 0.5f; - Main.dust[dustID].velocity *= 0.25f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - cg *= 0.9f; - cb *= 0.9f; - } - if (loveStruck && effects && shadow == 0f && Main.instance.IsActive && !Main.gamePaused && Main.rand.Next(5) == 0) - { - Vector2 value = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); - value.Normalize(); - value.X *= 0.66f; - int goreID = Gore.NewGore(codable.position + new Vector2((float)Main.rand.Next(codable.width + 1), (float)Main.rand.Next(codable.height + 1)), value * (float)Main.rand.Next(3, 6) * 0.33f, 331, (float)Main.rand.Next(40, 121) * 0.01f); - Main.gore[goreID].sticky = false; - Main.gore[goreID].velocity *= 0.4f; - Main.gore[goreID].velocity.Y -= 0.6f; - if (codable is Player) - { - Main.playerDrawGore.Add(goreID); - } - } - if (stinky && shadow == 0f) - { - cr *= 0.7f; - cb *= 0.55f; - if (effects && Main.rand.Next(5) == 0 && Main.instance.IsActive && !Main.gamePaused) - { - Vector2 value2 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); - value2.Normalize(); value2.X *= 0.66f; value2.Y = Math.Abs(value2.Y); - Vector2 vector = value2 * (float)Main.rand.Next(3, 5) * 0.25f; - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 188, vector.X, vector.Y * 0.5f, 100, default(Color), 1.5f); - Main.dust[dustID].velocity *= 0.1f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - } - lightColor.R = (byte)((float)lightColor.R * cr); - lightColor.G = (byte)((float)lightColor.G * cg); - lightColor.B = (byte)((float)lightColor.B * cb); - lightColor.A = (byte)((float)lightColor.A * ca); - if (codable is NPC) - { - NPCLoader.DrawEffects((NPC)codable, ref lightColor); - } - if (hunter && (codable is NPC ? ((NPC)codable).lifeMax > 1 : true)) - { - if (effects && !Main.gamePaused && Main.instance.IsActive && Main.rand.Next(50) == 0) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 15, 0f, 0f, 150, default(Color), 0.8f); - Main.dust[dustID].velocity *= 0.1f; - Main.dust[dustID].noLight = true; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - byte colorR = 50, colorG = 255, colorB = 50; - if (codable is NPC && !(((NPC)codable).friendly || ((NPC)codable).catchItem > 0 || (((NPC)codable).damage == 0 && ((NPC)codable).lifeMax == 5))) - { - colorR = 255; colorG = 50; - } - if (!(codable is NPC) && lightColor.R < 150) - { - lightColor.A = Main.mouseTextColor; - } - if (lightColor.R < colorR) - { - lightColor.R = colorR; - } - if (lightColor.G < colorG) - { - lightColor.G = colorG; - } - if (lightColor.B < colorB) - { - lightColor.B = colorB; - } - } - return lightColor; - } - - public static void DrawTexture(object sb, Texture2D texture, int shader, Entity codable, Color? overrideColor = null, bool drawCentered = false) - { - Color lightColor = (overrideColor != null ? (Color)overrideColor : codable is NPC ? GetNPCColor(((NPC)codable), codable.Center, false) : codable is Projectile ? ((Projectile)codable).GetAlpha(GetLightColor(codable.Center)) : GetLightColor(codable.Center)); - int frameCount = (codable is NPC ? Main.npcFrameCount[((NPC)codable).type] : 1); - Rectangle frame = (codable is NPC ? ((NPC)codable).frame : new Rectangle(0, 0, texture.Width, texture.Height)); - float scale = (codable is NPC ? ((NPC)codable).scale : ((Projectile)codable).scale); - float rotation = (codable is NPC ? ((NPC)codable).rotation : ((Projectile)codable).rotation); - int spriteDirection = (codable is NPC ? ((NPC)codable).spriteDirection : ((Projectile)codable).spriteDirection); - float offsetY = (codable is NPC ? ((NPC)codable).gfxOffY : 0f); - DrawTexture(sb, texture, shader, codable.position + new Vector2(0f, offsetY), codable.width, codable.height, scale, rotation, spriteDirection, frameCount, frame, lightColor, drawCentered); - } - - public static void DrawTexture(object sb, Texture2D texture, int shader, Vector2 position, int width, int height, float scale, float rotation, int direction, int framecount, Rectangle frame, Color? overrideColor = null, bool drawCentered = false) - { - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / framecount / 2)); - Color lightColor = overrideColor != null ? (Color)overrideColor : GetLightColor(position + new Vector2(width * 0.5f, height * 0.5f)); - if (sb is List) - { - DrawData dd = new DrawData(texture, GetDrawPosition(position, origin, width, height, texture.Width, texture.Height, framecount, scale, drawCentered), frame, lightColor, rotation, origin, scale, direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - dd.shader = shader; - ((List)sb).Add(dd); - } - else if (sb is SpriteBatch) - { - bool applyDye = shader > 0; - if (applyDye) - { - ((SpriteBatch)sb).End(); - ((SpriteBatch)sb).Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); - GameShaders.Armor.ApplySecondary(shader, Main.player[Main.myPlayer], null); - } - ((SpriteBatch)sb).Draw(texture, GetDrawPosition(position, origin, width, height, texture.Width, texture.Height, framecount, scale, drawCentered), frame, lightColor, rotation, origin, scale, direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - if (applyDye) - { - ((SpriteBatch)sb).End(); - ((SpriteBatch)sb).Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); - } - } - } - - public static Vector2 GetDrawPosition(Vector2 position, Vector2 origin, int width, int height, int texWidth, int texHeight, int framecount, float scale, bool drawCentered = false) - { - Vector2 screenPos = new Vector2((int)Main.screenPosition.X, (int)Main.screenPosition.Y); - if (drawCentered) - { - Vector2 texHalf = new Vector2(texWidth / 2, texHeight / framecount / 2); - return (position + new Vector2(width * 0.5f, height * 0.5f)) - (texHalf * scale) + (origin * scale) - screenPos; - } - return position - screenPos + new Vector2(width * 0.5f, height) - new Vector2(texWidth * scale / 2f, texHeight * scale / (float)framecount) + (origin * scale) + new Vector2(0f, 5f); - } - #endregion - - #region Recipes - public override void AddRecipeGroups() - { - CalamityRecipes.AddRecipeGroups(); - } - - public override void AddRecipes() - { - CalamityRecipes.AddRecipes(); - } - #endregion - - #region Seasons - public static Season season - { - get - { - DateTime date = DateTime.Now; - int day = date.DayOfYear - Convert.ToInt32((DateTime.IsLeapYear(date.Year)) && date.DayOfYear > 59); - - if (day < 80 || day >= 355) - { - return Season.Winter; - } - - else if (day >= 80 && day < 172) - { - return Season.Spring; - } - - else if (day >= 172 && day < 266) - { - return Season.Summer; - } - - else - { - return Season.Fall; - } - } - } - #endregion - - #region Packets - public override void HandlePacket(BinaryReader reader, int whoAmI) - { - CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); - switch (msgType) - { - case CalamityModMessageType.MeleeLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 0); - break; - case CalamityModMessageType.RangedLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 1); - break; - case CalamityModMessageType.MagicLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 2); - break; - case CalamityModMessageType.SummonLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 3); - break; - case CalamityModMessageType.RogueLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 4); - break; - case CalamityModMessageType.ExactMeleeLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 0); - break; - case CalamityModMessageType.ExactRangedLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 1); - break; - case CalamityModMessageType.ExactMagicLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 2); - break; - case CalamityModMessageType.ExactSummonLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 3); - break; - case CalamityModMessageType.ExactRogueLevelSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 4); - break; - case CalamityModMessageType.StressSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleStress(reader); - break; - case CalamityModMessageType.BossRushStage: - int stage = reader.ReadInt32(); - CalamityWorld.bossRushStage = stage; - break; - case CalamityModMessageType.AdrenalineSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleAdrenaline(reader); - break; - /*case CalamityModMessageType.DistanceFromBossSync: - Main.player[reader.ReadInt32()].GetModPlayer().HandleDistanceFromBoss(reader); - break;*/ - case CalamityModMessageType.TeleportPlayer: - Main.player[reader.ReadInt32()].GetModPlayer().HandleTeleport(reader.ReadInt32(), true, whoAmI); - break; - case CalamityModMessageType.DoGCountdownSync: - int countdown = reader.ReadInt32(); - CalamityWorld.DoGSecondStageCountdown = countdown; - break; - case CalamityModMessageType.BossSpawnCountdownSync: - int countdown2 = reader.ReadInt32(); - CalamityWorld.bossSpawnCountdown = countdown2; - break; - case CalamityModMessageType.BossTypeSync: - 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; - } - } - #endregion - } - - public enum Season : byte - { - Winter, - Spring, - Summer, - Fall - } - - enum CalamityModMessageType : byte - { - MeleeLevelSync, - RangedLevelSync, - MagicLevelSync, - SummonLevelSync, - RogueLevelSync, - ExactMeleeLevelSync, - ExactRangedLevelSync, - ExactMagicLevelSync, - ExactSummonLevelSync, - ExactRogueLevelSync, - StressSync, - AdrenalineSync, - TeleportPlayer, - BossRushStage, - DoGCountdownSync, - BossSpawnCountdownSync, - BossTypeSync, - DeathCountSync - //DistanceFromBossSync - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.UI; +using Terraria.DataStructures; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.Initializers; +using Terraria.IO; +using Terraria.Map; +using Terraria.GameContent; +using Terraria.ModLoader; +using Terraria.Localization; +using CalamityMod.NPCs; +using CalamityMod.NPCs.TheDevourerofGods; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Yharon; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.Tiles; +using CalamityMod.UI; +using CalamityMod.Skies; +using CalamityMod.World; + +namespace CalamityMod +{ + public class CalamityMod : Mod + { + //Hotkeys + public static ModHotKey NormalityRelocatorHotKey; + public static ModHotKey AegisHotKey; + public static ModHotKey TarraHotKey; + public static ModHotKey RageHotKey; + public static ModHotKey AdrenalineHotKey; + public static ModHotKey AstralTeleportHotKey; + public static ModHotKey AstralArcanumUIHotkey; + public static ModHotKey BossBarToggleHotKey; + public static ModHotKey BossBarToggleSmallTextHotKey; + + //Boss Spawners + public static int ghostKillCount = 0; + public static int sharkKillCount = 0; + public static int astralKillCount = 0; + + //Textures & Shaders + public static Texture2D heartOriginal2; + public static Texture2D heartOriginal; + public static Texture2D rainOriginal; + public static Texture2D manaOriginal; + public static Texture2D carpetOriginal; + public static Texture2D AstralCactusTexture; + public static Texture2D AstralCactusGlowTexture; + public static Texture2D AstralSky; + public static Effect CustomShader; + + //Lists + public static IList donatorList; + public static List rangedProjectileExceptionList; + 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; + public static List hardModeNerfList; + public static List debuffList; + public static List fireWeaponList; + public static List natureWeaponList; + public static List alcoholList; + public static List doubleDamageBuffList; //100% buff + public static List sixtySixDamageBuffList; //66% buff + public static List fiftyDamageBuffList; //50% buff + public static List thirtyThreeDamageBuffList; //33% buff + public static List twentyFiveDamageBuffList; //25% buff + public static List twentyDamageBuffList; //20% buff + public static List weaponAutoreuseList; + public static List quarterDamageNerfList; //25% nerf + public static List pumpkinMoonBuffList; + public static List frostMoonBuffList; + public static List eclipseBuffList; + public static List eventProjectileBuffList; + public static List revengeanceEnemyBuffList; + public static List revengeanceProjectileBuffList; + public static List trapProjectileList; + public static List scopedWeaponList; + public static List trueMeleeBoostExceptionList; + public static List skeletonList; + + public static CalamityMod Instance; + + public CalamityMod() + { + Instance = this; + } + + #region Load + public override void Load() + { + heartOriginal2 = Main.heartTexture; + heartOriginal = Main.heart2Texture; + rainOriginal = Main.rainTexture; + manaOriginal = Main.manaTexture; + carpetOriginal = Main.flyingCarpetTexture; + + NormalityRelocatorHotKey = RegisterHotKey("Normality Relocator", "Z"); + RageHotKey = RegisterHotKey("Rage Mode", "V"); + AdrenalineHotKey = RegisterHotKey("Adrenaline Mode", "B"); + AegisHotKey = RegisterHotKey("Elysian Guard", "N"); + TarraHotKey = RegisterHotKey("Armor Set Bonus", "Y"); + AstralTeleportHotKey = RegisterHotKey("Astral Teleport", "P"); + AstralArcanumUIHotkey = RegisterHotKey("Astral Arcanum UI Toggle", "O"); + BossBarToggleHotKey = RegisterHotKey("Boss Health Bar Toggle", "NumPad0"); + BossBarToggleSmallTextHotKey = RegisterHotKey("Boss Health Bar Small Text Toggle", "NumPad1"); + + if (!Main.dedServ) + { + LoadClient(); + } + + BossHealthBarManager.Load(this); + + Config.Load(); + + SetupLists(); + + CalamityLocalization.AddLocalizations(); + } + + private void LoadClient() + { + AddEquipTexture(new Items.Armor.AbyssalDivingSuitHead(), null, EquipType.Head, "AbyssalDivingSuitHead", "CalamityMod/Items/Armor/AbyssalDivingSuit_Head"); + AddEquipTexture(new Items.Armor.AbyssalDivingSuitBody(), null, EquipType.Body, "AbyssalDivingSuitBody", "CalamityMod/Items/Armor/AbyssalDivingSuit_Body", "CalamityMod/Items/Armor/AbyssalDivingSuit_Arms"); + AddEquipTexture(new Items.Armor.AbyssalDivingSuitLegs(), null, EquipType.Legs, "AbyssalDivingSuitLeg", "CalamityMod/Items/Armor/AbyssalDivingSuit_Legs"); + + AddEquipTexture(new Items.Armor.SirenHead(), null, EquipType.Head, "SirenHead", "CalamityMod/Items/Armor/SirenTrans_Head"); + AddEquipTexture(new Items.Armor.SirenBody(), null, EquipType.Body, "SirenBody", "CalamityMod/Items/Armor/SirenTrans_Body", "CalamityMod/Items/Armor/SirenTrans_Arms"); + AddEquipTexture(new Items.Armor.SirenLegs(), null, EquipType.Legs, "SirenLeg", "CalamityMod/Items/Armor/SirenTrans_Legs"); + + AddEquipTexture(new Items.Armor.SirenHeadAlt(), null, EquipType.Head, "SirenHeadAlt", "CalamityMod/Items/Armor/SirenTransAlt_Head"); + AddEquipTexture(new Items.Armor.SirenBodyAlt(), null, EquipType.Body, "SirenBodyAlt", "CalamityMod/Items/Armor/SirenTransAlt_Body", "CalamityMod/Items/Armor/SirenTransAlt_Arms"); + AddEquipTexture(new Items.Armor.SirenLegsAlt(), null, EquipType.Legs, "SirenLegAlt", "CalamityMod/Items/Armor/SirenTransAlt_Legs"); + + AddEquipTexture(new Items.Permafrost.PopoHead(), null, EquipType.Head, "PopoHead", "CalamityMod/Items/Permafrost/Popo_Head"); + AddEquipTexture(new Items.Permafrost.PopoNoselessHead(), null, EquipType.Head, "PopoNoselessHead", "CalamityMod/Items/Permafrost/PopoNoseless_Head"); + AddEquipTexture(new Items.Permafrost.PopoBody(), null, EquipType.Body, "PopoBody", "CalamityMod/Items/Permafrost/Popo_Body", "CalamityMod/Items/Permafrost/Popo_Arms"); + AddEquipTexture(new Items.Permafrost.PopoLegs(), null, EquipType.Legs, "PopoLeg", "CalamityMod/Items/Permafrost/Popo_Legs"); + + AstralCactusTexture = GetTexture("ExtraTextures/Tiles/AstralCactus"); + AstralCactusGlowTexture = GetTexture("ExtraTextures/Tiles/AstralCactusGlow"); + AstralSky = GetTexture("ExtraTextures/AstralSky"); + CustomShader = GetEffect("Effects/CustomShader"); + + Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); + + Filters.Scene["CalamityMod:DevourerofGodsHeadS"] = new Filter(new DoGScreenShaderDataS("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:DevourerofGodsHeadS"] = new DoGSkyS(); + + Filters.Scene["CalamityMod:CalamitasRun3"] = new Filter(new CalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.6f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:CalamitasRun3"] = new CalSky(); + + Filters.Scene["CalamityMod:PlaguebringerGoliath"] = new Filter(new PbGScreenShaderData("FilterMiniTower").UseColor(0.2f, 0.6f, 0.2f).UseOpacity(0.65f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:PlaguebringerGoliath"] = new PbGSky(); + + Filters.Scene["CalamityMod:Yharon"] = new Filter(new YScreenShaderData("FilterMiniTower").UseColor(1f, 0.4f, 0f).UseOpacity(0.75f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:Yharon"] = new YSky(); + + Filters.Scene["CalamityMod:Leviathan"] = new Filter(new LevScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0.5f).UseOpacity(0.5f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:Leviathan"] = new LevSky(); + + Filters.Scene["CalamityMod:Providence"] = new Filter(new ProvScreenShaderData("FilterMiniTower").UseColor(0.6f, 0.45f, 0f).UseOpacity(0.5f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:Providence"] = new ProvSky(); + + Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky(); + + Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(CustomShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); + + Mod mod = ModLoader.GetMod("CalamityMod"); + UIHandler.OnLoad(mod); + + AstralArcanumUI.Load(this); + } + #endregion + + #region Unload + public override void Unload() + { + NormalityRelocatorHotKey = null; + RageHotKey = null; + AdrenalineHotKey = null; + AegisHotKey = null; + TarraHotKey = null; + AstralTeleportHotKey = null; + AstralArcanumUIHotkey = null; + BossBarToggleHotKey = null; + BossBarToggleSmallTextHotKey = null; + + AstralCactusTexture = null; + AstralCactusGlowTexture = null; + AstralSky = null; + + donatorList = null; + + rangedProjectileExceptionList = null; + projectileMinionList = null; + enemyImmunityList = null; + dungeonEnemyBuffList = null; + dungeonProjectileBuffList = null; + bossScaleList = null; + beeEnemyList = null; + beeProjectileList = null; + hardModeNerfList = null; + debuffList = null; + fireWeaponList = null; + natureWeaponList = null; + alcoholList = null; + doubleDamageBuffList = null; + sixtySixDamageBuffList = null; + fiftyDamageBuffList = null; + thirtyThreeDamageBuffList = null; + twentyFiveDamageBuffList = null; + weaponAutoreuseList = null; + quarterDamageNerfList = null; + pumpkinMoonBuffList = null; + frostMoonBuffList = null; + eclipseBuffList = null; + eventProjectileBuffList = null; + revengeanceEnemyBuffList = null; + revengeanceProjectileBuffList = null; + trapProjectileList = null; + scopedWeaponList = null; + trueMeleeBoostExceptionList = null; + skeletonList = null; + + BossHealthBarManager.Unload(); + base.Unload(); + + AstralArcanumUI.Unload(); + base.Unload(); + + if (!Main.dedServ) + { + Main.heartTexture = heartOriginal2; + Main.heart2Texture = heartOriginal; + Main.rainTexture = rainOriginal; + Main.manaTexture = manaOriginal; + Main.flyingCarpetTexture = carpetOriginal; + } + + heartOriginal2 = null; + heartOriginal = null; + rainOriginal = null; + manaOriginal = null; + carpetOriginal = null; + + Instance = null; + } + #endregion + + #region SetupLists + public static void SetupLists() + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + Mod thorium = ModLoader.GetMod("ThoriumMod"); + if (calamity != null) + { + donatorList = new List() + { + "Vorbis", + "SoloMael", + "Chaotic Reks", + "The Buildmonger", + "Yuh", + "Littlepiggy", + "LompL", + "Lilith Saintclaire", + "Ben Shapiro", + "Frederik Henschel", + "Faye", + "Gibb50", + "Braden Hajer", + "Hannes Holmlund", + "profoundmango69", + "Jack M Sargent", + "Hans Volter", + "Krankwagon", + "MishiroUsui", + "pixlgray", + "Arkhine", + "Lodude", + "DevAesthetic", + "Mister Winchester", + "Zacky", + "Veine", + "Javyz", + "Shifter", + "Crysthamyr", + "Elfinlocks", + "Ein", + "2Larry2", + "Jenonen", + "Dodu", + "Arti", + "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", + "Ahmed Fahad Zamel Al Sharif", + "Eragon3942", + "TheBlackHand", + "william", + "Samuel Foreman" + }; + + rangedProjectileExceptionList = new List() + { + ProjectileID.Phantasm, + ProjectileID.VortexBeater, + ProjectileID.DD2PhoenixBow, + ProjectileID.IchorDart, + ProjectileID.PhantasmArrow, + calamity.ProjectileType("Phangasm"), + calamity.ProjectileType("Contagion"), + calamity.ProjectileType("DaemonsFlame"), + calamity.ProjectileType("ExoTornado"), + calamity.ProjectileType("Drataliornus"), + calamity.ProjectileType("FlakKrakenGun"), + calamity.ProjectileType("Butcher"), + calamity.ProjectileType("StarfleetMK2"), + calamity.ProjectileType("TerraBulletSplit"), + calamity.ProjectileType("TerraArrow2"), + calamity.ProjectileType("OMGWTH"), + calamity.ProjectileType("Norfleet"), + calamity.ProjectileType("NorfleetComet"), + calamity.ProjectileType("NorfleetExplosion") + }; + + projectileMinionList = new List() + { + ProjectileID.PygmySpear, + ProjectileID.UFOMinion, + ProjectileID.UFOLaser, + ProjectileID.StardustCellMinionShot, + ProjectileID.MiniSharkron, + ProjectileID.MiniRetinaLaser, + ProjectileID.ImpFireball, + ProjectileID.HornetStinger, + ProjectileID.DD2FlameBurstTowerT1Shot, + ProjectileID.DD2FlameBurstTowerT2Shot, + ProjectileID.DD2FlameBurstTowerT3Shot, + ProjectileID.DD2BallistraProj, + ProjectileID.DD2ExplosiveTrapT1Explosion, + ProjectileID.DD2ExplosiveTrapT2Explosion, + ProjectileID.DD2ExplosiveTrapT3Explosion, + ProjectileID.SpiderEgg, + ProjectileID.BabySpider, + ProjectileID.FrostBlastFriendly, + ProjectileID.MoonlordTurretLaser, + ProjectileID.RainbowCrystalExplosion + }; + + 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, + NPCID.Spazmatism, + NPCID.SkeletronPrime, + NPCID.PrimeCannon, + NPCID.PrimeSaw, + NPCID.PrimeLaser, + NPCID.PrimeVice, + NPCID.Plantera, + NPCID.IceQueen, + NPCID.Pumpking, + NPCID.Mothron, + NPCID.Golem, + NPCID.GolemHead, + NPCID.GolemFistRight, + NPCID.GolemFistLeft, + NPCID.DukeFishron, + NPCID.CultistBoss, + NPCID.MoonLordHead, + NPCID.MoonLordHand, + NPCID.MoonLordCore, + NPCID.MoonLordFreeEye, + NPCID.DD2Betsy + }; + + dungeonEnemyBuffList = new List() + { + NPCID.SkeletonSniper, + NPCID.TacticalSkeleton, + NPCID.SkeletonCommando, + NPCID.Paladin, + NPCID.GiantCursedSkull, + NPCID.BoneLee, + NPCID.DiabolistWhite, + NPCID.DiabolistRed, + NPCID.NecromancerArmored, + NPCID.Necromancer, + NPCID.RaggedCasterOpenCoat, + NPCID.RaggedCaster, + NPCID.HellArmoredBonesSword, + NPCID.HellArmoredBonesMace, + NPCID.HellArmoredBonesSpikeShield, + NPCID.HellArmoredBones, + NPCID.BlueArmoredBonesSword, + NPCID.BlueArmoredBonesNoPants, + NPCID.BlueArmoredBonesMace, + NPCID.BlueArmoredBones, + NPCID.RustyArmoredBonesSwordNoArmor, + NPCID.RustyArmoredBonesSword, + NPCID.RustyArmoredBonesFlail, + 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, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.Creeper, + NPCID.SkeletronHand, + NPCID.WallofFleshEye, + NPCID.TheHungry, + NPCID.TheHungryII, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCID.PrimeCannon, + NPCID.PrimeVice, + NPCID.PrimeSaw, + NPCID.PrimeLaser, + NPCID.PlanterasTentacle, + NPCID.Pumpking, + NPCID.IceQueen, + NPCID.Mothron, + NPCID.GolemHead + }; + + beeEnemyList = new List() + { + NPCID.GiantMossHornet, + NPCID.BigMossHornet, + NPCID.LittleMossHornet, + NPCID.TinyMossHornet, + NPCID.MossHornet, + NPCID.VortexHornetQueen, + NPCID.VortexHornet, + NPCID.Bee, + NPCID.BeeSmall, + NPCID.QueenBee, + calamity.NPCType("PlaguebringerGoliath"), + calamity.NPCType("PlaguebringerShade"), + calamity.NPCType("PlagueBeeLargeG"), + calamity.NPCType("PlagueBeeLarge"), + calamity.NPCType("PlagueBeeG"), + calamity.NPCType("PlagueBee") + }; + + beeProjectileList = new List() + { + ProjectileID.Stinger, + ProjectileID.HornetStinger, + calamity.ProjectileType("PlagueStingerGoliath"), + calamity.ProjectileType("PlagueStingerGoliathV2"), + calamity.ProjectileType("PlagueExplosion") + }; + + hardModeNerfList = new List() + { + ProjectileID.WebSpit, + ProjectileID.PinkLaser, + ProjectileID.FrostBlastHostile, + ProjectileID.RuneBlast, + ProjectileID.GoldenShowerHostile, + ProjectileID.RainNimbus, + ProjectileID.Stinger, + ProjectileID.FlamingArrow, + ProjectileID.BulletDeadeye, + ProjectileID.CannonballHostile + }; + + debuffList = new List() + { + BuffID.Poisoned, + BuffID.Darkness, + BuffID.Cursed, + BuffID.OnFire, + BuffID.Bleeding, + BuffID.Confused, + BuffID.Slow, + BuffID.Weak, + BuffID.Silenced, + BuffID.BrokenArmor, + BuffID.CursedInferno, + BuffID.Frostburn, + BuffID.Chilled, + BuffID.Frozen, + BuffID.Burning, + BuffID.Suffocation, + BuffID.Ichor, + BuffID.Venom, + BuffID.Blackout, + BuffID.Electrified, + BuffID.Rabies, + BuffID.Webbed, + BuffID.Stoned, + BuffID.Dazed, + BuffID.VortexDebuff, + BuffID.WitheredArmor, + BuffID.WitheredWeapon, + BuffID.OgreSpit, + BuffID.BetsysCurse, + calamity.BuffType("BrimstoneFlames"), + calamity.BuffType("BurningBlood"), + calamity.BuffType("GlacialState"), + calamity.BuffType("GodSlayerInferno"), + calamity.BuffType("HolyLight"), + calamity.BuffType("Irradiated"), + calamity.BuffType("Plague"), + calamity.BuffType("AbyssalFlames"), + calamity.BuffType("CrushDepth"), + calamity.BuffType("Horror"), + calamity.BuffType("MarkedforDeath") + }; + + fireWeaponList = new List() + { + ItemID.FieryGreatsword, + ItemID.DD2SquireDemonSword, + ItemID.TheHorsemansBlade, + ItemID.DD2SquireBetsySword, + ItemID.Cascade, + ItemID.HelFire, + ItemID.MonkStaffT2, + ItemID.Flamarang, + ItemID.MoltenFury, + ItemID.Sunfury, + ItemID.PhoenixBlaster, + ItemID.Flamelash, + ItemID.SolarEruption, + ItemID.DayBreak, + ItemID.MonkStaffT3, + ItemID.HellwingBow, + ItemID.DD2PhoenixBow, + ItemID.DD2BetsyBow, + ItemID.FlareGun, + ItemID.Flamethrower, + ItemID.EldMelter, + ItemID.FlowerofFire, + ItemID.MeteorStaff, + ItemID.ApprenticeStaffT3, + ItemID.InfernoFork, + ItemID.HeatRay, + ItemID.BookofSkulls, + ItemID.ImpStaff, + ItemID.DD2FlameburstTowerT1Popper, + ItemID.DD2FlameburstTowerT2Popper, + ItemID.DD2FlameburstTowerT3Popper, + ItemID.MolotovCocktail, + calamity.ItemType("AegisBlade"), + calamity.ItemType("BalefulHarvester"), + calamity.ItemType("Chaotrix"), + calamity.ItemType("CometQuasher"), + calamity.ItemType("DraconicDestruction"), + calamity.ItemType("Drataliornus"), + calamity.ItemType("EnergyStaff"), + calamity.ItemType("ExsanguinationLance"), + calamity.ItemType("FirestormCannon"), + calamity.ItemType("FlameburstShortsword"), + calamity.ItemType("FlameScythe"), + calamity.ItemType("FlameScytheMelee"), + calamity.ItemType("FlareBolt"), + calamity.ItemType("FlarefrostBlade"), + calamity.ItemType("FlarewingBow"), + calamity.ItemType("ForbiddenSun"), + calamity.ItemType("FrigidflashBolt"), + calamity.ItemType("GreatbowofTurmoil"), + calamity.ItemType("HarvestStaff"), + calamity.ItemType("HellBurst"), + calamity.ItemType("HellfireFlamberge"), + calamity.ItemType("Hellkite"), + calamity.ItemType("HellwingStaff"), + calamity.ItemType("Helstorm"), + calamity.ItemType("InfernaCutter"), + calamity.ItemType("Lazhar"), + calamity.ItemType("MeteorFist"), + calamity.ItemType("Mourningstar"), + calamity.ItemType("PhoenixBlade"), + calamity.ItemType("Photoviscerator"), + calamity.ItemType("RedSun"), + calamity.ItemType("SpectralstormCannon"), + calamity.ItemType("SunGodStaff"), + calamity.ItemType("SunSpiritStaff"), + calamity.ItemType("TearsofHeaven"), + calamity.ItemType("TerraFlameburster"), + calamity.ItemType("TheEmpyrean"), + calamity.ItemType("TheWand"), + calamity.ItemType("VenusianTrident"), + calamity.ItemType("Vesuvius"), + calamity.ItemType("BlissfulBombardier"), + calamity.ItemType("HolyCollider"), + calamity.ItemType("MoltenAmputator"), + calamity.ItemType("PurgeGuzzler"), + calamity.ItemType("SolarFlare"), + calamity.ItemType("TelluricGlare"), + calamity.ItemType("AngryChickenStaff"), + calamity.ItemType("ChickenCannon"), + calamity.ItemType("DragonRage"), + calamity.ItemType("DragonsBreath"), + calamity.ItemType("PhoenixFlameBarrage"), + calamity.ItemType("ProfanedTrident"), + calamity.ItemType("TheBurningSky") + }; + + natureWeaponList = new List() + { + ItemID.BladeofGrass, + ItemID.ChlorophyteClaymore, + ItemID.ChlorophyteSaber, + ItemID.ChlorophytePartisan, + ItemID.ChlorophyteShotbow, + ItemID.Seedler, + ItemID.ChristmasTreeSword, + ItemID.TerraBlade, + ItemID.JungleYoyo, + ItemID.Yelets, + ItemID.MushroomSpear, + ItemID.ThornChakram, + ItemID.Bananarang, + ItemID.FlowerPow, + ItemID.BeesKnees, + ItemID.Toxikarp, + ItemID.Bladetongue, + ItemID.PoisonStaff, + ItemID.VenomStaff, + ItemID.StaffofEarth, + ItemID.BeeGun, + ItemID.LeafBlower, + ItemID.WaspGun, + ItemID.CrystalSerpent, + ItemID.Razorpine, + ItemID.HornetStaff, + ItemID.QueenSpiderStaff, + ItemID.SlimeStaff, + ItemID.PygmyStaff, + ItemID.RavenStaff, + ItemID.BatScepter, + ItemID.SpiderStaff, + ItemID.Beenade, + ItemID.FrostDaggerfish, + calamity.ItemType("DepthBlade"), + calamity.ItemType("AbyssBlade"), + calamity.ItemType("NeptunesBounty"), + calamity.ItemType("AquaticDissolution"), + calamity.ItemType("ArchAmaryllis"), + calamity.ItemType("BiomeBlade"), + calamity.ItemType("TrueBiomeBlade"), + calamity.ItemType("OmegaBiomeBlade"), + calamity.ItemType("BladedgeGreatbow"), + calamity.ItemType("BlossomFlux"), + calamity.ItemType("EvergladeSpray"), + calamity.ItemType("FeralthornClaymore"), + calamity.ItemType("Floodtide"), + calamity.ItemType("FourSeasonsGalaxia"), + calamity.ItemType("GammaFusillade"), + calamity.ItemType("GleamingMagnolia"), + calamity.ItemType("HarvestStaff"), + calamity.ItemType("HellionFlowerSpear"), + calamity.ItemType("Lazhar"), + calamity.ItemType("LifefruitScythe"), + calamity.ItemType("ManaRose"), + calamity.ItemType("MangroveChakram"), + calamity.ItemType("MangroveChakramMelee"), + calamity.ItemType("MantisClaws"), + calamity.ItemType("Mariana"), + calamity.ItemType("Mistlestorm"), + calamity.ItemType("Monsoon"), + calamity.ItemType("Alluvion"), + calamity.ItemType("Needler"), + calamity.ItemType("NettlelineGreatbow"), + calamity.ItemType("Quagmire"), + calamity.ItemType("Shroomer"), + calamity.ItemType("SolsticeClaymore"), + calamity.ItemType("SporeKnife"), + calamity.ItemType("Spyker"), + calamity.ItemType("StormSaber"), + calamity.ItemType("StormRuler"), + calamity.ItemType("StormSurge"), + calamity.ItemType("TarragonThrowingDart"), + calamity.ItemType("TerraEdge"), + calamity.ItemType("TerraLance"), + calamity.ItemType("TerraRay"), + calamity.ItemType("TerraShiv"), + calamity.ItemType("Terratomere"), + calamity.ItemType("TerraFlameburster"), + calamity.ItemType("TheSwarmer"), + calamity.ItemType("Verdant"), + calamity.ItemType("Barinautical"), + calamity.ItemType("DeepseaStaff"), + calamity.ItemType("Downpour"), + calamity.ItemType("SubmarineShocker"), + calamity.ItemType("Archerfish"), + calamity.ItemType("BallOFugu"), + calamity.ItemType("BlackAnurian"), + calamity.ItemType("CalamarisLament"), + calamity.ItemType("HerringStaff"), + calamity.ItemType("Lionfish") + }; + + alcoholList = new List() + { + calamity.BuffType("BloodyMary"), + calamity.BuffType("CaribbeanRum"), + calamity.BuffType("CinnamonRoll"), + calamity.BuffType("Everclear"), + calamity.BuffType("EvergreenGin"), + calamity.BuffType("Fireball"), + calamity.BuffType("GrapeBeer"), + calamity.BuffType("Margarita"), + calamity.BuffType("Moonshine"), + calamity.BuffType("MoscowMule"), + calamity.BuffType("RedWine"), + calamity.BuffType("Rum"), + calamity.BuffType("Screwdriver"), + calamity.BuffType("StarBeamRye"), + calamity.BuffType("Tequila"), + calamity.BuffType("TequilaSunrise"), + calamity.BuffType("Vodka"), + calamity.BuffType("Whiskey"), + calamity.BuffType("WhiteWine") + }; + + doubleDamageBuffList = new List() + { + ItemID.BallOHurt, + ItemID.TheMeatball, + ItemID.BlueMoon, + ItemID.Sunfury, + ItemID.DaoofPow, + ItemID.FlowerPow, + ItemID.Anchor, + ItemID.KOCannon, + ItemID.GolemFist, + ItemID.BreakerBlade, + ItemID.SpectreStaff, + ItemID.MonkStaffT2, + ItemID.ProximityMineLauncher, + ItemID.FireworksLauncher + }; + + sixtySixDamageBuffList = new List() + { + ItemID.TrueNightsEdge, + ItemID.WandofSparking, + ItemID.MedusaHead, + ItemID.StaffofEarth, + ItemID.ChristmasTreeSword, + ItemID.MonkStaffT1, + ItemID.InfernoFork, + ItemID.VenomStaff + }; + + fiftyDamageBuffList = new List() + { + ItemID.NightsEdge, + ItemID.EldMelter, + ItemID.Flamethrower, + ItemID.MoonlordTurretStaff, + ItemID.WaspGun, + ItemID.Keybrand, + ItemID.PulseBow, + ItemID.PaladinsHammer + }; + + thirtyThreeDamageBuffList = new List() + { + ItemID.TerraBlade, + ItemID.CrystalVileShard, + ItemID.SoulDrain, + ItemID.ClingerStaff, + ItemID.ChargedBlasterCannon, + ItemID.NettleBurst, + ItemID.Excalibur, + ItemID.AmberStaff, + ItemID.BluePhasesaber, + ItemID.RedPhasesaber, + ItemID.GreenPhasesaber, + ItemID.WhitePhasesaber, + ItemID.YellowPhasesaber, + ItemID.PurplePhasesaber, + ItemID.TheRottedFork, + ItemID.VampireKnives, + ItemID.Cascade + }; + + twentyFiveDamageBuffList = new List() + { + ItemID.Muramasa, + ItemID.StakeLauncher + }; + + twentyDamageBuffList = new List() + { + ItemID.ChainGuillotines, + ItemID.FlowerofFrost, + ItemID.PoisonStaff, + ItemID.Gungnir, + ItemID.BookStaff + }; + + weaponAutoreuseList = new List() + { + ItemID.NightsEdge, + ItemID.TrueNightsEdge, + ItemID.TrueExcalibur, + ItemID.PhoenixBlaster, + ItemID.VenusMagnum, + ItemID.MagicDagger, + ItemID.BeamSword, + ItemID.MonkStaffT2, + ItemID.PaladinsHammer + }; + + quarterDamageNerfList = new List() + { + ItemID.DaedalusStormbow, + ItemID.PhoenixBlaster, + ItemID.VenusMagnum, + ItemID.BlizzardStaff, + ItemID.Phantasm + }; + + pumpkinMoonBuffList = new List() + { + NPCID.Scarecrow1, + NPCID.Scarecrow2, + NPCID.Scarecrow3, + NPCID.Scarecrow4, + NPCID.Scarecrow5, + NPCID.Scarecrow6, + NPCID.Scarecrow7, + NPCID.Scarecrow8, + NPCID.Scarecrow9, + NPCID.Scarecrow10, + NPCID.HeadlessHorseman, + NPCID.MourningWood, + NPCID.Splinterling, + NPCID.Pumpking, + NPCID.PumpkingBlade, + NPCID.Hellhound, + NPCID.Poltergeist + }; + + frostMoonBuffList = new List() + { + NPCID.ZombieElf, + NPCID.ZombieElfBeard, + NPCID.ZombieElfGirl, + NPCID.PresentMimic, + NPCID.GingerbreadMan, + NPCID.Yeti, + NPCID.Everscream, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.ElfCopter, + NPCID.Nutcracker, + NPCID.NutcrackerSpinning, + NPCID.ElfArcher, + NPCID.Krampus, + NPCID.Flocko + }; + + eclipseBuffList = new List() + { + NPCID.Eyezor, + NPCID.Reaper, + NPCID.Frankenstein, + NPCID.SwampThing, + NPCID.Vampire, + NPCID.VampireBat, + NPCID.Butcher, + NPCID.CreatureFromTheDeep, + NPCID.Fritz, + NPCID.Nailhead, + NPCID.Psycho, + NPCID.DeadlySphere, + NPCID.DrManFly, + NPCID.ThePossessed, + NPCID.Mothron, + NPCID.MothronEgg, + NPCID.MothronSpawn + }; + + eventProjectileBuffList = new List() + { + ProjectileID.FlamingWood, + ProjectileID.GreekFire1, + ProjectileID.GreekFire2, + ProjectileID.GreekFire3, + ProjectileID.FlamingScythe, + ProjectileID.FlamingArrow, + ProjectileID.PineNeedleHostile, + ProjectileID.OrnamentHostile, + ProjectileID.OrnamentHostileShrapnel, + ProjectileID.FrostWave, + ProjectileID.FrostShard, + ProjectileID.Missile, + ProjectileID.Present, + ProjectileID.Spike, + ProjectileID.BulletDeadeye, + ProjectileID.EyeLaser, + ProjectileID.Nail, + ProjectileID.DrManFlyFlask + }; + + revengeanceEnemyBuffList = new List() + { + NPCID.ServantofCthulhu, + NPCID.EyeofCthulhu, + NPCID.EaterofWorldsHead, + NPCID.DevourerHead, + NPCID.GiantWormHead, + NPCID.MeteorHead, + NPCID.SkeletronHead, + NPCID.SkeletronHand, + NPCID.BoneSerpentHead, + NPCID.ManEater, + NPCID.KingSlime, + NPCID.Snatcher, + NPCID.Piranha, + NPCID.Shark, + NPCID.SpikeBall, + NPCID.BlazingWheel, + NPCID.Mimic, + NPCID.WyvernHead, + NPCID.DiggerHead, + NPCID.SeekerHead, + NPCID.AnglerFish, + NPCID.Werewolf, + NPCID.Wraith, + NPCID.WallofFlesh, + NPCID.TheHungry, + NPCID.TheHungryII, + NPCID.LeechHead, + NPCID.Spazmatism, + NPCID.Retinazer, + NPCID.SkeletronPrime, + NPCID.PrimeSaw, + NPCID.PrimeVice, + NPCID.TheDestroyer, + NPCID.Arapaima, + NPCID.BlackRecluse, + NPCID.WallCreeper, + NPCID.WallCreeperWall, + NPCID.BlackRecluseWall, + NPCID.AngryTrapper, + NPCID.Lihzahrd, + NPCID.LihzahrdCrawler, + NPCID.PirateCaptain, + NPCID.QueenBee, + NPCID.FlyingSnake, + NPCID.Golem, + NPCID.GolemFistLeft, + NPCID.GolemFistRight, + NPCID.Reaper, + NPCID.Plantera, + NPCID.PlanterasHook, + NPCID.PlanterasTentacle, + NPCID.BrainofCthulhu, + NPCID.Paladin, + NPCID.BoneLee, + NPCID.MourningWood, + NPCID.Pumpking, + NPCID.PumpkingBlade, + NPCID.PresentMimic, + NPCID.Everscream, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.DukeFishron, + NPCID.MoonLordHand, + NPCID.StardustWormHead, + NPCID.SolarCrawltipedeHead, + NPCID.CultistDragonHead, + NPCID.Butcher, + NPCID.Psycho, + NPCID.DeadlySphere, + NPCID.BigMimicCorruption, + NPCID.BigMimicCrimson, + NPCID.BigMimicHallow, + NPCID.Mothron, + NPCID.DuneSplicerHead, + NPCID.SlimeSpiked, + NPCID.SandShark, + NPCID.SandsharkCorrupt, + NPCID.SandsharkCrimson, + NPCID.SandsharkHallow, + NPCID.DD2Betsy, + calamity.NPCType("Astrageldon"), + calamity.NPCType("AstrumDeusHead"), + calamity.NPCType("AstrumDeusHeadSpectral"), + calamity.NPCType("Bumblefuck"), + calamity.NPCType("CalamitasRun3"), + calamity.NPCType("CosmicWraith"), + calamity.NPCType("CrabulonIdle"), + calamity.NPCType("Cryogen"), + calamity.NPCType("DesertScourgeHead"), + calamity.NPCType("GreatSandShark"), + calamity.NPCType("HiveMindP2"), + calamity.NPCType("DankCreeper"), + calamity.NPCType("AquaticAberration"), + calamity.NPCType("Leviathan"), + calamity.NPCType("Siren"), + calamity.NPCType("PerforatorHeadLarge"), + calamity.NPCType("PerforatorHeadMedium"), + calamity.NPCType("PerforatorHeadSmall"), + calamity.NPCType("PlaguebringerGoliath"), + calamity.NPCType("PlagueHomingMissile"), + calamity.NPCType("PlagueMine"), + calamity.NPCType("Polterghast"), + calamity.NPCType("PolterghastHook"), + calamity.NPCType("PolterPhantom"), + calamity.NPCType("ProfanedGuardianBoss"), + calamity.NPCType("RockPillar"), + calamity.NPCType("ScavengerBody"), + calamity.NPCType("ScavengerClawRight"), + calamity.NPCType("ScavengerClawLeft"), + calamity.NPCType("ProfanedGuardianBoss2"), + calamity.NPCType("ProvSpawnDefense"), + calamity.NPCType("ProvSpawnOffense"), + calamity.NPCType("SlimeGod"), + calamity.NPCType("SlimeGodRun"), + calamity.NPCType("SlimeGodCore"), + calamity.NPCType("SlimeGodSplit"), + calamity.NPCType("SlimeGodRunSplit"), + calamity.NPCType("StormWeaverHead"), + calamity.NPCType("StormWeaverHeadNaked"), + calamity.NPCType("SupremeCalamitas"), + calamity.NPCType("DevourerofGodsHead"), + calamity.NPCType("DevourerofGodsHead2"), + calamity.NPCType("DevourerofGodsHeadS"), + calamity.NPCType("Yharon"), + calamity.NPCType("AquaticScourgeHead"), + calamity.NPCType("BobbitWormHead"), + calamity.NPCType("AquaticSeekerHead"), + calamity.NPCType("ColossalSquid"), + calamity.NPCType("EidolonWyrmHead"), + calamity.NPCType("EidolonWyrmHeadHuge"), + calamity.NPCType("GulperEelHead"), + calamity.NPCType("Mauler"), + calamity.NPCType("Reaper"), + calamity.NPCType("Atlas"), + calamity.NPCType("ArmoredDiggerHead"), + calamity.NPCType("Cnidrion"), + calamity.NPCType("Horse"), + calamity.NPCType("ScornEater"), + calamity.NPCType("OldDuke"), + calamity.NPCType("DukeUrchin"), + calamity.NPCType("PrismTurtle"), + calamity.NPCType("GhostBell"), + calamity.NPCType("EutrophicRay"), + calamity.NPCType("Clam"), + calamity.NPCType("SeaSerpent1"), + calamity.NPCType("BlindedAngler"), + calamity.NPCType("GiantClam") + }; + + revengeanceProjectileBuffList = new List() + { + ProjectileID.SandBallFalling, + ProjectileID.AshBallFalling, + ProjectileID.DemonSickle, + ProjectileID.EbonsandBallFalling, + ProjectileID.PearlSandBallFalling, + ProjectileID.CursedFlameHostile, + ProjectileID.EyeFire, + ProjectileID.Boulder, + ProjectileID.DeathLaser, + ProjectileID.PoisonDartTrap, + ProjectileID.SpikyBallTrap, + ProjectileID.SpearTrap, + ProjectileID.FlamethrowerTrap, + ProjectileID.FlamesTrap, + ProjectileID.CrimsandBallFalling, + ProjectileID.Fireball, + ProjectileID.EyeBeam, + ProjectileID.PoisonSeedPlantera, + ProjectileID.ThornBall, + ProjectileID.PaladinsHammerHostile, + ProjectileID.RocketSkeleton, + ProjectileID.FlamingWood, + ProjectileID.FlamingScythe, + ProjectileID.FrostWave, + ProjectileID.Present, + ProjectileID.Spike, + ProjectileID.SaucerDeathray, + ProjectileID.PhantasmalEye, + ProjectileID.PhantasmalSphere, + ProjectileID.PhantasmalDeathray, + ProjectileID.CultistBossIceMist, + ProjectileID.CultistBossLightningOrbArc, + ProjectileID.CultistBossFireBall, + ProjectileID.NebulaBolt, + ProjectileID.NebulaSphere, + ProjectileID.NebulaLaser, + ProjectileID.StardustSoldierLaser, + ProjectileID.VortexLaser, + ProjectileID.VortexVortexLightning, + ProjectileID.VortexLightning, + ProjectileID.VortexAcid, + ProjectileID.GeyserTrap, + ProjectileID.SandnadoHostile, + ProjectileID.DD2BetsyFireball, + ProjectileID.DD2BetsyFlameBreath, + calamity.ProjectileType("AbyssMine"), + calamity.ProjectileType("AbyssMine2"), + calamity.ProjectileType("AstralFlame"), + calamity.ProjectileType("BloodGeyser"), + calamity.ProjectileType("BrimstoneBarrage"), + calamity.ProjectileType("BrimstoneFireblast"), + calamity.ProjectileType("BrimstoneGigaBlast"), + calamity.ProjectileType("BrimstoneHellblast"), + calamity.ProjectileType("BrimstoneHellblast2"), + calamity.ProjectileType("BrimstoneHellfireball"), + calamity.ProjectileType("BrimstoneLaser"), + calamity.ProjectileType("BrimstoneLaserSplit"), + calamity.ProjectileType("BrimstoneMonster"), + calamity.ProjectileType("BrimstoneWave"), + calamity.ProjectileType("DarkEnergyBall"), + calamity.ProjectileType("DeusMine"), + calamity.ProjectileType("DoGDeath"), + calamity.ProjectileType("DoGFire"), + calamity.ProjectileType("CosmicFlameBurst"), + calamity.ProjectileType("FlareBomb"), + calamity.ProjectileType("Flarenado"), + calamity.ProjectileType("HiveBombGoliath"), + calamity.ProjectileType("HolyBlast"), + calamity.ProjectileType("HolyBomb"), + calamity.ProjectileType("HolyShot"), + calamity.ProjectileType("HolySpear"), + calamity.ProjectileType("IceBomb"), + calamity.ProjectileType("IchorShot"), + calamity.ProjectileType("Infernado"), + calamity.ProjectileType("LeviathanBomb"), + calamity.ProjectileType("MoltenBlast"), + calamity.ProjectileType("Mushmash"), + calamity.ProjectileType("PhantomMine"), + calamity.ProjectileType("PhantomBlast"), + calamity.ProjectileType("PhantomBlast2"), + calamity.ProjectileType("ProfanedSpear"), + calamity.ProjectileType("ProvidenceCrystalShard"), + calamity.ProjectileType("ProvidenceHolyRay"), + calamity.ProjectileType("RedLightningFeather"), + calamity.ProjectileType("SandPoisonCloud"), + calamity.ProjectileType("ScavengerNuke"), + calamity.ProjectileType("SirenSong"), + calamity.ProjectileType("YharonFireball"), + calamity.ProjectileType("YharonFireball2"), + calamity.ProjectileType("PearlBurst"), + calamity.ProjectileType("PearlRain") + }; + + trapProjectileList = new List() + { + ProjectileID.PoisonDartTrap, + ProjectileID.SpikyBallTrap, + ProjectileID.SpearTrap, + ProjectileID.FlamethrowerTrap, + ProjectileID.FlamesTrap, + ProjectileID.PoisonDart, + ProjectileID.GeyserTrap + }; + + scopedWeaponList = new List() + { + calamity.ItemType("AMR"), + calamity.ItemType("Shroomer"), + calamity.ItemType("SpectreRifle"), + 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("UrchinSpear"), + calamity.ItemType("AmidiasTrident"), + calamity.ItemType("GoldplumeSpear"), + calamity.ItemType("EarthenPike"), + 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 + }; + } + + if (Config.RevengeanceAndDeathThoriumBossBuff) + { + if (thorium != null) + { + enemyImmunityList.Add(thorium.NPCType("TheGrandThunderBirdv2")); + enemyImmunityList.Add(thorium.NPCType("QueenJelly")); + enemyImmunityList.Add(thorium.NPCType("Viscount")); + enemyImmunityList.Add(thorium.NPCType("GraniteEnergyStorm")); + enemyImmunityList.Add(thorium.NPCType("TheBuriedWarrior")); + enemyImmunityList.Add(thorium.NPCType("ThePrimeScouter")); + enemyImmunityList.Add(thorium.NPCType("BoreanStrider")); + enemyImmunityList.Add(thorium.NPCType("BoreanStriderPopped")); + enemyImmunityList.Add(thorium.NPCType("FallenDeathBeholder")); + enemyImmunityList.Add(thorium.NPCType("FallenDeathBeholder2")); + enemyImmunityList.Add(thorium.NPCType("Lich")); + enemyImmunityList.Add(thorium.NPCType("LichHeadless")); + enemyImmunityList.Add(thorium.NPCType("Abyssion")); + enemyImmunityList.Add(thorium.NPCType("AbyssionCracked")); + enemyImmunityList.Add(thorium.NPCType("AbyssionReleased")); + enemyImmunityList.Add(thorium.NPCType("SlagFury")); + enemyImmunityList.Add(thorium.NPCType("Omnicide")); + enemyImmunityList.Add(thorium.NPCType("RealityBreaker")); + enemyImmunityList.Add(thorium.NPCType("Aquaius")); + enemyImmunityList.Add(thorium.NPCType("Aquaius2")); + + revengeanceEnemyBuffList.Add(thorium.NPCType("TheGrandThunderBirdv2")); + revengeanceEnemyBuffList.Add(thorium.NPCType("QueenJelly")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Viscount")); + revengeanceEnemyBuffList.Add(thorium.NPCType("GraniteEnergyStorm")); + revengeanceEnemyBuffList.Add(thorium.NPCType("TheBuriedWarrior")); + revengeanceEnemyBuffList.Add(thorium.NPCType("ThePrimeScouter")); + revengeanceEnemyBuffList.Add(thorium.NPCType("BoreanStrider")); + revengeanceEnemyBuffList.Add(thorium.NPCType("BoreanStriderPopped")); + revengeanceEnemyBuffList.Add(thorium.NPCType("FallenDeathBeholder")); + revengeanceEnemyBuffList.Add(thorium.NPCType("FallenDeathBeholder2")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Lich")); + revengeanceEnemyBuffList.Add(thorium.NPCType("LichHeadless")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Abyssion")); + revengeanceEnemyBuffList.Add(thorium.NPCType("AbyssionCracked")); + revengeanceEnemyBuffList.Add(thorium.NPCType("AbyssionReleased")); + revengeanceEnemyBuffList.Add(thorium.NPCType("SlagFury")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Omnicide")); + revengeanceEnemyBuffList.Add(thorium.NPCType("RealityBreaker")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Aquaius")); + revengeanceEnemyBuffList.Add(thorium.NPCType("Aquaius2")); + + revengeanceProjectileBuffList.Add(thorium.ProjectileType("GrandThunderBirdZap")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ThunderGust")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BubbleBomb")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("QueenJellyArm")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("QueenTorrent")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRipple")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRipple2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountBlood")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountStomp")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountStomp2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("ViscountRockFall")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("GraniteCharge")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedShock")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedDagger")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrow")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrow2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowF")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowP")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedArrowC")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedMagic")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BuriedMagicPop")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeamOuter")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeam")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("MainBeamCheese")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("VaporizeBlast")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitonSurge")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("Vaporize")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitonCharge")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("GravitySpark")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("DoomBeholderBeam")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("VoidLaserPro")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BeholderBeam")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardBarrage")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostSurge")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostSurgeR")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardCascade")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardBoom")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("BlizzardFang")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FrostMytePro")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("IceAnomaly")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichGaze")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichGazeB")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareSpawn")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlare")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichPulse")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichMatter")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("SoulRenderLich")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareDeathD")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("LichFlareDeathU")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("Whirlpool")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssionSpit")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssionSpit2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("AquaRipple")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("AbyssalStrike2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("OldGodSpit")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("OldGodSpit2")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("WaterPulse")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("TyphoonBlastHostile")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("TyphoonBlastHostileSmaller")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("AquaBarrage")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawnR")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawnL")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("DeathRaySpawn")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("OmniDeath")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("OmniSphereOrb")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlameLash")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlamePulse")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlamePulseTorn")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("FlameNova")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("MoltenFury")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("RealityFury")); + revengeanceProjectileBuffList.Add(thorium.ProjectileType("UFOBlast")); + } + } + } + #endregion + + #region Music + public override void UpdateMusic(ref int music, ref MusicPriority priority) + { + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (Main.musicVolume != 0) + { + if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) + { + if (Main.LocalPlayer.GetModPlayer(this).ZoneCalamity) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag"); + else + music = MusicID.Eerie; + priority = MusicPriority.Environment; + } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneSunkenSea) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SunkenSea"); + else + music = MusicID.Temple; + priority = MusicPriority.Environment; + } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneAstral) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); + else + music = MusicID.Space; + priority = MusicPriority.Environment; + } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer1 || Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer2) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"); + else + music = MusicID.Hell; + priority = MusicPriority.BiomeHigh; + } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer3) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss"); + else + music = MusicID.Hell; + priority = MusicPriority.BiomeHigh; + } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer4) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheVoid"); + else + music = MusicID.Hell; + priority = MusicPriority.BiomeHigh; + } + } + if (Main.LocalPlayer.GetModPlayer(this).ZoneSulphur) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Sulphur"); + else + music = MusicID.Desert; + priority = MusicPriority.BiomeHigh; + } + } + if (CalamityWorld.DoGSecondStageCountdown <= 540 && CalamityWorld.DoGSecondStageCountdown > 60) //8 seconds before DoG spawns + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + else + music = MusicID.LunarBoss; + priority = MusicPriority.BossMedium; + } + } + } + } + } + #endregion + + #region ModSupport + public override void PostSetupContent() + { + WeakReferenceSupport.Setup(); + } + + public override object Call(params object[] args) + { + return ModSupport.Call(args); + } + #endregion + + #region DrawingStuff + public override void ModifyInterfaceLayers(List layers) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (CalamityWorld.revenge && Config.AdrenalineAndRage) + { + UIHandler.ModifyInterfaceLayers(mod, layers); + } + int index = layers.FindIndex(layer => layer.Name == "Vanilla: Mouse Text"); + if (index != -1) + { + layers.Insert(index, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () + { + if (Main.LocalPlayer.GetModPlayer(mod).drawBossHPBar) + { + BossHealthBarManager.Update(); + BossHealthBarManager.Draw(Main.spriteBatch); + } + return true; + }, InterfaceScaleType.None)); + } + base.ModifyInterfaceLayers(layers); + layers.Insert(index, new LegacyGameInterfaceLayer("Astral Arcanum UI", delegate () + { + AstralArcanumUI.UpdateAndDraw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + } + + public static Color GetNPCColor(NPC npc, Vector2? position = null, bool effects = true, float shadowOverride = 0f) + { + return npc.GetAlpha(BuffEffects(npc, GetLightColor(position != null ? (Vector2)position : npc.Center), (shadowOverride != 0f ? shadowOverride : 0f), effects, npc.poisoned, npc.onFire, npc.onFire2, Main.player[Main.myPlayer].detectCreature, false, false, false, npc.venom, npc.midas, npc.ichor, npc.onFrostBurn, false, false, npc.dripping, npc.drippingSlime, npc.loveStruck, npc.stinky)); + } + + public static Color GetLightColor(Vector2 position) + { + return Lighting.GetColor((int)(position.X / 16f), (int)(position.Y / 16f)); + } + + public static Color BuffEffects(Entity codable, Color lightColor, float shadow = 0f, bool effects = true, bool poisoned = false, bool onFire = false, bool onFire2 = false, bool hunter = false, bool noItems = false, bool blind = false, bool bleed = false, bool venom = false, bool midas = false, bool ichor = false, bool onFrostBurn = false, bool burned = false, bool honey = false, bool dripping = false, bool drippingSlime = false, bool loveStruck = false, bool stinky = false) + { + float cr = 1f; float cg = 1f; float cb = 1f; float ca = 1f; + if (effects && honey && Main.rand.Next(30) == 0) + { + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 152, 0f, 0f, 150, default(Color), 1f); + Main.dust[dustID].velocity.Y = 0.3f; + Main.dust[dustID].velocity.X *= 0.1f; + Main.dust[dustID].scale += (float)Main.rand.Next(3, 4) * 0.1f; + Main.dust[dustID].alpha = 100; + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity += codable.velocity * 0.1f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + if (poisoned) + { + if (effects && Main.rand.Next(30) == 0) + { + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 46, 0f, 0f, 120, default(Color), 0.2f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].fadeIn = 1.9f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + cr *= 0.65f; + cb *= 0.75f; + } + if (venom) + { + if (effects && Main.rand.Next(10) == 0) + { + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 171, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].fadeIn = 1.5f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + cg *= 0.45f; + cr *= 0.75f; + } + if (midas) + { + cb *= 0.3f; + cr *= 0.85f; + } + if (ichor) + { + if (codable is NPC) + { + lightColor = new Color(255, 255, 0, 255); + } + else + { + cb = 0f; + } + } + if (burned) + { + if (effects) + { + int dustID = Dust.NewDust(new Vector2(codable.position.X - 2f, codable.position.Y - 2f), codable.width + 4, codable.height + 4, 6, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default(Color), 2f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 1.8f; + Main.dust[dustID].velocity.Y -= 0.75f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + if (codable is Player) + { + cr = 1f; + cb *= 0.6f; + cg *= 0.7f; + } + } + if (onFrostBurn) + { + if (effects) + { + if (Main.rand.Next(4) < 3) + { + int dustID = Dust.NewDust(new Vector2(codable.position.X - 2f, codable.position.Y - 2f), codable.width + 4, codable.height + 4, 135, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default(Color), 3.5f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 1.8f; + Main.dust[dustID].velocity.Y -= 0.5f; + if (Main.rand.Next(4) == 0) + { + Main.dust[dustID].noGravity = false; + Main.dust[dustID].scale *= 0.5f; + } + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 0.1f, 0.6f, 1f); + } + if (codable is Player) + { + cr *= 0.5f; + cg *= 0.7f; + } + } + if (onFire) + { + if (effects) + { + if (Main.rand.Next(4) != 0) + { + int dustID = Dust.NewDust(codable.position - new Vector2(2f, 2f), codable.width + 4, codable.height + 4, 6, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default(Color), 3.5f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 1.8f; + Main.dust[dustID].velocity.Y -= 0.5f; + if (Main.rand.Next(4) == 0) + { + Main.dust[dustID].noGravity = false; + Main.dust[dustID].scale *= 0.5f; + } + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); + } + if (codable is Player) + { + cb *= 0.6f; + cg *= 0.7f; + } + } + if (dripping && shadow == 0f && Main.rand.Next(4) != 0) + { + Vector2 position = codable.position; + position.X -= 2f; position.Y -= 2f; + if (Main.rand.Next(2) == 0) + { + int dustID = Dust.NewDust(position, codable.width + 4, codable.height + 2, 211, 0f, 0f, 50, default(Color), 0.8f); + if (Main.rand.Next(2) == 0) + { + Main.dust[dustID].alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + Main.dust[dustID].alpha += 25; + } + Main.dust[dustID].noLight = true; + Main.dust[dustID].velocity *= 0.2f; + Main.dust[dustID].velocity.Y += 0.2f; + Main.dust[dustID].velocity += codable.velocity; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + else + { + int dustID = Dust.NewDust(position, codable.width + 8, codable.height + 8, 211, 0f, 0f, 50, default(Color), 1.1f); + if (Main.rand.Next(2) == 0) + { + Main.dust[dustID].alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + Main.dust[dustID].alpha += 25; + } + Main.dust[dustID].noLight = true; + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 0.2f; + Main.dust[dustID].velocity.Y += 1f; + Main.dust[dustID].velocity += codable.velocity; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + } + if (drippingSlime && shadow == 0f) + { + int alpha = 175; + Color newColor = new Color(0, 80, 255, 100); + if (Main.rand.Next(4) != 0) + { + if (Main.rand.Next(2) == 0) + { + Vector2 position2 = codable.position; + position2.X -= 2f; position2.Y -= 2f; + int dustID = Dust.NewDust(position2, codable.width + 4, codable.height + 2, 4, 0f, 0f, alpha, newColor, 1.4f); + if (Main.rand.Next(2) == 0) + { + Main.dust[dustID].alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + Main.dust[dustID].alpha += 25; + } + Main.dust[dustID].noLight = true; + Main.dust[dustID].velocity *= 0.2f; + Main.dust[dustID].velocity.Y += 0.2f; + Main.dust[dustID].velocity += codable.velocity; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + } + cr *= 0.8f; + cg *= 0.8f; + } + if (onFire2) + { + if (effects) + { + if (Main.rand.Next(4) != 0) + { + int dustID = Dust.NewDust(codable.position - new Vector2(2f, 2f), codable.width + 4, codable.height + 4, 75, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default(Color), 3.5f); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 1.8f; + Main.dust[dustID].velocity.Y -= 0.5f; + if (Main.rand.Next(4) == 0) + { + Main.dust[dustID].noGravity = false; + Main.dust[dustID].scale *= 0.5f; + } + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); + } + if (codable is Player) + { + cb *= 0.6f; + cg *= 0.7f; + } + } + if (noItems) + { + cr *= 0.65f; + cg *= 0.8f; + } + if (blind) + { + cr *= 0.7f; + cg *= 0.65f; + } + if (bleed) + { + bool dead = (codable is Player ? ((Player)codable).dead : codable is NPC ? ((NPC)codable).life <= 0 : false); + if (effects && !dead && Main.rand.Next(30) == 0) + { + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 5, 0f, 0f, 0, default(Color), 1f); + Main.dust[dustID].velocity.Y += 0.5f; + Main.dust[dustID].velocity *= 0.25f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + cg *= 0.9f; + cb *= 0.9f; + } + if (loveStruck && effects && shadow == 0f && Main.instance.IsActive && !Main.gamePaused && Main.rand.Next(5) == 0) + { + Vector2 value = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); + value.Normalize(); + value.X *= 0.66f; + int goreID = Gore.NewGore(codable.position + new Vector2((float)Main.rand.Next(codable.width + 1), (float)Main.rand.Next(codable.height + 1)), value * (float)Main.rand.Next(3, 6) * 0.33f, 331, (float)Main.rand.Next(40, 121) * 0.01f); + Main.gore[goreID].sticky = false; + Main.gore[goreID].velocity *= 0.4f; + Main.gore[goreID].velocity.Y -= 0.6f; + if (codable is Player) + { + Main.playerDrawGore.Add(goreID); + } + } + if (stinky && shadow == 0f) + { + cr *= 0.7f; + cb *= 0.55f; + if (effects && Main.rand.Next(5) == 0 && Main.instance.IsActive && !Main.gamePaused) + { + Vector2 value2 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); + value2.Normalize(); value2.X *= 0.66f; value2.Y = Math.Abs(value2.Y); + Vector2 vector = value2 * (float)Main.rand.Next(3, 5) * 0.25f; + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 188, vector.X, vector.Y * 0.5f, 100, default(Color), 1.5f); + Main.dust[dustID].velocity *= 0.1f; + Main.dust[dustID].velocity.Y -= 0.5f; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + } + lightColor.R = (byte)((float)lightColor.R * cr); + lightColor.G = (byte)((float)lightColor.G * cg); + lightColor.B = (byte)((float)lightColor.B * cb); + lightColor.A = (byte)((float)lightColor.A * ca); + if (codable is NPC) + { + NPCLoader.DrawEffects((NPC)codable, ref lightColor); + } + if (hunter && (codable is NPC ? ((NPC)codable).lifeMax > 1 : true)) + { + if (effects && !Main.gamePaused && Main.instance.IsActive && Main.rand.Next(50) == 0) + { + int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 15, 0f, 0f, 150, default(Color), 0.8f); + Main.dust[dustID].velocity *= 0.1f; + Main.dust[dustID].noLight = true; + if (codable is Player) + { + Main.playerDrawDust.Add(dustID); + } + } + byte colorR = 50, colorG = 255, colorB = 50; + if (codable is NPC && !(((NPC)codable).friendly || ((NPC)codable).catchItem > 0 || (((NPC)codable).damage == 0 && ((NPC)codable).lifeMax == 5))) + { + colorR = 255; colorG = 50; + } + if (!(codable is NPC) && lightColor.R < 150) + { + lightColor.A = Main.mouseTextColor; + } + if (lightColor.R < colorR) + { + lightColor.R = colorR; + } + if (lightColor.G < colorG) + { + lightColor.G = colorG; + } + if (lightColor.B < colorB) + { + lightColor.B = colorB; + } + } + return lightColor; + } + + public static void DrawTexture(object sb, Texture2D texture, int shader, Entity codable, Color? overrideColor = null, bool drawCentered = false) + { + Color lightColor = (overrideColor != null ? (Color)overrideColor : codable is NPC ? GetNPCColor(((NPC)codable), codable.Center, false) : codable is Projectile ? ((Projectile)codable).GetAlpha(GetLightColor(codable.Center)) : GetLightColor(codable.Center)); + int frameCount = (codable is NPC ? Main.npcFrameCount[((NPC)codable).type] : 1); + Rectangle frame = (codable is NPC ? ((NPC)codable).frame : new Rectangle(0, 0, texture.Width, texture.Height)); + float scale = (codable is NPC ? ((NPC)codable).scale : ((Projectile)codable).scale); + float rotation = (codable is NPC ? ((NPC)codable).rotation : ((Projectile)codable).rotation); + int spriteDirection = (codable is NPC ? ((NPC)codable).spriteDirection : ((Projectile)codable).spriteDirection); + float offsetY = (codable is NPC ? ((NPC)codable).gfxOffY : 0f); + DrawTexture(sb, texture, shader, codable.position + new Vector2(0f, offsetY), codable.width, codable.height, scale, rotation, spriteDirection, frameCount, frame, lightColor, drawCentered); + } + + public static void DrawTexture(object sb, Texture2D texture, int shader, Vector2 position, int width, int height, float scale, float rotation, int direction, int framecount, Rectangle frame, Color? overrideColor = null, bool drawCentered = false) + { + Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / framecount / 2)); + Color lightColor = overrideColor != null ? (Color)overrideColor : GetLightColor(position + new Vector2(width * 0.5f, height * 0.5f)); + if (sb is List) + { + DrawData dd = new DrawData(texture, GetDrawPosition(position, origin, width, height, texture.Width, texture.Height, framecount, scale, drawCentered), frame, lightColor, rotation, origin, scale, direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + dd.shader = shader; + ((List)sb).Add(dd); + } + else if (sb is SpriteBatch) + { + bool applyDye = shader > 0; + if (applyDye) + { + ((SpriteBatch)sb).End(); + ((SpriteBatch)sb).Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); + GameShaders.Armor.ApplySecondary(shader, Main.player[Main.myPlayer], null); + } + ((SpriteBatch)sb).Draw(texture, GetDrawPosition(position, origin, width, height, texture.Width, texture.Height, framecount, scale, drawCentered), frame, lightColor, rotation, origin, scale, direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + if (applyDye) + { + ((SpriteBatch)sb).End(); + ((SpriteBatch)sb).Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); + } + } + } + + public static Vector2 GetDrawPosition(Vector2 position, Vector2 origin, int width, int height, int texWidth, int texHeight, int framecount, float scale, bool drawCentered = false) + { + Vector2 screenPos = new Vector2((int)Main.screenPosition.X, (int)Main.screenPosition.Y); + if (drawCentered) + { + Vector2 texHalf = new Vector2(texWidth / 2, texHeight / framecount / 2); + return (position + new Vector2(width * 0.5f, height * 0.5f)) - (texHalf * scale) + (origin * scale) - screenPos; + } + return position - screenPos + new Vector2(width * 0.5f, height) - new Vector2(texWidth * scale / 2f, texHeight * scale / (float)framecount) + (origin * scale) + new Vector2(0f, 5f); + } + #endregion + + #region Recipes + public override void AddRecipeGroups() + { + CalamityRecipes.AddRecipeGroups(); + } + + public override void AddRecipes() + { + CalamityRecipes.AddRecipes(); + } + #endregion + + #region Seasons + public static Season season + { + get + { + DateTime date = DateTime.Now; + int day = date.DayOfYear - Convert.ToInt32((DateTime.IsLeapYear(date.Year)) && date.DayOfYear > 59); + + if (day < 80 || day >= 355) + { + return Season.Winter; + } + + else if (day >= 80 && day < 172) + { + return Season.Spring; + } + + else if (day >= 172 && day < 266) + { + return Season.Summer; + } + + else + { + return Season.Fall; + } + } + } + #endregion + + #region Packets + public override void HandlePacket(BinaryReader reader, int whoAmI) + { + CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); + switch (msgType) + { + case CalamityModMessageType.MeleeLevelSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 0); + break; + case CalamityModMessageType.RangedLevelSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 1); + break; + case CalamityModMessageType.MagicLevelSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 2); + break; + case CalamityModMessageType.SummonLevelSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 3); + break; + case CalamityModMessageType.RogueLevelSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleLevels(reader, 4); + break; + case CalamityModMessageType.ExactMeleeLevelSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 0); + break; + case CalamityModMessageType.ExactRangedLevelSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 1); + break; + case CalamityModMessageType.ExactMagicLevelSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 2); + break; + case CalamityModMessageType.ExactSummonLevelSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 3); + break; + case CalamityModMessageType.ExactRogueLevelSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleExactLevels(reader, 4); + break; + case CalamityModMessageType.StressSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleStress(reader); + break; + case CalamityModMessageType.BossRushStage: + int stage = reader.ReadInt32(); + CalamityWorld.bossRushStage = stage; + break; + case CalamityModMessageType.AdrenalineSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleAdrenaline(reader); + break; + /*case CalamityModMessageType.DistanceFromBossSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleDistanceFromBoss(reader); + break;*/ + case CalamityModMessageType.TeleportPlayer: + Main.player[reader.ReadInt32()].GetModPlayer().HandleTeleport(reader.ReadInt32(), true, whoAmI); + break; + case CalamityModMessageType.DoGCountdownSync: + int countdown = reader.ReadInt32(); + CalamityWorld.DoGSecondStageCountdown = countdown; + break; + case CalamityModMessageType.BossSpawnCountdownSync: + int countdown2 = reader.ReadInt32(); + CalamityWorld.bossSpawnCountdown = countdown2; + break; + case CalamityModMessageType.BossTypeSync: + 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; + } + } + #endregion + } + + public enum Season : byte + { + Winter, + Spring, + Summer, + Fall + } + + enum CalamityModMessageType : byte + { + MeleeLevelSync, + RangedLevelSync, + MagicLevelSync, + SummonLevelSync, + RogueLevelSync, + ExactMeleeLevelSync, + ExactRangedLevelSync, + ExactMagicLevelSync, + ExactSummonLevelSync, + ExactRogueLevelSync, + StressSync, + AdrenalineSync, + TeleportPlayer, + BossRushStage, + DoGCountdownSync, + BossSpawnCountdownSync, + BossTypeSync, + DeathCountSync + //DistanceFromBossSync + } +} diff --git a/CalamityPlayer.cs b/CalamityPlayer.cs index 2b20a0621e..3ec9feb071 100644 --- a/CalamityPlayer.cs +++ b/CalamityPlayer.cs @@ -1,11014 +1,11014 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; -using Terraria.GameContent.UI; -using Terraria.GameInput; -using Terraria.Graphics.Capture; -using Terraria.Graphics.Effects; -using Terraria.Graphics.Shaders; -using CalamityMod.NPCs; -using CalamityMod.NPCs.TheDevourerofGods; -using CalamityMod.NPCs.Calamitas; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Yharon; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.Projectiles; -using CalamityMod.Items; -using CalamityMod.Items.Armor; -using CalamityMod.UI; -using CalamityMod.World; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using Terraria.ModLoader.IO; - -namespace CalamityMod -{ - public class CalamityPlayer : ModPlayer - { - #region InstanceVars - - //No Category - public static bool areThereAnyDamnBosses = false; - public bool drawBossHPBar = true; - public bool shouldDrawSmallText = true; - private const int saveVersion = 0; - public const float defEndurance = 0.33f; - //public int distanceFromBoss = -1; - public int dashMod; - public int projTypeJustHitBy; - public int sCalDeathCount = 0; - public int sCalKillCount = 0; - public int deathCount = 0; - - //Timer and Counter - public int bossRushImmunityFrameCurseTimer = 0; - public int aBulwarkRareMeleeBoostTimer = 0; - public int nebulaManaNerfCounter = 0; - public int alcoholPoisonLevel = 0; - public int modStealthTimer; - public int dashTimeMod; - public int hInfernoBoost = 0; - public int pissWaterBoost = 0; - public int packetTimer = 0; - public int bloodflareHeartTimer = 180; - public int bloodflareManaTimer = 180; - public int ataraxiaDamageBoostCooldown = 0; - public int ataraxiaDamageBoostCancelTimer = 1200; - public float ataraxiaDamageBoost = 0f; - public float rogueStealth = 0f; - public float rogueStealthMax = 0f; - public float modStealth = 1f; - public float aquaticBoost = 1f; - public float shieldInvinc = 5f; - - //Sound - public bool playRogueStealthSound = false; - public bool playFullRageSound = true; - public bool playFullAdrenalineSound = true; - public bool playAdrenalineBurnoutSound = true; - public bool playFullAdrenalineBurnoutSound = true; - - //Proficiency - public int meleeLevel = 0; - public int rangedLevel = 0; - public int magicLevel = 0; - public int rogueLevel = 0; - public int summonLevel = 0; - public bool shootFireworksLevelUpMelee = true; - public bool shootFireworksLevelUpRanged = true; - public bool shootFireworksLevelUpMagic = true; - public bool shootFireworksLevelUpSummon = true; - public bool shootFireworksLevelUpRogue = true; - public int exactMeleeLevel = 0; - public int exactRangedLevel = 0; - public int exactMagicLevel = 0; - public int exactSummonLevel = 0; - public int exactRogueLevel = 0; - public int gainLevelCooldown = 120; - - //Mount - public bool onyxExcavator = false; - public bool angryDog = false; - public bool fab = false; - public bool crysthamyr = false; - - //Pet - public bool akato = false; - public bool leviPet = false; - public bool sirenPet = false; - public bool fox = false; - public bool chibii = false; - public bool brimling = false; - public bool bearPet = false; - public bool kendra = false; - public bool trashMan = false; - public int trashManChest = -1; - - //Rage - public const int stressMax = 10000; - public int stress; - public int stressCD; - public bool stressLevel500 = false; - public bool rageMode = false; - public int gainRageCooldown = 60; - - //Adrenaline - public const int adrenalineMax = 10000; - public int adrenalineMaxTimer = 300; - public int adrenalineDmgDown = 600; - public float adrenalineDmgMult = 1f; - public int adrenaline; - public int adrenalineCD; - public bool adrenalineMode = false; - - //Permanent Buff - public bool extraAccessoryML = false; - public bool eCore = false; - public bool pHeart = false; - public bool cShard = false; - public bool mFruit = false; - public bool bOrange = false; - public bool eBerry = false; - public bool dFruit = false; - public bool revJamDrop = false; - public bool rageBoostOne = false; - public bool rageBoostTwo = false; - public bool rageBoostThree = false; - public bool adrenalineBoostOne = false; - public bool adrenalineBoostTwo = false; - public bool adrenalineBoostThree = false; - - //Lore - 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; - - //Accessory - public bool fasterMeleeLevel = false; - public bool fasterRangedLevel = false; - public bool fasterMagicLevel = false; - public bool fasterSummonLevel = false; - 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; - public bool afflicted = false; - public bool affliction = false; - public bool stressPills = false; - public bool laudanum = false; - public bool heartOfDarkness = false; - public bool draedonsHeart = false; - public bool draedonsStressGain = false; - public bool rampartOfDeities = false; - public bool vexation = false; - public bool fBulwark = false; - public bool dodgeScarf = false; - public bool badgeOfBravery = false; - public bool badgeOfBraveryRare = false; - public bool scarfCooldown = false; - public bool cryogenSoul = false; - public bool yInsignia = false; - public bool eGauntlet = false; - public bool eTalisman = false; - public bool statisBeltOfCurses = false; - public bool elysianAegis = false; - public bool elysianGuard = false; - public bool nCore = false; - public bool deepDiver = false; - public bool abyssalDivingSuitPlates = false; - public bool abyssalDivingSuitCooldown = false; - public int abyssalDivingSuitPlateHits = 0; - public bool sirenWaterBuff = false; - public bool sirenIce = false; - public bool sirenIceCooldown = false; - public bool aSpark = false; - public bool aSparkRare = false; - public bool aBulwark = false; - public bool aBulwarkRare = false; - public bool dAmulet = false; - public bool fCarapace = false; - public bool gShell = false; - public bool absorber = false; - public bool aAmpoule = false; - public bool pAmulet = false; - public bool fBarrier = false; - public bool aBrain = false; - public bool lol = false; - public bool raiderTalisman = false; - public int raiderStack = 0; - public bool sGenerator = false; - public bool sDefense = false; - public bool sPower = false; - public bool sRegen = false; - public bool IBoots = false; - public bool elysianFire = false; - public bool sTracers = false; - public bool eTracers = false; - public bool cTracers = false; - public bool frostFlare = false; - public bool beeResist = false; - public bool uberBees = false; - public bool projRef = false; - public bool projRefRare = false; - public int projRefRareLifeRegenCounter = 0; - public bool nanotech = false; - public bool eQuiver = false; - public bool shadowMinions = false; - public bool tearMinions = false; - public bool alchFlask = false; - public bool community = false; - public bool fleshTotem = false; - public int fleshTotemCooldown = 0; - public bool bloodPact = false; - public bool bloodflareCore = false; - public bool coreOfTheBloodGod = false; - public bool elementalHeart = false; - public bool crownJewel = false; - public bool celestialJewel = false; - public bool astralArcanum = false; - public bool harpyRing = false; - public bool ironBoots = false; - public bool depthCharm = false; - public bool anechoicPlating = false; - public bool jellyfishNecklace = false; - public bool abyssalAmulet = false; - public bool lumenousAmulet = false; - public bool reaperToothNecklace = false; - public bool aquaticEmblem = false; - public bool darkSunRing = false; - public bool calamityRing = false; - public bool eArtifact = false; - public bool dArtifact = false; - public bool gArtifact = false; - public bool pArtifact = false; - public bool giantPearl = false; - public bool normalityRelocator = false; - public bool fabledTortoise = false; - public bool manaOverloader = false; - - //Armor Set - public bool victideSet = false; - public bool aeroSet = false; - public bool statigelSet = false; - public bool tarraSet = false; - public bool tarraMelee = false; - public bool tarraDefense = false; - public int tarraCooldown = 0; - public int tarraDefenseTime = 600; - public bool tarraMage = false; - public int tarraMageHealCooldown = 0; - public int tarraCrits = 0; - public bool tarraRanged = false; - public bool tarraThrowing = false; - public int tarraThrowingCrits = 0; - public int tarraThrowingCritTimer = 0; - public bool tarraSummon = false; - public bool bloodflareSet = false; - public bool bloodflareMelee = false; - public int bloodflareMeleeHits = 0; - public int bloodflareFrenzyTimer = 0; - public int bloodflareFrenzyCooldown = 0; - public bool bloodflareRanged = false; - public int bloodflareRangedCooldown = 0; - public bool bloodflareThrowing = false; - public bool bloodflareMage = false; - public int bloodflareMageCooldown = 0; - public bool bloodflareSummon = false; - public int bloodflareSummonTimer = 0; - public bool godSlayer = false; - public bool godSlayerDamage = false; - public bool godSlayerMage = false; - public bool godSlayerRanged = false; - public bool godSlayerThrowing = false; - public bool godSlayerSummon = false; - public float godSlayerDmg; - public bool godSlayerReflect = false; - public bool godSlayerCooldown = false; - public bool ataxiaBolt = false; - public bool ataxiaFire = false; - public bool ataxiaVolley = false; - public bool ataxiaBlaze = false; - public bool daedalusAbsorb = false; - public bool daedalusShard = false; - public bool reaverSpore = false; - public bool reaverDoubleTap = false; - public bool flamethrowerBoost = false; - public bool shadeRegen = false; - public bool shadowSpeed = false; - public bool dsSetBonus = false; - public bool auricBoost = false; - public bool daedalusReflect = false; - public bool daedalusSplit = false; - public bool reaverBlast = false; - public bool reaverBurst = false; - public bool astralStarRain = false; - public int astralStarRainCooldown = 0; - public float ataxiaDmg; - public bool ataxiaMage = false; - public bool ataxiaGeyser = false; - public float xerocDmg; - public bool xerocSet = false; - public bool silvaSet = false; - public bool silvaMelee = false; - public bool silvaRanged = false; - public bool silvaThrowing = false; - public bool silvaMage = false; - public bool silvaSummon = false; - public bool hasSilvaEffect = false; - public int silvaCountdown = 600; - public int silvaHitCounter = 0; - public bool auricSet = false; - public bool omegaBlueChestplate = false; - public bool omegaBlueSet = false; - public bool omegaBlueHentai = false; - public int omegaBlueCooldown = 0; - public bool molluskSet = false; - - //Debuff - public bool wDeath = false; - public bool lethalLavaBurn = false; - public bool aCrunch = false; - public bool hAttack = false; - public bool horror = false; - public bool irradiated = false; - public bool bFlames = false; - public bool aFlames = false; - public bool gsInferno = false; - public bool pFlames = false; - public bool hFlames = false; - public bool hInferno = false; - public bool gState = false; - public bool bBlood = false; - public bool eGravity = false; - public bool weakPetrification = false; - public bool vHex = false; - public bool eGrav = false; - public bool warped = false; - public bool marked = false; - public bool cDepth = false; - public bool fishAlert = false; - public bool bOut = false; - public bool clamity = false; - - //Buff - public bool trinketOfChiBuff = false; - public int chiBuffTimer = 0; - public bool corrEffigy = false; - public bool crimEffigy = false; - public bool rRage = false; - public bool tRegen = false; - public bool xRage = false; - public bool xWrath = false; - public bool graxDefense = false; - public bool sMeleeBoost = false; - public bool tFury = false; - public bool cadence = false; - public bool omniscience = false; - public bool zerg = false; - public bool zen = false; - public bool yPower = false; - public bool aWeapon = false; - public bool tScale = false; - public bool fabsolVodka = false; - public bool mushy = false; - public bool molten = false; - public bool shellBoost = false; - public bool cFreeze = false; - public bool invincible = false; - public bool shine = false; - public bool anechoicCoating = false; - public bool enraged = false; - public int revivifyTimer = 0; - 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; - public bool redWine = false; - public bool grapeBeer = false; - public bool moonshine = false; - public bool rum = false; - public bool whiskey = false; - public bool fireball = false; - public bool everclear = false; - public bool bloodyMary = false; - public bool tequila = false; - public bool caribbeanRum = false; - public bool cinnamonRoll = false; - public bool tequilaSunrise = false; - public bool margarita = false; - public bool starBeamRye = false; - public bool screwdriver = false; - public bool moscowMule = false; - public bool whiteWine = false; - public bool evergreenGin = false; - public bool tranquilityCandle = false; - public bool chaosCandle = false; - public bool purpleCandle = false; - public bool blueCandle = false; - public bool pinkCandle = false; - public int pinkCandleTimer = 60; - public bool yellowCandle = false; - public bool trippy = false; - public bool amidiasBlessing = false; - - //Minion - public bool glSword = false; - public bool mWorm = false; - public bool iClasper = false; - public bool herring = false; - public bool calamari = false; - public bool cEyes = false; - public bool cSlime = false; - public bool cSlime2 = false; - public bool bStar = false; - public bool aStar = false; - public bool SP = false; - public bool dCreeper = false; - public bool bClot = false; - public bool eAxe = false; - public bool SPG = false; - public bool aChicken = false; - public bool cLamp = false; - public bool pGuy = false; - public bool gDefense = false; - public bool gOffense = false; - public bool gHealer = false; - public bool cEnergy = false; - public bool sWaifu = false; - public bool dWaifu = false; - public bool cWaifu = false; - public bool bWaifu = false; - public bool slWaifu = false; - public bool fClump = false; - public bool rDevil = false; - public bool aValkyrie = false; - public bool sCrystal = false; - public bool sGod = false; - public bool sandnado = false; - public bool vUrchin = false; - public bool cSpirit = false; - public bool rOrb = false; - public bool dCrystal = false; - public bool sandWaifu = false; - public bool sandBoobWaifu = false; - public bool cloudWaifu = false; - public bool brimstoneWaifu = false; - public bool sirenWaifu = false; - public bool allWaifus = false; - public bool fungalClump = false; - public bool redDevil = false; - public bool valkyrie = false; - public bool slimeGod = false; - public bool urchin = false; - public bool chaosSpirit = false; - public bool reaverOrb = false; - public bool daedalusCrystal = false; - public int healCounter = 300; - public bool shellfish = false; - public bool hCrab = false; - - //Biome - public bool ZoneCalamity = false; - public bool ZoneAstral = false; - public bool ZoneSunkenSea = false; - public bool ZoneSulphur = false; - public bool ZoneAbyss = false; - public bool ZoneAbyssLayer1 = false; - public bool ZoneAbyssLayer2 = false; - public bool ZoneAbyssLayer3 = false; - public bool ZoneAbyssLayer4 = false; - public int abyssBreathCD; - - //Transformation - public bool abyssalDivingSuitPrevious; - public bool abyssalDivingSuit; - public bool abyssalDivingSuitHide; - public bool abyssalDivingSuitForce; - public bool abyssalDivingSuitPower; - public bool sirenBoobsPrevious; - public bool sirenBoobs; - public bool sirenBoobsHide; - public bool sirenBoobsForce; - public bool sirenBoobsPower; - public bool sirenBoobsAltPrevious; - public bool sirenBoobsAlt; - public bool sirenBoobsAltHide; - public bool sirenBoobsAltForce; - public bool sirenBoobsAltPower; - public bool snowmanPrevious; - public bool snowman; - public bool snowmanHide; - public bool snowmanForce; - public bool snowmanNoseless; - public bool snowmanPower; - - #endregion - - #region SavingAndLoading - public override void Initialize() - { - extraAccessoryML = false; - eCore = false; - mFruit = false; - bOrange = false; - eBerry = false; - dFruit = false; - pHeart = false; - cShard = false; - revJamDrop = false; - rageBoostOne = false; - rageBoostTwo = false; - rageBoostThree = false; - adrenalineBoostOne = false; - adrenalineBoostTwo = false; - adrenalineBoostThree = false; - drawBossHPBar = true; - shouldDrawSmallText = true; - } - - public override TagCompound Save() - { - var boost = new List(); - if (extraAccessoryML) boost.Add("extraAccessoryML"); - if (eCore) boost.Add("etherealCore"); - if (mFruit) boost.Add("miracleFruit"); - if (bOrange) boost.Add("bloodOrange"); - if (eBerry) boost.Add("elderBerry"); - if (dFruit) boost.Add("dragonFruit"); - if (pHeart) boost.Add("phantomHeart"); - if (cShard) boost.Add("cometShard"); - if (revJamDrop) boost.Add("revJam"); - if (rageBoostOne) boost.Add("rageOne"); - if (rageBoostTwo) boost.Add("rageTwo"); - if (rageBoostThree) boost.Add("rageThree"); - if (adrenalineBoostOne) boost.Add("adrenalineOne"); - if (adrenalineBoostTwo) boost.Add("adrenalineTwo"); - if (adrenalineBoostThree) boost.Add("adrenalineThree"); - if (drawBossHPBar) boost.Add("bossHPBar"); - if (shouldDrawSmallText) boost.Add("drawSmallText"); - - return new TagCompound - { - { - "boost", boost - }, - { - "stress", stress - }, - { - "adrenaline", adrenaline - }, - { - "sCalDeathCount", sCalDeathCount - }, - { - "sCalKillCount", sCalKillCount - }, - { - "meleeLevel", meleeLevel - }, - { - "exactMeleeLevel", exactMeleeLevel - }, - { - "rangedLevel", rangedLevel - }, - { - "exactRangedLevel", exactRangedLevel - }, - { - "magicLevel", magicLevel - }, - { - "exactMagicLevel", exactMagicLevel - }, - { - "summonLevel", summonLevel - }, - { - "exactSummonLevel", exactSummonLevel - }, - { - "rogueLevel", rogueLevel - }, - { - "exactRogueLevel", exactRogueLevel - }, - { - "deathCount", deathCount - } - }; - } - - public override void Load(TagCompound tag) - { - var boost = tag.GetList("boost"); - extraAccessoryML = boost.Contains("extraAccessoryML"); - eCore = boost.Contains("etherealCore"); - mFruit = boost.Contains("miracleFruit"); - bOrange = boost.Contains("bloodOrange"); - eBerry = boost.Contains("elderBerry"); - dFruit = boost.Contains("dragonFruit"); - pHeart = boost.Contains("phantomHeart"); - cShard = boost.Contains("cometShard"); - revJamDrop = boost.Contains("revJam"); - rageBoostOne = boost.Contains("rageOne"); - rageBoostTwo = boost.Contains("rageTwo"); - rageBoostThree = boost.Contains("rageThree"); - adrenalineBoostOne = boost.Contains("adrenalineOne"); - adrenalineBoostTwo = boost.Contains("adrenalineTwo"); - adrenalineBoostThree = boost.Contains("adrenalineThree"); - drawBossHPBar = boost.Contains("bossHPBar"); - shouldDrawSmallText = boost.Contains("drawSmallText"); - - stress = tag.GetInt("stress"); - adrenaline = tag.GetInt("adrenaline"); - sCalDeathCount = tag.GetInt("sCalDeathCount"); - sCalKillCount = tag.GetInt("sCalKillCount"); - deathCount = tag.GetInt("deathCount"); - - meleeLevel = tag.GetInt("meleeLevel"); - rangedLevel = tag.GetInt("rangedLevel"); - magicLevel = tag.GetInt("magicLevel"); - summonLevel = tag.GetInt("summonLevel"); - rogueLevel = tag.GetInt("rogueLevel"); - exactMeleeLevel = tag.GetInt("exactMeleeLevel"); - exactRangedLevel = tag.GetInt("exactRangedLevel"); - exactMagicLevel = tag.GetInt("exactMagicLevel"); - exactSummonLevel = tag.GetInt("exactSummonLevel"); - exactRogueLevel = tag.GetInt("exactRogueLevel"); - } - - public override void LoadLegacy(BinaryReader reader) - { - int loadVersion = reader.ReadInt32(); - stress = reader.ReadInt32(); - adrenaline = reader.ReadInt32(); - sCalDeathCount = reader.ReadInt32(); - sCalKillCount = reader.ReadInt32(); - deathCount = reader.ReadInt32(); - - meleeLevel = reader.ReadInt32(); - rangedLevel = reader.ReadInt32(); - magicLevel = reader.ReadInt32(); - summonLevel = reader.ReadInt32(); - rogueLevel = reader.ReadInt32(); - exactMeleeLevel = reader.ReadInt32(); - exactRangedLevel = reader.ReadInt32(); - exactMagicLevel = reader.ReadInt32(); - exactSummonLevel = reader.ReadInt32(); - exactRogueLevel = reader.ReadInt32(); - - if (loadVersion == 0) - { - BitsByte flags = reader.ReadByte(); - extraAccessoryML = flags[0]; - eCore = flags[1]; - mFruit = flags[2]; - bOrange = flags[3]; - eBerry = flags[4]; - dFruit = flags[5]; - pHeart = flags[6]; - cShard = flags[7]; - - BitsByte flags2 = reader.ReadByte(); - revJamDrop = flags2[0]; - rageBoostOne = flags2[1]; - rageBoostTwo = flags2[2]; - rageBoostThree = flags2[3]; - adrenalineBoostOne = flags2[4]; - adrenalineBoostTwo = flags2[5]; - adrenalineBoostThree = flags2[6]; - drawBossHPBar = flags2[7]; - - BitsByte flags3 = reader.ReadByte(); - shouldDrawSmallText = flags3[0]; - } - else - { - ErrorLogger.Log("CalamityMod: Unknown loadVersion: " + loadVersion); - } - } - #endregion - - #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; - - sirenWaterBuff = false; - sirenIce = false; - sirenIceCooldown = false; - - draedonsHeart = false; - draedonsStressGain = false; - - afflicted = false; - affliction = false; - - fasterMeleeLevel = false; - fasterRangedLevel = false; - fasterMagicLevel = false; - fasterSummonLevel = false; - fasterRogueLevel = false; - - dodgeScarf = false; - scarfCooldown = false; - - elysianAegis = false; - - nCore = false; - - godSlayer = false; - godSlayerDamage = false; - godSlayerMage = false; - godSlayerRanged = false; - godSlayerThrowing = false; - godSlayerSummon = false; - godSlayerReflect = false; - godSlayerCooldown = false; - - silvaSet = false; - silvaMelee = false; - silvaRanged = false; - silvaThrowing = false; - silvaMage = false; - silvaSummon = false; - - auricSet = false; - auricBoost = false; - - omegaBlueChestplate = false; - omegaBlueSet = false; - omegaBlueHentai = false; - - molluskSet = false; - - ataxiaBolt = false; - ataxiaGeyser = false; - ataxiaFire = false; - ataxiaVolley = false; - ataxiaBlaze = false; - ataxiaMage = false; - - shadeRegen = false; - - flamethrowerBoost = false; - - 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; - absorber = false; - aAmpoule = false; - pAmulet = false; - fBarrier = false; - aBrain = false; - frostFlare = false; - beeResist = false; - uberBees = false; - projRef = false; - projRefRare = false; - nanotech = false; - eQuiver = false; - cryogenSoul = false; - yInsignia = false; - eGauntlet = false; - eTalisman = false; - statisBeltOfCurses = false; - heartOfDarkness = false; - shadowMinions = false; - tearMinions = false; - alchFlask = false; - community = false; - stressPills = false; - laudanum = false; - fleshTotem = false; - bloodPact = false; - bloodflareCore = false; - coreOfTheBloodGod = false; - elementalHeart = false; - crownJewel = false; - celestialJewel = false; - astralArcanum = false; - harpyRing = false; - darkSunRing = false; - calamityRing = false; - eArtifact = false; - dArtifact = false; - gArtifact = false; - pArtifact = false; - giantPearl = false; - normalityRelocator = false; - fabledTortoise = false; - manaOverloader = false; - lol = false; - raiderTalisman = false; - sGenerator = false; - sDefense = false; - sRegen = false; - sPower = false; - IBoots = false; - elysianFire = false; - sTracers = false; - eTracers = false; - cTracers = false; - - daedalusReflect = false; - daedalusSplit = false; - daedalusAbsorb = false; - daedalusShard = false; - - reaverSpore = false; - reaverDoubleTap = false; - reaverBlast = false; - reaverBurst = false; - - ironBoots = false; - depthCharm = false; - anechoicPlating = false; - jellyfishNecklace = false; - abyssalAmulet = false; - lumenousAmulet = false; - reaperToothNecklace = false; - aquaticEmblem = false; - - astralStarRain = false; - - victideSet = false; - - aeroSet = false; - - statigelSet = false; - - tarraSet = false; - tarraMelee = false; - tarraMage = false; - tarraRanged = false; - tarraThrowing = false; - tarraSummon = false; - - bloodflareSet = false; - bloodflareMelee = false; - bloodflareRanged = false; - bloodflareThrowing = false; - bloodflareMage = false; - bloodflareSummon = false; - - xerocSet = false; - - weakPetrification = false; - - wDeath = false; - lethalLavaBurn = false; - aCrunch = false; - hAttack = false; - horror = false; - irradiated = false; - bFlames = false; - aFlames = false; - gsInferno = false; - pFlames = false; - hFlames = false; - hInferno = false; - gState = false; - bBlood = false; - eGravity = false; - vHex = false; - eGrav = false; - warped = false; - marked = false; - cDepth = false; - fishAlert = false; - bOut = false; - clamity = false; - enraged = false; - snowmanNoseless = false; - - trinketOfChiBuff = false; - corrEffigy = false; - crimEffigy = false; - rRage = false; - xRage = false; - xWrath = false; - graxDefense = false; - sMeleeBoost = false; - tFury = false; - cadence = false; - 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; - 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; - moonshine = false; - rum = false; - whiskey = false; - fireball = false; - everclear = false; - bloodyMary = false; - tequila = false; - caribbeanRum = false; - cinnamonRoll = false; - tequilaSunrise = false; - margarita = false; - starBeamRye = false; - screwdriver = false; - moscowMule = false; - whiteWine = false; - evergreenGin = false; - - tranquilityCandle = false; - chaosCandle = false; - purpleCandle = false; - blueCandle = false; - pinkCandle = false; - yellowCandle = false; - - glSword = false; - mWorm = false; - iClasper = false; - herring = false; - calamari = false; - cEyes = false; - cSlime = false; - cSlime2 = false; - bStar = false; - aStar = false; - SP = false; - dCreeper = false; - bClot = false; - eAxe = false; - SPG = false; - aChicken = false; - cLamp = false; - pGuy = false; - cEnergy = false; - gDefense = false; - gOffense = false; - gHealer = false; - sWaifu = false; - dWaifu = false; - cWaifu = false; - bWaifu = false; - slWaifu = false; - fClump = false; - rDevil = false; - aValkyrie = false; - sCrystal = false; - sGod = false; - sandnado = false; - vUrchin = false; - cSpirit = false; - rOrb = false; - dCrystal = false; - sandWaifu = false; - sandBoobWaifu = false; - cloudWaifu = false; - brimstoneWaifu = false; - sirenWaifu = false; - allWaifus = false; - fungalClump = false; - redDevil = false; - valkyrie = false; - slimeGod = false; - urchin = false; - chaosSpirit = false; - reaverOrb = false; - daedalusCrystal = false; - shellfish = false; - hCrab = false; - - abyssalDivingSuitPrevious = abyssalDivingSuit; - abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; - - sirenBoobsPrevious = sirenBoobs; - sirenBoobs = sirenBoobsHide = sirenBoobsForce = sirenBoobsPower = false; - sirenBoobsAltPrevious = sirenBoobsAlt; - sirenBoobsAlt = sirenBoobsAltHide = sirenBoobsAltForce = sirenBoobsAltPower = false; - - snowmanPrevious = snowman; - snowman = snowmanHide = snowmanForce = snowmanPower = false; - - rageMode = false; - adrenalineMode = false; - } - #endregion - - #region UpdateDead - public override void UpdateDead() - { - #region Debuffs - //distanceFromBoss = -1; - stress = 0; - adrenaline = 0; - adrenalineMaxTimer = 300; - adrenalineDmgDown = 600; - adrenalineDmgMult = 1f; - raiderStack = 0; - fleshTotemCooldown = 0; - astralStarRainCooldown = 0; - bloodflareMageCooldown = 0; - tarraMageHealCooldown = 0; - ataraxiaDamageBoost = 0f; - bossRushImmunityFrameCurseTimer = 0; - aBulwarkRareMeleeBoostTimer = 0; - ataraxiaDamageBoostCooldown = 0; - ataraxiaDamageBoostCancelTimer = 1200; - theBeeDamage = 0; - wDeath = false; - lethalLavaBurn = false; - aCrunch = false; - hAttack = false; - horror = false; - irradiated = false; - bFlames = false; - aFlames = false; - gsInferno = false; - pFlames = false; - hFlames = false; - hInferno = false; - gState = false; - bBlood = false; - eGravity = false; - vHex = false; - eGrav = false; - warped = false; - marked = false; - cDepth = false; - fishAlert = false; - bOut = false; - clamity = false; - snowmanNoseless = false; - scarfCooldown = false; - godSlayerCooldown = false; - abyssalDivingSuitCooldown = false; - abyssalDivingSuitPlateHits = 0; - sirenIceCooldown = false; - #endregion - - #region Buffs - sDefense = false; - sRegen = false; - sPower = false; - onyxExcavator = false; - angryDog = false; - fab = false; - crysthamyr = false; - abyssalDivingSuitPlates = false; - sirenWaterBuff = false; - sirenIce = false; - trinketOfChiBuff = false; - chiBuffTimer = 0; - corrEffigy = false; - crimEffigy = false; - rRage = false; - xRage = false; - xWrath = false; - graxDefense = false; - sMeleeBoost = false; - tFury = false; - cadence = false; - 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; - fabsolVodka = false; - invincible = false; - shine = false; - anechoicCoating = false; - mushy = false; - molten = false; - enraged = false; - shellBoost = false; - cFreeze = false; - tRegen = false; - rageMode = false; - adrenalineMode = false; - vodka = false; - redWine = false; - grapeBeer = false; - moonshine = false; - rum = false; - whiskey = false; - fireball = false; - everclear = false; - bloodyMary = false; - tequila = false; - caribbeanRum = false; - cinnamonRoll = false; - tequilaSunrise = false; - margarita = false; - starBeamRye = false; - screwdriver = false; - moscowMule = false; - whiteWine = false; - evergreenGin = false; - tranquilityCandle = false; - chaosCandle = false; - purpleCandle = false; - blueCandle = false; - pinkCandle = false; - pinkCandleTimer = 60; - yellowCandle = false; - trippy = false; - amidiasBlessing = false; - revivifyTimer = 0; - healCounter = 300; - #endregion - - #region Armorbonuses - flamethrowerBoost = false; - shadowSpeed = false; - godSlayer = false; - godSlayerDamage = false; - godSlayerMage = false; - godSlayerRanged = false; - godSlayerThrowing = false; - godSlayerSummon = false; - godSlayerReflect = false; - auricBoost = false; - silvaSet = false; - silvaMelee = false; - silvaRanged = false; - silvaThrowing = false; - silvaMage = false; - silvaSummon = false; - hasSilvaEffect = false; - silvaCountdown = 600; - silvaHitCounter = 0; - auricSet = false; - omegaBlueChestplate = false; - omegaBlueSet = false; - omegaBlueCooldown = 0; - molluskSet = false; - daedalusReflect = false; - daedalusSplit = false; - daedalusAbsorb = false; - daedalusShard = false; - reaverSpore = false; - reaverDoubleTap = false; - shadeRegen = false; - dsSetBonus = false; - reaverBlast = false; - reaverBurst = false; - astralStarRain = false; - ataxiaMage = false; - ataxiaBolt = false; - ataxiaGeyser = false; - ataxiaFire = false; - ataxiaVolley = false; - ataxiaBlaze = false; - victideSet = false; - aeroSet = false; - statigelSet = false; - tarraSet = false; - tarraMelee = false; - tarraMage = false; - tarraRanged = false; - tarraThrowing = false; - tarraThrowingCrits = 0; - tarraThrowingCritTimer = 0; - tarraSummon = false; - bloodflareSet = false; - bloodflareMelee = false; - bloodflareMeleeHits = 0; - bloodflareFrenzyTimer = 0; - bloodflareFrenzyCooldown = 0; - bloodflareRanged = false; - bloodflareRangedCooldown = 0; - bloodflareThrowing = false; - bloodflareMage = false; - bloodflareSummon = false; - bloodflareSummonTimer = 0; - xerocSet = false; - IBoots = false; - elysianFire = false; - elysianAegis = false; - elysianGuard = false; - #endregion - - if (CalamityWorld.bossRushActive) - { - if (!CalamityGlobalNPC.AnyLivingPlayers()) - { - CalamityWorld.bossRushActive = false; - CalamityWorld.bossRushStage = 0; - 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(); - } - for (int doom = 0; doom < 200; doom++) - { - if (Main.npc[doom].active && Main.npc[doom].boss) - { - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - } - } - if (CalamityWorld.armageddon && !areThereAnyDamnBosses) - { - player.respawnTimer -= 5; - } - else if (player.respawnTimer > 300 && Main.expertMode) //600 normal 900 expert - { - player.respawnTimer--; - } - } - #endregion - - #region BiomeStuff - public override void UpdateBiomeVisuals() - { - bool useNebula = NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")); - player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHead", useNebula); - - bool useNebulaS = NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")); - player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHeadS", useNebulaS); - - bool useBrimstone = NPC.AnyNPCs(mod.NPCType("CalamitasRun3")); - player.ManageSpecialBiomeVisuals("CalamityMod:CalamitasRun3", useBrimstone); - - bool usePlague = NPC.AnyNPCs(mod.NPCType("PlaguebringerGoliath")); - player.ManageSpecialBiomeVisuals("CalamityMod:PlaguebringerGoliath", usePlague); - - Point point = player.Center.ToTileCoordinates(); - bool aboveGround = point.Y > Main.maxTilesY - 320; - bool overworld = player.ZoneOverworldHeight && (point.X < 380 || point.X > Main.maxTilesX - 380); - bool useFire = NPC.AnyNPCs(mod.NPCType("Yharon")); - player.ManageSpecialBiomeVisuals("CalamityMod:Yharon", useFire); - player.ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (useFire || trippy || - (aboveGround || ((double)point.Y < Main.worldSurface && player.ZoneDesert && !overworld && !Main.raining && !Filters.Scene["Sandstorm"].IsActive())))); - - bool useWater = NPC.AnyNPCs(mod.NPCType("Leviathan")); - player.ManageSpecialBiomeVisuals("CalamityMod:Leviathan", useWater); - - bool useHoly = NPC.AnyNPCs(mod.NPCType("Providence")); - player.ManageSpecialBiomeVisuals("CalamityMod:Providence", useHoly); - - bool useSBrimstone = NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); - player.ManageSpecialBiomeVisuals("CalamityMod:SupremeCalamitas", useSBrimstone); - - bool inAstral = ZoneAstral; - player.ManageSpecialBiomeVisuals("CalamityMod:Astral", inAstral); - } - - public override void UpdateBiomes() - { - Point point = player.Center.ToTileCoordinates(); - ZoneCalamity = CalamityWorld.calamityTiles > 50; - ZoneAstral = !player.ZoneDungeon && (CalamityWorld.astralTiles > 950 || (player.ZoneSnow && CalamityWorld.astralTiles > 300)); - ZoneSunkenSea = CalamityWorld.sunkenSeaTiles > 150; - - 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 sulphurPosX = false; - bool abyssPosY = (point.Y <= abyssChasmY); - if (CalamityWorld.abyssSide) - { - if (point.X < 380) - { - sulphurPosX = true; - } - if (point.X < abyssChasmX + 80) - { - abyssPosX = true; - } - } - else - { - if (point.X > Main.maxTilesX - 380) - { - sulphurPosX = true; - } - if (point.X > abyssChasmX - 80) - { - abyssPosX = true; - } - } - - ZoneAbyss = (((double)point.Y > (Main.rockLayer - (double)y * 0.05)) && - !player.lavaWet && - !player.honeyWet && - abyssPosY && - abyssPosX); - - ZoneAbyssLayer1 = ZoneAbyss && - (double)point.Y <= (Main.rockLayer + (double)y * 0.03); - - ZoneAbyssLayer2 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + (double)y * 0.03) && - (double)point.Y <= (Main.rockLayer + (double)y * 0.14); - - ZoneAbyssLayer3 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + (double)y * 0.14) && - (double)point.Y <= (Main.rockLayer + (double)y * 0.26); - - ZoneAbyssLayer4 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + (double)y * 0.26); - - ZoneSulphur = (CalamityWorld.sulphurTiles > 30 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; - } - - public override bool CustomBiomesMatch(Player other) - { - CalamityPlayer modOther = other.GetModPlayer(mod); - return ZoneCalamity == modOther.ZoneCalamity || ZoneAstral == modOther.ZoneAstral || ZoneAbyss == modOther.ZoneAbyss || - ZoneAbyssLayer1 == modOther.ZoneAbyssLayer1 || ZoneAbyssLayer2 == modOther.ZoneAbyssLayer2 || - ZoneAbyssLayer3 == modOther.ZoneAbyssLayer3 || ZoneAbyssLayer4 == modOther.ZoneAbyssLayer4 || - ZoneSulphur == modOther.ZoneSulphur || ZoneSunkenSea == modOther.ZoneSunkenSea; - } - - public override void CopyCustomBiomesTo(Player other) - { - CalamityPlayer modOther = other.GetModPlayer(mod); - modOther.ZoneCalamity = ZoneCalamity; - modOther.ZoneAstral = ZoneAstral; - modOther.ZoneSulphur = ZoneSulphur; - modOther.ZoneSunkenSea = ZoneSunkenSea; - modOther.ZoneAbyss = ZoneAbyss; - modOther.ZoneAbyssLayer1 = ZoneAbyssLayer1; - modOther.ZoneAbyssLayer2 = ZoneAbyssLayer2; - modOther.ZoneAbyssLayer3 = ZoneAbyssLayer3; - modOther.ZoneAbyssLayer4 = ZoneAbyssLayer4; - } - - public override void SendCustomBiomes(BinaryWriter writer) - { - BitsByte flags = new BitsByte(); - flags[0] = ZoneCalamity; - flags[1] = ZoneAstral; - flags[2] = ZoneAbyss; - flags[3] = ZoneAbyssLayer1; - flags[4] = ZoneAbyssLayer2; - flags[5] = ZoneAbyssLayer3; - flags[6] = ZoneAbyssLayer4; - flags[7] = ZoneSulphur; - - BitsByte flags2 = new BitsByte(); - flags2[0] = ZoneSunkenSea; - - writer.Write(flags); - writer.Write(flags2); - } - - public override void ReceiveCustomBiomes(BinaryReader reader) - { - BitsByte flags = reader.ReadByte(); - ZoneCalamity = flags[0]; - ZoneAstral = flags[1]; - ZoneAbyss = flags[2]; - ZoneAbyssLayer1 = flags[3]; - ZoneAbyssLayer2 = flags[4]; - ZoneAbyssLayer3 = flags[5]; - ZoneAbyssLayer4 = flags[6]; - ZoneSulphur = flags[7]; - - BitsByte flags2 = reader.ReadByte(); - ZoneSunkenSea = flags2[0]; - } - - public override Texture2D GetMapBackgroundImage() - { - if (ZoneSulphur) - { - return mod.GetTexture("Backgrounds/MapBackgrounds/SulphurBG"); - } - if (ZoneAstral) - { - return mod.GetTexture("Backgrounds/MapBackgrounds/AstralBG"); - } - return null; - } - #endregion - - #region InventoryStartup - public override void SetupStartInventory(IList items, bool mediumcoreDeath) - { - if (!mediumcoreDeath) - { - player.inventory[9].SetDefaults(mod.ItemType("Revenge")); - player.inventory[8].SetDefaults(mod.ItemType("IronHeart")); - player.inventory[7].SetDefaults(mod.ItemType("StarterBag")); - } - } - #endregion - - #region LifeRegen - public override void UpdateBadLifeRegen() - { - Point point = player.Center.ToTileCoordinates(); - #region FirstDebuffs - if (wDeath) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.statDefense -= 50; - player.meleeDamage -= 0.1f; - player.rangedDamage -= 0.1f; - player.magicDamage -= 0.1f; - player.minionDamage -= 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage -= 0.1f; - } - if (bFlames || aFlames) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 16; - } - if (gsInferno || (ZoneCalamity && player.lavaWet)) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 30; - } - if (ZoneSulphur && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && !aquaticScourgeLore) - { - player.AddBuff(BuffID.Poisoned, 2, true); - pissWaterBoost++; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - if (pissWaterBoost > 1800) - { - player.lifeRegen -= 6; - } - else if (pissWaterBoost > 1440) - { - player.lifeRegen -= 4; - } - else if (pissWaterBoost > 1080) - { - player.lifeRegen -= 3; - } - else if (pissWaterBoost > 720) - { - player.lifeRegen -= 2; - } - else if (pissWaterBoost > 360) - { - player.lifeRegen -= 1; - } - } - else - { - pissWaterBoost = 0; - } - if (hFlames) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 20; - } - if (pFlames) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 20; - player.blind = true; - player.statDefense -= 8; - player.moveSpeed -= 0.15f; - } - if (bBlood) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 8; - player.blind = true; - player.statDefense -= 3; - player.moveSpeed += 0.2f; - player.meleeDamage += 0.05f; - player.rangedDamage -= 0.1f; - player.magicDamage -= 0.1f; - } - if (horror) - { - player.blind = true; - player.statDefense -= 15; - player.moveSpeed -= 0.15f; - } - if (aCrunch) - { - player.statDefense /= 3; - player.endurance *= 0.33f; - } - if (vHex) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 16; - player.blind = true; - player.statDefense -= 30; - player.moveSpeed -= 0.1f; - if (player.wingTimeMax <= 0) - { - player.wingTimeMax = 0; - } - player.wingTimeMax /= 2; - } - if (cDepth) - { - if (player.statDefense > 0) - { - int depthDamage = depthCharm ? 9 : 18; - int subtractDefense = (int)((double)player.statDefense * 0.05); //240 defense = 0 damage taken with depth charm - int calcDepthDamage = depthDamage - subtractDefense; - if (calcDepthDamage < 0) - { - calcDepthDamage = 0; - } - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= calcDepthDamage; - } - } - #endregion - #region Buffs - if (tRegen) - { - player.lifeRegen += 3; - } - if (sRegen) - { - player.lifeRegen += 2; - } - if (tarraSet) - { - player.calmed = (tarraMelee ? false : true); - player.lifeMagnet = true; - } - if (aChicken) - { - player.lifeRegen += 1; - player.statDefense += 5; - player.moveSpeed += 0.1f; - } - if (cadence) - { - if (player.FindBuffIndex(BuffID.Regeneration) > -1) { player.ClearBuff(BuffID.Regeneration); } - if (player.FindBuffIndex(BuffID.Lifeforce) > -1) { player.ClearBuff(BuffID.Lifeforce); } - player.discount = true; - player.lifeMagnet = true; - player.calmed = true; - player.loveStruck = true; - player.lifeRegen += 5; - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 25; - } - if (omniscience) - { - player.detectCreature = true; - player.dangerSense = true; - player.findTreasure = true; - } - if (aWeapon) - { - player.moveSpeed += 0.15f; - } - if (mushy) - { - player.statDefense += 5; - player.lifeRegen += 1; - } - if (molten) - { - player.resistCold = true; - } - if (shellBoost) - { - player.moveSpeed += 0.9f; - } - if (celestialJewel || astralArcanum) - { - bool lesserEffect = false; - for (int l = 0; l < 22; l++) - { - int hasBuff = player.buffType[l]; - bool shouldAffect = CalamityMod.alcoholList.Contains(hasBuff); - if (shouldAffect) - { - lesserEffect = true; - } - } - if (lesserEffect) - { - player.lifeRegen += 1; - player.statDefense += 20; - } - else - { - if (player.lifeRegen < 0) - { - if (player.lifeRegenTime < 1800) - { - player.lifeRegenTime = 1800; - } - player.lifeRegen += 4; - player.statDefense += 20; - } - else - { - player.lifeRegen += 2; - } - } - } - else if (crownJewel) - { - bool lesserEffect = false; - for (int l = 0; l < 22; l++) - { - int hasBuff = player.buffType[l]; - bool shouldAffect = CalamityMod.alcoholList.Contains(hasBuff); - if (shouldAffect) - { - lesserEffect = true; - } - } - if (lesserEffect) - { - player.statDefense += 10; - } - else - { - if (player.lifeRegen < 0) - { - if (player.lifeRegenTime < 1800) - { - player.lifeRegenTime = 1800; - } - player.lifeRegen += 2; - player.statDefense += 10; - } - else - { - player.lifeRegen += 1; - } - } - } - if (permafrostsConcoction) - { - if (player.statLife < player.statLifeMax2 / 2) - player.lifeRegen++; - if (player.statLife < player.statLifeMax2 / 4) - player.lifeRegen++; - if (player.statLife < player.statLifeMax2 / 10) - player.lifeRegen += 2; - if (player.poisoned || player.onFire || bFlames) - player.lifeRegen += 4; - } - if (CalamityCollision.HotWetCollision(player.position, player.width, player.height) || (ZoneAbyssLayer4 && point.Y > Main.maxTilesY - 300) || ZoneSunkenSea) - { - if (player.lifeRegen < 0) - { - player.lifeRegen += 2; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - } - player.lifeRegenTime += 1; - player.lifeRegen += 1; - } - #endregion - #region LastDebuffs - if (omegaBlueChestplate) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - - if (player.lifeRegenCount > 0) - player.lifeRegenCount = 0; - } - if (Config.LethalLava) - { - if (Main.myPlayer == player.whoAmI) - { - if (Collision.LavaCollision(player.position, player.width, (player.waterWalk ? (player.height - 6) : player.height))) - { - if (player.lavaImmune && !player.immune) - { - if (player.lavaTime > 0) - { - player.lavaTime--; - } - } - if (player.lavaTime <= 0) - { - player.AddBuff(mod.BuffType("LethalLavaBurn"), 2, true); - } - } - } - 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++; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - if (hInfernoBoost > 240) - { - player.lifeRegen -= 192; - } - else if (hInfernoBoost > 180) - { - player.lifeRegen -= 96; - } - else if (hInfernoBoost > 120) - { - player.lifeRegen -= 48; - } - else if (hInfernoBoost > 60) - { - player.lifeRegen -= 24; - } - else if (hInfernoBoost > 0) - { - player.lifeRegen -= 12; - } - } - else - { - hInfernoBoost = 0; - } - if (gState) - { - player.statDefense /= 2; - player.velocity.Y = 0f; - player.velocity.X = 0f; - } - if (eGravity) - { - player.velocity.X *= 0.99f; - if (player.wingTimeMax < 0) - { - player.wingTimeMax = 0; - } - player.wingTimeMax /= 4; - if (player.wingTimeMax > 400) - { - player.wingTimeMax = 100; - } - } - if (eGrav) - { - player.velocity.X *= 0.99f; - if (player.wingTimeMax < 0) - { - player.wingTimeMax = 0; - } - player.wingTimeMax /= 3; - if (player.wingTimeMax > 400) - { - player.wingTimeMax = 200; - } - } - if (warped) - { - player.velocity.X *= 0.99f; - } - if (molluskSet) - { - player.velocity.X *= 0.985f; - } - if ((warped || caribbeanRum) && !player.slowFall) - { - player.velocity.Y *= 1.01f; - } - 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 - } - - #region UpdateLifeRegen - public override void UpdateLifeRegen() - { - if (!player.shinyStone) - { - int lifeRegenTimeMaxBoost = (areThereAnyDamnBosses ? 450 : 1800); - int lifeRegenMaxBoost = (areThereAnyDamnBosses ? 1 : 4); - float lifeRegenLifeRegenTimeMaxBoost = (areThereAnyDamnBosses ? 8f : 30f); - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - if (shadeRegen) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - { - 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) - { - 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; - } - } - } - else if (cFreeze) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - { - 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) - { - 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; - } - } - } - else if (draedonsHeart) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - { - 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) - { - 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; - } - } - } - } - } - } - #endregion - #endregion - - #region HotKeys - public override void ProcessTriggers(TriggersSet triggersSet) - { - if (CalamityMod.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == player.whoAmI) - { - Vector2 teleportLocation; - teleportLocation.X = (float)Main.mouseX + Main.screenPosition.X; - if (player.gravDir == 1f) - { - teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; - } - else - { - teleportLocation.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; - } - teleportLocation.X -= (float)(player.width / 2); - if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) - { - int x = (int)(teleportLocation.X / 16f); - int y = (int)(teleportLocation.Y / 16f); - if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) - { - player.Teleport(teleportLocation, 4, 0); - NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); - if (player.chaosState) - { - player.statLife -= player.statLifeMax2 / 4; - 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); - } - } - } - if (CalamityMod.BossBarToggleHotKey.JustPressed) - { - if (drawBossHPBar) - { - drawBossHPBar = false; - } - else - { - drawBossHPBar = true; - } - } - if (CalamityMod.BossBarToggleSmallTextHotKey.JustPressed) - { - if (shouldDrawSmallText) - { - shouldDrawSmallText = false; - } - else - { - shouldDrawSmallText = true; - } - } - if (CalamityMod.TarraHotKey.JustPressed) - { - if (tarraMelee && tarraCooldown <= 0) - { - tarraDefense = true; - } - if (bloodflareRanged && bloodflareRangedCooldown <= 0) - { - bloodflareRangedCooldown = 1800; - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); - for (int num502 = 0; num502 < 64; num502++) - { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 60, 0f, 0f, 0, default(Color), 1f); - Main.dust[dust].velocity *= 3f; - Main.dust[dust].scale *= 1.15f; - } - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int damage = 800; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 8; i++) - { - float ai1 = (Main.rand.NextFloat() + 0.5f); - float randomSpeed = (float)Main.rand.Next(1, 7); - float randomSpeed2 = (float)Main.rand.Next(1, 7); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, mod.ProjectileType("BloodflareSoul"), damage, 0f, player.whoAmI, 0f, ai1); - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, mod.ProjectileType("BloodflareSoul"), damage, 0f, player.whoAmI, 0f, ai1); - } - } - } - if (omegaBlueSet && omegaBlueCooldown <= 0) - { - omegaBlueCooldown = 1800; - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); - for (int i = 0; i < 66; i++) - { - int d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); - Main.dust[d].noGravity = true; - Main.dust[d].noLight = true; - Main.dust[d].fadeIn = 1f; - Main.dust[d].velocity *= 6.6f; - } - } - if (dsSetBonus) - { - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); - for (int num502 = 0; num502 < 36; num502++) - { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default(Color), 1f); - Main.dust[dust].velocity *= 3f; - Main.dust[dust].scale *= 1.15f; - } - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - if (player.whoAmI == Main.myPlayer) - { - player.AddBuff(mod.BuffType("Enraged"), 600, false); - } - if (Main.netMode != 1) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= 3000f) - { - nPC.AddBuff(mod.BuffType("Enraged"), 600, false); - } - } - } - } - } - if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum) - { - AstralArcanumUI.Toggle(); - } - if (CalamityMod.AstralTeleportHotKey.JustPressed) - { - if (celestialJewel) - { - if (Main.netMode == 0) - { - player.TeleportationPotion(); - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 6); - } - else if (Main.netMode == 1 && player.whoAmI == Main.myPlayer) - { - NetMessage.SendData(73, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - } - if (CalamityMod.AegisHotKey.JustPressed) - { - if (elysianAegis && !player.mount.Active) - { - elysianGuard = !elysianGuard; - } - } - if (CalamityMod.RageHotKey.JustPressed) - { - if (stress == stressMax && !rageMode) - { - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); - for (int num502 = 0; num502 < 64; num502++) - { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default(Color), 1f); - Main.dust[dust].velocity *= 3f; - Main.dust[dust].scale *= 1.15f; - } - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - player.AddBuff(mod.BuffType("RageMode"), 300); - } - } - if (CalamityMod.AdrenalineHotKey.JustPressed) - { - if (adrenaline == adrenalineMax && !adrenalineMode) - { - Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); - for (int num502 = 0; num502 < 64; num502++) - { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 206, 0f, 0f, 0, default(Color), 1f); - Main.dust[dust].velocity *= 3f; - Main.dust[dust].scale *= 2f; - } - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 206, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - player.AddBuff(mod.BuffType("AdrenalineMode"), 300); - } - } - } - #endregion - - #region TeleportMethods - public void HandleTeleport(int teleportType, bool forceHandle = false, int whoAmI = 0) - { - bool syncData = forceHandle || Main.netMode == 0; - if (syncData) - { - TeleportPlayer(teleportType, forceHandle, whoAmI); - } - else - { - SyncTeleport(teleportType); - } - } - - public static void TeleportPlayer(int teleportType, bool syncData = false, int whoAmI = 0) - { - Player player; - if (!syncData) - { - player = Main.LocalPlayer; - } - else - { - player = Main.player[whoAmI]; - } - switch (teleportType) - { - case 0: UnderworldTeleport(player, syncData); break; - case 1: DungeonTeleport(player, syncData); break; - case 2: JungleTeleport(player, syncData); break; - default: break; - } - } - - public void SyncTeleport(int teleportType) - { - ModPacket netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.TeleportPlayer); - netMessage.Write(teleportType); - netMessage.Send(); - } - - public static void UnderworldTeleport(Player player, bool syncData = false) - { - int teleportStartX = 100; - int teleportRangeX = Main.maxTilesX - 200; - int teleportStartY = Main.maxTilesY - 200; - int teleportRangeY = 50; - bool flag = false; - int num = 0; - int num2 = 0; - int num3 = 0; - int width = player.width; - Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - while (!flag && num < 1000) - { - num++; - num2 = teleportStartX + Main.rand.Next(teleportRangeX); - num3 = teleportStartY + Main.rand.Next(teleportRangeY); - vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - if (!Collision.SolidCollision(vector, width, player.height)) - { - if (Main.tile[num2, num3] == null) - { - Main.tile[num2, num3] = new Tile(); - } - int i = 0; - while (i < 100) - { - if (Main.tile[num2, num3 + i] == null) - { - Main.tile[num2, num3 + i] = new Tile(); - } - Tile tile = Main.tile[num2, num3 + i]; - vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height); - if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X) - { - bool arg_1FE_0 = vector2.Y == vector.Y; - } - if (arg_1FF_0) - { - i++; - } - else - { - if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.type]) - { - break; - } - i++; - } - } - if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f) - { - Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - if (Collision.SolidCollision(vector, width, player.height) && i < 99) - { - Vector2 vector3 = Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - flag = true; - num3 += i; - break; - } - } - } - } - } - } - } - } - if (!flag) - { - return; - } - ModTeleport(player, vector, syncData, false); - } - - public static void DungeonTeleport(Player player, bool syncData = false) - { - ModTeleport(player, new Vector2(Main.dungeonX, Main.dungeonY), syncData, true); - } - - public static void JungleTeleport(Player player, bool syncData = false) - { - int jungleSide = CalamityWorld.abyssSide ? ((Main.maxTilesX / 2) + (Main.maxTilesX / 4)) : (Main.maxTilesX / 5); - int teleportStartX = jungleSide; - int teleportRangeX = 200; - int teleportStartY = (int)Main.worldSurface; - int teleportRangeY = 50; - bool flag = false; - int num = 0; - int num2 = 0; - int num3 = 0; - int width = player.width; - Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - while (!flag && num < 1000) - { - num++; - num2 = teleportStartX + Main.rand.Next(teleportRangeX); - num3 = teleportStartY + Main.rand.Next(teleportRangeY); - vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - if (!Collision.SolidCollision(vector, width, player.height)) - { - if (Main.tile[num2, num3] == null) - { - Main.tile[num2, num3] = new Tile(); - } - int i = 0; - while (i < 100) - { - if (Main.tile[num2, num3 + i] == null) - { - Main.tile[num2, num3 + i] = new Tile(); - } - Tile tile = Main.tile[num2, num3 + i]; - vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); - Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height); - if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X) - { - bool arg_1FE_0 = vector2.Y == vector.Y; - } - if (arg_1FF_0) - { - i++; - } - else - { - if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.type]) - { - break; - } - i++; - } - } - if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f) - { - Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - if (Collision.SolidCollision(vector, width, player.height) && i < 99) - { - Vector2 vector3 = Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - flag = true; - num3 += i; - break; - } - } - } - } - } - } - } - } - if (!flag) - { - return; - } - ModTeleport(player, vector, syncData, false); - } - - public static void ModTeleport(Player player, Vector2 pos, bool syncData = false, bool convertFromTiles = false) - { - bool postImmune = player.immune; - int postImmunteTime = player.immuneTime; - if (convertFromTiles) - { - pos = new Vector2(pos.X * 16 + 8 - player.width / 2, pos.Y * 16 - player.height); - } - player.grappling[0] = -1; - player.grapCount = 0; - for (int index = 0; index < 1000; ++index) - { - if (Main.projectile[index].active && Main.projectile[index].owner == player.whoAmI && Main.projectile[index].aiStyle == 7) - { - Main.projectile[index].Kill(); - } - } - player.Teleport(pos, 2, 0); - player.velocity = Vector2.Zero; - player.immune = postImmune; - player.immuneTime = postImmunteTime; - for (int index = 0; index < 100; ++index) - { - Main.dust[Dust.NewDust(player.position, player.width, player.height, 164, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; - } - Main.TeleportEffect(player.getRect(), 1); - Main.TeleportEffect(player.getRect(), 3); - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 6); - if (Main.netMode != 2) - { - return; - } - if (syncData) - { - RemoteClient.CheckSection(player.whoAmI, player.position, 1); - NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, pos.X, pos.Y, 3, 0, 0); - } - } - #endregion - - #region UpdateEquips - public override void UpdateVanityAccessories() - { - for (int n = 13; n < 18 + player.extraAccessorySlots; n++) - { - Item item = player.armor[n]; - if (item.type == mod.ItemType()) - { - snowmanHide = false; - snowmanForce = true; - } - else if (item.type == mod.ItemType()) - { - abyssalDivingSuitHide = false; - abyssalDivingSuitForce = true; - } - else if (item.type == mod.ItemType()) - { - sirenBoobsHide = false; - sirenBoobsForce = true; - } - else if (item.type == mod.ItemType()) - { - sirenBoobsAltHide = false; - sirenBoobsAltForce = true; - } - } - } - - public override void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff) - { - if (Config.MiningSpeedBoost) - { - player.pickSpeed *= 0.75f; - } - - #region MeleeSpeed - float meleeSpeedMult = 0f; - if (bBlood) - { - meleeSpeedMult += 0.025f; - } - if (rRage) - { - meleeSpeedMult += 0.05f; - } - if (graxDefense) - { - meleeSpeedMult += 0.05f; - } - if (sMeleeBoost) - { - meleeSpeedMult += 0.05f; - } - if (yPower) - { - meleeSpeedMult += 0.05f; - } - if (darkSunRing) - { - meleeSpeedMult += 0.12f; - } - if (badgeOfBravery) - { - meleeSpeedMult += 0.15f; - } - if (badgeOfBraveryRare) - { - meleeSpeedMult += 0.2f; - } - if (eGauntlet) - { - meleeSpeedMult += 0.15f; - } - if (yInsignia) - { - meleeSpeedMult += 0.1f; - } - if (bloodyMary) - { - if (Main.bloodMoon) - { - meleeSpeedMult += 0.15f; - } - } - if (community) - { - float floatTypeBoost = 0.01f + - (NPC.downedSlimeKing ? 0.01f : 0f) + - (NPC.downedBoss1 ? 0.01f : 0f) + - (NPC.downedBoss2 ? 0.01f : 0f) + - (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 - (NPC.downedBoss3 ? 0.01f : 0f) + - (Main.hardMode ? 0.01f : 0f) + - (NPC.downedMechBossAny ? 0.01f : 0f) + - (NPC.downedPlantBoss ? 0.01f : 0f) + - (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 - (NPC.downedFishron ? 0.01f : 0f) + - (NPC.downedAncientCultist ? 0.01f : 0f) + - (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 - (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 - (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 - meleeSpeedMult += (floatTypeBoost * 0.25f); - } - if (eArtifact) - { - meleeSpeedMult += 0.1f; - } - if (Config.ProficiencyEnabled) - { - meleeSpeedMult += GetMeleeSpeedBonus(); - } - player.meleeSpeed += meleeSpeedMult; - #endregion - - if (snowman) - { - if (player.whoAmI == Main.myPlayer && !snowmanNoseless) - { - player.AddBuff(mod.BuffType(), 60, true); - } - } - if (abyssalDivingSuit) - { - player.AddBuff(mod.BuffType(), 60, true); - if (player.whoAmI == Main.myPlayer) - { - if (abyssalDivingSuitCooldown) - { - for (int l = 0; l < 22; l++) - { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] < 30 && hasBuff == mod.BuffType("AbyssalDivingSuitPlatesBroken")) - { - abyssalDivingSuitPlateHits = 0; - player.DelBuff(l); - l = -1; - } - } - } - else - { - player.AddBuff(mod.BuffType("AbyssalDivingSuitPlates"), 2); - } - } - } - if (sirenBoobs) - { - player.AddBuff(mod.BuffType(), 60, true); - } - else if (sirenBoobsAlt) - { - player.AddBuff(mod.BuffType(), 60, true); - } - if ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) - { - if (player.whoAmI == Main.myPlayer && !sirenIceCooldown) - { - player.AddBuff(mod.BuffType("IceShieldBuff"), 2); - } - } - } - #endregion - - #region PreUpdateBuffs - public override void PreUpdateBuffs() - { - //Remove the mighty wind buff if the player is in the astral desert. - if (player.ZoneDesert && ZoneAstral && player.HasBuff(BuffID.WindPushed)) - { - player.ClearBuff(BuffID.WindPushed); - } - } - #endregion - - #region PostUpdate - - #region PostUpdateBuffs - public override void PostUpdateBuffs() - { - if (CalamityWorld.defiled) - Defiled(); - - if (weakPetrification) - WeakPetrification(); - - if (CalamityWorld.bossRushActive) - BossRushMovementChanges(); - - if (player.mount.Active || player.mount.Cart || (Config.BossRushDashCurse && CalamityWorld.bossRushActive)) - { - player.dashDelay = 60; - dashMod = 0; - } - - if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) - { - if (player.lifeRegen < 0) - player.lifeRegen = 0; - } - } - #endregion - - #region PostUpdateEquips - public override void PostUpdateEquips() - { - if (CalamityWorld.defiled) - Defiled(); - - if (weakPetrification) - WeakPetrification(); - - if (CalamityWorld.bossRushActive) - BossRushMovementChanges(); - - if (player.mount.Active || player.mount.Cart || (Config.BossRushDashCurse && CalamityWorld.bossRushActive)) - { - player.dashDelay = 60; - dashMod = 0; - } - - if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) - { - if (player.lifeRegen < 0) - player.lifeRegen = 0; - } - } - #endregion - - public override void PostUpdateMiscEffects() - { - if (Config.ExpertDebuffDurationReduction) - Main.expertDebuffTime = 1f; - - areThereAnyDamnBosses = CalamityGlobalNPC.AnyBossNPCS(); - - #region RevengeanceEffects - /*if (!areThereAnyDamnBosses) - { - distanceFromBoss = -1; - }*/ - if (CalamityWorld.revenge) - { - if (player.lifeSteal > (CalamityWorld.death ? 30f : 40f)) - { - player.lifeSteal = (CalamityWorld.death ? 30f : 40f); - } - if (player.whoAmI == Main.myPlayer) - { - if (player.onHitDodge) - { - for (int l = 0; l < 22; l++) - { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 360 && hasBuff == BuffID.ShadowDodge) - { - player.buffTime[l] = 360; - } - } - } - if (player.immuneTime > (tarraThrowing ? 300 : 120)) - { - player.immuneTime = (tarraThrowing ? 300 : 120); - } - if (Config.AdrenalineAndRage) - { - int stressGain = 0; - if (rageMode) - { - stressGain = -2000; - } - else - { - if (draedonsHeart) - { - if (draedonsStressGain) - { - stressGain += 60; - } - } - else if (heartOfDarkness) - { - stressGain += 30; - } - } - stressCD++; - if (stressCD >= 60) - { - stressCD = 0; - stress += stressGain; - if (stress < 0) - { - stress = 0; - } - if (stress >= stressMax) - { - if (playFullRageSound) - { - playFullRageSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); - } - stress = stressMax; - } - else - { - playFullRageSound = true; - } - } - stressLevel500 = stress >= 9800; - if (stressLevel500 && !hAttack) - { - int heartAttackChance = ((draedonsHeart || heartOfDarkness) ? 2000 : 10000); - if (Main.rand.Next(heartAttackChance) == 0) - { - player.AddBuff(mod.BuffType("HeartAttack"), 18000); - } - } - if (adrenaline >= adrenalineMax) - { - adrenalineMaxTimer--; - if (adrenalineMaxTimer <= 0) - { - if (playAdrenalineBurnoutSound) - { - playAdrenalineBurnoutSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout1"), (int)player.position.X, (int)player.position.Y); - } - adrenalineDmgDown--; - if (adrenalineDmgDown < 0) - { - if (playFullAdrenalineBurnoutSound) - { - playFullAdrenalineBurnoutSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout2"), (int)player.position.X, (int)player.position.Y); - } - adrenalineDmgDown = 0; - } - adrenalineMaxTimer = 0; - } - } - else if (!adrenalineMode && adrenaline <= 0) - { - playAdrenalineBurnoutSound = true; - playFullAdrenalineBurnoutSound = true; - adrenalineDmgDown = 600; - adrenalineMaxTimer = 300; - adrenalineDmgMult = 1f; - } - adrenalineDmgMult = 0.1f * (float)(adrenalineDmgDown / 60); - if (adrenalineDmgMult < 0.33f) - adrenalineDmgMult = 0.33f; - int adrenalineGain = 0; - bool SCalAlive = NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); - if (adrenalineMode) - { - adrenalineGain = (SCalAlive ? -10000 : -2000); - } - else - { - if (Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16)) // > - { - adrenaline = 0; - } - else if (areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0) - { - int adrenalineTickBoost = 0 + - (adrenalineBoostOne ? 63 : 0) + //286 - (adrenalineBoostTwo ? 115 : 0) + //401 - (adrenalineBoostThree ? 100 : 0); //501 - adrenalineGain = 223 + adrenalineTickBoost; //pre-slime god = 45, pre-astrum deus = 35, pre-polterghast = 25, post-polter = 20 - /*if (distanceFromBoss == -1 || distanceFromBoss > 5600) - { - adrenalineGain /= 4; - }*/ - } - else - { - adrenaline = 0; - } - } - adrenalineCD++; - if (adrenalineCD >= (SCalAlive ? 135 : 60)) - { - adrenalineCD = 0; - adrenaline += adrenalineGain; - if (adrenaline < 0) - { - adrenaline = 0; - } - if (adrenaline >= adrenalineMax) - { - if (playFullAdrenalineSound) - { - playFullAdrenalineSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullAdrenaline"), (int)player.position.X, (int)player.position.Y); - } - adrenaline = adrenalineMax; - } - else - { - playFullAdrenalineSound = true; - } - } - } - } - } - else - { - if (player.whoAmI == Main.myPlayer) - { - stressCD++; - if (stressCD >= 60) - { - stressCD = 0; - stress += -30; - if (stress < 0) - { - stress = 0; - } - } - adrenalineCD++; - if (adrenalineCD >= 60) - { - adrenalineCD = 0; - adrenaline += -30; - if (adrenaline < 0) - { - adrenaline = 0; - } - } - } - } - if (player.whoAmI == Main.myPlayer && Main.netMode == 1) - { - packetTimer++; - if (packetTimer == 60) - { - packetTimer = 0; - StressPacket(false); - AdrenalinePacket(false); - /*if (areThereAnyDamnBosses) - DistanceFromBossPacket(false);*/ - } - } - #endregion - - #region StressTiedEffects - if (stressPills) - { - player.statDefense += 8; - AllDamageBoost(0.08f); - } - if (laudanum) - { - player.statDefense += 6; - AllDamageBoost(0.06f); - } - if (draedonsHeart) - { - AllDamageBoost(0.1f); - } - if (!stressLevel500 && player.FindBuffIndex(mod.BuffType("HeartAttack")) > -1) { player.ClearBuff(mod.BuffType("HeartAttack")); } - if (draedonsHeart && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.statDefense += 25; - } - if (hAttack) - { - if (heartOfDarkness || draedonsHeart) - { - AllDamageBoost(0.1f); - } - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; - } - if (affliction || 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); - } - #endregion - - #region MaxLifeAndManaBoosts - player.statLifeMax2 += - (mFruit ? 25 : 0) + - (bOrange ? 25 : 0) + - (eBerry ? 25 : 0) + - (dFruit ? 25 : 0); - if (silvaHitCounter > 0) - { - player.statLifeMax2 -= silvaHitCounter * 100; - if (player.statLifeMax2 <= 400) - { - 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 += - (pHeart ? 50 : 0) + - (eCore ? 50 : 0) + - (cShard ? 50 : 0) + - (starBeamRye ? 50 : 0); - if (Main.netMode != 2 && player.whoAmI == Main.myPlayer) - { - Texture2D rain3 = mod.GetTexture("ExtraTextures/Rain3"); - Texture2D rainOriginal = mod.GetTexture("ExtraTextures/RainOriginal"); - Texture2D mana2 = mod.GetTexture("ExtraTextures/Mana2"); - Texture2D mana3 = mod.GetTexture("ExtraTextures/Mana3"); - Texture2D mana4 = mod.GetTexture("ExtraTextures/Mana4"); - Texture2D manaOriginal = mod.GetTexture("ExtraTextures/ManaOriginal"); - Texture2D carpetAuric = mod.GetTexture("ExtraTextures/AuricCarpet"); - Texture2D carpetOriginal = mod.GetTexture("ExtraTextures/Carpet"); - int totalManaBoost = - (pHeart ? 1 : 0) + - (eCore ? 1 : 0) + - (cShard ? 1 : 0); - switch (totalManaBoost) - { - default: - Main.manaTexture = manaOriginal; - break; - case 3: - Main.manaTexture = mana4; - break; - case 2: - Main.manaTexture = mana3; - break; - case 1: - Main.manaTexture = mana2; - break; - } - if (Main.bloodMoon) { Main.rainTexture = rainOriginal; } - else if (Main.raining && ZoneSulphur) { Main.rainTexture = rain3; } - else { Main.rainTexture = rainOriginal; } - if (auricSet) { Main.flyingCarpetTexture = carpetAuric; } - else { Main.flyingCarpetTexture = carpetOriginal; } - } - #endregion - - #region MiscEffects - if (Config.ProficiencyEnabled) - { - GetExactLevelUp(); - } - - if (gainRageCooldown > 0) - gainRageCooldown--; - - if (player.nebulaLevelMana > 0 && player.statMana < player.statManaMax2) - { - int num = 12; - nebulaManaNerfCounter += player.nebulaLevelMana; - if (nebulaManaNerfCounter >= num) - { - nebulaManaNerfCounter -= num; - player.statMana--; - if (player.statMana < 0) - { - player.statMana = 0; - } - } - } - else - { - nebulaManaNerfCounter = 0; - } - if (Main.myPlayer == player.whoAmI) - { - BossHealthBarManager.SHOULD_DRAW_SMALLTEXT_HEALTH = shouldDrawSmallText; - /*if (player.chest != -1) - { - if (player.chest != -2) - { - trashManChest = -1; - } - if (trashManChest >= 0) - { - if (!Main.projectile[trashManChest].active || Main.projectile[trashManChest].type != mod.ProjectileType("DannyDevito")) - { - Main.PlaySound(SoundID.Item11, -1, -1); - player.chest = -1; - Recipe.FindRecipes(); - } - else - { - int num16 = (int)(((double)player.position.X + (double)player.width * 0.5) / 16.0); - int num17 = (int)(((double)player.position.Y + (double)player.height * 0.5) / 16.0); - player.chestX = (int)Main.projectile[trashManChest].Center.X / 16; - player.chestY = (int)Main.projectile[trashManChest].Center.Y / 16; - if (num16 < player.chestX - Player.tileRangeX || num16 > player.chestX + Player.tileRangeX + 1 || num17 < player.chestY - Player.tileRangeY || num17 > player.chestY + Player.tileRangeY + 1) - { - if (player.chest != -1) - { - Main.PlaySound(SoundID.Item11, -1, -1); - } - player.chest = -1; - Recipe.FindRecipes(); - } - } - } - } - else - { - trashManChest = -1; - }*/ - } - if (silvaSet || invincible || margarita) - { - foreach (int debuff in CalamityMod.debuffList) - player.buffImmune[debuff] = true; - } - if (aSparkRare) - { - player.buffImmune[BuffID.Electrified] = true; - } - if (Config.ExpertChilledWaterRemoval) - { - if (Main.expertMode && player.ZoneSnow && player.wet && !player.lavaWet && !player.honeyWet && !player.arcticDivingGear) - { - player.buffImmune[BuffID.Chilled] = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - if (Main.myPlayer == player.whoAmI && !player.gills && !player.merman) - { - if (player.breath > 0) - player.breath--; - } - } - } - } - if (ZoneAbyss) - { - 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 - (player.arcticDivingGear ? 1 : 0) + //3 - (jellyfishNecklace ? 1 : 0) + //4 - ((player.blueFairy || player.greenFairy || player.redFairy || player.petFlagDD2Ghost) ? 2 : 0) + //6 - ((shine || lumenousAmulet) ? 2 : 0) + //8 - ((player.wisp || player.suspiciouslookingTentacle || sirenPet) ? 3 : 0); //11 - bool lightLevelOne = lightStrength > 0; //1+ - bool lightLevelTwo = lightStrength > 2; //3+ - bool lightLevelThree = lightStrength > 4; //5+ - bool lightLevelFour = lightStrength > 6; //7+ - if (ZoneAbyssLayer4) //3200 and below - { - breathLoss = 54; - 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 (!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; - lifeLossAtZeroBreath = 6; - player.statDefense -= (anechoicPlating ? 10 : 30); - } - else if (ZoneAbyssLayer1) //1500 to 2100 - { - if (!lightLevelOne) - player.blind = true; - player.statDefense -= (anechoicPlating ? 5 : 15); - } - double breathLossMult = 1.0 - - (player.gills ? 0.2 : 0.0) - //0.8 - (player.accDivingHelm ? 0.25 : 0.0) - //0.75 - (player.arcticDivingGear ? 0.25 : 0.0) - //0.75 - (aquaticEmblem ? 0.25 : 0.0) - //0.75 - (player.accMerman ? 0.3 : 0.0) - //0.7 - (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; - } - breathLoss = (int)((double)breathLoss * breathLossMult); - int tick = 6; - double tickMult = 1.0 + - (player.gills ? 4.0 : 0.0) + //5 - (player.ignoreWater ? 5.0 : 0.0) + //10 - (player.accDivingHelm ? 10.0 : 0.0) + //20 - (player.arcticDivingGear ? 10.0 : 0.0) + //30 - (aquaticEmblem ? 10.0 : 0.0) + //40 - (player.accMerman ? 15.0 : 0.0) + //55 - (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; - } - tick = (int)((double)tick * tickMult); - abyssBreathCD++; - if (player.gills || player.merman) - { - if (player.breath > 0) - player.breath -= 3; - } - if (!Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - if (player.statLife > 100) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 160; - } - } - if (abyssBreathCD >= tick) - { - abyssBreathCD = 0; - if (player.breath > 0) - player.breath -= breathLoss; - if (cDepth) - { - if (player.breath > 0) - player.breath--; - } - if (player.breath <= 0) - { - if (depthCharm) - { - lifeLossAtZeroBreath -= 3; - if (abyssalDivingSuit) - lifeLossAtZeroBreath -= 6; - } - if (lifeLossAtZeroBreath < 0) - { - lifeLossAtZeroBreath = 0; - } - player.statLife -= lifeLossAtZeroBreath; - if (player.statLife <= 0) - { - KillPlayer(); - } - } - } - } - } - else - { - abyssBreathCD = 0; - } - if (!player.mount.Active) - { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && ironBoots) - { - player.maxFallSpeed = 7f; - } - if (aeroSet && !player.wet) - { - player.maxFallSpeed = 15f; - } - if (normalityRelocator) - { - player.maxFallSpeed *= 1.1f; - } - } - if (normalityRelocator) - { - player.moveSpeed += 0.1f; - } - if (player.ZoneSkyHeight) - { - if (astrumDeusLore) - { - player.moveSpeed += 0.2f; - } - if (astrumAureusLore) - { - player.jumpSpeedBoost += 0.5f; - } - } - if (omegaBlueSet) //should apply after rev caps, actually those are gone so AAAAA - { - //add tentacles - if (player.ownedProjectileCounts[mod.ProjectileType("OmegaBlueTentacle")] < 6) - { - bool[] tentaclesPresent = new bool[6]; - for (int i = 0; i < 1000; i++) - { - Projectile projectile = Main.projectile[i]; - if (projectile.active && projectile.type == mod.ProjectileType("OmegaBlueTentacle") && projectile.owner == Main.myPlayer && projectile.ai[1] >= 0f && projectile.ai[1] < 6f) - { - tentaclesPresent[(int)projectile.ai[1]] = true; - } - } - for (int i = 0; i < 6; i++) - { - if (!tentaclesPresent[i]) - { - float modifier = player.meleeDamage + player.magicDamage + player.rangedDamage + - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage + player.minionDamage; - modifier /= 5f; - int damage = (int)(666 * modifier); - Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f; - Projectile.NewProjectile(player.Center, vel, mod.ProjectileType("OmegaBlueTentacle"), damage, 8f, Main.myPlayer, Main.rand.Next(120), i); - } - } - } - float damageUp = 0.1f; - int critUp = 10; - if (omegaBlueHentai) - { - damageUp *= 2f; - critUp *= 2; - } - AllDamageBoost(damageUp); - AllCritBoost(critUp); - } - if (!bOut) - { - if (gHealer) - { - if (healCounter > 0) - { - healCounter--; - } - if (healCounter <= 0) - { - healCounter = 300; - if (player.whoAmI == Main.myPlayer) - { - int healAmount = 5 + - (gDefense ? 5 : 0) + - (gOffense ? 5 : 0); - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - } - if (gDefense) - { - player.moveSpeed += 0.1f + - (gOffense ? 0.1f : 0f); - player.endurance += 0.025f + - (gOffense ? 0.025f : 0f); - } - if (gOffense) - { - player.minionDamage += 0.1f + - (gDefense ? 0.05f : 0f); - player.maxMinions++; - } - } - 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; - silvaCountdown--; - if (silvaCountdown <= 0) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); - } - for (int j = 0; j < 2; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].noGravity = true; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.Next(2) == 0) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - } - if (tarraMelee) - { - if (tarraDefense) - { - tarraDefenseTime--; - if (tarraDefenseTime <= 0) - { - tarraDefenseTime = 600; - tarraCooldown = 1800; - tarraDefense = false; - } - for (int j = 0; j < 2; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].noGravity = true; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.Next(2) == 0) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - } - if (tarraCooldown > 0) - tarraCooldown--; - } - if (tarraThrowing) - { - if (tarraThrowingCritTimer > 0) - { - tarraThrowingCritTimer--; - } - if (tarraThrowingCrits >= 25) - { - tarraThrowingCrits = 0; - tarraThrowingCritTimer = 1800; - player.immune = true; - player.immuneTime = 300; - } - for (int l = 0; l < 22; l++) - { - int hasBuff = player.buffType[l]; - bool shouldAffect = CalamityMod.debuffList.Contains(hasBuff); - if (shouldAffect) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - } - } - } - if (bloodflareSet) - { - if (bloodflareHeartTimer > 0) - bloodflareHeartTimer--; - if (bloodflareManaTimer > 0) - bloodflareManaTimer--; - } - if (bloodflareMelee) - { - if (bloodflareMeleeHits >= 15) - { - bloodflareMeleeHits = 0; - bloodflareFrenzyTimer = 300; - } - if (bloodflareFrenzyTimer > 0) - { - bloodflareFrenzyTimer--; - if (bloodflareFrenzyTimer <= 0) - { - bloodflareFrenzyCooldown = 1800; - } - player.meleeCrit += 25; - player.meleeDamage += 0.25f; - for (int j = 0; j < 2; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 5, 0f, 0f, 100, default(Color), 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].noGravity = true; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.Next(2) == 0) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - } - if (bloodflareFrenzyCooldown > 0) - bloodflareFrenzyCooldown--; - } - if (bloodflareRanged) - { - if (bloodflareRangedCooldown > 0) - bloodflareRangedCooldown--; - } - if (Main.raining && ZoneSulphur) - { - if (player.ZoneOverworldHeight || player.ZoneSkyHeight) - player.AddBuff(mod.BuffType("Irradiated"), 2); - } - if (raiderTalisman) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += ((float)raiderStack / 250f) * 0.25f; - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon) - { - player.maxMinions += 2; - } - if (sDefense) - { - player.statDefense += 5; - player.endurance += 0.05f; - } - if (absorber) - { - player.moveSpeed += 0.12f; - player.jumpSpeedBoost += 1.2f; - player.statLifeMax2 += 20; - player.thorns = 0.5f; - player.endurance += 0.05f; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.lifeRegen += 2; - player.manaRegenBonus += 2; - } - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.statDefense += 5; - player.endurance += 0.05f; - player.moveSpeed += 0.2f; - } - } - 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.25f; - player.buffImmune[70] = true; - player.buffImmune[47] = true; - player.buffImmune[46] = true; - player.buffImmune[44] = true; - player.buffImmune[20] = true; - if (!player.honey && player.lifeRegen < 0) - { - player.lifeRegen += 2; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - } - player.lifeRegenTime += 1; - player.lifeRegen += 2; - } - else if (cFreeze) - { - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.3f, ((float)Main.DiscoG / 400f), 0.5f); - } - else if (sirenIce) - { - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.35f, 1f, 1.25f); - } - else if (sirenBoobs || sirenBoobsAlt) - { - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1.5f, 1f, 0.1f); - } - else if (tarraSummon) - { - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 3f, 0f); - } - if (cFreeze) - { - int num = mod.BuffType("GlacialState"); - float num2 = 200f; - int random = Main.rand.Next(5); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (nPC.FindBuffIndex(num) == -1) - { - nPC.AddBuff(num, 120, false); - } - } - } - } - } - } - if (invincible || lol) - { - player.thorns = 0f; - player.turtleThorns = false; - } - if (player.vortexStealthActive) - { - player.rangedDamage -= (1f - player.stealth) * 0.4f; //change 80 to 40 - player.rangedCrit -= (int)((1f - player.stealth) * 5f); //change 20 to 15 - } - if (player.inventory[player.selectedItem].type != mod.ItemType("Ataraxia")) - { - ataraxiaDamageBoost = 0f; - ataraxiaDamageBoostCancelTimer = 1200; - } - else - { - if (ataraxiaDamageBoostCancelTimer > 0) - ataraxiaDamageBoostCancelTimer--; - if (ataraxiaDamageBoostCancelTimer <= 0) - { - if (ataraxiaDamageBoost > 0f) - ataraxiaDamageBoost -= 0.01f; - if (ataraxiaDamageBoost < 0f) - ataraxiaDamageBoost = 0f; - } - if (ataraxiaDamageBoostCooldown > 0) - ataraxiaDamageBoostCooldown--; - if (ataraxiaDamageBoost > 0.3f) - ataraxiaDamageBoost = 0.3f; - } - if (projRefRareLifeRegenCounter > 0) - { - projRefRareLifeRegenCounter--; - player.lifeRegenTime += 2; - player.lifeRegen += 2; - } - if (desertScourgeLore) - { - player.statDefense += 5; - } - if (skeletronPrimeLore) - { - player.armorPenetration += 5; - } - if (destroyerLore) - { - player.pickSpeed -= 0.05f; - } - 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 = 10; - float knockBack = 1f; - 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 += 5; - } - 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) - { - 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 < 90f + player.velocity.X) - { - Item item = Main.item[j]; - item.velocity.X = item.velocity.X + 9f; - } - if (Main.item[j].velocity.X < 0f) - { - Item item = Main.item[j]; - item.velocity.X = item.velocity.X + 9f * 0.75f; - } - } - else - { - if (Main.item[j].velocity.X > -90f + player.velocity.X) - { - Item item = Main.item[j]; - item.velocity.X = item.velocity.X - 9f; - } - if (Main.item[j].velocity.X > 0f) - { - Item item = Main.item[j]; - item.velocity.X = item.velocity.X - 9f * 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 < 90f) - { - Item item = Main.item[j]; - item.velocity.Y = item.velocity.Y + 9f; - } - if (Main.item[j].velocity.Y < 0f) - { - Item item = Main.item[j]; - item.velocity.Y = item.velocity.Y + 9f * 0.75f; - } - } - else - { - if (Main.item[j].velocity.Y > -90f) - { - Item item = Main.item[j]; - item.velocity.Y = item.velocity.Y - 9f; - } - if (Main.item[j].velocity.Y > 0f) - { - Item item = Main.item[j]; - item.velocity.Y = item.velocity.Y - 9f * 0.75f; - } - } - } - } - } - if (dukeFishronLore) - { - AllDamageBoost(0.05f); - AllCritBoost(5); - player.moveSpeed += 0.1f; - } - 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 - if (rogueStealthMax > 0f) - { - if (rogueStealth >= rogueStealthMax) //full stealth does more damage - { - if (playRogueStealthSound) - { - playRogueStealthSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/RogueStealth"), (int)player.position.X, (int)player.position.Y); - } - //The first projectile thrown will inherit this damage, not the crit. Crit is calculated on enemy hits and is not tied to the projectile - //The moment you use any item/weapon the crit multiplier from stealth will decrease, meaning you will never get the optimal boost - //To remedy this, make stealth increase crit by a larger amount so that it means more - //If not you risk the crit boost feeling negligible - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += rogueStealth * 1f; //100% max damage boost, 160% with Auric - } - else - { - playRogueStealthSound = true; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += rogueStealth * 0.75f; //0% to 75% damage boost, 120% with Auric - } - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += (int)(rogueStealth * 30f); //0% to 30% crit boost, 48% with Auric - player.moveSpeed += rogueStealth * 0.05f; - player.aggro -= (int)((rogueStealth / rogueStealthMax) * 900f); - if (player.itemAnimation > 0) - { - if (rogueStealth > 0f) - { - 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) || (penumbra && (!Main.dayTime || Main.eclipse))) && !player.mount.Active) - { - if (rogueStealth < rogueStealthMax) - { - 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) && - !player.mount.Active) - { - if (aquaticBoost > 0f) - { - aquaticBoost -= 0.0002f; //0.015 - if ((double)aquaticBoost <= 0.0) - { - aquaticBoost = 0f; - if (Main.netMode == 1) - NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - 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) - { - modStealthTimer = 5; - } - if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) - { - if (modStealthTimer == 0 && modStealth > 0f) - { - modStealth -= 0.015f; - if ((double)modStealth <= 0.0) - { - modStealth = 0f; - if (Main.netMode == 1) - NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - 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) - { - if (player.itemAnimation > 0) - { - modStealthTimer = 5; - } - if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) - { - if (modStealthTimer == 0 && modStealth > 0f) - { - modStealth -= 0.015f; - if ((double)modStealth <= 0.0) - { - modStealth = 0f; - if (Main.netMode == 1) - NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - 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; - } - 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 - if (elysianAegis) - { - bool flag14 = false; - if (elysianGuard) - { - float num29 = shieldInvinc; - shieldInvinc -= 0.08f; - if (shieldInvinc < 0f) - { - shieldInvinc = 0f; - } - else - { - flag14 = true; - } - if (shieldInvinc == 0f && num29 != shieldInvinc && Main.netMode == 1) - { - NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - float damageBoost = (5f - shieldInvinc) * 0.03f; - AllDamageBoost(damageBoost); - int critBoost = (int)((5f - shieldInvinc) * 2f); - AllCritBoost(critBoost); - player.aggro += (int)((5f - shieldInvinc) * 220f); - player.statDefense += (int)((5f - shieldInvinc) * 4f); - player.moveSpeed *= 0.85f; - if (player.mount.Active) - { - elysianGuard = false; - } - } - else - { - float num30 = shieldInvinc; - shieldInvinc += 0.08f; - if (shieldInvinc > 5f) - { - shieldInvinc = 5f; - } - else - { - flag14 = true; - } - if (shieldInvinc == 5f && num30 != shieldInvinc && Main.netMode == 1) - { - NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - if (flag14) - { - if (Main.rand.Next(2) == 0) - { - Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust = Main.dust[Dust.NewDust(player.Center - vector * 30f, 0, 0, 244, 0f, 0f, 0, default(Color), 1f)]; - dust.noGravity = true; - dust.position = player.Center - vector * (float)Main.rand.Next(5, 11); - dust.velocity = vector.RotatedBy(1.5707963705062866, default(Vector2)) * 4f; - dust.scale = 0.5f + Main.rand.NextFloat(); - dust.fadeIn = 0.5f; - } - if (Main.rand.Next(2) == 0) - { - Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust2 = Main.dust[Dust.NewDust(player.Center - vector2 * 30f, 0, 0, 246, 0f, 0f, 0, default(Color), 1f)]; - dust2.noGravity = true; - dust2.position = player.Center - vector2 * 12f; - dust2.velocity = vector2.RotatedBy(-1.5707963705062866, default(Vector2)) * 2f; - dust2.scale = 0.5f + Main.rand.NextFloat(); - dust2.fadeIn = 0.5f; - } - } - } - else - { - elysianGuard = false; - } - #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) - { - if (player.FindBuffIndex(mod.BuffType("ArmorCrumbling")) > -1) { player.ClearBuff(mod.BuffType("ArmorCrumbling")); } - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; - player.meleeDamage += 0.08f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; - player.meleeCrit += 8; - } - if (holyWrath) - { - if (player.FindBuffIndex(BuffID.Wrath) > -1) { player.ClearBuff(BuffID.Wrath); } - AllDamageBoost(0.12f); - player.moveSpeed += 0.05f; - } - if (profanedRage) - { - if (player.FindBuffIndex(BuffID.Rage) > -1) { player.ClearBuff(BuffID.Rage); } - AllCritBoost(12); - player.moveSpeed += 0.05f; - } - if (irradiated) - { - player.statDefense -= 10; - AllDamageBoost(0.05f); - player.minionKB += 0.5f; - player.moveSpeed += 0.05f; - } - if (rRage) - { - AllDamageBoost(0.05f); - player.moveSpeed += 0.05f; - } - if (xRage) - { - AllDamageBoost(0.1f); - } - if (xWrath) - { - AllCritBoost(5); - } - if (godSlayerCooldown) - { - AllDamageBoost(0.1f); - } - if (graxDefense) - { - player.statDefense += 15; - player.endurance += 0.05f; - player.meleeDamage += 0.1f; - } - if (sMeleeBoost) - { - AllDamageBoost(0.1f); - AllCritBoost(5); - } - if (tFury) - { - player.meleeDamage += 0.3f; - player.meleeCrit += 10; - } - if (yPower) - { - player.endurance += 0.05f; - player.statDefense += 5; - AllDamageBoost(0.06f); - AllCritBoost(2); - player.minionKB += 1f; - player.moveSpeed += 0.15f; - } - if (tScale) - { - player.endurance += 0.05f; - player.statDefense += 5; - player.kbBuff = true; - } - if (darkSunRing) - { - player.maxMinions += 2; - AllDamageBoost(0.12f); - player.minionKB += 1.2f; - player.pickSpeed -= 0.15f; - if (Main.dayTime) - { - player.lifeRegen += 3; - } - else - { - player.statDefense += 30; - } - } - if (eGauntlet) - { - player.longInvince = true; - player.kbGlove = true; - player.meleeDamage += 0.15f; - player.meleeCrit += 5; - player.lavaMax += 240; - } - if (fabsolVodka) - { - alcoholPoisonLevel++; - AllDamageBoost(0.08f); - player.statDefense -= 20; - } - if (vodka) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.statDefense -= 4; - AllDamageBoost(0.06f); - AllCritBoost(2); - } - if (redWine) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - } - if (grapeBeer) - { - alcoholPoisonLevel++; - player.statDefense -= 2; - player.moveSpeed -= 0.05f; - } - if (moonshine) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.statDefense += 10; - player.endurance += 0.05f; - } - if (rum) - { - alcoholPoisonLevel++; - player.lifeRegen += 2; - player.moveSpeed += 0.1f; - player.statDefense -= 8; - } - if (fireball) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - } - if (whiskey) - { - alcoholPoisonLevel++; - player.statDefense -= 8; - AllDamageBoost(0.04f); - AllCritBoost(2); - } - if (everclear) - { - alcoholPoisonLevel += 2; - player.lifeRegen -= 10; - player.statDefense -= 40; - AllDamageBoost(0.25f); - } - if (bloodyMary) - { - alcoholPoisonLevel++; - player.lifeRegen -= 2; - if (Main.bloodMoon) - { - player.statDefense -= 6; - AllDamageBoost(0.15f); - AllCritBoost(7); - player.moveSpeed += 0.15f; - } - } - if (tequila) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - if (Main.dayTime) - { - player.statDefense += 5; - AllDamageBoost(0.03f); - AllCritBoost(2); - player.endurance += 0.03f; - } - } - if (tequilaSunrise) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - if (Main.dayTime) - { - player.statDefense += 15; - AllDamageBoost(0.07f); - AllCritBoost(3); - player.endurance += 0.07f; - } - } - if (screwdriver) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - } - if (caribbeanRum) - { - alcoholPoisonLevel++; - player.lifeRegen += 2; - player.moveSpeed += 0.2f; - player.statDefense -= 12; - } - if (cinnamonRoll) - { - alcoholPoisonLevel++; - player.statDefense -= 12; - player.manaRegenDelay--; - player.manaRegenBonus += 10; - } - if (margarita) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.statDefense -= 6; - } - if (starBeamRye) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.statDefense -= 6; - player.magicDamage += 0.08f; - player.manaCost *= 0.9f; - } - if (moscowMule) - { - alcoholPoisonLevel++; - player.lifeRegen -= 2; - AllDamageBoost(0.09f); - AllCritBoost(3); - } - if (whiteWine) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.statDefense -= 6; - player.magicDamage += 0.1f; - } - if (evergreenGin) - { - alcoholPoisonLevel++; - player.lifeRegen -= 1; - player.endurance += 0.05f; - } - if (alcoholPoisonLevel > 3) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - player.lifeRegen -= 3 * alcoholPoisonLevel; - } - if (giantPearl) - { - if (Main.netMode != 1) - { - for (int m = 0; m < 200; m++) - { - if (Main.npc[m].active && !Main.npc[m].friendly) - { - float distance = (Main.npc[m].Center - player.Center).Length(); - if (distance < 120f) - Main.npc[m].AddBuff(mod.BuffType("PearlAura"), 2, false); - } - } - } - } - if (CalamityMod.scopedWeaponList.Contains(player.inventory[player.selectedItem].type)) - { - player.scope = true; - } - 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 + - (NPC.downedSlimeKing ? 0.01f : 0f) + - (NPC.downedBoss1 ? 0.01f : 0f) + - (NPC.downedBoss2 ? 0.01f : 0f) + - (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 - (NPC.downedBoss3 ? 0.01f : 0f) + - (Main.hardMode ? 0.01f : 0f) + - (NPC.downedMechBossAny ? 0.01f : 0f) + - (NPC.downedPlantBoss ? 0.01f : 0f) + - (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 - (NPC.downedFishron ? 0.01f : 0f) + - (NPC.downedAncientCultist ? 0.01f : 0f) + - (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 - (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 - (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 - int integerTypeBoost = (int)(floatTypeBoost * 50f); - int critBoost = integerTypeBoost / 2; - int regenBoost = 1 + (integerTypeBoost / 5); - float damageBoost = floatTypeBoost * 0.5f; - player.endurance += (floatTypeBoost * 0.25f); - player.statDefense += integerTypeBoost; - AllDamageBoost(damageBoost); - AllCritBoost(critBoost); - player.minionKB += floatTypeBoost; - player.moveSpeed += floatTypeBoost; - player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; - bool lesserEffect = false; - for (int l = 0; l < 22; l++) - { - 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.1f); - } - 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) - { - if (pinkCandleTimer > 0) { pinkCandleTimer--; } // 1 per second - if (pinkCandleTimer <= 0) - { - if (player.statLife < player.statLifeMax2) - { - float regen = (float)player.statLifeMax2 * 0.004f; - player.statLife += (int)regen; - } - pinkCandleTimer = 60; - } - } - if (manaOverloader) - { - player.magicDamage += 0.06f; - if (player.statMana > (int)((double)player.statManaMax2 * 0.5)) - player.lifeRegen -= 3; - if (player.statMana < (int)((double)player.statManaMax2 * 0.1)) - player.ghostHeal = true; - } - 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) - { - if (player.statLife < (int)((double)player.statLifeMax2 * 0.5)) - { - player.meleeDamage += 0.1f; - player.meleeSpeed += 0.1f; - player.endurance += 0.1f; - } - else - { - player.meleeDamage += 0.05f; - player.meleeSpeed += 0.05f; - player.endurance += 0.05f; - } - } - if (dAmulet) - { - player.panic = true; - player.pStone = true; - player.armorPenetration += 25; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 1.35f, 0.3f, 0.9f); - } - } - if (rampartOfDeities) - { - player.armorPenetration += 25; - player.noKnockback = true; - if (player.statLife > (int)((double)player.statLifeMax2 * 0.25)) - { - player.hasPaladinShield = 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)) < 800f) - { - Main.player[myPlayer].AddBuff(43, 20, true); - } - } - } - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.AddBuff(62, 5, true); - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) - { - player.endurance += 0.05f; - } - } - else if (fBulwark) - { - player.noKnockback = true; - if (player.statLife > (int)((double)player.statLifeMax2 * 0.25)) - { - player.hasPaladinShield = 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)) < 800f) - { - Main.player[myPlayer].AddBuff(43, 20, true); - } - } - } - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.AddBuff(62, 5, true); - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) - { - player.endurance += 0.05f; - } - } - if (frostFlare) - { - player.resistCold = true; - player.buffImmune[44] = true; - player.buffImmune[46] = true; - player.buffImmune[47] = true; - if (player.statLife > (int)((double)player.statLifeMax2 * 0.75)) - { - AllDamageBoost(0.1f); - } - if (player.statLife < (int)((double)player.statLifeMax2 * 0.25)) - { - player.statDefense += 10; - } - } - if (vexation) - { - if (player.statLife < (int)((double)player.statLifeMax2 * 0.5)) - { - AllDamageBoost(0.15f); - } - } - if (ataxiaBlaze) - { - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.AddBuff(BuffID.Inferno, 2); - } - } - if (bloodflareThrowing) - { - if (player.statLife > (int)((double)player.statLifeMax2 * 0.8)) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - player.statDefense += 30; - } - else - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - } - } - if (bloodflareSummon) - { - if (player.statLife >= (int)((double)player.statLifeMax2 * 0.9)) - { - player.minionDamage += 0.1f; - } - else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.statDefense += 20; - player.lifeRegen += 2; - } - if (bloodflareSummonTimer > 0) { bloodflareSummonTimer--; } - if (player.whoAmI == Main.myPlayer && bloodflareSummonTimer <= 0) - { - bloodflareSummonTimer = 900; - for (int I = 0; I < 3; I++) - { - float ai1 = (float)(I * 120); - Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, - mod.ProjectileType("GhostlyMine"), (int)((auricSet ? 15000f : 5000f) * player.minionDamage), 1f, player.whoAmI, ai1, 0f); - } - } - } - if (yInsignia) - { - player.longInvince = true; - player.kbGlove = true; - player.meleeDamage += 0.05f; - player.lavaMax += 240; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - AllDamageBoost(0.1f); - } - } - if (reaperToothNecklace) - { - 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; - AllDamageBoost(0.07f); - if (player.statDefense < 100) - { - AllDamageBoost(0.15f); - } - } - else if (bloodflareCore) - { - if (player.statDefense < 100) - { - AllDamageBoost(0.15f); - } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) - { - player.endurance += 0.1f; - AllDamageBoost(0.2f); - } - else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.endurance += 0.05f; - AllDamageBoost(0.1f); - } - } - if (godSlayerThrowing) - { - if (player.statLife >= player.statLifeMax2) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.1f; - } - } - if (tarraSummon) - { - int lifeCounter = 0; - float num2 = 300f; - bool flag = lifeCounter % 60 == 0; - int num3 = 200; - 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 (flag) - { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != 0) - { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); - } - } - } - } - } - lifeCounter++; - if (lifeCounter >= 180) - { - lifeCounter = 0; - } - if (player.statLife >= player.statLifeMax2) - { - player.minionDamage += 0.1f; - 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 - if (player.meleeSpeed < 0.5f) - { - player.meleeSpeed = 0.5f; - } - if (auricSet && silvaMelee) - { - double multiplier = (double)player.statLife / (double)player.statLifeMax2; - player.meleeDamage += (float)(multiplier * 0.2); //ranges from 1.2 times to 1 times - } - if (player.endurance > defEndurance) //0.33 - { - float damageReductionAboveCap = player.endurance - defEndurance; //0.6 - 0.33 = 0.27 - 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 || photosynthesis) && - (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0); - if (!noLifeRegenCap) - { - //Max HP = 400 - //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)) * 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%) - int defLifeRegen = (int)((double)player.lifeRegen / lifeRegenScalar); - player.lifeRegen = defLifeRegen; - } - } - } - } - 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(); - } - if (dArtifact) - { - AllDamageBoost(0.25f); - } - if (trippy) - { - AllDamageBoost(0.5f); - } - if (eArtifact) - { - player.manaCost *= 0.85f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; - player.maxMinions += 2; - } - if (gArtifact) - { - player.maxMinions += 8; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("AngryChicken")) == -1) - { - player.AddBuff(mod.BuffType("AngryChicken"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("AngryChicken")] < 2) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("AngryChicken"), (int)(232f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - if (pArtifact) - { - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("GuardianHealer")) == -1) - { - player.AddBuff(mod.BuffType("GuardianHealer"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianHealer")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -6f, mod.ProjectileType("MiniGuardianHealer"), 0, 0f, Main.myPlayer, 0f, 0f); - } - float baseDamage = 100f + - (CalamityWorld.downedDoG ? 100f : 0f) + - (CalamityWorld.downedYharon ? 100f : 0f); - if (player.maxMinions >= 8) - { - if (player.FindBuffIndex(mod.BuffType("GuardianDefense")) == -1) - { - player.AddBuff(mod.BuffType("GuardianDefense"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianDefense")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, mod.ProjectileType("MiniGuardianDefense"), (int)(baseDamage * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); - } - } - if (tarraSummon || bloodflareSummon || godSlayerSummon || silvaSummon || dsSetBonus || omegaBlueSet) - { - if (player.FindBuffIndex(mod.BuffType("GuardianOffense")) == -1) - { - player.AddBuff(mod.BuffType("GuardianOffense"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianAttack")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("MiniGuardianAttack"), (int)(baseDamage * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); - } - } - } - } - if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 1 || - player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 1 || - player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] > 1) - { - for (int projIndex = 0; projIndex < 1000; projIndex++) - { - if (Main.projectile[projIndex].active && Main.projectile[projIndex].owner == player.whoAmI) - { - if (Main.projectile[projIndex].type == mod.ProjectileType("BigBustyRose") || Main.projectile[projIndex].type == mod.ProjectileType("SirenLure") || - Main.projectile[projIndex].type == mod.ProjectileType("DrewsSandyWaifu") || Main.projectile[projIndex].type == mod.ProjectileType("SandyWaifu") || - Main.projectile[projIndex].type == mod.ProjectileType("CloudyWaifu") || Main.projectile[projIndex].type == mod.ProjectileType("FungalClump")) - { - Main.projectile[projIndex].Kill(); - } - } - } - } - if (marked || reaperToothNecklace) - { - if (player.endurance > 0f) - player.endurance *= 0.5f; - } - if (yharonLore && !CalamityWorld.defiled && !CalamityWorld.bossRushActive) - { - if (player.wingTimeMax < 50000) - player.wingTimeMax = 50000; - } - #endregion - } - - public override void PostUpdateRunSpeeds() - { - #region SpeedBoosts - 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)) - { - runAccMult *= 0.4f; - runSpeedMult *= 0.4f; - } - if (horror) - { - runAccMult *= 0.85f; - runSpeedMult *= 0.85f; - } - if (fabledTortoise) - { - runAccMult *= 0.5f; - runSpeedMult *= 0.5f; - } - if (elysianGuard) - { - runAccMult *= 0.5f; - runSpeedMult *= 0.5f; - } - if (player.powerrun && CalamityWorld.revenge) - { - runSpeedMult *= 0.6666667f; - } - - player.runAcceleration *= runAccMult; - player.maxRunSpeed *= runSpeedMult; - #endregion - - #region DashEffects - if (player.pulley && dashMod > 0) - { - ModDashMovement(); - } - else if (player.grappling[0] == -1 && !player.tongued) - { - ModHorizontalMovement(); - if (dashMod > 0) - { - ModDashMovement(); - } - if (pAmulet && modStealth < 1f) - { - float num43 = player.maxRunSpeed / 2f * (1f - modStealth); - player.maxRunSpeed -= num43; - player.accRunSpeed = player.maxRunSpeed; - } - } - #endregion - } - #endregion - - #region PreKill - public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) - { - if (invincible && player.inventory[player.selectedItem].type != mod.ItemType("ColdheartIcicle")) - { - if (player.statLife <= 0) - { - player.statLife = 1; - } - return false; - } - if (hInferno) - { - for (int x = 0; x < 200; x++) - { - if (Main.npc[x].active && Main.npc[x].type == mod.NPCType("Providence")) - { - Main.npc[x].active = false; - } - } - } - if (nCore && Main.rand.Next(10) == 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 67); - for (int j = 0; j < 25; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0f, 0f, 100, default(Color), 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.Next(2) == 0) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - player.statLife += 100; - player.HealEffect(100); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - return false; - } - if (godSlayer && !godSlayerCooldown) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 67); - for (int j = 0; j < 50; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0f, 0f, 100, default(Color), 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.Next(2) == 0) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - 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; - } - if (silvaSet && silvaCountdown > 0) - { - if (hasSilvaEffect) - { - silvaHitCounter++; - } - if (player.FindBuffIndex(mod.BuffType("SilvaRevival")) == -1) - { - 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) - { - player.statLife = 1; - } - return false; - } - if (permafrostsConcoction && player.FindBuffIndex(mod.BuffType("ConcoctionCooldown")) == -1) - { - player.AddBuff(mod.BuffType("ConcoctionCooldown"), 10800); - player.AddBuff(mod.BuffType("Encased"), 300); - player.statLife = player.statLifeMax2 * 3 / 10; - Main.PlaySound(SoundID.Item92, player.position); - for (int i = 0; i < 60; i++) - { - int d = Dust.NewDust(player.position, player.width, player.height, 88, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[d].noGravity = true; - Main.dust[d].velocity *= 5f; - } - return false; - } - if (bBlood && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " became a blood geyser."); - } - if ((bFlames || aFlames) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was consumed by the black flames."); - } - if (pFlames && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s flesh was melted by the plague."); - } - if ((hFlames || hInferno) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " fell prey to their sins."); - } - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - if (sCalDeathCount < 51) - { - sCalDeathCount++; - } - } - deathCount++; - if (player.whoAmI == Main.myPlayer && Main.netMode == 1) - { - DeathPacket(false); - } - if (CalamityWorld.ironHeart && areThereAnyDamnBosses) - { - KillPlayer(); - return false; - } - return true; - } - #endregion - - #region UseTimeMult - public override float UseTimeMultiplier(Item item) - { - if (silvaRanged) - { - if (item.ranged && !item.GetGlobalItem(mod).rogue && item.useTime > 3) - return (auricSet ? 1.2f : 1.1f); - } - if (silvaThrowing) - { - if (player.statLife > (int)((double)player.statLifeMax2 * 0.5) && - item.GetGlobalItem(mod).rogue && item.useTime > 3) - return 1.1f; - } - return 1f; - } - #endregion - - #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 ((cinnamonRoll && CalamityMod.fireWeaponList.Contains(item.type)) || (evergreenGin && CalamityMod.natureWeaponList.Contains(item.type))) - { - damage = (int)((double)damage * 1.15); - } - if (fireball && CalamityMod.fireWeaponList.Contains(item.type)) - { - 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 > 0.35) - useTimeBeeMultiplier = 0.35; - theBeeDamage = (int)((double)item.damage * useTimeBeeMultiplier); - } - } - else - { - theBeeDamage = 0; - } - if (!theBee) - { - theBeeDamage = 0; - } - } - - public override void GetWeaponKnockback(Item item, ref float knockback) - { - if (auricBoost) - { - knockback *= 1f + (1f - modStealth) * 0.5f; - } - if (whiskey) - { - knockback *= 1.04f; - } - if (tequila && Main.dayTime) - { - knockback *= 1.03f; - } - if (tequilaSunrise && Main.dayTime) - { - knockback *= 1.07f; - } - if (moscowMule) - { - knockback *= 1.09f; - } - } - #endregion - - #region MeleeEffects - public override void MeleeEffects(Item item, Rectangle hitbox) - { - bool isTrueMelee = item.melee && (item.shoot == 0 || (item.noMelee && item.noUseGraphic && item.useStyle == 5 && !CalamityMod.trueMeleeBoostExceptionList.Contains(item.type))); - if (isTrueMelee) - { - if (fungalSymbiote && 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.Mushroom, (int)((float)item.damage * 0.25f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); - } - } - if (aWeapon) - { - 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 (aChicken) - { - 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 (eGauntlet) - { - 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 (cryogenSoul) - { - 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 (xerocSet) - { - 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 (reaverBlast) - { - 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); - } - } - } - } - #endregion - - #region OnHitNPC - public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) - { - if (omegaBlueChestplate) - target.AddBuff(mod.BuffType("CrushDepth"), 240); - - if (eGauntlet) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - target.AddBuff(mod.BuffType("Plague"), 120, false); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); - if (Main.rand.Next(5) == 0) - { - target.AddBuff(mod.BuffType("GlacialState"), 120, false); - } - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); - target.AddBuff(BuffID.Poisoned, 120, false); - target.AddBuff(BuffID.OnFire, 120, false); - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - } - if (aWeapon) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - } - } - if (abyssalAmulet) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("CrushDepth"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("CrushDepth"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("CrushDepth"), 120, false); - } - } - if (dsSetBonus) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("DemonFlames"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("DemonFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("DemonFlames"), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(44, 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(44, 240, false); - } - else - { - target.AddBuff(44, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("HolyLight"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("HolyLight"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - if (alchFlask) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("Plague"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("Plague"), 240, false); - } - else - { - 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 - - #region OnHitNPCWithProj - public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit) - { - if (omegaBlueChestplate && proj.friendly && !target.friendly) - target.AddBuff(mod.BuffType("CrushDepth"), 240); - - if (proj.melee && silvaMelee && Main.rand.Next(4) == 0) - target.AddBuff(mod.BuffType("SilvaStun"), 20); - - if (abyssalAmulet) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("CrushDepth"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("CrushDepth"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("CrushDepth"), 120, false); - } - } - if (dsSetBonus) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("DemonFlames"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("DemonFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("DemonFlames"), 120, false); - } - } - 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) - { - target.AddBuff(mod.BuffType("Plague"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("Plague"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("Plague"), 120, false); - } - } - if (proj.melee) - { - if (eGauntlet) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - target.AddBuff(mod.BuffType("Plague"), 120, false); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); - if (Main.rand.Next(5) == 0) - { - target.AddBuff(mod.BuffType("GlacialState"), 120, false); - } - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); - target.AddBuff(BuffID.Poisoned, 120, false); - target.AddBuff(BuffID.OnFire, 120, false); - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - } - if (aWeapon) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(44, 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(44, 240, false); - } - else - { - target.AddBuff(44, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("HolyLight"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("HolyLight"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - } - 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, 90); - } - if (hiveMindLore) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - if (holyWrath) - { - target.AddBuff(mod.BuffType("HolyLight"), 600, false); - } - else if (providenceLore) - { - target.AddBuff(mod.BuffType("HolyLight"), 420, false); - } - if (proj.GetGlobalProjectile(mod).rogue) - { - if (player.meleeEnchant > 0) - { - if (player.meleeEnchant == 1) - { - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 2) - { - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 3) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 5) - { - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - } - if (player.meleeEnchant == 6) - { - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - } - if (player.meleeEnchant == 8) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 4) - { - target.AddBuff(BuffID.Midas, 120, false); - } - } - } - } - #endregion - - #region PvP - public override void OnHitPvp(Item item, Player target, int damage, bool crit) - { - if (omegaBlueChestplate) - target.AddBuff(mod.BuffType("CrushDepth"), 240); - - if (eGauntlet) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - target.AddBuff(mod.BuffType("Plague"), 120, false); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); - if (Main.rand.Next(5) == 0) - { - target.AddBuff(mod.BuffType("GlacialState"), 120, false); - } - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); - target.AddBuff(BuffID.Poisoned, 120, false); - target.AddBuff(BuffID.OnFire, 120, false); - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - } - if (aWeapon) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - } - } - if (abyssalAmulet) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("CrushDepth"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("CrushDepth"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("CrushDepth"), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(44, 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(44, 240, false); - } - else - { - target.AddBuff(44, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("HolyLight"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("HolyLight"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - if (alchFlask) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("Plague"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("Plague"), 240, false); - } - else - { - 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) - { - if (omegaBlueChestplate) - target.AddBuff(mod.BuffType("CrushDepth"), 240); - - if (proj.melee && silvaMelee && Main.rand.Next(4) == 0) - target.AddBuff(mod.BuffType("SilvaStun"), 20); - - if (abyssalAmulet) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("CrushDepth"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("CrushDepth"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("CrushDepth"), 120, false); - } - } - 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) - { - target.AddBuff(mod.BuffType("Plague"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("Plague"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("Plague"), 120, false); - } - } - if (proj.melee) - { - if (eGauntlet) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - target.AddBuff(mod.BuffType("Plague"), 120, false); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); - if (Main.rand.Next(5) == 0) - { - target.AddBuff(mod.BuffType("GlacialState"), 120, false); - } - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); - target.AddBuff(BuffID.Poisoned, 120, false); - target.AddBuff(BuffID.OnFire, 120, false); - target.AddBuff(BuffID.CursedInferno, 120, false); - target.AddBuff(BuffID.Frostburn, 120, false); - target.AddBuff(BuffID.Ichor, 120, false); - target.AddBuff(BuffID.Venom, 120, false); - } - if (aWeapon) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); - } - } - if (cryogenSoul || frostFlare) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(44, 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(44, 240, false); - } - else - { - target.AddBuff(44, 120, false); - } - } - if (yInsignia) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(mod.BuffType("HolyLight"), 360, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("HolyLight"), 240, false); - } - else - { - target.AddBuff(mod.BuffType("HolyLight"), 120, false); - } - } - if (ataxiaFire) - { - if (Main.rand.Next(4) == 0) - { - target.AddBuff(BuffID.OnFire, 720, false); - } - else if (Main.rand.Next(2) == 0) - { - target.AddBuff(BuffID.OnFire, 480, false); - } - else - { - target.AddBuff(BuffID.OnFire, 240, false); - } - } - } - 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, 90); - } - if (hiveMindLore) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - if (holyWrath) - { - target.AddBuff(mod.BuffType("HolyLight"), 600, false); - } - else if (providenceLore) - { - target.AddBuff(mod.BuffType("HolyLight"), 420, false); - } - if (proj.GetGlobalProjectile(mod).rogue) - { - if (player.meleeEnchant > 0) - { - if (player.meleeEnchant == 1) - { - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 2) - { - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 3) - { - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - } - if (player.meleeEnchant == 5) - { - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - } - if (player.meleeEnchant == 6) - { - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - } - if (player.meleeEnchant == 8) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - } - if (player.meleeEnchant == 4) - { - target.AddBuff(BuffID.Midas, 120, false); - } - } - } - } - #endregion - - #region ModifyHitNPC - public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit) - { - #region MultiplierBoosts - double damageMult = 1.0; - if (silvaMelee && Main.rand.Next(4) == 0 && item.melee) - { - damageMult += 4.0; - } - if (enraged && !Config.BossRushXerocCurse) - { - damageMult += 1.25; - } - if (CalamityWorld.revenge && Config.AdrenalineAndRage) - { - bool DHorHoD = (draedonsHeart || heartOfDarkness); - if (rageMode && adrenalineMode) - { - if (item.melee) - { - damageMult += (CalamityWorld.death ? (DHorHoD ? 8.9 : 8.0) : (DHorHoD ? 2.3 : 2.0)); - } - } - else if (rageMode) - { - if (item.melee) - { - 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 (item.melee) - { - 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")) - { - ataraxiaDamageBoostCancelTimer = 1200; - if (ataraxiaDamageBoostCooldown <= 0) - { - ataraxiaDamageBoostCooldown = 90; - if (ataraxiaDamageBoost < 0.3f) - ataraxiaDamageBoost += 0.01f; - } - } - 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, 120, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num17].ranged = false; - } - } - if (bloodflareMelee && item.melee) - { - 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); - } - } - if (Config.ProficiencyEnabled) - { - if (gainLevelCooldown <= 0) - { - gainLevelCooldown = 120; - if (item.melee && meleeLevel <= 12500) - { - if (!Main.hardMode && meleeLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && meleeLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - meleeLevel++; - if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 - meleeLevel++; - shootFireworksLevelUpMelee = true; - if (Main.netMode == 1) - { - LevelPacket(false, 0); - } - } - } - } - if (CalamityWorld.revenge && Config.AdrenalineAndRage) - { - if (item.melee) - { - int stressGain = (int)((double)damage * 0.1); - int stressMaxGain = 10; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - stress += stressGain; - if (stress >= stressMax) - { - stress = stressMax; - } - } - } - } - } - - 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) - { - 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].GetGlobalItem(mod).rogue) || - 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; - } - else if (proj.type == ProjectileID.InfernoFriendlyBlast) - { - damageMult += 0.33; - } - 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) - { - if (hasClassType) - damage += theBeeDamage; - } - if (proj.type == mod.ProjectileType("AcidBullet")) - { - int defenseAdd = (int)((double)target.defense * 0.1 * ((double)damage / 50.0)); //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"))) - { - damage += Main.rand.Next(20, 31); - } - #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].GetGlobalItem(mod).rogue) && - player.inventory[player.selectedItem].hammer == 0 && - player.inventory[player.selectedItem].pick == 0 && - player.inventory[player.selectedItem].axe == 0) - { - damage = (int)((double)damage * 0.75); - } - } - 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; - case ProjectileID.SpectreWrath: - 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++) - { - 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, 120, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num17].ranged = false; - } - } - if (tarraRanged && crit && proj.ranged) - { - 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) - { - 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 (bloodflareThrowing && proj.GetGlobalProjectile(mod).rogue && crit && Main.rand.Next(2) == 0) - { - if (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; - } - } - } - 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); - } - } - if (proj.type == mod.ProjectileType("AtaraxiaMain") || proj.type == mod.ProjectileType("AtaraxiaHoming") || - proj.type == mod.ProjectileType("AtaraxiaSplit") || proj.type == mod.ProjectileType("AtaraxiaSide")) - { - ataraxiaDamageBoostCancelTimer = 1200; - if (proj.type == mod.ProjectileType("AtaraxiaMain")) - { - if (ataraxiaDamageBoost < 0.3f) - ataraxiaDamageBoost += 0.0025f; - } - } - if (Config.ProficiencyEnabled) - { - if (gainLevelCooldown <= 0) //max is 12501 to avoid setting off fireworks forever - { - gainLevelCooldown = 120; //2 seconds - if (proj.melee && meleeLevel <= 12500) - { - if (!Main.hardMode && meleeLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && meleeLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - meleeLevel++; - if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 - meleeLevel++; - shootFireworksLevelUpMelee = true; - if (Main.netMode == 1) - { - LevelPacket(false, 0); - } - } - else if (proj.ranged && rangedLevel <= 12500) - { - if (!Main.hardMode && rangedLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && rangedLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - rangedLevel++; - if (fasterRangedLevel && rangedLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 - rangedLevel++; - shootFireworksLevelUpRanged = true; - if (Main.netMode == 1) - { - LevelPacket(false, 1); - } - } - else if (proj.magic && magicLevel <= 12500) - { - if (!Main.hardMode && magicLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && magicLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - magicLevel++; - if (fasterMagicLevel && magicLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 - magicLevel++; - shootFireworksLevelUpMagic = true; - if (Main.netMode == 1) - { - LevelPacket(false, 2); - } - } - else if (isSummon && summonLevel <= 12500) - { - if (!Main.hardMode && summonLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && summonLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - summonLevel++; - if (fasterSummonLevel && summonLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 - summonLevel++; - shootFireworksLevelUpSummon = true; - if (Main.netMode == 1) - { - LevelPacket(false, 3); - } - } - else if (proj.GetGlobalProjectile(mod).rogue && rogueLevel <= 12500) - { - if (!Main.hardMode && rogueLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && rogueLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - rogueLevel++; - if (fasterRogueLevel && rogueLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 - rogueLevel++; - shootFireworksLevelUpRogue = true; - if (Main.netMode == 1) - { - LevelPacket(false, 4); - } - } - } - } - if (raiderTalisman && raiderStack < 250 && proj.GetGlobalProjectile(mod).rogue && crit) - { - raiderStack++; - } - if (CalamityWorld.revenge && Config.AdrenalineAndRage) - { - if (isTrueMelee) - { - int stressGain = (int)((double)damage * 0.1); - int stressMaxGain = 10; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - stress += stressGain; - if (stress >= stressMax) - { - stress = stressMax; - } - } - } - } - } - #endregion - - #region ModifyHitByNPC - public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) - { - if (triumph) - { - double HPMultiplier = 0.15 * (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 - damage /= 2; - } - if (tarraDefense && tarraMelee) - { - damage /= 2; - } - if (bloodflareMelee && bloodflareFrenzyTimer > 0) - { - damage /= 2; - } - if (silvaMelee && silvaCountdown <= 0 && hasSilvaEffect) - { - damage = (int)((double)damage * 0.8); - } - if (aBulwarkRare) - { - aBulwarkRareMeleeBoostTimer += 3 * damage; - if (aBulwarkRareMeleeBoostTimer > 900) - aBulwarkRareMeleeBoostTimer = 900; - } - if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) - { - if (CalamityWorld.revenge && Config.AdrenalineAndRage && !npc.SpawnedFromStatue) - { - gainRageCooldown = 60; - int stressGain = damage * (profanedRage ? 3 : 2); - int stressMaxGain = 2500; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - stress += stressGain; - if (stress >= stressMax) - { - stress = stressMax; - } - } - } - } - #endregion - - #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); - } - if (beeResist) - { - if (CalamityMod.beeProjectileList.Contains(proj.type)) - damage = (int)((double)damage * 0.75); - } - if (Main.hardMode && Main.expertMode && !CalamityWorld.spawnedHardBoss && proj.active && !proj.friendly && proj.hostile && damage > 0) - { - if (CalamityMod.hardModeNerfList.Contains(proj.type)) - damage = (int)((double)damage * 0.75); - } - if (CalamityWorld.revenge) - { - if (CalamityMod.revengeanceProjectileBuffList.Contains(proj.type)) - damage = (int)((double)damage * 1.25); - } - if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) - { - if (CalamityWorld.revenge && Config.AdrenalineAndRage && !CalamityMod.trapProjectileList.Contains(proj.type)) - { - gainRageCooldown = 60; - int stressGain = damage * (profanedRage ? 3 : 2); - int stressMaxGain = 2500; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - stress += stressGain; - if (stress >= stressMax) - { - stress = stressMax; - } - } - } - } - #endregion - - #region OnHit - public override void OnHitByNPC(NPC npc, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - if (npc.type == NPCID.SkeletronPrime || npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeSaw) - { - player.AddBuff(BuffID.Bleeding, 300); - } - else if (npc.type == NPCID.Spazmatism && npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) - { - player.AddBuff(BuffID.Bleeding, 300); - } - else if (npc.type == NPCID.Plantera && npc.life < npc.lifeMax / 2) - { - player.AddBuff(BuffID.Poisoned, 180); - player.AddBuff(BuffID.Bleeding, 300); - } - else if (npc.type == NPCID.PlanterasTentacle) - { - player.AddBuff(BuffID.Poisoned, 120); - player.AddBuff(BuffID.Bleeding, 180); - } - else if (npc.type == NPCID.Golem || npc.type == NPCID.GolemFistLeft || npc.type == NPCID.GolemFistRight || - npc.type == NPCID.GolemHead || npc.type == NPCID.GolemHeadFree) - { - player.AddBuff(BuffID.BrokenArmor, 180); - } - } - } - - public override void OnHitByProjectile(Projectile proj, int damage, bool crit) - { - if (CalamityWorld.revenge && proj.hostile) - { - if (proj.type == ProjectileID.FrostBeam && !player.frozen && !gState) - { - player.AddBuff(mod.BuffType("GlacialState"), 120); - } - else if (proj.type == ProjectileID.DeathLaser) - { - player.AddBuff(BuffID.OnFire, 180); - } - else if (proj.type == ProjectileID.Skull) - { - player.AddBuff(BuffID.Weak, 120); - } - else if (proj.type == ProjectileID.ThornBall) - { - player.AddBuff(BuffID.Poisoned, 180); - } - else if (proj.type == ProjectileID.CultistBossIceMist) - { - player.AddBuff(BuffID.Frozen, 60); - player.AddBuff(BuffID.Chilled, 120); - player.AddBuff(BuffID.Frostburn, 240); - } - else if (proj.type == ProjectileID.CultistBossLightningOrbArc) - { - player.AddBuff(BuffID.Electrified, 120); - } - } - if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.Next(20) == 0) - { - player.statLife += damage; - player.HealEffect(damage); - proj.hostile = false; - proj.friendly = true; - 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; - player.statLife += healAmt; - player.HealEffect(healAmt); - proj.hostile = false; - proj.friendly = true; - proj.velocity.X = -proj.velocity.X; - proj.velocity.Y = -proj.velocity.Y; - } - } - #endregion - - #region Fishing - public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) - { - Point point = player.Center.ToTileCoordinates(); - bool abyssPosX = false; - if (CalamityWorld.abyssSide) - { - if (point.X < 380) - { - abyssPosX = true; - } - } - else - { - if (point.X > Main.maxTilesX - 380) - { - abyssPosX = true; - } - } - if (junk) - { - if (abyssPosX && liquidType == 0 && power < 40) - { - caughtType = mod.ItemType("PlantyMush"); - } - return; - } - /*if (abyssPosX && liquidType == 0 && (bait.type == ItemID.GoldWorm || bait.type == ItemID.GoldGrasshopper || bait.type == ItemID.GoldButterfly) && power > 150) - { - if (Main.netMode != 1) - { - CalamityGlobalNPC.OldDukeSpawn(player.whoAmI, mod.NPCType("OldDuke")); - } - else - { - NetMessage.SendData(61, -1, -1, null, player.whoAmI, (float)mod.NPCType("OldDuke"), 0f, 0f, 0, 0, 0); - } - switch (Main.rand.Next(4)) - { - case 0: caughtType = mod.ItemType("IronBoots"); break; //movement acc - case 1: caughtType = mod.ItemType("DepthCharm"); break; //regen acc - case 2: caughtType = mod.ItemType("AnechoicPlating"); break; //defense acc - case 3: caughtType = mod.ItemType("StrangeOrb"); break; //light pet - } - return; - }*/ - if (power >= 20) - { - if (power >= 40) - { - if (abyssPosX && liquidType == 0 && Main.rand.Next(15) == 0 && power < 80) - { - caughtType = mod.ItemType("PlantyMush"); - } - if (power >= 60) - { - if (player.FindBuffIndex(BuffID.Gills) > -1 && NPC.downedPlantBoss && liquidType == 0 && Main.rand.Next(25) == 0 && power < 160) - { - caughtType = mod.ItemType("Floodtide"); - } - if (abyssPosX && liquidType == 0 && Main.rand.Next(25) == 0 && power < 160) - { - caughtType = mod.ItemType("AlluringBait"); - } - if (power >= 80) - { - if (abyssPosX && Main.hardMode && liquidType == 0 && Main.rand.Next(15) == 0 && power < 210) - { - switch (Main.rand.Next(4)) - { - case 0: caughtType = mod.ItemType("IronBoots"); break; //movement acc - case 1: caughtType = mod.ItemType("DepthCharm"); break; //regen acc - case 2: caughtType = mod.ItemType("AnechoicPlating"); break; //defense acc - case 3: caughtType = mod.ItemType("StrangeOrb"); break; //light pet - } - } - if (power >= 110) - { - if (abyssPosX && liquidType == 0 && Main.rand.Next(25) == 0 && power < 240) - { - caughtType = mod.ItemType("AbyssalAmulet"); - } - } - } - } - } - } - } - #endregion - - #region FrameEffects - public override void FrameEffects() - { - if ((snowmanPower || snowmanForce) && !snowmanHide) - { - player.legs = mod.GetEquipSlot("PopoLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("PopoBody", EquipType.Body); - player.head = (snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head)); - } - else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) - { - player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); - player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); - } - else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) - { - player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); - } - else if ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide) - { - player.legs = mod.GetEquipSlot("SirenLegAlt", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); - } - - if (CalamityWorld.defiled) - Defiled(); - - if (weakPetrification) - WeakPetrification(); - - if (CalamityWorld.bossRushActive) - BossRushMovementChanges(); - } - #endregion - - #region Limitations - private void WeakPetrification() - { - player.doubleJumpCloud = false; - player.doubleJumpSandstorm = false; - player.doubleJumpBlizzard = false; - player.rocketBoots = 0; - player.jumpBoost = false; - player.slowFall = false; - player.gravControl = false; - player.gravControl2 = false; - player.jumpSpeedBoost = 0f; - player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5); - player.balloon = -1; - weakPetrification = true; - } - - private void Defiled() - { - 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 || SCalLore || (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0)) - { - 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; - } - if (godSlayerReflect && Main.rand.Next(50) == 0) - { - return false; - } - - if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) - { - playSound = false; - Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 4, 1f, 0f); //metal hit noise - } - else if (((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) || ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide)) - { - 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.85); - } - if (CalamityWorld.revenge) - { - if (!CalamityWorld.downedBossAny) - damage = (int)((double)damage * 0.8); - } - 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 * 0.9); - } - #endregion - - if ((godSlayerDamage && damage <= 80) || damage < 1) - { - damage = 1; - } - - #region HealingEffects - if (revivifyTimer > 0) - { - int healAmt = damage / 20; - player.statLife += healAmt; - player.HealEffect(healAmt); - } - if (daedalusAbsorb && Main.rand.Next(10) == 0) - { - int healAmt = damage / 2; - player.statLife += healAmt; - player.HealEffect(healAmt); - } - if (absorber) - { - int healAmt = damage / 20; - player.statLife += healAmt; - player.HealEffect(healAmt); - } - #endregion - - return true; - } - - public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) - { - modStealth = 1f; - ataraxiaDamageBoost = 0f; - if (player.whoAmI == Main.myPlayer) - { - if (rageMode) - { - stress = 0; - if (player.FindBuffIndex(mod.BuffType("RageMode")) > -1) { player.ClearBuff(mod.BuffType("RageMode")); } - } - if (amidiasBlessing) - { - player.ClearBuff(mod.BuffType("AmidiasBlessing")); - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 96); - } - if (!adrenalineMode && adrenaline != adrenalineMax) - { - adrenaline = 0; - } - if ((gShell || fabledTortoise) && !player.panic) - { - player.AddBuff(mod.BuffType("ShellBoost"), 300); - } - if (abyssalDivingSuitPlates && damage > 50) - { - abyssalDivingSuitPlateHits++; - if (abyssalDivingSuitPlateHits >= 3) - { - Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 14); - player.AddBuff(mod.BuffType("AbyssalDivingSuitPlatesBroken"), 10830); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.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 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 6, 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, 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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.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; - } - } - } - if (sirenIce) - { - Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 7); - player.AddBuff(mod.BuffType("IceShieldBrokenBuff"), 1800); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 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 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 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, 67, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - if (tarraMelee) - { - if (Main.rand.Next(4) == 0) - { - player.AddBuff(mod.BuffType("TarraLifeRegen"), 120); - } - } - else if (xerocSet) - { - player.AddBuff(mod.BuffType("XerocRage"), 240); - player.AddBuff(mod.BuffType("XerocWrath"), 240); - } - else if (reaverBlast) - { - player.AddBuff(mod.BuffType("ReaverRage"), 180); - } - if (fBarrier || ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3)) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); - for (int m = 0; m < 200; m++) - { - if (Main.npc[m].active && !Main.npc[m].friendly) - { - float distance = (Main.npc[m].Center - player.Center).Length(); - float num10 = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); - if (num10 > 500f) - { - num10 = 500f + (num10 - 500f) * 0.75f; - } - if (num10 > 700f) - { - num10 = 700f + (num10 - 700f) * 0.5f; - } - if (num10 > 900f) - { - num10 = 900f + (num10 - 900f) * 0.25f; - } - if (distance < num10) - { - float num11 = (float)Main.rand.Next(90 + (int)damage / 3, 240 + (int)damage / 2); - Main.npc[m].AddBuff(mod.BuffType("GlacialState"), (int)num11, false); - } - } - } - } - if (aBrain) - { - for (int m = 0; m < 200; m++) - { - if (Main.npc[m].active && !Main.npc[m].friendly) - { - float arg_67A_0 = (Main.npc[m].Center - player.Center).Length(); - float num10 = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); - if (num10 > 500f) - { - num10 = 500f + (num10 - 500f) * 0.75f; - } - if (num10 > 700f) - { - num10 = 700f + (num10 - 700f) * 0.5f; - } - if (num10 > 900f) - { - num10 = 900f + (num10 - 900f) * 0.25f; - } - if (arg_67A_0 < num10) - { - float num11 = (float)Main.rand.Next(90 + (int)damage / 3, 300 + (int)damage / 2); - Main.npc[m].AddBuff(31, (int)num11, false); - } - } - } - Projectile.NewProjectile(player.Center.X + (float)Main.rand.Next(-40, 40), player.Center.Y - (float)Main.rand.Next(20, 60), player.velocity.X * 0.3f, player.velocity.Y * 0.3f, 565, 0, 0f, player.whoAmI, 0f, 0f); - } - } - if (player.ownedProjectileCounts[mod.ProjectileType("Drataliornus")] != 0) - { - for (int i = 0; i < 1000; i++) - { - if (Main.projectile[i].active && Main.projectile[i].type == mod.ProjectileType("Drataliornus") && Main.projectile[i].owner == player.whoAmI) - { - Main.projectile[i].Kill(); - break; - } - } - player.AddBuff(mod.BuffType("Backfire"), 360); - if (player.wingTime > player.wingTimeMax / 2) - player.wingTime = player.wingTimeMax / 2; - } - } - - public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) - { - if (pArtifact) - { - player.AddBuff(mod.BuffType("BurntOut"), 300, true); - } - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")) && CalamityWorld.revenge) - { - if (damage < 100) - { - KillPlayer(); - string key = "Mods.CalamityMod.SupremeBossText28"; - 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); - } - } - } - bool hardMode = Main.hardMode; - if (player.whoAmI == Main.myPlayer) - { - if (cTracers && damage > 200) - { - player.immuneTime += 60; - } - if (godSlayerThrowing && damage > 80) - { - player.immuneTime += 30; - } - if (statigelSet && damage > 100) - { - player.immuneTime += 30; - } - if (dAmulet) - { - if (damage == 1.0) - { - player.immuneTime += 10; - } - else - { - player.immuneTime += 20; - } - } - if (fabsolVodka) - { - if (damage == 1.0) - { - player.immuneTime += 5; - } - else - { - player.immuneTime += 10; - } - } - if (CalamityWorld.bossRushActive && Config.BossRushImmunityFrameCurse) - { - bossRushImmunityFrameCurseTimer = 300 + player.immuneTime; - } - if (damage > 25) - { - if (aeroSet) - { - for (int n = 0; n < 4; n++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = player.position.X + (float)(player.width / 2) - vector.X; - float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 20; - 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, mod.ProjectileType("StickyFeatherAero"), 20, 1f, player.whoAmI, 0f, 0f); - } - } - } - if (aBulwark) - { - 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); - Vector2 vector = new Vector2(x, y); - float num13 = player.position.X + (float)(player.width / 2) - vector.X; - float num14 = player.position.Y + (float)(player.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; - int num17 = Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("AstralStar"), 320, 5f, player.whoAmI, 0f, 0f); - } - } - if (dAmulet) - { - for (int n = 0; n < 3; n++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = player.position.X + (float)(player.width / 2) - vector.X; - float num14 = player.position.Y + (float)(player.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; - int num17 = Projectile.NewProjectile(x, y, num13, num14, 92, 130, 4f, player.whoAmI, 0f, 0f); - Main.projectile[num17].usesLocalNPCImmunity = true; - Main.projectile[num17].localNPCHitCooldown = 5; - Main.projectile[num17].ranged = false; - } - } - } - if (fCarapace) - { - if (damage > 0) - { - Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 45); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int fDamage = 56; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - float xPos = Main.rand.Next(2) == 0 ? player.Center.X + 100 : player.Center.X - 100; - Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); - int spore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); - Main.projectile[spore1].timeLeft = 120; - Main.projectile[spore2].timeLeft = 120; - } - } - } - } - if (aSpark) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 93); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - 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++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int spark1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Spark"), sDamage, 1.25f, player.whoAmI, 0f, 0f); - int spark2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Spark"), sDamage, 1.25f, player.whoAmI, 0f, 0f); - Main.projectile[spark1].timeLeft = 120; - Main.projectile[spark2].timeLeft = 120; - } - } - } - } - if (ataxiaBlaze && Main.rand.Next(5) == 0) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); - int eDamage = 100; - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("ChaosBlaze"), eDamage, 1f, player.whoAmI, 0f, 0f); - } - } - } - else if (daedalusShard) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int sDamage = 27; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 8; i++) - { - float randomSpeed = (float)Main.rand.Next(1, 7); - float randomSpeed2 = (float)Main.rand.Next(1, 7); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int shard = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, 90, sDamage, 1f, player.whoAmI, 0f, 0f); - int shard2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, 90, sDamage, 1f, player.whoAmI, 0f, 0f); - Main.projectile[shard].ranged = false; - Main.projectile[shard2].ranged = false; - } - } - } - } - else if (reaverSpore) - { - if (damage > 0) - { - Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 1); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int rDamage = 58; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - float xPos = Main.rand.Next(2) == 0 ? player.Center.X + 100 : player.Center.X - 100; - Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 567, rDamage, 2f, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 568, rDamage, 2f, player.whoAmI, 0f, 0f); - } - } - } - } - else if (godSlayerDamage) - { - if (damage > 80) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 73); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GodKiller"), 900, 5f, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GodKiller"), 900, 5f, player.whoAmI, 0f, 0f); - } - } - } - } - else if (godSlayerMage) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerBlaze"), (auricSet ? 2400 : 1200), 1f, player.whoAmI, 0f, 0f); - } - } - } - else if (dsSetBonus) - { - if (player.whoAmI == Main.myPlayer) - { - for (int l = 0; l < 2; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, 294, 3000, 7f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - } - for (int l = 0; l < 5; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, 45, 5000, 7f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - } - } - } - } - #endregion - - #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; - bool specialDeath = CalamityWorld.ironHeart && areThereAnyDamnBosses; - bool flag; - int coinsOwned = (int)Utils.CoinsCount(out flag, player.inventory, new int[0]); - if (Main.myPlayer == player.whoAmI) - { - player.lostCoins = coinsOwned; - player.lostCoinString = Main.ValueToCoins(player.lostCoins); - } - if (Main.myPlayer == player.whoAmI) - { - Main.mapFullscreen = false; - } - if (Main.myPlayer == player.whoAmI) - { - player.trashItem.SetDefaults(0, false); - if (specialDeath) - { - player.difficulty = 2; - player.DropItems(); - player.KillMeForGood(); - } - else if (player.difficulty == 0) - { - for (int i = 0; i < 59; i++) - { - if (player.inventory[i].stack > 0 && ((player.inventory[i].type >= 1522 && player.inventory[i].type <= 1527) || player.inventory[i].type == 3643)) - { - int num = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, player.inventory[i].type, 1, false, 0, false, false); - Main.item[num].netDefaults(player.inventory[i].netID); - Main.item[num].Prefix((int)player.inventory[i].prefix); - Main.item[num].stack = player.inventory[i].stack; - Main.item[num].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; - Main.item[num].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; - Main.item[num].noGrabDelay = 100; - Main.item[num].favorited = false; - Main.item[num].newAndShiny = false; - if (Main.netMode == 1) - { - NetMessage.SendData(21, -1, -1, null, num, 0f, 0f, 0f, 0, 0, 0); - } - player.inventory[i].SetDefaults(0, false); - } - } - } - else if (player.difficulty == 1) - { - player.DropItems(); - } - else if (player.difficulty == 2) - { - player.DropItems(); - player.KillMeForGood(); - } - } - if (specialDeath) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/IronHeartDeath"), (int)player.position.X, (int)player.position.Y); - } - else - { - Main.PlaySound(5, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); - } - player.headVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; - player.bodyVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; - player.legVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; - player.headVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); - player.bodyVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); - player.legVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); - if (player.stoned) - { - player.headPosition = Vector2.Zero; - player.bodyPosition = Vector2.Zero; - player.legPosition = Vector2.Zero; - } - for (int j = 0; j < 100; j++) - { - Dust.NewDust(player.position, player.width, player.height, (specialDeath ? 91 : 235), (float)(2 * 0), -2f, 0, default(Color), 1f); - } - player.mount.Dismount(player); - player.dead = true; - player.respawnTimer = 600; - if (Main.expertMode) - { - player.respawnTimer = (int)((double)player.respawnTimer * 1.5); - } - player.immuneAlpha = 0; - player.palladiumRegen = false; - player.iceBarrier = false; - player.crystalLeaf = false; - PlayerDeathReason damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); - NetworkText deathText = damageSource.GetDeathText(player.name); - if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(deathText, new Color(225, 25, 25), -1); - } - else if (Main.netMode == 0) - { - Main.NewText(deathText.ToString(), 225, 25, 25, false); - } - if (Main.netMode == 1 && player.whoAmI == Main.myPlayer) - { - NetMessage.SendPlayerDeath(player.whoAmI, damageSource, (int)1000.0, 0, false, -1, -1); - } - if (player.whoAmI == Main.myPlayer && player.difficulty == 0) - { - player.DropCoins(); - } - player.DropTombstone(coinsOwned, deathText, 0); - if (player.whoAmI == Main.myPlayer) - { - try - { - WorldGen.saveToonWhilePlaying(); - } - catch - { - } - } - } - #endregion - - #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); - 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 = 1500f * player.meleeDamage; - float num2 = 15f; - 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); - int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), 1000, 20f, Main.myPlayer, 0f, 0f); - Main.projectile[num6].Kill(); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyEruption"), 780, 5f, Main.myPlayer, 0f, 0f); - } - nPC.immune[player.whoAmI] = 6; - nPC.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = 4; - } - } - } - } - if (dashMod == 3 && 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 = 500f * player.meleeDamage; - float num2 = 12f; - 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); - int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), 500, 15f, Main.myPlayer, 0f, 0f); - Main.projectile[num6].Kill(); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyEruption"), 380, 5f, Main.myPlayer, 0f, 0f); - } - nPC.immune[player.whoAmI] = 6; - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = 4; - } - } - } - } - if (dashMod == 2 && 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 = 100f * player.meleeDamage; - float num2 = 9f; - 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); - int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosion"), 100, 15f, Main.myPlayer, 0f, 0f); - Main.projectile[num6].Kill(); - } - nPC.immune[player.whoAmI] = 6; - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = 4; - } - } - } - } - if (dashMod == 1 && 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].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0)) - { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) - { - OnDodge(); - break; - } - } - } - for (int i = 0; i < 1000; i++) - { - if ((Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0)) - { - Projectile proj = Main.projectile[i]; - Rectangle rect = proj.getRect(); - if (rectangle.Intersects(rect)) - { - OnDodge(); - break; - } - } - } - } - if (player.dashDelay > 0) - { - return; - } - if (player.dashDelay < 0) - { - float num7 = 12f; - float num8 = 0.985f; - float num9 = Math.Max(player.accRunSpeed, player.maxRunSpeed); - float num10 = 0.94f; - int num11 = 20; - if (dashMod == 1) - { - for (int k = 0; k < 2; k++) - { - int num12; - if (player.velocity.Y == 0f) - { - num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)player.height - 4f), player.width, 8, 235, 0f, 0f, 100, default(Color), 1.4f); - } - else - { - num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)(player.height / 2) - 8f), player.width, 16, 235, 0f, 0f, 100, default(Color), 1.4f); - } - Main.dust[num12].velocity *= 0.1f; - Main.dust[num12].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - } - else if (dashMod == 2) - { - for (int m = 0; m < 4; m++) - { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 246, 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; - } - } - } - else if (dashMod == 3) - { - for (int m = 0; m < 12; m++) - { - int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 244, 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 = 14f; //14 - } - else if (dashMod == 4) - { - 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, 244, 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 = 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; - if (player.velocity.X > num7 || player.velocity.X < -num7) - { - player.velocity.X = player.velocity.X * num8; - return; - } - if (player.velocity.X > num9 || player.velocity.X < -num9) - { - player.velocity.X = player.velocity.X * num10; - return; - } - player.dashDelay = num11; - if (player.velocity.X < 0f) - { - player.velocity.X = -num9; - return; - } - if (player.velocity.X > 0f) - { - player.velocity.X = num9; - return; - } - } - } - else if (dashMod > 0 && !player.mount.Active) - { - if (dashMod == 1) - { - int num16 = 0; - bool flag = false; - if (dashTimeMod > 0) - { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) - { - num16 = 1; - flag = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - num16 = -1; - flag = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (flag) - { - player.velocity.X = 14.5f * (float)num16; //eoc dash amount - Point point = (player.Center + new Vector2((float)(num16 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point2 = (player.Center + new Vector2((float)(num16 * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point.X, point.Y) || WorldGen.SolidOrSlopedTile(point2.X, point2.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num17 = 0; num17 < 20; num17++) - { - int num18 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 235, 0f, 0f, 100, default(Color), 2f); - Dust expr_CDB_cp_0 = Main.dust[num18]; - expr_CDB_cp_0.position.X = expr_CDB_cp_0.position.X + (float)Main.rand.Next(-5, 6); - Dust expr_D02_cp_0 = Main.dust[num18]; - expr_D02_cp_0.position.Y = expr_D02_cp_0.position.Y + (float)Main.rand.Next(-5, 6); - Main.dust[num18].velocity *= 0.2f; - Main.dust[num18].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; - Main.dust[num18].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); - } - return; - } - } - else if (dashMod == 2) - { - 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 = 16.9f * (float)num23; //tabi dash amount - 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 < 20; num24++) - { - int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 246, 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 == 3) - { - 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 = 21.9f * (float)num23; //solar dash amount - 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 < 40; num24++) - { - int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 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 == 4) - { - 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 = 23.9f * (float)num23; //slighty more powerful solar dash - 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, 244, 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 == 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; - } - } - } - } - } - - private void OnDodge() - { - if (player.whoAmI == Main.myPlayer && dodgeScarf && !scarfCooldown) - { - player.AddBuff(mod.BuffType("ScarfMeleeBoost"), 540); - player.AddBuff(mod.BuffType("ScarfCooldown"), (player.chaosState ? 1800 : 900)); - player.immune = true; - player.immuneTime = 60; - if (player.longInvince) - { - player.immuneTime += 40; - } - for (int k = 0; k < player.hurtCooldowns.Length; k++) - { - player.hurtCooldowns[k] = player.immuneTime; - } - for (int j = 0; j < 100; j++) - { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 235, 0f, 0f, 100, default(Color), 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.4f; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.Next(2) == 0) - { - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].noGravity = true; - } - } - if (player.whoAmI == Main.myPlayer) - { - NetMessage.SendData(62, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); - } - } - } - - public void ModHorizontalMovement() - { - float num = (player.accRunSpeed + player.maxRunSpeed) / 2f; - if (player.controlLeft && player.velocity.X > -player.accRunSpeed && player.dashDelay >= 0) - { - if (player.velocity.X < -num && player.velocity.Y == 0f && !player.mount.Active) - { - int num3 = 0; - if (player.gravDir == -1f) - { - num3 -= player.height; - } - if (dashMod == 1) - { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 1.5f); - 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 == 2) - { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 2.5f); - 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 == 3) - { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -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 == 4) - { - int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -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 == 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) - { - if (player.velocity.X > num && player.velocity.Y == 0f && !player.mount.Active) - { - int num8 = 0; - if (player.gravDir == -1f) - { - num8 -= player.height; - } - if (dashMod == 1) - { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 1.5f); - 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 == 2) - { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 2.5f); - 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 == 3) - { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -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 == 4) - { - int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -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 == 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 - - #region Drawing - public static readonly PlayerLayer MiscEffectsBack = new PlayerLayer("CalamityMod", "MiscEffectsBack", PlayerLayer.MiscEffectsBack, delegate (PlayerDrawInfo drawInfo) - { - if (drawInfo.shadow != 0f) - { - return; - } - Player drawPlayer = drawInfo.drawPlayer; - Mod mod = ModLoader.GetMod("CalamityMod"); - CalamityPlayer modPlayer = drawPlayer.GetModPlayer(mod); - if (modPlayer.sirenIce) - { - Texture2D texture = mod.GetTexture("ExtraTextures/IceShield"); - int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); - int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); //4 - DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.Cyan, 0f, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, SpriteEffects.None, 0); - Main.playerDrawData.Add(data); - } - if (modPlayer.amidiasBlessing) - { - Texture2D texture = mod.GetTexture("ExtraTextures/AmidiasBubble"); - int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); - int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); //4 - DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.White, 0f, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, SpriteEffects.None, 0); - Main.playerDrawData.Add(data); - } - }); - - public static readonly PlayerLayer MiscEffects = new PlayerLayer("CalamityMod", "MiscEffects", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo drawInfo) - { - if (drawInfo.shadow != 0f) - { - return; - } - Player drawPlayer = drawInfo.drawPlayer; - Mod mod = ModLoader.GetMod("CalamityMod"); - Item item = drawPlayer.inventory[drawPlayer.selectedItem]; - if (!drawPlayer.frozen && - ((drawPlayer.itemAnimation > 0 && item.useStyle != 0) || (item.holdStyle > 0 && !drawPlayer.pulley)) && - item.type > 0 && - !drawPlayer.dead && - !item.noUseGraphic && - (!drawPlayer.wet || !item.noWet)) - { - Vector2 vector = drawPlayer.position + (drawPlayer.itemLocation - drawPlayer.position); - SpriteEffects effect = SpriteEffects.FlipHorizontally; - if (drawPlayer.gravDir == 1f) - { - if (drawPlayer.direction == 1) - { - effect = SpriteEffects.None; - } - else - { - effect = SpriteEffects.FlipHorizontally; - } - } - else - { - if (drawPlayer.direction == 1) - { - effect = SpriteEffects.FlipVertically; - } - else - { - effect = (SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically); - } - } - if (item.type == mod.ItemType("DeathhailStaff")) - { - Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/DeathhailStaffGlow"); - float num104 = drawPlayer.itemRotation + 0.785f * (float)drawPlayer.direction; - int num105 = 0; - int num106 = 0; - Vector2 zero3 = new Vector2(0f, (float)Main.itemTexture[item.type].Height); - if (drawPlayer.gravDir == -1f) - { - if (drawPlayer.direction == -1) - { - num104 += 1.57f; - zero3 = new Vector2((float)Main.itemTexture[item.type].Width, 0f); - num105 -= Main.itemTexture[item.type].Width; - } - else - { - num104 -= 1.57f; - zero3 = Vector2.Zero; - } - } - else if (drawPlayer.direction == -1) - { - zero3 = new Vector2((float)Main.itemTexture[item.type].Width, (float)Main.itemTexture[item.type].Height); - num105 -= Main.itemTexture[item.type].Width; - } - DrawData data = new DrawData(texture, - new Vector2((float)((int)(vector.X - Main.screenPosition.X + zero3.X + (float)num105)), (float)((int)(vector.Y - Main.screenPosition.Y + (float)num106))), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - num104, - zero3, - item.scale, - effect, - 0); - Main.playerDrawData.Add(data); - } - else if (item.type == mod.ItemType("Deathwind")) - { - Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/DeathwindGlow"); - Vector2 vector13 = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)); - Vector2 vector14 = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)); - int num107 = (int)vector14.X - 10; - vector13.Y = vector14.Y; - Vector2 origin4 = new Vector2(-(float)num107, (float)(Main.itemTexture[item.type].Height / 2)); - if (drawPlayer.direction == -1) - { - origin4 = new Vector2((float)(Main.itemTexture[item.type].Width + num107), (float)(Main.itemTexture[item.type].Height / 2)); - } - DrawData data = new DrawData(texture, - new Vector2((float)((int)(vector.X - Main.screenPosition.X + vector13.X)), (float)((int)(vector.Y - Main.screenPosition.Y + vector13.Y))), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - drawPlayer.itemRotation, - origin4, - item.scale, - effect, - 0); - Main.playerDrawData.Add(data); - } - else if (item.type == mod.ItemType("Excelsus")) - { - Vector2 zero2 = Vector2.Zero; - Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/ExcelsusGlow"); - if (drawPlayer.gravDir == -1f) - { - DrawData data = new DrawData(texture, - new Vector2((float)((int)(vector.X - Main.screenPosition.X)), (float)((int)(vector.Y - Main.screenPosition.Y))), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - drawPlayer.itemRotation, - new Vector2((float)Main.itemTexture[item.type].Width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f * (float)drawPlayer.direction, 0f) + zero2, - item.scale, - effect, - 0); - Main.playerDrawData.Add(data); - } - else - { - DrawData data = new DrawData(texture, - new Vector2((float)((int)(vector.X - Main.screenPosition.X)), (float)((int)(vector.Y - Main.screenPosition.Y))), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - drawPlayer.itemRotation, - new Vector2((float)Main.itemTexture[item.type].Width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f * (float)drawPlayer.direction, (float)Main.itemTexture[item.type].Height) + zero2, - item.scale, - effect, - 0); - Main.playerDrawData.Add(data); - } - } - } - }); - - public override void ModifyDrawLayers(List list) - { - MiscEffectsBack.visible = true; - list.Insert(0, MiscEffectsBack); - MiscEffects.visible = true; - list.Add(MiscEffects); - 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.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) - { - int insertAt = -1; - for (int m = 0; m < list.Count; m++) - { - PlayerLayer dl = list[m]; - if (dl.Name.Equals(parent.Name)) { insertAt = m; break; } - } - if (insertAt == -1) list.Add(layer); else list.Insert(first ? insertAt : insertAt + 1, layer); - } - - public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) - { - bool noRogueStealth = rogueStealth == 0f || player.townNPCs > 2f; - if (rogueStealth > 0f && rogueStealthMax > 0f && player.townNPCs < 3f) - { - //A translucent orchid color, the rogue class color - float colorValue = (rogueStealth / rogueStealthMax) * 0.9f; //0 to 0.9 - r *= 1f - (colorValue * 0.89f); //255 to 50 - g *= 1f - colorValue; //255 to 25 - b *= 1f - (colorValue * 0.89f); //255 to 50 - a *= 1f - colorValue; //255 to 25 - player.armorEffectDrawOutlines = false; - player.armorEffectDrawShadow = false; - player.armorEffectDrawShadowSubtle = false; - } - if (CalamityWorld.ironHeart && !Main.gameMenu) - { - Texture2D ironHeart = mod.GetTexture("ExtraTextures/IronHeart"); - Main.heartTexture = Main.heart2Texture = ironHeart; - } - else - { - Texture2D heart3 = mod.GetTexture("ExtraTextures/Heart3"); - Texture2D heart4 = mod.GetTexture("ExtraTextures/Heart4"); - Texture2D heart5 = mod.GetTexture("ExtraTextures/Heart5"); - Texture2D heart6 = mod.GetTexture("ExtraTextures/Heart6"); - Texture2D heartOriginal = mod.GetTexture("ExtraTextures/HeartOriginal"); - Texture2D heartOriginal2 = mod.GetTexture("ExtraTextures/HeartOriginal2"); - - int totalFruit = - (mFruit ? 1 : 0) + - (bOrange ? 1 : 0) + - (eBerry ? 1 : 0) + - (dFruit ? 1 : 0); - switch (totalFruit) - { - default: - Main.heart2Texture = heartOriginal; Main.heartTexture = heartOriginal2; - break; - case 4: - Main.heart2Texture = heart6; Main.heartTexture = heartOriginal2; - break; - case 3: - Main.heart2Texture = heart5; Main.heartTexture = heartOriginal2; - break; - case 2: - Main.heart2Texture = heart4; Main.heartTexture = heartOriginal2; - break; - case 1: - Main.heart2Texture = heart3; Main.heartTexture = heartOriginal2; - break; - } - } - if (revivifyTimer > 0) - { - if (Main.rand.Next(2) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 91, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default(Color), 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity.Y -= 0.5f; - Main.playerDrawDust.Add(dust); - } - } - if (tRegen) - { - if (Main.rand.Next(10) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 107, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.75f; - Main.dust[dust].velocity.Y -= 0.35f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.025f; - g *= 0.15f; - b *= 0.035f; - fullBright = true; - } - } - if (IBoots) - { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) - { - if (Main.rand.Next(2) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 229, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.05f; - g *= 0.05f; - b *= 0.05f; - fullBright = true; - } - } - } - if (elysianFire) - { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) - { - if (Main.rand.Next(2) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 246, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.75f; - g *= 0.55f; - b *= 0f; - fullBright = true; - } - } - } - if (dsSetBonus) - { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) - { - if (Main.rand.Next(2) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 27, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.025f; - b *= 0.1f; - fullBright = true; - } - } - } - if (auricSet) - { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) - { - if (drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, Main.rand.Next(2) == 0 ? 57 : 244, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.025f; - b *= 0.1f; - fullBright = true; - } - } - } - if (bFlames || aFlames || rageMode) - { - if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, mod.DustType("BrimstoneFlame"), player.velocity.X * 0.4f, player.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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - if (adrenalineMode) - { - if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 206, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 3f); - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.01f; - g *= 0.15f; - b *= 0.1f; - fullBright = true; - } - } - if (gsInferno) - { - if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 173, player.velocity.X * 0.4f, player.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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - if (hFlames || hInferno) - { - if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, mod.DustType("HolyFlame"), player.velocity.X * 0.4f, player.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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.25f; - b *= 0.1f; - fullBright = true; - } - } - if (pFlames) - { - if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 89, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.15f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.07f; - g *= 0.15f; - b *= 0.01f; - fullBright = true; - } - } - if (gState || cDepth) - { - if (noRogueStealth) - { - r *= 0f; - g *= 0.05f; - b *= 0.3f; - fullBright = true; - } - } - if (draedonsHeart && !shadeRegen && !cFreeze && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - if (noRogueStealth) - { - r *= 0f; - g *= 0.5f; - b *= 0f; - fullBright = true; - } - } - if (bBlood) - { - if (Main.rand.Next(6) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 5, player.velocity.X * 0.4f, player.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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - if (mushy) - { - if (Main.rand.Next(6) == 0 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 56, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 2f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity.Y -= 0.1f; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - } - #endregion - - /*#region NurseModifications - public override bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText) - { - if (CalamityWorld.revenge) - { - chatText = "Now is not the time!"; - return !areThereAnyDamnBosses; - } - return true; - } - - public override void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price) - { - if (CalamityWorld.revenge) - { - double priceMultiplier = 1.0 + //3 silver base - (Main.hardMode ? 99.0 : 0.0) + //3 gold - (NPC.downedMechBossAny ? 200.0 : 0.0) + //9 gold - (NPC.downedPlantBoss ? 300.0 : 0.0) + //18 gold - (NPC.downedGolemBoss ? 400.0 : 0.0) + //30 gold - (NPC.downedFishron ? 500.0 : 0.0) + //45 gold - (NPC.downedAncientCultist ? 600.0 : 0.0) + //63 gold - (NPC.downedMoonlord ? 700.0 : 0.0) + //84 gold - (CalamityWorld.downedProvidence ? 800.0 : 0.0) + //1 platinum 8 gold - (CalamityWorld.downedDoG ? 900.0 : 0.0) + //1 platinum 35 gold - (CalamityWorld.downedYharon ? 1000.0 : 0.0); //1 platinum 65 gold - price = (int)((double)price * priceMultiplier); - } - } - #endregion*/ - - #region DamageAndCrit - public void AllDamageBoost(float boost) - { - player.meleeDamage += boost; - player.rangedDamage += boost; - player.magicDamage += boost; - player.minionDamage += boost; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += boost; - } - - public void AllCritBoost(int boost) - { - player.meleeCrit += boost; - player.rangedCrit += boost; - player.magicCrit += boost; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += boost; - } - #endregion - - #region PacketStuff - private void ExactLevelPacket(bool server, int levelType) - { - ModPacket packet = mod.GetPacket(256); - switch (levelType) - { - case 0: - packet.Write((byte)CalamityModMessageType.ExactMeleeLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactMeleeLevel); - break; - case 1: - packet.Write((byte)CalamityModMessageType.ExactRangedLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactRangedLevel); - break; - case 2: - packet.Write((byte)CalamityModMessageType.ExactMagicLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactMagicLevel); - break; - case 3: - packet.Write((byte)CalamityModMessageType.ExactSummonLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactSummonLevel); - break; - case 4: - packet.Write((byte)CalamityModMessageType.ExactRogueLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactRogueLevel); - break; - } - if (!server) - { - packet.Send(); - } - else - { - packet.Send(-1, player.whoAmI); - } - } - - private void LevelPacket(bool server, int levelType) - { - ModPacket packet = mod.GetPacket(256); - switch (levelType) - { - case 0: - packet.Write((byte)CalamityModMessageType.MeleeLevelSync); - packet.Write(player.whoAmI); - packet.Write(meleeLevel); - break; - case 1: - packet.Write((byte)CalamityModMessageType.RangedLevelSync); - packet.Write(player.whoAmI); - packet.Write(rangedLevel); - break; - case 2: - packet.Write((byte)CalamityModMessageType.MagicLevelSync); - packet.Write(player.whoAmI); - packet.Write(magicLevel); - break; - case 3: - packet.Write((byte)CalamityModMessageType.SummonLevelSync); - packet.Write(player.whoAmI); - packet.Write(summonLevel); - break; - case 4: - packet.Write((byte)CalamityModMessageType.RogueLevelSync); - packet.Write(player.whoAmI); - packet.Write(rogueLevel); - break; - } - if (!server) - { - packet.Send(); - } - else - { - packet.Send(-1, player.whoAmI); - } - } - - private void StressPacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.StressSync); - packet.Write(player.whoAmI); - packet.Write(stress); - if (!server) - { - packet.Send(); - } - else - { - packet.Send(-1, player.whoAmI); - } - } - - private void AdrenalinePacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.AdrenalineSync); - packet.Write(player.whoAmI); - packet.Write(adrenaline); - if (!server) - { - packet.Send(); - } - else - { - packet.Send(-1, player.whoAmI); - } - } - - /*private void DistanceFromBossPacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.DistanceFromBossSync); - packet.Write(player.whoAmI); - packet.Write(distanceFromBoss); - if (!server) - { - packet.Send(); - } - else - { - packet.Send(-1, player.whoAmI); - } - }*/ - - 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) - { - case 0: - exactMeleeLevel = reader.ReadInt32(); - break; - case 1: - exactRangedLevel = reader.ReadInt32(); - break; - case 2: - exactMagicLevel = reader.ReadInt32(); - break; - case 3: - exactSummonLevel = reader.ReadInt32(); - break; - case 4: - exactRogueLevel = reader.ReadInt32(); - break; - } - if (Main.netMode == 2) - { - ExactLevelPacket(true, levelType); - } - } - - internal void HandleLevels(BinaryReader reader, int levelType) - { - switch (levelType) - { - case 0: - meleeLevel = reader.ReadInt32(); - break; - case 1: - rangedLevel = reader.ReadInt32(); - break; - case 2: - magicLevel = reader.ReadInt32(); - break; - case 3: - summonLevel = reader.ReadInt32(); - break; - case 4: - rogueLevel = reader.ReadInt32(); - break; - } - if (Main.netMode == 2) - { - LevelPacket(true, levelType); - } - } - - internal void HandleStress(BinaryReader reader) - { - stress = reader.ReadInt32(); - if (Main.netMode == 2) - { - StressPacket(true); - } - } - - internal void HandleAdrenaline(BinaryReader reader) - { - adrenaline = reader.ReadInt32(); - if (Main.netMode == 2) - { - AdrenalinePacket(true); - } - } - - /*internal void HandleDistanceFromBoss(BinaryReader reader) - { - distanceFromBoss = reader.ReadInt32(); - if (Main.netMode == 2) - { - DistanceFromBossPacket(true); - } - }*/ - - internal void HandleDeathCount(BinaryReader reader) - { - deathCount = reader.ReadInt32(); - if (Main.netMode == 2) - { - DeathPacket(true); - } - } - - public override void OnEnterWorld(Player player) - { - if (Main.netMode == 1) - { - ExactLevelPacket(false, 0); - ExactLevelPacket(false, 1); - ExactLevelPacket(false, 2); - ExactLevelPacket(false, 3); - ExactLevelPacket(false, 4); - LevelPacket(false, 0); - LevelPacket(false, 1); - LevelPacket(false, 2); - LevelPacket(false, 3); - LevelPacket(false, 4); - StressPacket(false); - AdrenalinePacket(false); - //DistanceFromBossPacket(false); - DeathPacket(false); - } - } - #endregion - - #region ProficiencyStuff - private void GetExactLevelUp() - { - if (gainLevelCooldown > 0) - gainLevelCooldown--; - - #region MeleeLevels - switch (meleeLevel) - { - case 100: - this.ExactLevelUp(0, 1, false); - break; - case 300: - this.ExactLevelUp(0, 2, false); - break; - case 600: - this.ExactLevelUp(0, 3, false); - break; - case 1000: - this.ExactLevelUp(0, 4, false); - break; - case 1500: - this.ExactLevelUp(0, 5, false); - break; - case 2100: - this.ExactLevelUp(0, 6, false); - break; - case 2800: - this.ExactLevelUp(0, 7, false); - break; - case 3600: - this.ExactLevelUp(0, 8, false); - break; - case 4500: - this.ExactLevelUp(0, 9, false); - break; - case 5500: - this.ExactLevelUp(0, 10, false); - break; - case 6600: - this.ExactLevelUp(0, 11, false); - break; - case 7800: - this.ExactLevelUp(0, 12, false); - break; - case 9100: - this.ExactLevelUp(0, 13, false); - break; - case 10500: - this.ExactLevelUp(0, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(0, 15, true); - break; - default: - break; - } - #endregion - - #region RangedLevels - switch (rangedLevel) - { - case 100: - this.ExactLevelUp(1, 1, false); - break; - case 300: - this.ExactLevelUp(1, 2, false); - break; - case 600: - this.ExactLevelUp(1, 3, false); - break; - case 1000: - this.ExactLevelUp(1, 4, false); - break; - case 1500: - this.ExactLevelUp(1, 5, false); - break; - case 2100: - this.ExactLevelUp(1, 6, false); - break; - case 2800: - this.ExactLevelUp(1, 7, false); - break; - case 3600: - this.ExactLevelUp(1, 8, false); - break; - case 4500: - this.ExactLevelUp(1, 9, false); - break; - case 5500: - this.ExactLevelUp(1, 10, false); - break; - case 6600: - this.ExactLevelUp(1, 11, false); - break; - case 7800: - this.ExactLevelUp(1, 12, false); - break; - case 9100: - this.ExactLevelUp(1, 13, false); - break; - case 10500: - this.ExactLevelUp(1, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(1, 15, true); - break; - default: - break; - } - #endregion - - #region MagicLevels - switch (magicLevel) - { - case 100: - this.ExactLevelUp(2, 1, false); - break; - case 300: - this.ExactLevelUp(2, 2, false); - break; - case 600: - this.ExactLevelUp(2, 3, false); - break; - case 1000: - this.ExactLevelUp(2, 4, false); - break; - case 1500: - this.ExactLevelUp(2, 5, false); - break; - case 2100: - this.ExactLevelUp(2, 6, false); - break; - case 2800: - this.ExactLevelUp(2, 7, false); - break; - case 3600: - this.ExactLevelUp(2, 8, false); - break; - case 4500: - this.ExactLevelUp(2, 9, false); - break; - case 5500: - this.ExactLevelUp(2, 10, false); - break; - case 6600: - this.ExactLevelUp(2, 11, false); - break; - case 7800: - this.ExactLevelUp(2, 12, false); - break; - case 9100: - this.ExactLevelUp(2, 13, false); - break; - case 10500: - this.ExactLevelUp(2, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(2, 15, true); - break; - default: - break; - } - #endregion - - #region SummonLevels - switch (summonLevel) - { - case 100: - this.ExactLevelUp(3, 1, false); - break; - case 300: - this.ExactLevelUp(3, 2, false); - break; - case 600: - this.ExactLevelUp(3, 3, false); - break; - case 1000: - this.ExactLevelUp(3, 4, false); - break; - case 1500: - this.ExactLevelUp(3, 5, false); - break; - case 2100: - this.ExactLevelUp(3, 6, false); - break; - case 2800: - this.ExactLevelUp(3, 7, false); - break; - case 3600: - this.ExactLevelUp(3, 8, false); - break; - case 4500: - this.ExactLevelUp(3, 9, false); - break; - case 5500: - this.ExactLevelUp(3, 10, false); - break; - case 6600: - this.ExactLevelUp(3, 11, false); - break; - case 7800: - this.ExactLevelUp(3, 12, false); - break; - case 9100: - this.ExactLevelUp(3, 13, false); - break; - case 10500: - this.ExactLevelUp(3, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(3, 15, true); - break; - default: - break; - } - #endregion - - #region RogueLevels - switch (rogueLevel) - { - case 100: - this.ExactLevelUp(4, 1, false); - break; - case 300: - this.ExactLevelUp(4, 2, false); - break; - case 600: - this.ExactLevelUp(4, 3, false); - break; - case 1000: - this.ExactLevelUp(4, 4, false); - break; - case 1500: - this.ExactLevelUp(4, 5, false); - break; - case 2100: - this.ExactLevelUp(4, 6, false); - break; - case 2800: - this.ExactLevelUp(4, 7, false); - break; - case 3600: - this.ExactLevelUp(4, 8, false); - break; - case 4500: - this.ExactLevelUp(4, 9, false); - break; - case 5500: - this.ExactLevelUp(4, 10, false); - break; - case 6600: - this.ExactLevelUp(4, 11, false); - break; - case 7800: - this.ExactLevelUp(4, 12, false); - break; - case 9100: - this.ExactLevelUp(4, 13, false); - break; - case 10500: - this.ExactLevelUp(4, 14, false); - break; - case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(4, 15, true); - break; - default: - break; - } - #endregion - } - - private void ExactLevelUp(int levelUpType, int level, bool final) - { - Color messageColor = Color.Orange; - switch (levelUpType) - { - case 0: - exactMeleeLevel = level; - if (shootFireworksLevelUpMelee) - { - string key = (final ? "Mods.CalamityMod.MeleeLevelUpFinal" : "Mods.CalamityMod.MeleeLevelUp"); - shootFireworksLevelUpMelee = false; - if (player.whoAmI == Main.myPlayer) - { - if (final) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 1: - exactRangedLevel = level; - if (shootFireworksLevelUpRanged) - { - string key = (final ? "Mods.CalamityMod.RangedLevelUpFinal" : "Mods.CalamityMod.RangedLevelUp"); - messageColor = Color.GreenYellow; - shootFireworksLevelUpRanged = false; - if (player.whoAmI == Main.myPlayer) - { - if (final) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 2: - exactMagicLevel = level; - if (shootFireworksLevelUpMagic) - { - string key = (final ? "Mods.CalamityMod.MagicLevelUpFinal" : "Mods.CalamityMod.MagicLevelUp"); - messageColor = Color.DodgerBlue; - shootFireworksLevelUpMagic = false; - if (player.whoAmI == Main.myPlayer) - { - if (final) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 3: - exactSummonLevel = level; - if (shootFireworksLevelUpSummon) - { - string key = (final ? "Mods.CalamityMod.SummonLevelUpFinal" : "Mods.CalamityMod.SummonLevelUp"); - messageColor = Color.Aquamarine; - shootFireworksLevelUpSummon = false; - if (player.whoAmI == Main.myPlayer) - { - if (final) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - case 4: - exactRogueLevel = level; - if (shootFireworksLevelUpRogue) - { - string key = (final ? "Mods.CalamityMod.RogueLevelUpFinal" : "Mods.CalamityMod.RogueLevelUp"); - messageColor = Color.Orchid; - shootFireworksLevelUpRogue = false; - if (player.whoAmI == Main.myPlayer) - { - if (final) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), - 0, 0f, Main.myPlayer, 0f, 0f); - } - Main.NewText(Language.GetTextValue(key), messageColor); - } - } - break; - } - if (Main.netMode == 1) - { - ExactLevelPacket(false, levelUpType); - } - } - - private void GetStatBonuses() - { - #region MeleeLevelBoosts - if (meleeLevel >= 12500) - { - player.meleeDamage += 0.12f; - player.meleeCrit += 6; - } - else if (meleeLevel >= 10500) - { - player.meleeDamage += 0.1f; - player.meleeCrit += 5; - } - else if (meleeLevel >= 9100) - { - player.meleeDamage += 0.09f; - player.meleeCrit += 5; - } - else if (meleeLevel >= 7800) - { - player.meleeDamage += 0.08f; - player.meleeCrit += 4; - } - else if (meleeLevel >= 6600) - { - player.meleeDamage += 0.07f; - player.meleeCrit += 4; - } - else if (meleeLevel >= 5500) //hm limit - { - player.meleeDamage += 0.06f; - player.meleeCrit += 3; - } - else if (meleeLevel >= 4500) - { - player.meleeDamage += 0.05f; - player.meleeCrit += 3; - } - else if (meleeLevel >= 3600) - { - player.meleeDamage += 0.05f; - player.meleeCrit += 2; - } - else if (meleeLevel >= 2800) - { - player.meleeDamage += 0.04f; - player.meleeCrit += 2; - } - else if (meleeLevel >= 2100) - { - player.meleeDamage += 0.04f; - player.meleeCrit += 1; - } - else if (meleeLevel >= 1500) //prehm limit - { - player.meleeDamage += 0.03f; - player.meleeCrit += 1; - } - else if (meleeLevel >= 1000) - { - player.meleeDamage += 0.03f; - player.meleeCrit += 1; - } - else if (meleeLevel >= 600) - { - player.meleeDamage += 0.02f; - } - else if (meleeLevel >= 300) - player.meleeDamage += 0.02f; - else if (meleeLevel >= 100) - player.meleeDamage += 0.01f; - #endregion - - #region RangedLevelBoosts - if (rangedLevel >= 12500) - { - player.rangedDamage += 0.12f; - player.moveSpeed += 0.12f; - player.rangedCrit += 6; - } - else if (rangedLevel >= 10500) - { - player.rangedDamage += 0.1f; - player.moveSpeed += 0.1f; - player.rangedCrit += 5; - } - else if (rangedLevel >= 9100) - { - player.rangedDamage += 0.09f; - player.moveSpeed += 0.09f; - player.rangedCrit += 5; - } - else if (rangedLevel >= 7800) - { - player.rangedDamage += 0.08f; - player.moveSpeed += 0.08f; - player.rangedCrit += 4; - } - else if (rangedLevel >= 6600) - { - player.rangedDamage += 0.07f; - player.moveSpeed += 0.07f; - player.rangedCrit += 4; - } - else if (rangedLevel >= 5500) - { - player.rangedDamage += 0.06f; - player.moveSpeed += 0.06f; - player.rangedCrit += 3; - } - else if (rangedLevel >= 4500) - { - player.rangedDamage += 0.05f; - player.moveSpeed += 0.05f; - player.rangedCrit += 3; - } - else if (rangedLevel >= 3600) - { - player.rangedDamage += 0.05f; - player.moveSpeed += 0.05f; - player.rangedCrit += 2; - } - else if (rangedLevel >= 2800) - { - player.rangedDamage += 0.04f; - player.moveSpeed += 0.04f; - player.rangedCrit += 2; - } - else if (rangedLevel >= 2100) - { - player.rangedDamage += 0.04f; - player.moveSpeed += 0.03f; - player.rangedCrit += 1; - } - else if (rangedLevel >= 1500) - { - player.rangedDamage += 0.03f; - player.moveSpeed += 0.02f; - player.rangedCrit += 1; - } - else if (rangedLevel >= 1000) - { - player.rangedDamage += 0.03f; - player.moveSpeed += 0.01f; - player.rangedCrit += 1; - } - else if (rangedLevel >= 600) - { - player.rangedDamage += 0.02f; - player.rangedCrit += 1; - } - else if (rangedLevel >= 300) - player.rangedDamage += 0.02f; - else if (rangedLevel >= 100) - player.rangedDamage += 0.01f; - #endregion - - #region MagicLevelBoosts - if (magicLevel >= 12500) - { - player.magicDamage += 0.12f; - player.manaCost *= 0.88f; - player.magicCrit += 6; - } - else if (magicLevel >= 10500) - { - player.magicDamage += 0.1f; - player.manaCost *= 0.9f; - player.magicCrit += 5; - } - else if (magicLevel >= 9100) - { - player.magicDamage += 0.09f; - player.manaCost *= 0.91f; - player.magicCrit += 5; - } - else if (magicLevel >= 7800) - { - player.magicDamage += 0.08f; - player.manaCost *= 0.92f; - player.magicCrit += 4; - } - else if (magicLevel >= 6600) - { - player.magicDamage += 0.07f; - player.manaCost *= 0.93f; - player.magicCrit += 4; - } - else if (magicLevel >= 5500) - { - player.magicDamage += 0.06f; - player.manaCost *= 0.94f; - player.magicCrit += 3; - } - else if (magicLevel >= 4500) - { - player.magicDamage += 0.05f; - player.manaCost *= 0.95f; - player.magicCrit += 3; - } - else if (magicLevel >= 3600) - { - player.magicDamage += 0.05f; - player.manaCost *= 0.95f; - player.magicCrit += 2; - } - else if (magicLevel >= 2800) - { - player.magicDamage += 0.04f; - player.manaCost *= 0.96f; - player.magicCrit += 2; - } - else if (magicLevel >= 2100) - { - player.magicDamage += 0.04f; - player.manaCost *= 0.97f; - player.magicCrit += 1; - } - else if (magicLevel >= 1500) - { - player.magicDamage += 0.03f; - player.manaCost *= 0.98f; - player.magicCrit += 1; - } - else if (magicLevel >= 1000) - { - player.magicDamage += 0.03f; - player.manaCost *= 0.99f; - player.magicCrit += 1; - } - else if (magicLevel >= 600) - { - player.magicDamage += 0.02f; - player.manaCost *= 0.99f; - } - else if (magicLevel >= 300) - player.magicDamage += 0.02f; - else if (magicLevel >= 100) - player.magicDamage += 0.01f; - #endregion - - #region SummonLevelBoosts - if (summonLevel >= 12500) - { - player.minionDamage += 0.12f; - player.minionKB += 3.0f; - player.maxMinions += 3; - } - else if (summonLevel >= 10500) - { - player.minionDamage += 0.1f; - player.minionKB += 3.0f; - player.maxMinions += 2; - } - else if (summonLevel >= 9100) - { - player.minionDamage += 0.09f; - player.minionKB += 2.7f; - player.maxMinions += 2; - } - else if (summonLevel >= 7800) - { - player.minionDamage += 0.08f; - player.minionKB += 2.4f; - player.maxMinions += 2; - } - else if (summonLevel >= 6600) - { - player.minionDamage += 0.07f; - player.minionKB += 2.1f; - player.maxMinions += 2; - } - else if (summonLevel >= 5500) - { - player.minionDamage += 0.06f; - player.minionKB += 1.8f; - player.maxMinions += 2; - } - else if (summonLevel >= 4500) - { - player.minionDamage += 0.06f; - player.minionKB += 1.8f; - player.maxMinions++; - } - else if (summonLevel >= 3600) - { - player.minionDamage += 0.05f; - player.minionKB += 1.5f; - player.maxMinions++; - } - else if (summonLevel >= 2800) - { - player.minionDamage += 0.04f; - player.minionKB += 1.2f; - player.maxMinions++; - } - else if (summonLevel >= 2100) - { - player.minionDamage += 0.04f; - player.minionKB += 0.9f; - player.maxMinions++; - } - else if (summonLevel >= 1500) - { - player.minionDamage += 0.03f; - player.minionKB += 0.6f; - } - else if (summonLevel >= 1000) - { - player.minionDamage += 0.03f; - player.minionKB += 0.3f; - } - else if (summonLevel >= 600) - { - player.minionDamage += 0.02f; - player.minionKB += 0.3f; - } - else if (summonLevel >= 300) - player.minionDamage += 0.02f; - else if (summonLevel >= 100) - player.minionDamage += 0.01f; - #endregion - - #region RogueLevelBoosts - if (rogueLevel >= 12500) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.12f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 6; - } - else if (rogueLevel >= 10500) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - } - else if (rogueLevel >= 9100) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.09f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.09f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - } - else if (rogueLevel >= 7800) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.08f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 4; - } - else if (rogueLevel >= 6600) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.07f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.07f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 4; - } - else if (rogueLevel >= 5500) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.06f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.06f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - } - else if (rogueLevel >= 4500) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - } - else if (rogueLevel >= 3600) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; - } - else if (rogueLevel >= 2800) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.04f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.04f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; - } - else if (rogueLevel >= 2100) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.04f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.03f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 1; - } - else if (rogueLevel >= 1500) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.02f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 1; - } - else if (rogueLevel >= 1000) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.01f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 1; - } - else if (rogueLevel >= 600) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.01f; - } - else if (rogueLevel >= 300) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; - else if (rogueLevel >= 100) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.01f; - #endregion - } - - private float GetMeleeSpeedBonus() - { - float meleeSpeedBonus = 0f; - if (meleeLevel >= 12500) - { - meleeSpeedBonus += 0.12f; - } - else if (meleeLevel >= 10500) - { - meleeSpeedBonus += 0.1f; - } - else if (meleeLevel >= 9100) - { - meleeSpeedBonus += 0.09f; - } - else if (meleeLevel >= 7800) - { - meleeSpeedBonus += 0.08f; - } - else if (meleeLevel >= 6600) - { - meleeSpeedBonus += 0.07f; - } - else if (meleeLevel >= 5500) //hm limit - { - meleeSpeedBonus += 0.06f; - } - else if (meleeLevel >= 4500) - { - meleeSpeedBonus += 0.05f; - } - else if (meleeLevel >= 3600) - { - meleeSpeedBonus += 0.05f; - } - else if (meleeLevel >= 2800) - { - meleeSpeedBonus += 0.04f; - } - else if (meleeLevel >= 2100) - { - meleeSpeedBonus += 0.03f; - } - else if (meleeLevel >= 1500) //prehm limit - { - meleeSpeedBonus += 0.02f; - } - else if (meleeLevel >= 1000) - { - meleeSpeedBonus += 0.01f; - } - else if (meleeLevel >= 600) - { - meleeSpeedBonus += 0.01f; - } - return meleeSpeedBonus; - } - #endregion - } -} +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent; +using Terraria.GameContent.UI; +using Terraria.GameInput; +using Terraria.Graphics.Capture; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; +using CalamityMod.NPCs; +using CalamityMod.NPCs.TheDevourerofGods; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Yharon; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.Projectiles; +using CalamityMod.Items; +using CalamityMod.Items.Armor; +using CalamityMod.UI; +using CalamityMod.World; +using CalamityMod.Items.CalamityCustomThrowingDamage; +using Terraria.ModLoader.IO; + +namespace CalamityMod +{ + public class CalamityPlayer : ModPlayer + { + #region InstanceVars + + //No Category + public static bool areThereAnyDamnBosses = false; + public bool drawBossHPBar = true; + public bool shouldDrawSmallText = true; + private const int saveVersion = 0; + public const float defEndurance = 0.33f; + //public int distanceFromBoss = -1; + public int dashMod; + public int projTypeJustHitBy; + public int sCalDeathCount = 0; + public int sCalKillCount = 0; + public int deathCount = 0; + + //Timer and Counter + public int bossRushImmunityFrameCurseTimer = 0; + public int aBulwarkRareMeleeBoostTimer = 0; + public int nebulaManaNerfCounter = 0; + public int alcoholPoisonLevel = 0; + public int modStealthTimer; + public int dashTimeMod; + public int hInfernoBoost = 0; + public int pissWaterBoost = 0; + public int packetTimer = 0; + public int bloodflareHeartTimer = 180; + public int bloodflareManaTimer = 180; + public int ataraxiaDamageBoostCooldown = 0; + public int ataraxiaDamageBoostCancelTimer = 1200; + public float ataraxiaDamageBoost = 0f; + public float rogueStealth = 0f; + public float rogueStealthMax = 0f; + public float modStealth = 1f; + public float aquaticBoost = 1f; + public float shieldInvinc = 5f; + + //Sound + public bool playRogueStealthSound = false; + public bool playFullRageSound = true; + public bool playFullAdrenalineSound = true; + public bool playAdrenalineBurnoutSound = true; + public bool playFullAdrenalineBurnoutSound = true; + + //Proficiency + public int meleeLevel = 0; + public int rangedLevel = 0; + public int magicLevel = 0; + public int rogueLevel = 0; + public int summonLevel = 0; + public bool shootFireworksLevelUpMelee = true; + public bool shootFireworksLevelUpRanged = true; + public bool shootFireworksLevelUpMagic = true; + public bool shootFireworksLevelUpSummon = true; + public bool shootFireworksLevelUpRogue = true; + public int exactMeleeLevel = 0; + public int exactRangedLevel = 0; + public int exactMagicLevel = 0; + public int exactSummonLevel = 0; + public int exactRogueLevel = 0; + public int gainLevelCooldown = 120; + + //Mount + public bool onyxExcavator = false; + public bool angryDog = false; + public bool fab = false; + public bool crysthamyr = false; + + //Pet + public bool akato = false; + public bool leviPet = false; + public bool sirenPet = false; + public bool fox = false; + public bool chibii = false; + public bool brimling = false; + public bool bearPet = false; + public bool kendra = false; + public bool trashMan = false; + public int trashManChest = -1; + + //Rage + public const int stressMax = 10000; + public int stress; + public int stressCD; + public bool stressLevel500 = false; + public bool rageMode = false; + public int gainRageCooldown = 60; + + //Adrenaline + public const int adrenalineMax = 10000; + public int adrenalineMaxTimer = 300; + public int adrenalineDmgDown = 600; + public float adrenalineDmgMult = 1f; + public int adrenaline; + public int adrenalineCD; + public bool adrenalineMode = false; + + //Permanent Buff + public bool extraAccessoryML = false; + public bool eCore = false; + public bool pHeart = false; + public bool cShard = false; + public bool mFruit = false; + public bool bOrange = false; + public bool eBerry = false; + public bool dFruit = false; + public bool revJamDrop = false; + public bool rageBoostOne = false; + public bool rageBoostTwo = false; + public bool rageBoostThree = false; + public bool adrenalineBoostOne = false; + public bool adrenalineBoostTwo = false; + public bool adrenalineBoostThree = false; + + //Lore + 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; + + //Accessory + public bool fasterMeleeLevel = false; + public bool fasterRangedLevel = false; + public bool fasterMagicLevel = false; + public bool fasterSummonLevel = false; + 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; + public bool afflicted = false; + public bool affliction = false; + public bool stressPills = false; + public bool laudanum = false; + public bool heartOfDarkness = false; + public bool draedonsHeart = false; + public bool draedonsStressGain = false; + public bool rampartOfDeities = false; + public bool vexation = false; + public bool fBulwark = false; + public bool dodgeScarf = false; + public bool badgeOfBravery = false; + public bool badgeOfBraveryRare = false; + public bool scarfCooldown = false; + public bool cryogenSoul = false; + public bool yInsignia = false; + public bool eGauntlet = false; + public bool eTalisman = false; + public bool statisBeltOfCurses = false; + public bool elysianAegis = false; + public bool elysianGuard = false; + public bool nCore = false; + public bool deepDiver = false; + public bool abyssalDivingSuitPlates = false; + public bool abyssalDivingSuitCooldown = false; + public int abyssalDivingSuitPlateHits = 0; + public bool sirenWaterBuff = false; + public bool sirenIce = false; + public bool sirenIceCooldown = false; + public bool aSpark = false; + public bool aSparkRare = false; + public bool aBulwark = false; + public bool aBulwarkRare = false; + public bool dAmulet = false; + public bool fCarapace = false; + public bool gShell = false; + public bool absorber = false; + public bool aAmpoule = false; + public bool pAmulet = false; + public bool fBarrier = false; + public bool aBrain = false; + public bool lol = false; + public bool raiderTalisman = false; + public int raiderStack = 0; + public bool sGenerator = false; + public bool sDefense = false; + public bool sPower = false; + public bool sRegen = false; + public bool IBoots = false; + public bool elysianFire = false; + public bool sTracers = false; + public bool eTracers = false; + public bool cTracers = false; + public bool frostFlare = false; + public bool beeResist = false; + public bool uberBees = false; + public bool projRef = false; + public bool projRefRare = false; + public int projRefRareLifeRegenCounter = 0; + public bool nanotech = false; + public bool eQuiver = false; + public bool shadowMinions = false; + public bool tearMinions = false; + public bool alchFlask = false; + public bool community = false; + public bool fleshTotem = false; + public int fleshTotemCooldown = 0; + public bool bloodPact = false; + public bool bloodflareCore = false; + public bool coreOfTheBloodGod = false; + public bool elementalHeart = false; + public bool crownJewel = false; + public bool celestialJewel = false; + public bool astralArcanum = false; + public bool harpyRing = false; + public bool ironBoots = false; + public bool depthCharm = false; + public bool anechoicPlating = false; + public bool jellyfishNecklace = false; + public bool abyssalAmulet = false; + public bool lumenousAmulet = false; + public bool reaperToothNecklace = false; + public bool aquaticEmblem = false; + public bool darkSunRing = false; + public bool calamityRing = false; + public bool eArtifact = false; + public bool dArtifact = false; + public bool gArtifact = false; + public bool pArtifact = false; + public bool giantPearl = false; + public bool normalityRelocator = false; + public bool fabledTortoise = false; + public bool manaOverloader = false; + + //Armor Set + public bool victideSet = false; + public bool aeroSet = false; + public bool statigelSet = false; + public bool tarraSet = false; + public bool tarraMelee = false; + public bool tarraDefense = false; + public int tarraCooldown = 0; + public int tarraDefenseTime = 600; + public bool tarraMage = false; + public int tarraMageHealCooldown = 0; + public int tarraCrits = 0; + public bool tarraRanged = false; + public bool tarraThrowing = false; + public int tarraThrowingCrits = 0; + public int tarraThrowingCritTimer = 0; + public bool tarraSummon = false; + public bool bloodflareSet = false; + public bool bloodflareMelee = false; + public int bloodflareMeleeHits = 0; + public int bloodflareFrenzyTimer = 0; + public int bloodflareFrenzyCooldown = 0; + public bool bloodflareRanged = false; + public int bloodflareRangedCooldown = 0; + public bool bloodflareThrowing = false; + public bool bloodflareMage = false; + public int bloodflareMageCooldown = 0; + public bool bloodflareSummon = false; + public int bloodflareSummonTimer = 0; + public bool godSlayer = false; + public bool godSlayerDamage = false; + public bool godSlayerMage = false; + public bool godSlayerRanged = false; + public bool godSlayerThrowing = false; + public bool godSlayerSummon = false; + public float godSlayerDmg; + public bool godSlayerReflect = false; + public bool godSlayerCooldown = false; + public bool ataxiaBolt = false; + public bool ataxiaFire = false; + public bool ataxiaVolley = false; + public bool ataxiaBlaze = false; + public bool daedalusAbsorb = false; + public bool daedalusShard = false; + public bool reaverSpore = false; + public bool reaverDoubleTap = false; + public bool flamethrowerBoost = false; + public bool shadeRegen = false; + public bool shadowSpeed = false; + public bool dsSetBonus = false; + public bool auricBoost = false; + public bool daedalusReflect = false; + public bool daedalusSplit = false; + public bool reaverBlast = false; + public bool reaverBurst = false; + public bool astralStarRain = false; + public int astralStarRainCooldown = 0; + public float ataxiaDmg; + public bool ataxiaMage = false; + public bool ataxiaGeyser = false; + public float xerocDmg; + public bool xerocSet = false; + public bool silvaSet = false; + public bool silvaMelee = false; + public bool silvaRanged = false; + public bool silvaThrowing = false; + public bool silvaMage = false; + public bool silvaSummon = false; + public bool hasSilvaEffect = false; + public int silvaCountdown = 600; + public int silvaHitCounter = 0; + public bool auricSet = false; + public bool omegaBlueChestplate = false; + public bool omegaBlueSet = false; + public bool omegaBlueHentai = false; + public int omegaBlueCooldown = 0; + public bool molluskSet = false; + + //Debuff + public bool wDeath = false; + public bool lethalLavaBurn = false; + public bool aCrunch = false; + public bool hAttack = false; + public bool horror = false; + public bool irradiated = false; + public bool bFlames = false; + public bool aFlames = false; + public bool gsInferno = false; + public bool pFlames = false; + public bool hFlames = false; + public bool hInferno = false; + public bool gState = false; + public bool bBlood = false; + public bool eGravity = false; + public bool weakPetrification = false; + public bool vHex = false; + public bool eGrav = false; + public bool warped = false; + public bool marked = false; + public bool cDepth = false; + public bool fishAlert = false; + public bool bOut = false; + public bool clamity = false; + + //Buff + public bool trinketOfChiBuff = false; + public int chiBuffTimer = 0; + public bool corrEffigy = false; + public bool crimEffigy = false; + public bool rRage = false; + public bool tRegen = false; + public bool xRage = false; + public bool xWrath = false; + public bool graxDefense = false; + public bool sMeleeBoost = false; + public bool tFury = false; + public bool cadence = false; + public bool omniscience = false; + public bool zerg = false; + public bool zen = false; + public bool yPower = false; + public bool aWeapon = false; + public bool tScale = false; + public bool fabsolVodka = false; + public bool mushy = false; + public bool molten = false; + public bool shellBoost = false; + public bool cFreeze = false; + public bool invincible = false; + public bool shine = false; + public bool anechoicCoating = false; + public bool enraged = false; + public int revivifyTimer = 0; + 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; + public bool redWine = false; + public bool grapeBeer = false; + public bool moonshine = false; + public bool rum = false; + public bool whiskey = false; + public bool fireball = false; + public bool everclear = false; + public bool bloodyMary = false; + public bool tequila = false; + public bool caribbeanRum = false; + public bool cinnamonRoll = false; + public bool tequilaSunrise = false; + public bool margarita = false; + public bool starBeamRye = false; + public bool screwdriver = false; + public bool moscowMule = false; + public bool whiteWine = false; + public bool evergreenGin = false; + public bool tranquilityCandle = false; + public bool chaosCandle = false; + public bool purpleCandle = false; + public bool blueCandle = false; + public bool pinkCandle = false; + public int pinkCandleTimer = 60; + public bool yellowCandle = false; + public bool trippy = false; + public bool amidiasBlessing = false; + + //Minion + public bool glSword = false; + public bool mWorm = false; + public bool iClasper = false; + public bool herring = false; + public bool calamari = false; + public bool cEyes = false; + public bool cSlime = false; + public bool cSlime2 = false; + public bool bStar = false; + public bool aStar = false; + public bool SP = false; + public bool dCreeper = false; + public bool bClot = false; + public bool eAxe = false; + public bool SPG = false; + public bool aChicken = false; + public bool cLamp = false; + public bool pGuy = false; + public bool gDefense = false; + public bool gOffense = false; + public bool gHealer = false; + public bool cEnergy = false; + public bool sWaifu = false; + public bool dWaifu = false; + public bool cWaifu = false; + public bool bWaifu = false; + public bool slWaifu = false; + public bool fClump = false; + public bool rDevil = false; + public bool aValkyrie = false; + public bool sCrystal = false; + public bool sGod = false; + public bool sandnado = false; + public bool vUrchin = false; + public bool cSpirit = false; + public bool rOrb = false; + public bool dCrystal = false; + public bool sandWaifu = false; + public bool sandBoobWaifu = false; + public bool cloudWaifu = false; + public bool brimstoneWaifu = false; + public bool sirenWaifu = false; + public bool allWaifus = false; + public bool fungalClump = false; + public bool redDevil = false; + public bool valkyrie = false; + public bool slimeGod = false; + public bool urchin = false; + public bool chaosSpirit = false; + public bool reaverOrb = false; + public bool daedalusCrystal = false; + public int healCounter = 300; + public bool shellfish = false; + public bool hCrab = false; + + //Biome + public bool ZoneCalamity = false; + public bool ZoneAstral = false; + public bool ZoneSunkenSea = false; + public bool ZoneSulphur = false; + public bool ZoneAbyss = false; + public bool ZoneAbyssLayer1 = false; + public bool ZoneAbyssLayer2 = false; + public bool ZoneAbyssLayer3 = false; + public bool ZoneAbyssLayer4 = false; + public int abyssBreathCD; + + //Transformation + public bool abyssalDivingSuitPrevious; + public bool abyssalDivingSuit; + public bool abyssalDivingSuitHide; + public bool abyssalDivingSuitForce; + public bool abyssalDivingSuitPower; + public bool sirenBoobsPrevious; + public bool sirenBoobs; + public bool sirenBoobsHide; + public bool sirenBoobsForce; + public bool sirenBoobsPower; + public bool sirenBoobsAltPrevious; + public bool sirenBoobsAlt; + public bool sirenBoobsAltHide; + public bool sirenBoobsAltForce; + public bool sirenBoobsAltPower; + public bool snowmanPrevious; + public bool snowman; + public bool snowmanHide; + public bool snowmanForce; + public bool snowmanNoseless; + public bool snowmanPower; + + #endregion + + #region SavingAndLoading + public override void Initialize() + { + extraAccessoryML = false; + eCore = false; + mFruit = false; + bOrange = false; + eBerry = false; + dFruit = false; + pHeart = false; + cShard = false; + revJamDrop = false; + rageBoostOne = false; + rageBoostTwo = false; + rageBoostThree = false; + adrenalineBoostOne = false; + adrenalineBoostTwo = false; + adrenalineBoostThree = false; + drawBossHPBar = true; + shouldDrawSmallText = true; + } + + public override TagCompound Save() + { + var boost = new List(); + if (extraAccessoryML) boost.Add("extraAccessoryML"); + if (eCore) boost.Add("etherealCore"); + if (mFruit) boost.Add("miracleFruit"); + if (bOrange) boost.Add("bloodOrange"); + if (eBerry) boost.Add("elderBerry"); + if (dFruit) boost.Add("dragonFruit"); + if (pHeart) boost.Add("phantomHeart"); + if (cShard) boost.Add("cometShard"); + if (revJamDrop) boost.Add("revJam"); + if (rageBoostOne) boost.Add("rageOne"); + if (rageBoostTwo) boost.Add("rageTwo"); + if (rageBoostThree) boost.Add("rageThree"); + if (adrenalineBoostOne) boost.Add("adrenalineOne"); + if (adrenalineBoostTwo) boost.Add("adrenalineTwo"); + if (adrenalineBoostThree) boost.Add("adrenalineThree"); + if (drawBossHPBar) boost.Add("bossHPBar"); + if (shouldDrawSmallText) boost.Add("drawSmallText"); + + return new TagCompound + { + { + "boost", boost + }, + { + "stress", stress + }, + { + "adrenaline", adrenaline + }, + { + "sCalDeathCount", sCalDeathCount + }, + { + "sCalKillCount", sCalKillCount + }, + { + "meleeLevel", meleeLevel + }, + { + "exactMeleeLevel", exactMeleeLevel + }, + { + "rangedLevel", rangedLevel + }, + { + "exactRangedLevel", exactRangedLevel + }, + { + "magicLevel", magicLevel + }, + { + "exactMagicLevel", exactMagicLevel + }, + { + "summonLevel", summonLevel + }, + { + "exactSummonLevel", exactSummonLevel + }, + { + "rogueLevel", rogueLevel + }, + { + "exactRogueLevel", exactRogueLevel + }, + { + "deathCount", deathCount + } + }; + } + + public override void Load(TagCompound tag) + { + var boost = tag.GetList("boost"); + extraAccessoryML = boost.Contains("extraAccessoryML"); + eCore = boost.Contains("etherealCore"); + mFruit = boost.Contains("miracleFruit"); + bOrange = boost.Contains("bloodOrange"); + eBerry = boost.Contains("elderBerry"); + dFruit = boost.Contains("dragonFruit"); + pHeart = boost.Contains("phantomHeart"); + cShard = boost.Contains("cometShard"); + revJamDrop = boost.Contains("revJam"); + rageBoostOne = boost.Contains("rageOne"); + rageBoostTwo = boost.Contains("rageTwo"); + rageBoostThree = boost.Contains("rageThree"); + adrenalineBoostOne = boost.Contains("adrenalineOne"); + adrenalineBoostTwo = boost.Contains("adrenalineTwo"); + adrenalineBoostThree = boost.Contains("adrenalineThree"); + drawBossHPBar = boost.Contains("bossHPBar"); + shouldDrawSmallText = boost.Contains("drawSmallText"); + + stress = tag.GetInt("stress"); + adrenaline = tag.GetInt("adrenaline"); + sCalDeathCount = tag.GetInt("sCalDeathCount"); + sCalKillCount = tag.GetInt("sCalKillCount"); + deathCount = tag.GetInt("deathCount"); + + meleeLevel = tag.GetInt("meleeLevel"); + rangedLevel = tag.GetInt("rangedLevel"); + magicLevel = tag.GetInt("magicLevel"); + summonLevel = tag.GetInt("summonLevel"); + rogueLevel = tag.GetInt("rogueLevel"); + exactMeleeLevel = tag.GetInt("exactMeleeLevel"); + exactRangedLevel = tag.GetInt("exactRangedLevel"); + exactMagicLevel = tag.GetInt("exactMagicLevel"); + exactSummonLevel = tag.GetInt("exactSummonLevel"); + exactRogueLevel = tag.GetInt("exactRogueLevel"); + } + + public override void LoadLegacy(BinaryReader reader) + { + int loadVersion = reader.ReadInt32(); + stress = reader.ReadInt32(); + adrenaline = reader.ReadInt32(); + sCalDeathCount = reader.ReadInt32(); + sCalKillCount = reader.ReadInt32(); + deathCount = reader.ReadInt32(); + + meleeLevel = reader.ReadInt32(); + rangedLevel = reader.ReadInt32(); + magicLevel = reader.ReadInt32(); + summonLevel = reader.ReadInt32(); + rogueLevel = reader.ReadInt32(); + exactMeleeLevel = reader.ReadInt32(); + exactRangedLevel = reader.ReadInt32(); + exactMagicLevel = reader.ReadInt32(); + exactSummonLevel = reader.ReadInt32(); + exactRogueLevel = reader.ReadInt32(); + + if (loadVersion == 0) + { + BitsByte flags = reader.ReadByte(); + extraAccessoryML = flags[0]; + eCore = flags[1]; + mFruit = flags[2]; + bOrange = flags[3]; + eBerry = flags[4]; + dFruit = flags[5]; + pHeart = flags[6]; + cShard = flags[7]; + + BitsByte flags2 = reader.ReadByte(); + revJamDrop = flags2[0]; + rageBoostOne = flags2[1]; + rageBoostTwo = flags2[2]; + rageBoostThree = flags2[3]; + adrenalineBoostOne = flags2[4]; + adrenalineBoostTwo = flags2[5]; + adrenalineBoostThree = flags2[6]; + drawBossHPBar = flags2[7]; + + BitsByte flags3 = reader.ReadByte(); + shouldDrawSmallText = flags3[0]; + } + else + { + ErrorLogger.Log("CalamityMod: Unknown loadVersion: " + loadVersion); + } + } + #endregion + + #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; + + sirenWaterBuff = false; + sirenIce = false; + sirenIceCooldown = false; + + draedonsHeart = false; + draedonsStressGain = false; + + afflicted = false; + affliction = false; + + fasterMeleeLevel = false; + fasterRangedLevel = false; + fasterMagicLevel = false; + fasterSummonLevel = false; + fasterRogueLevel = false; + + dodgeScarf = false; + scarfCooldown = false; + + elysianAegis = false; + + nCore = false; + + godSlayer = false; + godSlayerDamage = false; + godSlayerMage = false; + godSlayerRanged = false; + godSlayerThrowing = false; + godSlayerSummon = false; + godSlayerReflect = false; + godSlayerCooldown = false; + + silvaSet = false; + silvaMelee = false; + silvaRanged = false; + silvaThrowing = false; + silvaMage = false; + silvaSummon = false; + + auricSet = false; + auricBoost = false; + + omegaBlueChestplate = false; + omegaBlueSet = false; + omegaBlueHentai = false; + + molluskSet = false; + + ataxiaBolt = false; + ataxiaGeyser = false; + ataxiaFire = false; + ataxiaVolley = false; + ataxiaBlaze = false; + ataxiaMage = false; + + shadeRegen = false; + + flamethrowerBoost = false; + + 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; + absorber = false; + aAmpoule = false; + pAmulet = false; + fBarrier = false; + aBrain = false; + frostFlare = false; + beeResist = false; + uberBees = false; + projRef = false; + projRefRare = false; + nanotech = false; + eQuiver = false; + cryogenSoul = false; + yInsignia = false; + eGauntlet = false; + eTalisman = false; + statisBeltOfCurses = false; + heartOfDarkness = false; + shadowMinions = false; + tearMinions = false; + alchFlask = false; + community = false; + stressPills = false; + laudanum = false; + fleshTotem = false; + bloodPact = false; + bloodflareCore = false; + coreOfTheBloodGod = false; + elementalHeart = false; + crownJewel = false; + celestialJewel = false; + astralArcanum = false; + harpyRing = false; + darkSunRing = false; + calamityRing = false; + eArtifact = false; + dArtifact = false; + gArtifact = false; + pArtifact = false; + giantPearl = false; + normalityRelocator = false; + fabledTortoise = false; + manaOverloader = false; + lol = false; + raiderTalisman = false; + sGenerator = false; + sDefense = false; + sRegen = false; + sPower = false; + IBoots = false; + elysianFire = false; + sTracers = false; + eTracers = false; + cTracers = false; + + daedalusReflect = false; + daedalusSplit = false; + daedalusAbsorb = false; + daedalusShard = false; + + reaverSpore = false; + reaverDoubleTap = false; + reaverBlast = false; + reaverBurst = false; + + ironBoots = false; + depthCharm = false; + anechoicPlating = false; + jellyfishNecklace = false; + abyssalAmulet = false; + lumenousAmulet = false; + reaperToothNecklace = false; + aquaticEmblem = false; + + astralStarRain = false; + + victideSet = false; + + aeroSet = false; + + statigelSet = false; + + tarraSet = false; + tarraMelee = false; + tarraMage = false; + tarraRanged = false; + tarraThrowing = false; + tarraSummon = false; + + bloodflareSet = false; + bloodflareMelee = false; + bloodflareRanged = false; + bloodflareThrowing = false; + bloodflareMage = false; + bloodflareSummon = false; + + xerocSet = false; + + weakPetrification = false; + + wDeath = false; + lethalLavaBurn = false; + aCrunch = false; + hAttack = false; + horror = false; + irradiated = false; + bFlames = false; + aFlames = false; + gsInferno = false; + pFlames = false; + hFlames = false; + hInferno = false; + gState = false; + bBlood = false; + eGravity = false; + vHex = false; + eGrav = false; + warped = false; + marked = false; + cDepth = false; + fishAlert = false; + bOut = false; + clamity = false; + enraged = false; + snowmanNoseless = false; + + trinketOfChiBuff = false; + corrEffigy = false; + crimEffigy = false; + rRage = false; + xRage = false; + xWrath = false; + graxDefense = false; + sMeleeBoost = false; + tFury = false; + cadence = false; + 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; + 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; + moonshine = false; + rum = false; + whiskey = false; + fireball = false; + everclear = false; + bloodyMary = false; + tequila = false; + caribbeanRum = false; + cinnamonRoll = false; + tequilaSunrise = false; + margarita = false; + starBeamRye = false; + screwdriver = false; + moscowMule = false; + whiteWine = false; + evergreenGin = false; + + tranquilityCandle = false; + chaosCandle = false; + purpleCandle = false; + blueCandle = false; + pinkCandle = false; + yellowCandle = false; + + glSword = false; + mWorm = false; + iClasper = false; + herring = false; + calamari = false; + cEyes = false; + cSlime = false; + cSlime2 = false; + bStar = false; + aStar = false; + SP = false; + dCreeper = false; + bClot = false; + eAxe = false; + SPG = false; + aChicken = false; + cLamp = false; + pGuy = false; + cEnergy = false; + gDefense = false; + gOffense = false; + gHealer = false; + sWaifu = false; + dWaifu = false; + cWaifu = false; + bWaifu = false; + slWaifu = false; + fClump = false; + rDevil = false; + aValkyrie = false; + sCrystal = false; + sGod = false; + sandnado = false; + vUrchin = false; + cSpirit = false; + rOrb = false; + dCrystal = false; + sandWaifu = false; + sandBoobWaifu = false; + cloudWaifu = false; + brimstoneWaifu = false; + sirenWaifu = false; + allWaifus = false; + fungalClump = false; + redDevil = false; + valkyrie = false; + slimeGod = false; + urchin = false; + chaosSpirit = false; + reaverOrb = false; + daedalusCrystal = false; + shellfish = false; + hCrab = false; + + abyssalDivingSuitPrevious = abyssalDivingSuit; + abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; + + sirenBoobsPrevious = sirenBoobs; + sirenBoobs = sirenBoobsHide = sirenBoobsForce = sirenBoobsPower = false; + sirenBoobsAltPrevious = sirenBoobsAlt; + sirenBoobsAlt = sirenBoobsAltHide = sirenBoobsAltForce = sirenBoobsAltPower = false; + + snowmanPrevious = snowman; + snowman = snowmanHide = snowmanForce = snowmanPower = false; + + rageMode = false; + adrenalineMode = false; + } + #endregion + + #region UpdateDead + public override void UpdateDead() + { + #region Debuffs + //distanceFromBoss = -1; + stress = 0; + adrenaline = 0; + adrenalineMaxTimer = 300; + adrenalineDmgDown = 600; + adrenalineDmgMult = 1f; + raiderStack = 0; + fleshTotemCooldown = 0; + astralStarRainCooldown = 0; + bloodflareMageCooldown = 0; + tarraMageHealCooldown = 0; + ataraxiaDamageBoost = 0f; + bossRushImmunityFrameCurseTimer = 0; + aBulwarkRareMeleeBoostTimer = 0; + ataraxiaDamageBoostCooldown = 0; + ataraxiaDamageBoostCancelTimer = 1200; + theBeeDamage = 0; + wDeath = false; + lethalLavaBurn = false; + aCrunch = false; + hAttack = false; + horror = false; + irradiated = false; + bFlames = false; + aFlames = false; + gsInferno = false; + pFlames = false; + hFlames = false; + hInferno = false; + gState = false; + bBlood = false; + eGravity = false; + vHex = false; + eGrav = false; + warped = false; + marked = false; + cDepth = false; + fishAlert = false; + bOut = false; + clamity = false; + snowmanNoseless = false; + scarfCooldown = false; + godSlayerCooldown = false; + abyssalDivingSuitCooldown = false; + abyssalDivingSuitPlateHits = 0; + sirenIceCooldown = false; + #endregion + + #region Buffs + sDefense = false; + sRegen = false; + sPower = false; + onyxExcavator = false; + angryDog = false; + fab = false; + crysthamyr = false; + abyssalDivingSuitPlates = false; + sirenWaterBuff = false; + sirenIce = false; + trinketOfChiBuff = false; + chiBuffTimer = 0; + corrEffigy = false; + crimEffigy = false; + rRage = false; + xRage = false; + xWrath = false; + graxDefense = false; + sMeleeBoost = false; + tFury = false; + cadence = false; + 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; + fabsolVodka = false; + invincible = false; + shine = false; + anechoicCoating = false; + mushy = false; + molten = false; + enraged = false; + shellBoost = false; + cFreeze = false; + tRegen = false; + rageMode = false; + adrenalineMode = false; + vodka = false; + redWine = false; + grapeBeer = false; + moonshine = false; + rum = false; + whiskey = false; + fireball = false; + everclear = false; + bloodyMary = false; + tequila = false; + caribbeanRum = false; + cinnamonRoll = false; + tequilaSunrise = false; + margarita = false; + starBeamRye = false; + screwdriver = false; + moscowMule = false; + whiteWine = false; + evergreenGin = false; + tranquilityCandle = false; + chaosCandle = false; + purpleCandle = false; + blueCandle = false; + pinkCandle = false; + pinkCandleTimer = 60; + yellowCandle = false; + trippy = false; + amidiasBlessing = false; + revivifyTimer = 0; + healCounter = 300; + #endregion + + #region Armorbonuses + flamethrowerBoost = false; + shadowSpeed = false; + godSlayer = false; + godSlayerDamage = false; + godSlayerMage = false; + godSlayerRanged = false; + godSlayerThrowing = false; + godSlayerSummon = false; + godSlayerReflect = false; + auricBoost = false; + silvaSet = false; + silvaMelee = false; + silvaRanged = false; + silvaThrowing = false; + silvaMage = false; + silvaSummon = false; + hasSilvaEffect = false; + silvaCountdown = 600; + silvaHitCounter = 0; + auricSet = false; + omegaBlueChestplate = false; + omegaBlueSet = false; + omegaBlueCooldown = 0; + molluskSet = false; + daedalusReflect = false; + daedalusSplit = false; + daedalusAbsorb = false; + daedalusShard = false; + reaverSpore = false; + reaverDoubleTap = false; + shadeRegen = false; + dsSetBonus = false; + reaverBlast = false; + reaverBurst = false; + astralStarRain = false; + ataxiaMage = false; + ataxiaBolt = false; + ataxiaGeyser = false; + ataxiaFire = false; + ataxiaVolley = false; + ataxiaBlaze = false; + victideSet = false; + aeroSet = false; + statigelSet = false; + tarraSet = false; + tarraMelee = false; + tarraMage = false; + tarraRanged = false; + tarraThrowing = false; + tarraThrowingCrits = 0; + tarraThrowingCritTimer = 0; + tarraSummon = false; + bloodflareSet = false; + bloodflareMelee = false; + bloodflareMeleeHits = 0; + bloodflareFrenzyTimer = 0; + bloodflareFrenzyCooldown = 0; + bloodflareRanged = false; + bloodflareRangedCooldown = 0; + bloodflareThrowing = false; + bloodflareMage = false; + bloodflareSummon = false; + bloodflareSummonTimer = 0; + xerocSet = false; + IBoots = false; + elysianFire = false; + elysianAegis = false; + elysianGuard = false; + #endregion + + if (CalamityWorld.bossRushActive) + { + if (!CalamityGlobalNPC.AnyLivingPlayers()) + { + CalamityWorld.bossRushActive = false; + CalamityWorld.bossRushStage = 0; + 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(); + } + for (int doom = 0; doom < 200; doom++) + { + if (Main.npc[doom].active && Main.npc[doom].boss) + { + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + } + } + if (CalamityWorld.armageddon && !areThereAnyDamnBosses) + { + player.respawnTimer -= 5; + } + else if (player.respawnTimer > 300 && Main.expertMode) //600 normal 900 expert + { + player.respawnTimer--; + } + } + #endregion + + #region BiomeStuff + public override void UpdateBiomeVisuals() + { + bool useNebula = NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")); + player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHead", useNebula); + + bool useNebulaS = NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")); + player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHeadS", useNebulaS); + + bool useBrimstone = NPC.AnyNPCs(mod.NPCType("CalamitasRun3")); + player.ManageSpecialBiomeVisuals("CalamityMod:CalamitasRun3", useBrimstone); + + bool usePlague = NPC.AnyNPCs(mod.NPCType("PlaguebringerGoliath")); + player.ManageSpecialBiomeVisuals("CalamityMod:PlaguebringerGoliath", usePlague); + + Point point = player.Center.ToTileCoordinates(); + bool aboveGround = point.Y > Main.maxTilesY - 320; + bool overworld = player.ZoneOverworldHeight && (point.X < 380 || point.X > Main.maxTilesX - 380); + bool useFire = NPC.AnyNPCs(mod.NPCType("Yharon")); + player.ManageSpecialBiomeVisuals("CalamityMod:Yharon", useFire); + player.ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (useFire || trippy || + (aboveGround || ((double)point.Y < Main.worldSurface && player.ZoneDesert && !overworld && !Main.raining && !Filters.Scene["Sandstorm"].IsActive())))); + + bool useWater = NPC.AnyNPCs(mod.NPCType("Leviathan")); + player.ManageSpecialBiomeVisuals("CalamityMod:Leviathan", useWater); + + bool useHoly = NPC.AnyNPCs(mod.NPCType("Providence")); + player.ManageSpecialBiomeVisuals("CalamityMod:Providence", useHoly); + + bool useSBrimstone = NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); + player.ManageSpecialBiomeVisuals("CalamityMod:SupremeCalamitas", useSBrimstone); + + bool inAstral = ZoneAstral; + player.ManageSpecialBiomeVisuals("CalamityMod:Astral", inAstral); + } + + public override void UpdateBiomes() + { + Point point = player.Center.ToTileCoordinates(); + ZoneCalamity = CalamityWorld.calamityTiles > 50; + ZoneAstral = !player.ZoneDungeon && (CalamityWorld.astralTiles > 950 || (player.ZoneSnow && CalamityWorld.astralTiles > 300)); + ZoneSunkenSea = CalamityWorld.sunkenSeaTiles > 150; + + 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 sulphurPosX = false; + bool abyssPosY = (point.Y <= abyssChasmY); + if (CalamityWorld.abyssSide) + { + if (point.X < 380) + { + sulphurPosX = true; + } + if (point.X < abyssChasmX + 80) + { + abyssPosX = true; + } + } + else + { + if (point.X > Main.maxTilesX - 380) + { + sulphurPosX = true; + } + if (point.X > abyssChasmX - 80) + { + abyssPosX = true; + } + } + + ZoneAbyss = (((double)point.Y > (Main.rockLayer - (double)y * 0.05)) && + !player.lavaWet && + !player.honeyWet && + abyssPosY && + abyssPosX); + + ZoneAbyssLayer1 = ZoneAbyss && + (double)point.Y <= (Main.rockLayer + (double)y * 0.03); + + ZoneAbyssLayer2 = ZoneAbyss && + (double)point.Y > (Main.rockLayer + (double)y * 0.03) && + (double)point.Y <= (Main.rockLayer + (double)y * 0.14); + + ZoneAbyssLayer3 = ZoneAbyss && + (double)point.Y > (Main.rockLayer + (double)y * 0.14) && + (double)point.Y <= (Main.rockLayer + (double)y * 0.26); + + ZoneAbyssLayer4 = ZoneAbyss && + (double)point.Y > (Main.rockLayer + (double)y * 0.26); + + ZoneSulphur = (CalamityWorld.sulphurTiles > 30 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; + } + + public override bool CustomBiomesMatch(Player other) + { + CalamityPlayer modOther = other.GetModPlayer(mod); + return ZoneCalamity == modOther.ZoneCalamity || ZoneAstral == modOther.ZoneAstral || ZoneAbyss == modOther.ZoneAbyss || + ZoneAbyssLayer1 == modOther.ZoneAbyssLayer1 || ZoneAbyssLayer2 == modOther.ZoneAbyssLayer2 || + ZoneAbyssLayer3 == modOther.ZoneAbyssLayer3 || ZoneAbyssLayer4 == modOther.ZoneAbyssLayer4 || + ZoneSulphur == modOther.ZoneSulphur || ZoneSunkenSea == modOther.ZoneSunkenSea; + } + + public override void CopyCustomBiomesTo(Player other) + { + CalamityPlayer modOther = other.GetModPlayer(mod); + modOther.ZoneCalamity = ZoneCalamity; + modOther.ZoneAstral = ZoneAstral; + modOther.ZoneSulphur = ZoneSulphur; + modOther.ZoneSunkenSea = ZoneSunkenSea; + modOther.ZoneAbyss = ZoneAbyss; + modOther.ZoneAbyssLayer1 = ZoneAbyssLayer1; + modOther.ZoneAbyssLayer2 = ZoneAbyssLayer2; + modOther.ZoneAbyssLayer3 = ZoneAbyssLayer3; + modOther.ZoneAbyssLayer4 = ZoneAbyssLayer4; + } + + public override void SendCustomBiomes(BinaryWriter writer) + { + BitsByte flags = new BitsByte(); + flags[0] = ZoneCalamity; + flags[1] = ZoneAstral; + flags[2] = ZoneAbyss; + flags[3] = ZoneAbyssLayer1; + flags[4] = ZoneAbyssLayer2; + flags[5] = ZoneAbyssLayer3; + flags[6] = ZoneAbyssLayer4; + flags[7] = ZoneSulphur; + + BitsByte flags2 = new BitsByte(); + flags2[0] = ZoneSunkenSea; + + writer.Write(flags); + writer.Write(flags2); + } + + public override void ReceiveCustomBiomes(BinaryReader reader) + { + BitsByte flags = reader.ReadByte(); + ZoneCalamity = flags[0]; + ZoneAstral = flags[1]; + ZoneAbyss = flags[2]; + ZoneAbyssLayer1 = flags[3]; + ZoneAbyssLayer2 = flags[4]; + ZoneAbyssLayer3 = flags[5]; + ZoneAbyssLayer4 = flags[6]; + ZoneSulphur = flags[7]; + + BitsByte flags2 = reader.ReadByte(); + ZoneSunkenSea = flags2[0]; + } + + public override Texture2D GetMapBackgroundImage() + { + if (ZoneSulphur) + { + return mod.GetTexture("Backgrounds/MapBackgrounds/SulphurBG"); + } + if (ZoneAstral) + { + return mod.GetTexture("Backgrounds/MapBackgrounds/AstralBG"); + } + return null; + } + #endregion + + #region InventoryStartup + public override void SetupStartInventory(IList items, bool mediumcoreDeath) + { + if (!mediumcoreDeath) + { + player.inventory[9].SetDefaults(mod.ItemType("Revenge")); + player.inventory[8].SetDefaults(mod.ItemType("IronHeart")); + player.inventory[7].SetDefaults(mod.ItemType("StarterBag")); + } + } + #endregion + + #region LifeRegen + public override void UpdateBadLifeRegen() + { + Point point = player.Center.ToTileCoordinates(); + #region FirstDebuffs + if (wDeath) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.statDefense -= 50; + player.meleeDamage -= 0.1f; + player.rangedDamage -= 0.1f; + player.magicDamage -= 0.1f; + player.minionDamage -= 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage -= 0.1f; + } + if (bFlames || aFlames) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 16; + } + if (gsInferno || (ZoneCalamity && player.lavaWet)) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 30; + } + if (ZoneSulphur && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && !aquaticScourgeLore) + { + player.AddBuff(BuffID.Poisoned, 2, true); + pissWaterBoost++; + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + if (pissWaterBoost > 1800) + { + player.lifeRegen -= 6; + } + else if (pissWaterBoost > 1440) + { + player.lifeRegen -= 4; + } + else if (pissWaterBoost > 1080) + { + player.lifeRegen -= 3; + } + else if (pissWaterBoost > 720) + { + player.lifeRegen -= 2; + } + else if (pissWaterBoost > 360) + { + player.lifeRegen -= 1; + } + } + else + { + pissWaterBoost = 0; + } + if (hFlames) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 20; + } + if (pFlames) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 20; + player.blind = true; + player.statDefense -= 8; + player.moveSpeed -= 0.15f; + } + if (bBlood) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 8; + player.blind = true; + player.statDefense -= 3; + player.moveSpeed += 0.2f; + player.meleeDamage += 0.05f; + player.rangedDamage -= 0.1f; + player.magicDamage -= 0.1f; + } + if (horror) + { + player.blind = true; + player.statDefense -= 15; + player.moveSpeed -= 0.15f; + } + if (aCrunch) + { + player.statDefense /= 3; + player.endurance *= 0.33f; + } + if (vHex) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 16; + player.blind = true; + player.statDefense -= 30; + player.moveSpeed -= 0.1f; + if (player.wingTimeMax <= 0) + { + player.wingTimeMax = 0; + } + player.wingTimeMax /= 2; + } + if (cDepth) + { + if (player.statDefense > 0) + { + int depthDamage = depthCharm ? 9 : 18; + int subtractDefense = (int)((double)player.statDefense * 0.05); //240 defense = 0 damage taken with depth charm + int calcDepthDamage = depthDamage - subtractDefense; + if (calcDepthDamage < 0) + { + calcDepthDamage = 0; + } + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= calcDepthDamage; + } + } + #endregion + #region Buffs + if (tRegen) + { + player.lifeRegen += 3; + } + if (sRegen) + { + player.lifeRegen += 2; + } + if (tarraSet) + { + player.calmed = (tarraMelee ? false : true); + player.lifeMagnet = true; + } + if (aChicken) + { + player.lifeRegen += 1; + player.statDefense += 5; + player.moveSpeed += 0.1f; + } + if (cadence) + { + if (player.FindBuffIndex(BuffID.Regeneration) > -1) { player.ClearBuff(BuffID.Regeneration); } + if (player.FindBuffIndex(BuffID.Lifeforce) > -1) { player.ClearBuff(BuffID.Lifeforce); } + player.discount = true; + player.lifeMagnet = true; + player.calmed = true; + player.loveStruck = true; + player.lifeRegen += 5; + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 25; + } + if (omniscience) + { + player.detectCreature = true; + player.dangerSense = true; + player.findTreasure = true; + } + if (aWeapon) + { + player.moveSpeed += 0.15f; + } + if (mushy) + { + player.statDefense += 5; + player.lifeRegen += 1; + } + if (molten) + { + player.resistCold = true; + } + if (shellBoost) + { + player.moveSpeed += 0.9f; + } + if (celestialJewel || astralArcanum) + { + bool lesserEffect = false; + for (int l = 0; l < 22; l++) + { + int hasBuff = player.buffType[l]; + bool shouldAffect = CalamityMod.alcoholList.Contains(hasBuff); + if (shouldAffect) + { + lesserEffect = true; + } + } + if (lesserEffect) + { + player.lifeRegen += 1; + player.statDefense += 20; + } + else + { + if (player.lifeRegen < 0) + { + if (player.lifeRegenTime < 1800) + { + player.lifeRegenTime = 1800; + } + player.lifeRegen += 4; + player.statDefense += 20; + } + else + { + player.lifeRegen += 2; + } + } + } + else if (crownJewel) + { + bool lesserEffect = false; + for (int l = 0; l < 22; l++) + { + int hasBuff = player.buffType[l]; + bool shouldAffect = CalamityMod.alcoholList.Contains(hasBuff); + if (shouldAffect) + { + lesserEffect = true; + } + } + if (lesserEffect) + { + player.statDefense += 10; + } + else + { + if (player.lifeRegen < 0) + { + if (player.lifeRegenTime < 1800) + { + player.lifeRegenTime = 1800; + } + player.lifeRegen += 2; + player.statDefense += 10; + } + else + { + player.lifeRegen += 1; + } + } + } + if (permafrostsConcoction) + { + if (player.statLife < player.statLifeMax2 / 2) + player.lifeRegen++; + if (player.statLife < player.statLifeMax2 / 4) + player.lifeRegen++; + if (player.statLife < player.statLifeMax2 / 10) + player.lifeRegen += 2; + if (player.poisoned || player.onFire || bFlames) + player.lifeRegen += 4; + } + if (CalamityCollision.HotWetCollision(player.position, player.width, player.height) || (ZoneAbyssLayer4 && point.Y > Main.maxTilesY - 300) || ZoneSunkenSea) + { + if (player.lifeRegen < 0) + { + player.lifeRegen += 2; + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + } + player.lifeRegenTime += 1; + player.lifeRegen += 1; + } + #endregion + #region LastDebuffs + if (omegaBlueChestplate) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + + if (player.lifeRegenCount > 0) + player.lifeRegenCount = 0; + } + if (Config.LethalLava) + { + if (Main.myPlayer == player.whoAmI) + { + if (Collision.LavaCollision(player.position, player.width, (player.waterWalk ? (player.height - 6) : player.height))) + { + if (player.lavaImmune && !player.immune) + { + if (player.lavaTime > 0) + { + player.lavaTime--; + } + } + if (player.lavaTime <= 0) + { + player.AddBuff(mod.BuffType("LethalLavaBurn"), 2, true); + } + } + } + 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++; + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + if (hInfernoBoost > 240) + { + player.lifeRegen -= 192; + } + else if (hInfernoBoost > 180) + { + player.lifeRegen -= 96; + } + else if (hInfernoBoost > 120) + { + player.lifeRegen -= 48; + } + else if (hInfernoBoost > 60) + { + player.lifeRegen -= 24; + } + else if (hInfernoBoost > 0) + { + player.lifeRegen -= 12; + } + } + else + { + hInfernoBoost = 0; + } + if (gState) + { + player.statDefense /= 2; + player.velocity.Y = 0f; + player.velocity.X = 0f; + } + if (eGravity) + { + player.velocity.X *= 0.99f; + if (player.wingTimeMax < 0) + { + player.wingTimeMax = 0; + } + player.wingTimeMax /= 4; + if (player.wingTimeMax > 400) + { + player.wingTimeMax = 100; + } + } + if (eGrav) + { + player.velocity.X *= 0.99f; + if (player.wingTimeMax < 0) + { + player.wingTimeMax = 0; + } + player.wingTimeMax /= 3; + if (player.wingTimeMax > 400) + { + player.wingTimeMax = 200; + } + } + if (warped) + { + player.velocity.X *= 0.99f; + } + if (molluskSet) + { + player.velocity.X *= 0.985f; + } + if ((warped || caribbeanRum) && !player.slowFall) + { + player.velocity.Y *= 1.01f; + } + 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 + } + + #region UpdateLifeRegen + public override void UpdateLifeRegen() + { + if (!player.shinyStone) + { + int lifeRegenTimeMaxBoost = (areThereAnyDamnBosses ? 450 : 1800); + int lifeRegenMaxBoost = (areThereAnyDamnBosses ? 1 : 4); + float lifeRegenLifeRegenTimeMaxBoost = (areThereAnyDamnBosses ? 8f : 30f); + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + if (shadeRegen) + { + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) + { + 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) + { + 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; + } + } + } + else if (cFreeze) + { + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) + { + 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) + { + 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; + } + } + } + else if (draedonsHeart) + { + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) + { + 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) + { + 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; + } + } + } + } + } + } + #endregion + #endregion + + #region HotKeys + public override void ProcessTriggers(TriggersSet triggersSet) + { + if (CalamityMod.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == player.whoAmI) + { + Vector2 teleportLocation; + teleportLocation.X = (float)Main.mouseX + Main.screenPosition.X; + if (player.gravDir == 1f) + { + teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; + } + else + { + teleportLocation.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; + } + teleportLocation.X -= (float)(player.width / 2); + if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) + { + int x = (int)(teleportLocation.X / 16f); + int y = (int)(teleportLocation.Y / 16f); + if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) + { + player.Teleport(teleportLocation, 4, 0); + NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); + if (player.chaosState) + { + player.statLife -= player.statLifeMax2 / 4; + 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); + } + } + } + if (CalamityMod.BossBarToggleHotKey.JustPressed) + { + if (drawBossHPBar) + { + drawBossHPBar = false; + } + else + { + drawBossHPBar = true; + } + } + if (CalamityMod.BossBarToggleSmallTextHotKey.JustPressed) + { + if (shouldDrawSmallText) + { + shouldDrawSmallText = false; + } + else + { + shouldDrawSmallText = true; + } + } + if (CalamityMod.TarraHotKey.JustPressed) + { + if (tarraMelee && tarraCooldown <= 0) + { + tarraDefense = true; + } + if (bloodflareRanged && bloodflareRangedCooldown <= 0) + { + bloodflareRangedCooldown = 1800; + Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + for (int num502 = 0; num502 < 64; num502++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 60, 0f, 0f, 0, default(Color), 1f); + Main.dust[dust].velocity *= 3f; + Main.dust[dust].scale *= 1.15f; + } + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int damage = 800; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 8; i++) + { + float ai1 = (Main.rand.NextFloat() + 0.5f); + float randomSpeed = (float)Main.rand.Next(1, 7); + float randomSpeed2 = (float)Main.rand.Next(1, 7); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, mod.ProjectileType("BloodflareSoul"), damage, 0f, player.whoAmI, 0f, ai1); + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, mod.ProjectileType("BloodflareSoul"), damage, 0f, player.whoAmI, 0f, ai1); + } + } + } + if (omegaBlueSet && omegaBlueCooldown <= 0) + { + omegaBlueCooldown = 1800; + Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + for (int i = 0; i < 66; i++) + { + int d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); + Main.dust[d].noGravity = true; + Main.dust[d].noLight = true; + Main.dust[d].fadeIn = 1f; + Main.dust[d].velocity *= 6.6f; + } + } + if (dsSetBonus) + { + Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + for (int num502 = 0; num502 < 36; num502++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default(Color), 1f); + Main.dust[dust].velocity *= 3f; + Main.dust[dust].scale *= 1.15f; + } + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(mod.BuffType("Enraged"), 600, false); + } + if (Main.netMode != 1) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= 3000f) + { + nPC.AddBuff(mod.BuffType("Enraged"), 600, false); + } + } + } + } + } + if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum) + { + AstralArcanumUI.Toggle(); + } + if (CalamityMod.AstralTeleportHotKey.JustPressed) + { + if (celestialJewel) + { + if (Main.netMode == 0) + { + player.TeleportationPotion(); + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 6); + } + else if (Main.netMode == 1 && player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(73, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + } + if (CalamityMod.AegisHotKey.JustPressed) + { + if (elysianAegis && !player.mount.Active) + { + elysianGuard = !elysianGuard; + } + } + if (CalamityMod.RageHotKey.JustPressed) + { + if (stress == stressMax && !rageMode) + { + Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + for (int num502 = 0; num502 < 64; num502++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default(Color), 1f); + Main.dust[dust].velocity *= 3f; + Main.dust[dust].scale *= 1.15f; + } + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + player.AddBuff(mod.BuffType("RageMode"), 300); + } + } + if (CalamityMod.AdrenalineHotKey.JustPressed) + { + if (adrenaline == adrenalineMax && !adrenalineMode) + { + Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104); + for (int num502 = 0; num502 < 64; num502++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 206, 0f, 0f, 0, default(Color), 1f); + Main.dust[dust].velocity *= 3f; + Main.dust[dust].scale *= 2f; + } + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 206, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + player.AddBuff(mod.BuffType("AdrenalineMode"), 300); + } + } + } + #endregion + + #region TeleportMethods + public void HandleTeleport(int teleportType, bool forceHandle = false, int whoAmI = 0) + { + bool syncData = forceHandle || Main.netMode == 0; + if (syncData) + { + TeleportPlayer(teleportType, forceHandle, whoAmI); + } + else + { + SyncTeleport(teleportType); + } + } + + public static void TeleportPlayer(int teleportType, bool syncData = false, int whoAmI = 0) + { + Player player; + if (!syncData) + { + player = Main.LocalPlayer; + } + else + { + player = Main.player[whoAmI]; + } + switch (teleportType) + { + case 0: UnderworldTeleport(player, syncData); break; + case 1: DungeonTeleport(player, syncData); break; + case 2: JungleTeleport(player, syncData); break; + default: break; + } + } + + public void SyncTeleport(int teleportType) + { + ModPacket netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.TeleportPlayer); + netMessage.Write(teleportType); + netMessage.Send(); + } + + public static void UnderworldTeleport(Player player, bool syncData = false) + { + int teleportStartX = 100; + int teleportRangeX = Main.maxTilesX - 200; + int teleportStartY = Main.maxTilesY - 200; + int teleportRangeY = 50; + bool flag = false; + int num = 0; + int num2 = 0; + int num3 = 0; + int width = player.width; + Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + while (!flag && num < 1000) + { + num++; + num2 = teleportStartX + Main.rand.Next(teleportRangeX); + num3 = teleportStartY + Main.rand.Next(teleportRangeY); + vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + if (!Collision.SolidCollision(vector, width, player.height)) + { + if (Main.tile[num2, num3] == null) + { + Main.tile[num2, num3] = new Tile(); + } + int i = 0; + while (i < 100) + { + if (Main.tile[num2, num3 + i] == null) + { + Main.tile[num2, num3 + i] = new Tile(); + } + Tile tile = Main.tile[num2, num3 + i]; + vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); + bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height); + if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X) + { + bool arg_1FE_0 = vector2.Y == vector.Y; + } + if (arg_1FF_0) + { + i++; + } + else + { + if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.type]) + { + break; + } + i++; + } + } + if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f) + { + Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); + if (Collision.SolidCollision(vector, width, player.height) && i < 99) + { + Vector2 vector3 = Vector2.UnitX * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = -Vector2.UnitX * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = Vector2.UnitY * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = -Vector2.UnitY * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + flag = true; + num3 += i; + break; + } + } + } + } + } + } + } + } + if (!flag) + { + return; + } + ModTeleport(player, vector, syncData, false); + } + + public static void DungeonTeleport(Player player, bool syncData = false) + { + ModTeleport(player, new Vector2(Main.dungeonX, Main.dungeonY), syncData, true); + } + + public static void JungleTeleport(Player player, bool syncData = false) + { + int jungleSide = CalamityWorld.abyssSide ? ((Main.maxTilesX / 2) + (Main.maxTilesX / 4)) : (Main.maxTilesX / 5); + int teleportStartX = jungleSide; + int teleportRangeX = 200; + int teleportStartY = (int)Main.worldSurface; + int teleportRangeY = 50; + bool flag = false; + int num = 0; + int num2 = 0; + int num3 = 0; + int width = player.width; + Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + while (!flag && num < 1000) + { + num++; + num2 = teleportStartX + Main.rand.Next(teleportRangeX); + num3 = teleportStartY + Main.rand.Next(teleportRangeY); + vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + if (!Collision.SolidCollision(vector, width, player.height)) + { + if (Main.tile[num2, num3] == null) + { + Main.tile[num2, num3] = new Tile(); + } + int i = 0; + while (i < 100) + { + if (Main.tile[num2, num3 + i] == null) + { + Main.tile[num2, num3 + i] = new Tile(); + } + Tile tile = Main.tile[num2, num3 + i]; + vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)(-(float)player.height)); + Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); + bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height); + if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X) + { + bool arg_1FE_0 = vector2.Y == vector.Y; + } + if (arg_1FF_0) + { + i++; + } + else + { + if (tile.active() && !tile.inActive() && Main.tileSolid[(int)tile.type]) + { + break; + } + i++; + } + } + if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f) + { + Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); + if (Collision.SolidCollision(vector, width, player.height) && i < 99) + { + Vector2 vector3 = Vector2.UnitX * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = -Vector2.UnitX * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = Vector2.UnitY * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + vector3 = -Vector2.UnitY * 16f; + if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) + { + flag = true; + num3 += i; + break; + } + } + } + } + } + } + } + } + if (!flag) + { + return; + } + ModTeleport(player, vector, syncData, false); + } + + public static void ModTeleport(Player player, Vector2 pos, bool syncData = false, bool convertFromTiles = false) + { + bool postImmune = player.immune; + int postImmunteTime = player.immuneTime; + if (convertFromTiles) + { + pos = new Vector2(pos.X * 16 + 8 - player.width / 2, pos.Y * 16 - player.height); + } + player.grappling[0] = -1; + player.grapCount = 0; + for (int index = 0; index < 1000; ++index) + { + if (Main.projectile[index].active && Main.projectile[index].owner == player.whoAmI && Main.projectile[index].aiStyle == 7) + { + Main.projectile[index].Kill(); + } + } + player.Teleport(pos, 2, 0); + player.velocity = Vector2.Zero; + player.immune = postImmune; + player.immuneTime = postImmunteTime; + for (int index = 0; index < 100; ++index) + { + Main.dust[Dust.NewDust(player.position, player.width, player.height, 164, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; + } + Main.TeleportEffect(player.getRect(), 1); + Main.TeleportEffect(player.getRect(), 3); + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 6); + if (Main.netMode != 2) + { + return; + } + if (syncData) + { + RemoteClient.CheckSection(player.whoAmI, player.position, 1); + NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, pos.X, pos.Y, 3, 0, 0); + } + } + #endregion + + #region UpdateEquips + public override void UpdateVanityAccessories() + { + for (int n = 13; n < 18 + player.extraAccessorySlots; n++) + { + Item item = player.armor[n]; + if (item.type == mod.ItemType()) + { + snowmanHide = false; + snowmanForce = true; + } + else if (item.type == mod.ItemType()) + { + abyssalDivingSuitHide = false; + abyssalDivingSuitForce = true; + } + else if (item.type == mod.ItemType()) + { + sirenBoobsHide = false; + sirenBoobsForce = true; + } + else if (item.type == mod.ItemType()) + { + sirenBoobsAltHide = false; + sirenBoobsAltForce = true; + } + } + } + + public override void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff) + { + if (Config.MiningSpeedBoost) + { + player.pickSpeed *= 0.75f; + } + + #region MeleeSpeed + float meleeSpeedMult = 0f; + if (bBlood) + { + meleeSpeedMult += 0.025f; + } + if (rRage) + { + meleeSpeedMult += 0.05f; + } + if (graxDefense) + { + meleeSpeedMult += 0.05f; + } + if (sMeleeBoost) + { + meleeSpeedMult += 0.05f; + } + if (yPower) + { + meleeSpeedMult += 0.05f; + } + if (darkSunRing) + { + meleeSpeedMult += 0.12f; + } + if (badgeOfBravery) + { + meleeSpeedMult += 0.15f; + } + if (badgeOfBraveryRare) + { + meleeSpeedMult += 0.2f; + } + if (eGauntlet) + { + meleeSpeedMult += 0.15f; + } + if (yInsignia) + { + meleeSpeedMult += 0.1f; + } + if (bloodyMary) + { + if (Main.bloodMoon) + { + meleeSpeedMult += 0.15f; + } + } + if (community) + { + float floatTypeBoost = 0.01f + + (NPC.downedSlimeKing ? 0.01f : 0f) + + (NPC.downedBoss1 ? 0.01f : 0f) + + (NPC.downedBoss2 ? 0.01f : 0f) + + (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 + (NPC.downedBoss3 ? 0.01f : 0f) + + (Main.hardMode ? 0.01f : 0f) + + (NPC.downedMechBossAny ? 0.01f : 0f) + + (NPC.downedPlantBoss ? 0.01f : 0f) + + (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 + (NPC.downedFishron ? 0.01f : 0f) + + (NPC.downedAncientCultist ? 0.01f : 0f) + + (NPC.downedMoonlord ? 0.01f : 0f) + + (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 + (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 + (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 + meleeSpeedMult += (floatTypeBoost * 0.25f); + } + if (eArtifact) + { + meleeSpeedMult += 0.1f; + } + if (Config.ProficiencyEnabled) + { + meleeSpeedMult += GetMeleeSpeedBonus(); + } + player.meleeSpeed += meleeSpeedMult; + #endregion + + if (snowman) + { + if (player.whoAmI == Main.myPlayer && !snowmanNoseless) + { + player.AddBuff(mod.BuffType(), 60, true); + } + } + if (abyssalDivingSuit) + { + player.AddBuff(mod.BuffType(), 60, true); + if (player.whoAmI == Main.myPlayer) + { + if (abyssalDivingSuitCooldown) + { + for (int l = 0; l < 22; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] < 30 && hasBuff == mod.BuffType("AbyssalDivingSuitPlatesBroken")) + { + abyssalDivingSuitPlateHits = 0; + player.DelBuff(l); + l = -1; + } + } + } + else + { + player.AddBuff(mod.BuffType("AbyssalDivingSuitPlates"), 2); + } + } + } + if (sirenBoobs) + { + player.AddBuff(mod.BuffType(), 60, true); + } + else if (sirenBoobsAlt) + { + player.AddBuff(mod.BuffType(), 60, true); + } + if ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) + { + if (player.whoAmI == Main.myPlayer && !sirenIceCooldown) + { + player.AddBuff(mod.BuffType("IceShieldBuff"), 2); + } + } + } + #endregion + + #region PreUpdateBuffs + public override void PreUpdateBuffs() + { + //Remove the mighty wind buff if the player is in the astral desert. + if (player.ZoneDesert && ZoneAstral && player.HasBuff(BuffID.WindPushed)) + { + player.ClearBuff(BuffID.WindPushed); + } + } + #endregion + + #region PostUpdate + + #region PostUpdateBuffs + public override void PostUpdateBuffs() + { + if (CalamityWorld.defiled) + Defiled(); + + if (weakPetrification) + WeakPetrification(); + + if (CalamityWorld.bossRushActive) + BossRushMovementChanges(); + + if (player.mount.Active || player.mount.Cart || (Config.BossRushDashCurse && CalamityWorld.bossRushActive)) + { + player.dashDelay = 60; + dashMod = 0; + } + + if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) + { + if (player.lifeRegen < 0) + player.lifeRegen = 0; + } + } + #endregion + + #region PostUpdateEquips + public override void PostUpdateEquips() + { + if (CalamityWorld.defiled) + Defiled(); + + if (weakPetrification) + WeakPetrification(); + + if (CalamityWorld.bossRushActive) + BossRushMovementChanges(); + + if (player.mount.Active || player.mount.Cart || (Config.BossRushDashCurse && CalamityWorld.bossRushActive)) + { + player.dashDelay = 60; + dashMod = 0; + } + + if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) + { + if (player.lifeRegen < 0) + player.lifeRegen = 0; + } + } + #endregion + + public override void PostUpdateMiscEffects() + { + if (Config.ExpertDebuffDurationReduction) + Main.expertDebuffTime = 1f; + + areThereAnyDamnBosses = CalamityGlobalNPC.AnyBossNPCS(); + + #region RevengeanceEffects + /*if (!areThereAnyDamnBosses) + { + distanceFromBoss = -1; + }*/ + if (CalamityWorld.revenge) + { + if (player.lifeSteal > (CalamityWorld.death ? 30f : 40f)) + { + player.lifeSteal = (CalamityWorld.death ? 30f : 40f); + } + if (player.whoAmI == Main.myPlayer) + { + if (player.onHitDodge) + { + for (int l = 0; l < 22; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] > 360 && hasBuff == BuffID.ShadowDodge) + { + player.buffTime[l] = 360; + } + } + } + if (player.immuneTime > (tarraThrowing ? 300 : 120)) + { + player.immuneTime = (tarraThrowing ? 300 : 120); + } + if (Config.AdrenalineAndRage) + { + int stressGain = 0; + if (rageMode) + { + stressGain = -2000; + } + else + { + if (draedonsHeart) + { + if (draedonsStressGain) + { + stressGain += 60; + } + } + else if (heartOfDarkness) + { + stressGain += 30; + } + } + stressCD++; + if (stressCD >= 60) + { + stressCD = 0; + stress += stressGain; + if (stress < 0) + { + stress = 0; + } + if (stress >= stressMax) + { + if (playFullRageSound) + { + playFullRageSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); + } + stress = stressMax; + } + else + { + playFullRageSound = true; + } + } + stressLevel500 = stress >= 9800; + if (stressLevel500 && !hAttack) + { + int heartAttackChance = ((draedonsHeart || heartOfDarkness) ? 2000 : 10000); + if (Main.rand.Next(heartAttackChance) == 0) + { + player.AddBuff(mod.BuffType("HeartAttack"), 18000); + } + } + if (adrenaline >= adrenalineMax) + { + adrenalineMaxTimer--; + if (adrenalineMaxTimer <= 0) + { + if (playAdrenalineBurnoutSound) + { + playAdrenalineBurnoutSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout1"), (int)player.position.X, (int)player.position.Y); + } + adrenalineDmgDown--; + if (adrenalineDmgDown < 0) + { + if (playFullAdrenalineBurnoutSound) + { + playFullAdrenalineBurnoutSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout2"), (int)player.position.X, (int)player.position.Y); + } + adrenalineDmgDown = 0; + } + adrenalineMaxTimer = 0; + } + } + else if (!adrenalineMode && adrenaline <= 0) + { + playAdrenalineBurnoutSound = true; + playFullAdrenalineBurnoutSound = true; + adrenalineDmgDown = 600; + adrenalineMaxTimer = 300; + adrenalineDmgMult = 1f; + } + adrenalineDmgMult = 0.1f * (float)(adrenalineDmgDown / 60); + if (adrenalineDmgMult < 0.33f) + adrenalineDmgMult = 0.33f; + int adrenalineGain = 0; + bool SCalAlive = NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); + if (adrenalineMode) + { + adrenalineGain = (SCalAlive ? -10000 : -2000); + } + else + { + if (Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16)) // > + { + adrenaline = 0; + } + else if (areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0) + { + int adrenalineTickBoost = 0 + + (adrenalineBoostOne ? 63 : 0) + //286 + (adrenalineBoostTwo ? 115 : 0) + //401 + (adrenalineBoostThree ? 100 : 0); //501 + adrenalineGain = 223 + adrenalineTickBoost; //pre-slime god = 45, pre-astrum deus = 35, pre-polterghast = 25, post-polter = 20 + /*if (distanceFromBoss == -1 || distanceFromBoss > 5600) + { + adrenalineGain /= 4; + }*/ + } + else + { + adrenaline = 0; + } + } + adrenalineCD++; + if (adrenalineCD >= (SCalAlive ? 135 : 60)) + { + adrenalineCD = 0; + adrenaline += adrenalineGain; + if (adrenaline < 0) + { + adrenaline = 0; + } + if (adrenaline >= adrenalineMax) + { + if (playFullAdrenalineSound) + { + playFullAdrenalineSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullAdrenaline"), (int)player.position.X, (int)player.position.Y); + } + adrenaline = adrenalineMax; + } + else + { + playFullAdrenalineSound = true; + } + } + } + } + } + else + { + if (player.whoAmI == Main.myPlayer) + { + stressCD++; + if (stressCD >= 60) + { + stressCD = 0; + stress += -30; + if (stress < 0) + { + stress = 0; + } + } + adrenalineCD++; + if (adrenalineCD >= 60) + { + adrenalineCD = 0; + adrenaline += -30; + if (adrenaline < 0) + { + adrenaline = 0; + } + } + } + } + if (player.whoAmI == Main.myPlayer && Main.netMode == 1) + { + packetTimer++; + if (packetTimer == 60) + { + packetTimer = 0; + StressPacket(false); + AdrenalinePacket(false); + /*if (areThereAnyDamnBosses) + DistanceFromBossPacket(false);*/ + } + } + #endregion + + #region StressTiedEffects + if (stressPills) + { + player.statDefense += 8; + AllDamageBoost(0.08f); + } + if (laudanum) + { + player.statDefense += 6; + AllDamageBoost(0.06f); + } + if (draedonsHeart) + { + AllDamageBoost(0.1f); + } + if (!stressLevel500 && player.FindBuffIndex(mod.BuffType("HeartAttack")) > -1) { player.ClearBuff(mod.BuffType("HeartAttack")); } + if (draedonsHeart && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.statDefense += 25; + } + if (hAttack) + { + if (heartOfDarkness || draedonsHeart) + { + AllDamageBoost(0.1f); + } + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; + } + if (affliction || 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); + } + #endregion + + #region MaxLifeAndManaBoosts + player.statLifeMax2 += + (mFruit ? 25 : 0) + + (bOrange ? 25 : 0) + + (eBerry ? 25 : 0) + + (dFruit ? 25 : 0); + if (silvaHitCounter > 0) + { + player.statLifeMax2 -= silvaHitCounter * 100; + if (player.statLifeMax2 <= 400) + { + 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 += + (pHeart ? 50 : 0) + + (eCore ? 50 : 0) + + (cShard ? 50 : 0) + + (starBeamRye ? 50 : 0); + if (Main.netMode != 2 && player.whoAmI == Main.myPlayer) + { + Texture2D rain3 = mod.GetTexture("ExtraTextures/Rain3"); + Texture2D rainOriginal = mod.GetTexture("ExtraTextures/RainOriginal"); + Texture2D mana2 = mod.GetTexture("ExtraTextures/Mana2"); + Texture2D mana3 = mod.GetTexture("ExtraTextures/Mana3"); + Texture2D mana4 = mod.GetTexture("ExtraTextures/Mana4"); + Texture2D manaOriginal = mod.GetTexture("ExtraTextures/ManaOriginal"); + Texture2D carpetAuric = mod.GetTexture("ExtraTextures/AuricCarpet"); + Texture2D carpetOriginal = mod.GetTexture("ExtraTextures/Carpet"); + int totalManaBoost = + (pHeart ? 1 : 0) + + (eCore ? 1 : 0) + + (cShard ? 1 : 0); + switch (totalManaBoost) + { + default: + Main.manaTexture = manaOriginal; + break; + case 3: + Main.manaTexture = mana4; + break; + case 2: + Main.manaTexture = mana3; + break; + case 1: + Main.manaTexture = mana2; + break; + } + if (Main.bloodMoon) { Main.rainTexture = rainOriginal; } + else if (Main.raining && ZoneSulphur) { Main.rainTexture = rain3; } + else { Main.rainTexture = rainOriginal; } + if (auricSet) { Main.flyingCarpetTexture = carpetAuric; } + else { Main.flyingCarpetTexture = carpetOriginal; } + } + #endregion + + #region MiscEffects + if (Config.ProficiencyEnabled) + { + GetExactLevelUp(); + } + + if (gainRageCooldown > 0) + gainRageCooldown--; + + if (player.nebulaLevelMana > 0 && player.statMana < player.statManaMax2) + { + int num = 12; + nebulaManaNerfCounter += player.nebulaLevelMana; + if (nebulaManaNerfCounter >= num) + { + nebulaManaNerfCounter -= num; + player.statMana--; + if (player.statMana < 0) + { + player.statMana = 0; + } + } + } + else + { + nebulaManaNerfCounter = 0; + } + if (Main.myPlayer == player.whoAmI) + { + BossHealthBarManager.SHOULD_DRAW_SMALLTEXT_HEALTH = shouldDrawSmallText; + /*if (player.chest != -1) + { + if (player.chest != -2) + { + trashManChest = -1; + } + if (trashManChest >= 0) + { + if (!Main.projectile[trashManChest].active || Main.projectile[trashManChest].type != mod.ProjectileType("DannyDevito")) + { + Main.PlaySound(SoundID.Item11, -1, -1); + player.chest = -1; + Recipe.FindRecipes(); + } + else + { + int num16 = (int)(((double)player.position.X + (double)player.width * 0.5) / 16.0); + int num17 = (int)(((double)player.position.Y + (double)player.height * 0.5) / 16.0); + player.chestX = (int)Main.projectile[trashManChest].Center.X / 16; + player.chestY = (int)Main.projectile[trashManChest].Center.Y / 16; + if (num16 < player.chestX - Player.tileRangeX || num16 > player.chestX + Player.tileRangeX + 1 || num17 < player.chestY - Player.tileRangeY || num17 > player.chestY + Player.tileRangeY + 1) + { + if (player.chest != -1) + { + Main.PlaySound(SoundID.Item11, -1, -1); + } + player.chest = -1; + Recipe.FindRecipes(); + } + } + } + } + else + { + trashManChest = -1; + }*/ + } + if (silvaSet || invincible || margarita) + { + foreach (int debuff in CalamityMod.debuffList) + player.buffImmune[debuff] = true; + } + if (aSparkRare) + { + player.buffImmune[BuffID.Electrified] = true; + } + if (Config.ExpertChilledWaterRemoval) + { + if (Main.expertMode && player.ZoneSnow && player.wet && !player.lavaWet && !player.honeyWet && !player.arcticDivingGear) + { + player.buffImmune[BuffID.Chilled] = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + if (Main.myPlayer == player.whoAmI && !player.gills && !player.merman) + { + if (player.breath > 0) + player.breath--; + } + } + } + } + if (ZoneAbyss) + { + 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 + (player.arcticDivingGear ? 1 : 0) + //3 + (jellyfishNecklace ? 1 : 0) + //4 + ((player.blueFairy || player.greenFairy || player.redFairy || player.petFlagDD2Ghost) ? 2 : 0) + //6 + ((shine || lumenousAmulet) ? 2 : 0) + //8 + ((player.wisp || player.suspiciouslookingTentacle || sirenPet) ? 3 : 0); //11 + bool lightLevelOne = lightStrength > 0; //1+ + bool lightLevelTwo = lightStrength > 2; //3+ + bool lightLevelThree = lightStrength > 4; //5+ + bool lightLevelFour = lightStrength > 6; //7+ + if (ZoneAbyssLayer4) //3200 and below + { + breathLoss = 54; + 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 (!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; + lifeLossAtZeroBreath = 6; + player.statDefense -= (anechoicPlating ? 10 : 30); + } + else if (ZoneAbyssLayer1) //1500 to 2100 + { + if (!lightLevelOne) + player.blind = true; + player.statDefense -= (anechoicPlating ? 5 : 15); + } + double breathLossMult = 1.0 - + (player.gills ? 0.2 : 0.0) - //0.8 + (player.accDivingHelm ? 0.25 : 0.0) - //0.75 + (player.arcticDivingGear ? 0.25 : 0.0) - //0.75 + (aquaticEmblem ? 0.25 : 0.0) - //0.75 + (player.accMerman ? 0.3 : 0.0) - //0.7 + (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; + } + breathLoss = (int)((double)breathLoss * breathLossMult); + int tick = 6; + double tickMult = 1.0 + + (player.gills ? 4.0 : 0.0) + //5 + (player.ignoreWater ? 5.0 : 0.0) + //10 + (player.accDivingHelm ? 10.0 : 0.0) + //20 + (player.arcticDivingGear ? 10.0 : 0.0) + //30 + (aquaticEmblem ? 10.0 : 0.0) + //40 + (player.accMerman ? 15.0 : 0.0) + //55 + (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; + } + tick = (int)((double)tick * tickMult); + abyssBreathCD++; + if (player.gills || player.merman) + { + if (player.breath > 0) + player.breath -= 3; + } + if (!Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + if (player.statLife > 100) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 160; + } + } + if (abyssBreathCD >= tick) + { + abyssBreathCD = 0; + if (player.breath > 0) + player.breath -= breathLoss; + if (cDepth) + { + if (player.breath > 0) + player.breath--; + } + if (player.breath <= 0) + { + if (depthCharm) + { + lifeLossAtZeroBreath -= 3; + if (abyssalDivingSuit) + lifeLossAtZeroBreath -= 6; + } + if (lifeLossAtZeroBreath < 0) + { + lifeLossAtZeroBreath = 0; + } + player.statLife -= lifeLossAtZeroBreath; + if (player.statLife <= 0) + { + KillPlayer(); + } + } + } + } + } + else + { + abyssBreathCD = 0; + } + if (!player.mount.Active) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && ironBoots) + { + player.maxFallSpeed = 7f; + } + if (aeroSet && !player.wet) + { + player.maxFallSpeed = 15f; + } + if (normalityRelocator) + { + player.maxFallSpeed *= 1.1f; + } + } + if (normalityRelocator) + { + player.moveSpeed += 0.1f; + } + if (player.ZoneSkyHeight) + { + if (astrumDeusLore) + { + player.moveSpeed += 0.2f; + } + if (astrumAureusLore) + { + player.jumpSpeedBoost += 0.5f; + } + } + if (omegaBlueSet) //should apply after rev caps, actually those are gone so AAAAA + { + //add tentacles + if (player.ownedProjectileCounts[mod.ProjectileType("OmegaBlueTentacle")] < 6) + { + bool[] tentaclesPresent = new bool[6]; + for (int i = 0; i < 1000; i++) + { + Projectile projectile = Main.projectile[i]; + if (projectile.active && projectile.type == mod.ProjectileType("OmegaBlueTentacle") && projectile.owner == Main.myPlayer && projectile.ai[1] >= 0f && projectile.ai[1] < 6f) + { + tentaclesPresent[(int)projectile.ai[1]] = true; + } + } + for (int i = 0; i < 6; i++) + { + if (!tentaclesPresent[i]) + { + float modifier = player.meleeDamage + player.magicDamage + player.rangedDamage + + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage + player.minionDamage; + modifier /= 5f; + int damage = (int)(666 * modifier); + Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f; + Projectile.NewProjectile(player.Center, vel, mod.ProjectileType("OmegaBlueTentacle"), damage, 8f, Main.myPlayer, Main.rand.Next(120), i); + } + } + } + float damageUp = 0.1f; + int critUp = 10; + if (omegaBlueHentai) + { + damageUp *= 2f; + critUp *= 2; + } + AllDamageBoost(damageUp); + AllCritBoost(critUp); + } + if (!bOut) + { + if (gHealer) + { + if (healCounter > 0) + { + healCounter--; + } + if (healCounter <= 0) + { + healCounter = 300; + if (player.whoAmI == Main.myPlayer) + { + int healAmount = 5 + + (gDefense ? 5 : 0) + + (gOffense ? 5 : 0); + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + } + if (gDefense) + { + player.moveSpeed += 0.1f + + (gOffense ? 0.1f : 0f); + player.endurance += 0.025f + + (gOffense ? 0.025f : 0f); + } + if (gOffense) + { + player.minionDamage += 0.1f + + (gDefense ? 0.05f : 0f); + player.maxMinions++; + } + } + 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; + silvaCountdown--; + if (silvaCountdown <= 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); + } + for (int j = 0; j < 2; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].noGravity = true; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.Next(2) == 0) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + } + if (tarraMelee) + { + if (tarraDefense) + { + tarraDefenseTime--; + if (tarraDefenseTime <= 0) + { + tarraDefenseTime = 600; + tarraCooldown = 1800; + tarraDefense = false; + } + for (int j = 0; j < 2; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].noGravity = true; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.Next(2) == 0) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + } + if (tarraCooldown > 0) + tarraCooldown--; + } + if (tarraThrowing) + { + if (tarraThrowingCritTimer > 0) + { + tarraThrowingCritTimer--; + } + if (tarraThrowingCrits >= 25) + { + tarraThrowingCrits = 0; + tarraThrowingCritTimer = 1800; + player.immune = true; + player.immuneTime = 300; + } + for (int l = 0; l < 22; l++) + { + int hasBuff = player.buffType[l]; + bool shouldAffect = CalamityMod.debuffList.Contains(hasBuff); + if (shouldAffect) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + } + } + } + if (bloodflareSet) + { + if (bloodflareHeartTimer > 0) + bloodflareHeartTimer--; + if (bloodflareManaTimer > 0) + bloodflareManaTimer--; + } + if (bloodflareMelee) + { + if (bloodflareMeleeHits >= 15) + { + bloodflareMeleeHits = 0; + bloodflareFrenzyTimer = 300; + } + if (bloodflareFrenzyTimer > 0) + { + bloodflareFrenzyTimer--; + if (bloodflareFrenzyTimer <= 0) + { + bloodflareFrenzyCooldown = 1800; + } + player.meleeCrit += 25; + player.meleeDamage += 0.25f; + for (int j = 0; j < 2; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 5, 0f, 0f, 100, default(Color), 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].noGravity = true; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.Next(2) == 0) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + } + if (bloodflareFrenzyCooldown > 0) + bloodflareFrenzyCooldown--; + } + if (bloodflareRanged) + { + if (bloodflareRangedCooldown > 0) + bloodflareRangedCooldown--; + } + if (Main.raining && ZoneSulphur) + { + if (player.ZoneOverworldHeight || player.ZoneSkyHeight) + player.AddBuff(mod.BuffType("Irradiated"), 2); + } + if (raiderTalisman) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += ((float)raiderStack / 250f) * 0.25f; + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon) + { + player.maxMinions += 2; + } + if (sDefense) + { + player.statDefense += 5; + player.endurance += 0.05f; + } + if (absorber) + { + player.moveSpeed += 0.12f; + player.jumpSpeedBoost += 1.2f; + player.statLifeMax2 += 20; + player.thorns = 0.5f; + player.endurance += 0.05f; + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.lifeRegen += 2; + player.manaRegenBonus += 2; + } + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.statDefense += 5; + player.endurance += 0.05f; + player.moveSpeed += 0.2f; + } + } + 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.25f; + player.buffImmune[70] = true; + player.buffImmune[47] = true; + player.buffImmune[46] = true; + player.buffImmune[44] = true; + player.buffImmune[20] = true; + if (!player.honey && player.lifeRegen < 0) + { + player.lifeRegen += 2; + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + } + player.lifeRegenTime += 1; + player.lifeRegen += 2; + } + else if (cFreeze) + { + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.3f, ((float)Main.DiscoG / 400f), 0.5f); + } + else if (sirenIce) + { + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.35f, 1f, 1.25f); + } + else if (sirenBoobs || sirenBoobsAlt) + { + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1.5f, 1f, 0.1f); + } + else if (tarraSummon) + { + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 3f, 0f); + } + if (cFreeze) + { + int num = mod.BuffType("GlacialState"); + float num2 = 200f; + int random = Main.rand.Next(5); + if (player.whoAmI == Main.myPlayer) + { + if (random == 0) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1) + { + nPC.AddBuff(num, 120, false); + } + } + } + } + } + } + if (invincible || lol) + { + player.thorns = 0f; + player.turtleThorns = false; + } + if (player.vortexStealthActive) + { + player.rangedDamage -= (1f - player.stealth) * 0.4f; //change 80 to 40 + player.rangedCrit -= (int)((1f - player.stealth) * 5f); //change 20 to 15 + } + if (player.inventory[player.selectedItem].type != mod.ItemType("Ataraxia")) + { + ataraxiaDamageBoost = 0f; + ataraxiaDamageBoostCancelTimer = 1200; + } + else + { + if (ataraxiaDamageBoostCancelTimer > 0) + ataraxiaDamageBoostCancelTimer--; + if (ataraxiaDamageBoostCancelTimer <= 0) + { + if (ataraxiaDamageBoost > 0f) + ataraxiaDamageBoost -= 0.01f; + if (ataraxiaDamageBoost < 0f) + ataraxiaDamageBoost = 0f; + } + if (ataraxiaDamageBoostCooldown > 0) + ataraxiaDamageBoostCooldown--; + if (ataraxiaDamageBoost > 0.3f) + ataraxiaDamageBoost = 0.3f; + } + if (projRefRareLifeRegenCounter > 0) + { + projRefRareLifeRegenCounter--; + player.lifeRegenTime += 2; + player.lifeRegen += 2; + } + if (desertScourgeLore) + { + player.statDefense += 5; + } + if (skeletronPrimeLore) + { + player.armorPenetration += 5; + } + if (destroyerLore) + { + player.pickSpeed -= 0.05f; + } + 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 = 10; + float knockBack = 1f; + 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 += 5; + } + 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) + { + 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 < 90f + player.velocity.X) + { + Item item = Main.item[j]; + item.velocity.X = item.velocity.X + 9f; + } + if (Main.item[j].velocity.X < 0f) + { + Item item = Main.item[j]; + item.velocity.X = item.velocity.X + 9f * 0.75f; + } + } + else + { + if (Main.item[j].velocity.X > -90f + player.velocity.X) + { + Item item = Main.item[j]; + item.velocity.X = item.velocity.X - 9f; + } + if (Main.item[j].velocity.X > 0f) + { + Item item = Main.item[j]; + item.velocity.X = item.velocity.X - 9f * 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 < 90f) + { + Item item = Main.item[j]; + item.velocity.Y = item.velocity.Y + 9f; + } + if (Main.item[j].velocity.Y < 0f) + { + Item item = Main.item[j]; + item.velocity.Y = item.velocity.Y + 9f * 0.75f; + } + } + else + { + if (Main.item[j].velocity.Y > -90f) + { + Item item = Main.item[j]; + item.velocity.Y = item.velocity.Y - 9f; + } + if (Main.item[j].velocity.Y > 0f) + { + Item item = Main.item[j]; + item.velocity.Y = item.velocity.Y - 9f * 0.75f; + } + } + } + } + } + if (dukeFishronLore) + { + AllDamageBoost(0.05f); + AllCritBoost(5); + player.moveSpeed += 0.1f; + } + 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 + if (rogueStealthMax > 0f) + { + if (rogueStealth >= rogueStealthMax) //full stealth does more damage + { + if (playRogueStealthSound) + { + playRogueStealthSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/RogueStealth"), (int)player.position.X, (int)player.position.Y); + } + //The first projectile thrown will inherit this damage, not the crit. Crit is calculated on enemy hits and is not tied to the projectile + //The moment you use any item/weapon the crit multiplier from stealth will decrease, meaning you will never get the optimal boost + //To remedy this, make stealth increase crit by a larger amount so that it means more + //If not you risk the crit boost feeling negligible + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += rogueStealth * 1f; //100% max damage boost, 160% with Auric + } + else + { + playRogueStealthSound = true; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += rogueStealth * 0.75f; //0% to 75% damage boost, 120% with Auric + } + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += (int)(rogueStealth * 30f); //0% to 30% crit boost, 48% with Auric + player.moveSpeed += rogueStealth * 0.05f; + player.aggro -= (int)((rogueStealth / rogueStealthMax) * 900f); + if (player.itemAnimation > 0) + { + if (rogueStealth > 0f) + { + 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) || (penumbra && (!Main.dayTime || Main.eclipse))) && !player.mount.Active) + { + if (rogueStealth < rogueStealthMax) + { + 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) && + !player.mount.Active) + { + if (aquaticBoost > 0f) + { + aquaticBoost -= 0.0002f; //0.015 + if ((double)aquaticBoost <= 0.0) + { + aquaticBoost = 0f; + if (Main.netMode == 1) + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + 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) + { + modStealthTimer = 5; + } + if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + { + if (modStealthTimer == 0 && modStealth > 0f) + { + modStealth -= 0.015f; + if ((double)modStealth <= 0.0) + { + modStealth = 0f; + if (Main.netMode == 1) + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + 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) + { + if (player.itemAnimation > 0) + { + modStealthTimer = 5; + } + if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + { + if (modStealthTimer == 0 && modStealth > 0f) + { + modStealth -= 0.015f; + if ((double)modStealth <= 0.0) + { + modStealth = 0f; + if (Main.netMode == 1) + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + 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; + } + 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 + if (elysianAegis) + { + bool flag14 = false; + if (elysianGuard) + { + float num29 = shieldInvinc; + shieldInvinc -= 0.08f; + if (shieldInvinc < 0f) + { + shieldInvinc = 0f; + } + else + { + flag14 = true; + } + if (shieldInvinc == 0f && num29 != shieldInvinc && Main.netMode == 1) + { + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + float damageBoost = (5f - shieldInvinc) * 0.03f; + AllDamageBoost(damageBoost); + int critBoost = (int)((5f - shieldInvinc) * 2f); + AllCritBoost(critBoost); + player.aggro += (int)((5f - shieldInvinc) * 220f); + player.statDefense += (int)((5f - shieldInvinc) * 4f); + player.moveSpeed *= 0.85f; + if (player.mount.Active) + { + elysianGuard = false; + } + } + else + { + float num30 = shieldInvinc; + shieldInvinc += 0.08f; + if (shieldInvinc > 5f) + { + shieldInvinc = 5f; + } + else + { + flag14 = true; + } + if (shieldInvinc == 5f && num30 != shieldInvinc && Main.netMode == 1) + { + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + if (flag14) + { + if (Main.rand.Next(2) == 0) + { + Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust = Main.dust[Dust.NewDust(player.Center - vector * 30f, 0, 0, 244, 0f, 0f, 0, default(Color), 1f)]; + dust.noGravity = true; + dust.position = player.Center - vector * (float)Main.rand.Next(5, 11); + dust.velocity = vector.RotatedBy(1.5707963705062866, default(Vector2)) * 4f; + dust.scale = 0.5f + Main.rand.NextFloat(); + dust.fadeIn = 0.5f; + } + if (Main.rand.Next(2) == 0) + { + Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust2 = Main.dust[Dust.NewDust(player.Center - vector2 * 30f, 0, 0, 246, 0f, 0f, 0, default(Color), 1f)]; + dust2.noGravity = true; + dust2.position = player.Center - vector2 * 12f; + dust2.velocity = vector2.RotatedBy(-1.5707963705062866, default(Vector2)) * 2f; + dust2.scale = 0.5f + Main.rand.NextFloat(); + dust2.fadeIn = 0.5f; + } + } + } + else + { + elysianGuard = false; + } + #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) + { + if (player.FindBuffIndex(mod.BuffType("ArmorCrumbling")) > -1) { player.ClearBuff(mod.BuffType("ArmorCrumbling")); } + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; + player.meleeDamage += 0.08f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; + player.meleeCrit += 8; + } + if (holyWrath) + { + if (player.FindBuffIndex(BuffID.Wrath) > -1) { player.ClearBuff(BuffID.Wrath); } + AllDamageBoost(0.12f); + player.moveSpeed += 0.05f; + } + if (profanedRage) + { + if (player.FindBuffIndex(BuffID.Rage) > -1) { player.ClearBuff(BuffID.Rage); } + AllCritBoost(12); + player.moveSpeed += 0.05f; + } + if (irradiated) + { + player.statDefense -= 10; + AllDamageBoost(0.05f); + player.minionKB += 0.5f; + player.moveSpeed += 0.05f; + } + if (rRage) + { + AllDamageBoost(0.05f); + player.moveSpeed += 0.05f; + } + if (xRage) + { + AllDamageBoost(0.1f); + } + if (xWrath) + { + AllCritBoost(5); + } + if (godSlayerCooldown) + { + AllDamageBoost(0.1f); + } + if (graxDefense) + { + player.statDefense += 15; + player.endurance += 0.05f; + player.meleeDamage += 0.1f; + } + if (sMeleeBoost) + { + AllDamageBoost(0.1f); + AllCritBoost(5); + } + if (tFury) + { + player.meleeDamage += 0.3f; + player.meleeCrit += 10; + } + if (yPower) + { + player.endurance += 0.05f; + player.statDefense += 5; + AllDamageBoost(0.06f); + AllCritBoost(2); + player.minionKB += 1f; + player.moveSpeed += 0.15f; + } + if (tScale) + { + player.endurance += 0.05f; + player.statDefense += 5; + player.kbBuff = true; + } + if (darkSunRing) + { + player.maxMinions += 2; + AllDamageBoost(0.12f); + player.minionKB += 1.2f; + player.pickSpeed -= 0.15f; + if (Main.dayTime) + { + player.lifeRegen += 3; + } + else + { + player.statDefense += 30; + } + } + if (eGauntlet) + { + player.longInvince = true; + player.kbGlove = true; + player.meleeDamage += 0.15f; + player.meleeCrit += 5; + player.lavaMax += 240; + } + if (fabsolVodka) + { + alcoholPoisonLevel++; + AllDamageBoost(0.08f); + player.statDefense -= 20; + } + if (vodka) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.statDefense -= 4; + AllDamageBoost(0.06f); + AllCritBoost(2); + } + if (redWine) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + } + if (grapeBeer) + { + alcoholPoisonLevel++; + player.statDefense -= 2; + player.moveSpeed -= 0.05f; + } + if (moonshine) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.statDefense += 10; + player.endurance += 0.05f; + } + if (rum) + { + alcoholPoisonLevel++; + player.lifeRegen += 2; + player.moveSpeed += 0.1f; + player.statDefense -= 8; + } + if (fireball) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + } + if (whiskey) + { + alcoholPoisonLevel++; + player.statDefense -= 8; + AllDamageBoost(0.04f); + AllCritBoost(2); + } + if (everclear) + { + alcoholPoisonLevel += 2; + player.lifeRegen -= 10; + player.statDefense -= 40; + AllDamageBoost(0.25f); + } + if (bloodyMary) + { + alcoholPoisonLevel++; + player.lifeRegen -= 2; + if (Main.bloodMoon) + { + player.statDefense -= 6; + AllDamageBoost(0.15f); + AllCritBoost(7); + player.moveSpeed += 0.15f; + } + } + if (tequila) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + if (Main.dayTime) + { + player.statDefense += 5; + AllDamageBoost(0.03f); + AllCritBoost(2); + player.endurance += 0.03f; + } + } + if (tequilaSunrise) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + if (Main.dayTime) + { + player.statDefense += 15; + AllDamageBoost(0.07f); + AllCritBoost(3); + player.endurance += 0.07f; + } + } + if (screwdriver) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + } + if (caribbeanRum) + { + alcoholPoisonLevel++; + player.lifeRegen += 2; + player.moveSpeed += 0.2f; + player.statDefense -= 12; + } + if (cinnamonRoll) + { + alcoholPoisonLevel++; + player.statDefense -= 12; + player.manaRegenDelay--; + player.manaRegenBonus += 10; + } + if (margarita) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.statDefense -= 6; + } + if (starBeamRye) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.statDefense -= 6; + player.magicDamage += 0.08f; + player.manaCost *= 0.9f; + } + if (moscowMule) + { + alcoholPoisonLevel++; + player.lifeRegen -= 2; + AllDamageBoost(0.09f); + AllCritBoost(3); + } + if (whiteWine) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.statDefense -= 6; + player.magicDamage += 0.1f; + } + if (evergreenGin) + { + alcoholPoisonLevel++; + player.lifeRegen -= 1; + player.endurance += 0.05f; + } + if (alcoholPoisonLevel > 3) + { + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + player.lifeRegen -= 3 * alcoholPoisonLevel; + } + if (giantPearl) + { + if (Main.netMode != 1) + { + for (int m = 0; m < 200; m++) + { + if (Main.npc[m].active && !Main.npc[m].friendly) + { + float distance = (Main.npc[m].Center - player.Center).Length(); + if (distance < 120f) + Main.npc[m].AddBuff(mod.BuffType("PearlAura"), 2, false); + } + } + } + } + if (CalamityMod.scopedWeaponList.Contains(player.inventory[player.selectedItem].type)) + { + player.scope = true; + } + 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 + + (NPC.downedSlimeKing ? 0.01f : 0f) + + (NPC.downedBoss1 ? 0.01f : 0f) + + (NPC.downedBoss2 ? 0.01f : 0f) + + (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 + (NPC.downedBoss3 ? 0.01f : 0f) + + (Main.hardMode ? 0.01f : 0f) + + (NPC.downedMechBossAny ? 0.01f : 0f) + + (NPC.downedPlantBoss ? 0.01f : 0f) + + (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 + (NPC.downedFishron ? 0.01f : 0f) + + (NPC.downedAncientCultist ? 0.01f : 0f) + + (NPC.downedMoonlord ? 0.01f : 0f) + + (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 + (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 + (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 + int integerTypeBoost = (int)(floatTypeBoost * 50f); + int critBoost = integerTypeBoost / 2; + int regenBoost = 1 + (integerTypeBoost / 5); + float damageBoost = floatTypeBoost * 0.5f; + player.endurance += (floatTypeBoost * 0.25f); + player.statDefense += integerTypeBoost; + AllDamageBoost(damageBoost); + AllCritBoost(critBoost); + player.minionKB += floatTypeBoost; + player.moveSpeed += floatTypeBoost; + player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; + bool lesserEffect = false; + for (int l = 0; l < 22; l++) + { + 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.1f); + } + 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) + { + if (pinkCandleTimer > 0) { pinkCandleTimer--; } // 1 per second + if (pinkCandleTimer <= 0) + { + if (player.statLife < player.statLifeMax2) + { + float regen = (float)player.statLifeMax2 * 0.004f; + player.statLife += (int)regen; + } + pinkCandleTimer = 60; + } + } + if (manaOverloader) + { + player.magicDamage += 0.06f; + if (player.statMana > (int)((double)player.statManaMax2 * 0.5)) + player.lifeRegen -= 3; + if (player.statMana < (int)((double)player.statManaMax2 * 0.1)) + player.ghostHeal = true; + } + 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) + { + if (player.statLife < (int)((double)player.statLifeMax2 * 0.5)) + { + player.meleeDamage += 0.1f; + player.meleeSpeed += 0.1f; + player.endurance += 0.1f; + } + else + { + player.meleeDamage += 0.05f; + player.meleeSpeed += 0.05f; + player.endurance += 0.05f; + } + } + if (dAmulet) + { + player.panic = true; + player.pStone = true; + player.armorPenetration += 25; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 1.35f, 0.3f, 0.9f); + } + } + if (rampartOfDeities) + { + player.armorPenetration += 25; + player.noKnockback = true; + if (player.statLife > (int)((double)player.statLifeMax2 * 0.25)) + { + player.hasPaladinShield = 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)) < 800f) + { + Main.player[myPlayer].AddBuff(43, 20, true); + } + } + } + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(62, 5, true); + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.endurance += 0.05f; + } + } + else if (fBulwark) + { + player.noKnockback = true; + if (player.statLife > (int)((double)player.statLifeMax2 * 0.25)) + { + player.hasPaladinShield = 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)) < 800f) + { + Main.player[myPlayer].AddBuff(43, 20, true); + } + } + } + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(62, 5, true); + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.endurance += 0.05f; + } + } + if (frostFlare) + { + player.resistCold = true; + player.buffImmune[44] = true; + player.buffImmune[46] = true; + player.buffImmune[47] = true; + if (player.statLife > (int)((double)player.statLifeMax2 * 0.75)) + { + AllDamageBoost(0.1f); + } + if (player.statLife < (int)((double)player.statLifeMax2 * 0.25)) + { + player.statDefense += 10; + } + } + if (vexation) + { + if (player.statLife < (int)((double)player.statLifeMax2 * 0.5)) + { + AllDamageBoost(0.15f); + } + } + if (ataxiaBlaze) + { + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(BuffID.Inferno, 2); + } + } + if (bloodflareThrowing) + { + if (player.statLife > (int)((double)player.statLifeMax2 * 0.8)) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + player.statDefense += 30; + } + else + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + } + } + if (bloodflareSummon) + { + if (player.statLife >= (int)((double)player.statLifeMax2 * 0.9)) + { + player.minionDamage += 0.1f; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.statDefense += 20; + player.lifeRegen += 2; + } + if (bloodflareSummonTimer > 0) { bloodflareSummonTimer--; } + if (player.whoAmI == Main.myPlayer && bloodflareSummonTimer <= 0) + { + bloodflareSummonTimer = 900; + for (int I = 0; I < 3; I++) + { + float ai1 = (float)(I * 120); + Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, + mod.ProjectileType("GhostlyMine"), (int)((auricSet ? 15000f : 5000f) * player.minionDamage), 1f, player.whoAmI, ai1, 0f); + } + } + } + if (yInsignia) + { + player.longInvince = true; + player.kbGlove = true; + player.meleeDamage += 0.05f; + player.lavaMax += 240; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + AllDamageBoost(0.1f); + } + } + if (reaperToothNecklace) + { + 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; + AllDamageBoost(0.07f); + if (player.statDefense < 100) + { + AllDamageBoost(0.15f); + } + } + else if (bloodflareCore) + { + if (player.statDefense < 100) + { + AllDamageBoost(0.15f); + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.endurance += 0.1f; + AllDamageBoost(0.2f); + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.endurance += 0.05f; + AllDamageBoost(0.1f); + } + } + if (godSlayerThrowing) + { + if (player.statLife >= player.statLifeMax2) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.1f; + } + } + if (tarraSummon) + { + int lifeCounter = 0; + float num2 = 300f; + bool flag = lifeCounter % 60 == 0; + int num3 = 200; + 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 (flag) + { + nPC.StrikeNPC(num3, 0f, 0, false, false, false); + if (Main.netMode != 0) + { + NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + } + } + } + } + } + lifeCounter++; + if (lifeCounter >= 180) + { + lifeCounter = 0; + } + if (player.statLife >= player.statLifeMax2) + { + player.minionDamage += 0.1f; + 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 + if (player.meleeSpeed < 0.5f) + { + player.meleeSpeed = 0.5f; + } + if (auricSet && silvaMelee) + { + double multiplier = (double)player.statLife / (double)player.statLifeMax2; + player.meleeDamage += (float)(multiplier * 0.2); //ranges from 1.2 times to 1 times + } + if (player.endurance > defEndurance) //0.33 + { + float damageReductionAboveCap = player.endurance - defEndurance; //0.6 - 0.33 = 0.27 + 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 || photosynthesis) && + (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0); + if (!noLifeRegenCap) + { + //Max HP = 400 + //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)) * 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%) + int defLifeRegen = (int)((double)player.lifeRegen / lifeRegenScalar); + player.lifeRegen = defLifeRegen; + } + } + } + } + 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(); + } + if (dArtifact) + { + AllDamageBoost(0.25f); + } + if (trippy) + { + AllDamageBoost(0.5f); + } + if (eArtifact) + { + player.manaCost *= 0.85f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; + player.maxMinions += 2; + } + if (gArtifact) + { + player.maxMinions += 8; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("AngryChicken")) == -1) + { + player.AddBuff(mod.BuffType("AngryChicken"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("AngryChicken")] < 2) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("AngryChicken"), (int)(232f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + if (pArtifact) + { + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("GuardianHealer")) == -1) + { + player.AddBuff(mod.BuffType("GuardianHealer"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianHealer")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -6f, mod.ProjectileType("MiniGuardianHealer"), 0, 0f, Main.myPlayer, 0f, 0f); + } + float baseDamage = 100f + + (CalamityWorld.downedDoG ? 100f : 0f) + + (CalamityWorld.downedYharon ? 100f : 0f); + if (player.maxMinions >= 8) + { + if (player.FindBuffIndex(mod.BuffType("GuardianDefense")) == -1) + { + player.AddBuff(mod.BuffType("GuardianDefense"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianDefense")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, mod.ProjectileType("MiniGuardianDefense"), (int)(baseDamage * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); + } + } + if (tarraSummon || bloodflareSummon || godSlayerSummon || silvaSummon || dsSetBonus || omegaBlueSet) + { + if (player.FindBuffIndex(mod.BuffType("GuardianOffense")) == -1) + { + player.AddBuff(mod.BuffType("GuardianOffense"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("MiniGuardianAttack")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("MiniGuardianAttack"), (int)(baseDamage * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); + } + } + } + } + if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 1 || + player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 1 || + player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] > 1) + { + for (int projIndex = 0; projIndex < 1000; projIndex++) + { + if (Main.projectile[projIndex].active && Main.projectile[projIndex].owner == player.whoAmI) + { + if (Main.projectile[projIndex].type == mod.ProjectileType("BigBustyRose") || Main.projectile[projIndex].type == mod.ProjectileType("SirenLure") || + Main.projectile[projIndex].type == mod.ProjectileType("DrewsSandyWaifu") || Main.projectile[projIndex].type == mod.ProjectileType("SandyWaifu") || + Main.projectile[projIndex].type == mod.ProjectileType("CloudyWaifu") || Main.projectile[projIndex].type == mod.ProjectileType("FungalClump")) + { + Main.projectile[projIndex].Kill(); + } + } + } + } + if (marked || reaperToothNecklace) + { + if (player.endurance > 0f) + player.endurance *= 0.5f; + } + if (yharonLore && !CalamityWorld.defiled && !CalamityWorld.bossRushActive) + { + if (player.wingTimeMax < 50000) + player.wingTimeMax = 50000; + } + #endregion + } + + public override void PostUpdateRunSpeeds() + { + #region SpeedBoosts + 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)) + { + runAccMult *= 0.4f; + runSpeedMult *= 0.4f; + } + if (horror) + { + runAccMult *= 0.85f; + runSpeedMult *= 0.85f; + } + if (fabledTortoise) + { + runAccMult *= 0.5f; + runSpeedMult *= 0.5f; + } + if (elysianGuard) + { + runAccMult *= 0.5f; + runSpeedMult *= 0.5f; + } + if (player.powerrun && CalamityWorld.revenge) + { + runSpeedMult *= 0.6666667f; + } + + player.runAcceleration *= runAccMult; + player.maxRunSpeed *= runSpeedMult; + #endregion + + #region DashEffects + if (player.pulley && dashMod > 0) + { + ModDashMovement(); + } + else if (player.grappling[0] == -1 && !player.tongued) + { + ModHorizontalMovement(); + if (dashMod > 0) + { + ModDashMovement(); + } + if (pAmulet && modStealth < 1f) + { + float num43 = player.maxRunSpeed / 2f * (1f - modStealth); + player.maxRunSpeed -= num43; + player.accRunSpeed = player.maxRunSpeed; + } + } + #endregion + } + #endregion + + #region PreKill + public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) + { + if (invincible && player.inventory[player.selectedItem].type != mod.ItemType("ColdheartIcicle")) + { + if (player.statLife <= 0) + { + player.statLife = 1; + } + return false; + } + if (hInferno) + { + for (int x = 0; x < 200; x++) + { + if (Main.npc[x].active && Main.npc[x].type == mod.NPCType("Providence")) + { + Main.npc[x].active = false; + } + } + } + if (nCore && Main.rand.Next(10) == 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 67); + for (int j = 0; j < 25; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0f, 0f, 100, default(Color), 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.Next(2) == 0) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + player.statLife += 100; + player.HealEffect(100); + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + return false; + } + if (godSlayer && !godSlayerCooldown) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 67); + for (int j = 0; j < 50; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0f, 0f, 100, default(Color), 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.Next(2) == 0) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + 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; + } + if (silvaSet && silvaCountdown > 0) + { + if (hasSilvaEffect) + { + silvaHitCounter++; + } + if (player.FindBuffIndex(mod.BuffType("SilvaRevival")) == -1) + { + 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) + { + player.statLife = 1; + } + return false; + } + if (permafrostsConcoction && player.FindBuffIndex(mod.BuffType("ConcoctionCooldown")) == -1) + { + player.AddBuff(mod.BuffType("ConcoctionCooldown"), 10800); + player.AddBuff(mod.BuffType("Encased"), 300); + player.statLife = player.statLifeMax2 * 3 / 10; + Main.PlaySound(SoundID.Item92, player.position); + for (int i = 0; i < 60; i++) + { + int d = Dust.NewDust(player.position, player.width, player.height, 88, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[d].noGravity = true; + Main.dust[d].velocity *= 5f; + } + return false; + } + if (bBlood && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " became a blood geyser."); + } + if ((bFlames || aFlames) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " was consumed by the black flames."); + } + if (pFlames && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s flesh was melted by the plague."); + } + if ((hFlames || hInferno) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " fell prey to their sins."); + } + if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + { + if (sCalDeathCount < 51) + { + sCalDeathCount++; + } + } + deathCount++; + if (player.whoAmI == Main.myPlayer && Main.netMode == 1) + { + DeathPacket(false); + } + if (CalamityWorld.ironHeart && areThereAnyDamnBosses) + { + KillPlayer(); + return false; + } + return true; + } + #endregion + + #region UseTimeMult + public override float UseTimeMultiplier(Item item) + { + if (silvaRanged) + { + if (item.ranged && !item.GetGlobalItem(mod).rogue && item.useTime > 3) + return (auricSet ? 1.2f : 1.1f); + } + if (silvaThrowing) + { + if (player.statLife > (int)((double)player.statLifeMax2 * 0.5) && + item.GetGlobalItem(mod).rogue && item.useTime > 3) + return 1.1f; + } + return 1f; + } + #endregion + + #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 ((cinnamonRoll && CalamityMod.fireWeaponList.Contains(item.type)) || (evergreenGin && CalamityMod.natureWeaponList.Contains(item.type))) + { + damage = (int)((double)damage * 1.15); + } + if (fireball && CalamityMod.fireWeaponList.Contains(item.type)) + { + 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 > 0.35) + useTimeBeeMultiplier = 0.35; + theBeeDamage = (int)((double)item.damage * useTimeBeeMultiplier); + } + } + else + { + theBeeDamage = 0; + } + if (!theBee) + { + theBeeDamage = 0; + } + } + + public override void GetWeaponKnockback(Item item, ref float knockback) + { + if (auricBoost) + { + knockback *= 1f + (1f - modStealth) * 0.5f; + } + if (whiskey) + { + knockback *= 1.04f; + } + if (tequila && Main.dayTime) + { + knockback *= 1.03f; + } + if (tequilaSunrise && Main.dayTime) + { + knockback *= 1.07f; + } + if (moscowMule) + { + knockback *= 1.09f; + } + } + #endregion + + #region MeleeEffects + public override void MeleeEffects(Item item, Rectangle hitbox) + { + bool isTrueMelee = item.melee && (item.shoot == 0 || (item.noMelee && item.noUseGraphic && item.useStyle == 5 && !CalamityMod.trueMeleeBoostExceptionList.Contains(item.type))); + if (isTrueMelee) + { + if (fungalSymbiote && 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.Mushroom, (int)((float)item.damage * 0.25f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); + } + } + if (aWeapon) + { + 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 (aChicken) + { + 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 (eGauntlet) + { + 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 (cryogenSoul) + { + 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 (xerocSet) + { + 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 (reaverBlast) + { + 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); + } + } + } + } + #endregion + + #region OnHitNPC + public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) + { + if (omegaBlueChestplate) + target.AddBuff(mod.BuffType("CrushDepth"), 240); + + if (eGauntlet) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + target.AddBuff(mod.BuffType("Plague"), 120, false); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); + if (Main.rand.Next(5) == 0) + { + target.AddBuff(mod.BuffType("GlacialState"), 120, false); + } + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); + target.AddBuff(BuffID.Poisoned, 120, false); + target.AddBuff(BuffID.OnFire, 120, false); + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + if (aWeapon) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + } + } + if (abyssalAmulet) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("CrushDepth"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("CrushDepth"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("CrushDepth"), 120, false); + } + } + if (dsSetBonus) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("DemonFlames"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("DemonFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("DemonFlames"), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(44, 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(44, 240, false); + } + else + { + target.AddBuff(44, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("HolyLight"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("HolyLight"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + if (alchFlask) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("Plague"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("Plague"), 240, false); + } + else + { + 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 + + #region OnHitNPCWithProj + public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit) + { + if (omegaBlueChestplate && proj.friendly && !target.friendly) + target.AddBuff(mod.BuffType("CrushDepth"), 240); + + if (proj.melee && silvaMelee && Main.rand.Next(4) == 0) + target.AddBuff(mod.BuffType("SilvaStun"), 20); + + if (abyssalAmulet) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("CrushDepth"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("CrushDepth"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("CrushDepth"), 120, false); + } + } + if (dsSetBonus) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("DemonFlames"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("DemonFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("DemonFlames"), 120, false); + } + } + 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) + { + target.AddBuff(mod.BuffType("Plague"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("Plague"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("Plague"), 120, false); + } + } + if (proj.melee) + { + if (eGauntlet) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + target.AddBuff(mod.BuffType("Plague"), 120, false); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); + if (Main.rand.Next(5) == 0) + { + target.AddBuff(mod.BuffType("GlacialState"), 120, false); + } + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); + target.AddBuff(BuffID.Poisoned, 120, false); + target.AddBuff(BuffID.OnFire, 120, false); + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + if (aWeapon) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(44, 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(44, 240, false); + } + else + { + target.AddBuff(44, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("HolyLight"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("HolyLight"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + } + 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, 90); + } + if (hiveMindLore) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + if (holyWrath) + { + target.AddBuff(mod.BuffType("HolyLight"), 600, false); + } + else if (providenceLore) + { + target.AddBuff(mod.BuffType("HolyLight"), 420, false); + } + if (proj.GetGlobalProjectile(mod).rogue) + { + if (player.meleeEnchant > 0) + { + if (player.meleeEnchant == 1) + { + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 2) + { + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 3) + { + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 5) + { + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + } + if (player.meleeEnchant == 6) + { + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + } + if (player.meleeEnchant == 8) + { + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 4) + { + target.AddBuff(BuffID.Midas, 120, false); + } + } + } + } + #endregion + + #region PvP + public override void OnHitPvp(Item item, Player target, int damage, bool crit) + { + if (omegaBlueChestplate) + target.AddBuff(mod.BuffType("CrushDepth"), 240); + + if (eGauntlet) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + target.AddBuff(mod.BuffType("Plague"), 120, false); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); + if (Main.rand.Next(5) == 0) + { + target.AddBuff(mod.BuffType("GlacialState"), 120, false); + } + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); + target.AddBuff(BuffID.Poisoned, 120, false); + target.AddBuff(BuffID.OnFire, 120, false); + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + if (aWeapon) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + } + } + if (abyssalAmulet) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("CrushDepth"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("CrushDepth"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("CrushDepth"), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(44, 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(44, 240, false); + } + else + { + target.AddBuff(44, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("HolyLight"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("HolyLight"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + if (alchFlask) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("Plague"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("Plague"), 240, false); + } + else + { + 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) + { + if (omegaBlueChestplate) + target.AddBuff(mod.BuffType("CrushDepth"), 240); + + if (proj.melee && silvaMelee && Main.rand.Next(4) == 0) + target.AddBuff(mod.BuffType("SilvaStun"), 20); + + if (abyssalAmulet) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("CrushDepth"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("CrushDepth"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("CrushDepth"), 120, false); + } + } + 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) + { + target.AddBuff(mod.BuffType("Plague"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("Plague"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("Plague"), 120, false); + } + } + if (proj.melee) + { + if (eGauntlet) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + target.AddBuff(mod.BuffType("Plague"), 120, false); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120, false); + if (Main.rand.Next(5) == 0) + { + target.AddBuff(mod.BuffType("GlacialState"), 120, false); + } + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120, false); + target.AddBuff(BuffID.Poisoned, 120, false); + target.AddBuff(BuffID.OnFire, 120, false); + target.AddBuff(BuffID.CursedInferno, 120, false); + target.AddBuff(BuffID.Frostburn, 120, false); + target.AddBuff(BuffID.Ichor, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + if (aWeapon) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 120, false); + } + } + if (cryogenSoul || frostFlare) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(44, 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(44, 240, false); + } + else + { + target.AddBuff(44, 120, false); + } + } + if (yInsignia) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("HolyLight"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("HolyLight"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("HolyLight"), 120, false); + } + } + if (ataxiaFire) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(BuffID.OnFire, 720, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(BuffID.OnFire, 480, false); + } + else + { + target.AddBuff(BuffID.OnFire, 240, false); + } + } + } + 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, 90); + } + if (hiveMindLore) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + if (holyWrath) + { + target.AddBuff(mod.BuffType("HolyLight"), 600, false); + } + else if (providenceLore) + { + target.AddBuff(mod.BuffType("HolyLight"), 420, false); + } + if (proj.GetGlobalProjectile(mod).rogue) + { + if (player.meleeEnchant > 0) + { + if (player.meleeEnchant == 1) + { + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 2) + { + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 3) + { + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + } + if (player.meleeEnchant == 5) + { + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + } + if (player.meleeEnchant == 6) + { + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + } + if (player.meleeEnchant == 8) + { + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + } + if (player.meleeEnchant == 4) + { + target.AddBuff(BuffID.Midas, 120, false); + } + } + } + } + #endregion + + #region ModifyHitNPC + public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit) + { + #region MultiplierBoosts + double damageMult = 1.0; + if (silvaMelee && Main.rand.Next(4) == 0 && item.melee) + { + damageMult += 4.0; + } + if (enraged && !Config.BossRushXerocCurse) + { + damageMult += 1.25; + } + if (CalamityWorld.revenge && Config.AdrenalineAndRage) + { + bool DHorHoD = (draedonsHeart || heartOfDarkness); + if (rageMode && adrenalineMode) + { + if (item.melee) + { + damageMult += (CalamityWorld.death ? (DHorHoD ? 8.9 : 8.0) : (DHorHoD ? 2.3 : 2.0)); + } + } + else if (rageMode) + { + if (item.melee) + { + 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 (item.melee) + { + 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")) + { + ataraxiaDamageBoostCancelTimer = 1200; + if (ataraxiaDamageBoostCooldown <= 0) + { + ataraxiaDamageBoostCooldown = 90; + if (ataraxiaDamageBoost < 0.3f) + ataraxiaDamageBoost += 0.01f; + } + } + 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, 120, 5f, player.whoAmI, 0f, 0f); + Main.projectile[num17].ranged = false; + } + } + if (bloodflareMelee && item.melee) + { + 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); + } + } + if (Config.ProficiencyEnabled) + { + if (gainLevelCooldown <= 0) + { + gainLevelCooldown = 120; + if (item.melee && meleeLevel <= 12500) + { + if (!Main.hardMode && meleeLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && meleeLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + meleeLevel++; + if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 + meleeLevel++; + shootFireworksLevelUpMelee = true; + if (Main.netMode == 1) + { + LevelPacket(false, 0); + } + } + } + } + if (CalamityWorld.revenge && Config.AdrenalineAndRage) + { + if (item.melee) + { + int stressGain = (int)((double)damage * 0.1); + int stressMaxGain = 10; + if (stressGain < 1) + { + stressGain = 1; + } + if (stressGain > stressMaxGain) + { + stressGain = stressMaxGain; + } + stress += stressGain; + if (stress >= stressMax) + { + stress = stressMax; + } + } + } + } + } + + 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) + { + 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].GetGlobalItem(mod).rogue) || + 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; + } + else if (proj.type == ProjectileID.InfernoFriendlyBlast) + { + damageMult += 0.33; + } + 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) + { + if (hasClassType) + damage += theBeeDamage; + } + if (proj.type == mod.ProjectileType("AcidBullet")) + { + int defenseAdd = (int)((double)target.defense * 0.1 * ((double)damage / 50.0)); //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"))) + { + damage += Main.rand.Next(20, 31); + } + #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].GetGlobalItem(mod).rogue) && + player.inventory[player.selectedItem].hammer == 0 && + player.inventory[player.selectedItem].pick == 0 && + player.inventory[player.selectedItem].axe == 0) + { + damage = (int)((double)damage * 0.75); + } + } + 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; + case ProjectileID.SpectreWrath: + 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++) + { + 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, 120, 5f, player.whoAmI, 0f, 0f); + Main.projectile[num17].ranged = false; + } + } + if (tarraRanged && crit && proj.ranged) + { + 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) + { + 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 (bloodflareThrowing && proj.GetGlobalProjectile(mod).rogue && crit && Main.rand.Next(2) == 0) + { + if (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; + } + } + } + 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); + } + } + if (proj.type == mod.ProjectileType("AtaraxiaMain") || proj.type == mod.ProjectileType("AtaraxiaHoming") || + proj.type == mod.ProjectileType("AtaraxiaSplit") || proj.type == mod.ProjectileType("AtaraxiaSide")) + { + ataraxiaDamageBoostCancelTimer = 1200; + if (proj.type == mod.ProjectileType("AtaraxiaMain")) + { + if (ataraxiaDamageBoost < 0.3f) + ataraxiaDamageBoost += 0.0025f; + } + } + if (Config.ProficiencyEnabled) + { + if (gainLevelCooldown <= 0) //max is 12501 to avoid setting off fireworks forever + { + gainLevelCooldown = 120; //2 seconds + if (proj.melee && meleeLevel <= 12500) + { + if (!Main.hardMode && meleeLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && meleeLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + meleeLevel++; + if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 + meleeLevel++; + shootFireworksLevelUpMelee = true; + if (Main.netMode == 1) + { + LevelPacket(false, 0); + } + } + else if (proj.ranged && rangedLevel <= 12500) + { + if (!Main.hardMode && rangedLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && rangedLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + rangedLevel++; + if (fasterRangedLevel && rangedLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 + rangedLevel++; + shootFireworksLevelUpRanged = true; + if (Main.netMode == 1) + { + LevelPacket(false, 1); + } + } + else if (proj.magic && magicLevel <= 12500) + { + if (!Main.hardMode && magicLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && magicLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + magicLevel++; + if (fasterMagicLevel && magicLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 + magicLevel++; + shootFireworksLevelUpMagic = true; + if (Main.netMode == 1) + { + LevelPacket(false, 2); + } + } + else if (isSummon && summonLevel <= 12500) + { + if (!Main.hardMode && summonLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && summonLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + summonLevel++; + if (fasterSummonLevel && summonLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 + summonLevel++; + shootFireworksLevelUpSummon = true; + if (Main.netMode == 1) + { + LevelPacket(false, 3); + } + } + else if (proj.GetGlobalProjectile(mod).rogue && rogueLevel <= 12500) + { + if (!Main.hardMode && rogueLevel >= 1500) + { + gainLevelCooldown = 1200; //20 seconds + } + if (!NPC.downedMoonlord && rogueLevel >= 5500) + { + gainLevelCooldown = 2400; //40 seconds + } + rogueLevel++; + if (fasterRogueLevel && rogueLevel % 100 != 0 && Main.rand.Next(10) == 0) //add only to non-multiples of 100 + rogueLevel++; + shootFireworksLevelUpRogue = true; + if (Main.netMode == 1) + { + LevelPacket(false, 4); + } + } + } + } + if (raiderTalisman && raiderStack < 250 && proj.GetGlobalProjectile(mod).rogue && crit) + { + raiderStack++; + } + if (CalamityWorld.revenge && Config.AdrenalineAndRage) + { + if (isTrueMelee) + { + int stressGain = (int)((double)damage * 0.1); + int stressMaxGain = 10; + if (stressGain < 1) + { + stressGain = 1; + } + if (stressGain > stressMaxGain) + { + stressGain = stressMaxGain; + } + stress += stressGain; + if (stress >= stressMax) + { + stress = stressMax; + } + } + } + } + } + #endregion + + #region ModifyHitByNPC + public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) + { + if (triumph) + { + double HPMultiplier = 0.15 * (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 + damage /= 2; + } + if (tarraDefense && tarraMelee) + { + damage /= 2; + } + if (bloodflareMelee && bloodflareFrenzyTimer > 0) + { + damage /= 2; + } + if (silvaMelee && silvaCountdown <= 0 && hasSilvaEffect) + { + damage = (int)((double)damage * 0.8); + } + if (aBulwarkRare) + { + aBulwarkRareMeleeBoostTimer += 3 * damage; + if (aBulwarkRareMeleeBoostTimer > 900) + aBulwarkRareMeleeBoostTimer = 900; + } + if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) + { + if (CalamityWorld.revenge && Config.AdrenalineAndRage && !npc.SpawnedFromStatue) + { + gainRageCooldown = 60; + int stressGain = damage * (profanedRage ? 3 : 2); + int stressMaxGain = 2500; + if (stressGain < 1) + { + stressGain = 1; + } + if (stressGain > stressMaxGain) + { + stressGain = stressMaxGain; + } + stress += stressGain; + if (stress >= stressMax) + { + stress = stressMax; + } + } + } + } + #endregion + + #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); + } + if (beeResist) + { + if (CalamityMod.beeProjectileList.Contains(proj.type)) + damage = (int)((double)damage * 0.75); + } + if (Main.hardMode && Main.expertMode && !CalamityWorld.spawnedHardBoss && proj.active && !proj.friendly && proj.hostile && damage > 0) + { + if (CalamityMod.hardModeNerfList.Contains(proj.type)) + damage = (int)((double)damage * 0.75); + } + if (CalamityWorld.revenge) + { + if (CalamityMod.revengeanceProjectileBuffList.Contains(proj.type)) + damage = (int)((double)damage * 1.25); + } + if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) + { + if (CalamityWorld.revenge && Config.AdrenalineAndRage && !CalamityMod.trapProjectileList.Contains(proj.type)) + { + gainRageCooldown = 60; + int stressGain = damage * (profanedRage ? 3 : 2); + int stressMaxGain = 2500; + if (stressGain < 1) + { + stressGain = 1; + } + if (stressGain > stressMaxGain) + { + stressGain = stressMaxGain; + } + stress += stressGain; + if (stress >= stressMax) + { + stress = stressMax; + } + } + } + } + #endregion + + #region OnHit + public override void OnHitByNPC(NPC npc, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + if (npc.type == NPCID.SkeletronPrime || npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeSaw) + { + player.AddBuff(BuffID.Bleeding, 300); + } + else if (npc.type == NPCID.Spazmatism && npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) + { + player.AddBuff(BuffID.Bleeding, 300); + } + else if (npc.type == NPCID.Plantera && npc.life < npc.lifeMax / 2) + { + player.AddBuff(BuffID.Poisoned, 180); + player.AddBuff(BuffID.Bleeding, 300); + } + else if (npc.type == NPCID.PlanterasTentacle) + { + player.AddBuff(BuffID.Poisoned, 120); + player.AddBuff(BuffID.Bleeding, 180); + } + else if (npc.type == NPCID.Golem || npc.type == NPCID.GolemFistLeft || npc.type == NPCID.GolemFistRight || + npc.type == NPCID.GolemHead || npc.type == NPCID.GolemHeadFree) + { + player.AddBuff(BuffID.BrokenArmor, 180); + } + } + } + + public override void OnHitByProjectile(Projectile proj, int damage, bool crit) + { + if (CalamityWorld.revenge && proj.hostile) + { + if (proj.type == ProjectileID.FrostBeam && !player.frozen && !gState) + { + player.AddBuff(mod.BuffType("GlacialState"), 120); + } + else if (proj.type == ProjectileID.DeathLaser) + { + player.AddBuff(BuffID.OnFire, 180); + } + else if (proj.type == ProjectileID.Skull) + { + player.AddBuff(BuffID.Weak, 120); + } + else if (proj.type == ProjectileID.ThornBall) + { + player.AddBuff(BuffID.Poisoned, 180); + } + else if (proj.type == ProjectileID.CultistBossIceMist) + { + player.AddBuff(BuffID.Frozen, 60); + player.AddBuff(BuffID.Chilled, 120); + player.AddBuff(BuffID.Frostburn, 240); + } + else if (proj.type == ProjectileID.CultistBossLightningOrbArc) + { + player.AddBuff(BuffID.Electrified, 120); + } + } + if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.Next(20) == 0) + { + player.statLife += damage; + player.HealEffect(damage); + proj.hostile = false; + proj.friendly = true; + 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; + player.statLife += healAmt; + player.HealEffect(healAmt); + proj.hostile = false; + proj.friendly = true; + proj.velocity.X = -proj.velocity.X; + proj.velocity.Y = -proj.velocity.Y; + } + } + #endregion + + #region Fishing + public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) + { + Point point = player.Center.ToTileCoordinates(); + bool abyssPosX = false; + if (CalamityWorld.abyssSide) + { + if (point.X < 380) + { + abyssPosX = true; + } + } + else + { + if (point.X > Main.maxTilesX - 380) + { + abyssPosX = true; + } + } + if (junk) + { + if (abyssPosX && liquidType == 0 && power < 40) + { + caughtType = mod.ItemType("PlantyMush"); + } + return; + } + /*if (abyssPosX && liquidType == 0 && (bait.type == ItemID.GoldWorm || bait.type == ItemID.GoldGrasshopper || bait.type == ItemID.GoldButterfly) && power > 150) + { + if (Main.netMode != 1) + { + CalamityGlobalNPC.OldDukeSpawn(player.whoAmI, mod.NPCType("OldDuke")); + } + else + { + NetMessage.SendData(61, -1, -1, null, player.whoAmI, (float)mod.NPCType("OldDuke"), 0f, 0f, 0, 0, 0); + } + switch (Main.rand.Next(4)) + { + case 0: caughtType = mod.ItemType("IronBoots"); break; //movement acc + case 1: caughtType = mod.ItemType("DepthCharm"); break; //regen acc + case 2: caughtType = mod.ItemType("AnechoicPlating"); break; //defense acc + case 3: caughtType = mod.ItemType("StrangeOrb"); break; //light pet + } + return; + }*/ + if (power >= 20) + { + if (power >= 40) + { + if (abyssPosX && liquidType == 0 && Main.rand.Next(15) == 0 && power < 80) + { + caughtType = mod.ItemType("PlantyMush"); + } + if (power >= 60) + { + if (player.FindBuffIndex(BuffID.Gills) > -1 && NPC.downedPlantBoss && liquidType == 0 && Main.rand.Next(25) == 0 && power < 160) + { + caughtType = mod.ItemType("Floodtide"); + } + if (abyssPosX && liquidType == 0 && Main.rand.Next(25) == 0 && power < 160) + { + caughtType = mod.ItemType("AlluringBait"); + } + if (power >= 80) + { + if (abyssPosX && Main.hardMode && liquidType == 0 && Main.rand.Next(15) == 0 && power < 210) + { + switch (Main.rand.Next(4)) + { + case 0: caughtType = mod.ItemType("IronBoots"); break; //movement acc + case 1: caughtType = mod.ItemType("DepthCharm"); break; //regen acc + case 2: caughtType = mod.ItemType("AnechoicPlating"); break; //defense acc + case 3: caughtType = mod.ItemType("StrangeOrb"); break; //light pet + } + } + if (power >= 110) + { + if (abyssPosX && liquidType == 0 && Main.rand.Next(25) == 0 && power < 240) + { + caughtType = mod.ItemType("AbyssalAmulet"); + } + } + } + } + } + } + } + #endregion + + #region FrameEffects + public override void FrameEffects() + { + if ((snowmanPower || snowmanForce) && !snowmanHide) + { + player.legs = mod.GetEquipSlot("PopoLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("PopoBody", EquipType.Body); + player.head = (snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head)); + } + else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) + { + player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); + player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); + } + else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) + { + player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); + player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); + } + else if ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide) + { + player.legs = mod.GetEquipSlot("SirenLegAlt", EquipType.Legs); + player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); + player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); + } + + if (CalamityWorld.defiled) + Defiled(); + + if (weakPetrification) + WeakPetrification(); + + if (CalamityWorld.bossRushActive) + BossRushMovementChanges(); + } + #endregion + + #region Limitations + private void WeakPetrification() + { + player.doubleJumpCloud = false; + player.doubleJumpSandstorm = false; + player.doubleJumpBlizzard = false; + player.rocketBoots = 0; + player.jumpBoost = false; + player.slowFall = false; + player.gravControl = false; + player.gravControl2 = false; + player.jumpSpeedBoost = 0f; + player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5); + player.balloon = -1; + weakPetrification = true; + } + + private void Defiled() + { + 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 || SCalLore || (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0)) + { + 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; + } + if (godSlayerReflect && Main.rand.Next(50) == 0) + { + return false; + } + + if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) + { + playSound = false; + Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 4, 1f, 0f); //metal hit noise + } + else if (((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) || ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide)) + { + 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.85); + } + if (CalamityWorld.revenge) + { + if (!CalamityWorld.downedBossAny) + damage = (int)((double)damage * 0.8); + } + 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 * 0.9); + } + #endregion + + if ((godSlayerDamage && damage <= 80) || damage < 1) + { + damage = 1; + } + + #region HealingEffects + if (revivifyTimer > 0) + { + int healAmt = damage / 20; + player.statLife += healAmt; + player.HealEffect(healAmt); + } + if (daedalusAbsorb && Main.rand.Next(10) == 0) + { + int healAmt = damage / 2; + player.statLife += healAmt; + player.HealEffect(healAmt); + } + if (absorber) + { + int healAmt = damage / 20; + player.statLife += healAmt; + player.HealEffect(healAmt); + } + #endregion + + return true; + } + + public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) + { + modStealth = 1f; + ataraxiaDamageBoost = 0f; + if (player.whoAmI == Main.myPlayer) + { + if (rageMode) + { + stress = 0; + if (player.FindBuffIndex(mod.BuffType("RageMode")) > -1) { player.ClearBuff(mod.BuffType("RageMode")); } + } + if (amidiasBlessing) + { + player.ClearBuff(mod.BuffType("AmidiasBlessing")); + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 96); + } + if (!adrenalineMode && adrenaline != adrenalineMax) + { + adrenaline = 0; + } + if ((gShell || fabledTortoise) && !player.panic) + { + player.AddBuff(mod.BuffType("ShellBoost"), 300); + } + if (abyssalDivingSuitPlates && damage > 50) + { + abyssalDivingSuitPlateHits++; + if (abyssalDivingSuitPlateHits >= 3) + { + Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 14); + player.AddBuff(mod.BuffType("AbyssalDivingSuitPlatesBroken"), 10830); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.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 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 6, 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, 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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.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; + } + } + } + if (sirenIce) + { + Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 7); + player.AddBuff(mod.BuffType("IceShieldBrokenBuff"), 1800); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 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, 67, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + if (tarraMelee) + { + if (Main.rand.Next(4) == 0) + { + player.AddBuff(mod.BuffType("TarraLifeRegen"), 120); + } + } + else if (xerocSet) + { + player.AddBuff(mod.BuffType("XerocRage"), 240); + player.AddBuff(mod.BuffType("XerocWrath"), 240); + } + else if (reaverBlast) + { + player.AddBuff(mod.BuffType("ReaverRage"), 180); + } + if (fBarrier || ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3)) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); + for (int m = 0; m < 200; m++) + { + if (Main.npc[m].active && !Main.npc[m].friendly) + { + float distance = (Main.npc[m].Center - player.Center).Length(); + float num10 = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); + if (num10 > 500f) + { + num10 = 500f + (num10 - 500f) * 0.75f; + } + if (num10 > 700f) + { + num10 = 700f + (num10 - 700f) * 0.5f; + } + if (num10 > 900f) + { + num10 = 900f + (num10 - 900f) * 0.25f; + } + if (distance < num10) + { + float num11 = (float)Main.rand.Next(90 + (int)damage / 3, 240 + (int)damage / 2); + Main.npc[m].AddBuff(mod.BuffType("GlacialState"), (int)num11, false); + } + } + } + } + if (aBrain) + { + for (int m = 0; m < 200; m++) + { + if (Main.npc[m].active && !Main.npc[m].friendly) + { + float arg_67A_0 = (Main.npc[m].Center - player.Center).Length(); + float num10 = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); + if (num10 > 500f) + { + num10 = 500f + (num10 - 500f) * 0.75f; + } + if (num10 > 700f) + { + num10 = 700f + (num10 - 700f) * 0.5f; + } + if (num10 > 900f) + { + num10 = 900f + (num10 - 900f) * 0.25f; + } + if (arg_67A_0 < num10) + { + float num11 = (float)Main.rand.Next(90 + (int)damage / 3, 300 + (int)damage / 2); + Main.npc[m].AddBuff(31, (int)num11, false); + } + } + } + Projectile.NewProjectile(player.Center.X + (float)Main.rand.Next(-40, 40), player.Center.Y - (float)Main.rand.Next(20, 60), player.velocity.X * 0.3f, player.velocity.Y * 0.3f, 565, 0, 0f, player.whoAmI, 0f, 0f); + } + } + if (player.ownedProjectileCounts[mod.ProjectileType("Drataliornus")] != 0) + { + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == mod.ProjectileType("Drataliornus") && Main.projectile[i].owner == player.whoAmI) + { + Main.projectile[i].Kill(); + break; + } + } + player.AddBuff(mod.BuffType("Backfire"), 360); + if (player.wingTime > player.wingTimeMax / 2) + player.wingTime = player.wingTimeMax / 2; + } + } + + public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) + { + if (pArtifact) + { + player.AddBuff(mod.BuffType("BurntOut"), 300, true); + } + if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")) && CalamityWorld.revenge) + { + if (damage < 100) + { + KillPlayer(); + string key = "Mods.CalamityMod.SupremeBossText28"; + 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); + } + } + } + bool hardMode = Main.hardMode; + if (player.whoAmI == Main.myPlayer) + { + if (cTracers && damage > 200) + { + player.immuneTime += 60; + } + if (godSlayerThrowing && damage > 80) + { + player.immuneTime += 30; + } + if (statigelSet && damage > 100) + { + player.immuneTime += 30; + } + if (dAmulet) + { + if (damage == 1.0) + { + player.immuneTime += 10; + } + else + { + player.immuneTime += 20; + } + } + if (fabsolVodka) + { + if (damage == 1.0) + { + player.immuneTime += 5; + } + else + { + player.immuneTime += 10; + } + } + if (CalamityWorld.bossRushActive && Config.BossRushImmunityFrameCurse) + { + bossRushImmunityFrameCurseTimer = 300 + player.immuneTime; + } + if (damage > 25) + { + if (aeroSet) + { + for (int n = 0; n < 4; n++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = player.position.X + (float)(player.width / 2) - vector.X; + float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 20; + 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, mod.ProjectileType("StickyFeatherAero"), 20, 1f, player.whoAmI, 0f, 0f); + } + } + } + if (aBulwark) + { + 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); + Vector2 vector = new Vector2(x, y); + float num13 = player.position.X + (float)(player.width / 2) - vector.X; + float num14 = player.position.Y + (float)(player.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; + int num17 = Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("AstralStar"), 320, 5f, player.whoAmI, 0f, 0f); + } + } + if (dAmulet) + { + for (int n = 0; n < 3; n++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = player.position.X + (float)(player.width / 2) - vector.X; + float num14 = player.position.Y + (float)(player.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; + int num17 = Projectile.NewProjectile(x, y, num13, num14, 92, 130, 4f, player.whoAmI, 0f, 0f); + Main.projectile[num17].usesLocalNPCImmunity = true; + Main.projectile[num17].localNPCHitCooldown = 5; + Main.projectile[num17].ranged = false; + } + } + } + if (fCarapace) + { + if (damage > 0) + { + Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 45); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int fDamage = 56; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + float xPos = Main.rand.Next(2) == 0 ? player.Center.X + 100 : player.Center.X - 100; + Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); + int spore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); + Main.projectile[spore1].timeLeft = 120; + Main.projectile[spore2].timeLeft = 120; + } + } + } + } + if (aSpark) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 93); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + 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++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int spark1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Spark"), sDamage, 1.25f, player.whoAmI, 0f, 0f); + int spark2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Spark"), sDamage, 1.25f, player.whoAmI, 0f, 0f); + Main.projectile[spark1].timeLeft = 120; + Main.projectile[spark2].timeLeft = 120; + } + } + } + } + if (ataxiaBlaze && Main.rand.Next(5) == 0) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); + int eDamage = 100; + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("ChaosBlaze"), eDamage, 1f, player.whoAmI, 0f, 0f); + } + } + } + else if (daedalusShard) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int sDamage = 27; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 8; i++) + { + float randomSpeed = (float)Main.rand.Next(1, 7); + float randomSpeed2 = (float)Main.rand.Next(1, 7); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int shard = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, 90, sDamage, 1f, player.whoAmI, 0f, 0f); + int shard2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, 90, sDamage, 1f, player.whoAmI, 0f, 0f); + Main.projectile[shard].ranged = false; + Main.projectile[shard2].ranged = false; + } + } + } + } + else if (reaverSpore) + { + if (damage > 0) + { + Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 1); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int rDamage = 58; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + float xPos = Main.rand.Next(2) == 0 ? player.Center.X + 100 : player.Center.X - 100; + Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 567, rDamage, 2f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 568, rDamage, 2f, player.whoAmI, 0f, 0f); + } + } + } + } + else if (godSlayerDamage) + { + if (damage > 80) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 73); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GodKiller"), 900, 5f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GodKiller"), 900, 5f, player.whoAmI, 0f, 0f); + } + } + } + } + else if (godSlayerMage) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerBlaze"), (auricSet ? 2400 : 1200), 1f, player.whoAmI, 0f, 0f); + } + } + } + else if (dsSetBonus) + { + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 2; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, 294, 3000, 7f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + } + for (int l = 0; l < 5; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, 45, 5000, 7f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + } + } + } + } + #endregion + + #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; + bool specialDeath = CalamityWorld.ironHeart && areThereAnyDamnBosses; + bool flag; + int coinsOwned = (int)Utils.CoinsCount(out flag, player.inventory, new int[0]); + if (Main.myPlayer == player.whoAmI) + { + player.lostCoins = coinsOwned; + player.lostCoinString = Main.ValueToCoins(player.lostCoins); + } + if (Main.myPlayer == player.whoAmI) + { + Main.mapFullscreen = false; + } + if (Main.myPlayer == player.whoAmI) + { + player.trashItem.SetDefaults(0, false); + if (specialDeath) + { + player.difficulty = 2; + player.DropItems(); + player.KillMeForGood(); + } + else if (player.difficulty == 0) + { + for (int i = 0; i < 59; i++) + { + if (player.inventory[i].stack > 0 && ((player.inventory[i].type >= 1522 && player.inventory[i].type <= 1527) || player.inventory[i].type == 3643)) + { + int num = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, player.inventory[i].type, 1, false, 0, false, false); + Main.item[num].netDefaults(player.inventory[i].netID); + Main.item[num].Prefix((int)player.inventory[i].prefix); + Main.item[num].stack = player.inventory[i].stack; + Main.item[num].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; + Main.item[num].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f; + Main.item[num].noGrabDelay = 100; + Main.item[num].favorited = false; + Main.item[num].newAndShiny = false; + if (Main.netMode == 1) + { + NetMessage.SendData(21, -1, -1, null, num, 0f, 0f, 0f, 0, 0, 0); + } + player.inventory[i].SetDefaults(0, false); + } + } + } + else if (player.difficulty == 1) + { + player.DropItems(); + } + else if (player.difficulty == 2) + { + player.DropItems(); + player.KillMeForGood(); + } + } + if (specialDeath) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/IronHeartDeath"), (int)player.position.X, (int)player.position.Y); + } + else + { + Main.PlaySound(5, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); + } + player.headVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; + player.bodyVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; + player.legVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; + player.headVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); + player.bodyVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); + player.legVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * 0); + if (player.stoned) + { + player.headPosition = Vector2.Zero; + player.bodyPosition = Vector2.Zero; + player.legPosition = Vector2.Zero; + } + for (int j = 0; j < 100; j++) + { + Dust.NewDust(player.position, player.width, player.height, (specialDeath ? 91 : 235), (float)(2 * 0), -2f, 0, default(Color), 1f); + } + player.mount.Dismount(player); + player.dead = true; + player.respawnTimer = 600; + if (Main.expertMode) + { + player.respawnTimer = (int)((double)player.respawnTimer * 1.5); + } + player.immuneAlpha = 0; + player.palladiumRegen = false; + player.iceBarrier = false; + player.crystalLeaf = false; + PlayerDeathReason damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); + NetworkText deathText = damageSource.GetDeathText(player.name); + if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(deathText, new Color(225, 25, 25), -1); + } + else if (Main.netMode == 0) + { + Main.NewText(deathText.ToString(), 225, 25, 25, false); + } + if (Main.netMode == 1 && player.whoAmI == Main.myPlayer) + { + NetMessage.SendPlayerDeath(player.whoAmI, damageSource, (int)1000.0, 0, false, -1, -1); + } + if (player.whoAmI == Main.myPlayer && player.difficulty == 0) + { + player.DropCoins(); + } + player.DropTombstone(coinsOwned, deathText, 0); + if (player.whoAmI == Main.myPlayer) + { + try + { + WorldGen.saveToonWhilePlaying(); + } + catch + { + } + } + } + #endregion + + #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); + 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 = 1500f * player.meleeDamage; + float num2 = 15f; + 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); + int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), 1000, 20f, Main.myPlayer, 0f, 0f); + Main.projectile[num6].Kill(); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyEruption"), 780, 5f, Main.myPlayer, 0f, 0f); + } + nPC.immune[player.whoAmI] = 6; + nPC.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = 4; + } + } + } + } + if (dashMod == 3 && 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 = 500f * player.meleeDamage; + float num2 = 12f; + 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); + int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), 500, 15f, Main.myPlayer, 0f, 0f); + Main.projectile[num6].Kill(); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyEruption"), 380, 5f, Main.myPlayer, 0f, 0f); + } + nPC.immune[player.whoAmI] = 6; + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = 4; + } + } + } + } + if (dashMod == 2 && 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 = 100f * player.meleeDamage; + float num2 = 9f; + 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); + int num6 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosion"), 100, 15f, Main.myPlayer, 0f, 0f); + Main.projectile[num6].Kill(); + } + nPC.immune[player.whoAmI] = 6; + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = 4; + } + } + } + } + if (dashMod == 1 && 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].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0)) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + OnDodge(); + break; + } + } + } + for (int i = 0; i < 1000; i++) + { + if ((Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0)) + { + Projectile proj = Main.projectile[i]; + Rectangle rect = proj.getRect(); + if (rectangle.Intersects(rect)) + { + OnDodge(); + break; + } + } + } + } + if (player.dashDelay > 0) + { + return; + } + if (player.dashDelay < 0) + { + float num7 = 12f; + float num8 = 0.985f; + float num9 = Math.Max(player.accRunSpeed, player.maxRunSpeed); + float num10 = 0.94f; + int num11 = 20; + if (dashMod == 1) + { + for (int k = 0; k < 2; k++) + { + int num12; + if (player.velocity.Y == 0f) + { + num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)player.height - 4f), player.width, 8, 235, 0f, 0f, 100, default(Color), 1.4f); + } + else + { + num12 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)(player.height / 2) - 8f), player.width, 16, 235, 0f, 0f, 100, default(Color), 1.4f); + } + Main.dust[num12].velocity *= 0.1f; + Main.dust[num12].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + } + else if (dashMod == 2) + { + for (int m = 0; m < 4; m++) + { + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 246, 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; + } + } + } + else if (dashMod == 3) + { + for (int m = 0; m < 12; m++) + { + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 244, 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 = 14f; //14 + } + else if (dashMod == 4) + { + 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, 244, 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 = 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; + if (player.velocity.X > num7 || player.velocity.X < -num7) + { + player.velocity.X = player.velocity.X * num8; + return; + } + if (player.velocity.X > num9 || player.velocity.X < -num9) + { + player.velocity.X = player.velocity.X * num10; + return; + } + player.dashDelay = num11; + if (player.velocity.X < 0f) + { + player.velocity.X = -num9; + return; + } + if (player.velocity.X > 0f) + { + player.velocity.X = num9; + return; + } + } + } + else if (dashMod > 0 && !player.mount.Active) + { + if (dashMod == 1) + { + int num16 = 0; + bool flag = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + num16 = 1; + flag = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + num16 = -1; + flag = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (flag) + { + player.velocity.X = 14.5f * (float)num16; //eoc dash amount + Point point = (player.Center + new Vector2((float)(num16 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point2 = (player.Center + new Vector2((float)(num16 * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point.X, point.Y) || WorldGen.SolidOrSlopedTile(point2.X, point2.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num17 = 0; num17 < 20; num17++) + { + int num18 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 235, 0f, 0f, 100, default(Color), 2f); + Dust expr_CDB_cp_0 = Main.dust[num18]; + expr_CDB_cp_0.position.X = expr_CDB_cp_0.position.X + (float)Main.rand.Next(-5, 6); + Dust expr_D02_cp_0 = Main.dust[num18]; + expr_D02_cp_0.position.Y = expr_D02_cp_0.position.Y + (float)Main.rand.Next(-5, 6); + Main.dust[num18].velocity *= 0.2f; + Main.dust[num18].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num18].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + return; + } + } + else if (dashMod == 2) + { + 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 = 16.9f * (float)num23; //tabi dash amount + 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 < 20; num24++) + { + int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 246, 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 == 3) + { + 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 = 21.9f * (float)num23; //solar dash amount + 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 < 40; num24++) + { + int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 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 == 4) + { + 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 = 23.9f * (float)num23; //slighty more powerful solar dash + 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, 244, 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 == 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; + } + } + } + } + } + + private void OnDodge() + { + if (player.whoAmI == Main.myPlayer && dodgeScarf && !scarfCooldown) + { + player.AddBuff(mod.BuffType("ScarfMeleeBoost"), 540); + player.AddBuff(mod.BuffType("ScarfCooldown"), (player.chaosState ? 1800 : 900)); + player.immune = true; + player.immuneTime = 60; + if (player.longInvince) + { + player.immuneTime += 40; + } + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + for (int j = 0; j < 100; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 235, 0f, 0f, 100, default(Color), 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.4f; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.Next(2) == 0) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].noGravity = true; + } + } + if (player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(62, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } + } + } + + public void ModHorizontalMovement() + { + float num = (player.accRunSpeed + player.maxRunSpeed) / 2f; + if (player.controlLeft && player.velocity.X > -player.accRunSpeed && player.dashDelay >= 0) + { + if (player.velocity.X < -num && player.velocity.Y == 0f && !player.mount.Active) + { + int num3 = 0; + if (player.gravDir == -1f) + { + num3 -= player.height; + } + if (dashMod == 1) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 1.5f); + 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 == 2) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 2.5f); + 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 == 3) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -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 == 4) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -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 == 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) + { + if (player.velocity.X > num && player.velocity.Y == 0f && !player.mount.Active) + { + int num8 = 0; + if (player.gravDir == -1f) + { + num8 -= player.height; + } + if (dashMod == 1) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 1.5f); + 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 == 2) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 2.5f); + 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 == 3) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -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 == 4) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -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 == 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 + + #region Drawing + public static readonly PlayerLayer MiscEffectsBack = new PlayerLayer("CalamityMod", "MiscEffectsBack", PlayerLayer.MiscEffectsBack, delegate (PlayerDrawInfo drawInfo) + { + if (drawInfo.shadow != 0f) + { + return; + } + Player drawPlayer = drawInfo.drawPlayer; + Mod mod = ModLoader.GetMod("CalamityMod"); + CalamityPlayer modPlayer = drawPlayer.GetModPlayer(mod); + if (modPlayer.sirenIce) + { + Texture2D texture = mod.GetTexture("ExtraTextures/IceShield"); + int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); + int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); //4 + DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.Cyan, 0f, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, SpriteEffects.None, 0); + Main.playerDrawData.Add(data); + } + if (modPlayer.amidiasBlessing) + { + Texture2D texture = mod.GetTexture("ExtraTextures/AmidiasBubble"); + int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); + int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); //4 + DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.White, 0f, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, SpriteEffects.None, 0); + Main.playerDrawData.Add(data); + } + }); + + public static readonly PlayerLayer MiscEffects = new PlayerLayer("CalamityMod", "MiscEffects", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo drawInfo) + { + if (drawInfo.shadow != 0f) + { + return; + } + Player drawPlayer = drawInfo.drawPlayer; + Mod mod = ModLoader.GetMod("CalamityMod"); + Item item = drawPlayer.inventory[drawPlayer.selectedItem]; + if (!drawPlayer.frozen && + ((drawPlayer.itemAnimation > 0 && item.useStyle != 0) || (item.holdStyle > 0 && !drawPlayer.pulley)) && + item.type > 0 && + !drawPlayer.dead && + !item.noUseGraphic && + (!drawPlayer.wet || !item.noWet)) + { + Vector2 vector = drawPlayer.position + (drawPlayer.itemLocation - drawPlayer.position); + SpriteEffects effect = SpriteEffects.FlipHorizontally; + if (drawPlayer.gravDir == 1f) + { + if (drawPlayer.direction == 1) + { + effect = SpriteEffects.None; + } + else + { + effect = SpriteEffects.FlipHorizontally; + } + } + else + { + if (drawPlayer.direction == 1) + { + effect = SpriteEffects.FlipVertically; + } + else + { + effect = (SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically); + } + } + if (item.type == mod.ItemType("DeathhailStaff")) + { + Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/DeathhailStaffGlow"); + float num104 = drawPlayer.itemRotation + 0.785f * (float)drawPlayer.direction; + int num105 = 0; + int num106 = 0; + Vector2 zero3 = new Vector2(0f, (float)Main.itemTexture[item.type].Height); + if (drawPlayer.gravDir == -1f) + { + if (drawPlayer.direction == -1) + { + num104 += 1.57f; + zero3 = new Vector2((float)Main.itemTexture[item.type].Width, 0f); + num105 -= Main.itemTexture[item.type].Width; + } + else + { + num104 -= 1.57f; + zero3 = Vector2.Zero; + } + } + else if (drawPlayer.direction == -1) + { + zero3 = new Vector2((float)Main.itemTexture[item.type].Width, (float)Main.itemTexture[item.type].Height); + num105 -= Main.itemTexture[item.type].Width; + } + DrawData data = new DrawData(texture, + new Vector2((float)((int)(vector.X - Main.screenPosition.X + zero3.X + (float)num105)), (float)((int)(vector.Y - Main.screenPosition.Y + (float)num106))), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), + Color.White, + num104, + zero3, + item.scale, + effect, + 0); + Main.playerDrawData.Add(data); + } + else if (item.type == mod.ItemType("Deathwind")) + { + Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/DeathwindGlow"); + Vector2 vector13 = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)); + Vector2 vector14 = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)); + int num107 = (int)vector14.X - 10; + vector13.Y = vector14.Y; + Vector2 origin4 = new Vector2(-(float)num107, (float)(Main.itemTexture[item.type].Height / 2)); + if (drawPlayer.direction == -1) + { + origin4 = new Vector2((float)(Main.itemTexture[item.type].Width + num107), (float)(Main.itemTexture[item.type].Height / 2)); + } + DrawData data = new DrawData(texture, + new Vector2((float)((int)(vector.X - Main.screenPosition.X + vector13.X)), (float)((int)(vector.Y - Main.screenPosition.Y + vector13.Y))), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), + Color.White, + drawPlayer.itemRotation, + origin4, + item.scale, + effect, + 0); + Main.playerDrawData.Add(data); + } + else if (item.type == mod.ItemType("Excelsus")) + { + Vector2 zero2 = Vector2.Zero; + Texture2D texture = mod.GetTexture("Items/Weapons/DevourerofGods/ExcelsusGlow"); + if (drawPlayer.gravDir == -1f) + { + DrawData data = new DrawData(texture, + new Vector2((float)((int)(vector.X - Main.screenPosition.X)), (float)((int)(vector.Y - Main.screenPosition.Y))), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), + Color.White, + drawPlayer.itemRotation, + new Vector2((float)Main.itemTexture[item.type].Width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f * (float)drawPlayer.direction, 0f) + zero2, + item.scale, + effect, + 0); + Main.playerDrawData.Add(data); + } + else + { + DrawData data = new DrawData(texture, + new Vector2((float)((int)(vector.X - Main.screenPosition.X)), (float)((int)(vector.Y - Main.screenPosition.Y))), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), + Color.White, + drawPlayer.itemRotation, + new Vector2((float)Main.itemTexture[item.type].Width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f * (float)drawPlayer.direction, (float)Main.itemTexture[item.type].Height) + zero2, + item.scale, + effect, + 0); + Main.playerDrawData.Add(data); + } + } + } + }); + + public override void ModifyDrawLayers(List list) + { + MiscEffectsBack.visible = true; + list.Insert(0, MiscEffectsBack); + MiscEffects.visible = true; + list.Add(MiscEffects); + 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.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) + { + int insertAt = -1; + for (int m = 0; m < list.Count; m++) + { + PlayerLayer dl = list[m]; + if (dl.Name.Equals(parent.Name)) { insertAt = m; break; } + } + if (insertAt == -1) list.Add(layer); else list.Insert(first ? insertAt : insertAt + 1, layer); + } + + public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) + { + bool noRogueStealth = rogueStealth == 0f || player.townNPCs > 2f; + if (rogueStealth > 0f && rogueStealthMax > 0f && player.townNPCs < 3f) + { + //A translucent orchid color, the rogue class color + float colorValue = (rogueStealth / rogueStealthMax) * 0.9f; //0 to 0.9 + r *= 1f - (colorValue * 0.89f); //255 to 50 + g *= 1f - colorValue; //255 to 25 + b *= 1f - (colorValue * 0.89f); //255 to 50 + a *= 1f - colorValue; //255 to 25 + player.armorEffectDrawOutlines = false; + player.armorEffectDrawShadow = false; + player.armorEffectDrawShadowSubtle = false; + } + if (CalamityWorld.ironHeart && !Main.gameMenu) + { + Texture2D ironHeart = mod.GetTexture("ExtraTextures/IronHeart"); + Main.heartTexture = Main.heart2Texture = ironHeart; + } + else + { + Texture2D heart3 = mod.GetTexture("ExtraTextures/Heart3"); + Texture2D heart4 = mod.GetTexture("ExtraTextures/Heart4"); + Texture2D heart5 = mod.GetTexture("ExtraTextures/Heart5"); + Texture2D heart6 = mod.GetTexture("ExtraTextures/Heart6"); + Texture2D heartOriginal = mod.GetTexture("ExtraTextures/HeartOriginal"); + Texture2D heartOriginal2 = mod.GetTexture("ExtraTextures/HeartOriginal2"); + + int totalFruit = + (mFruit ? 1 : 0) + + (bOrange ? 1 : 0) + + (eBerry ? 1 : 0) + + (dFruit ? 1 : 0); + switch (totalFruit) + { + default: + Main.heart2Texture = heartOriginal; Main.heartTexture = heartOriginal2; + break; + case 4: + Main.heart2Texture = heart6; Main.heartTexture = heartOriginal2; + break; + case 3: + Main.heart2Texture = heart5; Main.heartTexture = heartOriginal2; + break; + case 2: + Main.heart2Texture = heart4; Main.heartTexture = heartOriginal2; + break; + case 1: + Main.heart2Texture = heart3; Main.heartTexture = heartOriginal2; + break; + } + } + if (revivifyTimer > 0) + { + if (Main.rand.Next(2) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 91, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default(Color), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + } + if (tRegen) + { + if (Main.rand.Next(10) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 107, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.75f; + Main.dust[dust].velocity.Y -= 0.35f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.025f; + g *= 0.15f; + b *= 0.035f; + fullBright = true; + } + } + if (IBoots) + { + if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + { + if (Main.rand.Next(2) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 229, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.05f; + g *= 0.05f; + b *= 0.05f; + fullBright = true; + } + } + } + if (elysianFire) + { + if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + { + if (Main.rand.Next(2) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 246, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.75f; + g *= 0.55f; + b *= 0f; + fullBright = true; + } + } + } + if (dsSetBonus) + { + if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + { + if (Main.rand.Next(2) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 27, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.025f; + b *= 0.1f; + fullBright = true; + } + } + } + if (auricSet) + { + if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + { + if (drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, Main.rand.Next(2) == 0 ? 57 : 244, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.025f; + b *= 0.1f; + fullBright = true; + } + } + } + if (bFlames || aFlames || rageMode) + { + if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, mod.DustType("BrimstoneFlame"), player.velocity.X * 0.4f, player.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; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + if (adrenalineMode) + { + if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 206, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 3f); + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.01f; + g *= 0.15f; + b *= 0.1f; + fullBright = true; + } + } + if (gsInferno) + { + if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 173, player.velocity.X * 0.4f, player.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; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + if (hFlames || hInferno) + { + if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, mod.DustType("HolyFlame"), player.velocity.X * 0.4f, player.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; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.25f; + b *= 0.1f; + fullBright = true; + } + } + if (pFlames) + { + if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 89, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.07f; + g *= 0.15f; + b *= 0.01f; + fullBright = true; + } + } + if (gState || cDepth) + { + if (noRogueStealth) + { + r *= 0f; + g *= 0.05f; + b *= 0.3f; + fullBright = true; + } + } + if (draedonsHeart && !shadeRegen && !cFreeze && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + if (noRogueStealth) + { + r *= 0f; + g *= 0.5f; + b *= 0f; + fullBright = true; + } + } + if (bBlood) + { + if (Main.rand.Next(6) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 5, player.velocity.X * 0.4f, player.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; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + if (mushy) + { + if (Main.rand.Next(6) == 0 && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 56, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.dust[dust].velocity.Y -= 0.1f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + } + #endregion + + /*#region NurseModifications + public override bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText) + { + if (CalamityWorld.revenge) + { + chatText = "Now is not the time!"; + return !areThereAnyDamnBosses; + } + return true; + } + + public override void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price) + { + if (CalamityWorld.revenge) + { + double priceMultiplier = 1.0 + //3 silver base + (Main.hardMode ? 99.0 : 0.0) + //3 gold + (NPC.downedMechBossAny ? 200.0 : 0.0) + //9 gold + (NPC.downedPlantBoss ? 300.0 : 0.0) + //18 gold + (NPC.downedGolemBoss ? 400.0 : 0.0) + //30 gold + (NPC.downedFishron ? 500.0 : 0.0) + //45 gold + (NPC.downedAncientCultist ? 600.0 : 0.0) + //63 gold + (NPC.downedMoonlord ? 700.0 : 0.0) + //84 gold + (CalamityWorld.downedProvidence ? 800.0 : 0.0) + //1 platinum 8 gold + (CalamityWorld.downedDoG ? 900.0 : 0.0) + //1 platinum 35 gold + (CalamityWorld.downedYharon ? 1000.0 : 0.0); //1 platinum 65 gold + price = (int)((double)price * priceMultiplier); + } + } + #endregion*/ + + #region DamageAndCrit + public void AllDamageBoost(float boost) + { + player.meleeDamage += boost; + player.rangedDamage += boost; + player.magicDamage += boost; + player.minionDamage += boost; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += boost; + } + + public void AllCritBoost(int boost) + { + player.meleeCrit += boost; + player.rangedCrit += boost; + player.magicCrit += boost; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += boost; + } + #endregion + + #region PacketStuff + private void ExactLevelPacket(bool server, int levelType) + { + ModPacket packet = mod.GetPacket(256); + switch (levelType) + { + case 0: + packet.Write((byte)CalamityModMessageType.ExactMeleeLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactMeleeLevel); + break; + case 1: + packet.Write((byte)CalamityModMessageType.ExactRangedLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactRangedLevel); + break; + case 2: + packet.Write((byte)CalamityModMessageType.ExactMagicLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactMagicLevel); + break; + case 3: + packet.Write((byte)CalamityModMessageType.ExactSummonLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactSummonLevel); + break; + case 4: + packet.Write((byte)CalamityModMessageType.ExactRogueLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactRogueLevel); + break; + } + if (!server) + { + packet.Send(); + } + else + { + packet.Send(-1, player.whoAmI); + } + } + + private void LevelPacket(bool server, int levelType) + { + ModPacket packet = mod.GetPacket(256); + switch (levelType) + { + case 0: + packet.Write((byte)CalamityModMessageType.MeleeLevelSync); + packet.Write(player.whoAmI); + packet.Write(meleeLevel); + break; + case 1: + packet.Write((byte)CalamityModMessageType.RangedLevelSync); + packet.Write(player.whoAmI); + packet.Write(rangedLevel); + break; + case 2: + packet.Write((byte)CalamityModMessageType.MagicLevelSync); + packet.Write(player.whoAmI); + packet.Write(magicLevel); + break; + case 3: + packet.Write((byte)CalamityModMessageType.SummonLevelSync); + packet.Write(player.whoAmI); + packet.Write(summonLevel); + break; + case 4: + packet.Write((byte)CalamityModMessageType.RogueLevelSync); + packet.Write(player.whoAmI); + packet.Write(rogueLevel); + break; + } + if (!server) + { + packet.Send(); + } + else + { + packet.Send(-1, player.whoAmI); + } + } + + private void StressPacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.StressSync); + packet.Write(player.whoAmI); + packet.Write(stress); + if (!server) + { + packet.Send(); + } + else + { + packet.Send(-1, player.whoAmI); + } + } + + private void AdrenalinePacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.AdrenalineSync); + packet.Write(player.whoAmI); + packet.Write(adrenaline); + if (!server) + { + packet.Send(); + } + else + { + packet.Send(-1, player.whoAmI); + } + } + + /*private void DistanceFromBossPacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DistanceFromBossSync); + packet.Write(player.whoAmI); + packet.Write(distanceFromBoss); + if (!server) + { + packet.Send(); + } + else + { + packet.Send(-1, player.whoAmI); + } + }*/ + + 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) + { + case 0: + exactMeleeLevel = reader.ReadInt32(); + break; + case 1: + exactRangedLevel = reader.ReadInt32(); + break; + case 2: + exactMagicLevel = reader.ReadInt32(); + break; + case 3: + exactSummonLevel = reader.ReadInt32(); + break; + case 4: + exactRogueLevel = reader.ReadInt32(); + break; + } + if (Main.netMode == 2) + { + ExactLevelPacket(true, levelType); + } + } + + internal void HandleLevels(BinaryReader reader, int levelType) + { + switch (levelType) + { + case 0: + meleeLevel = reader.ReadInt32(); + break; + case 1: + rangedLevel = reader.ReadInt32(); + break; + case 2: + magicLevel = reader.ReadInt32(); + break; + case 3: + summonLevel = reader.ReadInt32(); + break; + case 4: + rogueLevel = reader.ReadInt32(); + break; + } + if (Main.netMode == 2) + { + LevelPacket(true, levelType); + } + } + + internal void HandleStress(BinaryReader reader) + { + stress = reader.ReadInt32(); + if (Main.netMode == 2) + { + StressPacket(true); + } + } + + internal void HandleAdrenaline(BinaryReader reader) + { + adrenaline = reader.ReadInt32(); + if (Main.netMode == 2) + { + AdrenalinePacket(true); + } + } + + /*internal void HandleDistanceFromBoss(BinaryReader reader) + { + distanceFromBoss = reader.ReadInt32(); + if (Main.netMode == 2) + { + DistanceFromBossPacket(true); + } + }*/ + + internal void HandleDeathCount(BinaryReader reader) + { + deathCount = reader.ReadInt32(); + if (Main.netMode == 2) + { + DeathPacket(true); + } + } + + public override void OnEnterWorld(Player player) + { + if (Main.netMode == 1) + { + ExactLevelPacket(false, 0); + ExactLevelPacket(false, 1); + ExactLevelPacket(false, 2); + ExactLevelPacket(false, 3); + ExactLevelPacket(false, 4); + LevelPacket(false, 0); + LevelPacket(false, 1); + LevelPacket(false, 2); + LevelPacket(false, 3); + LevelPacket(false, 4); + StressPacket(false); + AdrenalinePacket(false); + //DistanceFromBossPacket(false); + DeathPacket(false); + } + } + #endregion + + #region ProficiencyStuff + private void GetExactLevelUp() + { + if (gainLevelCooldown > 0) + gainLevelCooldown--; + + #region MeleeLevels + switch (meleeLevel) + { + case 100: + this.ExactLevelUp(0, 1, false); + break; + case 300: + this.ExactLevelUp(0, 2, false); + break; + case 600: + this.ExactLevelUp(0, 3, false); + break; + case 1000: + this.ExactLevelUp(0, 4, false); + break; + case 1500: + this.ExactLevelUp(0, 5, false); + break; + case 2100: + this.ExactLevelUp(0, 6, false); + break; + case 2800: + this.ExactLevelUp(0, 7, false); + break; + case 3600: + this.ExactLevelUp(0, 8, false); + break; + case 4500: + this.ExactLevelUp(0, 9, false); + break; + case 5500: + this.ExactLevelUp(0, 10, false); + break; + case 6600: + this.ExactLevelUp(0, 11, false); + break; + case 7800: + this.ExactLevelUp(0, 12, false); + break; + case 9100: + this.ExactLevelUp(0, 13, false); + break; + case 10500: + this.ExactLevelUp(0, 14, false); + break; + case 12500: //celebration or some shit for final level, yay + this.ExactLevelUp(0, 15, true); + break; + default: + break; + } + #endregion + + #region RangedLevels + switch (rangedLevel) + { + case 100: + this.ExactLevelUp(1, 1, false); + break; + case 300: + this.ExactLevelUp(1, 2, false); + break; + case 600: + this.ExactLevelUp(1, 3, false); + break; + case 1000: + this.ExactLevelUp(1, 4, false); + break; + case 1500: + this.ExactLevelUp(1, 5, false); + break; + case 2100: + this.ExactLevelUp(1, 6, false); + break; + case 2800: + this.ExactLevelUp(1, 7, false); + break; + case 3600: + this.ExactLevelUp(1, 8, false); + break; + case 4500: + this.ExactLevelUp(1, 9, false); + break; + case 5500: + this.ExactLevelUp(1, 10, false); + break; + case 6600: + this.ExactLevelUp(1, 11, false); + break; + case 7800: + this.ExactLevelUp(1, 12, false); + break; + case 9100: + this.ExactLevelUp(1, 13, false); + break; + case 10500: + this.ExactLevelUp(1, 14, false); + break; + case 12500: //celebration or some shit for final level, yay + this.ExactLevelUp(1, 15, true); + break; + default: + break; + } + #endregion + + #region MagicLevels + switch (magicLevel) + { + case 100: + this.ExactLevelUp(2, 1, false); + break; + case 300: + this.ExactLevelUp(2, 2, false); + break; + case 600: + this.ExactLevelUp(2, 3, false); + break; + case 1000: + this.ExactLevelUp(2, 4, false); + break; + case 1500: + this.ExactLevelUp(2, 5, false); + break; + case 2100: + this.ExactLevelUp(2, 6, false); + break; + case 2800: + this.ExactLevelUp(2, 7, false); + break; + case 3600: + this.ExactLevelUp(2, 8, false); + break; + case 4500: + this.ExactLevelUp(2, 9, false); + break; + case 5500: + this.ExactLevelUp(2, 10, false); + break; + case 6600: + this.ExactLevelUp(2, 11, false); + break; + case 7800: + this.ExactLevelUp(2, 12, false); + break; + case 9100: + this.ExactLevelUp(2, 13, false); + break; + case 10500: + this.ExactLevelUp(2, 14, false); + break; + case 12500: //celebration or some shit for final level, yay + this.ExactLevelUp(2, 15, true); + break; + default: + break; + } + #endregion + + #region SummonLevels + switch (summonLevel) + { + case 100: + this.ExactLevelUp(3, 1, false); + break; + case 300: + this.ExactLevelUp(3, 2, false); + break; + case 600: + this.ExactLevelUp(3, 3, false); + break; + case 1000: + this.ExactLevelUp(3, 4, false); + break; + case 1500: + this.ExactLevelUp(3, 5, false); + break; + case 2100: + this.ExactLevelUp(3, 6, false); + break; + case 2800: + this.ExactLevelUp(3, 7, false); + break; + case 3600: + this.ExactLevelUp(3, 8, false); + break; + case 4500: + this.ExactLevelUp(3, 9, false); + break; + case 5500: + this.ExactLevelUp(3, 10, false); + break; + case 6600: + this.ExactLevelUp(3, 11, false); + break; + case 7800: + this.ExactLevelUp(3, 12, false); + break; + case 9100: + this.ExactLevelUp(3, 13, false); + break; + case 10500: + this.ExactLevelUp(3, 14, false); + break; + case 12500: //celebration or some shit for final level, yay + this.ExactLevelUp(3, 15, true); + break; + default: + break; + } + #endregion + + #region RogueLevels + switch (rogueLevel) + { + case 100: + this.ExactLevelUp(4, 1, false); + break; + case 300: + this.ExactLevelUp(4, 2, false); + break; + case 600: + this.ExactLevelUp(4, 3, false); + break; + case 1000: + this.ExactLevelUp(4, 4, false); + break; + case 1500: + this.ExactLevelUp(4, 5, false); + break; + case 2100: + this.ExactLevelUp(4, 6, false); + break; + case 2800: + this.ExactLevelUp(4, 7, false); + break; + case 3600: + this.ExactLevelUp(4, 8, false); + break; + case 4500: + this.ExactLevelUp(4, 9, false); + break; + case 5500: + this.ExactLevelUp(4, 10, false); + break; + case 6600: + this.ExactLevelUp(4, 11, false); + break; + case 7800: + this.ExactLevelUp(4, 12, false); + break; + case 9100: + this.ExactLevelUp(4, 13, false); + break; + case 10500: + this.ExactLevelUp(4, 14, false); + break; + case 12500: //celebration or some shit for final level, yay + this.ExactLevelUp(4, 15, true); + break; + default: + break; + } + #endregion + } + + private void ExactLevelUp(int levelUpType, int level, bool final) + { + Color messageColor = Color.Orange; + switch (levelUpType) + { + case 0: + exactMeleeLevel = level; + if (shootFireworksLevelUpMelee) + { + string key = (final ? "Mods.CalamityMod.MeleeLevelUpFinal" : "Mods.CalamityMod.MeleeLevelUp"); + shootFireworksLevelUpMelee = false; + if (player.whoAmI == Main.myPlayer) + { + if (final) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 0f); + } + Main.NewText(Language.GetTextValue(key), messageColor); + } + } + break; + case 1: + exactRangedLevel = level; + if (shootFireworksLevelUpRanged) + { + string key = (final ? "Mods.CalamityMod.RangedLevelUpFinal" : "Mods.CalamityMod.RangedLevelUp"); + messageColor = Color.GreenYellow; + shootFireworksLevelUpRanged = false; + if (player.whoAmI == Main.myPlayer) + { + if (final) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 0f); + } + Main.NewText(Language.GetTextValue(key), messageColor); + } + } + break; + case 2: + exactMagicLevel = level; + if (shootFireworksLevelUpMagic) + { + string key = (final ? "Mods.CalamityMod.MagicLevelUpFinal" : "Mods.CalamityMod.MagicLevelUp"); + messageColor = Color.DodgerBlue; + shootFireworksLevelUpMagic = false; + if (player.whoAmI == Main.myPlayer) + { + if (final) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 0f); + } + Main.NewText(Language.GetTextValue(key), messageColor); + } + } + break; + case 3: + exactSummonLevel = level; + if (shootFireworksLevelUpSummon) + { + string key = (final ? "Mods.CalamityMod.SummonLevelUpFinal" : "Mods.CalamityMod.SummonLevelUp"); + messageColor = Color.Aquamarine; + shootFireworksLevelUpSummon = false; + if (player.whoAmI == Main.myPlayer) + { + if (final) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 0f); + } + Main.NewText(Language.GetTextValue(key), messageColor); + } + } + break; + case 4: + exactRogueLevel = level; + if (shootFireworksLevelUpRogue) + { + string key = (final ? "Mods.CalamityMod.RogueLevelUpFinal" : "Mods.CalamityMod.RogueLevelUp"); + messageColor = Color.Orchid; + shootFireworksLevelUpRogue = false; + if (player.whoAmI == Main.myPlayer) + { + if (final) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworkRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -5f, ProjectileID.RocketFireworksBoxRed + Main.rand.Next(4), + 0, 0f, Main.myPlayer, 0f, 0f); + } + Main.NewText(Language.GetTextValue(key), messageColor); + } + } + break; + } + if (Main.netMode == 1) + { + ExactLevelPacket(false, levelUpType); + } + } + + private void GetStatBonuses() + { + #region MeleeLevelBoosts + if (meleeLevel >= 12500) + { + player.meleeDamage += 0.12f; + player.meleeCrit += 6; + } + else if (meleeLevel >= 10500) + { + player.meleeDamage += 0.1f; + player.meleeCrit += 5; + } + else if (meleeLevel >= 9100) + { + player.meleeDamage += 0.09f; + player.meleeCrit += 5; + } + else if (meleeLevel >= 7800) + { + player.meleeDamage += 0.08f; + player.meleeCrit += 4; + } + else if (meleeLevel >= 6600) + { + player.meleeDamage += 0.07f; + player.meleeCrit += 4; + } + else if (meleeLevel >= 5500) //hm limit + { + player.meleeDamage += 0.06f; + player.meleeCrit += 3; + } + else if (meleeLevel >= 4500) + { + player.meleeDamage += 0.05f; + player.meleeCrit += 3; + } + else if (meleeLevel >= 3600) + { + player.meleeDamage += 0.05f; + player.meleeCrit += 2; + } + else if (meleeLevel >= 2800) + { + player.meleeDamage += 0.04f; + player.meleeCrit += 2; + } + else if (meleeLevel >= 2100) + { + player.meleeDamage += 0.04f; + player.meleeCrit += 1; + } + else if (meleeLevel >= 1500) //prehm limit + { + player.meleeDamage += 0.03f; + player.meleeCrit += 1; + } + else if (meleeLevel >= 1000) + { + player.meleeDamage += 0.03f; + player.meleeCrit += 1; + } + else if (meleeLevel >= 600) + { + player.meleeDamage += 0.02f; + } + else if (meleeLevel >= 300) + player.meleeDamage += 0.02f; + else if (meleeLevel >= 100) + player.meleeDamage += 0.01f; + #endregion + + #region RangedLevelBoosts + if (rangedLevel >= 12500) + { + player.rangedDamage += 0.12f; + player.moveSpeed += 0.12f; + player.rangedCrit += 6; + } + else if (rangedLevel >= 10500) + { + player.rangedDamage += 0.1f; + player.moveSpeed += 0.1f; + player.rangedCrit += 5; + } + else if (rangedLevel >= 9100) + { + player.rangedDamage += 0.09f; + player.moveSpeed += 0.09f; + player.rangedCrit += 5; + } + else if (rangedLevel >= 7800) + { + player.rangedDamage += 0.08f; + player.moveSpeed += 0.08f; + player.rangedCrit += 4; + } + else if (rangedLevel >= 6600) + { + player.rangedDamage += 0.07f; + player.moveSpeed += 0.07f; + player.rangedCrit += 4; + } + else if (rangedLevel >= 5500) + { + player.rangedDamage += 0.06f; + player.moveSpeed += 0.06f; + player.rangedCrit += 3; + } + else if (rangedLevel >= 4500) + { + player.rangedDamage += 0.05f; + player.moveSpeed += 0.05f; + player.rangedCrit += 3; + } + else if (rangedLevel >= 3600) + { + player.rangedDamage += 0.05f; + player.moveSpeed += 0.05f; + player.rangedCrit += 2; + } + else if (rangedLevel >= 2800) + { + player.rangedDamage += 0.04f; + player.moveSpeed += 0.04f; + player.rangedCrit += 2; + } + else if (rangedLevel >= 2100) + { + player.rangedDamage += 0.04f; + player.moveSpeed += 0.03f; + player.rangedCrit += 1; + } + else if (rangedLevel >= 1500) + { + player.rangedDamage += 0.03f; + player.moveSpeed += 0.02f; + player.rangedCrit += 1; + } + else if (rangedLevel >= 1000) + { + player.rangedDamage += 0.03f; + player.moveSpeed += 0.01f; + player.rangedCrit += 1; + } + else if (rangedLevel >= 600) + { + player.rangedDamage += 0.02f; + player.rangedCrit += 1; + } + else if (rangedLevel >= 300) + player.rangedDamage += 0.02f; + else if (rangedLevel >= 100) + player.rangedDamage += 0.01f; + #endregion + + #region MagicLevelBoosts + if (magicLevel >= 12500) + { + player.magicDamage += 0.12f; + player.manaCost *= 0.88f; + player.magicCrit += 6; + } + else if (magicLevel >= 10500) + { + player.magicDamage += 0.1f; + player.manaCost *= 0.9f; + player.magicCrit += 5; + } + else if (magicLevel >= 9100) + { + player.magicDamage += 0.09f; + player.manaCost *= 0.91f; + player.magicCrit += 5; + } + else if (magicLevel >= 7800) + { + player.magicDamage += 0.08f; + player.manaCost *= 0.92f; + player.magicCrit += 4; + } + else if (magicLevel >= 6600) + { + player.magicDamage += 0.07f; + player.manaCost *= 0.93f; + player.magicCrit += 4; + } + else if (magicLevel >= 5500) + { + player.magicDamage += 0.06f; + player.manaCost *= 0.94f; + player.magicCrit += 3; + } + else if (magicLevel >= 4500) + { + player.magicDamage += 0.05f; + player.manaCost *= 0.95f; + player.magicCrit += 3; + } + else if (magicLevel >= 3600) + { + player.magicDamage += 0.05f; + player.manaCost *= 0.95f; + player.magicCrit += 2; + } + else if (magicLevel >= 2800) + { + player.magicDamage += 0.04f; + player.manaCost *= 0.96f; + player.magicCrit += 2; + } + else if (magicLevel >= 2100) + { + player.magicDamage += 0.04f; + player.manaCost *= 0.97f; + player.magicCrit += 1; + } + else if (magicLevel >= 1500) + { + player.magicDamage += 0.03f; + player.manaCost *= 0.98f; + player.magicCrit += 1; + } + else if (magicLevel >= 1000) + { + player.magicDamage += 0.03f; + player.manaCost *= 0.99f; + player.magicCrit += 1; + } + else if (magicLevel >= 600) + { + player.magicDamage += 0.02f; + player.manaCost *= 0.99f; + } + else if (magicLevel >= 300) + player.magicDamage += 0.02f; + else if (magicLevel >= 100) + player.magicDamage += 0.01f; + #endregion + + #region SummonLevelBoosts + if (summonLevel >= 12500) + { + player.minionDamage += 0.12f; + player.minionKB += 3.0f; + player.maxMinions += 3; + } + else if (summonLevel >= 10500) + { + player.minionDamage += 0.1f; + player.minionKB += 3.0f; + player.maxMinions += 2; + } + else if (summonLevel >= 9100) + { + player.minionDamage += 0.09f; + player.minionKB += 2.7f; + player.maxMinions += 2; + } + else if (summonLevel >= 7800) + { + player.minionDamage += 0.08f; + player.minionKB += 2.4f; + player.maxMinions += 2; + } + else if (summonLevel >= 6600) + { + player.minionDamage += 0.07f; + player.minionKB += 2.1f; + player.maxMinions += 2; + } + else if (summonLevel >= 5500) + { + player.minionDamage += 0.06f; + player.minionKB += 1.8f; + player.maxMinions += 2; + } + else if (summonLevel >= 4500) + { + player.minionDamage += 0.06f; + player.minionKB += 1.8f; + player.maxMinions++; + } + else if (summonLevel >= 3600) + { + player.minionDamage += 0.05f; + player.minionKB += 1.5f; + player.maxMinions++; + } + else if (summonLevel >= 2800) + { + player.minionDamage += 0.04f; + player.minionKB += 1.2f; + player.maxMinions++; + } + else if (summonLevel >= 2100) + { + player.minionDamage += 0.04f; + player.minionKB += 0.9f; + player.maxMinions++; + } + else if (summonLevel >= 1500) + { + player.minionDamage += 0.03f; + player.minionKB += 0.6f; + } + else if (summonLevel >= 1000) + { + player.minionDamage += 0.03f; + player.minionKB += 0.3f; + } + else if (summonLevel >= 600) + { + player.minionDamage += 0.02f; + player.minionKB += 0.3f; + } + else if (summonLevel >= 300) + player.minionDamage += 0.02f; + else if (summonLevel >= 100) + player.minionDamage += 0.01f; + #endregion + + #region RogueLevelBoosts + if (rogueLevel >= 12500) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.12f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 6; + } + else if (rogueLevel >= 10500) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + } + else if (rogueLevel >= 9100) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.09f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.09f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + } + else if (rogueLevel >= 7800) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.08f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 4; + } + else if (rogueLevel >= 6600) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.07f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.07f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 4; + } + else if (rogueLevel >= 5500) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.06f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.06f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + } + else if (rogueLevel >= 4500) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + } + else if (rogueLevel >= 3600) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; + } + else if (rogueLevel >= 2800) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.04f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.04f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; + } + else if (rogueLevel >= 2100) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.04f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.03f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 1; + } + else if (rogueLevel >= 1500) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.02f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 1; + } + else if (rogueLevel >= 1000) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.01f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 1; + } + else if (rogueLevel >= 600) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.01f; + } + else if (rogueLevel >= 300) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; + else if (rogueLevel >= 100) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.01f; + #endregion + } + + private float GetMeleeSpeedBonus() + { + float meleeSpeedBonus = 0f; + if (meleeLevel >= 12500) + { + meleeSpeedBonus += 0.12f; + } + else if (meleeLevel >= 10500) + { + meleeSpeedBonus += 0.1f; + } + else if (meleeLevel >= 9100) + { + meleeSpeedBonus += 0.09f; + } + else if (meleeLevel >= 7800) + { + meleeSpeedBonus += 0.08f; + } + else if (meleeLevel >= 6600) + { + meleeSpeedBonus += 0.07f; + } + else if (meleeLevel >= 5500) //hm limit + { + meleeSpeedBonus += 0.06f; + } + else if (meleeLevel >= 4500) + { + meleeSpeedBonus += 0.05f; + } + else if (meleeLevel >= 3600) + { + meleeSpeedBonus += 0.05f; + } + else if (meleeLevel >= 2800) + { + meleeSpeedBonus += 0.04f; + } + else if (meleeLevel >= 2100) + { + meleeSpeedBonus += 0.03f; + } + else if (meleeLevel >= 1500) //prehm limit + { + meleeSpeedBonus += 0.02f; + } + else if (meleeLevel >= 1000) + { + meleeSpeedBonus += 0.01f; + } + else if (meleeLevel >= 600) + { + meleeSpeedBonus += 0.01f; + } + return meleeSpeedBonus; + } + #endregion + } +} diff --git a/CalamityRecipes.cs b/CalamityRecipes.cs index 30accee06f..98d14df039 100644 --- a/CalamityRecipes.cs +++ b/CalamityRecipes.cs @@ -1,740 +1,740 @@ -using System.Collections.Generic; -using System.Linq; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod -{ - internal class CalamityRecipes - { - private static ModRecipe GetNewRecipe() - { - return new ModRecipe(CalamityMod.Instance); - } - - public static void AddRecipes() - { - EditTerraBladeRecipe(); - AddPotionRecipes(); - AddToolRecipes(); - AddProgressionRecipes(); - AddEarlyGameWeaponRecipes(); - AddEarlyGameAccessoryRecipes(); - AddAnkhShieldRecipes(); - AddAlternateHardmodeRecipes(); - - // Leather from Vertebrae, for Crimson worlds - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.Vertebrae, 5); - r.AddTile(TileID.WorkBenches); - r.SetResult(ItemID.Leather); - r.AddRecipe(); - - // Black Lens - r = GetNewRecipe(); - r.AddIngredient(ItemID.Lens); - r.AddIngredient(ItemID.BlackDye); - r.AddTile(TileID.DyeVat); - r.SetResult(ItemID.BlackLens); - r.AddRecipe(); - - // Fallen Star - r = GetNewRecipe(); - r.AddIngredient(null, "Stardust", 5); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.FallenStar); - r.AddRecipe(); - - // Ectoplasm from Ectoblood - r = GetNewRecipe(); - r.AddIngredient(null, "Ectoblood", 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Ectoplasm); - r.AddRecipe(); - - // Rocket I from Empty Bullet - r = GetNewRecipe(); - r.AddIngredient(ItemID.EmptyBullet, 20); - r.AddIngredient(ItemID.ExplosivePowder, 1); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.RocketI, 20); - r.AddRecipe(); - - // Life Crystal - r = GetNewRecipe(); - r.AddIngredient(ItemID.Bone, 5); - r.AddIngredient(ItemID.PinkGel); - r.AddIngredient(ItemID.HealingPotion); - r.AddIngredient(ItemID.Ruby); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.LifeCrystal); - r.AddRecipe(); - - // Life Fruit - r = GetNewRecipe(); - r.AddIngredient(null, "PlantyMush", 10); - r.AddIngredient(null, "LivingShard"); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.LifeFruit); - r.AddRecipe(); - } - - // Change Terra Blade's recipe to require 7 Living Shards (forces the Blade to be post-Plantera) - private static void EditTerraBladeRecipe() - { - List rec = Main.recipe.ToList(); - rec.Where(x => x.createItem.type == ItemID.TerraBlade).ToList().ForEach(s => - { - for (int i = 0; i < s.requiredItem.Length; i++) - { - s.requiredItem[i] = new Item(); - } - s.requiredItem[0].SetDefaults(ItemID.TrueNightsEdge, false); - s.requiredItem[0].stack = 1; - s.requiredItem[1].SetDefaults(ItemID.TrueExcalibur, false); - s.requiredItem[1].stack = 1; - s.requiredItem[2].SetDefaults(CalamityMod.Instance.ItemType("LivingShard"), false); - s.requiredItem[2].stack = 7; - - s.createItem.SetDefaults(ItemID.TerraBlade, false); - s.createItem.stack = 1; - }); - } - - #region Potions - // Equivalent Blood Orb recipes for almost all vanilla potions - private static void AddPotionRecipes() - { - short[] potions = new[] - { - ItemID.WormholePotion, - ItemID.TeleportationPotion, - ItemID.SwiftnessPotion, - ItemID.FeatherfallPotion, - ItemID.GravitationPotion, - ItemID.ShinePotion, - ItemID.InvisibilityPotion, - ItemID.NightOwlPotion, - ItemID.SpelunkerPotion, - ItemID.HunterPotion, - ItemID.TrapsightPotion, - ItemID.BattlePotion, - ItemID.CalmingPotion, - ItemID.WrathPotion, - ItemID.RagePotion, - ItemID.ThornsPotion, - ItemID.IronskinPotion, - ItemID.EndurancePotion, - ItemID.RegenerationPotion, - ItemID.LifeforcePotion, - ItemID.HeartreachPotion, - ItemID.TitanPotion, - ItemID.ArcheryPotion, - ItemID.AmmoReservationPotion, - ItemID.MagicPowerPotion, - ItemID.ManaRegenerationPotion, - ItemID.SummoningPotion, - ItemID.InfernoPotion, - ItemID.WarmthPotion, - ItemID.ObsidianSkinPotion, - ItemID.GillsPotion, - ItemID.WaterWalkingPotion, - ItemID.FlipperPotion, - ItemID.BuilderPotion, - ItemID.MiningPotion, - ItemID.FishingPotion, - ItemID.CratePotion, - ItemID.SonarPotion, - ItemID.GenderChangePotion, - ItemID.LovePotion, - ItemID.StinkPotion - }; - ModRecipe r; - - foreach (var potion in potions) - { - r = GetNewRecipe(); - r.AddIngredient(null, "BloodOrb", 10); - r.AddIngredient(ItemID.BottledWater); - r.AddTile(TileID.AlchemyTable); - r.SetResult(potion); - r.AddRecipe(); - } - } - #endregion - - #region Tools - // Essential tools such as the Magic Mirror and Rod of Discord - private static void AddToolRecipes() - { - // Magic Mirror - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.IronBar, 10); - r.AddIngredient(ItemID.Glass, 10); - r.AddIngredient(ItemID.FallenStar, 10); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.MagicMirror); - r.AddRecipe(); - - // Ice Mirror - r = GetNewRecipe(); - r.AddIngredient(ItemID.IceBlock, 20); - r.AddIngredient(ItemID.Glass, 10); - r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(ItemID.IronBar, 5); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.IceMirror); - r.AddRecipe(); - - // Shadow Key - r = GetNewRecipe(); - r.AddIngredient(ItemID.GoldenKey); - r.AddIngredient(ItemID.Obsidian, 20); - r.AddIngredient(ItemID.Bone, 5); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.ShadowKey); - r.AddRecipe(); - - // Rod of Discord - r = GetNewRecipe(); - r.AddIngredient(ItemID.SoulofLight, 30); - r.AddIngredient(ItemID.ChaosFish, 5); - r.AddIngredient(ItemID.PixieDust, 50); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.RodofDiscord); - r.AddRecipe(); - - // Sky Mill - r = GetNewRecipe(); - r.AddIngredient(ItemID.SunplateBlock, 10); - r.AddIngredient(ItemID.Cloud, 5); - r.AddIngredient(ItemID.RainCloud, 3); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.SkyMill); - r.AddRecipe(); - - // Ice Machine - r = GetNewRecipe(); - r.AddIngredient(ItemID.IceBlock, 25); - r.AddIngredient(ItemID.SnowBlock, 15); - r.AddIngredient(ItemID.IronBar, 3); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.IceMachine); - r.AddRecipe(); - } - #endregion - - #region ProgressionItems - // Boss summon and progression items - private static void AddProgressionRecipes() - { - // Guide Voodoo Doll - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.Leather, 2); - r.AddIngredient(null, "FetidEssence", 2); - r.AddTile(TileID.Hellforge); - r.SetResult(ItemID.GuideVoodooDoll); - r.AddRecipe(); - - r = GetNewRecipe(); - r.AddIngredient(ItemID.Leather, 2); - r.AddIngredient(null, "BloodlettingEssence", 2); - r.AddTile(TileID.Hellforge); - r.SetResult(ItemID.GuideVoodooDoll); - r.AddRecipe(); - - // Temple Key - r = GetNewRecipe(); - r.AddIngredient(ItemID.JungleSpores, 15); - r.AddIngredient(ItemID.RichMahogany, 15); - r.AddIngredient(ItemID.SoulofNight, 15); - r.AddIngredient(ItemID.SoulofLight, 15); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.TempleKey); - r.AddRecipe(); - - // Lihzahrd Power Cell (NOT Calamity's Old Power Cell) - r = GetNewRecipe(); - r.AddIngredient(ItemID.LihzahrdBrick, 15); - r.AddIngredient(null, "CoreofCinder"); - r.AddTile(TileID.LihzahrdFurnace); - r.SetResult(ItemID.LihzahrdPowerCell); - r.AddRecipe(); - - // Truffle Worm - r = GetNewRecipe(); - r.AddIngredient(ItemID.GlowingMushroom, 15); - r.AddIngredient(ItemID.Worm); - r.AddTile(TileID.Autohammer); - r.SetResult(ItemID.TruffleWorm); - r.AddRecipe(); - } - #endregion - - #region EarlyGameWeapons - // Early game weapons such as Enchanted Sword - private static void AddEarlyGameWeaponRecipes() - { - // Shuriken - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.IronBar); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Shuriken, 50); - r.AddRecipe(); - - // Throwing Knife - r = GetNewRecipe(); - r.AddIngredient(ItemID.IronBar); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.ThrowingKnife, 50); - r.AddRecipe(); - - // Wand of Sparking - r = GetNewRecipe(); - r.AddIngredient(ItemID.Wood, 5); - r.AddIngredient(ItemID.Torch, 3); - r.AddIngredient(ItemID.FallenStar); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.WandofSparking); - r.AddRecipe(); - - // Starfury w/ Gold Broadsword - r = GetNewRecipe(); - r.AddIngredient(ItemID.GoldBroadsword); - r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(null, "VictoryShard", 3); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Starfury); - r.AddRecipe(); - - // Starfury w/ Platinum Broadsword - r = GetNewRecipe(); - r.AddIngredient(ItemID.PlatinumBroadsword); - r.AddIngredient(ItemID.FallenStar, 10); - r.AddIngredient(null, "VictoryShard", 3); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Starfury); - r.AddRecipe(); - - // Enchanted Sword (requires Hardmode materials) - r = GetNewRecipe(); - r.AddIngredient(null, "VictoryShard", 10); - r.AddIngredient(ItemID.SoulofLight, 15); - r.AddIngredient(ItemID.UnicornHorn, 3); - r.AddIngredient(ItemID.LightShard); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.EnchantedSword); - r.AddRecipe(); - - // Muramasa w/ Cobalt Bars - r = GetNewRecipe(); - r.AddIngredient(ItemID.CobaltBar, 15); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Muramasa); - r.AddRecipe(); - - // Muramasa w/ Palladium Bars - r = GetNewRecipe(); - r.AddIngredient(ItemID.PalladiumBar, 15); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Muramasa); - r.AddRecipe(); - } - #endregion - - #region EarlyGameAccessories - // Early game accessories such as Cloud in a Bottle - private static void AddEarlyGameAccessoryRecipes() - { - // Cloud in a Bottle - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.Feather, 2); - r.AddIngredient(ItemID.Bottle); - r.AddIngredient(ItemID.Cloud, 25); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.CloudinaBottle); - r.AddRecipe(); - - // Hermes Boots - r = GetNewRecipe(); - r.AddIngredient(ItemID.Silk, 10); - r.AddTile(TileID.Loom); - r.SetResult(ItemID.HermesBoots); - r.AddRecipe(); - - // Blizzard in a Bottle - r = GetNewRecipe(); - r.AddIngredient(ItemID.Feather, 4); - r.AddIngredient(ItemID.Bottle); - r.AddIngredient(ItemID.SnowBlock, 50); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.BlizzardinaBottle); - r.AddRecipe(); - - // Sandstorm in a Bottle - r = GetNewRecipe(); - r.AddIngredient(null, "DesertFeather", 10); - r.AddIngredient(ItemID.Feather, 6); - r.AddIngredient(ItemID.Bottle); - r.AddIngredient(ItemID.SandBlock, 70); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.SandstorminaBottle); - r.AddRecipe(); - - // Frog Leg - r = GetNewRecipe(); - r.AddIngredient(ItemID.Frog, 10); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.FrogLeg); - r.AddRecipe(); - - // Flying Carpet - r = GetNewRecipe(); - r.AddIngredient(ItemID.AncientCloth, 10); - r.AddIngredient(ItemID.SoulofLight, 10); - r.AddIngredient(ItemID.SoulofNight, 10); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.FlyingCarpet); - r.AddRecipe(); - - // Aglet - r = GetNewRecipe(); - r.AddIngredient(ItemID.IronBar, 5); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Aglet); - r.AddRecipe(); - - // Anklet of the Wind - r = GetNewRecipe(); - r.AddIngredient(ItemID.JungleSpores, 15); - r.AddIngredient(ItemID.Cloud, 15); - r.AddIngredient(ItemID.PinkGel, 5); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.AnkletoftheWind); - r.AddRecipe(); - - // Water Walking Boots - r = GetNewRecipe(); - r.AddIngredient(ItemID.Leather, 5); - r.AddIngredient(ItemID.WaterWalkingPotion, 8); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.WaterWalkingBoots); - r.AddRecipe(); - - // Ice Skates - r = GetNewRecipe(); - r.AddIngredient(ItemID.IceBlock, 20); - r.AddIngredient(ItemID.Leather, 5); - r.AddIngredient(ItemID.IronBar, 5); - r.anyIronBar = true; - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.IceSkates); - r.AddRecipe(); - - // Lucky Horseshoe w/ Gold Bars - r = GetNewRecipe(); - r.AddIngredient(ItemID.SunplateBlock, 10); - r.AddIngredient(ItemID.Cloud, 10); - r.AddIngredient(ItemID.GoldBar, 5); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.LuckyHorseshoe); - r.AddRecipe(); - - // Lucky Horseshoe w/ Platinum Bars - r = GetNewRecipe(); - r.AddIngredient(ItemID.SunplateBlock, 10); - r.AddIngredient(ItemID.Cloud, 10); - r.AddIngredient(ItemID.PlatinumBar, 5); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.LuckyHorseshoe); - r.AddRecipe(); - - // Shiny Red Balloon - r = GetNewRecipe(); - r.AddIngredient(ItemID.WhiteString); - r.AddIngredient(ItemID.Gel, 80); - r.AddIngredient(ItemID.Cloud, 40); - r.AddTile(TileID.Solidifier); - r.SetResult(ItemID.ShinyRedBalloon); - r.AddRecipe(); - - // Lava Charm - r = GetNewRecipe(); - r.AddIngredient(ItemID.LavaBucket, 5); - r.AddIngredient(ItemID.Obsidian, 25); - r.AddIngredient(ItemID.IronBar, 5); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.LavaCharm); - r.AddRecipe(); - - // Feral Claws - r = GetNewRecipe(); - r.AddIngredient(ItemID.Leather, 10); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.FeralClaws); - r.AddRecipe(); - - // Radar - r = GetNewRecipe(); - r.AddIngredient(ItemID.IronBar, 5); - r.anyIronBar = true; - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Radar); - r.AddRecipe(); - } - #endregion - - #region AnkhShield - // Every base component for the Ankh Shield - private static void AddAnkhShieldRecipes() - { - // Cobalt Shield w/ Cobalt - ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.CobaltBar, 10); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.CobaltShield); - r.AddRecipe(); - - // Cobalt Shield w/ Palladium - r = GetNewRecipe(); - r.AddIngredient(ItemID.PalladiumBar, 10); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.CobaltShield); - r.AddRecipe(); - - // Armor Polish (broken armor) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Bone, 50); - r.AddIngredient(null, "AncientBoneDust", 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.ArmorPolish); - r.AddRecipe(); - - // Adhesive Bandage (bleeding) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Silk, 10); - r.AddIngredient(ItemID.Gel, 50); - r.AddIngredient(ItemID.GreaterHealingPotion); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.AdhesiveBandage); - r.AddRecipe(); - - // Bezoar (poison) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Stinger, 15); - r.AddIngredient(null, "MurkyPaste"); - r.AddTile(TileID.Anvils); - r.SetResult(ItemID.Bezoar); - r.AddRecipe(); - - // Nazar (curse) - r = GetNewRecipe(); - r.AddIngredient(ItemID.SoulofNight, 20); - r.AddIngredient(ItemID.Lens, 5); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Nazar); - r.AddRecipe(); - - // Vitamins (weakness) - r = GetNewRecipe(); - r.AddIngredient(ItemID.BottledWater); - r.AddIngredient(ItemID.Waterleaf, 5); - r.AddIngredient(ItemID.Blinkroot, 5); - r.AddIngredient(ItemID.Daybloom, 5); - r.AddIngredient(null, "BeetleJuice", 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Vitamins); - r.AddRecipe(); - - // Blindfold (darkness) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Silk, 30); - r.AddIngredient(ItemID.SoulofNight, 5); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Blindfold); - r.AddRecipe(); - - // Trifold Map (confusion) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Silk, 20); - r.AddIngredient(ItemID.SoulofLight, 3); - r.AddIngredient(ItemID.SoulofNight, 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.TrifoldMap); - r.AddRecipe(); - - // Fast Clock (slow) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Timer1Second); - r.AddIngredient(ItemID.PixieDust, 15); - r.AddIngredient(ItemID.SoulofLight, 5); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.FastClock); - r.AddRecipe(); - - // Megaphone (silence) - r = GetNewRecipe(); - r.AddIngredient(ItemID.Wire, 10); - r.AddIngredient(ItemID.HallowedBar, 5); - r.AddIngredient(ItemID.Ruby, 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.Megaphone); - r.AddRecipe(); - } - #endregion - - #region HardmodeEquipment - // Alternate recipes for vanilla Hardmode equipment - private static void AddAlternateHardmodeRecipes() - { - // Avenger Emblem made with Rogue Emblem - ModRecipe r = GetNewRecipe(); - r.AddIngredient(null, "RogueEmblem"); - r.AddIngredient(ItemID.SoulofMight, 5); - r.AddIngredient(ItemID.SoulofSight, 5); - r.AddIngredient(ItemID.SoulofFright, 5); - r.AddTile(TileID.TinkerersWorkbench); - r.SetResult(ItemID.AvengerEmblem); - r.AddRecipe(); - - // Celestial Magnet - r = GetNewRecipe(); - r.AddIngredient(ItemID.FallenStar, 20); - r.AddIngredient(ItemID.SoulofMight, 10); - r.AddIngredient(ItemID.SoulofLight, 5); - r.AddIngredient(ItemID.SoulofNight, 5); - r.AddIngredient(null, "CryoBar", 3); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.CelestialMagnet); - r.AddRecipe(); - - // Frozen Turtle Shell - r = GetNewRecipe(); - r.AddIngredient(ItemID.TurtleShell, 3); - r.AddIngredient(null, "EssenceofEleum", 9); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.FrozenTurtleShell); - r.AddRecipe(); - - // Frost Helmet w/ Frigid Bars - r = GetNewRecipe(); - r.AddIngredient(null, "CryoBar", 6); - r.AddIngredient(ItemID.FrostCore); - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.FrostHelmet); - r.AddRecipe(); - - // Frost Breastplate w/ Frigid Bars - r = GetNewRecipe(); - r.AddIngredient(null, "CryoBar", 10); - r.AddIngredient(ItemID.FrostCore); - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.FrostBreastplate); - r.AddRecipe(); - - // Frost Leggings w/ Frigid Bars - r = GetNewRecipe(); - r.AddIngredient(null, "CryoBar", 8); - r.AddIngredient(ItemID.FrostCore); - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.FrostLeggings); - r.AddRecipe(); - - // Terra Blade w/ True Bloody Edge - r = GetNewRecipe(); - r.AddIngredient(null, "TrueBloodyEdge"); - r.AddIngredient(ItemID.TrueExcalibur); - r.AddIngredient(null, "LivingShard", 7); - r.AddTile(TileID.MythrilAnvil); - r.SetResult(ItemID.TerraBlade); - r.AddRecipe(); - } - #endregion - - public static void AddRecipeGroups() - { - RecipeGroup group = new RecipeGroup(() => Lang.misc[37] + (" Silt"), new int[] - { - ItemID.SiltBlock, - ItemID.SlushBlock - }); - RecipeGroup.RegisterGroup("SiltGroup", group); - - group = new RecipeGroup(() => Lang.misc[37] + (" Lunar Pickaxe"), new int[] - { - ItemID.SolarFlarePickaxe, - ItemID.VortexPickaxe, - ItemID.NebulaPickaxe, - ItemID.StardustPickaxe - }); - RecipeGroup.RegisterGroup("LunarPickaxe", group); - - group = new RecipeGroup(() => Lang.misc[37] + (" Lunar Hamaxe"), new int[] - { - ItemID.LunarHamaxeSolar, - ItemID.LunarHamaxeVortex, - ItemID.LunarHamaxeNebula, - ItemID.LunarHamaxeStardust - }); - RecipeGroup.RegisterGroup("LunarHamaxe", group); - - group = new RecipeGroup(() => Lang.misc[37] + (" Wings"), new int[] - { - ItemID.DemonWings, - ItemID.AngelWings, - ItemID.RedsWings, - ItemID.ButterflyWings, - ItemID.FairyWings, - ItemID.HarpyWings, - ItemID.BoneWings, - ItemID.FlameWings, - ItemID.FrozenWings, - ItemID.GhostWings, - ItemID.SteampunkWings, - ItemID.LeafWings, - ItemID.BatWings, - ItemID.BeeWings, - ItemID.DTownsWings, - ItemID.WillsWings, - ItemID.CrownosWings, - ItemID.CenxsWings, - ItemID.TatteredFairyWings, - ItemID.SpookyWings, - ItemID.Hoverboard, - ItemID.FestiveWings, - ItemID.BeetleWings, - ItemID.FinWings, - ItemID.FishronWings, - ItemID.MothronWings, - ItemID.WingsSolar, - ItemID.WingsVortex, - ItemID.WingsNebula, - ItemID.WingsStardust, - ItemID.Yoraiz0rWings, - ItemID.JimsWings, - ItemID.SkiphsWings, - ItemID.LokisWings, - ItemID.BetsyWings, - ItemID.ArkhalisWings, - ItemID.LeinforsWings, - CalamityMod.Instance.ItemType("SkylineWings"), - CalamityMod.Instance.ItemType("StarlightWings"), - CalamityMod.Instance.ItemType("AureateWings"), - CalamityMod.Instance.ItemType("DiscordianWings"), - CalamityMod.Instance.ItemType("TarragonWings"), - CalamityMod.Instance.ItemType("XerocWings"), - CalamityMod.Instance.ItemType("HadarianWings") - }); - RecipeGroup.RegisterGroup("WingsGroup", group); - } - } +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod +{ + internal class CalamityRecipes + { + private static ModRecipe GetNewRecipe() + { + return new ModRecipe(CalamityMod.Instance); + } + + public static void AddRecipes() + { + EditTerraBladeRecipe(); + AddPotionRecipes(); + AddToolRecipes(); + AddProgressionRecipes(); + AddEarlyGameWeaponRecipes(); + AddEarlyGameAccessoryRecipes(); + AddAnkhShieldRecipes(); + AddAlternateHardmodeRecipes(); + + // Leather from Vertebrae, for Crimson worlds + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.Vertebrae, 5); + r.AddTile(TileID.WorkBenches); + r.SetResult(ItemID.Leather); + r.AddRecipe(); + + // Black Lens + r = GetNewRecipe(); + r.AddIngredient(ItemID.Lens); + r.AddIngredient(ItemID.BlackDye); + r.AddTile(TileID.DyeVat); + r.SetResult(ItemID.BlackLens); + r.AddRecipe(); + + // Fallen Star + r = GetNewRecipe(); + r.AddIngredient(null, "Stardust", 5); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.FallenStar); + r.AddRecipe(); + + // Ectoplasm from Ectoblood + r = GetNewRecipe(); + r.AddIngredient(null, "Ectoblood", 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Ectoplasm); + r.AddRecipe(); + + // Rocket I from Empty Bullet + r = GetNewRecipe(); + r.AddIngredient(ItemID.EmptyBullet, 20); + r.AddIngredient(ItemID.ExplosivePowder, 1); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.RocketI, 20); + r.AddRecipe(); + + // Life Crystal + r = GetNewRecipe(); + r.AddIngredient(ItemID.Bone, 5); + r.AddIngredient(ItemID.PinkGel); + r.AddIngredient(ItemID.HealingPotion); + r.AddIngredient(ItemID.Ruby); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.LifeCrystal); + r.AddRecipe(); + + // Life Fruit + r = GetNewRecipe(); + r.AddIngredient(null, "PlantyMush", 10); + r.AddIngredient(null, "LivingShard"); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.LifeFruit); + r.AddRecipe(); + } + + // Change Terra Blade's recipe to require 7 Living Shards (forces the Blade to be post-Plantera) + private static void EditTerraBladeRecipe() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.TerraBlade).ToList().ForEach(s => + { + for (int i = 0; i < s.requiredItem.Length; i++) + { + s.requiredItem[i] = new Item(); + } + s.requiredItem[0].SetDefaults(ItemID.TrueNightsEdge, false); + s.requiredItem[0].stack = 1; + s.requiredItem[1].SetDefaults(ItemID.TrueExcalibur, false); + s.requiredItem[1].stack = 1; + s.requiredItem[2].SetDefaults(CalamityMod.Instance.ItemType("LivingShard"), false); + s.requiredItem[2].stack = 7; + + s.createItem.SetDefaults(ItemID.TerraBlade, false); + s.createItem.stack = 1; + }); + } + + #region Potions + // Equivalent Blood Orb recipes for almost all vanilla potions + private static void AddPotionRecipes() + { + short[] potions = new[] + { + ItemID.WormholePotion, + ItemID.TeleportationPotion, + ItemID.SwiftnessPotion, + ItemID.FeatherfallPotion, + ItemID.GravitationPotion, + ItemID.ShinePotion, + ItemID.InvisibilityPotion, + ItemID.NightOwlPotion, + ItemID.SpelunkerPotion, + ItemID.HunterPotion, + ItemID.TrapsightPotion, + ItemID.BattlePotion, + ItemID.CalmingPotion, + ItemID.WrathPotion, + ItemID.RagePotion, + ItemID.ThornsPotion, + ItemID.IronskinPotion, + ItemID.EndurancePotion, + ItemID.RegenerationPotion, + ItemID.LifeforcePotion, + ItemID.HeartreachPotion, + ItemID.TitanPotion, + ItemID.ArcheryPotion, + ItemID.AmmoReservationPotion, + ItemID.MagicPowerPotion, + ItemID.ManaRegenerationPotion, + ItemID.SummoningPotion, + ItemID.InfernoPotion, + ItemID.WarmthPotion, + ItemID.ObsidianSkinPotion, + ItemID.GillsPotion, + ItemID.WaterWalkingPotion, + ItemID.FlipperPotion, + ItemID.BuilderPotion, + ItemID.MiningPotion, + ItemID.FishingPotion, + ItemID.CratePotion, + ItemID.SonarPotion, + ItemID.GenderChangePotion, + ItemID.LovePotion, + ItemID.StinkPotion + }; + ModRecipe r; + + foreach (var potion in potions) + { + r = GetNewRecipe(); + r.AddIngredient(null, "BloodOrb", 10); + r.AddIngredient(ItemID.BottledWater); + r.AddTile(TileID.AlchemyTable); + r.SetResult(potion); + r.AddRecipe(); + } + } + #endregion + + #region Tools + // Essential tools such as the Magic Mirror and Rod of Discord + private static void AddToolRecipes() + { + // Magic Mirror + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.IronBar, 10); + r.AddIngredient(ItemID.Glass, 10); + r.AddIngredient(ItemID.FallenStar, 10); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.MagicMirror); + r.AddRecipe(); + + // Ice Mirror + r = GetNewRecipe(); + r.AddIngredient(ItemID.IceBlock, 20); + r.AddIngredient(ItemID.Glass, 10); + r.AddIngredient(ItemID.FallenStar, 10); + r.AddIngredient(ItemID.IronBar, 5); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.IceMirror); + r.AddRecipe(); + + // Shadow Key + r = GetNewRecipe(); + r.AddIngredient(ItemID.GoldenKey); + r.AddIngredient(ItemID.Obsidian, 20); + r.AddIngredient(ItemID.Bone, 5); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.ShadowKey); + r.AddRecipe(); + + // Rod of Discord + r = GetNewRecipe(); + r.AddIngredient(ItemID.SoulofLight, 30); + r.AddIngredient(ItemID.ChaosFish, 5); + r.AddIngredient(ItemID.PixieDust, 50); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.RodofDiscord); + r.AddRecipe(); + + // Sky Mill + r = GetNewRecipe(); + r.AddIngredient(ItemID.SunplateBlock, 10); + r.AddIngredient(ItemID.Cloud, 5); + r.AddIngredient(ItemID.RainCloud, 3); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.SkyMill); + r.AddRecipe(); + + // Ice Machine + r = GetNewRecipe(); + r.AddIngredient(ItemID.IceBlock, 25); + r.AddIngredient(ItemID.SnowBlock, 15); + r.AddIngredient(ItemID.IronBar, 3); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.IceMachine); + r.AddRecipe(); + } + #endregion + + #region ProgressionItems + // Boss summon and progression items + private static void AddProgressionRecipes() + { + // Guide Voodoo Doll + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.Leather, 2); + r.AddIngredient(null, "FetidEssence", 2); + r.AddTile(TileID.Hellforge); + r.SetResult(ItemID.GuideVoodooDoll); + r.AddRecipe(); + + r = GetNewRecipe(); + r.AddIngredient(ItemID.Leather, 2); + r.AddIngredient(null, "BloodlettingEssence", 2); + r.AddTile(TileID.Hellforge); + r.SetResult(ItemID.GuideVoodooDoll); + r.AddRecipe(); + + // Temple Key + r = GetNewRecipe(); + r.AddIngredient(ItemID.JungleSpores, 15); + r.AddIngredient(ItemID.RichMahogany, 15); + r.AddIngredient(ItemID.SoulofNight, 15); + r.AddIngredient(ItemID.SoulofLight, 15); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.TempleKey); + r.AddRecipe(); + + // Lihzahrd Power Cell (NOT Calamity's Old Power Cell) + r = GetNewRecipe(); + r.AddIngredient(ItemID.LihzahrdBrick, 15); + r.AddIngredient(null, "CoreofCinder"); + r.AddTile(TileID.LihzahrdFurnace); + r.SetResult(ItemID.LihzahrdPowerCell); + r.AddRecipe(); + + // Truffle Worm + r = GetNewRecipe(); + r.AddIngredient(ItemID.GlowingMushroom, 15); + r.AddIngredient(ItemID.Worm); + r.AddTile(TileID.Autohammer); + r.SetResult(ItemID.TruffleWorm); + r.AddRecipe(); + } + #endregion + + #region EarlyGameWeapons + // Early game weapons such as Enchanted Sword + private static void AddEarlyGameWeaponRecipes() + { + // Shuriken + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.IronBar); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Shuriken, 50); + r.AddRecipe(); + + // Throwing Knife + r = GetNewRecipe(); + r.AddIngredient(ItemID.IronBar); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.ThrowingKnife, 50); + r.AddRecipe(); + + // Wand of Sparking + r = GetNewRecipe(); + r.AddIngredient(ItemID.Wood, 5); + r.AddIngredient(ItemID.Torch, 3); + r.AddIngredient(ItemID.FallenStar); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.WandofSparking); + r.AddRecipe(); + + // Starfury w/ Gold Broadsword + r = GetNewRecipe(); + r.AddIngredient(ItemID.GoldBroadsword); + r.AddIngredient(ItemID.FallenStar, 10); + r.AddIngredient(null, "VictoryShard", 3); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Starfury); + r.AddRecipe(); + + // Starfury w/ Platinum Broadsword + r = GetNewRecipe(); + r.AddIngredient(ItemID.PlatinumBroadsword); + r.AddIngredient(ItemID.FallenStar, 10); + r.AddIngredient(null, "VictoryShard", 3); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Starfury); + r.AddRecipe(); + + // Enchanted Sword (requires Hardmode materials) + r = GetNewRecipe(); + r.AddIngredient(null, "VictoryShard", 10); + r.AddIngredient(ItemID.SoulofLight, 15); + r.AddIngredient(ItemID.UnicornHorn, 3); + r.AddIngredient(ItemID.LightShard); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.EnchantedSword); + r.AddRecipe(); + + // Muramasa w/ Cobalt Bars + r = GetNewRecipe(); + r.AddIngredient(ItemID.CobaltBar, 15); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Muramasa); + r.AddRecipe(); + + // Muramasa w/ Palladium Bars + r = GetNewRecipe(); + r.AddIngredient(ItemID.PalladiumBar, 15); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Muramasa); + r.AddRecipe(); + } + #endregion + + #region EarlyGameAccessories + // Early game accessories such as Cloud in a Bottle + private static void AddEarlyGameAccessoryRecipes() + { + // Cloud in a Bottle + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.Feather, 2); + r.AddIngredient(ItemID.Bottle); + r.AddIngredient(ItemID.Cloud, 25); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.CloudinaBottle); + r.AddRecipe(); + + // Hermes Boots + r = GetNewRecipe(); + r.AddIngredient(ItemID.Silk, 10); + r.AddTile(TileID.Loom); + r.SetResult(ItemID.HermesBoots); + r.AddRecipe(); + + // Blizzard in a Bottle + r = GetNewRecipe(); + r.AddIngredient(ItemID.Feather, 4); + r.AddIngredient(ItemID.Bottle); + r.AddIngredient(ItemID.SnowBlock, 50); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.BlizzardinaBottle); + r.AddRecipe(); + + // Sandstorm in a Bottle + r = GetNewRecipe(); + r.AddIngredient(null, "DesertFeather", 10); + r.AddIngredient(ItemID.Feather, 6); + r.AddIngredient(ItemID.Bottle); + r.AddIngredient(ItemID.SandBlock, 70); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.SandstorminaBottle); + r.AddRecipe(); + + // Frog Leg + r = GetNewRecipe(); + r.AddIngredient(ItemID.Frog, 10); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.FrogLeg); + r.AddRecipe(); + + // Flying Carpet + r = GetNewRecipe(); + r.AddIngredient(ItemID.AncientCloth, 10); + r.AddIngredient(ItemID.SoulofLight, 10); + r.AddIngredient(ItemID.SoulofNight, 10); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.FlyingCarpet); + r.AddRecipe(); + + // Aglet + r = GetNewRecipe(); + r.AddIngredient(ItemID.IronBar, 5); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Aglet); + r.AddRecipe(); + + // Anklet of the Wind + r = GetNewRecipe(); + r.AddIngredient(ItemID.JungleSpores, 15); + r.AddIngredient(ItemID.Cloud, 15); + r.AddIngredient(ItemID.PinkGel, 5); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.AnkletoftheWind); + r.AddRecipe(); + + // Water Walking Boots + r = GetNewRecipe(); + r.AddIngredient(ItemID.Leather, 5); + r.AddIngredient(ItemID.WaterWalkingPotion, 8); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.WaterWalkingBoots); + r.AddRecipe(); + + // Ice Skates + r = GetNewRecipe(); + r.AddIngredient(ItemID.IceBlock, 20); + r.AddIngredient(ItemID.Leather, 5); + r.AddIngredient(ItemID.IronBar, 5); + r.anyIronBar = true; + r.AddTile(TileID.IceMachine); + r.SetResult(ItemID.IceSkates); + r.AddRecipe(); + + // Lucky Horseshoe w/ Gold Bars + r = GetNewRecipe(); + r.AddIngredient(ItemID.SunplateBlock, 10); + r.AddIngredient(ItemID.Cloud, 10); + r.AddIngredient(ItemID.GoldBar, 5); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.LuckyHorseshoe); + r.AddRecipe(); + + // Lucky Horseshoe w/ Platinum Bars + r = GetNewRecipe(); + r.AddIngredient(ItemID.SunplateBlock, 10); + r.AddIngredient(ItemID.Cloud, 10); + r.AddIngredient(ItemID.PlatinumBar, 5); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.LuckyHorseshoe); + r.AddRecipe(); + + // Shiny Red Balloon + r = GetNewRecipe(); + r.AddIngredient(ItemID.WhiteString); + r.AddIngredient(ItemID.Gel, 80); + r.AddIngredient(ItemID.Cloud, 40); + r.AddTile(TileID.Solidifier); + r.SetResult(ItemID.ShinyRedBalloon); + r.AddRecipe(); + + // Lava Charm + r = GetNewRecipe(); + r.AddIngredient(ItemID.LavaBucket, 5); + r.AddIngredient(ItemID.Obsidian, 25); + r.AddIngredient(ItemID.IronBar, 5); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.LavaCharm); + r.AddRecipe(); + + // Feral Claws + r = GetNewRecipe(); + r.AddIngredient(ItemID.Leather, 10); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.FeralClaws); + r.AddRecipe(); + + // Radar + r = GetNewRecipe(); + r.AddIngredient(ItemID.IronBar, 5); + r.anyIronBar = true; + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Radar); + r.AddRecipe(); + } + #endregion + + #region AnkhShield + // Every base component for the Ankh Shield + private static void AddAnkhShieldRecipes() + { + // Cobalt Shield w/ Cobalt + ModRecipe r = GetNewRecipe(); + r.AddIngredient(ItemID.CobaltBar, 10); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.CobaltShield); + r.AddRecipe(); + + // Cobalt Shield w/ Palladium + r = GetNewRecipe(); + r.AddIngredient(ItemID.PalladiumBar, 10); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.CobaltShield); + r.AddRecipe(); + + // Armor Polish (broken armor) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Bone, 50); + r.AddIngredient(null, "AncientBoneDust", 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.ArmorPolish); + r.AddRecipe(); + + // Adhesive Bandage (bleeding) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Silk, 10); + r.AddIngredient(ItemID.Gel, 50); + r.AddIngredient(ItemID.GreaterHealingPotion); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.AdhesiveBandage); + r.AddRecipe(); + + // Bezoar (poison) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Stinger, 15); + r.AddIngredient(null, "MurkyPaste"); + r.AddTile(TileID.Anvils); + r.SetResult(ItemID.Bezoar); + r.AddRecipe(); + + // Nazar (curse) + r = GetNewRecipe(); + r.AddIngredient(ItemID.SoulofNight, 20); + r.AddIngredient(ItemID.Lens, 5); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Nazar); + r.AddRecipe(); + + // Vitamins (weakness) + r = GetNewRecipe(); + r.AddIngredient(ItemID.BottledWater); + r.AddIngredient(ItemID.Waterleaf, 5); + r.AddIngredient(ItemID.Blinkroot, 5); + r.AddIngredient(ItemID.Daybloom, 5); + r.AddIngredient(null, "BeetleJuice", 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Vitamins); + r.AddRecipe(); + + // Blindfold (darkness) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Silk, 30); + r.AddIngredient(ItemID.SoulofNight, 5); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Blindfold); + r.AddRecipe(); + + // Trifold Map (confusion) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Silk, 20); + r.AddIngredient(ItemID.SoulofLight, 3); + r.AddIngredient(ItemID.SoulofNight, 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.TrifoldMap); + r.AddRecipe(); + + // Fast Clock (slow) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Timer1Second); + r.AddIngredient(ItemID.PixieDust, 15); + r.AddIngredient(ItemID.SoulofLight, 5); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.FastClock); + r.AddRecipe(); + + // Megaphone (silence) + r = GetNewRecipe(); + r.AddIngredient(ItemID.Wire, 10); + r.AddIngredient(ItemID.HallowedBar, 5); + r.AddIngredient(ItemID.Ruby, 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.Megaphone); + r.AddRecipe(); + } + #endregion + + #region HardmodeEquipment + // Alternate recipes for vanilla Hardmode equipment + private static void AddAlternateHardmodeRecipes() + { + // Avenger Emblem made with Rogue Emblem + ModRecipe r = GetNewRecipe(); + r.AddIngredient(null, "RogueEmblem"); + r.AddIngredient(ItemID.SoulofMight, 5); + r.AddIngredient(ItemID.SoulofSight, 5); + r.AddIngredient(ItemID.SoulofFright, 5); + r.AddTile(TileID.TinkerersWorkbench); + r.SetResult(ItemID.AvengerEmblem); + r.AddRecipe(); + + // Celestial Magnet + r = GetNewRecipe(); + r.AddIngredient(ItemID.FallenStar, 20); + r.AddIngredient(ItemID.SoulofMight, 10); + r.AddIngredient(ItemID.SoulofLight, 5); + r.AddIngredient(ItemID.SoulofNight, 5); + r.AddIngredient(null, "CryoBar", 3); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.CelestialMagnet); + r.AddRecipe(); + + // Frozen Turtle Shell + r = GetNewRecipe(); + r.AddIngredient(ItemID.TurtleShell, 3); + r.AddIngredient(null, "EssenceofEleum", 9); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.FrozenTurtleShell); + r.AddRecipe(); + + // Frost Helmet w/ Frigid Bars + r = GetNewRecipe(); + r.AddIngredient(null, "CryoBar", 6); + r.AddIngredient(ItemID.FrostCore); + r.AddTile(TileID.IceMachine); + r.SetResult(ItemID.FrostHelmet); + r.AddRecipe(); + + // Frost Breastplate w/ Frigid Bars + r = GetNewRecipe(); + r.AddIngredient(null, "CryoBar", 10); + r.AddIngredient(ItemID.FrostCore); + r.AddTile(TileID.IceMachine); + r.SetResult(ItemID.FrostBreastplate); + r.AddRecipe(); + + // Frost Leggings w/ Frigid Bars + r = GetNewRecipe(); + r.AddIngredient(null, "CryoBar", 8); + r.AddIngredient(ItemID.FrostCore); + r.AddTile(TileID.IceMachine); + r.SetResult(ItemID.FrostLeggings); + r.AddRecipe(); + + // Terra Blade w/ True Bloody Edge + r = GetNewRecipe(); + r.AddIngredient(null, "TrueBloodyEdge"); + r.AddIngredient(ItemID.TrueExcalibur); + r.AddIngredient(null, "LivingShard", 7); + r.AddTile(TileID.MythrilAnvil); + r.SetResult(ItemID.TerraBlade); + r.AddRecipe(); + } + #endregion + + public static void AddRecipeGroups() + { + RecipeGroup group = new RecipeGroup(() => Lang.misc[37] + (" Silt"), new int[] + { + ItemID.SiltBlock, + ItemID.SlushBlock + }); + RecipeGroup.RegisterGroup("SiltGroup", group); + + group = new RecipeGroup(() => Lang.misc[37] + (" Lunar Pickaxe"), new int[] + { + ItemID.SolarFlarePickaxe, + ItemID.VortexPickaxe, + ItemID.NebulaPickaxe, + ItemID.StardustPickaxe + }); + RecipeGroup.RegisterGroup("LunarPickaxe", group); + + group = new RecipeGroup(() => Lang.misc[37] + (" Lunar Hamaxe"), new int[] + { + ItemID.LunarHamaxeSolar, + ItemID.LunarHamaxeVortex, + ItemID.LunarHamaxeNebula, + ItemID.LunarHamaxeStardust + }); + RecipeGroup.RegisterGroup("LunarHamaxe", group); + + group = new RecipeGroup(() => Lang.misc[37] + (" Wings"), new int[] + { + ItemID.DemonWings, + ItemID.AngelWings, + ItemID.RedsWings, + ItemID.ButterflyWings, + ItemID.FairyWings, + ItemID.HarpyWings, + ItemID.BoneWings, + ItemID.FlameWings, + ItemID.FrozenWings, + ItemID.GhostWings, + ItemID.SteampunkWings, + ItemID.LeafWings, + ItemID.BatWings, + ItemID.BeeWings, + ItemID.DTownsWings, + ItemID.WillsWings, + ItemID.CrownosWings, + ItemID.CenxsWings, + ItemID.TatteredFairyWings, + ItemID.SpookyWings, + ItemID.Hoverboard, + ItemID.FestiveWings, + ItemID.BeetleWings, + ItemID.FinWings, + ItemID.FishronWings, + ItemID.MothronWings, + ItemID.WingsSolar, + ItemID.WingsVortex, + ItemID.WingsNebula, + ItemID.WingsStardust, + ItemID.Yoraiz0rWings, + ItemID.JimsWings, + ItemID.SkiphsWings, + ItemID.LokisWings, + ItemID.BetsyWings, + ItemID.ArkhalisWings, + ItemID.LeinforsWings, + CalamityMod.Instance.ItemType("SkylineWings"), + CalamityMod.Instance.ItemType("StarlightWings"), + CalamityMod.Instance.ItemType("AureateWings"), + CalamityMod.Instance.ItemType("DiscordianWings"), + CalamityMod.Instance.ItemType("TarragonWings"), + CalamityMod.Instance.ItemType("XerocWings"), + CalamityMod.Instance.ItemType("HadarianWings") + }); + RecipeGroup.RegisterGroup("WingsGroup", group); + } + } } diff --git a/CustomTileFraming.cs b/CustomTileFraming.cs index de1afc0f90..a6355669eb 100644 --- a/CustomTileFraming.cs +++ b/CustomTileFraming.cs @@ -12,950 +12,950 @@ using Terraria.ModLoader; using CalamityMod.Tiles; namespace CalamityMod -{ - public static class CustomTileFraming - { - private static int[][] PlantCheckAgainst; - private static Dictionary VineToGrass; - public static bool[] tileMergeAstralDirt; - - static CustomTileFraming() - { - Setup(); - } - - private static void Setup() - { - Mod mod = CalamityMod.Instance; - - int size = CalamityGlobalTile.PlantTypes.Length; - PlantCheckAgainst = new int[TileLoader.TileCount][]; - - PlantCheckAgainst[TileID.Plants] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; - PlantCheckAgainst[TileID.CorruptPlants] = new int[1] { TileID.CorruptGrass }; - PlantCheckAgainst[TileID.JunglePlants] = new int[1] { TileID.JungleGrass }; - PlantCheckAgainst[TileID.MushroomPlants] = new int[1] { TileID.MushroomGrass }; - PlantCheckAgainst[TileID.Plants2] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; - PlantCheckAgainst[TileID.JunglePlants2] = new int[1] { TileID.JungleGrass }; - PlantCheckAgainst[TileID.HallowedPlants] = new int[1] { TileID.HallowedGrass }; - PlantCheckAgainst[TileID.HallowedPlants2] = new int[1] { TileID.HallowedGrass }; - PlantCheckAgainst[TileID.FleshWeeds] = new int[1] { TileID.FleshWeeds }; - PlantCheckAgainst[CalamityMod.Instance.TileType("AstralShortPlants")] = new int[1] { mod.TileType("AstralGrass") }; - PlantCheckAgainst[CalamityMod.Instance.TileType("AstralTallPlants")] = new int[1] { mod.TileType("AstralGrass") }; - - VineToGrass = new Dictionary(); - VineToGrass[TileID.Vines] = TileID.Grass; - VineToGrass[TileID.CrimsonVines] = TileID.FleshGrass; - VineToGrass[TileID.HallowedVines] = TileID.HallowedGrass; - VineToGrass[(ushort)mod.TileType("AstralVines")] = (ushort)mod.TileType("AstralGrass"); - - tileMergeAstralDirt = new bool[TileLoader.TileCount]; - //TODO: REST OF THESE - tileMergeAstralDirt[mod.TileType("AstralOre")] = true; - tileMergeAstralDirt[mod.TileType("AstralStone")] = true; - tileMergeAstralDirt[mod.TileType("AstralSand")] = true; - } - - private static bool PlantNeedsUpdate(int plantType, int checkType) - { - if (PlantCheckAgainst[plantType] == null) return false; - int size = PlantCheckAgainst[plantType].Length; - for (int i = 0; i < size; i++) - { - if (PlantCheckAgainst[plantType][i] == checkType) - { - return false; - } - } - return true; - } - - public static void CheckPlants(int x, int y) - { - int checkType = -1; - int plantType = Main.tile[x, y].type; - - if (y + 1 >= Main.maxTilesY) - checkType = plantType; - - Tile tile = Main.tile[x, y]; - Tile below = Main.tile[x, y + 1]; - if (y + 1 < Main.maxTilesY && below != null && below.nactive() && !below.halfBrick() && below.slope() == 0) - checkType = below.type; - - if (checkType == -1) return; - - //Check if this plant needs an update - if (PlantNeedsUpdate(plantType, checkType)) - { - if ((plantType == TileID.Plants || plantType == TileID.Plants2) && checkType != TileID.Grass && tile.frameX >= 162) - { - Main.tile[x, y].frameX = 126; - } - if (plantType == TileID.JunglePlants2 && checkType != TileID.JungleGrass && tile.frameX >= 162) - { - Main.tile[x, y].frameX = 126; - } - - if (checkType == TileID.CorruptGrass) - { - plantType = TileID.CorruptPlants; - if (tile.frameX >= 162) - { - Main.tile[x, y].frameX = 126; - } - } - else if (checkType == TileID.Grass) - { - if (plantType == TileID.HallowedPlants2) - { - plantType = TileID.Plants2; - } - else - { - plantType = TileID.Plants; - } - } - else if (checkType == TileID.HallowedGrass) - { - if (plantType == TileID.Plants2) - { - plantType = TileID.HallowedPlants2; - } - else - { - plantType = TileID.HallowedPlants; - } - } - else if (checkType == TileID.FleshGrass) - { - plantType = TileID.FleshWeeds; - } - else if (checkType == TileID.MushroomGrass) - { - plantType = TileID.MushroomPlants; - while (Main.tile[x, y].frameX > 72) - { - Main.tile[x, y].frameX -= 72; - } - } - else if (checkType == CalamityMod.Instance.TileType("AstralGrass")) //ASTRAL - { - if (plantType == TileID.Plants || plantType == TileID.CorruptPlants || - plantType == TileID.FleshWeeds || plantType == TileID.HallowedPlants || - plantType == TileID.MushroomPlants || plantType == TileID.JunglePlants) - { - plantType = CalamityMod.Instance.TileType("AstralShortPlants"); - } - else - { - plantType = CalamityMod.Instance.TileType("AstralTallPlants"); - } - } - if (plantType != Main.tile[x, y].type) - { - Main.tile[x, y].type = (ushort)plantType; - return; - } - WorldGen.KillTile(x, y, false, false, false); - } - } - - public static void VineFrame(int x, int y) - { - Tile tile = Main.tile[x, y]; - int myType = tile.type; - Tile tile2 = Main.tile[x, y - 1]; - Tile tile3 = Main.tile[x, y + 1]; - Tile tile4 = Main.tile[x - 1, y]; - Tile tile5 = Main.tile[x + 1, y]; - Tile tile6 = Main.tile[x - 1, y + 1]; - Tile tile7 = Main.tile[x + 1, y + 1]; - Tile tile8 = Main.tile[x - 1, y - 1]; - Tile tile9 = Main.tile[x + 1, y - 1]; - int num52 = -1; - int num53 = -1; - int num54 = -1; - int num55 = -1; - int num56 = -1; - int num57 = -1; - int num58 = -1; - int num59 = -1; - if (tile4 != null && tile4.active()) - { - if (Main.tileStone[(int)tile4.type]) - { - num55 = 1; - } - else - { - num55 = (int)tile4.type; - } - if (tile4.slope() == 1 || tile4.slope() == 3) - { - num55 = -1; - } - } - if (tile5 != null && tile5.active()) - { - if (Main.tileStone[(int)tile5.type]) - { - num56 = 1; - } - else - { - num56 = (int)tile5.type; - } - if (tile5.slope() == 2 || tile5.slope() == 4) - { - num56 = -1; - } - } - if (tile2 != null && tile2.active()) - { - if (Main.tileStone[(int)tile2.type]) - { - num53 = 1; - } - else - { - num53 = (int)tile2.type; - } - if (tile2.slope() == 3 || tile2.slope() == 4) - { - num53 = -1; - } - } - if (tile3 != null && tile3.active()) - { - if (Main.tileStone[(int)tile3.type]) - { - num58 = 1; - } - else - { - num58 = (int)tile3.type; - } - if (tile3.slope() == 1 || tile3.slope() == 2) - { - num58 = -1; - } - } - if (tile8 != null && tile8.active()) - { - if (Main.tileStone[(int)tile8.type]) - { - num52 = 1; - } - else - { - num52 = (int)tile8.type; - } - } - if (tile9 != null && tile9.active()) - { - if (Main.tileStone[(int)tile9.type]) - { - num54 = 1; - } - else - { - num54 = (int)tile9.type; - } - } - if (tile6 != null && tile6.active()) - { - if (Main.tileStone[(int)tile6.type]) - { - num57 = 1; - } - else - { - num57 = (int)tile6.type; - } - } - if (tile7 != null && tile7.active()) - { - if (Main.tileStone[(int)tile7.type]) - { - num59 = 1; - } - else - { - num59 = (int)tile7.type; - } - } - if (tile.slope() == 2) - { - num53 = -1; - num55 = -1; - } - if (tile.slope() == 1) - { - num53 = -1; - num56 = -1; - } - if (tile.slope() == 4) - { - num58 = -1; - num55 = -1; - } - if (tile.slope() == 3) - { - num58 = -1; - num56 = -1; - } - - if (tile2 != null) - { - if (!tile2.active()) - { - num53 = -1; - } - else if (tile2.bottomSlope()) - { - num53 = -1; - } - else - { - num53 = (int)tile2.type; - } - } - else - { - num53 = myType; - } - - ushort[] vines = VineToGrass.Keys.ToArray(); - - for (int i = 0; i < vines.Length; i++) - { - ushort myGrassType = VineToGrass[(ushort)vines[i]]; - if (myType != vines[i] && (num53 == myGrassType || num53 == vines[i])) - { - Main.tile[x, y].type = vines[i]; - WorldGen.SquareTileFrame(x, y, true); - return; - } - } - - if (num53 != myType) - { - bool flag17 = false; - if (num53 == -1) - { - flag17 = true; - } - else - { - for (int i = 0; i < vines.Length; i++) - { - if (myType != TileID.Vines) - { - if (myType == vines[i] && num53 != VineToGrass[vines[i]]) - { - flag17 = true; - } - } - else if (num53 != TileID.Grass && num53 != TileID.LeafBlock) - { - flag17 = true; - } - } - } - if (flag17) - { - WorldGen.KillTile(x, y, false, false, false); - } - } - return; - } - - enum Similarity - { - Same, - MergeLink, - None - } - - public static void FrameTileForCustomMerge(int x, int y, int myType, int mergeType, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) - { - bool tmp; - FrameTileForCustomMerge(x, y, myType, mergeType, out tmp, out tmp, out tmp, out tmp, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, resetFrame); - } - - public static void FrameTileForCustomMerge(int x, int y, int myType, int mergeType, out bool mergedUp, out bool mergedLeft, out bool mergedRight, out bool mergedDown, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) - { - Tile tileLeft = Main.tile[x - 1, y]; - Tile tileRight = Main.tile[x + 1, y]; - Tile tileUp = Main.tile[x, y - 1]; - Tile tileDown = Main.tile[x, y + 1]; - Tile tileTopLeft = Main.tile[x - 1, y - 1]; - Tile tileTopRight = Main.tile[x + 1, y - 1]; - Tile tileBottomLeft = Main.tile[x - 1, y + 1]; - Tile tileBottomRight = Main.tile[x + 1, y + 1]; - - //CARDINAL - Similarity leftSim = GetSimilarity(tileLeft, myType, mergeType); - if (forceSameLeft) leftSim = Similarity.Same; - Similarity rightSim = GetSimilarity(tileRight, myType, mergeType); - if (forceSameRight) rightSim = Similarity.Same; - Similarity upSim = GetSimilarity(tileUp, myType, mergeType); - if (forceSameUp) upSim = Similarity.Same; - Similarity downSim = GetSimilarity(tileDown, myType, mergeType); - if (forceSameDown) downSim = Similarity.Same; - - //DIAGONAL - Similarity topLeftSim = GetSimilarity(tileTopLeft, myType, mergeType); - Similarity topRightSim = GetSimilarity(tileTopRight, myType, mergeType); - Similarity bottomLeftSim = GetSimilarity(tileBottomLeft, myType, mergeType); - Similarity bottomRightSim = GetSimilarity(tileBottomRight, myType, mergeType); - - int randomFrame; - if (resetFrame) - { - randomFrame = WorldGen.genRand.Next(3); - Main.tile[x, y].frameNumber((byte)randomFrame); - } - else - { - randomFrame = Main.tile[x, y].frameNumber(); - } - +{ + public static class CustomTileFraming + { + private static int[][] PlantCheckAgainst; + private static Dictionary VineToGrass; + public static bool[] tileMergeAstralDirt; + + static CustomTileFraming() + { + Setup(); + } + + private static void Setup() + { + Mod mod = CalamityMod.Instance; + + int size = CalamityGlobalTile.PlantTypes.Length; + PlantCheckAgainst = new int[TileLoader.TileCount][]; + + PlantCheckAgainst[TileID.Plants] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; + PlantCheckAgainst[TileID.CorruptPlants] = new int[1] { TileID.CorruptGrass }; + PlantCheckAgainst[TileID.JunglePlants] = new int[1] { TileID.JungleGrass }; + PlantCheckAgainst[TileID.MushroomPlants] = new int[1] { TileID.MushroomGrass }; + PlantCheckAgainst[TileID.Plants2] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot }; + PlantCheckAgainst[TileID.JunglePlants2] = new int[1] { TileID.JungleGrass }; + PlantCheckAgainst[TileID.HallowedPlants] = new int[1] { TileID.HallowedGrass }; + PlantCheckAgainst[TileID.HallowedPlants2] = new int[1] { TileID.HallowedGrass }; + PlantCheckAgainst[TileID.FleshWeeds] = new int[1] { TileID.FleshWeeds }; + PlantCheckAgainst[CalamityMod.Instance.TileType("AstralShortPlants")] = new int[1] { mod.TileType("AstralGrass") }; + PlantCheckAgainst[CalamityMod.Instance.TileType("AstralTallPlants")] = new int[1] { mod.TileType("AstralGrass") }; + + VineToGrass = new Dictionary(); + VineToGrass[TileID.Vines] = TileID.Grass; + VineToGrass[TileID.CrimsonVines] = TileID.FleshGrass; + VineToGrass[TileID.HallowedVines] = TileID.HallowedGrass; + VineToGrass[(ushort)mod.TileType("AstralVines")] = (ushort)mod.TileType("AstralGrass"); + + tileMergeAstralDirt = new bool[TileLoader.TileCount]; + //TODO: REST OF THESE + tileMergeAstralDirt[mod.TileType("AstralOre")] = true; + tileMergeAstralDirt[mod.TileType("AstralStone")] = true; + tileMergeAstralDirt[mod.TileType("AstralSand")] = true; + } + + private static bool PlantNeedsUpdate(int plantType, int checkType) + { + if (PlantCheckAgainst[plantType] == null) return false; + int size = PlantCheckAgainst[plantType].Length; + for (int i = 0; i < size; i++) + { + if (PlantCheckAgainst[plantType][i] == checkType) + { + return false; + } + } + return true; + } + + public static void CheckPlants(int x, int y) + { + int checkType = -1; + int plantType = Main.tile[x, y].type; + + if (y + 1 >= Main.maxTilesY) + checkType = plantType; + + Tile tile = Main.tile[x, y]; + Tile below = Main.tile[x, y + 1]; + if (y + 1 < Main.maxTilesY && below != null && below.nactive() && !below.halfBrick() && below.slope() == 0) + checkType = below.type; + + if (checkType == -1) return; + + //Check if this plant needs an update + if (PlantNeedsUpdate(plantType, checkType)) + { + if ((plantType == TileID.Plants || plantType == TileID.Plants2) && checkType != TileID.Grass && tile.frameX >= 162) + { + Main.tile[x, y].frameX = 126; + } + if (plantType == TileID.JunglePlants2 && checkType != TileID.JungleGrass && tile.frameX >= 162) + { + Main.tile[x, y].frameX = 126; + } + + if (checkType == TileID.CorruptGrass) + { + plantType = TileID.CorruptPlants; + if (tile.frameX >= 162) + { + Main.tile[x, y].frameX = 126; + } + } + else if (checkType == TileID.Grass) + { + if (plantType == TileID.HallowedPlants2) + { + plantType = TileID.Plants2; + } + else + { + plantType = TileID.Plants; + } + } + else if (checkType == TileID.HallowedGrass) + { + if (plantType == TileID.Plants2) + { + plantType = TileID.HallowedPlants2; + } + else + { + plantType = TileID.HallowedPlants; + } + } + else if (checkType == TileID.FleshGrass) + { + plantType = TileID.FleshWeeds; + } + else if (checkType == TileID.MushroomGrass) + { + plantType = TileID.MushroomPlants; + while (Main.tile[x, y].frameX > 72) + { + Main.tile[x, y].frameX -= 72; + } + } + else if (checkType == CalamityMod.Instance.TileType("AstralGrass")) //ASTRAL + { + if (plantType == TileID.Plants || plantType == TileID.CorruptPlants || + plantType == TileID.FleshWeeds || plantType == TileID.HallowedPlants || + plantType == TileID.MushroomPlants || plantType == TileID.JunglePlants) + { + plantType = CalamityMod.Instance.TileType("AstralShortPlants"); + } + else + { + plantType = CalamityMod.Instance.TileType("AstralTallPlants"); + } + } + if (plantType != Main.tile[x, y].type) + { + Main.tile[x, y].type = (ushort)plantType; + return; + } + WorldGen.KillTile(x, y, false, false, false); + } + } + + public static void VineFrame(int x, int y) + { + Tile tile = Main.tile[x, y]; + int myType = tile.type; + Tile tile2 = Main.tile[x, y - 1]; + Tile tile3 = Main.tile[x, y + 1]; + Tile tile4 = Main.tile[x - 1, y]; + Tile tile5 = Main.tile[x + 1, y]; + Tile tile6 = Main.tile[x - 1, y + 1]; + Tile tile7 = Main.tile[x + 1, y + 1]; + Tile tile8 = Main.tile[x - 1, y - 1]; + Tile tile9 = Main.tile[x + 1, y - 1]; + int num52 = -1; + int num53 = -1; + int num54 = -1; + int num55 = -1; + int num56 = -1; + int num57 = -1; + int num58 = -1; + int num59 = -1; + if (tile4 != null && tile4.active()) + { + if (Main.tileStone[(int)tile4.type]) + { + num55 = 1; + } + else + { + num55 = (int)tile4.type; + } + if (tile4.slope() == 1 || tile4.slope() == 3) + { + num55 = -1; + } + } + if (tile5 != null && tile5.active()) + { + if (Main.tileStone[(int)tile5.type]) + { + num56 = 1; + } + else + { + num56 = (int)tile5.type; + } + if (tile5.slope() == 2 || tile5.slope() == 4) + { + num56 = -1; + } + } + if (tile2 != null && tile2.active()) + { + if (Main.tileStone[(int)tile2.type]) + { + num53 = 1; + } + else + { + num53 = (int)tile2.type; + } + if (tile2.slope() == 3 || tile2.slope() == 4) + { + num53 = -1; + } + } + if (tile3 != null && tile3.active()) + { + if (Main.tileStone[(int)tile3.type]) + { + num58 = 1; + } + else + { + num58 = (int)tile3.type; + } + if (tile3.slope() == 1 || tile3.slope() == 2) + { + num58 = -1; + } + } + if (tile8 != null && tile8.active()) + { + if (Main.tileStone[(int)tile8.type]) + { + num52 = 1; + } + else + { + num52 = (int)tile8.type; + } + } + if (tile9 != null && tile9.active()) + { + if (Main.tileStone[(int)tile9.type]) + { + num54 = 1; + } + else + { + num54 = (int)tile9.type; + } + } + if (tile6 != null && tile6.active()) + { + if (Main.tileStone[(int)tile6.type]) + { + num57 = 1; + } + else + { + num57 = (int)tile6.type; + } + } + if (tile7 != null && tile7.active()) + { + if (Main.tileStone[(int)tile7.type]) + { + num59 = 1; + } + else + { + num59 = (int)tile7.type; + } + } + if (tile.slope() == 2) + { + num53 = -1; + num55 = -1; + } + if (tile.slope() == 1) + { + num53 = -1; + num56 = -1; + } + if (tile.slope() == 4) + { + num58 = -1; + num55 = -1; + } + if (tile.slope() == 3) + { + num58 = -1; + num56 = -1; + } + + if (tile2 != null) + { + if (!tile2.active()) + { + num53 = -1; + } + else if (tile2.bottomSlope()) + { + num53 = -1; + } + else + { + num53 = (int)tile2.type; + } + } + else + { + num53 = myType; + } + + ushort[] vines = VineToGrass.Keys.ToArray(); + + for (int i = 0; i < vines.Length; i++) + { + ushort myGrassType = VineToGrass[(ushort)vines[i]]; + if (myType != vines[i] && (num53 == myGrassType || num53 == vines[i])) + { + Main.tile[x, y].type = vines[i]; + WorldGen.SquareTileFrame(x, y, true); + return; + } + } + + if (num53 != myType) + { + bool flag17 = false; + if (num53 == -1) + { + flag17 = true; + } + else + { + for (int i = 0; i < vines.Length; i++) + { + if (myType != TileID.Vines) + { + if (myType == vines[i] && num53 != VineToGrass[vines[i]]) + { + flag17 = true; + } + } + else if (num53 != TileID.Grass && num53 != TileID.LeafBlock) + { + flag17 = true; + } + } + } + if (flag17) + { + WorldGen.KillTile(x, y, false, false, false); + } + } + return; + } + + enum Similarity + { + Same, + MergeLink, + None + } + + public static void FrameTileForCustomMerge(int x, int y, int myType, int mergeType, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) + { + bool tmp; + FrameTileForCustomMerge(x, y, myType, mergeType, out tmp, out tmp, out tmp, out tmp, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, resetFrame); + } + + public static void FrameTileForCustomMerge(int x, int y, int myType, int mergeType, out bool mergedUp, out bool mergedLeft, out bool mergedRight, out bool mergedDown, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) + { + Tile tileLeft = Main.tile[x - 1, y]; + Tile tileRight = Main.tile[x + 1, y]; + Tile tileUp = Main.tile[x, y - 1]; + Tile tileDown = Main.tile[x, y + 1]; + Tile tileTopLeft = Main.tile[x - 1, y - 1]; + Tile tileTopRight = Main.tile[x + 1, y - 1]; + Tile tileBottomLeft = Main.tile[x - 1, y + 1]; + Tile tileBottomRight = Main.tile[x + 1, y + 1]; + + //CARDINAL + Similarity leftSim = GetSimilarity(tileLeft, myType, mergeType); + if (forceSameLeft) leftSim = Similarity.Same; + Similarity rightSim = GetSimilarity(tileRight, myType, mergeType); + if (forceSameRight) rightSim = Similarity.Same; + Similarity upSim = GetSimilarity(tileUp, myType, mergeType); + if (forceSameUp) upSim = Similarity.Same; + Similarity downSim = GetSimilarity(tileDown, myType, mergeType); + if (forceSameDown) downSim = Similarity.Same; + + //DIAGONAL + Similarity topLeftSim = GetSimilarity(tileTopLeft, myType, mergeType); + Similarity topRightSim = GetSimilarity(tileTopRight, myType, mergeType); + Similarity bottomLeftSim = GetSimilarity(tileBottomLeft, myType, mergeType); + Similarity bottomRightSim = GetSimilarity(tileBottomRight, myType, mergeType); + + int randomFrame; + if (resetFrame) + { + randomFrame = WorldGen.genRand.Next(3); + Main.tile[x, y].frameNumber((byte)randomFrame); + } + else + { + randomFrame = Main.tile[x, y].frameNumber(); + } + /* DEBUGGING if (Player.tileTargetX == x && Player.tileTargetY == y) { Main.NewText(StringWriter(leftSim, rightSim, upSim, downSim, topLeftSim, topRightSim, bottomLeftSim, bottomRightSim, forceSameDown, forceSameUp, forceSameLeft, forceSameRight)); - }*/ - - mergedDown = mergedLeft = mergedRight = mergedUp = false; - - if (leftSim == Similarity.None) - { - if (upSim == Similarity.Same) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 0, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 234 + 18 * randomFrame, 36); - return; - } - SetFrameAt(x, y, 90, 18 * randomFrame); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedDown = true; - SetFrameAt(x, y, 72, 90 + 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 108 + 18 * randomFrame, 54); - return; - } - mergedDown = true; - SetFrameAt(x, y, 126, 90 + 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 36 * randomFrame, 72); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 54); - return; - } - else if (upSim == Similarity.MergeLink) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - mergedUp = true; - SetFrameAt(x, y, 72, 144 + 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - mergedUp = true; - SetFrameAt(x, y, 126, 144 + 18 * randomFrame); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - mergedUp = true; - mergedDown = true; - SetFrameAt(x, y, 108, 216 + 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - mergedUp = true; - SetFrameAt(x, y, 108, 144 + 18 * randomFrame); - return; - } - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 36 * randomFrame, 54); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - mergedDown = true; - SetFrameAt(x, y, 108, 90 + 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 54 + 18 * randomFrame, 234); - return; - } - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - else if (leftSim == Similarity.MergeLink) - { - if (upSim == Similarity.Same) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - mergedLeft = true; - SetFrameAt(x, y, 162, 126 + 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedLeft = true; - mergedRight = true; - SetFrameAt(x, y, 180, 126 + 18 * randomFrame); - return; - } - mergedLeft = true; - SetFrameAt(x, y, 234 + 18 * randomFrame, 54); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedLeft = mergedDown = true; - SetFrameAt(x, y, 36, 108 + 36 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedLeft = mergedRight = mergedDown = true; - SetFrameAt(x, y, 198, 144 + 18 * randomFrame); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 54); - return; - } - if (rightSim == Similarity.Same) - { - mergedLeft = true; - SetFrameAt(x, y, 18 * randomFrame, 216); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 54); - return; - } - else if (upSim == Similarity.MergeLink) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - mergedUp = mergedLeft = true; - SetFrameAt(x, y, 36, 90 + 36 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedLeft = mergedRight = mergedUp = true; - SetFrameAt(x, y, 198, 90 + 18 * randomFrame); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedUp = mergedLeft = mergedDown = true; - SetFrameAt(x, y, 216, 90 + 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedDown = mergedLeft = mergedRight = mergedUp = true; - SetFrameAt(x, y, 108 + 18 * randomFrame, 198); - return; - } - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - mergedLeft = true; - SetFrameAt(x, y, 18 * randomFrame, 198); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 0); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 162, 18 * randomFrame); - return; - } - else if (rightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - SetFrameAt(x, y, 162 + 18 * randomFrame, 54); - return; - } - if (rightSim == Similarity.Same) - { - mergedLeft = true; - SetFrameAt(x, y, 18 * randomFrame, 252); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = mergedLeft = true; - SetFrameAt(x, y, 162 + 18 * randomFrame, 198); - return; - } - mergedLeft = true; - SetFrameAt(x, y, 18 * randomFrame, 234); - return; - } - if (upSim == Similarity.Same) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { + }*/ + + mergedDown = mergedLeft = mergedRight = mergedUp = false; + + if (leftSim == Similarity.None) + { + if (upSim == Similarity.Same) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 0, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 234 + 18 * randomFrame, 36); + return; + } + SetFrameAt(x, y, 90, 18 * randomFrame); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedDown = true; + SetFrameAt(x, y, 72, 90 + 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 108 + 18 * randomFrame, 54); + return; + } + mergedDown = true; + SetFrameAt(x, y, 126, 90 + 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 36 * randomFrame, 72); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 54); + return; + } + else if (upSim == Similarity.MergeLink) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + mergedUp = true; + SetFrameAt(x, y, 72, 144 + 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + mergedUp = true; + SetFrameAt(x, y, 126, 144 + 18 * randomFrame); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + mergedUp = true; + mergedDown = true; + SetFrameAt(x, y, 108, 216 + 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + mergedUp = true; + SetFrameAt(x, y, 108, 144 + 18 * randomFrame); + return; + } + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 36 * randomFrame, 54); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + mergedDown = true; + SetFrameAt(x, y, 108, 90 + 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 54 + 18 * randomFrame, 234); + return; + } + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + else if (leftSim == Similarity.MergeLink) + { + if (upSim == Similarity.Same) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + mergedLeft = true; + SetFrameAt(x, y, 162, 126 + 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedLeft = true; + mergedRight = true; + SetFrameAt(x, y, 180, 126 + 18 * randomFrame); + return; + } + mergedLeft = true; + SetFrameAt(x, y, 234 + 18 * randomFrame, 54); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedLeft = mergedDown = true; + SetFrameAt(x, y, 36, 108 + 36 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedLeft = mergedRight = mergedDown = true; + SetFrameAt(x, y, 198, 144 + 18 * randomFrame); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 54); + return; + } + if (rightSim == Similarity.Same) + { + mergedLeft = true; + SetFrameAt(x, y, 18 * randomFrame, 216); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 54); + return; + } + else if (upSim == Similarity.MergeLink) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + mergedUp = mergedLeft = true; + SetFrameAt(x, y, 36, 90 + 36 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedLeft = mergedRight = mergedUp = true; + SetFrameAt(x, y, 198, 90 + 18 * randomFrame); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedUp = mergedLeft = mergedDown = true; + SetFrameAt(x, y, 216, 90 + 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedDown = mergedLeft = mergedRight = mergedUp = true; + SetFrameAt(x, y, 108 + 18 * randomFrame, 198); + return; + } + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + mergedLeft = true; + SetFrameAt(x, y, 18 * randomFrame, 198); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 0); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 162, 18 * randomFrame); + return; + } + else if (rightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + SetFrameAt(x, y, 162 + 18 * randomFrame, 54); + return; + } + if (rightSim == Similarity.Same) + { + mergedLeft = true; + SetFrameAt(x, y, 18 * randomFrame, 252); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = mergedLeft = true; + SetFrameAt(x, y, 162 + 18 * randomFrame, 198); + return; + } + mergedLeft = true; + SetFrameAt(x, y, 18 * randomFrame, 234); + return; + } + if (upSim == Similarity.Same) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { #region FULL TILE STUFF - if (topLeftSim == Similarity.MergeLink || topRightSim == Similarity.MergeLink || bottomLeftSim == Similarity.MergeLink || bottomRightSim == Similarity.MergeLink) - { - if (bottomRightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 0, 90 + 36 * randomFrame); - return; - } - else if (bottomLeftSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 18, 90 + 36 * randomFrame); - return; - } - else if (topRightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 0, 108 + 36 * randomFrame); - return; - } - SetFrameAt(x, y, 18, 108 + 36 * randomFrame); - return; - } - if (topLeftSim == Similarity.Same) - { - if (topRightSim == Similarity.Same) - { - if (bottomLeftSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - if (bottomRightSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - SetFrameAt(x, y, 108 + 18 * randomFrame, 36); - return; - } - if (bottomLeftSim == Similarity.Same) - { - if (bottomRightSim == Similarity.Same) - { - if (topRightSim == Similarity.MergeLink) - { - SetFrameAt(x, y, 0, 108 + 36 * randomFrame); - return; - } - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - SetFrameAt(x, y, 198, 18 * randomFrame); - return; - } - } - else if (topLeftSim == Similarity.None) - { - if (topRightSim == Similarity.Same) - { - if (bottomRightSim == Similarity.Same) - { - if (bottomLeftSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - if (bottomLeftSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - } - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; - } - SetFrameAt(x, y, 18 + 18 * randomFrame, 18); - return; + if (topLeftSim == Similarity.MergeLink || topRightSim == Similarity.MergeLink || bottomLeftSim == Similarity.MergeLink || bottomRightSim == Similarity.MergeLink) + { + if (bottomRightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 0, 90 + 36 * randomFrame); + return; + } + else if (bottomLeftSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 18, 90 + 36 * randomFrame); + return; + } + else if (topRightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 0, 108 + 36 * randomFrame); + return; + } + SetFrameAt(x, y, 18, 108 + 36 * randomFrame); + return; + } + if (topLeftSim == Similarity.Same) + { + if (topRightSim == Similarity.Same) + { + if (bottomLeftSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + if (bottomRightSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + SetFrameAt(x, y, 108 + 18 * randomFrame, 36); + return; + } + if (bottomLeftSim == Similarity.Same) + { + if (bottomRightSim == Similarity.Same) + { + if (topRightSim == Similarity.MergeLink) + { + SetFrameAt(x, y, 0, 108 + 36 * randomFrame); + return; + } + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + SetFrameAt(x, y, 198, 18 * randomFrame); + return; + } + } + else if (topLeftSim == Similarity.None) + { + if (topRightSim == Similarity.Same) + { + if (bottomRightSim == Similarity.Same) + { + if (bottomLeftSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + if (bottomLeftSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + } + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; + } + SetFrameAt(x, y, 18 + 18 * randomFrame, 18); + return; #endregion - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 144, 126 + 18 * randomFrame); - return; - } - SetFrameAt(x, y, 72, 18 * randomFrame); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedDown = true; - SetFrameAt(x, y, 144 + 18 * randomFrame, 90); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedDown = mergedRight = true; - SetFrameAt(x, y, 54, 108 + 36 * randomFrame); - return; - } - mergedDown = true; - SetFrameAt(x, y, 90, 90 + 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 36); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 54 + 18 * randomFrame, 216); - return; - } - SetFrameAt(x, y, 18 + 36 * randomFrame, 72); - return; - } - else if (upSim == Similarity.MergeLink) - { - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - mergedUp = true; - SetFrameAt(x, y, 144 + 18 * randomFrame, 108); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = mergedUp = true; - SetFrameAt(x, y, 54, 90 + 36 * randomFrame); - return; - } - mergedUp = true; - SetFrameAt(x, y, 90, 144 + 18 * randomFrame); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedUp = mergedDown = true; - SetFrameAt(x, y, 144 + 18 * randomFrame, 180); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedUp = mergedRight = mergedDown = true; - SetFrameAt(x, y, 216, 144 + 18 * randomFrame); - return; - } - SetFrameAt(x, y, 216, 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - mergedUp = true; - SetFrameAt(x, y, 234 + 18 * randomFrame, 18); - return; - } - SetFrameAt(x, y, 216, 18 * randomFrame); - return; - } - if (downSim == Similarity.Same) - { - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 18 + 18 * randomFrame, 0); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 54 + 18 * randomFrame, 198); - return; - } - SetFrameAt(x, y, 18 + 36 * randomFrame, 54); - return; - } - else if (downSim == Similarity.MergeLink) - { - if (rightSim == Similarity.Same) - { - mergedDown = true; - SetFrameAt(x, y, 234 + 18 * randomFrame, 0); - return; - } - SetFrameAt(x, y, 216, 18 * randomFrame); - return; - } - if (rightSim == Similarity.Same) - { - SetFrameAt(x, y, 108 + 18 * randomFrame, 72); - return; - } - else if (rightSim == Similarity.MergeLink) - { - mergedRight = true; - SetFrameAt(x, y, 54 + 18 * randomFrame, 252); - return; - } - SetFrameAt(x, y, 216, 18 * randomFrame); - return; - } - - private static void SetFrameAt(int x, int y, int frameX, int frameY) - { - Main.tile[x, y].frameX = (short)frameX; - Main.tile[x, y].frameY = (short)frameY; - } - - private static Similarity GetSimilarity(Tile check, int myType, int mergeType) - { - if (!check.active()) return Similarity.None; - - if (check.type == myType || Main.tileMerge[myType][check.type]) - return Similarity.Same; - else if (check.type == mergeType) - return Similarity.MergeLink; - - return Similarity.None; - } - - private static string StringWriter(params object[] strings) - { - string s = ""; - for (int i = 0; i < strings.Length; i++) - { - s += strings[i].ToString(); - if (i != strings.Length - 1) - { - s += ", "; - } - } - return s; - } + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 144, 126 + 18 * randomFrame); + return; + } + SetFrameAt(x, y, 72, 18 * randomFrame); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedDown = true; + SetFrameAt(x, y, 144 + 18 * randomFrame, 90); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedDown = mergedRight = true; + SetFrameAt(x, y, 54, 108 + 36 * randomFrame); + return; + } + mergedDown = true; + SetFrameAt(x, y, 90, 90 + 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 36); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 54 + 18 * randomFrame, 216); + return; + } + SetFrameAt(x, y, 18 + 36 * randomFrame, 72); + return; + } + else if (upSim == Similarity.MergeLink) + { + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + mergedUp = true; + SetFrameAt(x, y, 144 + 18 * randomFrame, 108); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = mergedUp = true; + SetFrameAt(x, y, 54, 90 + 36 * randomFrame); + return; + } + mergedUp = true; + SetFrameAt(x, y, 90, 144 + 18 * randomFrame); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedUp = mergedDown = true; + SetFrameAt(x, y, 144 + 18 * randomFrame, 180); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedUp = mergedRight = mergedDown = true; + SetFrameAt(x, y, 216, 144 + 18 * randomFrame); + return; + } + SetFrameAt(x, y, 216, 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + mergedUp = true; + SetFrameAt(x, y, 234 + 18 * randomFrame, 18); + return; + } + SetFrameAt(x, y, 216, 18 * randomFrame); + return; + } + if (downSim == Similarity.Same) + { + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 18 + 18 * randomFrame, 0); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 54 + 18 * randomFrame, 198); + return; + } + SetFrameAt(x, y, 18 + 36 * randomFrame, 54); + return; + } + else if (downSim == Similarity.MergeLink) + { + if (rightSim == Similarity.Same) + { + mergedDown = true; + SetFrameAt(x, y, 234 + 18 * randomFrame, 0); + return; + } + SetFrameAt(x, y, 216, 18 * randomFrame); + return; + } + if (rightSim == Similarity.Same) + { + SetFrameAt(x, y, 108 + 18 * randomFrame, 72); + return; + } + else if (rightSim == Similarity.MergeLink) + { + mergedRight = true; + SetFrameAt(x, y, 54 + 18 * randomFrame, 252); + return; + } + SetFrameAt(x, y, 216, 18 * randomFrame); + return; + } + + private static void SetFrameAt(int x, int y, int frameX, int frameY) + { + Main.tile[x, y].frameX = (short)frameX; + Main.tile[x, y].frameY = (short)frameY; + } + + private static Similarity GetSimilarity(Tile check, int myType, int mergeType) + { + if (!check.active()) return Similarity.None; + + if (check.type == myType || Main.tileMerge[myType][check.type]) + return Similarity.Same; + else if (check.type == mergeType) + return Similarity.MergeLink; + + return Similarity.None; + } + + private static string StringWriter(params object[] strings) + { + string s = ""; + for (int i = 0; i < strings.Length; i++) + { + s += strings[i].ToString(); + if (i != strings.Length - 1) + { + s += ", "; + } + } + return s; + } } } diff --git a/Dusts/BrimstoneFlame.cs b/Dusts/BrimstoneFlame.cs index 6111b7bb54..78ccb4ef68 100644 --- a/Dusts/BrimstoneFlame.cs +++ b/Dusts/BrimstoneFlame.cs @@ -1,40 +1,40 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts -{ - public class BrimstoneFlame : ModDust - { - public override void OnSpawn(Dust dust) - { - dust.velocity.Y = Main.rand.Next(-10, 6) * 0.1f; - dust.velocity.X *= 0.3f; - dust.scale *= 0.7f; - } - - public override bool MidUpdate(Dust dust) - { - if (!dust.noGravity) - { - dust.velocity.Y += 0.05f; - } - if (!dust.noLight) - { - float strength = dust.scale * 1.4f; - if (strength > 1f) - { - strength = 1f; - } - Lighting.AddLight(dust.position, 0.1f * strength, 0.025f * strength, 0.025f * strength); - } - return true; - } - - public override Color? GetAlpha(Dust dust, Color lightColor) - { - return new Color(lightColor.R, lightColor.G, lightColor.B, 25); - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class BrimstoneFlame : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.velocity.Y = Main.rand.Next(-10, 6) * 0.1f; + dust.velocity.X *= 0.3f; + dust.scale *= 0.7f; + } + + public override bool MidUpdate(Dust dust) + { + if (!dust.noGravity) + { + dust.velocity.Y += 0.05f; + } + if (!dust.noLight) + { + float strength = dust.scale * 1.4f; + if (strength > 1f) + { + strength = 1f; + } + Lighting.AddLight(dust.position, 0.1f * strength, 0.025f * strength, 0.025f * strength); + } + return true; + } + + public override Color? GetAlpha(Dust dust, Color lightColor) + { + return new Color(lightColor.R, lightColor.G, lightColor.B, 25); + } + } +} diff --git a/Dusts/FurnitureDusts/BloomTileGold.cs b/Dusts/FurnitureDusts/BloomTileGold.cs index 663cd8a699..0242aa8cf0 100644 --- a/Dusts/FurnitureDusts/BloomTileGold.cs +++ b/Dusts/FurnitureDusts/BloomTileGold.cs @@ -27,4 +27,4 @@ namespace CalamityMod.Dusts.FurnitureDusts return false; } } -} \ No newline at end of file +} diff --git a/Dusts/FurnitureDusts/BloomTileLeaves.cs b/Dusts/FurnitureDusts/BloomTileLeaves.cs index dbce261520..3e58e8a698 100644 --- a/Dusts/FurnitureDusts/BloomTileLeaves.cs +++ b/Dusts/FurnitureDusts/BloomTileLeaves.cs @@ -27,4 +27,4 @@ namespace CalamityMod.Dusts.FurnitureDusts return false; } } -} \ No newline at end of file +} diff --git a/Dusts/FurnitureDusts/OccultTileCloth.cs b/Dusts/FurnitureDusts/OccultTileCloth.cs index 076934841a..0f90198ccb 100644 --- a/Dusts/FurnitureDusts/OccultTileCloth.cs +++ b/Dusts/FurnitureDusts/OccultTileCloth.cs @@ -27,4 +27,4 @@ namespace CalamityMod.Dusts.FurnitureDusts return false; } } -} \ No newline at end of file +} diff --git a/Dusts/FurnitureDusts/ProfanedTileRock.cs b/Dusts/FurnitureDusts/ProfanedTileRock.cs index 1b941e17ce..5e8c3cdf9d 100644 --- a/Dusts/FurnitureDusts/ProfanedTileRock.cs +++ b/Dusts/FurnitureDusts/ProfanedTileRock.cs @@ -27,4 +27,4 @@ namespace CalamityMod.Dusts.FurnitureDusts return false; } } -} \ No newline at end of file +} diff --git a/Dusts/FurnitureDusts/SilvaTileGold.cs b/Dusts/FurnitureDusts/SilvaTileGold.cs index 8843fd6a2a..fbf0cfbb39 100644 --- a/Dusts/FurnitureDusts/SilvaTileGold.cs +++ b/Dusts/FurnitureDusts/SilvaTileGold.cs @@ -27,4 +27,4 @@ namespace CalamityMod.Dusts.FurnitureDusts return false; } } -} \ No newline at end of file +} diff --git a/Dusts/HBSparkle.cs b/Dusts/HBSparkle.cs index a0cff41c6d..2cbd33041a 100644 --- a/Dusts/HBSparkle.cs +++ b/Dusts/HBSparkle.cs @@ -1,31 +1,31 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class HBSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.alpha = 155; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.25f; - } - - public override bool Update(Dust dust) - { - dust.position += dust.velocity; - dust.rotation += dust.velocity.X * 0.05f; - dust.scale *= 0.99f; - float light = 0.35f * dust.scale; - Lighting.AddLight(dust.position, 0.35f, 0.01f, 0.01f); - if (dust.scale < 0.15f) - { - dust.active = false; - } - return false; - } -}} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class HBSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.alpha = 155; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.25f; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.rotation += dust.velocity.X * 0.05f; + dust.scale *= 0.99f; + float light = 0.35f * dust.scale; + Lighting.AddLight(dust.position, 0.35f, 0.01f, 0.01f); + if (dust.scale < 0.15f) + { + dust.active = false; + } + return false; + } +}} diff --git a/Dusts/HolyFlame.cs b/Dusts/HolyFlame.cs index 08deeb2c03..ba27a83bca 100644 --- a/Dusts/HolyFlame.cs +++ b/Dusts/HolyFlame.cs @@ -1,40 +1,40 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts -{ - public class HolyFlame : ModDust - { - public override void OnSpawn(Dust dust) - { - dust.velocity.Y = Main.rand.Next(-10, 6) * 0.1f; - dust.velocity.X *= 0.3f; - dust.scale *= 0.7f; - } - - public override bool MidUpdate(Dust dust) - { - if (!dust.noGravity) - { - dust.velocity.Y += 0.05f; - } - if (!dust.noLight) - { - float strength = dust.scale * 1.4f; - if (strength > 1f) - { - strength = 1f; - } - Lighting.AddLight(dust.position, 0.25f * strength, 0.25f * strength, 0.1f * strength); - } - return true; - } - - public override Color? GetAlpha(Dust dust, Color lightColor) - { - return new Color(lightColor.R, lightColor.G, lightColor.B, 25); - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class HolyFlame : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.velocity.Y = Main.rand.Next(-10, 6) * 0.1f; + dust.velocity.X *= 0.3f; + dust.scale *= 0.7f; + } + + public override bool MidUpdate(Dust dust) + { + if (!dust.noGravity) + { + dust.velocity.Y += 0.05f; + } + if (!dust.noLight) + { + float strength = dust.scale * 1.4f; + if (strength > 1f) + { + strength = 1f; + } + Lighting.AddLight(dust.position, 0.25f * strength, 0.25f * strength, 0.1f * strength); + } + return true; + } + + public override Color? GetAlpha(Dust dust, Color lightColor) + { + return new Color(lightColor.R, lightColor.G, lightColor.B, 25); + } + } +} diff --git a/Dusts/OMGWTHSparkle.cs b/Dusts/OMGWTHSparkle.cs index 524f68ee15..2697d8fdb4 100644 --- a/Dusts/OMGWTHSparkle.cs +++ b/Dusts/OMGWTHSparkle.cs @@ -1,31 +1,31 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Dusts { -public class OMGWTHSparkle : ModDust -{ - public override void OnSpawn(Dust dust) - { - dust.velocity *= 0.1f; - dust.alpha = 155; - dust.noGravity = true; - dust.noLight = true; - dust.scale *= 0.25f; - } - - public override bool Update(Dust dust) - { - dust.position += dust.velocity; - dust.rotation += dust.velocity.X * 0.05f; - dust.scale *= 0.99f; - float light = 0.35f * dust.scale; - Lighting.AddLight(dust.position, 0.35f, 0.1f, 0.1f); - if (dust.scale < 0.15f) - { - dust.active = false; - } - return false; - } -}} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts { +public class OMGWTHSparkle : ModDust +{ + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.alpha = 155; + dust.noGravity = true; + dust.noLight = true; + dust.scale *= 0.25f; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.rotation += dust.velocity.X * 0.05f; + dust.scale *= 0.99f; + float light = 0.35f * dust.scale; + Lighting.AddLight(dust.position, 0.35f, 0.1f, 0.1f); + if (dust.scale < 0.15f) + { + dust.active = false; + } + return false; + } +}} diff --git a/Items/AbyssItems/AbyssalAmulet.cs b/Items/AbyssItems/AbyssalAmulet.cs index 64933ee978..eb03127c0b 100644 --- a/Items/AbyssItems/AbyssalAmulet.cs +++ b/Items/AbyssItems/AbyssalAmulet.cs @@ -1,36 +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.AbyssItems -{ - public class AbyssalAmulet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyssal Amulet"); - Tooltip.SetDefault("Attacks inflict the Crush Depth debuff\n" + - "While in the abyss you gain 10% increased max life"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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.abyssalAmulet = true; - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class AbyssalAmulet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Amulet"); + Tooltip.SetDefault("Attacks inflict the Crush Depth debuff\n" + + "While in the abyss you gain 10% increased max life"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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.abyssalAmulet = true; + } + } +} diff --git a/Items/AbyssItems/AbyssalDivingGear.cs b/Items/AbyssItems/AbyssalDivingGear.cs index 02a5c208b3..06c811aa7c 100644 --- a/Items/AbyssItems/AbyssalDivingGear.cs +++ b/Items/AbyssItems/AbyssalDivingGear.cs @@ -1,62 +1,62 @@ -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.AbyssItems -{ - [AutoloadEquip(EquipType.Head)] - public class AbyssalDivingGear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyssal Diving Gear"); - 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\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" + - "Greatly reduces breath loss in the abyss"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 6; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.depthCharm = true; - modPlayer.jellyfishNecklace = true; - player.arcticDivingGear = true; - player.accFlipper = true; - player.accDivingHelm = true; - player.iceSkate = true; - if (player.wet) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ArcticDivingGear); - recipe.AddIngredient(null, "DepthCharm"); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddTile(TileID.TinkerersWorkbench); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.AbyssItems +{ + [AutoloadEquip(EquipType.Head)] + public class AbyssalDivingGear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Diving Gear"); + 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\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" + + "Greatly reduces breath loss in the abyss"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 45, 0, 0); + item.rare = 6; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.depthCharm = true; + modPlayer.jellyfishNecklace = true; + player.arcticDivingGear = true; + player.accFlipper = true; + player.accDivingHelm = true; + player.iceSkate = true; + if (player.wet) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ArcticDivingGear); + recipe.AddIngredient(null, "DepthCharm"); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddTile(TileID.TinkerersWorkbench); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/AbyssItems/AlluringBait.cs b/Items/AbyssItems/AlluringBait.cs index a986801a9d..a2f0eb521a 100644 --- a/Items/AbyssItems/AlluringBait.cs +++ b/Items/AbyssItems/AlluringBait.cs @@ -1,38 +1,38 @@ -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.AbyssItems -{ - public class AlluringBait : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Alluring Bait"); - Tooltip.SetDefault("30% increased fishing power during the day\n" + - "45% increased fishing power during the night\n" + - "60% increased fishing power during a solar eclipse"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (Main.eclipse) { player.fishingSkill += 60; } - else if (!Main.dayTime) { player.fishingSkill += 45; } - else { player.fishingSkill += 30; } - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class AlluringBait : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Alluring Bait"); + Tooltip.SetDefault("30% increased fishing power during the day\n" + + "45% increased fishing power during the night\n" + + "60% increased fishing power during a solar eclipse"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (Main.eclipse) { player.fishingSkill += 60; } + else if (!Main.dayTime) { player.fishingSkill += 45; } + else { player.fishingSkill += 30; } + } + } +} diff --git a/Items/AbyssItems/AnechoicPlating.cs b/Items/AbyssItems/AnechoicPlating.cs index c02dac8722..3c38c43937 100644 --- a/Items/AbyssItems/AnechoicPlating.cs +++ b/Items/AbyssItems/AnechoicPlating.cs @@ -1,36 +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.AbyssItems -{ - public class AnechoicPlating : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Anechoic Plating"); - Tooltip.SetDefault("Reduces creature's ability to detect you in the abyss\n" + - "Reduces the defense reduction that the abyss causes"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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.anechoicPlating = true; - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class AnechoicPlating : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anechoic Plating"); + Tooltip.SetDefault("Reduces creature's ability to detect you in the abyss\n" + + "Reduces the defense reduction that the abyss causes"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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.anechoicPlating = true; + } + } +} diff --git a/Items/AbyssItems/CloakingGland.cs b/Items/AbyssItems/CloakingGland.cs index 0e973e99db..a791945903 100644 --- a/Items/AbyssItems/CloakingGland.cs +++ b/Items/AbyssItems/CloakingGland.cs @@ -1,28 +1,28 @@ -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.AbyssItems -{ - public class CloakingGland : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloaking Gland"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 3; - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class CloakingGland : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloaking Gland"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 999; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 3; + } + } +} diff --git a/Items/AbyssItems/DepthCells.cs b/Items/AbyssItems/DepthCells.cs index 21f87db438..27568c2db7 100644 --- a/Items/AbyssItems/DepthCells.cs +++ b/Items/AbyssItems/DepthCells.cs @@ -1,29 +1,29 @@ -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.AbyssItems -{ - public class DepthCells : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Depth Cells"); - Tooltip.SetDefault("The cells of abyssal creatures"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 3; - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class DepthCells : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Depth Cells"); + Tooltip.SetDefault("The cells of abyssal creatures"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 999; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 3; + } + } +} diff --git a/Items/AbyssItems/DepthCharm.cs b/Items/AbyssItems/DepthCharm.cs index 247df99a92..7d77431e07 100644 --- a/Items/AbyssItems/DepthCharm.cs +++ b/Items/AbyssItems/DepthCharm.cs @@ -1,36 +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.AbyssItems -{ - public class DepthCharm : ModItem - { - public override void SetStaticDefaults() - { - 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 upper layers of the abyss"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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.depthCharm = true; - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class DepthCharm : ModItem + { + public override void SetStaticDefaults() + { + 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 upper layers of the abyss"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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.depthCharm = true; + } + } +} diff --git a/Items/AbyssItems/IronBoots.cs b/Items/AbyssItems/IronBoots.cs index c535a2e413..dbb447c6ee 100644 --- a/Items/AbyssItems/IronBoots.cs +++ b/Items/AbyssItems/IronBoots.cs @@ -1,35 +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.AbyssItems -{ - public class IronBoots : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Iron Boots"); - Tooltip.SetDefault("Allows you to fall faster while in liquids"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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.ironBoots = true; - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class IronBoots : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Iron Boots"); + Tooltip.SetDefault("Allows you to fall faster while in liquids"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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.ironBoots = true; + } + } +} diff --git a/Items/AbyssItems/Lumenite.cs b/Items/AbyssItems/Lumenite.cs index dfbc77b1d6..d20d738988 100644 --- a/Items/AbyssItems/Lumenite.cs +++ b/Items/AbyssItems/Lumenite.cs @@ -1,36 +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.AbyssItems -{ - public class Lumenite : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lumenyl"); - Tooltip.SetDefault("A shard of lumenous energy"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("LumenylCrystals"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 3; - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class Lumenite : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lumenyl"); + Tooltip.SetDefault("A shard of lumenous energy"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("LumenylCrystals"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 26; + item.height = 26; + item.maxStack = 999; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 3; + } + } +} diff --git a/Items/AbyssItems/LumenousAmulet.cs b/Items/AbyssItems/LumenousAmulet.cs index b71fbfef95..474469627f 100644 --- a/Items/AbyssItems/LumenousAmulet.cs +++ b/Items/AbyssItems/LumenousAmulet.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.AbyssItems -{ - public class LumenousAmulet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lumenous Amulet"); - Tooltip.SetDefault("Attacks inflict the Crush Depth debuff\n" + - "While in the abyss you gain 25% increased max life\n" + - "Provides a moderate amount of light in the abyss"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.abyssalAmulet = true; - modPlayer.lumenousAmulet = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AbyssalAmulet"); - recipe.AddIngredient(null, "Lumenite", 15); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class LumenousAmulet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lumenous Amulet"); + Tooltip.SetDefault("Attacks inflict the Crush Depth debuff\n" + + "While in the abyss you gain 25% increased max life\n" + + "Provides a moderate amount of light in the abyss"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.abyssalAmulet = true; + modPlayer.lumenousAmulet = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AbyssalAmulet"); + recipe.AddIngredient(null, "Lumenite", 15); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/AbyssItems/ReaperTooth.cs b/Items/AbyssItems/ReaperTooth.cs index a703dd1086..387a16c128 100644 --- a/Items/AbyssItems/ReaperTooth.cs +++ b/Items/AbyssItems/ReaperTooth.cs @@ -1,29 +1,29 @@ -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.AbyssItems -{ - public class ReaperTooth : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaper Tooth"); - Tooltip.SetDefault("Sharp enough to cut diamonds"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 10; - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class ReaperTooth : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaper Tooth"); + Tooltip.SetDefault("Sharp enough to cut diamonds"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 999; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 10; + } + } +} diff --git a/Items/AbyssItems/ReaperToothNecklace.cs b/Items/AbyssItems/ReaperToothNecklace.cs index e67a6d6c3d..c8412e10e3 100644 --- a/Items/AbyssItems/ReaperToothNecklace.cs +++ b/Items/AbyssItems/ReaperToothNecklace.cs @@ -1,50 +1,50 @@ -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.AbyssItems -{ - public class ReaperToothNecklace : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaper Tooth Necklace"); - Tooltip.SetDefault("Increases armor penetration by 100\n" + - "Increases all damage by 25%\n" + - "Cuts your defense and damage reduction in half"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 10; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.reaperToothNecklace = true; - player.armorPenetration += 100; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ReaperTooth", 6); - recipe.AddIngredient(null, "Lumenite", 15); - recipe.AddIngredient(null, "DepthCells", 15); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.AbyssItems +{ + public class ReaperToothNecklace : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaper Tooth Necklace"); + Tooltip.SetDefault("Increases armor penetration by 100\n" + + "Increases all damage by 25%\n" + + "Cuts your defense and damage reduction in half"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 10; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.reaperToothNecklace = true; + player.armorPenetration += 100; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ReaperTooth", 6); + recipe.AddIngredient(null, "Lumenite", 15); + recipe.AddIngredient(null, "DepthCells", 15); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/AbyssItems/StrangeOrb.cs b/Items/AbyssItems/StrangeOrb.cs index 4cb76098e4..b0d8d2768b 100644 --- a/Items/AbyssItems/StrangeOrb.cs +++ b/Items/AbyssItems/StrangeOrb.cs @@ -1,36 +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.AbyssItems -{ - public class StrangeOrb : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Strange Orb"); - Tooltip.SetDefault("Summons a young Siren light pet\n" + - "Provides a large amount of light while underwater"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.WispinaBottle); - item.shoot = mod.ProjectileType("SirenYoung"); - item.buffType = mod.BuffType("StrangeOrb"); - } - - 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 +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.AbyssItems +{ + public class StrangeOrb : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Strange Orb"); + Tooltip.SetDefault("Summons a young Siren light pet\n" + + "Provides a large amount of light while underwater"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.WispinaBottle); + item.shoot = mod.ProjectileType("SirenYoung"); + item.buffType = mod.BuffType("StrangeOrb"); + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } + } +} diff --git a/Items/AbyssItems/SunkenStew.cs b/Items/AbyssItems/SunkenStew.cs index a22fc85053..84b969d6bd 100644 --- a/Items/AbyssItems/SunkenStew.cs +++ b/Items/AbyssItems/SunkenStew.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; - -namespace CalamityMod.Items.AbyssItems -{ - public class SunkenStew : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sunken Stew"); - Tooltip.SetDefault("Causes potion sickness for 50 (37 with Philosopher's Stone effect) seconds instead of 60\n" + - "Restores 120 life and 150 mana"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.rare = 3; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = BuffID.WellFed; - item.buffTime = 216000; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override bool ConsumeItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override void OnConsumeItem(Player player) - { - player.statLife += 120; - player.statMana += 150; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (player.statMana > player.statManaMax2) - { - player.statMana = player.statManaMax2; - } - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(120, true); - player.ManaEffect(150); - } - player.AddBuff(BuffID.WellFed, 216000); - player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2220 : 3000)); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DepthCells", 5); - recipe.AddIngredient(ItemID.GlowingMushroom, 3); - recipe.AddIngredient(ItemID.Honeyfin); - recipe.AddIngredient(ItemID.Bowl); - recipe.AddTile(TileID.CookingPots); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.AbyssItems +{ + public class SunkenStew : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sunken Stew"); + Tooltip.SetDefault("Causes potion sickness for 50 (37 with Philosopher's Stone effect) seconds instead of 60\n" + + "Restores 120 life and 150 mana"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.useAnimation = 17; + item.useTime = 17; + item.rare = 3; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = BuffID.WellFed; + item.buffTime = 216000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override bool ConsumeItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override void OnConsumeItem(Player player) + { + player.statLife += 120; + player.statMana += 150; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(120, true); + player.ManaEffect(150); + } + player.AddBuff(BuffID.WellFed, 216000); + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2220 : 3000)); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DepthCells", 5); + recipe.AddIngredient(ItemID.GlowingMushroom, 3); + recipe.AddIngredient(ItemID.Honeyfin); + recipe.AddIngredient(ItemID.Bowl); + recipe.AddTile(TileID.CookingPots); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/AbyssItems/TorrentialTear.cs b/Items/AbyssItems/TorrentialTear.cs index 3eab676962..7fa737dbc2 100644 --- a/Items/AbyssItems/TorrentialTear.cs +++ b/Items/AbyssItems/TorrentialTear.cs @@ -1,105 +1,105 @@ -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; - -namespace CalamityMod.Items.AbyssItems -{ - public class TorrentialTear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Torrential Tear"); - Tooltip.SetDefault("Summons the rain\n" + - "Rain will start some time after this item is used\n" + - "If used when raining the rain will stop some time after this item is used"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item66; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return !Main.slimeRain; - } - - public override bool UseItem(Player player) - { - if (!Main.raining) - { - int num = 86400; - int num2 = num / 24; - Main.rainTime = Main.rand.Next(num2 * 8, num); - if (Main.rand.Next(3) == 0) - { - Main.rainTime += Main.rand.Next(0, num2); - } - if (Main.rand.Next(4) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.Next(5) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.Next(6) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 3); - } - if (Main.rand.Next(7) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 4); - } - if (Main.rand.Next(8) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 5); - } - float num3 = 1f; - if (Main.rand.Next(2) == 0) - { - num3 += 0.05f; - } - if (Main.rand.Next(3) == 0) - { - num3 += 0.1f; - } - if (Main.rand.Next(4) == 0) - { - num3 += 0.15f; - } - if (Main.rand.Next(5) == 0) - { - num3 += 0.2f; - } - Main.rainTime = (int)((float)Main.rainTime * num3); - Main.raining = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else - { - Main.raining = false; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - return true; - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.Items.AbyssItems +{ + public class TorrentialTear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Torrential Tear"); + Tooltip.SetDefault("Summons the rain\n" + + "Rain will start some time after this item is used\n" + + "If used when raining the rain will stop some time after this item is used"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item66; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return !Main.slimeRain; + } + + public override bool UseItem(Player player) + { + if (!Main.raining) + { + int num = 86400; + int num2 = num / 24; + Main.rainTime = Main.rand.Next(num2 * 8, num); + if (Main.rand.Next(3) == 0) + { + Main.rainTime += Main.rand.Next(0, num2); + } + if (Main.rand.Next(4) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.Next(5) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.Next(6) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 3); + } + if (Main.rand.Next(7) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 4); + } + if (Main.rand.Next(8) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 5); + } + float num3 = 1f; + if (Main.rand.Next(2) == 0) + { + num3 += 0.05f; + } + if (Main.rand.Next(3) == 0) + { + num3 += 0.1f; + } + if (Main.rand.Next(4) == 0) + { + num3 += 0.15f; + } + if (Main.rand.Next(5) == 0) + { + num3 += 0.2f; + } + Main.rainTime = (int)((float)Main.rainTime * num3); + Main.raining = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else + { + Main.raining = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + return true; + } + } +} diff --git a/Items/AbyssalWarhammer.cs b/Items/AbyssalWarhammer.cs index d3b05d6e8f..0f5e399937 100644 --- a/Items/AbyssalWarhammer.cs +++ b/Items/AbyssalWarhammer.cs @@ -1,59 +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 -{ - public class AbyssalWarhammer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyssal Warhammer"); - } - - public override void SetDefaults() - { - item.damage = 42; - item.melee = true; - item.width = 66; - item.height = 64; - item.useTime = 38; - item.useAnimation = 38; - item.useTurn = true; - item.hammer = 110; - item.useStyle = 1; - item.knockBack = 8f; - 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, "VerstaltiteBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 29); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } - } -} \ No newline at end of file +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 +{ + public class AbyssalWarhammer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Warhammer"); + } + + public override void SetDefaults() + { + item.damage = 42; + item.melee = true; + item.width = 66; + item.height = 64; + item.useTime = 38; + item.useAnimation = 38; + item.useTurn = true; + item.hammer = 110; + item.useStyle = 1; + item.knockBack = 8f; + 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, "VerstaltiteBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 29); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120); + } + } +} diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index a504986d96..fc1b67e8a6 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.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.Accessories -{ - public class AlchemicalFlask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Alchemical Flask"); - Tooltip.SetDefault("All attacks inflict the plague\n" + - "Makes you immune to the plague\n" + - "Projectiles spawn plague seekers on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 8; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.alchFlask = true; - player.buffImmune[mod.BuffType("Plague")] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ItemID.Bezoar); - recipe.AddIngredient(null, "PlagueCellCluster", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class AlchemicalFlask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Alchemical Flask"); + Tooltip.SetDefault("All attacks inflict the plague\n" + + "Makes you immune to the plague\n" + + "Projectiles spawn plague seekers on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.alchFlask = true; + player.buffImmune[mod.BuffType("Plague")] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.Bezoar); + recipe.AddIngredient(null, "PlagueCellCluster", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index d3c0ec42fc..a739ae45ce 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - public class AmalgamatedBrain : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amalgamated Brain"); - Tooltip.SetDefault("12% increased damage\n" + - "Shade rains down when you are hit\n" + - "You will confuse nearby enemies when you are struck"); - } - - public override void SetDefaults() - { - item.width = 34; - item.height = 34; - item.value = Item.buyPrice(0, 15, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - CalamityCustomThrowingDamagePlayer modPlayer2 = CalamityCustomThrowingDamagePlayer.ModPlayer(player); - modPlayer.aBrain = true; - if (player.immune) - { - if (Main.rand.Next(8) == 0) - { - if (player.whoAmI == Main.myPlayer) - { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("AuraRain"), 60, 2f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].tileCollide = false; - } - } - } - } - player.meleeDamage += 0.12f; - player.magicDamage += 0.12f; - player.rangedDamage += 0.12f; - modPlayer2.throwingDamage += 0.12f; - player.minionDamage += 0.12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "RottenBrain"); - recipe.AddIngredient(ItemID.BrainOfConfusion); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + public class AmalgamatedBrain : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amalgamated Brain"); + Tooltip.SetDefault("12% increased damage\n" + + "Shade rains down when you are hit\n" + + "You will confuse nearby enemies when you are struck"); + } + + public override void SetDefaults() + { + item.width = 34; + item.height = 34; + item.value = Item.buyPrice(0, 15, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityCustomThrowingDamagePlayer modPlayer2 = CalamityCustomThrowingDamagePlayer.ModPlayer(player); + modPlayer.aBrain = true; + if (player.immune) + { + if (Main.rand.Next(8) == 0) + { + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 1; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("AuraRain"), 60, 2f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + Main.projectile[num19].tileCollide = false; + } + } + } + } + player.meleeDamage += 0.12f; + player.magicDamage += 0.12f; + player.rangedDamage += 0.12f; + modPlayer2.throwingDamage += 0.12f; + player.minionDamage += 0.12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "RottenBrain"); + recipe.AddIngredient(ItemID.BrainOfConfusion); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 0b088d096f..e6085d10bd 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -1,66 +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.Accessories -{ - public class AmbrosialAmpoule : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ambrosial Ampoule"); - 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" + - "Honey-like life regen with no speed penalty\n" + - "Most bee/hornet enemies and projectiles do 75% damage to you"); - } - - public override void SetDefaults() - { - item.defense = 4; - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 10; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.beeResist = true; - modPlayer.aAmpoule = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CorruptFlask"); - recipe.AddIngredient(null, "ArchaicPowder"); - recipe.AddIngredient(null, "RadiantOoze"); - recipe.AddIngredient(null, "HoneyDew"); - recipe.AddIngredient(null, "Stardust", 15); - recipe.AddIngredient(null, "CryoBar", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CrimsonFlask"); - recipe.AddIngredient(null, "ArchaicPowder"); - recipe.AddIngredient(null, "RadiantOoze"); - recipe.AddIngredient(null, "HoneyDew"); - recipe.AddIngredient(null, "Stardust", 15); - recipe.AddIngredient(null, "CryoBar", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class AmbrosialAmpoule : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ambrosial Ampoule"); + 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" + + "Honey-like life regen with no speed penalty\n" + + "Most bee/hornet enemies and projectiles do 75% damage to you"); + } + + public override void SetDefaults() + { + item.defense = 4; + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 45, 0, 0); + item.rare = 10; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.beeResist = true; + modPlayer.aAmpoule = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CorruptFlask"); + recipe.AddIngredient(null, "ArchaicPowder"); + recipe.AddIngredient(null, "RadiantOoze"); + recipe.AddIngredient(null, "HoneyDew"); + recipe.AddIngredient(null, "Stardust", 15); + recipe.AddIngredient(null, "CryoBar", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CrimsonFlask"); + recipe.AddIngredient(null, "ArchaicPowder"); + recipe.AddIngredient(null, "RadiantOoze"); + recipe.AddIngredient(null, "HoneyDew"); + recipe.AddIngredient(null, "Stardust", 15); + recipe.AddIngredient(null, "CryoBar", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index 850d7e8278..aec2584126 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.cs @@ -1,36 +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 -{ - 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 UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aSpark = true; - } - } -} \ No newline at end of file +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 +{ + 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 UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aSpark = true; + } + } +} diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index 70196c5b38..baa1cff74b 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.cs @@ -1,46 +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.Accessories -{ - public class AncientFossil : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient Fossil"); - Tooltip.SetDefault("Increases pick speed by 15% while underground"); - } - - 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) - { - if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) - { - player.pickSpeed -= 0.15f; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("SiltGroup", 100); - recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class AncientFossil : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient Fossil"); + Tooltip.SetDefault("Increases pick speed by 15% while underground"); + } + + 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) + { + if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) + { + player.pickSpeed -= 0.15f; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddRecipeGroup("SiltGroup", 100); + recipe.AddTile(TileID.Furnaces); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index f6d962eb5d..e4a86d7f2c 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -1,62 +1,62 @@ -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 -{ - [AutoloadEquip(EquipType.Shoes)] - public class AngelTreads : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Angel Treads"); - Tooltip.SetDefault("Extreme speed!\n" + - "Greater mobility on ice\n" + - "Water and lava walking\n" + - "Temporary immunity to lava"); - } - - public override void SetDefaults() - { - item.width = 36; - item.height = 32; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 8; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.harpyRing = true; - player.accRunSpeed = 8f; - player.rocketBoots = 3; - player.moveSpeed += 0.16f; - player.iceSkate = true; - player.waterWalk = true; - player.fireWalk = true; - player.lavaMax += 240; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FrostsparkBoots); - recipe.AddIngredient(ItemID.LavaWaders); - recipe.AddIngredient(null, "HarpyRing"); - recipe.AddIngredient(null, "EssenceofCinder", 5); - recipe.AddIngredient(null, "AerialiteBar", 20); - recipe.AddIngredient(ItemID.SoulofMight); - recipe.AddIngredient(ItemID.SoulofSight); - recipe.AddIngredient(ItemID.SoulofFright); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + [AutoloadEquip(EquipType.Shoes)] + public class AngelTreads : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Angel Treads"); + Tooltip.SetDefault("Extreme speed!\n" + + "Greater mobility on ice\n" + + "Water and lava walking\n" + + "Temporary immunity to lava"); + } + + public override void SetDefaults() + { + item.width = 36; + item.height = 32; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.harpyRing = true; + player.accRunSpeed = 8f; + player.rocketBoots = 3; + player.moveSpeed += 0.16f; + player.iceSkate = true; + player.waterWalk = true; + player.fireWalk = true; + player.lavaMax += 240; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FrostsparkBoots); + recipe.AddIngredient(ItemID.LavaWaders); + recipe.AddIngredient(null, "HarpyRing"); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddIngredient(null, "AerialiteBar", 20); + recipe.AddIngredient(ItemID.SoulofMight); + recipe.AddIngredient(ItemID.SoulofSight); + recipe.AddIngredient(ItemID.SoulofFright); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs index 699805575c..40554a8a87 100644 --- a/Items/Accessories/ArcanumoftheVoid.cs +++ b/Items/Accessories/ArcanumoftheVoid.cs @@ -1,36 +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 -{ - public class ArcanumoftheVoid : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arcanum of the Void"); - Tooltip.SetDefault("You have a 5% chance to reflect projectiles when they hit you\n" + - "If this effect triggers you get healed for the projectile's damage"); - } - - 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 = 13; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.projRef = true; - } - } -} \ No newline at end of file +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 +{ + public class ArcanumoftheVoid : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arcanum of the Void"); + Tooltip.SetDefault("You have a 5% chance to reflect projectiles when they hit you\n" + + "If this effect triggers you get healed for the projectile's damage"); + } + + 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 = 13; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.projRef = true; + } + } +} diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index 6f5b976f69..985da864ef 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -1,51 +1,51 @@ -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 -{ - public class ArchaicPowder : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Archaic Powder"); - Tooltip.SetDefault("20% increased mining speed, 7% damage reduction, and +3 defense while underground or in the underworld"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight) - { - player.statDefense += 3; - player.endurance += 0.07f; - player.pickSpeed -= 0.2f; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientFossil"); - recipe.AddIngredient(null, "DemonicBoneAsh"); - recipe.AddIngredient(null, "AncientBoneDust", 3); - recipe.AddIngredient(ItemID.Bone, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class ArchaicPowder : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Archaic Powder"); + Tooltip.SetDefault("20% increased mining speed, 7% damage reduction, and +3 defense while underground or in the underworld"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight) + { + player.statDefense += 3; + player.endurance += 0.07f; + player.pickSpeed -= 0.2f; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientFossil"); + recipe.AddIngredient(null, "DemonicBoneAsh"); + recipe.AddIngredient(null, "AncientBoneDust", 3); + recipe.AddIngredient(ItemID.Bone, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 9c0738fcd1..32cc85b124 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -1,76 +1,76 @@ -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 -{ - [AutoloadEquip(EquipType.Shield)] - public class AsgardianAegis : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Asgardian Aegis"); - Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + - "Immune to most debuffs\n" + - "+40 max life\n" + - "Grants a supreme holy flame dash\n" + - "Can be used to ram enemies\n" + - "Press N to activate buffs to all damage, crit chance, and defense\n" + - "Activating this buff will reduce your movement speed and increase enemy aggro\n" + - "10% damage reduction while submerged in liquid\n" + - "Toggle visibility of this accessory to enable/disable the dash"); - } - - public override void SetDefaults() - { - item.width = 60; - item.height = 54; - item.value = Item.buyPrice(0, 90, 0, 0); //30 gold reforge - item.defense = 10; - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!hideVisual) { modPlayer.dashMod = 4; } - modPlayer.elysianAegis = true; - player.noKnockback = true; - player.fireWalk = true; - player.statLifeMax2 += 40; - player.buffImmune[46] = true; - player.buffImmune[44] = true; - player.buffImmune[33] = true; - player.buffImmune[36] = true; - player.buffImmune[30] = true; - player.buffImmune[20] = true; - player.buffImmune[32] = true; - player.buffImmune[31] = true; - player.buffImmune[35] = true; - player.buffImmune[23] = true; - player.buffImmune[22] = true; - player.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - player.buffImmune[mod.BuffType("HolyLight")] = true; - player.buffImmune[mod.BuffType("GlacialState")] = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.endurance += 0.1f; } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AsgardsValor"); - recipe.AddIngredient(null, "ElysianAegis"); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + [AutoloadEquip(EquipType.Shield)] + public class AsgardianAegis : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Asgardian Aegis"); + Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + + "Immune to most debuffs\n" + + "+40 max life\n" + + "Grants a supreme holy flame dash\n" + + "Can be used to ram enemies\n" + + "Press N to activate buffs to all damage, crit chance, and defense\n" + + "Activating this buff will reduce your movement speed and increase enemy aggro\n" + + "10% damage reduction while submerged in liquid\n" + + "Toggle visibility of this accessory to enable/disable the dash"); + } + + public override void SetDefaults() + { + item.width = 60; + item.height = 54; + item.value = Item.buyPrice(0, 90, 0, 0); //30 gold reforge + item.defense = 10; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!hideVisual) { modPlayer.dashMod = 4; } + modPlayer.elysianAegis = true; + player.noKnockback = true; + player.fireWalk = true; + player.statLifeMax2 += 40; + player.buffImmune[46] = true; + player.buffImmune[44] = true; + player.buffImmune[33] = true; + player.buffImmune[36] = true; + player.buffImmune[30] = true; + player.buffImmune[20] = true; + player.buffImmune[32] = true; + player.buffImmune[31] = true; + player.buffImmune[35] = true; + player.buffImmune[23] = true; + player.buffImmune[22] = true; + player.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + player.buffImmune[mod.BuffType("HolyLight")] = true; + player.buffImmune[mod.BuffType("GlacialState")] = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.endurance += 0.1f; } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AsgardsValor"); + recipe.AddIngredient(null, "ElysianAegis"); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index efb38d8ff9..1a02e97d26 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -1,77 +1,77 @@ -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 -{ - [AutoloadEquip(EquipType.Shield)] - public class AsgardsValor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Asgard's Valor"); - Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + - "Immune to most debuffs including Brimstone Flames, Holy Flames, and Glacial State\n" + - "10% damage reduction while submerged in liquid\n" + - "+20 max life\n" + - "Grants an improved holy dash\n" + - "Can be used to ram enemies\n" + - "Toggle visibility of this accessory to enable/disable the dash"); - } - - public override void SetDefaults() - { - item.width = 38; - item.height = 44; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 9; - item.defense = 8; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!hideVisual) { modPlayer.dashMod = 2; } - player.buffImmune[46] = true; - player.buffImmune[44] = true; - player.noKnockback = true; - player.fireWalk = true; - player.buffImmune[33] = true; - player.buffImmune[36] = true; - player.buffImmune[30] = true; - player.buffImmune[20] = true; - player.buffImmune[32] = true; - player.buffImmune[31] = true; - player.buffImmune[35] = true; - player.buffImmune[23] = true; - player.buffImmune[22] = true; - player.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - player.buffImmune[mod.BuffType("HolyLight")] = true; - player.buffImmune[mod.BuffType("GlacialState")] = true; - player.statLifeMax2 += 20; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.endurance += 0.1f; } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AnkhShield); - recipe.AddIngredient(null, "OrnateShield"); - recipe.AddIngredient(null, "ShieldoftheOcean"); - recipe.AddIngredient(null, "Abaddon"); - recipe.AddIngredient(null, "CoreofEleum", 3); - recipe.AddIngredient(null, "CoreofCinder", 3); - recipe.AddIngredient(null, "CoreofChaos", 3); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + [AutoloadEquip(EquipType.Shield)] + public class AsgardsValor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Asgard's Valor"); + Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + + "Immune to most debuffs including Brimstone Flames, Holy Flames, and Glacial State\n" + + "10% damage reduction while submerged in liquid\n" + + "+20 max life\n" + + "Grants an improved holy dash\n" + + "Can be used to ram enemies\n" + + "Toggle visibility of this accessory to enable/disable the dash"); + } + + public override void SetDefaults() + { + item.width = 38; + item.height = 44; + item.value = Item.buyPrice(0, 45, 0, 0); + item.rare = 9; + item.defense = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!hideVisual) { modPlayer.dashMod = 2; } + player.buffImmune[46] = true; + player.buffImmune[44] = true; + player.noKnockback = true; + player.fireWalk = true; + player.buffImmune[33] = true; + player.buffImmune[36] = true; + player.buffImmune[30] = true; + player.buffImmune[20] = true; + player.buffImmune[32] = true; + player.buffImmune[31] = true; + player.buffImmune[35] = true; + player.buffImmune[23] = true; + player.buffImmune[22] = true; + player.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + player.buffImmune[mod.BuffType("HolyLight")] = true; + player.buffImmune[mod.BuffType("GlacialState")] = true; + player.statLifeMax2 += 20; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.endurance += 0.1f; } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AnkhShield); + recipe.AddIngredient(null, "OrnateShield"); + recipe.AddIngredient(null, "ShieldoftheOcean"); + recipe.AddIngredient(null, "Abaddon"); + recipe.AddIngredient(null, "CoreofEleum", 3); + recipe.AddIngredient(null, "CoreofCinder", 3); + recipe.AddIngredient(null, "CoreofChaos", 3); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index c8813fd59c..ffda38caa3 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -1,55 +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.Accessories -{ - public class AstralArcanum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Arcanum"); - Tooltip.SetDefault("Taking damage drops astral stars from the sky\n" + - "Provides immunity to the god slayer inferno debuff\n" + - "You have a 5% chance to reflect projectiles when they hit you\n" + - "If this effect triggers you get healed for the projectile's damage\n" + - "Boosts life regen even while under the effects of a damaging debuff\n" + - "While under the effects of a damaging debuff you will gain 20 defense\n" + - "Press O to toggle teleportation UI"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 90, 0, 0); - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.astralArcanum = true; - modPlayer.aBulwark = true; - modPlayer.projRef = true; - player.buffImmune[mod.BuffType("GodSlayerInferno")] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CelestialJewel"); - recipe.AddIngredient(null, "AstralBulwark"); - recipe.AddIngredient(null, "ArcanumoftheVoid"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class AstralArcanum : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Arcanum"); + Tooltip.SetDefault("Taking damage drops astral stars from the sky\n" + + "Provides immunity to the god slayer inferno debuff\n" + + "You have a 5% chance to reflect projectiles when they hit you\n" + + "If this effect triggers you get healed for the projectile's damage\n" + + "Boosts life regen even while under the effects of a damaging debuff\n" + + "While under the effects of a damaging debuff you will gain 20 defense\n" + + "Press O to toggle teleportation UI"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 90, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.astralArcanum = true; + modPlayer.aBulwark = true; + modPlayer.projRef = true; + player.buffImmune[mod.BuffType("GodSlayerInferno")] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CelestialJewel"); + recipe.AddIngredient(null, "AstralBulwark"); + recipe.AddIngredient(null, "ArcanumoftheVoid"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/AstralBulwark.cs b/Items/Accessories/AstralBulwark.cs index 021746b1e1..ad2df14cab 100644 --- a/Items/Accessories/AstralBulwark.cs +++ b/Items/Accessories/AstralBulwark.cs @@ -1,38 +1,38 @@ -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 -{ - public class AstralBulwark : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Bulwark"); - Tooltip.SetDefault("Taking damage drops astral stars from the sky\n" + - "Provides immunity to 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.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aBulwark = true; - player.buffImmune[mod.BuffType("GodSlayerInferno")] = true; - } - } -} \ No newline at end of file +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 +{ + public class AstralBulwark : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Bulwark"); + Tooltip.SetDefault("Taking damage drops astral stars from the sky\n" + + "Provides immunity to 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.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aBulwark = true; + player.buffImmune[mod.BuffType("GodSlayerInferno")] = true; + } + } +} diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index db8a84e687..486d410083 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -1,53 +1,53 @@ -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 -{ - public class BadgeofBravery : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Badge of Bravery"); - Tooltip.SetDefault("15% increased melee speed"); - } - - 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 = 12; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.badgeOfBravery = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 2); - recipe.AddIngredient(ItemID.FeralClaws); - recipe.AddTile(TileID.LunarCraftingStation); - 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 +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 +{ + public class BadgeofBravery : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Badge of Bravery"); + Tooltip.SetDefault("15% increased melee speed"); + } + + 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 = 12; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.badgeOfBravery = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 2); + recipe.AddIngredient(ItemID.FeralClaws); + recipe.AddTile(TileID.LunarCraftingStation); + 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; + } + } +} diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index d2b1dd6822..85e9a903d8 100644 --- a/Items/Accessories/BloodflareCore.cs +++ b/Items/Accessories/BloodflareCore.cs @@ -1,38 +1,38 @@ -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 -{ - public class BloodflareCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodflare Core"); - Tooltip.SetDefault("When below 50% life you gain 5% increased damage reduction and 10% increased damage\n" + - "When below 15% life you gain 10% increased damage reduction and 20% increased damage\n" + - "When below 100 defense you gain 15% increased damage"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 45, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bloodflareCore = true; - } - } -} \ No newline at end of file +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 +{ + public class BloodflareCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Core"); + Tooltip.SetDefault("When below 50% life you gain 5% increased damage reduction and 10% increased damage\n" + + "When below 15% life you gain 10% increased damage reduction and 20% increased damage\n" + + "When below 100 defense you gain 15% increased damage"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 45, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.bloodflareCore = true; + } + } +} diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index 27545f9999..4effdbb411 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.cs @@ -1,48 +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.Accessories -{ - [AutoloadEquip(EquipType.Neck)] - public class BloodyWormScarf : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Worm Scarf"); - Tooltip.SetDefault("10% increased damage reduction and increased melee stats"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 42; - item.value = Item.buyPrice(0, 15, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.meleeDamage += 0.1f; - player.meleeSpeed += 0.1f; - player.endurance += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodyWormTooth"); - recipe.AddIngredient(ItemID.WormScarf); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + [AutoloadEquip(EquipType.Neck)] + public class BloodyWormScarf : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Worm Scarf"); + Tooltip.SetDefault("10% increased damage reduction and increased melee stats"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 42; + item.value = Item.buyPrice(0, 15, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.meleeDamage += 0.1f; + player.meleeSpeed += 0.1f; + player.endurance += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodyWormTooth"); + recipe.AddIngredient(ItemID.WormScarf); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/BurdenBreaker.cs b/Items/Accessories/BurdenBreaker.cs index 2a68a2154b..098044bf45 100644 --- a/Items/Accessories/BurdenBreaker.cs +++ b/Items/Accessories/BurdenBreaker.cs @@ -1,56 +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.Accessories -{ - public class BurdenBreaker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Determination Breaker"); - Tooltip.SetDefault("The bad time\n" + - "Removes immunity frames\n" + - "If you want a crazy challenge, equip this\n" + - "Touching lava kills you instantly"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.lavaImmune = false; - if (Collision.LavaCollision(player.position, player.width, (player.waterWalk ? (player.height - 6) : player.height))) - { - player.GetModPlayer(mod).KillPlayer(); - } - else if (player.immune) - { - player.immune = false; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 50); - recipe.AddIngredient(ItemID.IronBar, 7); - recipe.anyIronBar = true; - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class BurdenBreaker : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Determination Breaker"); + Tooltip.SetDefault("The bad time\n" + + "Removes immunity frames\n" + + "If you want a crazy challenge, equip this\n" + + "Touching lava kills you instantly"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.lavaImmune = false; + if (Collision.LavaCollision(player.position, player.width, (player.waterWalk ? (player.height - 6) : player.height))) + { + player.GetModPlayer(mod).KillPlayer(); + } + else if (player.immune) + { + player.immune = false; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 50); + recipe.AddIngredient(ItemID.IronBar, 7); + recipe.anyIronBar = true; + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/CelestialJewel.cs b/Items/Accessories/CelestialJewel.cs index e9f72842d8..cb81c7f009 100644 --- a/Items/Accessories/CelestialJewel.cs +++ b/Items/Accessories/CelestialJewel.cs @@ -1,47 +1,47 @@ -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 -{ - public class CelestialJewel : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestial Jewel"); - Tooltip.SetDefault("Boosts life regen even while under the effects of a damaging debuff\n" + - "While under the effects of a damaging debuff you will gain 20 defense\n" + - "Press P to teleport to a random location"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 7; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.celestialJewel = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CrownJewel"); - recipe.AddIngredient(null, "AstralJelly", 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class CelestialJewel : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestial Jewel"); + Tooltip.SetDefault("Boosts life regen even while under the effects of a damaging debuff\n" + + "While under the effects of a damaging debuff you will gain 20 defense\n" + + "Press P to teleport to a random location"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 7; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.celestialJewel = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CrownJewel"); + recipe.AddIngredient(null, "AstralJelly", 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/ChaosAmulet.cs b/Items/Accessories/ChaosAmulet.cs index 270b6938ff..78d1810e35 100644 --- a/Items/Accessories/ChaosAmulet.cs +++ b/Items/Accessories/ChaosAmulet.cs @@ -1,45 +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 -{ - public class ChaosAmulet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Amulet"); - Tooltip.SetDefault("Spelunker effect and increased life regen"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 24; - item.lifeRegen = 2; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.findTreasure = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofChaos", 7); - recipe.AddIngredient(ItemID.SpelunkerPotion, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class ChaosAmulet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Amulet"); + Tooltip.SetDefault("Spelunker effect and increased life regen"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 24; + item.lifeRegen = 2; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.findTreasure = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofChaos", 7); + recipe.AddIngredient(ItemID.SpelunkerPotion, 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/CheatTestThing.cs b/Items/Accessories/CheatTestThing.cs index 3e7cccbbbc..1b2b55a65c 100644 --- a/Items/Accessories/CheatTestThing.cs +++ b/Items/Accessories/CheatTestThing.cs @@ -1,42 +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 -{ - public class CheatTestThing : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("lul"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = 1; - item.rare = 1; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - bool canUse = (player.name == "Fabsol" || player.name == "Totalbiscuit") && player.townNPCs <= 1; - if (canUse) - { - modPlayer.lol = true; - } - else if (!player.immune) - { - player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - } - } - } -} \ No newline at end of file +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 +{ + public class CheatTestThing : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("lul"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = 1; + item.rare = 1; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + bool canUse = (player.name == "Fabsol" || player.name == "Totalbiscuit") && player.townNPCs <= 1; + if (canUse) + { + modPlayer.lol = true; + } + else if (!player.immune) + { + player.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + } + } + } +} diff --git a/Items/Accessories/CoreOfTheBloodGod.cs b/Items/Accessories/CoreOfTheBloodGod.cs index 5ce1f87337..9fd13039f6 100644 --- a/Items/Accessories/CoreOfTheBloodGod.cs +++ b/Items/Accessories/CoreOfTheBloodGod.cs @@ -1,56 +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.Accessories -{ - public class CoreOfTheBloodGod : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Core of the Blood God"); - Tooltip.SetDefault("5% increased damage reduction\n" + - "7% increased damage\n" + - "When below 100 defense you gain 15% increased damage\n" + - "Halves enemy contact damage\n" + - "When you take contact damage this effect has a 20 second cooldown\n" + - "Boosts your max HP by 10%"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 90, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.coreOfTheBloodGod = true; - modPlayer.fleshTotem = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodyWormScarf"); - recipe.AddIngredient(null, "BloodPact"); - recipe.AddIngredient(null, "FleshTotem"); - recipe.AddIngredient(null, "BloodflareCore"); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class CoreOfTheBloodGod : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Core of the Blood God"); + Tooltip.SetDefault("5% increased damage reduction\n" + + "7% increased damage\n" + + "When below 100 defense you gain 15% increased damage\n" + + "Halves enemy contact damage\n" + + "When you take contact damage this effect has a 20 second cooldown\n" + + "Boosts your max HP by 10%"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 90, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.coreOfTheBloodGod = true; + modPlayer.fleshTotem = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodyWormScarf"); + recipe.AddIngredient(null, "BloodPact"); + recipe.AddIngredient(null, "FleshTotem"); + recipe.AddIngredient(null, "BloodflareCore"); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/CorruptFlask.cs b/Items/Accessories/CorruptFlask.cs index 3a1963e8a1..70926418b4 100644 --- a/Items/Accessories/CorruptFlask.cs +++ b/Items/Accessories/CorruptFlask.cs @@ -1,48 +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.Accessories -{ - public class CorruptFlask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corrupt Flask"); - Tooltip.SetDefault("7% increased damage reduction and +3 defense while in the corruption"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 2; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.ZoneCorrupt) - { - player.statDefense += 3; - player.endurance += 0.07f; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FetidEssence", 3); - recipe.AddIngredient(ItemID.RottenChunk, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class CorruptFlask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrupt Flask"); + Tooltip.SetDefault("7% increased damage reduction and +3 defense while in the corruption"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 2; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.ZoneCorrupt) + { + player.statDefense += 3; + player.endurance += 0.07f; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FetidEssence", 3); + recipe.AddIngredient(ItemID.RottenChunk, 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index fc3fe022a4..428e8ef338 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -1,40 +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 -{ - public class CounterScarf : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Counter Scarf"); - Tooltip.SetDefault("Melee weapons that don't fire projectiles are granted 20% more damage\n" + - "Grants the ability to dash; dashing into an attack will cause you to dodge it\n" + - "After a dodge you will be granted a buff to all damage, melee speed, and all crit chance for a short time\n" + - "After a successful dodge you must wait 15 seconds before you can dodge again\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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.dodgeScarf = true; - modPlayer.dashMod = 1; - } - } -} \ No newline at end of file +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 +{ + public class CounterScarf : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Counter Scarf"); + Tooltip.SetDefault("Melee weapons that don't fire projectiles are granted 20% more damage\n" + + "Grants the ability to dash; dashing into an attack will cause you to dodge it\n" + + "After a dodge you will be granted a buff to all damage, melee speed, and all crit chance for a short time\n" + + "After a successful dodge you must wait 15 seconds before you can dodge again\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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.dodgeScarf = true; + modPlayer.dashMod = 1; + } + } +} diff --git a/Items/Accessories/CrawCarapace.cs b/Items/Accessories/CrawCarapace.cs index 7f592466da..ac40d94604 100644 --- a/Items/Accessories/CrawCarapace.cs +++ b/Items/Accessories/CrawCarapace.cs @@ -1,37 +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 -{ - public class CrawCarapace : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Craw Carapace"); - Tooltip.SetDefault("5% increased damage reduction\n" + - "Enemies take damage when they touch you"); - } - - public override void SetDefaults() - { - item.defense = 3; - item.width = 20; - item.height = 24; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 1; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.endurance += 0.05f; - player.thorns = 0.25f; - } - } -} \ No newline at end of file +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 +{ + public class CrawCarapace : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Craw Carapace"); + Tooltip.SetDefault("5% increased damage reduction\n" + + "Enemies take damage when they touch you"); + } + + public override void SetDefaults() + { + item.defense = 3; + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.endurance += 0.05f; + player.thorns = 0.25f; + } + } +} diff --git a/Items/Accessories/CrimsonFlask.cs b/Items/Accessories/CrimsonFlask.cs index cb61f08635..acafb375db 100644 --- a/Items/Accessories/CrimsonFlask.cs +++ b/Items/Accessories/CrimsonFlask.cs @@ -1,48 +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.Accessories -{ - public class CrimsonFlask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimson Flask"); - Tooltip.SetDefault("7% increased damage reduction and +3 defense while in the crimson"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 2; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.ZoneCrimson) - { - player.statDefense += 3; - player.endurance += 0.07f; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodlettingEssence", 3); - recipe.AddIngredient(ItemID.Vertebrae, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class CrimsonFlask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimson Flask"); + Tooltip.SetDefault("7% increased damage reduction and +3 defense while in the crimson"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 2; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.ZoneCrimson) + { + player.statDefense += 3; + player.endurance += 0.07f; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodlettingEssence", 3); + recipe.AddIngredient(ItemID.Vertebrae, 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs index f991b66dc9..730a86a13c 100644 --- a/Items/Accessories/CrownJewel.cs +++ b/Items/Accessories/CrownJewel.cs @@ -1,37 +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 -{ - public class CrownJewel : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crown Jewel"); - Tooltip.SetDefault("Boosts life regen even while under the effects of a damaging debuff\n" + - "While under the effects of a damaging debuff you will gain 10 defense\n" + - "Revengeance drop"); - } - - 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.crownJewel = true; - } - } -} \ No newline at end of file +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 +{ + public class CrownJewel : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crown Jewel"); + Tooltip.SetDefault("Boosts life regen even while under the effects of a damaging debuff\n" + + "While under the effects of a damaging debuff you will gain 10 defense\n" + + "Revengeance drop"); + } + + 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.crownJewel = true; + } + } +} diff --git a/Items/Accessories/DaedalusEmblem.cs b/Items/Accessories/DaedalusEmblem.cs index 858088bfe8..1a2706a720 100644 --- a/Items/Accessories/DaedalusEmblem.cs +++ b/Items/Accessories/DaedalusEmblem.cs @@ -1,52 +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.Accessories -{ - public class DaedalusEmblem : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Emblem"); - Tooltip.SetDefault("10% increased ranged damage, 5% increased ranged critical strike chance, and 20% reduced ammo usage\n" + - "Increases life regen, minion knockback, defense, and pick speed"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.ammoCost80 = true; - player.lifeRegen += 2; - player.statDefense += 5; - player.rangedDamage += 0.1f; - player.rangedCrit += 5; - player.pickSpeed -= 0.15f; - player.minionKB += 0.5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CelestialStone); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(ItemID.RangerEmblem); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class DaedalusEmblem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Emblem"); + Tooltip.SetDefault("10% increased ranged damage, 5% increased ranged critical strike chance, and 20% reduced ammo usage\n" + + "Increases life regen, minion knockback, defense, and pick speed"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.ammoCost80 = true; + player.lifeRegen += 2; + player.statDefense += 5; + player.rangedDamage += 0.1f; + player.rangedCrit += 5; + player.pickSpeed -= 0.15f; + player.minionKB += 0.5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CelestialStone); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(ItemID.RangerEmblem); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index dbbcb962a5..cf40c785d2 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -1,52 +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.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - public class DarkSunRing : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Sun Ring"); - 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)); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 10; - item.lifeRegen = 1; - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.darkSunRing = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 10); - recipe.AddIngredient(null, "DarksunFragment", 100); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + public class DarkSunRing : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Sun Ring"); + 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)); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 10; + item.lifeRegen = 1; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.darkSunRing = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 10); + recipe.AddIngredient(null, "DarksunFragment", 100); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 512d0b2216..7039544bbb 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -1,53 +1,53 @@ -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 -{ - public class DeificAmulet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deific Amulet"); - Tooltip.SetDefault("Taking damage makes you move very fast for a short time\n" + - "Increases armor penetration by 25 and immune time after being struck\n" + - "Provides light underwater and causes stars to fall when damaged\n" + - "Reduces the cooldown of healing potions"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.rare = 8; - item.value = Item.buyPrice(0, 45, 0, 0); - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.dAmulet = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CharmofMyths); - recipe.AddIngredient(ItemID.JellyfishNecklace); - recipe.AddIngredient(ItemID.PanicNecklace); - recipe.AddIngredient(ItemID.SharkToothNecklace); - recipe.AddIngredient(ItemID.StarVeil); - recipe.AddIngredient(null, "Stardust", 25); - recipe.AddIngredient(ItemID.MeteoriteBar, 25); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class DeificAmulet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deific Amulet"); + Tooltip.SetDefault("Taking damage makes you move very fast for a short time\n" + + "Increases armor penetration by 25 and immune time after being struck\n" + + "Provides light underwater and causes stars to fall when damaged\n" + + "Reduces the cooldown of healing potions"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.rare = 8; + item.value = Item.buyPrice(0, 45, 0, 0); + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.dAmulet = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CharmofMyths); + recipe.AddIngredient(ItemID.JellyfishNecklace); + recipe.AddIngredient(ItemID.PanicNecklace); + recipe.AddIngredient(ItemID.SharkToothNecklace); + recipe.AddIngredient(ItemID.StarVeil); + recipe.AddIngredient(null, "Stardust", 25); + recipe.AddIngredient(ItemID.MeteoriteBar, 25); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 3130d6d409..3e91e10678 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -1,57 +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.Accessories -{ - public class DraedonsHeart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Draedon's Heart"); - Tooltip.SetDefault("Gives 10% increased damage while you have the heart attack debuff\n" + - "Increases your chance of getting the heart attack debuff\n" + - "Boosts your damage by 10% and max movement speed and acceleration by 5%\n" + - "Rage mode does more damage\n" + - "You gain rage over time\n" + - "Gives immunity to the horror debuff\n" + - "Standing still regenerates your life quickly and boosts your defense by 25"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 7)); - } - - 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 = 15; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.draedonsHeart = true; - player.buffImmune[mod.BuffType("Horror")] = true; - modPlayer.draedonsStressGain = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "HeartofDarkness"); - recipe.AddIngredient(null, "StressPills"); - recipe.AddIngredient(null, "Laudanum"); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class DraedonsHeart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon's Heart"); + Tooltip.SetDefault("Gives 10% increased damage while you have the heart attack debuff\n" + + "Increases your chance of getting the heart attack debuff\n" + + "Boosts your damage by 10% and max movement speed and acceleration by 5%\n" + + "Rage mode does more damage\n" + + "You gain rage over time\n" + + "Gives immunity to the horror debuff\n" + + "Standing still regenerates your life quickly and boosts your defense by 25"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 7)); + } + + 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 = 15; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.draedonsHeart = true; + player.buffImmune[mod.BuffType("Horror")] = true; + modPlayer.draedonsStressGain = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "HeartofDarkness"); + recipe.AddIngredient(null, "StressPills"); + recipe.AddIngredient(null, "Laudanum"); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 5881823117..dbd91737c0 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -1,53 +1,53 @@ -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 -{ - public class ElementalGauntlet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Gauntlet"); - Tooltip.SetDefault("Melee attacks and projectiles inflict most debuffs\n" + - "15% increased melee speed, damage, and 5% increased melee critical strike chance\n" + - "Increased invincibility after taking damage\n" + - "Temporary immunity to lava\n" + - "Increased melee knockback\n" + - "Melee attacks have a chance to instantly kill normal enemies"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 38; - item.value = Item.buyPrice(0, 90, 0, 0); - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.eGauntlet = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FireGauntlet); - recipe.AddIngredient(null, "YharimsInsignia"); - recipe.AddIngredient(null, "Phantoplasm", 20); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class ElementalGauntlet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Gauntlet"); + Tooltip.SetDefault("Melee attacks and projectiles inflict most debuffs\n" + + "15% increased melee speed, damage, and 5% increased melee critical strike chance\n" + + "Increased invincibility after taking damage\n" + + "Temporary immunity to lava\n" + + "Increased melee knockback\n" + + "Melee attacks have a chance to instantly kill normal enemies"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 38; + item.value = Item.buyPrice(0, 90, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eGauntlet = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FireGauntlet); + recipe.AddIngredient(null, "YharimsInsignia"); + recipe.AddIngredient(null, "Phantoplasm", 20); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 4aaea18dbd..69d56dc1f9 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.cs @@ -1,58 +1,58 @@ -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 -{ - public class ElementalQuiver : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Quiver"); - Tooltip.SetDefault("Ranged projectiles have a chance to split\n" + - "Ranged weapons have a chance to instantly kill normal enemies\n" + - "10% increased ranged damage and 5% increased ranged critical strike chance\n" + - "20% reduced ammo usage and increased life regen, minion knockback, defense, and pick speed"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.eQuiver = true; - player.rangedDamage += 0.1f; - player.rangedCrit += 5; - player.ammoCost80 = true; - player.lifeRegen += 2; - player.statDefense += 5; - player.pickSpeed -= 0.15f; - player.minionKB += 0.5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MagicQuiver); - recipe.AddIngredient(null, "DaedalusEmblem"); - recipe.AddIngredient(null, "Phantoplasm", 20); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class ElementalQuiver : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Quiver"); + Tooltip.SetDefault("Ranged projectiles have a chance to split\n" + + "Ranged weapons have a chance to instantly kill normal enemies\n" + + "10% increased ranged damage and 5% increased ranged critical strike chance\n" + + "20% reduced ammo usage and increased life regen, minion knockback, defense, and pick speed"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 90, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eQuiver = true; + player.rangedDamage += 0.1f; + player.rangedCrit += 5; + player.ammoCost80 = true; + player.lifeRegen += 2; + player.statDefense += 5; + player.pickSpeed -= 0.15f; + player.minionKB += 0.5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MagicQuiver); + recipe.AddIngredient(null, "DaedalusEmblem"); + recipe.AddIngredient(null, "Phantoplasm", 20); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index 64533a9110..0f85ed667e 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -1,60 +1,60 @@ -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 -{ - public class EtherealTalisman : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ethereal Talisman"); - Tooltip.SetDefault("15% increased magic damage, 5% increased magic critical strike chance, and 10% decreased mana usage\n" + - "+150 max mana and reveals treasure locations\n" + - "Increases pickup range for mana stars and you restore mana when damaged\n" + - "You automatically use mana potions when needed\n" + - "Magic attacks have a chance to instantly kill normal enemies"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.eTalisman = true; - player.findTreasure = true; - player.manaFlower = true; - player.magicCuffs = true; - player.manaMagnet = true; - player.statManaMax2 += 150; - player.magicDamage += 0.15f; - player.manaCost *= 0.9f; - player.magicCrit += 5; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SigilofCalamitas"); - recipe.AddIngredient(ItemID.ManaFlower); - recipe.AddIngredient(null, "Phantoplasm", 20); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class EtherealTalisman : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ethereal Talisman"); + Tooltip.SetDefault("15% increased magic damage, 5% increased magic critical strike chance, and 10% decreased mana usage\n" + + "+150 max mana and reveals treasure locations\n" + + "Increases pickup range for mana stars and you restore mana when damaged\n" + + "You automatically use mana potions when needed\n" + + "Magic attacks have a chance to instantly kill normal enemies"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 90, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eTalisman = true; + player.findTreasure = true; + player.manaFlower = true; + player.magicCuffs = true; + player.manaMagnet = true; + player.statManaMax2 += 150; + player.magicDamage += 0.15f; + player.manaCost *= 0.9f; + player.magicCrit += 5; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SigilofCalamitas"); + recipe.AddIngredient(ItemID.ManaFlower); + recipe.AddIngredient(null, "Phantoplasm", 20); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 40594d7f24..233b32c009 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -1,62 +1,62 @@ -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.Accessories -{ - public class EyeoftheStorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eye of the Storm"); - Tooltip.SetDefault("Summons a cloud elemental to fight for you"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.elementalHeart) - { - return false; - } - return true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.cloudWaifu = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("CloudyWaifu")) == -1) - { - player.AddBuff(mod.BuffType("CloudyWaifu"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("CloudyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - } -} \ No newline at end of file +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.Accessories +{ + public class EyeoftheStorm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of the Storm"); + Tooltip.SetDefault("Summons a cloud elemental to fight for you"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.elementalHeart) + { + return false; + } + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.cloudWaifu = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("CloudyWaifu")) == -1) + { + player.AddBuff(mod.BuffType("CloudyWaifu"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("CloudyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + } +} diff --git a/Items/Accessories/FrigidBulwark.cs b/Items/Accessories/FrigidBulwark.cs index e45239cf28..23e5ff73c6 100644 --- a/Items/Accessories/FrigidBulwark.cs +++ b/Items/Accessories/FrigidBulwark.cs @@ -1,51 +1,51 @@ -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 -{ - public class FrigidBulwark : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frigid Bulwark"); - Tooltip.SetDefault("Absorbs 25% of damage done to players on your team\n" + - "Only active above 25% life\n" + - "Grants immunity to knockback\n" + - "Puts a shell around the owner when below 50% life that reduces damage\n" + - "The shell becomes more powerful when below 15% life and reduces damage even further"); - } - - public override void SetDefaults() - { - item.width = 38; - item.height = 44; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 9; - item.defense = 8; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fBulwark = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PaladinsShield); - recipe.AddIngredient(ItemID.FrozenTurtleShell); - recipe.AddIngredient(null, "CoreofEleum", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class FrigidBulwark : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frigid Bulwark"); + Tooltip.SetDefault("Absorbs 25% of damage done to players on your team\n" + + "Only active above 25% life\n" + + "Grants immunity to knockback\n" + + "Puts a shell around the owner when below 50% life that reduces damage\n" + + "The shell becomes more powerful when below 15% life and reduces damage even further"); + } + + public override void SetDefaults() + { + item.width = 38; + item.height = 44; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 9; + item.defense = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fBulwark = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PaladinsShield); + recipe.AddIngredient(ItemID.FrozenTurtleShell); + recipe.AddIngredient(null, "CoreofEleum", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/FrostBarrier.cs b/Items/Accessories/FrostBarrier.cs index 124d8a097d..be85bfbeaa 100644 --- a/Items/Accessories/FrostBarrier.cs +++ b/Items/Accessories/FrostBarrier.cs @@ -1,38 +1,38 @@ -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 -{ - public class FrostBarrier : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frost Barrier"); - Tooltip.SetDefault("You will freeze enemies near you when you are struck\n" + - "You are immune to the chilled debuff"); - } - - public override void SetDefaults() - { - item.defense = 4; - item.width = 20; - item.height = 24; - 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.fBarrier = true; - player.buffImmune[46] = true; - } - } -} \ No newline at end of file +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 +{ + public class FrostBarrier : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frost Barrier"); + Tooltip.SetDefault("You will freeze enemies near you when you are struck\n" + + "You are immune to the chilled debuff"); + } + + public override void SetDefaults() + { + item.defense = 4; + item.width = 20; + item.height = 24; + 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.fBarrier = true; + player.buffImmune[46] = true; + } + } +} diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs index 71979dfb6e..c39c9ee0f4 100644 --- a/Items/Accessories/FrostFlare.cs +++ b/Items/Accessories/FrostFlare.cs @@ -1,43 +1,43 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - public class FrostFlare : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frost Flare"); - Tooltip.SetDefault("All melee attacks and projectiles inflict frostburn\n" + - "Immunity to frostburn, chilled, and frozen\n" + - "Resistant to cold attacks and +1 life regen\n" + - "Being above 75% life grants the player 10% increased damage\n" + - "Being below 25% life grants the player 10 defense and 15% increased max movement speed and acceleration\n" + - "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 10)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 24; - item.lifeRegen = 1; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.frostFlare = true; - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + public class FrostFlare : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frost Flare"); + Tooltip.SetDefault("All melee attacks and projectiles inflict frostburn\n" + + "Immunity to frostburn, chilled, and frozen\n" + + "Resistant to cold attacks and +1 life regen\n" + + "Being above 75% life grants the player 10% increased damage\n" + + "Being below 25% life grants the player 10 defense and 15% increased max movement speed and acceleration\n" + + "Revengeance drop"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 10)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 24; + item.lifeRegen = 1; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.frostFlare = true; + } + } +} diff --git a/Items/Accessories/FungalCarapace.cs b/Items/Accessories/FungalCarapace.cs index 264df94a9a..df51d7e95c 100644 --- a/Items/Accessories/FungalCarapace.cs +++ b/Items/Accessories/FungalCarapace.cs @@ -1,36 +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 -{ - public class FungalCarapace : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fungal Carapace"); - Tooltip.SetDefault("You emit a mushroom spore explosion when you are hit"); - } - - public override void SetDefaults() - { - item.defense = 2; - item.width = 20; - item.height = 24; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fCarapace = true; - } - } -} \ No newline at end of file +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 +{ + public class FungalCarapace : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fungal Carapace"); + Tooltip.SetDefault("You emit a mushroom spore explosion when you are hit"); + } + + public override void SetDefaults() + { + item.defense = 2; + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fCarapace = true; + } + } +} diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index 50d639c197..3b910d5e57 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -1,38 +1,38 @@ -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 -{ - public class GiantShell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Giant Shell"); - Tooltip.SetDefault("15% reduced movement speed\n" + - "Taking a hit will make you move very fast for a short time"); - } - - public override void SetDefaults() - { - item.defense = 6; - item.width = 20; - item.height = 24; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 1; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.moveSpeed -= 0.15f; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.gShell = true; - } - } -} \ No newline at end of file +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 +{ + public class GiantShell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Giant Shell"); + Tooltip.SetDefault("15% reduced movement speed\n" + + "Taking a hit will make you move very fast for a short time"); + } + + public override void SetDefaults() + { + item.defense = 6; + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.moveSpeed -= 0.15f; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.gShell = true; + } + } +} diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index 30e0386fc9..2397fad9cc 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -1,38 +1,38 @@ -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 -{ - public class GiantTortoiseShell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Giant Tortoise Shell"); - Tooltip.SetDefault("10% reduced movement speed\n" + - "Enemies take damage when they hit you"); - } - - public override void SetDefaults() - { - item.defense = 8; - item.width = 20; - item.height = 24; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.moveSpeed -= 0.1f; - player.thorns = 0.25f; - } - } -} \ No newline at end of file +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 +{ + public class GiantTortoiseShell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Giant Tortoise Shell"); + Tooltip.SetDefault("10% reduced movement speed\n" + + "Enemies take damage when they hit you"); + } + + public override void SetDefaults() + { + item.defense = 8; + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 5; + item.accessory = true; + } + + 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/GoldBurdenBreaker.cs b/Items/Accessories/GoldBurdenBreaker.cs index 420f394801..cc87755f3a 100644 --- a/Items/Accessories/GoldBurdenBreaker.cs +++ b/Items/Accessories/GoldBurdenBreaker.cs @@ -1,73 +1,73 @@ -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.NPCs; - -namespace CalamityMod.Items.Accessories -{ - public class GoldBurdenBreaker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burden Breaker"); - Tooltip.SetDefault("The good time\nGo fast\nWARNING: May have disastrous results"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (CalamityGlobalNPC.AnyBossNPCS()) { return; } - if (player.velocity.X > 5f) - { - player.velocity.X *= 1.025f; - if (player.velocity.X >= 500f) - { - player.velocity.X = 0f; - } - } - else if (player.velocity.X < -5f) - { - player.velocity.X *= 1.025f; - if (player.velocity.X <= -500f) - { - player.velocity.X = 0f; - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 50); - recipe.AddIngredient(ItemID.GoldBar, 7); - recipe.AddIngredient(ItemID.SoulofMight); - recipe.AddIngredient(ItemID.SoulofSight); - recipe.AddIngredient(ItemID.SoulofFright); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bone, 50); - recipe.AddIngredient(ItemID.PlatinumBar, 7); - recipe.AddIngredient(ItemID.SoulofMight); - recipe.AddIngredient(ItemID.SoulofSight); - recipe.AddIngredient(ItemID.SoulofFright); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.NPCs; + +namespace CalamityMod.Items.Accessories +{ + public class GoldBurdenBreaker : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burden Breaker"); + Tooltip.SetDefault("The good time\nGo fast\nWARNING: May have disastrous results"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (CalamityGlobalNPC.AnyBossNPCS()) { return; } + if (player.velocity.X > 5f) + { + player.velocity.X *= 1.025f; + if (player.velocity.X >= 500f) + { + player.velocity.X = 0f; + } + } + else if (player.velocity.X < -5f) + { + player.velocity.X *= 1.025f; + if (player.velocity.X <= -500f) + { + player.velocity.X = 0f; + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 50); + recipe.AddIngredient(ItemID.GoldBar, 7); + recipe.AddIngredient(ItemID.SoulofMight); + recipe.AddIngredient(ItemID.SoulofSight); + recipe.AddIngredient(ItemID.SoulofFright); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bone, 50); + recipe.AddIngredient(ItemID.PlatinumBar, 7); + recipe.AddIngredient(ItemID.SoulofMight); + recipe.AddIngredient(ItemID.SoulofSight); + recipe.AddIngredient(ItemID.SoulofFright); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index 15743b2f59..01c53b10bd 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -1,56 +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.Accessories -{ - public class GrandGelatin : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grand Gelatin"); - Tooltip.SetDefault("10% increased movement speed\n" + - "100% increased jump speed\n" + - "+20 max life and mana\n" + - "Standing still boosts life and mana regen"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 24; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 6; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 1.0f; - player.statLifeMax2 += 20; - player.statManaMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.lifeRegen += 2; - player.manaRegenBonus += 2; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ManaJelly"); - recipe.AddIngredient(null, "LifeJelly"); - recipe.AddIngredient(null, "VitalJelly"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class GrandGelatin : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grand Gelatin"); + Tooltip.SetDefault("10% increased movement speed\n" + + "100% increased jump speed\n" + + "+20 max life and mana\n" + + "Standing still boosts life and mana regen"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 6; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 1.0f; + player.statLifeMax2 += 20; + player.statManaMax2 += 20; + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.lifeRegen += 2; + player.manaRegenBonus += 2; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ManaJelly"); + recipe.AddIngredient(null, "LifeJelly"); + recipe.AddIngredient(null, "VitalJelly"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index 81f0c29716..d02463093d 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -1,47 +1,47 @@ -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 -{ - public class HarpyRing : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Harpy Ring"); - Tooltip.SetDefault("Increased movement speed\n" + - "Boosts your maximum flight time by 25%"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 22; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 4; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.harpyRing = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 2); - recipe.AddIngredient(ItemID.Feather, 5); - recipe.AddIngredient(ItemID.FallenStar); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class HarpyRing : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Harpy Ring"); + Tooltip.SetDefault("Increased movement speed\n" + + "Boosts your maximum flight time by 25%"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 22; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 4; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.harpyRing = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 2); + recipe.AddIngredient(ItemID.Feather, 5); + recipe.AddIngredient(ItemID.FallenStar); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs index e4a9389bef..ad86a3add1 100644 --- a/Items/Accessories/HeartofDarkness.cs +++ b/Items/Accessories/HeartofDarkness.cs @@ -1,40 +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 -{ - public class HeartofDarkness : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heart of Darkness"); - Tooltip.SetDefault("Gives 10% increased damage while you have the heart attack debuff\n" + - "Increases your chance of getting the heart attack debuff\n" + - "Rage mode does more damage\n" + - "You gain rage over time\n" + - "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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.heartOfDarkness = true; - } - } -} \ No newline at end of file +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 +{ + public class HeartofDarkness : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heart of Darkness"); + Tooltip.SetDefault("Gives 10% increased damage while you have the heart attack debuff\n" + + "Increases your chance of getting the heart attack debuff\n" + + "Rage mode does more damage\n" + + "You gain rage over time\n" + + "Revengeance drop"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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.heartOfDarkness = true; + } + } +} diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 1d29417d22..8c17779d9a 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -1,240 +1,240 @@ -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.Items.CalamityCustomThrowingDamage; -using CalamityMod.World; - -namespace CalamityMod.Items.Accessories -{ - public class HeartoftheElements : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heart of the Elements"); - Tooltip.SetDefault("The heart of the world\n" + - "Increases max life by 20, life regen by 1, and all damage by 8%\n" + - "Increases movement speed by 10% and jump speed by 200%\n" + - "Increases damage reduction by 5%\n" + - "Increases max mana by 50 and reduces mana usage by 5%\n" + - "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt\n" + - "Summons all elementals to protect you\n" + - "Toggling the visibility of this accessory also toggles the elementals on and off\n" + - "Stat increases are slightly higher if the elementals are turned off"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 8)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 9; - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.brimstoneWaifu || modPlayer.sandWaifu || modPlayer.sandBoobWaifu || modPlayer.cloudWaifu || modPlayer.sirenWaifu) - { - return false; - } - return true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, ((float)Main.DiscoR / 255f), ((float)Main.DiscoG / 255f), ((float)Main.DiscoB / 255f)); - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.allWaifus = !hideVisual; - modPlayer.elementalHeart = true; - if (!hideVisual) - { - player.lifeRegen += 1; - player.statLifeMax2 += 20; - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 2.0f; - player.endurance += 0.05f; - player.statManaMax2 += 50; - player.manaCost *= 0.95f; - player.meleeDamage += 0.08f; - player.magicDamage += 0.08f; - player.rangedDamage += 0.08f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; - player.minionDamage += 0.08f; - int damage = NPC.downedMoonlord ? 150 : 90; - float damageMult = CalamityWorld.downedDoG ? 2f : 1f; - if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 1 || - player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 1 || - player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 1) - { - player.ClearBuff(mod.BuffType("HotE")); - } - if (player.FindBuffIndex(mod.BuffType("HotE")) == -1) - { - player.AddBuff(mod.BuffType("HotE"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("BigBustyRose"), (int)((float)damage * damageMult * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - if (player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SirenLure"), (int)((float)damage * damageMult * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - if (player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("DrewsSandyWaifu"), (int)((float)damage * damageMult * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - if (player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SandyWaifu"), (int)((float)damage * damageMult * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - if (player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("CloudyWaifu"), (int)((float)damage * damageMult * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - else - { - player.lifeRegen += 2; - player.statLifeMax2 += 25; - player.moveSpeed += 0.12f; - player.jumpSpeedBoost += 2.2f; - player.endurance += 0.06f; - player.statManaMax2 += 60; - player.manaCost *= 0.93f; - player.meleeDamage += 0.1f; - player.magicDamage += 0.1f; - player.rangedDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - player.minionDamage += 0.1f; - if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 0 || - player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 0 || - player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 0) - { - player.ClearBuff(mod.BuffType("HotE")); - } - } - if (player.velocity.Y == 0f && player.grappling[0] == -1) - { - int num4 = (int)player.Center.X / 16; - int num5 = (int)(player.position.Y + (float)player.height - 1f) / 16; - if (Main.tile[num4, num5] == null) - { - Main.tile[num4, num5] = new Tile(); - } - if (!Main.tile[num4, num5].active() && Main.tile[num4, num5].liquid == 0 && Main.tile[num4, num5 + 1] != null && WorldGen.SolidTile(num4, num5 + 1)) - { - Main.tile[num4, num5].frameY = 0; - Main.tile[num4, num5].slope(0); - Main.tile[num4, num5].halfBrick(false); - if (Main.tile[num4, num5 + 1].type == 0) - { - if (Main.rand.Next(1000) == 0) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 227; - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); - } - } - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - if (Main.tile[num4, num5 + 1].type == 2) - { - if (Main.rand.Next(2) == 0) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 3; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); - } - } - else - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 73; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); - } - } - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - else if (Main.tile[num4, num5 + 1].type == 109) - { - if (Main.rand.Next(2) == 0) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 110; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); - while (Main.tile[num4, num5].frameX == 90) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); - } - } - else - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 113; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); - while (Main.tile[num4, num5].frameX == 90) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); - } - } - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - else if (Main.tile[num4, num5 + 1].type == 60) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 74; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(9, 17)); - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WifeinaBottle"); - recipe.AddIngredient(null, "WifeinaBottlewithBoobs"); - recipe.AddIngredient(null, "LureofEnthrallment"); - recipe.AddIngredient(null, "EyeoftheStorm"); - recipe.AddIngredient(null, "RoseStone"); - recipe.AddIngredient(null, "AeroStone"); - recipe.AddIngredient(null, "CryoStone"); - recipe.AddIngredient(null, "ChaosStone"); - recipe.AddIngredient(null, "BloomStone"); - recipe.AddTile(TileID.LunarCraftingStation); - 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; +using CalamityMod.Items.CalamityCustomThrowingDamage; +using CalamityMod.World; + +namespace CalamityMod.Items.Accessories +{ + public class HeartoftheElements : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heart of the Elements"); + Tooltip.SetDefault("The heart of the world\n" + + "Increases max life by 20, life regen by 1, and all damage by 8%\n" + + "Increases movement speed by 10% and jump speed by 200%\n" + + "Increases damage reduction by 5%\n" + + "Increases max mana by 50 and reduces mana usage by 5%\n" + + "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt\n" + + "Summons all elementals to protect you\n" + + "Toggling the visibility of this accessory also toggles the elementals on and off\n" + + "Stat increases are slightly higher if the elementals are turned off"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 8)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 9; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.brimstoneWaifu || modPlayer.sandWaifu || modPlayer.sandBoobWaifu || modPlayer.cloudWaifu || modPlayer.sirenWaifu) + { + return false; + } + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, ((float)Main.DiscoR / 255f), ((float)Main.DiscoG / 255f), ((float)Main.DiscoB / 255f)); + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.allWaifus = !hideVisual; + modPlayer.elementalHeart = true; + if (!hideVisual) + { + player.lifeRegen += 1; + player.statLifeMax2 += 20; + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 2.0f; + player.endurance += 0.05f; + player.statManaMax2 += 50; + player.manaCost *= 0.95f; + player.meleeDamage += 0.08f; + player.magicDamage += 0.08f; + player.rangedDamage += 0.08f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; + player.minionDamage += 0.08f; + int damage = NPC.downedMoonlord ? 150 : 90; + float damageMult = CalamityWorld.downedDoG ? 2f : 1f; + if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 1 || + player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 1 || player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 1 || + player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 1) + { + player.ClearBuff(mod.BuffType("HotE")); + } + if (player.FindBuffIndex(mod.BuffType("HotE")) == -1) + { + player.AddBuff(mod.BuffType("HotE"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("BigBustyRose"), (int)((float)damage * damageMult * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + if (player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SirenLure"), (int)((float)damage * damageMult * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + if (player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("DrewsSandyWaifu"), (int)((float)damage * damageMult * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + if (player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SandyWaifu"), (int)((float)damage * damageMult * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + if (player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("CloudyWaifu"), (int)((float)damage * damageMult * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + else + { + player.lifeRegen += 2; + player.statLifeMax2 += 25; + player.moveSpeed += 0.12f; + player.jumpSpeedBoost += 2.2f; + player.endurance += 0.06f; + player.statManaMax2 += 60; + player.manaCost *= 0.93f; + player.meleeDamage += 0.1f; + player.magicDamage += 0.1f; + player.rangedDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + player.minionDamage += 0.1f; + if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] > 0 || + player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] > 0 || player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] > 0 || + player.ownedProjectileCounts[mod.ProjectileType("CloudyWaifu")] > 0) + { + player.ClearBuff(mod.BuffType("HotE")); + } + } + if (player.velocity.Y == 0f && player.grappling[0] == -1) + { + int num4 = (int)player.Center.X / 16; + int num5 = (int)(player.position.Y + (float)player.height - 1f) / 16; + if (Main.tile[num4, num5] == null) + { + Main.tile[num4, num5] = new Tile(); + } + if (!Main.tile[num4, num5].active() && Main.tile[num4, num5].liquid == 0 && Main.tile[num4, num5 + 1] != null && WorldGen.SolidTile(num4, num5 + 1)) + { + Main.tile[num4, num5].frameY = 0; + Main.tile[num4, num5].slope(0); + Main.tile[num4, num5].halfBrick(false); + if (Main.tile[num4, num5 + 1].type == 0) + { + if (Main.rand.Next(1000) == 0) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 227; + Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); + } + } + if (Main.netMode == 1) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + if (Main.tile[num4, num5 + 1].type == 2) + { + if (Main.rand.Next(2) == 0) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 3; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); + } + } + else + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 73; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); + } + } + if (Main.netMode == 1) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + else if (Main.tile[num4, num5 + 1].type == 109) + { + if (Main.rand.Next(2) == 0) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 110; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); + while (Main.tile[num4, num5].frameX == 90) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); + } + } + else + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 113; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); + while (Main.tile[num4, num5].frameX == 90) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); + } + } + if (Main.netMode == 1) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + else if (Main.tile[num4, num5 + 1].type == 60) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 74; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(9, 17)); + if (Main.netMode == 1) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WifeinaBottle"); + recipe.AddIngredient(null, "WifeinaBottlewithBoobs"); + recipe.AddIngredient(null, "LureofEnthrallment"); + recipe.AddIngredient(null, "EyeoftheStorm"); + recipe.AddIngredient(null, "RoseStone"); + recipe.AddIngredient(null, "AeroStone"); + recipe.AddIngredient(null, "CryoStone"); + recipe.AddIngredient(null, "ChaosStone"); + recipe.AddIngredient(null, "BloomStone"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs index 55c3f752c6..da0d768d32 100644 --- a/Items/Accessories/HoneyDew.cs +++ b/Items/Accessories/HoneyDew.cs @@ -1,68 +1,68 @@ -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 -{ - public class HoneyDew : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Honey Dew"); - Tooltip.SetDefault("5% increased damage reduction, +5 defense, and increased life regen while in the Jungle\n" + - "Poison and Venom immunity\n" + - "Honey-like life regen with no speed penalty\n" + - "Most bee/hornet enemies and projectiles do 75% damage to you"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 7; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.beeResist = true; - if (player.ZoneJungle) - { - player.lifeRegen += 1; - player.statDefense += 5; - player.endurance += 0.05f; - } - player.buffImmune[70] = true; - player.buffImmune[20] = true; - if (!player.honey && player.lifeRegen < 0) - { - player.lifeRegen += 2; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - } - player.lifeRegenTime += 1; - player.lifeRegen += 2; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "LivingDew"); - recipe.AddIngredient(ItemID.BottledHoney, 10); - recipe.AddIngredient(ItemID.BeeWax, 10); - recipe.AddIngredient(ItemID.Bezoar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class HoneyDew : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Honey Dew"); + Tooltip.SetDefault("5% increased damage reduction, +5 defense, and increased life regen while in the Jungle\n" + + "Poison and Venom immunity\n" + + "Honey-like life regen with no speed penalty\n" + + "Most bee/hornet enemies and projectiles do 75% damage to you"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 7; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.beeResist = true; + if (player.ZoneJungle) + { + player.lifeRegen += 1; + player.statDefense += 5; + player.endurance += 0.05f; + } + player.buffImmune[70] = true; + player.buffImmune[20] = true; + if (!player.honey && player.lifeRegen < 0) + { + player.lifeRegen += 2; + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + } + player.lifeRegenTime += 1; + player.lifeRegen += 2; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "LivingDew"); + recipe.AddIngredient(ItemID.BottledHoney, 10); + recipe.AddIngredient(ItemID.BeeWax, 10); + recipe.AddIngredient(ItemID.Bezoar); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index c34d04db4f..98b1a6889e 100644 --- a/Items/Accessories/Laudanum.cs +++ b/Items/Accessories/Laudanum.cs @@ -1,39 +1,39 @@ -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 -{ - public class Laudanum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laudanum"); - Tooltip.SetDefault("Boosts your damage by 6%,\n" + - "defense by 6, and max movement speed and acceleration by 5%\n" + - "Makes you immune to The Horror debuff\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - 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.laudanum = true; - player.buffImmune[mod.BuffType("Horror")] = true; - } - } -} \ No newline at end of file +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 +{ + public class Laudanum : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laudanum"); + Tooltip.SetDefault("Boosts your damage by 6%,\n" + + "defense by 6, and max movement speed and acceleration by 5%\n" + + "Makes you immune to The Horror debuff\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + 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.laudanum = true; + player.buffImmune[mod.BuffType("Horror")] = true; + } + } +} diff --git a/Items/Accessories/LeadCore.cs b/Items/Accessories/LeadCore.cs index 975d093661..17adb449a6 100644 --- a/Items/Accessories/LeadCore.cs +++ b/Items/Accessories/LeadCore.cs @@ -1,34 +1,34 @@ -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 -{ - public class LeadCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lead Core"); - Tooltip.SetDefault("Grants immunity to the acid rain debuff"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.rare = 2; - item.value = Item.buyPrice(0, 3, 0, 0); - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.buffImmune[mod.BuffType("Irradiated")] = true; - } - } -} \ No newline at end of file +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 +{ + public class LeadCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lead Core"); + Tooltip.SetDefault("Grants immunity to the acid rain debuff"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.rare = 2; + item.value = Item.buyPrice(0, 3, 0, 0); + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.buffImmune[mod.BuffType("Irradiated")] = true; + } + } +} diff --git a/Items/Accessories/LifeJelly.cs b/Items/Accessories/LifeJelly.cs index a9cb2b94a3..a6bf0d8a56 100644 --- a/Items/Accessories/LifeJelly.cs +++ b/Items/Accessories/LifeJelly.cs @@ -1,39 +1,39 @@ -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 -{ - public class LifeJelly : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Life Jelly"); - Tooltip.SetDefault("+20 max life\n" + - "Standing still boosts life regen"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 24; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.statLifeMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.lifeRegen += 2; - } - } - } -} \ No newline at end of file +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 +{ + public class LifeJelly : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Life Jelly"); + Tooltip.SetDefault("+20 max life\n" + + "Standing still boosts life regen"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.statLifeMax2 += 20; + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.lifeRegen += 2; + } + } + } +} diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index bba4c6ca70..6269909d43 100644 --- a/Items/Accessories/LivingDew.cs +++ b/Items/Accessories/LivingDew.cs @@ -1,52 +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.Accessories -{ - public class LivingDew : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Living Dew"); - Tooltip.SetDefault("5% increased damage reduction, +5 defense, and increased life regen while in the Jungle"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.ZoneJungle) - { - player.lifeRegen += 1; - player.statDefense += 5; - player.endurance += 0.05f; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ManeaterBulb", 2); - recipe.AddIngredient(null, "TrapperBulb", 2); - recipe.AddIngredient(null, "MurkyPaste", 5); - recipe.AddIngredient(null, "GypsyPowder"); - recipe.AddIngredient(null, "BeetleJuice", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class LivingDew : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Living Dew"); + Tooltip.SetDefault("5% increased damage reduction, +5 defense, and increased life regen while in the Jungle"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.ZoneJungle) + { + player.lifeRegen += 1; + player.statDefense += 5; + player.endurance += 0.05f; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ManeaterBulb", 2); + recipe.AddIngredient(null, "TrapperBulb", 2); + recipe.AddIngredient(null, "MurkyPaste", 5); + recipe.AddIngredient(null, "GypsyPowder"); + recipe.AddIngredient(null, "BeetleJuice", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/MagicLevelMeter.cs b/Items/Accessories/MagicLevelMeter.cs index 8e83020e4b..09782532ec 100644 --- a/Items/Accessories/MagicLevelMeter.cs +++ b/Items/Accessories/MagicLevelMeter.cs @@ -1,133 +1,133 @@ -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 -{ - public class MagicLevelMeter : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magic Level Meter"); - Tooltip.SetDefault("Tells you how high your magic proficiency is"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - int level = Main.player[Main.myPlayer].GetModPlayer(mod).magicLevel; - int exactLevel = Main.player[Main.myPlayer].GetModPlayer(mod).exactMagicLevel; - int damageGain = 0; - int manaUsage = 0; - int critGain = 0; - switch (exactLevel) - { - case 0: - break; - case 1: - damageGain = 1; - break; - case 2: - damageGain = 2; - break; - case 3: - damageGain = 2; - manaUsage = 1; - break; - case 4: - damageGain = 3; - manaUsage = 1; - critGain = 1; - break; - case 5: - damageGain = 3; - manaUsage = 2; - critGain = 1; - break; - case 6: - damageGain = 4; - manaUsage = 3; - critGain = 1; - break; - case 7: - damageGain = 4; - manaUsage = 4; - critGain = 2; - break; - case 8: - damageGain = 5; - manaUsage = 5; - critGain = 2; - break; - case 9: - damageGain = 5; - manaUsage = 5; - critGain = 3; - break; - case 10: - damageGain = 6; - manaUsage = 6; - critGain = 3; - break; - case 11: - damageGain = 7; - manaUsage = 7; - critGain = 4; - break; - case 12: - damageGain = 8; - manaUsage = 8; - critGain = 4; - break; - case 13: - damageGain = 9; - manaUsage = 9; - critGain = 5; - break; - case 14: - damageGain = 10; - manaUsage = 10; - critGain = 5; - break; - case 15: - damageGain = 12; - manaUsage = 12; - critGain = 6; - break; - } - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Tells you how high your magic proficiency is\n" + - "While equipped you will gain magic proficiency faster\n" + - "The higher your magic level the higher your magic damage, critical strike chance, and the lower your mana cost\n" + - "Magic proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + - "Magic level (max of 15): " + exactLevel + "\n" + - "Magic damage increase: " + damageGain + "%\n" + - "Mana usage decrease: " + manaUsage + "%\n" + - "Magic crit increase: " + critGain + "%"; - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fasterMagicLevel = true; - } - } -} \ No newline at end of file +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 +{ + public class MagicLevelMeter : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magic Level Meter"); + Tooltip.SetDefault("Tells you how high your magic proficiency is"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + int level = Main.player[Main.myPlayer].GetModPlayer(mod).magicLevel; + int exactLevel = Main.player[Main.myPlayer].GetModPlayer(mod).exactMagicLevel; + int damageGain = 0; + int manaUsage = 0; + int critGain = 0; + switch (exactLevel) + { + case 0: + break; + case 1: + damageGain = 1; + break; + case 2: + damageGain = 2; + break; + case 3: + damageGain = 2; + manaUsage = 1; + break; + case 4: + damageGain = 3; + manaUsage = 1; + critGain = 1; + break; + case 5: + damageGain = 3; + manaUsage = 2; + critGain = 1; + break; + case 6: + damageGain = 4; + manaUsage = 3; + critGain = 1; + break; + case 7: + damageGain = 4; + manaUsage = 4; + critGain = 2; + break; + case 8: + damageGain = 5; + manaUsage = 5; + critGain = 2; + break; + case 9: + damageGain = 5; + manaUsage = 5; + critGain = 3; + break; + case 10: + damageGain = 6; + manaUsage = 6; + critGain = 3; + break; + case 11: + damageGain = 7; + manaUsage = 7; + critGain = 4; + break; + case 12: + damageGain = 8; + manaUsage = 8; + critGain = 4; + break; + case 13: + damageGain = 9; + manaUsage = 9; + critGain = 5; + break; + case 14: + damageGain = 10; + manaUsage = 10; + critGain = 5; + break; + case 15: + damageGain = 12; + manaUsage = 12; + critGain = 6; + break; + } + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Tells you how high your magic proficiency is\n" + + "While equipped you will gain magic proficiency faster\n" + + "The higher your magic level the higher your magic damage, critical strike chance, and the lower your mana cost\n" + + "Magic proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + + "Magic level (max of 15): " + exactLevel + "\n" + + "Magic damage increase: " + damageGain + "%\n" + + "Mana usage decrease: " + manaUsage + "%\n" + + "Magic crit increase: " + critGain + "%"; + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fasterMagicLevel = true; + } + } +} diff --git a/Items/Accessories/ManaJelly.cs b/Items/Accessories/ManaJelly.cs index c29686aef7..f537fd9086 100644 --- a/Items/Accessories/ManaJelly.cs +++ b/Items/Accessories/ManaJelly.cs @@ -1,39 +1,39 @@ -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 -{ - public class ManaJelly : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mana Jelly"); - Tooltip.SetDefault("+20 max mana\n" + - "Standing still boosts mana regen"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 24; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.statManaMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.manaRegenBonus += 2; - } - } - } -} \ No newline at end of file +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 +{ + public class ManaJelly : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mana Jelly"); + Tooltip.SetDefault("+20 max mana\n" + + "Standing still boosts mana regen"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.statManaMax2 += 20; + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.manaRegenBonus += 2; + } + } + } +} diff --git a/Items/Accessories/MeleeLevelMeter.cs b/Items/Accessories/MeleeLevelMeter.cs index b05f36a5a8..a0f03f3261 100644 --- a/Items/Accessories/MeleeLevelMeter.cs +++ b/Items/Accessories/MeleeLevelMeter.cs @@ -1,133 +1,133 @@ -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 -{ - public class MeleeLevelMeter : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Melee Level Meter"); - Tooltip.SetDefault("Tells you how high your melee proficiency is"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - int level = Main.player[Main.myPlayer].GetModPlayer(mod).meleeLevel; - int exactLevel = Main.player[Main.myPlayer].GetModPlayer(mod).exactMeleeLevel; - int damageGain = 0; - int meleeSpeed = 0; - int critGain = 0; - switch (exactLevel) - { - case 0: - break; - case 1: - damageGain = 1; - break; - case 2: - damageGain = 2; - break; - case 3: - damageGain = 2; - meleeSpeed = 1; - break; - case 4: - damageGain = 3; - meleeSpeed = 1; - critGain = 1; - break; - case 5: - damageGain = 3; - meleeSpeed = 2; - critGain = 1; - break; - case 6: - damageGain = 4; - meleeSpeed = 3; - critGain = 1; - break; - case 7: - damageGain = 4; - meleeSpeed = 4; - critGain = 2; - break; - case 8: - damageGain = 5; - meleeSpeed = 5; - critGain = 2; - break; - case 9: - damageGain = 5; - meleeSpeed = 5; - critGain = 3; - break; - case 10: - damageGain = 6; - meleeSpeed = 6; - critGain = 3; - break; - case 11: - damageGain = 7; - meleeSpeed = 7; - critGain = 4; - break; - case 12: - damageGain = 8; - meleeSpeed = 8; - critGain = 4; - break; - case 13: - damageGain = 9; - meleeSpeed = 9; - critGain = 5; - break; - case 14: - damageGain = 10; - meleeSpeed = 10; - critGain = 5; - break; - case 15: - damageGain = 12; - meleeSpeed = 12; - critGain = 6; - break; - } - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Tells you how high your melee proficiency is\n" + - "While equipped you will gain melee proficiency faster\n" + - "The higher your melee level the higher your melee damage, speed, and critical strike chance\n" + - "Melee proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + - "Melee level (max of 15): " + exactLevel + "\n" + - "Melee damage increase: " + damageGain + "%\n" + - "Melee speed increase: " + meleeSpeed + "%\n" + - "Melee crit increase: " + critGain + "%"; - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fasterMeleeLevel = true; - } - } -} \ No newline at end of file +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 +{ + public class MeleeLevelMeter : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Melee Level Meter"); + Tooltip.SetDefault("Tells you how high your melee proficiency is"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + int level = Main.player[Main.myPlayer].GetModPlayer(mod).meleeLevel; + int exactLevel = Main.player[Main.myPlayer].GetModPlayer(mod).exactMeleeLevel; + int damageGain = 0; + int meleeSpeed = 0; + int critGain = 0; + switch (exactLevel) + { + case 0: + break; + case 1: + damageGain = 1; + break; + case 2: + damageGain = 2; + break; + case 3: + damageGain = 2; + meleeSpeed = 1; + break; + case 4: + damageGain = 3; + meleeSpeed = 1; + critGain = 1; + break; + case 5: + damageGain = 3; + meleeSpeed = 2; + critGain = 1; + break; + case 6: + damageGain = 4; + meleeSpeed = 3; + critGain = 1; + break; + case 7: + damageGain = 4; + meleeSpeed = 4; + critGain = 2; + break; + case 8: + damageGain = 5; + meleeSpeed = 5; + critGain = 2; + break; + case 9: + damageGain = 5; + meleeSpeed = 5; + critGain = 3; + break; + case 10: + damageGain = 6; + meleeSpeed = 6; + critGain = 3; + break; + case 11: + damageGain = 7; + meleeSpeed = 7; + critGain = 4; + break; + case 12: + damageGain = 8; + meleeSpeed = 8; + critGain = 4; + break; + case 13: + damageGain = 9; + meleeSpeed = 9; + critGain = 5; + break; + case 14: + damageGain = 10; + meleeSpeed = 10; + critGain = 5; + break; + case 15: + damageGain = 12; + meleeSpeed = 12; + critGain = 6; + break; + } + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Tells you how high your melee proficiency is\n" + + "While equipped you will gain melee proficiency faster\n" + + "The higher your melee level the higher your melee damage, speed, and critical strike chance\n" + + "Melee proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + + "Melee level (max of 15): " + exactLevel + "\n" + + "Melee damage increase: " + damageGain + "%\n" + + "Melee speed increase: " + meleeSpeed + "%\n" + + "Melee crit increase: " + critGain + "%"; + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fasterMeleeLevel = true; + } + } +} diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 0bc64d4169..8353c36065 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -1,60 +1,60 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - public class Nanotech : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanotech"); - Tooltip.SetDefault("Rogue projectiles create nanoblades as they travel\n" + - "Rogue weapons have a chance to instantly kill normal enemies\n" + - "10% increased rogue damage, 5% increased rogue crit chance, and 15% increased rogue velocity\n" + - "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 25%"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.nanotech = true; - modPlayer.raiderTalisman = true; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.15f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "RogueEmblem"); - recipe.AddIngredient(null, "RaidersTalisman"); - recipe.AddIngredient(ItemID.MartianConduitPlating, 250); - recipe.AddIngredient(ItemID.Nanites, 500); - recipe.AddIngredient(null, "Phantoplasm", 20); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + public class Nanotech : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanotech"); + Tooltip.SetDefault("Rogue projectiles create nanoblades as they travel\n" + + "Rogue weapons have a chance to instantly kill normal enemies\n" + + "10% increased rogue damage, 5% increased rogue crit chance, and 15% increased rogue velocity\n" + + "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 25%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 90, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.nanotech = true; + modPlayer.raiderTalisman = true; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.15f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "RogueEmblem"); + recipe.AddIngredient(null, "RaidersTalisman"); + recipe.AddIngredient(ItemID.MartianConduitPlating, 250); + recipe.AddIngredient(ItemID.Nanites, 500); + recipe.AddIngredient(null, "Phantoplasm", 20); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index 666b924e94..dfa3bb020e 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.cs @@ -1,47 +1,47 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - public class NecklaceofVexation : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Necklace of Vexation"); - Tooltip.SetDefault("Revenge\n" + - "15% increased damage when under 50% life"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - 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.vexation = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 2); - recipe.AddIngredient(ItemID.AvengerEmblem); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + public class NecklaceofVexation : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Necklace of Vexation"); + Tooltip.SetDefault("Revenge\n" + + "15% increased damage when under 50% life"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + 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.vexation = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 2); + recipe.AddIngredient(ItemID.AvengerEmblem); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index b28e4e1794..41cac0923c 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -1,39 +1,39 @@ -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 -{ - public class OrnateShield : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ornate Shield"); - } - - public override void SetDefaults() - { - item.width = 36; - item.height = 32; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 5; - item.defense = 8; - item.accessory = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 5); - recipe.AddIngredient(ItemID.CrystalShard, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class OrnateShield : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ornate Shield"); + } + + public override void SetDefaults() + { + item.width = 36; + item.height = 32; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 5; + item.defense = 8; + item.accessory = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 5); + recipe.AddIngredient(ItemID.CrystalShard, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index 8933c3e237..e34d0f6269 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -1,95 +1,95 @@ -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 -{ - public class PlagueHive : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Hive"); - Tooltip.SetDefault("Summons a damaging plague aura around the player to destroy nearby enemies\n" + - "Releases bees when damaged\n" + - "Friendly bees inflict the plague\n" + - "All of your attacks inflict the plague\n" + - "Makes you immune to the plague\n" + - "Projectiles spawn plague seekers on enemy hits\n" + - "The power of your bees and wasps will rival the Moon Lord himself"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 38; - item.value = Item.buyPrice(0, 60, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ToxicHeart"); - recipe.AddIngredient(null, "AlchemicalFlask"); - recipe.AddIngredient(ItemID.HiveBackpack); - recipe.AddIngredient(ItemID.HoneyComb); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.buffImmune[mod.BuffType("Plague")] = true; - player.bee = true; - modPlayer.uberBees = true; - player.strongBees = true; - modPlayer.alchFlask = true; - int plagueCounter = 0; - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.1f, 2f, 0.2f); - int num = mod.BuffType("Plague"); - float num2 = 300f; - bool flag = plagueCounter % 60 == 0; - int num3 = 60; - int random = Main.rand.Next(10); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (nPC.FindBuffIndex(num) == -1) - { - nPC.AddBuff(num, 120, false); - } - if (flag) - { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != 0) - { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - plagueCounter++; - if (plagueCounter >= 180) - { - plagueCounter = 0; - } - } - } -} \ No newline at end of file +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 +{ + public class PlagueHive : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Hive"); + Tooltip.SetDefault("Summons a damaging plague aura around the player to destroy nearby enemies\n" + + "Releases bees when damaged\n" + + "Friendly bees inflict the plague\n" + + "All of your attacks inflict the plague\n" + + "Makes you immune to the plague\n" + + "Projectiles spawn plague seekers on enemy hits\n" + + "The power of your bees and wasps will rival the Moon Lord himself"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 38; + item.value = Item.buyPrice(0, 60, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ToxicHeart"); + recipe.AddIngredient(null, "AlchemicalFlask"); + recipe.AddIngredient(ItemID.HiveBackpack); + recipe.AddIngredient(ItemID.HoneyComb); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.buffImmune[mod.BuffType("Plague")] = true; + player.bee = true; + modPlayer.uberBees = true; + player.strongBees = true; + modPlayer.alchFlask = true; + int plagueCounter = 0; + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.1f, 2f, 0.2f); + int num = mod.BuffType("Plague"); + float num2 = 300f; + bool flag = plagueCounter % 60 == 0; + int num3 = 60; + int random = Main.rand.Next(10); + if (player.whoAmI == Main.myPlayer) + { + if (random == 0) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1) + { + nPC.AddBuff(num, 120, false); + } + if (flag) + { + nPC.StrikeNPC(num3, 0f, 0, false, false, false); + if (Main.netMode != 0) + { + NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + plagueCounter++; + if (plagueCounter >= 180) + { + plagueCounter = 0; + } + } + } +} diff --git a/Items/Accessories/PsychoticAmulet.cs b/Items/Accessories/PsychoticAmulet.cs index 3f083f9b5f..9eddc939b4 100644 --- a/Items/Accessories/PsychoticAmulet.cs +++ b/Items/Accessories/PsychoticAmulet.cs @@ -1,43 +1,43 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - 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 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 +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + 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 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; + } + } +} diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs index f68bcd8be7..5abba6b93e 100644 --- a/Items/Accessories/RadiantOoze.cs +++ b/Items/Accessories/RadiantOoze.cs @@ -1,48 +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.Accessories -{ - public class RadiantOoze : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Radiant Ooze"); - Tooltip.SetDefault("You emit light and regen life more quickly at night"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (!Main.dayTime) - { - 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.lifeRegen += 1; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MurkySludge", 5); - recipe.AddIngredient(null, "PurifiedGel", 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class RadiantOoze : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Radiant Ooze"); + Tooltip.SetDefault("You emit light and regen life more quickly at night"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (!Main.dayTime) + { + 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.lifeRegen += 1; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MurkySludge", 5); + recipe.AddIngredient(null, "PurifiedGel", 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index ce7b893d10..422510586d 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -1,47 +1,47 @@ -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 -{ - public class RaidersTalisman : ModItem - { - public override void SetStaticDefaults() - { - 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 25%"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 2; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.raiderTalisman = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Leather, 5); - recipe.AddIngredient(ItemID.Obsidian, 20); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class RaidersTalisman : ModItem + { + public override void SetStaticDefaults() + { + 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 25%"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 2; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.raiderTalisman = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Leather, 5); + recipe.AddIngredient(ItemID.Obsidian, 20); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 22ea150556..ef26404bba 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -1,57 +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.Accessories -{ - public class RampartofDeities : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rampart of Deities"); - Tooltip.SetDefault("Taking damage makes you move very fast for a short time\n" + - "Increases armor penetration by 50 and immune time after being struck\n" + - "Provides light underwater and causes stars to fall when damaged\n" + - "Absorbs 25% of damage done to players on your team\n" + - "Only active above 25% life\n" + - "Grants immunity to knockback and reduces the cooldown of healing potions\n" + - "Puts a shell around the owner when below 50% life that reduces damage\n" + - "The shell becomes more powerful when below 15% life and reduces damage even further"); - } - - public override void SetDefaults() - { - item.width = 38; - item.height = 44; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 12; - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.dAmulet = true; - modPlayer.rampartOfDeities = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FrigidBulwark"); - recipe.AddIngredient(null, "DeificAmulet"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "DivineGeode", 10); - recipe.AddIngredient(null, "CosmiliteBar", 20); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class RampartofDeities : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rampart of Deities"); + Tooltip.SetDefault("Taking damage makes you move very fast for a short time\n" + + "Increases armor penetration by 50 and immune time after being struck\n" + + "Provides light underwater and causes stars to fall when damaged\n" + + "Absorbs 25% of damage done to players on your team\n" + + "Only active above 25% life\n" + + "Grants immunity to knockback and reduces the cooldown of healing potions\n" + + "Puts a shell around the owner when below 50% life that reduces damage\n" + + "The shell becomes more powerful when below 15% life and reduces damage even further"); + } + + public override void SetDefaults() + { + item.width = 38; + item.height = 44; + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 12; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.dAmulet = true; + modPlayer.rampartOfDeities = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FrigidBulwark"); + recipe.AddIngredient(null, "DeificAmulet"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "DivineGeode", 10); + recipe.AddIngredient(null, "CosmiliteBar", 20); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/RangedLevelMeter.cs b/Items/Accessories/RangedLevelMeter.cs index 682658a5a1..ab3d7454ff 100644 --- a/Items/Accessories/RangedLevelMeter.cs +++ b/Items/Accessories/RangedLevelMeter.cs @@ -1,133 +1,133 @@ -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 -{ - public class RangedLevelMeter : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ranged Level Meter"); - Tooltip.SetDefault("Tells you how high your ranged proficiency is"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - int level = Main.player[Main.myPlayer].GetModPlayer(mod).rangedLevel; - int exactLevel = Main.player[Main.myPlayer].GetModPlayer(mod).exactRangedLevel; - int damageGain = 0; - int moveSpeed = 0; - int critGain = 0; - switch (exactLevel) - { - case 0: - break; - case 1: - damageGain = 1; - break; - case 2: - damageGain = 2; - break; - case 3: - damageGain = 2; - critGain = 1; - break; - case 4: - damageGain = 3; - critGain = 1; - moveSpeed = 1; - break; - case 5: - damageGain = 3; - moveSpeed = 2; - critGain = 1; - break; - case 6: - damageGain = 4; - moveSpeed = 3; - critGain = 1; - break; - case 7: - damageGain = 4; - moveSpeed = 4; - critGain = 2; - break; - case 8: - damageGain = 5; - moveSpeed = 5; - critGain = 2; - break; - case 9: - damageGain = 5; - moveSpeed = 5; - critGain = 3; - break; - case 10: - damageGain = 6; - moveSpeed = 6; - critGain = 3; - break; - case 11: - damageGain = 7; - moveSpeed = 7; - critGain = 4; - break; - case 12: - damageGain = 8; - moveSpeed = 8; - critGain = 4; - break; - case 13: - damageGain = 9; - moveSpeed = 9; - critGain = 5; - break; - case 14: - damageGain = 10; - moveSpeed = 10; - critGain = 5; - break; - case 15: - damageGain = 12; - moveSpeed = 12; - critGain = 6; - break; - } - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Tells you how high your ranged proficiency is\n" + - "While equipped you will gain ranged proficiency faster\n" + - "The higher your ranged level the higher your ranged damage, critical strike chance, and movement speed\n" + - "Ranged proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + - "Ranged level (max of 15): " + exactLevel + "\n" + - "Ranged damage increase: " + damageGain + "%\n" + - "Movement speed increase: " + moveSpeed + "%\n" + - "Ranged crit increase: " + critGain + "%"; - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fasterRangedLevel = true; - } - } -} \ No newline at end of file +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 +{ + public class RangedLevelMeter : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ranged Level Meter"); + Tooltip.SetDefault("Tells you how high your ranged proficiency is"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + int level = Main.player[Main.myPlayer].GetModPlayer(mod).rangedLevel; + int exactLevel = Main.player[Main.myPlayer].GetModPlayer(mod).exactRangedLevel; + int damageGain = 0; + int moveSpeed = 0; + int critGain = 0; + switch (exactLevel) + { + case 0: + break; + case 1: + damageGain = 1; + break; + case 2: + damageGain = 2; + break; + case 3: + damageGain = 2; + critGain = 1; + break; + case 4: + damageGain = 3; + critGain = 1; + moveSpeed = 1; + break; + case 5: + damageGain = 3; + moveSpeed = 2; + critGain = 1; + break; + case 6: + damageGain = 4; + moveSpeed = 3; + critGain = 1; + break; + case 7: + damageGain = 4; + moveSpeed = 4; + critGain = 2; + break; + case 8: + damageGain = 5; + moveSpeed = 5; + critGain = 2; + break; + case 9: + damageGain = 5; + moveSpeed = 5; + critGain = 3; + break; + case 10: + damageGain = 6; + moveSpeed = 6; + critGain = 3; + break; + case 11: + damageGain = 7; + moveSpeed = 7; + critGain = 4; + break; + case 12: + damageGain = 8; + moveSpeed = 8; + critGain = 4; + break; + case 13: + damageGain = 9; + moveSpeed = 9; + critGain = 5; + break; + case 14: + damageGain = 10; + moveSpeed = 10; + critGain = 5; + break; + case 15: + damageGain = 12; + moveSpeed = 12; + critGain = 6; + break; + } + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Tells you how high your ranged proficiency is\n" + + "While equipped you will gain ranged proficiency faster\n" + + "The higher your ranged level the higher your ranged damage, critical strike chance, and movement speed\n" + + "Ranged proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + + "Ranged level (max of 15): " + exactLevel + "\n" + + "Ranged damage increase: " + damageGain + "%\n" + + "Movement speed increase: " + moveSpeed + "%\n" + + "Ranged crit increase: " + critGain + "%"; + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fasterRangedLevel = true; + } + } +} diff --git a/Items/Accessories/RareVariants/DeepDiver.cs b/Items/Accessories/RareVariants/DeepDiver.cs index fad81bf6e2..95330dbdb0 100644 --- a/Items/Accessories/RareVariants/DeepDiver.cs +++ b/Items/Accessories/RareVariants/DeepDiver.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.Accessories.RareVariants } } } -} \ No newline at end of file +} diff --git a/Items/Accessories/RareVariants/FabledTortoiseShell.cs b/Items/Accessories/RareVariants/FabledTortoiseShell.cs index a01ef497f7..44d264c12c 100644 --- a/Items/Accessories/RareVariants/FabledTortoiseShell.cs +++ b/Items/Accessories/RareVariants/FabledTortoiseShell.cs @@ -38,4 +38,4 @@ namespace CalamityMod.Items.Accessories.RareVariants player.thorns = 0.25f; } } -} \ No newline at end of file +} diff --git a/Items/Accessories/RareVariants/HideofAstrumDeus.cs b/Items/Accessories/RareVariants/HideofAstrumDeus.cs index 64e6203a94..94865837d4 100644 --- a/Items/Accessories/RareVariants/HideofAstrumDeus.cs +++ b/Items/Accessories/RareVariants/HideofAstrumDeus.cs @@ -42,4 +42,4 @@ namespace CalamityMod.Items.Accessories.RareVariants player.thorns += 0.75f; } } -} \ No newline at end of file +} diff --git a/Items/Accessories/RareVariants/Regenator.cs b/Items/Accessories/RareVariants/Regenator.cs index fccfdb9191..cdb2e19ecd 100644 --- a/Items/Accessories/RareVariants/Regenator.cs +++ b/Items/Accessories/RareVariants/Regenator.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Accessories.RareVariants modPlayer.regenator = true; } } -} \ No newline at end of file +} diff --git a/Items/Accessories/RareVariants/SamuraiBadge.cs b/Items/Accessories/RareVariants/SamuraiBadge.cs index 0e0d7047e7..e0957b25e5 100644 --- a/Items/Accessories/RareVariants/SamuraiBadge.cs +++ b/Items/Accessories/RareVariants/SamuraiBadge.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Accessories.RareVariants modPlayer.badgeOfBraveryRare = true; } } -} \ No newline at end of file +} diff --git a/Items/Accessories/RareVariants/TheBee.cs b/Items/Accessories/RareVariants/TheBee.cs index c15cc84493..d2fbeefca2 100644 --- a/Items/Accessories/RareVariants/TheBee.cs +++ b/Items/Accessories/RareVariants/TheBee.cs @@ -38,4 +38,4 @@ namespace CalamityMod.Items.Accessories.RareVariants modPlayer.theBee = true; } } -} \ No newline at end of file +} diff --git a/Items/Accessories/RareVariants/TheEvolution.cs b/Items/Accessories/RareVariants/TheEvolution.cs index 49f92741e0..6e2955cef2 100644 --- a/Items/Accessories/RareVariants/TheEvolution.cs +++ b/Items/Accessories/RareVariants/TheEvolution.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Accessories.RareVariants modPlayer.projRefRare = true; } } -} \ No newline at end of file +} diff --git a/Items/Accessories/RareVariants/TheTransformer.cs b/Items/Accessories/RareVariants/TheTransformer.cs index 9b41d24cba..eb836b654c 100644 --- a/Items/Accessories/RareVariants/TheTransformer.cs +++ b/Items/Accessories/RareVariants/TheTransformer.cs @@ -37,4 +37,4 @@ namespace CalamityMod.Items.Accessories.RareVariants modPlayer.aSpark = true; } } -} \ No newline at end of file +} diff --git a/Items/Accessories/RogueEmblem.cs b/Items/Accessories/RogueEmblem.cs index 8636360c8e..da056ebe7b 100644 --- a/Items/Accessories/RogueEmblem.cs +++ b/Items/Accessories/RogueEmblem.cs @@ -1,35 +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.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - public class RogueEmblem : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rogue Emblem"); - Tooltip.SetDefault("15% increased rogue damage"); - } - - public override void SetDefaults() - { - item.width = 24; - item.height = 24; - item.value = 100000; - item.rare = 4; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityCustomThrowingDamagePlayer modPlayer2 = CalamityCustomThrowingDamagePlayer.ModPlayer(player); - modPlayer2.throwingDamage += 0.15f; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + public class RogueEmblem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rogue Emblem"); + Tooltip.SetDefault("15% increased rogue damage"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 24; + item.value = 100000; + item.rare = 4; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityCustomThrowingDamagePlayer modPlayer2 = CalamityCustomThrowingDamagePlayer.ModPlayer(player); + modPlayer2.throwingDamage += 0.15f; + } + } +} diff --git a/Items/Accessories/RogueLevelMeter.cs b/Items/Accessories/RogueLevelMeter.cs index 1c0b78dabc..3812614976 100644 --- a/Items/Accessories/RogueLevelMeter.cs +++ b/Items/Accessories/RogueLevelMeter.cs @@ -1,133 +1,133 @@ -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 -{ - public class RogueLevelMeter : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rogue Level Meter"); - Tooltip.SetDefault("Tells you how high your rogue proficiency is"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - int level = Main.player[Main.myPlayer].GetModPlayer(mod).rogueLevel; - int exactLevel = Main.player[Main.myPlayer].GetModPlayer(mod).exactRogueLevel; - int damageGain = 0; - int velocityGain = 0; - int critGain = 0; - switch (exactLevel) - { - case 0: - break; - case 1: - damageGain = 1; - break; - case 2: - damageGain = 2; - break; - case 3: - damageGain = 2; - velocityGain = 1; - break; - case 4: - damageGain = 3; - critGain = 1; - velocityGain = 1; - break; - case 5: - damageGain = 3; - velocityGain = 2; - critGain = 1; - break; - case 6: - damageGain = 4; - velocityGain = 3; - critGain = 1; - break; - case 7: - damageGain = 4; - velocityGain = 4; - critGain = 2; - break; - case 8: - damageGain = 5; - velocityGain = 5; - critGain = 2; - break; - case 9: - damageGain = 5; - velocityGain = 5; - critGain = 3; - break; - case 10: - damageGain = 6; - velocityGain = 6; - critGain = 3; - break; - case 11: - damageGain = 7; - velocityGain = 7; - critGain = 4; - break; - case 12: - damageGain = 8; - velocityGain = 8; - critGain = 4; - break; - case 13: - damageGain = 9; - velocityGain = 9; - critGain = 5; - break; - case 14: - damageGain = 10; - velocityGain = 10; - critGain = 5; - break; - case 15: - damageGain = 12; - velocityGain = 12; - critGain = 6; - break; - } - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Tells you how high your rogue proficiency is\n" + - "While equipped you will gain rogue proficiency faster\n" + - "The higher your rogue level the higher your rogue damage, critical strike chance, and velocity\n" + - "Rogue proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + - "Rogue level (max of 15): " + exactLevel + "\n" + - "Rogue damage increase: " + damageGain + "%\n" + - "Rogue velocity increase: " + velocityGain + "%\n" + - "Rogue crit increase: " + critGain + "%"; - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fasterRogueLevel = true; - } - } -} \ No newline at end of file +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 +{ + public class RogueLevelMeter : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rogue Level Meter"); + Tooltip.SetDefault("Tells you how high your rogue proficiency is"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + int level = Main.player[Main.myPlayer].GetModPlayer(mod).rogueLevel; + int exactLevel = Main.player[Main.myPlayer].GetModPlayer(mod).exactRogueLevel; + int damageGain = 0; + int velocityGain = 0; + int critGain = 0; + switch (exactLevel) + { + case 0: + break; + case 1: + damageGain = 1; + break; + case 2: + damageGain = 2; + break; + case 3: + damageGain = 2; + velocityGain = 1; + break; + case 4: + damageGain = 3; + critGain = 1; + velocityGain = 1; + break; + case 5: + damageGain = 3; + velocityGain = 2; + critGain = 1; + break; + case 6: + damageGain = 4; + velocityGain = 3; + critGain = 1; + break; + case 7: + damageGain = 4; + velocityGain = 4; + critGain = 2; + break; + case 8: + damageGain = 5; + velocityGain = 5; + critGain = 2; + break; + case 9: + damageGain = 5; + velocityGain = 5; + critGain = 3; + break; + case 10: + damageGain = 6; + velocityGain = 6; + critGain = 3; + break; + case 11: + damageGain = 7; + velocityGain = 7; + critGain = 4; + break; + case 12: + damageGain = 8; + velocityGain = 8; + critGain = 4; + break; + case 13: + damageGain = 9; + velocityGain = 9; + critGain = 5; + break; + case 14: + damageGain = 10; + velocityGain = 10; + critGain = 5; + break; + case 15: + damageGain = 12; + velocityGain = 12; + critGain = 6; + break; + } + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Tells you how high your rogue proficiency is\n" + + "While equipped you will gain rogue proficiency faster\n" + + "The higher your rogue level the higher your rogue damage, critical strike chance, and velocity\n" + + "Rogue proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + + "Rogue level (max of 15): " + exactLevel + "\n" + + "Rogue damage increase: " + damageGain + "%\n" + + "Rogue velocity increase: " + velocityGain + "%\n" + + "Rogue crit increase: " + critGain + "%"; + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fasterRogueLevel = true; + } + } +} diff --git a/Items/Accessories/SeaShell.cs b/Items/Accessories/SeaShell.cs index ba075a1c29..b5c137a8dd 100644 --- a/Items/Accessories/SeaShell.cs +++ b/Items/Accessories/SeaShell.cs @@ -1,42 +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 -{ - public class SeaShell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Shell"); - Tooltip.SetDefault("Increased defense and damage reduction when submerged in liquid\n" + - "Increased movement speed when submerged in liquid"); - } - - public override void SetDefaults() - { - item.defense = 2; - item.width = 20; - item.height = 24; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 1; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.statDefense += 3; - player.endurance += 0.05f; - player.moveSpeed += 0.15f; - player.ignoreWater = true; - } - } - } -} \ No newline at end of file +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 +{ + public class SeaShell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Shell"); + Tooltip.SetDefault("Increased defense and damage reduction when submerged in liquid\n" + + "Increased movement speed when submerged in liquid"); + } + + public override void SetDefaults() + { + item.defense = 2; + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.statDefense += 3; + player.endurance += 0.05f; + player.moveSpeed += 0.15f; + player.ignoreWater = true; + } + } + } +} diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 816923a79c..f92a19cc11 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -1,48 +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.Accessories -{ - public class ShieldoftheOcean : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shield of the Ocean"); - Tooltip.SetDefault("Increased defense by 5 when submerged in liquid"); - } - - 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; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.statDefense += 5; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 5); - recipe.AddIngredient(ItemID.Coral, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class ShieldoftheOcean : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shield of the Ocean"); + Tooltip.SetDefault("Increased defense by 5 when submerged in liquid"); + } + + 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; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.statDefense += 5; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 5); + recipe.AddIngredient(ItemID.Coral, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index a5946ac9c2..8f3b118e3e 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -1,70 +1,70 @@ -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 -{ - public class SigilofCalamitas : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sigil of Calamitas"); - Tooltip.SetDefault("10% increased magic damage and 10% decreased mana usage\n" + - "Increases pickup range for mana stars and you restore mana when damaged\n" + - "+100 max mana and reveals treasure locations"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.magicCuffs = true; - player.manaMagnet = true; - player.findTreasure = true; - player.statManaMax2 += 100; - player.magicDamage += 0.1f; - player.manaCost *= 0.9f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SorcererEmblem); - recipe.AddIngredient(ItemID.CelestialCuffs); - recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(null, "CalamityDust", 5); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddIngredient(null, "CruptixBar", 2); - recipe.AddIngredient(null, "ChaosAmulet"); - recipe.AddIngredient(ItemID.UnholyWater, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SorcererEmblem); - recipe.AddIngredient(ItemID.CelestialCuffs); - recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(null, "CalamityDust", 5); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddIngredient(null, "CruptixBar", 2); - recipe.AddIngredient(null, "ChaosAmulet"); - recipe.AddIngredient(ItemID.BloodWater, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class SigilofCalamitas : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sigil of Calamitas"); + Tooltip.SetDefault("10% increased magic damage and 10% decreased mana usage\n" + + "Increases pickup range for mana stars and you restore mana when damaged\n" + + "+100 max mana and reveals treasure locations"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.magicCuffs = true; + player.manaMagnet = true; + player.findTreasure = true; + player.statManaMax2 += 100; + player.magicDamage += 0.1f; + player.manaCost *= 0.9f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SorcererEmblem); + recipe.AddIngredient(ItemID.CelestialCuffs); + recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(null, "CalamityDust", 5); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddIngredient(null, "CruptixBar", 2); + recipe.AddIngredient(null, "ChaosAmulet"); + recipe.AddIngredient(ItemID.UnholyWater, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SorcererEmblem); + recipe.AddIngredient(ItemID.CelestialCuffs); + recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(null, "CalamityDust", 5); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddIngredient(null, "CruptixBar", 2); + recipe.AddIngredient(null, "ChaosAmulet"); + recipe.AddIngredient(ItemID.BloodWater, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/SpiritGenerator.cs b/Items/Accessories/SpiritGenerator.cs index 17ab75fb2f..7d7b7ed3bc 100644 --- a/Items/Accessories/SpiritGenerator.cs +++ b/Items/Accessories/SpiritGenerator.cs @@ -1,52 +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.Accessories -{ - public class SpiritGenerator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spirit Glyph"); - Tooltip.SetDefault("Whenever your minions hit an enemy you will gain a random buff\n" + - "These buffs will either boost your defense, summon damage, or life regen for a while"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 2; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.sGenerator = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Diamond, 5); - recipe.AddIngredient(ItemID.IronBar, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Diamond, 5); - recipe.AddIngredient(ItemID.LeadBar, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class SpiritGenerator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spirit Glyph"); + Tooltip.SetDefault("Whenever your minions hit an enemy you will gain a random buff\n" + + "These buffs will either boost your defense, summon damage, or life regen for a while"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 2; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.sGenerator = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Diamond, 5); + recipe.AddIngredient(ItemID.IronBar, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Diamond, 5); + recipe.AddIngredient(ItemID.LeadBar, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs index 03cdd1b4ad..29150d7e16 100644 --- a/Items/Accessories/Sponge.cs +++ b/Items/Accessories/Sponge.cs @@ -1,66 +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.Accessories -{ - public class Sponge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Sponge"); - Tooltip.SetDefault("50% increased mining speed and you emit light\n" + - "10% increased damage reduction and increased life regen\n" + - "Poison, Freeze, Chill, Frostburn, and Venom immunity\n" + - "Honey-like life regen with no speed penalty, +20 max life and mana\n" + - "Most bee/hornet enemies and projectiles do 75% damage to you\n" + - "120% increased jump speed and 12% increased movement speed\n" + - "Standing still boosts life and mana regen\n" + - "Increased defense and damage reduction when submerged in liquid\n" + - "Increased movement speed when submerged in liquid\n" + - "Enemies take damage when they hit you\n" + - "Taking a hit will make you move very fast for a short time\n" + - "You emit a mushroom spore and spark explosion when you are hit\n" + - "Enemy attacks will have part of their damage absorbed and used to heal you"); - } - - public override void SetDefaults() - { - item.defense = 10; - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 90, 0, 0); - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.beeResist = true; - modPlayer.aSpark = true; - modPlayer.gShell = true; - modPlayer.fCarapace = true; - modPlayer.absorber = true; - modPlayer.aAmpoule = true; - player.statManaMax2 += 20; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TheAbsorber"); - recipe.AddIngredient(null, "AmbrosialAmpoule"); - recipe.AddIngredient(null, "CosmiliteBar", 15); - recipe.AddIngredient(null, "Phantoplasm", 15); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class Sponge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Sponge"); + Tooltip.SetDefault("50% increased mining speed and you emit light\n" + + "10% increased damage reduction and increased life regen\n" + + "Poison, Freeze, Chill, Frostburn, and Venom immunity\n" + + "Honey-like life regen with no speed penalty, +20 max life and mana\n" + + "Most bee/hornet enemies and projectiles do 75% damage to you\n" + + "120% increased jump speed and 12% increased movement speed\n" + + "Standing still boosts life and mana regen\n" + + "Increased defense and damage reduction when submerged in liquid\n" + + "Increased movement speed when submerged in liquid\n" + + "Enemies take damage when they hit you\n" + + "Taking a hit will make you move very fast for a short time\n" + + "You emit a mushroom spore and spark explosion when you are hit\n" + + "Enemy attacks will have part of their damage absorbed and used to heal you"); + } + + public override void SetDefaults() + { + item.defense = 10; + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 90, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.beeResist = true; + modPlayer.aSpark = true; + modPlayer.gShell = true; + modPlayer.fCarapace = true; + modPlayer.absorber = true; + modPlayer.aAmpoule = true; + player.statManaMax2 += 20; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TheAbsorber"); + recipe.AddIngredient(null, "AmbrosialAmpoule"); + recipe.AddIngredient(null, "CosmiliteBar", 15); + recipe.AddIngredient(null, "Phantoplasm", 15); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index ad5ab56d31..338375053c 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -1,71 +1,71 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - public class StatisBeltOfCurses : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statis' Belt of Curses"); - Tooltip.SetDefault("Increases jump speed and allows constant jumping\n" + - "Can climb walls, dash, and dodge attacks\n" + - "10% increased rogue damage and velocity\n" + - "5% increased rogue crit chance\n" + - "Increased max minions by 3 and 10% increased minion damage\n" + - "Increased minion knockback\n" + - "Grants shadowflame powers to all minions\n" + - "Minions make enemies cry on hit\n" + - "Minion attacks have a chance to instantly kill normal enemies"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.statisBeltOfCurses = true; - modPlayer.shadowMinions = true; - modPlayer.tearMinions = true; - player.minionKB += 2.5f; - player.minionDamage += 0.1f; - player.maxMinions += 3; - player.autoJump = true; - player.jumpSpeedBoost += 1.2f; - player.extraFall += 50; - player.blackBelt = true; - player.dash = 1; - player.spikedBoots = 2; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StatisNinjaBelt"); - recipe.AddIngredient(null, "StatisCurse"); - recipe.AddIngredient(null, "Phantoplasm", 20); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + public class StatisBeltOfCurses : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statis' Belt of Curses"); + Tooltip.SetDefault("Increases jump speed and allows constant jumping\n" + + "Can climb walls, dash, and dodge attacks\n" + + "10% increased rogue damage and velocity\n" + + "5% increased rogue crit chance\n" + + "Increased max minions by 3 and 10% increased minion damage\n" + + "Increased minion knockback\n" + + "Grants shadowflame powers to all minions\n" + + "Minions make enemies cry on hit\n" + + "Minion attacks have a chance to instantly kill normal enemies"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 90, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.statisBeltOfCurses = true; + modPlayer.shadowMinions = true; + modPlayer.tearMinions = true; + player.minionKB += 2.5f; + player.minionDamage += 0.1f; + player.maxMinions += 3; + player.autoJump = true; + player.jumpSpeedBoost += 1.2f; + player.extraFall += 50; + player.blackBelt = true; + player.dash = 1; + player.spikedBoots = 2; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StatisNinjaBelt"); + recipe.AddIngredient(null, "StatisCurse"); + recipe.AddIngredient(null, "Phantoplasm", 20); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index 8d6f41018d..dcd4e703be 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -1,54 +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; - -namespace CalamityMod.Items.Accessories -{ - public class StatisBlessing : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statis' Blessing"); - Tooltip.SetDefault("Increased max minions by 3 and 10% increased minion damage\n" + - "Increased minion knockback\n" + - "Minions cause enemies to cry on hit"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tearMinions = true; - player.minionKB += 2.5f; - player.minionDamage += 0.1f; - player.maxMinions += 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PapyrusScarab); - recipe.AddIngredient(ItemID.PygmyNecklace); - recipe.AddIngredient(ItemID.SummonerEmblem); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(null, "CoreofCinder", 5); - recipe.AddIngredient(ItemID.HolyWater, 30); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class StatisBlessing : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statis' Blessing"); + Tooltip.SetDefault("Increased max minions by 3 and 10% increased minion damage\n" + + "Increased minion knockback\n" + + "Minions cause enemies to cry on hit"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 45, 0, 0); + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tearMinions = true; + player.minionKB += 2.5f; + player.minionDamage += 0.1f; + player.maxMinions += 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PapyrusScarab); + recipe.AddIngredient(ItemID.PygmyNecklace); + recipe.AddIngredient(ItemID.SummonerEmblem); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "CoreofCinder", 5); + recipe.AddIngredient(ItemID.HolyWater, 30); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index 07531b00b0..c4f209b3d6 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -1,53 +1,53 @@ -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 -{ - public class StatisCurse : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statis' Curse"); - Tooltip.SetDefault("Increased max minions by 3 and 10% increased minion damage\n" + - "Increased minion knockback\n" + - "Grants shadowflame powers to all minions\n" + - "Minions make enemies cry on hit"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 10; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.shadowMinions = true; - modPlayer.tearMinions = true; - player.minionKB += 2.5f; - player.minionDamage += 0.1f; - player.maxMinions += 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentStardust, 10); - recipe.AddIngredient(null, "StatisBlessing"); - recipe.AddIngredient(null, "TheFirstShadowflame"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class StatisCurse : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statis' Curse"); + Tooltip.SetDefault("Increased max minions by 3 and 10% increased minion damage\n" + + "Increased minion knockback\n" + + "Grants shadowflame powers to all minions\n" + + "Minions make enemies cry on hit"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 10; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.shadowMinions = true; + modPlayer.tearMinions = true; + player.minionKB += 2.5f; + player.minionDamage += 0.1f; + player.maxMinions += 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FragmentStardust, 10); + recipe.AddIngredient(null, "StatisBlessing"); + recipe.AddIngredient(null, "TheFirstShadowflame"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index b7bf93a2d9..ad36345e30 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - public class StatisNinjaBelt : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statis' Ninja Belt"); - Tooltip.SetDefault("Increases jump speed and allows constant jumping\n" + - "Can climb walls, dash, and dodge attacks\n" + - "5% increased rogue damage and velocity\n" + - "5% increased rogue crit chance"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityCustomThrowingDamagePlayer modPlayer = CalamityCustomThrowingDamagePlayer.ModPlayer(player); - player.autoJump = true; - player.jumpSpeedBoost += 0.4f; - player.extraFall += 35; - player.blackBelt = true; - player.dash = 1; - player.spikedBoots = 2; - modPlayer.throwingDamage += 0.05f; - modPlayer.throwingCrit += 5; - modPlayer.throwingVelocity += 0.05f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FrogLeg); - recipe.AddIngredient(null, "PurifiedGel", 50); - recipe.AddIngredient(null, "CoreofEleum"); - recipe.AddIngredient(ItemID.MasterNinjaGear); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + public class StatisNinjaBelt : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statis' Ninja Belt"); + Tooltip.SetDefault("Increases jump speed and allows constant jumping\n" + + "Can climb walls, dash, and dodge attacks\n" + + "5% increased rogue damage and velocity\n" + + "5% increased rogue crit chance"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 45, 0, 0); + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityCustomThrowingDamagePlayer modPlayer = CalamityCustomThrowingDamagePlayer.ModPlayer(player); + player.autoJump = true; + player.jumpSpeedBoost += 0.4f; + player.extraFall += 35; + player.blackBelt = true; + player.dash = 1; + player.spikedBoots = 2; + modPlayer.throwingDamage += 0.05f; + modPlayer.throwingCrit += 5; + modPlayer.throwingVelocity += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FrogLeg); + recipe.AddIngredient(null, "PurifiedGel", 50); + recipe.AddIngredient(null, "CoreofEleum"); + recipe.AddIngredient(ItemID.MasterNinjaGear); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/StressPills.cs b/Items/Accessories/StressPills.cs index c93b4242de..c3abccf6d8 100644 --- a/Items/Accessories/StressPills.cs +++ b/Items/Accessories/StressPills.cs @@ -1,37 +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 -{ - public class StressPills : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stress Pills"); - Tooltip.SetDefault("Boosts your damage by 8%,\n" + - "defense by 8, and max movement speed and acceleration by 5%\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 3; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.stressPills = true; - } - } -} \ No newline at end of file +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 +{ + public class StressPills : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stress Pills"); + Tooltip.SetDefault("Boosts your damage by 8%,\n" + + "defense by 8, and max movement speed and acceleration by 5%\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.stressPills = true; + } + } +} diff --git a/Items/Accessories/SummonLevelMeter.cs b/Items/Accessories/SummonLevelMeter.cs index da6be47ba2..6910e191f7 100644 --- a/Items/Accessories/SummonLevelMeter.cs +++ b/Items/Accessories/SummonLevelMeter.cs @@ -1,131 +1,131 @@ -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 -{ - public class SummonLevelMeter : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Summon Level Meter"); - Tooltip.SetDefault("Tells you how high your summon proficiency is"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - int level = Main.player[Main.myPlayer].GetModPlayer(mod).summonLevel; - int exactLevel = Main.player[Main.myPlayer].GetModPlayer(mod).exactSummonLevel; - int damageGain = 0; - int minionKB = 0; - int minionSlots = 0; - switch (exactLevel) - { - case 0: - break; - case 1: - damageGain = 1; - break; - case 2: - damageGain = 2; - break; - case 3: - damageGain = 2; - minionKB = 30; - break; - case 4: - damageGain = 3; - minionKB = 30; - break; - case 5: - damageGain = 3; - minionKB = 60; - break; - case 6: - damageGain = 4; - minionKB = 90; - minionSlots = 1; - break; - case 7: - damageGain = 4; - minionKB = 120; - minionSlots = 1; - break; - case 8: - damageGain = 5; - minionKB = 150; - minionSlots = 1; - break; - case 9: - damageGain = 6; - minionKB = 180; - minionSlots = 1; - break; - case 10: - damageGain = 6; - minionKB = 180; - minionSlots = 2; - break; - case 11: - damageGain = 7; - minionKB = 210; - minionSlots = 2; - break; - case 12: - damageGain = 8; - minionKB = 240; - minionSlots = 2; - break; - case 13: - damageGain = 9; - minionKB = 270; - minionSlots = 2; - break; - case 14: - damageGain = 10; - minionKB = 300; - minionSlots = 2; - break; - case 15: - damageGain = 12; - minionKB = 300; - minionSlots = 3; - break; - } - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Tells you how high your summon proficiency is\n" + - "While equipped you will gain summon proficiency faster\n" + - "The higher your summon level the higher your minion damage, knockback, and slots\n" + - "Summon proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + - "Summon level (max of 15): " + exactLevel + "\n" + - "Minion damage increase: " + damageGain + "%\n" + - "Minion knockback increase: " + minionKB + "%\n" + - "Minion slot increase: " + minionSlots; - } - } - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fasterSummonLevel = true; - } - } -} \ No newline at end of file +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 +{ + public class SummonLevelMeter : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Summon Level Meter"); + Tooltip.SetDefault("Tells you how high your summon proficiency is"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 1; + item.accessory = true; + } + + public override void ModifyTooltips(List list) + { + int level = Main.player[Main.myPlayer].GetModPlayer(mod).summonLevel; + int exactLevel = Main.player[Main.myPlayer].GetModPlayer(mod).exactSummonLevel; + int damageGain = 0; + int minionKB = 0; + int minionSlots = 0; + switch (exactLevel) + { + case 0: + break; + case 1: + damageGain = 1; + break; + case 2: + damageGain = 2; + break; + case 3: + damageGain = 2; + minionKB = 30; + break; + case 4: + damageGain = 3; + minionKB = 30; + break; + case 5: + damageGain = 3; + minionKB = 60; + break; + case 6: + damageGain = 4; + minionKB = 90; + minionSlots = 1; + break; + case 7: + damageGain = 4; + minionKB = 120; + minionSlots = 1; + break; + case 8: + damageGain = 5; + minionKB = 150; + minionSlots = 1; + break; + case 9: + damageGain = 6; + minionKB = 180; + minionSlots = 1; + break; + case 10: + damageGain = 6; + minionKB = 180; + minionSlots = 2; + break; + case 11: + damageGain = 7; + minionKB = 210; + minionSlots = 2; + break; + case 12: + damageGain = 8; + minionKB = 240; + minionSlots = 2; + break; + case 13: + damageGain = 9; + minionKB = 270; + minionSlots = 2; + break; + case 14: + damageGain = 10; + minionKB = 300; + minionSlots = 2; + break; + case 15: + damageGain = 12; + minionKB = 300; + minionSlots = 3; + break; + } + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Tells you how high your summon proficiency is\n" + + "While equipped you will gain summon proficiency faster\n" + + "The higher your summon level the higher your minion damage, knockback, and slots\n" + + "Summon proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + + "Summon level (max of 15): " + exactLevel + "\n" + + "Minion damage increase: " + damageGain + "%\n" + + "Minion knockback increase: " + minionKB + "%\n" + + "Minion slot increase: " + minionSlots; + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fasterSummonLevel = true; + } + } +} diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index b59587ab56..7b7f30c246 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -1,58 +1,58 @@ -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 -{ - public class SupremeBaitTackleBoxFishingStation : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Supreme Bait Tackle Box Fishing Station"); - Tooltip.SetDefault("The ultimate fishing accessory\n" + - "Increases fishing skill by 100\n" + - "Fishing line will never break and decreases chance of bait consumption\n" + - "Crate potion effect, does not stack with crate potions\n" + - "Sonar potion effect"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 10; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.fishingSkill += 100; - player.accFishingLine = true; - player.accTackleBox = true; - player.cratePotion = true; - player.sonarPotion = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AnglerHat); //5 - recipe.AddIngredient(ItemID.AnglerVest); //5 - recipe.AddIngredient(ItemID.AnglerPants); //5 - recipe.AddIngredient(ItemID.AnglerTackleBag); //10 - recipe.AddIngredient(ItemID.FishingPotion, 5); //15 - recipe.AddIngredient(ItemID.CratePotion, 5); - recipe.AddIngredient(ItemID.SonarPotion, 5); - recipe.AddIngredient(ItemID.MasterBait, 5); //50 - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class SupremeBaitTackleBoxFishingStation : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Supreme Bait Tackle Box Fishing Station"); + Tooltip.SetDefault("The ultimate fishing accessory\n" + + "Increases fishing skill by 100\n" + + "Fishing line will never break and decreases chance of bait consumption\n" + + "Crate potion effect, does not stack with crate potions\n" + + "Sonar potion effect"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 45, 0, 0); + item.rare = 10; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.fishingSkill += 100; + player.accFishingLine = true; + player.accTackleBox = true; + player.cratePotion = true; + player.sonarPotion = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AnglerHat); //5 + recipe.AddIngredient(ItemID.AnglerVest); //5 + recipe.AddIngredient(ItemID.AnglerPants); //5 + recipe.AddIngredient(ItemID.AnglerTackleBag); //10 + recipe.AddIngredient(ItemID.FishingPotion, 5); //15 + recipe.AddIngredient(ItemID.CratePotion, 5); + recipe.AddIngredient(ItemID.SonarPotion, 5); + recipe.AddIngredient(ItemID.MasterBait, 5); //50 + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index b4aff32ef2..f76014b26f 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -1,80 +1,80 @@ -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 -{ - public class TheAbsorber : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Absorber"); - Tooltip.SetDefault("12% increased movement speed\n" + - "120% increased jump speed\n" + - "+20 max life and mana\n" + - "Standing still boosts life and mana regen\n" + - "Increased defense and damage reduction when submerged in liquid\n" + - "Increased movement speed when submerged in liquid\n" + - "Enemies take damage when they hit you\n" + - "Taking a hit will make you move very fast for a short time\n" + - "You emit a mushroom spore and spark explosion when you are hit\n" + - "5% increased damage reduction\n" + - "Enemy attacks will have part of their damage absorbed and used to heal you"); - } - - public override void SetDefaults() - { - item.defense = 6; - item.width = 20; - item.height = 24; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 10; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aSpark = true; - modPlayer.gShell = true; - modPlayer.fCarapace = true; - modPlayer.absorber = true; - player.statManaMax2 += 20; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GrandGelatin"); - recipe.AddIngredient(null, "SeaShell"); - recipe.AddIngredient(null, "CrawCarapace"); - recipe.AddIngredient(null, "FungalCarapace"); - recipe.AddIngredient(null, "GiantTortoiseShell"); - recipe.AddIngredient(null, "AmidiasSpark"); - recipe.AddIngredient(null, "DepthCells", 15); - recipe.AddIngredient(null, "Lumenite", 15); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GrandGelatin"); - recipe.AddIngredient(null, "SeaShell"); - recipe.AddIngredient(null, "FungalCarapace"); - recipe.AddIngredient(null, "GiantShell"); - recipe.AddIngredient(null, "GiantTortoiseShell"); - recipe.AddIngredient(null, "AmidiasSpark"); - recipe.AddIngredient(null, "DepthCells", 15); - recipe.AddIngredient(null, "Lumenite", 15); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class TheAbsorber : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Absorber"); + Tooltip.SetDefault("12% increased movement speed\n" + + "120% increased jump speed\n" + + "+20 max life and mana\n" + + "Standing still boosts life and mana regen\n" + + "Increased defense and damage reduction when submerged in liquid\n" + + "Increased movement speed when submerged in liquid\n" + + "Enemies take damage when they hit you\n" + + "Taking a hit will make you move very fast for a short time\n" + + "You emit a mushroom spore and spark explosion when you are hit\n" + + "5% increased damage reduction\n" + + "Enemy attacks will have part of their damage absorbed and used to heal you"); + } + + public override void SetDefaults() + { + item.defense = 6; + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 10; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aSpark = true; + modPlayer.gShell = true; + modPlayer.fCarapace = true; + modPlayer.absorber = true; + player.statManaMax2 += 20; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GrandGelatin"); + recipe.AddIngredient(null, "SeaShell"); + recipe.AddIngredient(null, "CrawCarapace"); + recipe.AddIngredient(null, "FungalCarapace"); + recipe.AddIngredient(null, "GiantTortoiseShell"); + recipe.AddIngredient(null, "AmidiasSpark"); + recipe.AddIngredient(null, "DepthCells", 15); + recipe.AddIngredient(null, "Lumenite", 15); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GrandGelatin"); + recipe.AddIngredient(null, "SeaShell"); + recipe.AddIngredient(null, "FungalCarapace"); + recipe.AddIngredient(null, "GiantShell"); + recipe.AddIngredient(null, "GiantTortoiseShell"); + recipe.AddIngredient(null, "AmidiasSpark"); + recipe.AddIngredient(null, "DepthCells", 15); + recipe.AddIngredient(null, "Lumenite", 15); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 4bdcfdd3b6..528ebc6f4f 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -1,215 +1,215 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - public class TheAmalgam : ModItem - { - public const int FireProjectiles = 2; - public const float FireAngleSpread = 120; - public int FireCountdown = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Amalgam"); - Tooltip.SetDefault("15% increased damage\n" + - "Shade rains down when you are hit\n" + - "You will confuse nearby enemies when you are struck\n" + - "Drops brimstone fireballs from the sky occasionally\n" + - "Brimstone fire rains down while invincibility is active\n" + - "Temporary immunity to lava, greatly reduces lava burn damage, and 15% increased damage while in lava\n" + - "Summons a fungal clump to fight for you\n" + - "You leave behind poisonous seawater as you move\n" + - "75% increased movement speed, 10% increase to all damage, and plus 40 defense while submerged in liquid\n" + - "If you are damaged while submerged in liquid you will gain a damaging aura for a short time"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(9, 8)); - } - - public override void SetDefaults() - { - item.width = 34; - item.height = 34; - item.value = Item.buyPrice(0, 90, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.fungalClump) - { - return false; - } - return true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aBrain = true; - modPlayer.fungalClump = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("FungalClump")) == -1) - { - player.AddBuff(mod.BuffType("FungalClump"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("FungalClump"), (int)(1000f * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); - } - } - player.meleeDamage += 0.15f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; - player.rangedDamage += 0.15f; - player.magicDamage += 0.15f; - player.minionDamage += 0.15f; - player.ignoreWater = true; - player.lavaRose = true; - player.lavaMax += 240; - if (player.lavaWet) - { - player.meleeDamage += 0.15f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; - player.rangedDamage += 0.15f; - player.magicDamage += 0.15f; - player.minionDamage += 0.15f; - } - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.meleeDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - player.rangedDamage += 0.1f; - player.magicDamage += 0.1f; - player.minionDamage += 0.1f; - player.statDefense += 40; - player.moveSpeed += 0.75f; - } - if (((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1)) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 2000, 0f, player.whoAmI, 0f, 0f); - } - } - if (player.immune) - { - if (Main.rand.Next(20) == 0) - { - if (player.whoAmI == Main.myPlayer) - { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int type = (Main.rand.Next(2) == 0 ? mod.ProjectileType("AuraRain") : mod.ProjectileType("StandingFire")); - int num19 = Projectile.NewProjectile(x, y, num15, num16, type, 2000, 1f, player.whoAmI, 0f, 0f); - Main.projectile[num19].tileCollide = false; - } - } - } - } - int seaCounter = 0; - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 0.5f, 1.25f); - int num = BuffID.Venom; - float num2 = 300f; - bool flag = seaCounter % 60 == 0; - int num3 = 320; - int random = Main.rand.Next(5); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0 && player.immune && (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir))) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (nPC.FindBuffIndex(num) == -1) - { - nPC.AddBuff(num, 300, false); - } - if (flag) - { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != 0) - { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - seaCounter++; - if (seaCounter >= 180) - { - seaCounter = 0; - } - if (FireCountdown == 0) - { - FireCountdown = 600; - } - if (FireCountdown > 0) - { - FireCountdown--; - if (FireCountdown == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int speed2 = 25; - float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; - float spawnY = -1000 + player.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = player.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; - for (int i = 0; i < FireProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("BrimstoneHellfireballFriendly2"), 2000, 5f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].tileCollide = false; - Main.projectile[projectile].timeLeft = 50; - } - } - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AmalgamatedBrain"); - recipe.AddIngredient(null, "VoidofExtinction"); - recipe.AddIngredient(null, "FungalClump"); - recipe.AddIngredient(null, "LeviathanAmbergris"); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + public class TheAmalgam : ModItem + { + public const int FireProjectiles = 2; + public const float FireAngleSpread = 120; + public int FireCountdown = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Amalgam"); + Tooltip.SetDefault("15% increased damage\n" + + "Shade rains down when you are hit\n" + + "You will confuse nearby enemies when you are struck\n" + + "Drops brimstone fireballs from the sky occasionally\n" + + "Brimstone fire rains down while invincibility is active\n" + + "Temporary immunity to lava, greatly reduces lava burn damage, and 15% increased damage while in lava\n" + + "Summons a fungal clump to fight for you\n" + + "You leave behind poisonous seawater as you move\n" + + "75% increased movement speed, 10% increase to all damage, and plus 40 defense while submerged in liquid\n" + + "If you are damaged while submerged in liquid you will gain a damaging aura for a short time"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(9, 8)); + } + + public override void SetDefaults() + { + item.width = 34; + item.height = 34; + item.value = Item.buyPrice(0, 90, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.fungalClump) + { + return false; + } + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aBrain = true; + modPlayer.fungalClump = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("FungalClump")) == -1) + { + player.AddBuff(mod.BuffType("FungalClump"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("FungalClump"), (int)(1000f * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); + } + } + player.meleeDamage += 0.15f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; + player.rangedDamage += 0.15f; + player.magicDamage += 0.15f; + player.minionDamage += 0.15f; + player.ignoreWater = true; + player.lavaRose = true; + player.lavaMax += 240; + if (player.lavaWet) + { + player.meleeDamage += 0.15f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; + player.rangedDamage += 0.15f; + player.magicDamage += 0.15f; + player.minionDamage += 0.15f; + } + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.meleeDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + player.rangedDamage += 0.1f; + player.magicDamage += 0.1f; + player.minionDamage += 0.1f; + player.statDefense += 40; + player.moveSpeed += 0.75f; + } + if (((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1)) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 2000, 0f, player.whoAmI, 0f, 0f); + } + } + if (player.immune) + { + if (Main.rand.Next(20) == 0) + { + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 1; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int type = (Main.rand.Next(2) == 0 ? mod.ProjectileType("AuraRain") : mod.ProjectileType("StandingFire")); + int num19 = Projectile.NewProjectile(x, y, num15, num16, type, 2000, 1f, player.whoAmI, 0f, 0f); + Main.projectile[num19].tileCollide = false; + } + } + } + } + int seaCounter = 0; + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 0.5f, 1.25f); + int num = BuffID.Venom; + float num2 = 300f; + bool flag = seaCounter % 60 == 0; + int num3 = 320; + int random = Main.rand.Next(5); + if (player.whoAmI == Main.myPlayer) + { + if (random == 0 && player.immune && (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir))) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1) + { + nPC.AddBuff(num, 300, false); + } + if (flag) + { + nPC.StrikeNPC(num3, 0f, 0, false, false, false); + if (Main.netMode != 0) + { + NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + seaCounter++; + if (seaCounter >= 180) + { + seaCounter = 0; + } + if (FireCountdown == 0) + { + FireCountdown = 600; + } + if (FireCountdown > 0) + { + FireCountdown--; + if (FireCountdown == 0) + { + if (player.whoAmI == Main.myPlayer) + { + int speed2 = 25; + float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; + float spawnY = -1000 + player.Center.Y; + Vector2 baseSpawn = new Vector2(spawnX, spawnY); + Vector2 baseVelocity = player.Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity = baseVelocity * speed2; + for (int i = 0; i < FireProjectiles; i++) + { + Vector2 spawn = baseSpawn; + spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("BrimstoneHellfireballFriendly2"), 2000, 5f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].tileCollide = false; + Main.projectile[projectile].timeLeft = 50; + } + } + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AmalgamatedBrain"); + recipe.AddIngredient(null, "VoidofExtinction"); + recipe.AddIngredient(null, "FungalClump"); + recipe.AddIngredient(null, "LeviathanAmbergris"); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index c3aeb430a8..9c4298dfb0 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -1,43 +1,43 @@ -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 -{ - public class TheCommunity : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Community"); - Tooltip.SetDefault("The heart of (most of) the Terraria community\n" + - "Legendary Accessory\n" + - "Starts off with weak buffs to all of your stats\n" + - "The stat buffs become more powerful as you progress\n" + - "Reduces the DoT effects of harmful debuffs inflicted on you\n" + - "Boosts your maximum flight time by 15%\n" + - "Thank you to all of my supporters that made this mod a reality\n" + - "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 15)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 60, 0, 0); - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.community = true; - } - } -} +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 +{ + public class TheCommunity : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Community"); + Tooltip.SetDefault("The heart of (most of) the Terraria community\n" + + "Legendary Accessory\n" + + "Starts off with weak buffs to all of your stats\n" + + "The stat buffs become more powerful as you progress\n" + + "Reduces the DoT effects of harmful debuffs inflicted on you\n" + + "Boosts your maximum flight time by 15%\n" + + "Thank you to all of my supporters that made this mod a reality\n" + + "Revengeance drop"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 15)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 60, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.community = true; + } + } +} diff --git a/Items/Accessories/TheFirstShadowflame.cs b/Items/Accessories/TheFirstShadowflame.cs index c51976ade0..40ff7f2ad3 100644 --- a/Items/Accessories/TheFirstShadowflame.cs +++ b/Items/Accessories/TheFirstShadowflame.cs @@ -1,37 +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 -{ - public class TheFirstShadowflame : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The First Shadowflame"); - 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() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.shadowMinions = true; - } - } -} \ No newline at end of file +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 +{ + public class TheFirstShadowflame : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The First Shadowflame"); + 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() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.shadowMinions = true; + } + } +} diff --git a/Items/Accessories/VitalJelly.cs b/Items/Accessories/VitalJelly.cs index 47054d2524..3f2395b947 100644 --- a/Items/Accessories/VitalJelly.cs +++ b/Items/Accessories/VitalJelly.cs @@ -1,36 +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 -{ - public class VitalJelly : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vital Jelly"); - Tooltip.SetDefault("10% increased movement speed\n" + - "100% increased jump speed"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 24; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 1.0f; - } - } -} \ No newline at end of file +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 +{ + public class VitalJelly : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vital Jelly"); + Tooltip.SetDefault("10% increased movement speed\n" + + "100% increased jump speed"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 1.0f; + } + } +} diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index f75df72b2b..709f784722 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -1,138 +1,138 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Accessories -{ - public class VoidofExtinction : ModItem - { - public const int FireProjectiles = 2; - public const float FireAngleSpread = 120; - public int FireCountdown = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Void of Extinction"); - Tooltip.SetDefault("No longer cursed\n" + - "Drops brimstone fireballs from the sky occasionally\n" + - "15% increase to all damage\n" + - "Brimstone fire rains down while invincibility is active\n" + - "Temporary immunity to lava, greatly reduces lava burn damage, and 25% increased damage while in lava"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 30, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.calamityRing) - { - return false; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ObsidianRose); - recipe.AddIngredient(null, "Gehenna"); - recipe.AddIngredient(null, "CalamityRing"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.calamityRing = true; - player.lavaRose = true; - player.lavaMax += 240; - player.meleeDamage += 0.15f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; - player.rangedDamage += 0.15f; - player.magicDamage += 0.15f; - player.minionDamage += 0.15f; - if (player.lavaWet) - { - player.meleeDamage += 0.25f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.25f; - player.rangedDamage += 0.25f; - player.magicDamage += 0.25f; - player.minionDamage += 0.25f; - } - if (player.immune) - { - if (Main.rand.Next(10) == 0) - { - if (player.whoAmI == Main.myPlayer) - { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("StandingFire"), 40, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - } - } - } - } - if (FireCountdown == 0) - { - FireCountdown = 600; - } - if (FireCountdown > 0) - { - FireCountdown--; - if (FireCountdown == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int speed2 = 25; - float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; - float spawnY = -1000 + player.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = player.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; - for (int i = 0; i < FireProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("BrimstoneHellfireballFriendly2"), 70, 5f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].tileCollide = false; - Main.projectile[projectile].timeLeft = 50; - } - } - } - } - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Accessories +{ + public class VoidofExtinction : ModItem + { + public const int FireProjectiles = 2; + public const float FireAngleSpread = 120; + public int FireCountdown = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Void of Extinction"); + Tooltip.SetDefault("No longer cursed\n" + + "Drops brimstone fireballs from the sky occasionally\n" + + "15% increase to all damage\n" + + "Brimstone fire rains down while invincibility is active\n" + + "Temporary immunity to lava, greatly reduces lava burn damage, and 25% increased damage while in lava"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 30, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.calamityRing) + { + return false; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ObsidianRose); + recipe.AddIngredient(null, "Gehenna"); + recipe.AddIngredient(null, "CalamityRing"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.calamityRing = true; + player.lavaRose = true; + player.lavaMax += 240; + player.meleeDamage += 0.15f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; + player.rangedDamage += 0.15f; + player.magicDamage += 0.15f; + player.minionDamage += 0.15f; + if (player.lavaWet) + { + player.meleeDamage += 0.25f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.25f; + player.rangedDamage += 0.25f; + player.magicDamage += 0.25f; + player.minionDamage += 0.25f; + } + if (player.immune) + { + if (Main.rand.Next(10) == 0) + { + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 1; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("StandingFire"), 40, 5f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + } + } + } + } + if (FireCountdown == 0) + { + FireCountdown = 600; + } + if (FireCountdown > 0) + { + FireCountdown--; + if (FireCountdown == 0) + { + if (player.whoAmI == Main.myPlayer) + { + int speed2 = 25; + float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; + float spawnY = -1000 + player.Center.Y; + Vector2 baseSpawn = new Vector2(spawnX, spawnY); + Vector2 baseVelocity = player.Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity = baseVelocity * speed2; + for (int i = 0; i < FireProjectiles; i++) + { + Vector2 spawn = baseSpawn; + spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("BrimstoneHellfireballFriendly2"), 70, 5f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].tileCollide = false; + Main.projectile[projectile].timeLeft = 50; + } + } + } + } + } + } +} diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs index 73f9ab0cf6..1a9e5a85da 100644 --- a/Items/Accessories/WifeinaBottle.cs +++ b/Items/Accessories/WifeinaBottle.cs @@ -1,62 +1,62 @@ -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.Accessories -{ - public class WifeinaBottle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental in a Bottle"); - Tooltip.SetDefault("Summons a sand elemental to fight for you"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.elementalHeart) - { - return false; - } - return true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.sandWaifu = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("SandyWaifu")) == -1) - { - player.AddBuff(mod.BuffType("SandyWaifu"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SandyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - } -} \ No newline at end of file +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.Accessories +{ + public class WifeinaBottle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental in a Bottle"); + Tooltip.SetDefault("Summons a sand elemental to fight for you"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.elementalHeart) + { + return false; + } + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.sandWaifu = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("SandyWaifu")) == -1) + { + player.AddBuff(mod.BuffType("SandyWaifu"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("SandyWaifu")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SandyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + } +} diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs index 62fe57bf7b..9a20411fce 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/WifeinaBottlewithBoobs.cs @@ -1,64 +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.Accessories -{ - public class WifeinaBottlewithBoobs : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rare Elemental in a Bottle"); - Tooltip.SetDefault("Summons a sand elemental to heal you\n" + - ";D"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.elementalHeart) - { - return false; - } - return true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.sandBoobWaifu = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("DrewsSandyWaifu")) == -1) - { - player.AddBuff(mod.BuffType("DrewsSandyWaifu"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("DrewsSandyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - } -} \ No newline at end of file +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.Accessories +{ + public class WifeinaBottlewithBoobs : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rare Elemental in a Bottle"); + Tooltip.SetDefault("Summons a sand elemental to heal you\n" + + ";D"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.elementalHeart) + { + return false; + } + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.sandBoobWaifu = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("DrewsSandyWaifu")) == -1) + { + player.AddBuff(mod.BuffType("DrewsSandyWaifu"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("DrewsSandyWaifu")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("DrewsSandyWaifu"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + } +} diff --git a/Items/Accessories/Wings/AureateWings.cs b/Items/Accessories/Wings/AureateWings.cs index d7fd34bfd7..8fb86c2cf3 100644 --- a/Items/Accessories/Wings/AureateWings.cs +++ b/Items/Accessories/Wings/AureateWings.cs @@ -117,4 +117,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/CelestialTracers.cs b/Items/Accessories/Wings/CelestialTracers.cs index 4db59751fa..d25cb56409 100644 --- a/Items/Accessories/Wings/CelestialTracers.cs +++ b/Items/Accessories/Wings/CelestialTracers.cs @@ -97,4 +97,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/DiscordianWings.cs b/Items/Accessories/Wings/DiscordianWings.cs index 617a9239b7..cfd2978b4a 100644 --- a/Items/Accessories/Wings/DiscordianWings.cs +++ b/Items/Accessories/Wings/DiscordianWings.cs @@ -79,4 +79,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs index 5e127e5764..5202407a63 100644 --- a/Items/Accessories/Wings/DrewsWings.cs +++ b/Items/Accessories/Wings/DrewsWings.cs @@ -69,4 +69,4 @@ namespace CalamityMod.Items.Accessories.Wings acceleration *= 3f; } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/ElysianTracers.cs b/Items/Accessories/Wings/ElysianTracers.cs index 613c207f19..9eed0d81a1 100644 --- a/Items/Accessories/Wings/ElysianTracers.cs +++ b/Items/Accessories/Wings/ElysianTracers.cs @@ -96,4 +96,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 33b1ed85b3..c1138aee6a 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -92,4 +92,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/InfinityBoots.cs b/Items/Accessories/Wings/InfinityBoots.cs index 7037c9078f..05db297bee 100644 --- a/Items/Accessories/Wings/InfinityBoots.cs +++ b/Items/Accessories/Wings/InfinityBoots.cs @@ -96,4 +96,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 69d066a6ca..346437a0d5 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -125,4 +125,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index 2a341c3772..fbb0ceeba3 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -61,4 +61,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index c5bee7e4cb..4f7749452c 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -78,4 +78,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index 356222bf04..b583eec49a 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -88,4 +88,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/Wings/XerocWings.cs b/Items/Accessories/Wings/XerocWings.cs index 21b4c5a58b..d14d30b2f2 100644 --- a/Items/Accessories/Wings/XerocWings.cs +++ b/Items/Accessories/Wings/XerocWings.cs @@ -79,4 +79,4 @@ namespace CalamityMod.Items.Accessories.Wings recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index b9eb39813b..bb53b15d42 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.cs @@ -1,54 +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; - -namespace CalamityMod.Items.Accessories -{ - public class YharimsInsignia : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharim's Insignia"); - Tooltip.SetDefault("10% increased damage when under 50% life\n" + - "10% increased melee speed\n" + - "5% increased melee damage\n" + - "Melee attacks and melee projectiles inflict holy fire\n" + - "Increased invincibility after taking damage\n" + - "Temporary immunity to lava\n" + - "Increased melee knockback"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 38; - item.value = Item.buyPrice(0, 30, 0, 0); - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.yInsignia = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WarriorEmblem); - recipe.AddIngredient(null, "NecklaceofVexation"); - recipe.AddIngredient(null, "CoreofCinder", 5); - recipe.AddIngredient(ItemID.CrossNecklace); - recipe.AddIngredient(null, "BadgeofBravery"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class YharimsInsignia : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharim's Insignia"); + Tooltip.SetDefault("10% increased damage when under 50% life\n" + + "10% increased melee speed\n" + + "5% increased melee damage\n" + + "Melee attacks and melee projectiles inflict holy fire\n" + + "Increased invincibility after taking damage\n" + + "Temporary immunity to lava\n" + + "Increased melee knockback"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 38; + item.value = Item.buyPrice(0, 30, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.yInsignia = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WarriorEmblem); + recipe.AddIngredient(null, "NecklaceofVexation"); + recipe.AddIngredient(null, "CoreofCinder", 5); + recipe.AddIngredient(ItemID.CrossNecklace); + recipe.AddIngredient(null, "BadgeofBravery"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/AerialHamaxe.cs b/Items/AerialHamaxe.cs index 38755a307f..cb884a29c8 100644 --- a/Items/AerialHamaxe.cs +++ b/Items/AerialHamaxe.cs @@ -1,56 +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 -{ - public class AerialHamaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerial Hamaxe"); - } - - public override void SetDefaults() - { - item.damage = 20; - item.melee = true; - item.width = 44; - item.height = 46; - item.useTime = 26; - item.useAnimation = 26; - item.useTurn = true; - item.axe = 25; - item.hammer = 65; - item.useStyle = 1; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 6); - recipe.AddIngredient(ItemID.SunplateBlock, 5); - recipe.AddTile(TileID.SkyMill); - 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, 59); - } - } - } -} \ No newline at end of file +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 +{ + public class AerialHamaxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerial Hamaxe"); + } + + public override void SetDefaults() + { + item.damage = 20; + item.melee = true; + item.width = 44; + item.height = 46; + item.useTime = 26; + item.useAnimation = 26; + item.useTurn = true; + item.axe = 25; + item.hammer = 65; + item.useStyle = 1; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 6); + recipe.AddIngredient(ItemID.SunplateBlock, 5); + recipe.AddTile(TileID.SkyMill); + 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, 59); + } + } + } +} diff --git a/Items/AerialiteBar.cs b/Items/AerialiteBar.cs index 16cb486966..6a7d654483 100644 --- a/Items/AerialiteBar.cs +++ b/Items/AerialiteBar.cs @@ -1,37 +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 -{ - public class AerialiteBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerialite Bar"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteOre", 4); - recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class AerialiteBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerialite Bar"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteOre", 4); + recipe.AddTile(TileID.Furnaces); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Amidias/AmidiasTrident.cs b/Items/Amidias/AmidiasTrident.cs index 9e02b97372..2bba8db19d 100644 --- a/Items/Amidias/AmidiasTrident.cs +++ b/Items/Amidias/AmidiasTrident.cs @@ -1,53 +1,53 @@ -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.Amidias -{ - public class AmidiasTrident : 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.Amidias +{ + public class AmidiasTrident : ModItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Amidias' Trident"); + DisplayName.SetDefault("Amidias' Trident"); Tooltip.SetDefault("Gains the power to shoot whirlpools after Skeletron has been defeated"); } - - public override void SetDefaults() - { - item.width = 44; - item.damage = 28; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 17; - item.useStyle = 5; - item.useTime = 17; - item.knockBack = 4.5f; - 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("AmidiasTridentProj"); - item.shootSpeed = 6f; - } - - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - } -} + + public override void SetDefaults() + { + item.width = 44; + item.damage = 28; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 17; + item.useStyle = 5; + item.useTime = 17; + item.knockBack = 4.5f; + 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("AmidiasTridentProj"); + item.shootSpeed = 6f; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + } +} diff --git a/Items/Amidias/CoralCannon.cs b/Items/Amidias/CoralCannon.cs index dd9d2ccfb7..7b62447248 100644 --- a/Items/Amidias/CoralCannon.cs +++ b/Items/Amidias/CoralCannon.cs @@ -1,58 +1,58 @@ -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.Amidias -{ - public class CoralCannon : 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.Amidias +{ + public class CoralCannon : ModItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Coral Cannon"); + DisplayName.SetDefault("Coral Cannon"); Tooltip.SetDefault("Has a chance to shoot a big coral that stuns enemies"); - } - - public override void SetDefaults() - { - item.damage = 20; - item.ranged = true; - item.width = 52; - item.height = 40; - item.crit += 10; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SmallCoral"); - item.shootSpeed = 10f; - } - - 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) - { - if (Main.rand.Next(5) == 0) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BigCoral"), (int)((double)damage * 2.0), knockBack * 2f, player.whoAmI, 0.0f, 0.0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 20; + item.ranged = true; + item.width = 52; + item.height = 40; + item.crit += 10; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item61; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SmallCoral"); + item.shootSpeed = 10f; + } + + 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) + { + if (Main.rand.Next(5) == 0) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BigCoral"), (int)((double)damage * 2.0), knockBack * 2f, player.whoAmI, 0.0f, 0.0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } +} diff --git a/Items/Amidias/MagicalConch.cs b/Items/Amidias/MagicalConch.cs index 847f4d3709..60211d0840 100644 --- a/Items/Amidias/MagicalConch.cs +++ b/Items/Amidias/MagicalConch.cs @@ -1,81 +1,81 @@ -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.Amidias -{ - public class MagicalConch : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magical Conch"); - Tooltip.SetDefault("Summons a hermit crab to fight for you"); - } - - public override void SetDefaults() - { - item.damage = 20; - item.mana = 10; - item.width = 34; - item.height = 24; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("HermitCrab"); - 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) - { - 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("HermitCrab"), num73, num74, i, 0f, 0f); - return false; - } - } -} \ No newline at end of file +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.Amidias +{ + public class MagicalConch : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magical Conch"); + Tooltip.SetDefault("Summons a hermit crab to fight for you"); + } + + public override void SetDefaults() + { + item.damage = 20; + item.mana = 10; + item.width = 34; + item.height = 24; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("HermitCrab"); + 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) + { + 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("HermitCrab"), num73, num74, i, 0f, 0f); + return false; + } + } +} diff --git a/Items/Amidias/Shellshooter.cs b/Items/Amidias/Shellshooter.cs index 40829892f8..284f3f480d 100644 --- a/Items/Amidias/Shellshooter.cs +++ b/Items/Amidias/Shellshooter.cs @@ -1,47 +1,47 @@ -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.Amidias -{ - public class Shellshooter : 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.Amidias +{ + public class Shellshooter : ModItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Shellshooter"); + DisplayName.SetDefault("Shellshooter"); Tooltip.SetDefault("Shoots slow, powerful shells"); - } - - public override void SetDefaults() - { - item.damage = 30; - item.ranged = true; - item.width = 30; - item.height = 38; - item.crit += 15; - item.useTime = 70; - item.useAnimation = 70; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Shell"); - item.shootSpeed = 1.5f; - item.useAmmo = 40; - } - - 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("Shell"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 30; + item.height = 38; + item.crit += 15; + item.useTime = 70; + item.useAnimation = 70; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Shell"); + item.shootSpeed = 1.5f; + item.useAmmo = 40; + } + + 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("Shell"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Amidias/UrchinFlail.cs b/Items/Amidias/UrchinFlail.cs index e07a093f6c..103b273f6c 100644 --- a/Items/Amidias/UrchinFlail.cs +++ b/Items/Amidias/UrchinFlail.cs @@ -1,41 +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.Amidias -{ - public class UrchinFlail : 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.Amidias +{ + public class UrchinFlail : ModItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Urchin Flail"); + DisplayName.SetDefault("Urchin Flail"); Tooltip.SetDefault("Launch an urchin ball, which shoots a spike on contact with an enemy"); - } - - public override void SetDefaults() - { - item.damage = 20; - item.melee = true; - item.width = 44; - item.height = 36; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = mod.ProjectileType("UrchinBall"); - item.shootSpeed = 12f; - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 20; + item.melee = true; + item.width = 44; + item.height = 36; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.knockBack = 6f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.channel = true; + item.shoot = mod.ProjectileType("UrchinBall"); + item.shootSpeed = 12f; + } + } +} diff --git a/Items/Amidias/Waywasher.cs b/Items/Amidias/Waywasher.cs index c0f22cbe08..7229c50ca5 100644 --- a/Items/Amidias/Waywasher.cs +++ b/Items/Amidias/Waywasher.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.Amidias -{ - public class Waywasher : 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.Amidias +{ + public class Waywasher : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Waywasher"); Tooltip.SetDefault("Casts inaccurate water bolts"); - } - - public override void SetDefaults() - { - item.damage = 10; - item.magic = true; - item.mana = 4; - item.width = 30; - item.height = 30; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WaywasherProj"); - item.shootSpeed = 8f; - } - - 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(-25, 26) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("WaywasherProj"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 10; + item.magic = true; + item.mana = 4; + item.width = 30; + item.height = 30; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WaywasherProj"); + item.shootSpeed = 8f; + } + + 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(-25, 26) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("WaywasherProj"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + } +} diff --git a/Items/AncientBoneDust.cs b/Items/AncientBoneDust.cs index 28f013dd47..d78d0953a8 100644 --- a/Items/AncientBoneDust.cs +++ b/Items/AncientBoneDust.cs @@ -1,28 +1,28 @@ -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 -{ - public class AncientBoneDust : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient Bone Dust"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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 +{ + public class AncientBoneDust : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient Bone Dust"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/AnechoicCoating.cs b/Items/AnechoicCoating.cs index dbb62c27f5..f67f2c1cb6 100644 --- a/Items/AnechoicCoating.cs +++ b/Items/AnechoicCoating.cs @@ -1,48 +1,48 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class AnechoicCoating : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Anechoic Coating"); - Tooltip.SetDefault("Reduces creature's ability to detect you in the abyss"); - } - - 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("AnechoicCoating"); - item.buffTime = 7200; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CloakingGland"); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class AnechoicCoating : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anechoic Coating"); + Tooltip.SetDefault("Reduces creature's ability to detect you in the abyss"); + } + + 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("AnechoicCoating"); + item.buffTime = 7200; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CloakingGland"); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/AquaticScourge/AquaticEmblem.cs b/Items/AquaticScourge/AquaticEmblem.cs index 25abf5714e..2b075b9e18 100644 --- a/Items/AquaticScourge/AquaticEmblem.cs +++ b/Items/AquaticScourge/AquaticEmblem.cs @@ -1,47 +1,47 @@ -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.AquaticScourge -{ - public class AquaticEmblem : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Emblem"); - Tooltip.SetDefault("Most ocean enemies become friendly and provides waterbreathing\n" + - "Being underwater slowly boosts your defense over time but also slows movement speed\n" + - "The defense boost and movement speed reduction slowly vanish while outside of water\n" + - "Maximum defense boost is 30, maximum movement speed reduction is 5%\n" + - "Provides a small amount of light in the abyss\n" + - "Moderately reduces breath loss in the abyss"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 26; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 9; - item.accessory = true; - item.expert = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aquaticEmblem = true; - player.npcTypeNoAggro[65] = true; - player.npcTypeNoAggro[220] = true; - player.npcTypeNoAggro[64] = true; - player.npcTypeNoAggro[67] = true; - player.npcTypeNoAggro[221] = true; - player.gills = true; - } - } -} \ No newline at end of file +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.AquaticScourge +{ + public class AquaticEmblem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Emblem"); + Tooltip.SetDefault("Most ocean enemies become friendly and provides waterbreathing\n" + + "Being underwater slowly boosts your defense over time but also slows movement speed\n" + + "The defense boost and movement speed reduction slowly vanish while outside of water\n" + + "Maximum defense boost is 30, maximum movement speed reduction is 5%\n" + + "Provides a small amount of light in the abyss\n" + + "Moderately reduces breath loss in the abyss"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 26; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 9; + item.accessory = true; + item.expert = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aquaticEmblem = true; + player.npcTypeNoAggro[65] = true; + player.npcTypeNoAggro[220] = true; + player.npcTypeNoAggro[64] = true; + player.npcTypeNoAggro[67] = true; + player.npcTypeNoAggro[221] = true; + player.gills = true; + } + } +} diff --git a/Items/AquaticScourge/AquaticScourgeBag.cs b/Items/AquaticScourge/AquaticScourgeBag.cs index afa8753e75..665a05f6bb 100644 --- a/Items/AquaticScourge/AquaticScourgeBag.cs +++ b/Items/AquaticScourge/AquaticScourgeBag.cs @@ -1,140 +1,140 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.AquaticScourge -{ - public class AquaticScourgeBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("AquaticScourgeHead"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("DeepseaStaff")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Downpour")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Barinautical")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("SubmarineShocker")); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.HighTestFishingLine); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.AnglerTackleBag); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.TackleBox); - } - if (Main.rand.Next(8) == 0) - { - player.QuickSpawnItem(ItemID.AnglerEarring); - } - if (Main.rand.Next(8) == 0) - { - player.QuickSpawnItem(ItemID.FishermansGuide); - } - if (Main.rand.Next(8) == 0) - { - player.QuickSpawnItem(ItemID.WeatherRadio); - } - if (Main.rand.Next(8) == 0) - { - player.QuickSpawnItem(ItemID.Sextant); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(ItemID.AnglerHat); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(ItemID.AnglerVest); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(ItemID.AnglerPants); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(ItemID.CratePotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(ItemID.FishingPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(ItemID.SonarPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(8) == 0) - { - player.QuickSpawnItem(mod.ItemType("AeroStone")); - } - if (NPC.downedBoss3) - { - if (Main.rand.Next(12) == 0) - { - player.QuickSpawnItem(ItemID.GoldenBugNet); - } - } - player.QuickSpawnItem(mod.ItemType("AquaticEmblem")); - player.QuickSpawnItem(mod.ItemType("VictoryShard"), Main.rand.Next(15, 26)); - player.QuickSpawnItem(ItemID.Coral, Main.rand.Next(7, 12)); - player.QuickSpawnItem(ItemID.Seashell, Main.rand.Next(7, 12)); - player.QuickSpawnItem(ItemID.Starfish, Main.rand.Next(7, 12)); - player.QuickSpawnItem(ItemID.SoulofSight, Main.rand.Next(25, 41)); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.AquaticScourge +{ + public class AquaticScourgeBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("AquaticScourgeHead"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("DeepseaStaff")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Downpour")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Barinautical")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("SubmarineShocker")); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.HighTestFishingLine); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.AnglerTackleBag); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.TackleBox); + } + if (Main.rand.Next(8) == 0) + { + player.QuickSpawnItem(ItemID.AnglerEarring); + } + if (Main.rand.Next(8) == 0) + { + player.QuickSpawnItem(ItemID.FishermansGuide); + } + if (Main.rand.Next(8) == 0) + { + player.QuickSpawnItem(ItemID.WeatherRadio); + } + if (Main.rand.Next(8) == 0) + { + player.QuickSpawnItem(ItemID.Sextant); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(ItemID.AnglerHat); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(ItemID.AnglerVest); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(ItemID.AnglerPants); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(ItemID.CratePotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(ItemID.FishingPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(ItemID.SonarPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(8) == 0) + { + player.QuickSpawnItem(mod.ItemType("AeroStone")); + } + if (NPC.downedBoss3) + { + if (Main.rand.Next(12) == 0) + { + player.QuickSpawnItem(ItemID.GoldenBugNet); + } + } + player.QuickSpawnItem(mod.ItemType("AquaticEmblem")); + player.QuickSpawnItem(mod.ItemType("VictoryShard"), Main.rand.Next(15, 26)); + player.QuickSpawnItem(ItemID.Coral, Main.rand.Next(7, 12)); + player.QuickSpawnItem(ItemID.Seashell, Main.rand.Next(7, 12)); + player.QuickSpawnItem(ItemID.Starfish, Main.rand.Next(7, 12)); + player.QuickSpawnItem(ItemID.SoulofSight, Main.rand.Next(25, 41)); + } + } +} diff --git a/Items/AquaticScourge/Seafood.cs b/Items/AquaticScourge/Seafood.cs index c2f5a82b78..89f4c30641 100644 --- a/Items/AquaticScourge/Seafood.cs +++ b/Items/AquaticScourge/Seafood.cs @@ -1,52 +1,52 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.AquaticScourge -{ - public class Seafood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seafood"); - Tooltip.SetDefault("The sulphuric sand stirs...\n" + - "Summons the Aquatic Scourge"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.maxStack = 20; - item.rare = 5; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - return modPlayer.ZoneSulphur && !NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead")); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AquaticScourgeHead")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SulphurousSand", 10); - recipe.AddIngredient(ItemID.Starfish, 5); - recipe.AddIngredient(ItemID.SharkFin, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.AquaticScourge +{ + public class Seafood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seafood"); + Tooltip.SetDefault("The sulphuric sand stirs...\n" + + "Summons the Aquatic Scourge"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.maxStack = 20; + item.rare = 5; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + return modPlayer.ZoneSulphur && !NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AquaticScourgeHead")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SulphurousSand", 10); + recipe.AddIngredient(ItemID.Starfish, 5); + recipe.AddIngredient(ItemID.SharkFin, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/AridArtifact.cs b/Items/AridArtifact.cs index 388c3864b2..c0e27876ba 100644 --- a/Items/AridArtifact.cs +++ b/Items/AridArtifact.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent.Events; - -namespace CalamityMod.Items -{ - public class AridArtifact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arid Artifact"); - Tooltip.SetDefault("Summons a sandstorm\n" + - "The sandstorm will happen shortly after the item is used"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item66; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return !Sandstorm.Happening; - } - - public override bool UseItem(Player player) - { - typeof(Sandstorm).GetMethod("StartSandstorm", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(ItemID.AdamantiteBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(ItemID.TitaniumBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent.Events; + +namespace CalamityMod.Items +{ + public class AridArtifact : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arid Artifact"); + Tooltip.SetDefault("Summons a sandstorm\n" + + "The sandstorm will happen shortly after the item is used"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item66; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return !Sandstorm.Happening; + } + + public override bool UseItem(Player player) + { + typeof(Sandstorm).GetMethod("StartSandstorm", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); + recipe.AddIngredient(ItemID.AdamantiteBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); + recipe.AddIngredient(ItemID.TitaniumBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AbyssalDivingSuit.cs b/Items/Armor/AbyssalDivingSuit.cs index 8f54d7081e..fb10f7348c 100644 --- a/Items/Armor/AbyssalDivingSuit.cs +++ b/Items/Armor/AbyssalDivingSuit.cs @@ -1,86 +1,86 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - public class AbyssalDivingSuit : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyssal Diving Suit"); - Tooltip.SetDefault("Transforms the holder into an armored diver\n" + - "Increases movement speed while underwater and moves slowly outside of water\n" + - "The suits' armored plates reduce damage taken by 15%\n" + - "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 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" + - "Greatly reduces breath loss in the abyss\n" + - "Reduces creature's ability to detect you in the abyss\n" + - "Reduces the defense reduction that the abyss causes\n" + - "Allows you to fall faster while in liquids"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.accessory = true; - item.value = Item.buyPrice(0, 90, 0, 0); - item.rare = 10; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(); - modPlayer.abyssalDivingSuit = true; - if (hideVisual) - { - modPlayer.abyssalDivingSuitHide = true; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AbyssalDivingGear"); - recipe.AddIngredient(null, "AnechoicPlating"); - recipe.AddIngredient(null, "IronBoots"); - recipe.AddIngredient(null, "Lumenite", 40); - recipe.AddIngredient(null, "DepthCells", 40); - recipe.AddIngredient(null, "Tenebris", 15); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } - - public class AbyssalDivingSuitHead : EquipTexture - { - public override bool DrawHead() - { - return false; - } - } - - public class AbyssalDivingSuitBody : EquipTexture - { - public override bool DrawBody() - { - return false; - } - } - - public class AbyssalDivingSuitLegs : EquipTexture - { - public override bool DrawLegs() - { - return false; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + public class AbyssalDivingSuit : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Diving Suit"); + Tooltip.SetDefault("Transforms the holder into an armored diver\n" + + "Increases movement speed while underwater and moves slowly outside of water\n" + + "The suits' armored plates reduce damage taken by 15%\n" + + "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 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" + + "Greatly reduces breath loss in the abyss\n" + + "Reduces creature's ability to detect you in the abyss\n" + + "Reduces the defense reduction that the abyss causes\n" + + "Allows you to fall faster while in liquids"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.accessory = true; + item.value = Item.buyPrice(0, 90, 0, 0); + item.rare = 10; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(); + modPlayer.abyssalDivingSuit = true; + if (hideVisual) + { + modPlayer.abyssalDivingSuitHide = true; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AbyssalDivingGear"); + recipe.AddIngredient(null, "AnechoicPlating"); + recipe.AddIngredient(null, "IronBoots"); + recipe.AddIngredient(null, "Lumenite", 40); + recipe.AddIngredient(null, "DepthCells", 40); + recipe.AddIngredient(null, "Tenebris", 15); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + + public class AbyssalDivingSuitHead : EquipTexture + { + public override bool DrawHead() + { + return false; + } + } + + public class AbyssalDivingSuitBody : EquipTexture + { + public override bool DrawBody() + { + return false; + } + } + + public class AbyssalDivingSuitLegs : EquipTexture + { + public override bool DrawLegs() + { + return false; + } + } +} diff --git a/Items/Armor/AerospecBreastplate.cs b/Items/Armor/AerospecBreastplate.cs index 436545343c..71c4cf1250 100644 --- a/Items/Armor/AerospecBreastplate.cs +++ b/Items/Armor/AerospecBreastplate.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class AerospecBreastplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Breastplate"); - Tooltip.SetDefault("3% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.defense = 7; - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 3; - player.rangedCrit += 3; - player.magicCrit += 3; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 11); - recipe.AddIngredient(ItemID.Cloud, 10); - recipe.AddIngredient(ItemID.RainCloud, 5); - recipe.AddIngredient(ItemID.Feather, 2); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class AerospecBreastplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerospec Breastplate"); + Tooltip.SetDefault("3% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.defense = 7; + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 3; + player.rangedCrit += 3; + player.magicCrit += 3; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 11); + recipe.AddIngredient(ItemID.Cloud, 10); + recipe.AddIngredient(ItemID.RainCloud, 5); + recipe.AddIngredient(ItemID.Feather, 2); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AerospecHat.cs b/Items/Armor/AerospecHat.cs index 4a32e2c374..131a8f962c 100644 --- a/Items/Armor/AerospecHat.cs +++ b/Items/Armor/AerospecHat.cs @@ -1,70 +1,70 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AerospecHat : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Hat"); - Tooltip.SetDefault("8% increased magic damage and +20 max mana"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; - item.defense = 3; //15 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AerospecBreastplate") && legs.type == mod.ItemType("AerospecLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased movement speed and magic critical strike chance\n" + - "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + - "Allows you to fall more quickly and disables fall damage"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aeroSet = true; - player.noFallDmg = true; - player.moveSpeed += 0.05f; - player.magicCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.magicDamage += 0.08f; - player.statManaMax2 += 20; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 5); - recipe.AddIngredient(ItemID.Cloud, 3); - recipe.AddIngredient(ItemID.RainCloud); - recipe.AddIngredient(ItemID.Feather); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AerospecHat : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerospec Hat"); + Tooltip.SetDefault("8% increased magic damage and +20 max mana"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; + item.defense = 3; //15 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AerospecBreastplate") && legs.type == mod.ItemType("AerospecLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased movement speed and magic critical strike chance\n" + + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + + "Allows you to fall more quickly and disables fall damage"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aeroSet = true; + player.noFallDmg = true; + player.moveSpeed += 0.05f; + player.magicCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.magicDamage += 0.08f; + player.statManaMax2 += 20; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 5); + recipe.AddIngredient(ItemID.Cloud, 3); + recipe.AddIngredient(ItemID.RainCloud); + recipe.AddIngredient(ItemID.Feather); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AerospecHeadgear.cs b/Items/Armor/AerospecHeadgear.cs index 05fb18e867..610c4e789b 100644 --- a/Items/Armor/AerospecHeadgear.cs +++ b/Items/Armor/AerospecHeadgear.cs @@ -1,81 +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.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AerospecHeadgear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Headgear"); - Tooltip.SetDefault("8% increased rogue damage and 5% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; - item.defense = 4; //17 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AerospecBreastplate") && legs.type == mod.ItemType("AerospecLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void DrawHair(ref bool drawHair, ref bool drawAltHair) - { - drawHair = true; - drawAltHair = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased movement speed and rogue critical strike chance\n" + - "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + - "Allows you to fall more quickly and disables fall damage\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aeroSet = true; - modPlayer.rogueStealthMax = 1f; - player.noFallDmg = true; - player.moveSpeed += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; - player.moveSpeed += 0.05f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 5); - recipe.AddIngredient(ItemID.Cloud, 3); - recipe.AddIngredient(ItemID.RainCloud); - recipe.AddIngredient(ItemID.Feather); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AerospecHeadgear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerospec Headgear"); + Tooltip.SetDefault("8% increased rogue damage and 5% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; + item.defense = 4; //17 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AerospecBreastplate") && legs.type == mod.ItemType("AerospecLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void DrawHair(ref bool drawHair, ref bool drawAltHair) + { + drawHair = true; + drawAltHair = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased movement speed and rogue critical strike chance\n" + + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + + "Allows you to fall more quickly and disables fall damage\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aeroSet = true; + modPlayer.rogueStealthMax = 1f; + player.noFallDmg = true; + player.moveSpeed += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; + player.moveSpeed += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 5); + recipe.AddIngredient(ItemID.Cloud, 3); + recipe.AddIngredient(ItemID.RainCloud); + recipe.AddIngredient(ItemID.Feather); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AerospecHelm.cs b/Items/Armor/AerospecHelm.cs index f531b427b1..db192f842e 100644 --- a/Items/Armor/AerospecHelm.cs +++ b/Items/Armor/AerospecHelm.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AerospecHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Helm"); - Tooltip.SetDefault("8% increased melee damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; - item.defense = 7; //20 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AerospecBreastplate") && legs.type == mod.ItemType("AerospecLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased movement speed and melee critical strike chance\n" + - "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + - "Allows you to fall more quickly and disables fall damage"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aeroSet = true; - player.noFallDmg = true; - player.moveSpeed += 0.05f; - player.meleeCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.08f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 5); - recipe.AddIngredient(ItemID.Cloud, 3); - recipe.AddIngredient(ItemID.RainCloud); - recipe.AddIngredient(ItemID.Feather); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AerospecHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerospec Helm"); + Tooltip.SetDefault("8% increased melee damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; + item.defense = 7; //20 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AerospecBreastplate") && legs.type == mod.ItemType("AerospecLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased movement speed and melee critical strike chance\n" + + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + + "Allows you to fall more quickly and disables fall damage"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aeroSet = true; + player.noFallDmg = true; + player.moveSpeed += 0.05f; + player.meleeCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.meleeDamage += 0.08f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 5); + recipe.AddIngredient(ItemID.Cloud, 3); + recipe.AddIngredient(ItemID.RainCloud); + recipe.AddIngredient(ItemID.Feather); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AerospecHelmet.cs b/Items/Armor/AerospecHelmet.cs index d2a6787d21..9748fccd9a 100644 --- a/Items/Armor/AerospecHelmet.cs +++ b/Items/Armor/AerospecHelmet.cs @@ -1,82 +1,82 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AerospecHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Helmet"); - Tooltip.SetDefault("5% increased movement speed and +1 max minion"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; - item.defense = 2; //13 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AerospecBreastplate") && legs.type == mod.ItemType("AerospecLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "16% increased minion damage\n" + - "Summons a valkyrie to protect you\n" + - "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + - "Allows you to fall more quickly and disables fall damage"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.valkyrie = true; - modPlayer.aeroSet = true; - player.noFallDmg = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("Valkyrie")) == -1) - { - player.AddBuff(mod.BuffType("Valkyrie"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("Valkyrie")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("Valkyrie"), (int)(25f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - } - player.minionDamage += 0.16f; - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.05f; - player.maxMinions++; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 5); - recipe.AddIngredient(ItemID.Cloud, 3); - recipe.AddIngredient(ItemID.RainCloud); - recipe.AddIngredient(ItemID.Feather); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AerospecHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerospec Helmet"); + Tooltip.SetDefault("5% increased movement speed and +1 max minion"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; + item.defense = 2; //13 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AerospecBreastplate") && legs.type == mod.ItemType("AerospecLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "16% increased minion damage\n" + + "Summons a valkyrie to protect you\n" + + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + + "Allows you to fall more quickly and disables fall damage"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.valkyrie = true; + modPlayer.aeroSet = true; + player.noFallDmg = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("Valkyrie")) == -1) + { + player.AddBuff(mod.BuffType("Valkyrie"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("Valkyrie")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("Valkyrie"), (int)(25f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + } + player.minionDamage += 0.16f; + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.05f; + player.maxMinions++; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 5); + recipe.AddIngredient(ItemID.Cloud, 3); + recipe.AddIngredient(ItemID.RainCloud); + recipe.AddIngredient(ItemID.Feather); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AerospecHood.cs b/Items/Armor/AerospecHood.cs index be31ecfdb5..9305d10322 100644 --- a/Items/Armor/AerospecHood.cs +++ b/Items/Armor/AerospecHood.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AerospecHood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Hood"); - Tooltip.SetDefault("8% increased ranged damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; - item.defense = 5; //18 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AerospecBreastplate") && legs.type == mod.ItemType("AerospecLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased movement speed and ranged critical strike chance\n" + - "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + - "Allows you to fall more quickly and disables fall damage"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aeroSet = true; - player.noFallDmg = true; - player.moveSpeed += 0.05f; - player.rangedCrit += 5; - } - - public override void UpdateEquip(Player player) - { - player.rangedDamage += 0.08f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 5); - recipe.AddIngredient(ItemID.Cloud, 3); - recipe.AddIngredient(ItemID.RainCloud); - recipe.AddIngredient(ItemID.Feather); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AerospecHood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerospec Hood"); + Tooltip.SetDefault("8% increased ranged damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 3; + item.defense = 5; //18 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AerospecBreastplate") && legs.type == mod.ItemType("AerospecLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased movement speed and ranged critical strike chance\n" + + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + + "Allows you to fall more quickly and disables fall damage"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aeroSet = true; + player.noFallDmg = true; + player.moveSpeed += 0.05f; + player.rangedCrit += 5; + } + + public override void UpdateEquip(Player player) + { + player.rangedDamage += 0.08f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 5); + recipe.AddIngredient(ItemID.Cloud, 3); + recipe.AddIngredient(ItemID.RainCloud); + recipe.AddIngredient(ItemID.Feather); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AerospecLeggings.cs b/Items/Armor/AerospecLeggings.cs index 552ab8bfdf..dee3c44058 100644 --- a/Items/Armor/AerospecLeggings.cs +++ b/Items/Armor/AerospecLeggings.cs @@ -1,47 +1,47 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class AerospecLeggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerospec Leggings"); - Tooltip.SetDefault("12% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 3; - item.defense = 6; - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 7); - recipe.AddIngredient(ItemID.Cloud, 6); - recipe.AddIngredient(ItemID.RainCloud, 3); - recipe.AddIngredient(ItemID.Feather, 2); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class AerospecLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerospec Leggings"); + Tooltip.SetDefault("12% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 3; + item.defense = 6; + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 7); + recipe.AddIngredient(ItemID.Cloud, 6); + recipe.AddIngredient(ItemID.RainCloud, 3); + recipe.AddIngredient(ItemID.Feather, 2); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AstralBreastplate.cs b/Items/Armor/AstralBreastplate.cs index 5c7fece0fa..02a9473afe 100644 --- a/Items/Armor/AstralBreastplate.cs +++ b/Items/Armor/AstralBreastplate.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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class AstralBreastplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Breastplate"); - Tooltip.SetDefault("+20 max mana and life\n" + - "+3 max minions\n" + - "Creature detection"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 32, 0, 0); - item.rare = 9; - item.defense = 25; - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 20; - player.statManaMax2 += 20; - player.maxMinions += 3; - player.detectCreature = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class AstralBreastplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Breastplate"); + Tooltip.SetDefault("+20 max mana and life\n" + + "+3 max minions\n" + + "Creature detection"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 32, 0, 0); + item.rare = 9; + item.defense = 25; + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 20; + player.statManaMax2 += 20; + player.maxMinions += 3; + player.detectCreature = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AstralHelm.cs b/Items/Armor/AstralHelm.cs index 76deb4225a..8b305a1567 100644 --- a/Items/Armor/AstralHelm.cs +++ b/Items/Armor/AstralHelm.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AstralHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Helm"); - Tooltip.SetDefault("Danger detection"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 40, 0, 0); - item.rare = 9; - item.defense = 17; //63 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AstralBreastplate") && legs.type == mod.ItemType("AstralLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "25% increased movement speed\n" + - "28% increased damage and 21% increased critical strike chance\n" + - "Whenever you crit an enemy fallen, hallowed, and astral stars will rain down\n" + - "This effect has a 1 second cooldown before it can trigger again"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.astralStarRain = true; - player.moveSpeed += 0.25f; - player.meleeDamage += 0.28f; - player.meleeCrit += 21; - player.rangedDamage += 0.28f; - player.rangedCrit += 21; - player.magicDamage += 0.28f; - player.magicCrit += 21; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.28f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 21; - player.minionDamage += 0.28f; - } - - public override void UpdateEquip(Player player) - { - player.dangerSense = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AstralHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Helm"); + Tooltip.SetDefault("Danger detection"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 40, 0, 0); + item.rare = 9; + item.defense = 17; //63 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AstralBreastplate") && legs.type == mod.ItemType("AstralLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "25% increased movement speed\n" + + "28% increased damage and 21% increased critical strike chance\n" + + "Whenever you crit an enemy fallen, hallowed, and astral stars will rain down\n" + + "This effect has a 1 second cooldown before it can trigger again"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.astralStarRain = true; + player.moveSpeed += 0.25f; + player.meleeDamage += 0.28f; + player.meleeCrit += 21; + player.rangedDamage += 0.28f; + player.rangedCrit += 21; + player.magicDamage += 0.28f; + player.magicCrit += 21; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.28f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 21; + player.minionDamage += 0.28f; + } + + public override void UpdateEquip(Player player) + { + player.dangerSense = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 8); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AstralLeggings.cs b/Items/Armor/AstralLeggings.cs index 2b8e083c31..5837a92188 100644 --- a/Items/Armor/AstralLeggings.cs +++ b/Items/Armor/AstralLeggings.cs @@ -1,46 +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.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class AstralLeggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Leggings"); - Tooltip.SetDefault("10% increased movement speed\n" + - "Treasure and ore detection"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 9; - item.defense = 21; - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.1f; - player.findTreasure = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class AstralLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Leggings"); + Tooltip.SetDefault("10% increased movement speed\n" + + "Treasure and ore detection"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 9; + item.defense = 21; + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.1f; + player.findTreasure = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AstrumDeusMask.cs b/Items/Armor/AstrumDeusMask.cs index ae7053cd54..4527ee89b3 100644 --- a/Items/Armor/AstrumDeusMask.cs +++ b/Items/Armor/AstrumDeusMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AstrumDeusMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AstrumDeusMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/AtaxiaArmor.cs b/Items/Armor/AtaxiaArmor.cs index 41874affac..bd2cf4ae24 100644 --- a/Items/Armor/AtaxiaArmor.cs +++ b/Items/Armor/AtaxiaArmor.cs @@ -1,55 +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; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class AtaxiaArmor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Armor"); - Tooltip.SetDefault("+20 max life\n" + - "8% increased damage and 4% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 8; - item.defense = 20; - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 20; - player.meleeCrit += 4; - player.meleeDamage += 0.08f; - player.magicCrit += 4; - player.magicDamage += 0.08f; - player.rangedCrit += 4; - player.rangedDamage += 0.08f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 4; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; - player.minionDamage += 0.08f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class AtaxiaArmor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Armor"); + Tooltip.SetDefault("+20 max life\n" + + "8% increased damage and 4% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 8; + item.defense = 20; + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 20; + player.meleeCrit += 4; + player.meleeDamage += 0.08f; + player.magicCrit += 4; + player.magicDamage += 0.08f; + player.rangedCrit += 4; + player.rangedDamage += 0.08f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 4; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; + player.minionDamage += 0.08f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AtaxiaHeadgear.cs b/Items/Armor/AtaxiaHeadgear.cs index d977d3b972..b6a1ac958e 100644 --- a/Items/Armor/AtaxiaHeadgear.cs +++ b/Items/Armor/AtaxiaHeadgear.cs @@ -1,77 +1,77 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AtaxiaHeadgear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Headgear"); - Tooltip.SetDefault("12% increased ranged damage and 10% increased ranged critical strike chance\n" + - "Reduces ammo usage by 25%, temporary immunity to lava, and immunity to fire damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; - item.defense = 15; //53 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AtaxiaArmor") && legs.type == mod.ItemType("AtaxiaSubligar"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } - - public override void DrawHair(ref bool drawHair, ref bool drawAltHair) - { - drawHair = true; - drawAltHair = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased ranged damage\n" + - "Inferno effect when below 50% life\n" + - "You have a 50% chance to fire a homing chaos flare when using ranged weapons\n" + - "You have a 20% chance to emit a blazing explosion when you are hit"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.ataxiaBlaze = true; - modPlayer.ataxiaBolt = true; - player.rangedDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.ammoCost75 = true; - player.rangedDamage += 0.12f; - player.rangedCrit += 10; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AtaxiaHeadgear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Headgear"); + Tooltip.SetDefault("12% increased ranged damage and 10% increased ranged critical strike chance\n" + + "Reduces ammo usage by 25%, temporary immunity to lava, and immunity to fire damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; + item.defense = 15; //53 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AtaxiaArmor") && legs.type == mod.ItemType("AtaxiaSubligar"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawOutlines = true; + } + + public override void DrawHair(ref bool drawHair, ref bool drawAltHair) + { + drawHair = true; + drawAltHair = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased ranged damage\n" + + "Inferno effect when below 50% life\n" + + "You have a 50% chance to fire a homing chaos flare when using ranged weapons\n" + + "You have a 20% chance to emit a blazing explosion when you are hit"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.ataxiaBlaze = true; + modPlayer.ataxiaBolt = true; + player.rangedDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.ammoCost75 = true; + player.rangedDamage += 0.12f; + player.rangedCrit += 10; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AtaxiaHelm.cs b/Items/Armor/AtaxiaHelm.cs index b2b7463d5e..e4d8b96569 100644 --- a/Items/Armor/AtaxiaHelm.cs +++ b/Items/Armor/AtaxiaHelm.cs @@ -1,76 +1,76 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AtaxiaHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Helm"); - Tooltip.SetDefault("12% increased melee damage and 10% increased melee critical strike chance\n" + - "12% increased melee and movement speed\n" + - "Melee attacks and melee projectiles inflict on fire\n" + - "Temporary immunity to lava and immunity to fire damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; - item.defense = 25; //67 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AtaxiaArmor") && legs.type == mod.ItemType("AtaxiaSubligar"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased melee damage\n" + - "Inferno effect when below 50% life\n" + - "Melee attacks and projectiles cause chaos flames to erupt on enemy hits\n" + - "You have a 20% chance to emit a blazing explosion when you are hit"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.ataxiaBlaze = true; - modPlayer.ataxiaGeyser = true; - player.meleeDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.ataxiaFire = true; - player.meleeSpeed += 0.12f; - player.moveSpeed += 0.12f; - player.meleeDamage += 0.12f; - player.meleeCrit += 10; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AtaxiaHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Helm"); + Tooltip.SetDefault("12% increased melee damage and 10% increased melee critical strike chance\n" + + "12% increased melee and movement speed\n" + + "Melee attacks and melee projectiles inflict on fire\n" + + "Temporary immunity to lava and immunity to fire damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; + item.defense = 25; //67 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AtaxiaArmor") && legs.type == mod.ItemType("AtaxiaSubligar"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased melee damage\n" + + "Inferno effect when below 50% life\n" + + "Melee attacks and projectiles cause chaos flames to erupt on enemy hits\n" + + "You have a 20% chance to emit a blazing explosion when you are hit"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.ataxiaBlaze = true; + modPlayer.ataxiaGeyser = true; + player.meleeDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.ataxiaFire = true; + player.meleeSpeed += 0.12f; + player.moveSpeed += 0.12f; + player.meleeDamage += 0.12f; + player.meleeCrit += 10; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AtaxiaHelmet.cs b/Items/Armor/AtaxiaHelmet.cs index 2139b51470..4ca09370f0 100644 --- a/Items/Armor/AtaxiaHelmet.cs +++ b/Items/Armor/AtaxiaHelmet.cs @@ -1,83 +1,83 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AtaxiaHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Helmet"); - Tooltip.SetDefault("5% increased minion damage and increased minion knockback\n" + - "+2 max minions\n" + - "Temporary immunity to lava and immunity to fire damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; - item.defense = 6; //40 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AtaxiaArmor") && legs.type == mod.ItemType("AtaxiaSubligar"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "40% increased minion damage\n" + - "Inferno effect when below 50% life\n" + - "Summons a chaos spirit to protect you\n" + - "You have a 20% chance to emit a blazing explosion when you are hit"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.ataxiaBlaze = true; - modPlayer.chaosSpirit = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("ChaosSpirit")) == -1) - { - player.AddBuff(mod.BuffType("ChaosSpirit"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("ChaosSpirit")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("ChaosSpirit"), (int)(190f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - } - player.minionDamage += 0.4f; - } - - public override void UpdateEquip(Player player) - { - player.minionDamage += 0.05f; - player.minionKB += 1.5f; - player.maxMinions += 2; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AtaxiaHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Helmet"); + Tooltip.SetDefault("5% increased minion damage and increased minion knockback\n" + + "+2 max minions\n" + + "Temporary immunity to lava and immunity to fire damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; + item.defense = 6; //40 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AtaxiaArmor") && legs.type == mod.ItemType("AtaxiaSubligar"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "40% increased minion damage\n" + + "Inferno effect when below 50% life\n" + + "Summons a chaos spirit to protect you\n" + + "You have a 20% chance to emit a blazing explosion when you are hit"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.ataxiaBlaze = true; + modPlayer.chaosSpirit = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("ChaosSpirit")) == -1) + { + player.AddBuff(mod.BuffType("ChaosSpirit"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("ChaosSpirit")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("ChaosSpirit"), (int)(190f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + } + player.minionDamage += 0.4f; + } + + public override void UpdateEquip(Player player) + { + player.minionDamage += 0.05f; + player.minionKB += 1.5f; + player.maxMinions += 2; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AtaxiaHood.cs b/Items/Armor/AtaxiaHood.cs index 5cb46d7b17..717fc7608b 100644 --- a/Items/Armor/AtaxiaHood.cs +++ b/Items/Armor/AtaxiaHood.cs @@ -1,78 +1,78 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AtaxiaHood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Hood"); - Tooltip.SetDefault("12% increased rogue damage and 10% increased rogue critical strike chance\n" + - "50% chance to not consume rogue items and 15% increased movement speed\n" + - "Temporary immunity to lava and immunity to fire damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; - item.defense = 12; //49 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AtaxiaArmor") && legs.type == mod.ItemType("AtaxiaSubligar"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased rogue damage\n" + - "Inferno effect when below 50% life\n" + - "Rogue weapons have a 10% chance to unleash a volley of chaos flames around the player that chase enemies when used\n" + - "You have a 20% chance to emit a blazing explosion when you are hit\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 120\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.ataxiaBlaze = true; - modPlayer.ataxiaVolley = true; - modPlayer.rogueStealthMax = 1.2f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingAmmoCost50 = true; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; - player.moveSpeed += 0.15f; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AtaxiaHood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Hood"); + Tooltip.SetDefault("12% increased rogue damage and 10% increased rogue critical strike chance\n" + + "50% chance to not consume rogue items and 15% increased movement speed\n" + + "Temporary immunity to lava and immunity to fire damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; + item.defense = 12; //49 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AtaxiaArmor") && legs.type == mod.ItemType("AtaxiaSubligar"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased rogue damage\n" + + "Inferno effect when below 50% life\n" + + "Rogue weapons have a 10% chance to unleash a volley of chaos flames around the player that chase enemies when used\n" + + "You have a 20% chance to emit a blazing explosion when you are hit\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 120\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.ataxiaBlaze = true; + modPlayer.ataxiaVolley = true; + modPlayer.rogueStealthMax = 1.2f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingAmmoCost50 = true; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; + player.moveSpeed += 0.15f; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AtaxiaMask.cs b/Items/Armor/AtaxiaMask.cs index 895f3fb96e..f4ad6e6583 100644 --- a/Items/Armor/AtaxiaMask.cs +++ b/Items/Armor/AtaxiaMask.cs @@ -1,72 +1,72 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AtaxiaMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Mask"); - Tooltip.SetDefault("12% increased magic damage, reduces mana usage by 15%, and 10% increased magic critical strike chance\n" + - "+100 max mana, temporary immunity to lava, and immunity to fire damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; - item.defense = 9; //45 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AtaxiaArmor") && legs.type == mod.ItemType("AtaxiaSubligar"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased magic damage\n" + - "Inferno effect when below 50% life\n" + - "Magic attacks summon damaging and healing flare orbs on hit\n" + - "You have a 20% chance to emit a blazing explosion when you are hit"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.ataxiaBlaze = true; - modPlayer.ataxiaMage = true; - player.magicDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.manaCost *= 0.85f; - player.statManaMax2 += 100; - player.magicDamage += 0.12f; - player.magicCrit += 10; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AtaxiaMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Mask"); + Tooltip.SetDefault("12% increased magic damage, reduces mana usage by 15%, and 10% increased magic critical strike chance\n" + + "+100 max mana, temporary immunity to lava, and immunity to fire damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; + item.defense = 9; //45 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AtaxiaArmor") && legs.type == mod.ItemType("AtaxiaSubligar"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased magic damage\n" + + "Inferno effect when below 50% life\n" + + "Magic attacks summon damaging and healing flare orbs on hit\n" + + "You have a 20% chance to emit a blazing explosion when you are hit"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.ataxiaBlaze = true; + modPlayer.ataxiaMage = true; + player.magicDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.manaCost *= 0.85f; + player.statManaMax2 += 100; + player.magicDamage += 0.12f; + player.magicCrit += 10; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AtaxiaSubligar.cs b/Items/Armor/AtaxiaSubligar.cs index 0bfe5baa96..a30700c3ea 100644 --- a/Items/Armor/AtaxiaSubligar.cs +++ b/Items/Armor/AtaxiaSubligar.cs @@ -1,50 +1,50 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class AtaxiaSubligar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Subligar"); - Tooltip.SetDefault("3% increased critical strike chance\n" + - "15% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = 8; - item.defense = 14; - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 3; - player.magicCrit += 3; - player.rangedCrit += 3; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - player.moveSpeed += 0.15f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class AtaxiaSubligar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Subligar"); + Tooltip.SetDefault("3% increased critical strike chance\n" + + "15% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 18, 0, 0); + item.rare = 8; + item.defense = 14; + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 3; + player.magicCrit += 3; + player.rangedCrit += 3; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + player.moveSpeed += 0.15f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AureusMask.cs b/Items/Armor/AureusMask.cs index af1be8f51f..916090b78c 100644 --- a/Items/Armor/AureusMask.cs +++ b/Items/Armor/AureusMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AureusMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Aureus Mask"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 28; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AureusMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Aureus Mask"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 28; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/AuricTeslaBodyArmor.cs b/Items/Armor/AuricTeslaBodyArmor.cs index 01f4e35b3e..9a2306cf15 100644 --- a/Items/Armor/AuricTeslaBodyArmor.cs +++ b/Items/Armor/AuricTeslaBodyArmor.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class AuricTeslaBodyArmor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Tesla Body Armor"); - 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" + - "You will freeze enemies near you when you are struck"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 44, 0, 0); - item.defense = 48; - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fBarrier = true; - modPlayer.godSlayerReflect = true; - player.statLifeMax2 += 100; - player.moveSpeed += 0.25f; - player.meleeDamage += 0.08f; - player.meleeCrit += 5; - player.rangedDamage += 0.08f; - player.rangedCrit += 5; - player.magicDamage += 0.08f; - player.magicCrit += 5; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - player.minionDamage += 0.08f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaArmor"); - recipe.AddIngredient(null, "GodSlayerChestplate"); - recipe.AddIngredient(null, "BloodflareBodyArmor"); - recipe.AddIngredient(null, "TarragonBreastplate"); - recipe.AddIngredient(null, "AuricOre", 100); - recipe.AddIngredient(null, "EndothermicEnergy", 30); - recipe.AddIngredient(null, "NightmareFuel", 30); - recipe.AddIngredient(null, "Phantoplasm", 20); - recipe.AddIngredient(null, "DarksunFragment", 15); - recipe.AddIngredient(null, "BarofLife", 10); - recipe.AddIngredient(null, "HellcasterFragment", 7); - recipe.AddIngredient(null, "CoreofCalamity", 5); - recipe.AddIngredient(null, "GalacticaSingularity", 3); - recipe.AddIngredient(null, "FrostBarrier"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class AuricTeslaBodyArmor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Tesla Body Armor"); + 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" + + "You will freeze enemies near you when you are struck"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(1, 44, 0, 0); + item.defense = 48; + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fBarrier = true; + modPlayer.godSlayerReflect = true; + player.statLifeMax2 += 100; + player.moveSpeed += 0.25f; + player.meleeDamage += 0.08f; + player.meleeCrit += 5; + player.rangedDamage += 0.08f; + player.rangedCrit += 5; + player.magicDamage += 0.08f; + player.magicCrit += 5; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + player.minionDamage += 0.08f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaArmor"); + recipe.AddIngredient(null, "GodSlayerChestplate"); + recipe.AddIngredient(null, "BloodflareBodyArmor"); + recipe.AddIngredient(null, "TarragonBreastplate"); + recipe.AddIngredient(null, "AuricOre", 100); + recipe.AddIngredient(null, "EndothermicEnergy", 30); + recipe.AddIngredient(null, "NightmareFuel", 30); + recipe.AddIngredient(null, "Phantoplasm", 20); + recipe.AddIngredient(null, "DarksunFragment", 15); + recipe.AddIngredient(null, "BarofLife", 10); + recipe.AddIngredient(null, "HellcasterFragment", 7); + recipe.AddIngredient(null, "CoreofCalamity", 5); + recipe.AddIngredient(null, "GalacticaSingularity", 3); + recipe.AddIngredient(null, "FrostBarrier"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AuricTeslaCuisses.cs b/Items/Armor/AuricTeslaCuisses.cs index 7c8407ff60..115b13fcce 100644 --- a/Items/Armor/AuricTeslaCuisses.cs +++ b/Items/Armor/AuricTeslaCuisses.cs @@ -1,70 +1,70 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class AuricTeslaCuisses : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Tesla Cuisses"); - Tooltip.SetDefault("50% increased movement speed\n" + - "12% increased damage and 5% increased critical strike chance\n" + - "Magic carpet effect"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 8, 0, 0); - item.defense = 44; - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.5f; - player.carpet = true; - player.meleeDamage += 0.12f; - player.meleeCrit += 5; - player.rangedDamage += 0.12f; - player.rangedCrit += 5; - player.magicDamage += 0.12f; - player.magicCrit += 5; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - player.minionDamage += 0.12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaLeggings"); - recipe.AddIngredient(null, "GodSlayerLeggings"); - recipe.AddIngredient(null, "BloodflareCuisses"); - recipe.AddIngredient(null, "TarragonLeggings"); - recipe.AddIngredient(null, "AuricOre", 80); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "Phantoplasm", 15); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddIngredient(null, "BarofLife", 8); - recipe.AddIngredient(null, "HellcasterFragment", 6); - recipe.AddIngredient(null, "CoreofCalamity", 3); - recipe.AddIngredient(null, "GalacticaSingularity", 2); - recipe.AddIngredient(ItemID.FlyingCarpet); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class AuricTeslaCuisses : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Tesla Cuisses"); + Tooltip.SetDefault("50% increased movement speed\n" + + "12% increased damage and 5% increased critical strike chance\n" + + "Magic carpet effect"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(1, 8, 0, 0); + item.defense = 44; + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.5f; + player.carpet = true; + player.meleeDamage += 0.12f; + player.meleeCrit += 5; + player.rangedDamage += 0.12f; + player.rangedCrit += 5; + player.magicDamage += 0.12f; + player.magicCrit += 5; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + player.minionDamage += 0.12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaLeggings"); + recipe.AddIngredient(null, "GodSlayerLeggings"); + recipe.AddIngredient(null, "BloodflareCuisses"); + recipe.AddIngredient(null, "TarragonLeggings"); + recipe.AddIngredient(null, "AuricOre", 80); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "Phantoplasm", 15); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddIngredient(null, "BarofLife", 8); + recipe.AddIngredient(null, "HellcasterFragment", 6); + recipe.AddIngredient(null, "CoreofCalamity", 3); + recipe.AddIngredient(null, "GalacticaSingularity", 2); + recipe.AddIngredient(ItemID.FlyingCarpet); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AuricTeslaHelm.cs b/Items/Armor/AuricTeslaHelm.cs index 12c6d5ee36..b53b9c9cde 100644 --- a/Items/Armor/AuricTeslaHelm.cs +++ b/Items/Armor/AuricTeslaHelm.cs @@ -1,99 +1,99 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AuricTeslaHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Tesla Royal Helm"); - Tooltip.SetDefault("20% increased melee damage and critical strike chance\n" + - "Not moving boosts all damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 54; //132 - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AuricTeslaBodyArmor") && legs.type == mod.ItemType("AuricTeslaCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Melee Tarragon, Bloodflare, God Slayer, and Silva armor effects\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"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tarraSet = true; - modPlayer.tarraMelee = true; - modPlayer.bloodflareSet = true; - modPlayer.bloodflareMelee = true; - modPlayer.godSlayer = true; - modPlayer.godSlayerDamage = true; - modPlayer.silvaSet = true; - modPlayer.silvaMelee = true; - modPlayer.auricSet = true; - player.thorns += 3f; - player.lavaMax += 240; - player.ignoreWater = true; - player.crimsonRegen = true; - player.aggro += 1200; - if (player.lavaWet) - { - player.statDefense += 30; - player.lifeRegen += 10; - } - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.auricBoost = true; - player.meleeDamage += 0.2f; - player.meleeCrit += 20; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaHelm"); - recipe.AddIngredient(null, "GodSlayerHelm"); - recipe.AddIngredient(null, "BloodflareMask"); - recipe.AddIngredient(null, "TarragonHelm"); - recipe.AddIngredient(null, "AuricOre", 60); - recipe.AddIngredient(null, "EndothermicEnergy", 10); - recipe.AddIngredient(null, "NightmareFuel", 10); - recipe.AddIngredient(null, "Phantoplasm", 8); - recipe.AddIngredient(null, "DarksunFragment", 6); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(null, "HellcasterFragment", 5); - recipe.AddIngredient(null, "CoreofCalamity", 2); - recipe.AddIngredient(null, "GalacticaSingularity"); - recipe.AddIngredient(null, "PsychoticAmulet"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AuricTeslaHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Tesla Royal Helm"); + Tooltip.SetDefault("20% increased melee damage and critical strike chance\n" + + "Not moving boosts all damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(1, 80, 0, 0); + item.defense = 54; //132 + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AuricTeslaBodyArmor") && legs.type == mod.ItemType("AuricTeslaCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Melee Tarragon, Bloodflare, God Slayer, and Silva armor effects\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"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tarraSet = true; + modPlayer.tarraMelee = true; + modPlayer.bloodflareSet = true; + modPlayer.bloodflareMelee = true; + modPlayer.godSlayer = true; + modPlayer.godSlayerDamage = true; + modPlayer.silvaSet = true; + modPlayer.silvaMelee = true; + modPlayer.auricSet = true; + player.thorns += 3f; + player.lavaMax += 240; + player.ignoreWater = true; + player.crimsonRegen = true; + player.aggro += 1200; + if (player.lavaWet) + { + player.statDefense += 30; + player.lifeRegen += 10; + } + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.auricBoost = true; + player.meleeDamage += 0.2f; + player.meleeCrit += 20; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaHelm"); + recipe.AddIngredient(null, "GodSlayerHelm"); + recipe.AddIngredient(null, "BloodflareMask"); + recipe.AddIngredient(null, "TarragonHelm"); + recipe.AddIngredient(null, "AuricOre", 60); + recipe.AddIngredient(null, "EndothermicEnergy", 10); + recipe.AddIngredient(null, "NightmareFuel", 10); + recipe.AddIngredient(null, "Phantoplasm", 8); + recipe.AddIngredient(null, "DarksunFragment", 6); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(null, "HellcasterFragment", 5); + recipe.AddIngredient(null, "CoreofCalamity", 2); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddIngredient(null, "PsychoticAmulet"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AuricTeslaHoodedFacemask.cs b/Items/Armor/AuricTeslaHoodedFacemask.cs index 76008a4958..7fb89f94d5 100644 --- a/Items/Armor/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/AuricTeslaHoodedFacemask.cs @@ -1,97 +1,97 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AuricTeslaHoodedFacemask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Tesla Hooded Facemask"); - Tooltip.SetDefault("30% increased ranged damage and critical strike chance\n" + - "Not moving boosts all damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 40; //132 - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AuricTeslaBodyArmor") && legs.type == mod.ItemType("AuricTeslaCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Ranged Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + - "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tarraSet = true; - modPlayer.tarraRanged = true; - modPlayer.bloodflareSet = true; - modPlayer.bloodflareRanged = true; - modPlayer.godSlayer = true; - modPlayer.godSlayerRanged = true; - modPlayer.silvaSet = true; - modPlayer.silvaRanged = true; - modPlayer.auricSet = true; - player.thorns += 3f; - player.lavaMax += 240; - player.ignoreWater = true; - player.crimsonRegen = true; - if (player.lavaWet) - { - player.statDefense += 30; - player.lifeRegen += 10; - } - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.auricBoost = true; - player.rangedDamage += 0.3f; - player.rangedCrit += 30; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaHornedHelm"); - recipe.AddIngredient(null, "GodSlayerHelmet"); - recipe.AddIngredient(null, "BloodflareHornedHelm"); - recipe.AddIngredient(null, "TarragonVisage"); - recipe.AddIngredient(null, "AuricOre", 60); - recipe.AddIngredient(null, "EndothermicEnergy", 10); - recipe.AddIngredient(null, "NightmareFuel", 10); - recipe.AddIngredient(null, "Phantoplasm", 8); - recipe.AddIngredient(null, "DarksunFragment", 6); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(null, "HellcasterFragment", 5); - recipe.AddIngredient(null, "CoreofCalamity", 2); - recipe.AddIngredient(null, "GalacticaSingularity"); - recipe.AddIngredient(null, "PsychoticAmulet"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AuricTeslaHoodedFacemask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Tesla Hooded Facemask"); + Tooltip.SetDefault("30% increased ranged damage and critical strike chance\n" + + "Not moving boosts all damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(1, 80, 0, 0); + item.defense = 40; //132 + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AuricTeslaBodyArmor") && legs.type == mod.ItemType("AuricTeslaCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Ranged Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + + "All projectiles spawn healing auric orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 10%"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tarraSet = true; + modPlayer.tarraRanged = true; + modPlayer.bloodflareSet = true; + modPlayer.bloodflareRanged = true; + modPlayer.godSlayer = true; + modPlayer.godSlayerRanged = true; + modPlayer.silvaSet = true; + modPlayer.silvaRanged = true; + modPlayer.auricSet = true; + player.thorns += 3f; + player.lavaMax += 240; + player.ignoreWater = true; + player.crimsonRegen = true; + if (player.lavaWet) + { + player.statDefense += 30; + player.lifeRegen += 10; + } + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.auricBoost = true; + player.rangedDamage += 0.3f; + player.rangedCrit += 30; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaHornedHelm"); + recipe.AddIngredient(null, "GodSlayerHelmet"); + recipe.AddIngredient(null, "BloodflareHornedHelm"); + recipe.AddIngredient(null, "TarragonVisage"); + recipe.AddIngredient(null, "AuricOre", 60); + recipe.AddIngredient(null, "EndothermicEnergy", 10); + recipe.AddIngredient(null, "NightmareFuel", 10); + recipe.AddIngredient(null, "Phantoplasm", 8); + recipe.AddIngredient(null, "DarksunFragment", 6); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(null, "HellcasterFragment", 5); + recipe.AddIngredient(null, "CoreofCalamity", 2); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddIngredient(null, "PsychoticAmulet"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index c1ac8f397f..c1b1ba23d1 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -1,104 +1,104 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AuricTeslaPlumedHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Tesla Plumed Helm"); - Tooltip.SetDefault("20% increased rogue damage and critical strike chance, 25% increased movement speed\n" + - "Not moving boosts all damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 34; //132 - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AuricTeslaBodyArmor") && legs.type == mod.ItemType("AuricTeslaCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Rogue Tarragon, Bloodflare, God Slayer, and Silva armor effects\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" + - "Rogue stealth builds while not attacking and not moving, up to a max of 160\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tarraSet = true; - modPlayer.tarraThrowing = true; - modPlayer.bloodflareSet = true; - modPlayer.bloodflareThrowing = true; - modPlayer.godSlayer = true; - modPlayer.godSlayerThrowing = true; - modPlayer.silvaSet = true; - modPlayer.silvaThrowing = true; - modPlayer.auricSet = true; - modPlayer.rogueStealthMax = 1.6f; - player.thorns += 3f; - player.lavaMax += 240; - player.ignoreWater = true; - player.crimsonRegen = true; - if (player.lavaWet) - { - player.statDefense += 30; - player.lifeRegen += 10; - } - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.auricBoost = true; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.2f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 20; - player.moveSpeed += 0.25f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaMask"); - recipe.AddIngredient(null, "GodSlayerMask"); - recipe.AddIngredient(null, "BloodflareHelm"); - recipe.AddIngredient(null, "TarragonHelmet"); - recipe.AddIngredient(null, "AuricOre", 60); - recipe.AddIngredient(null, "EndothermicEnergy", 10); - recipe.AddIngredient(null, "NightmareFuel", 10); - recipe.AddIngredient(null, "Phantoplasm", 8); - recipe.AddIngredient(null, "DarksunFragment", 6); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(null, "HellcasterFragment", 5); - recipe.AddIngredient(null, "CoreofCalamity", 2); - recipe.AddIngredient(null, "GalacticaSingularity"); - recipe.AddIngredient(null, "PsychoticAmulet"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AuricTeslaPlumedHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Tesla Plumed Helm"); + Tooltip.SetDefault("20% increased rogue damage and critical strike chance, 25% increased movement speed\n" + + "Not moving boosts all damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(1, 80, 0, 0); + item.defense = 34; //132 + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AuricTeslaBodyArmor") && legs.type == mod.ItemType("AuricTeslaCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Rogue Tarragon, Bloodflare, God Slayer, and Silva armor effects\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" + + "Rogue stealth builds while not attacking and not moving, up to a max of 160\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tarraSet = true; + modPlayer.tarraThrowing = true; + modPlayer.bloodflareSet = true; + modPlayer.bloodflareThrowing = true; + modPlayer.godSlayer = true; + modPlayer.godSlayerThrowing = true; + modPlayer.silvaSet = true; + modPlayer.silvaThrowing = true; + modPlayer.auricSet = true; + modPlayer.rogueStealthMax = 1.6f; + player.thorns += 3f; + player.lavaMax += 240; + player.ignoreWater = true; + player.crimsonRegen = true; + if (player.lavaWet) + { + player.statDefense += 30; + player.lifeRegen += 10; + } + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.auricBoost = true; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.2f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 20; + player.moveSpeed += 0.25f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaMask"); + recipe.AddIngredient(null, "GodSlayerMask"); + recipe.AddIngredient(null, "BloodflareHelm"); + recipe.AddIngredient(null, "TarragonHelmet"); + recipe.AddIngredient(null, "AuricOre", 60); + recipe.AddIngredient(null, "EndothermicEnergy", 10); + recipe.AddIngredient(null, "NightmareFuel", 10); + recipe.AddIngredient(null, "Phantoplasm", 8); + recipe.AddIngredient(null, "DarksunFragment", 6); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(null, "HellcasterFragment", 5); + recipe.AddIngredient(null, "CoreofCalamity", 2); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddIngredient(null, "PsychoticAmulet"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index b884cfde19..2bbc8db68b 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -1,229 +1,229 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AuricTeslaSpaceHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Tesla Space Helmet"); - Tooltip.SetDefault("+7 max minions\n" + - "Not moving boosts all damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 12; //132 - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AuricTeslaBodyArmor") && legs.type == mod.ItemType("AuricTeslaCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Summoner Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + - "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%\n" + - "120% increased minion damage"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tarraSet = true; - modPlayer.tarraSummon = true; - modPlayer.bloodflareSet = true; - modPlayer.bloodflareSummon = true; - modPlayer.godSlayer = true; - modPlayer.godSlayerSummon = true; - modPlayer.silvaSet = true; - modPlayer.silvaSummon = true; - modPlayer.auricSet = true; - player.thorns += 3f; - player.lavaMax += 240; - player.ignoreWater = true; - player.crimsonRegen = true; - player.minionDamage += 1.2f; - if (player.lavaWet) - { - player.statDefense += 30; - player.lifeRegen += 10; - } - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("SilvaCrystal")) == -1) - { - player.AddBuff(mod.BuffType("SilvaCrystal"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("SilvaCrystal")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SilvaCrystal"), (int)(3000f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - if (player.FindBuffIndex(mod.BuffType("Mechworm")) == -1) - { - player.AddBuff(mod.BuffType("Mechworm"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("MechwormHead")] < 1) - { - int owner = player.whoAmI; - int typeHead = mod.ProjectileType("MechwormHead"); - int typeBody = mod.ProjectileType("MechwormBody"); - int typeBody2 = mod.ProjectileType("MechwormBody2"); - int typeTail = mod.ProjectileType("MechwormTail"); - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) - { - if (Main.projectile[i].type == typeHead || Main.projectile[i].type == typeTail || Main.projectile[i].type == typeBody || - Main.projectile[i].type == typeBody2) - { - Main.projectile[i].Kill(); - } - } - } - int maxMinionScale = player.maxMinions; - if (maxMinionScale > 10) - { - maxMinionScale = 10; - } - int damage = (int)(35 * ((player.minionDamage * 5 / 3) + ((player.minionDamage * 0.46f) * (maxMinionScale - 1)))); - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; - float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) - { - velX = (float)player.direction; - velY = 0f; - dist = 10f; - } - else - { - dist = 10f / dist; - } - velX *= dist; - velY *= dist; - int head = -1; - int tail = -1; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) - { - if (head == -1 && Main.projectile[i].type == typeHead) - { - head = i; - } - else if (tail == -1 && Main.projectile[i].type == typeTail) - { - tail = i; - } - if (head != -1 && tail != -1) - { - break; - } - } - } - if (head == -1 && tail == -1) - { - float num77 = Vector2.Dot(value, vector3); - if (num77 > 0f) - { - player.ChangeDir(1); - } - else - { - player.ChangeDir(-1); - } - velX = 0f; - velY = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormHead"), damage, 1f, owner); - - int prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, 1f, owner, (float)prev); - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, 1f, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormTail"), damage, 1f, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - } - else if (head != -1 && tail != -1) - { - int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, 1f, owner, Main.projectile[tail].ai[0]); - int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, 1f, owner, (float)body); - - Main.projectile[body].localAI[1] = (float)back; - Main.projectile[body].ai[1] = 1f; - Main.projectile[body].minionSlots = 0f; - Main.projectile[body].netUpdate = true; - - Main.projectile[back].localAI[1] = (float)tail; - Main.projectile[back].netUpdate = true; - Main.projectile[back].minionSlots = 0f; - Main.projectile[back].ai[1] = 1f; - - Main.projectile[tail].ai[0] = (float)back; - Main.projectile[tail].netUpdate = true; - Main.projectile[tail].ai[1] = 1f; - } - } - } - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.auricBoost = true; - player.maxMinions += 7; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaHelmet"); - recipe.AddIngredient(null, "GodSlayerHornedHelm"); - recipe.AddIngredient(null, "BloodflareHelmet"); - recipe.AddIngredient(null, "TarragonHornedHelm"); - recipe.AddIngredient(null, "AuricOre", 60); - recipe.AddIngredient(null, "EndothermicEnergy", 10); - recipe.AddIngredient(null, "NightmareFuel", 10); - recipe.AddIngredient(null, "Phantoplasm", 8); - recipe.AddIngredient(null, "DarksunFragment", 6); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(null, "HellcasterFragment", 5); - recipe.AddIngredient(null, "CoreofCalamity", 2); - recipe.AddIngredient(null, "GalacticaSingularity"); - recipe.AddIngredient(null, "PsychoticAmulet"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AuricTeslaSpaceHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Tesla Space Helmet"); + Tooltip.SetDefault("+7 max minions\n" + + "Not moving boosts all damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(1, 80, 0, 0); + item.defense = 12; //132 + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AuricTeslaBodyArmor") && legs.type == mod.ItemType("AuricTeslaCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Summoner Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + + "All projectiles spawn healing auric orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 10%\n" + + "120% increased minion damage"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tarraSet = true; + modPlayer.tarraSummon = true; + modPlayer.bloodflareSet = true; + modPlayer.bloodflareSummon = true; + modPlayer.godSlayer = true; + modPlayer.godSlayerSummon = true; + modPlayer.silvaSet = true; + modPlayer.silvaSummon = true; + modPlayer.auricSet = true; + player.thorns += 3f; + player.lavaMax += 240; + player.ignoreWater = true; + player.crimsonRegen = true; + player.minionDamage += 1.2f; + if (player.lavaWet) + { + player.statDefense += 30; + player.lifeRegen += 10; + } + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("SilvaCrystal")) == -1) + { + player.AddBuff(mod.BuffType("SilvaCrystal"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("SilvaCrystal")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SilvaCrystal"), (int)(3000f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + if (player.FindBuffIndex(mod.BuffType("Mechworm")) == -1) + { + player.AddBuff(mod.BuffType("Mechworm"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("MechwormHead")] < 1) + { + int owner = player.whoAmI; + int typeHead = mod.ProjectileType("MechwormHead"); + int typeBody = mod.ProjectileType("MechwormBody"); + int typeBody2 = mod.ProjectileType("MechwormBody2"); + int typeTail = mod.ProjectileType("MechwormTail"); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == owner) + { + if (Main.projectile[i].type == typeHead || Main.projectile[i].type == typeTail || Main.projectile[i].type == typeBody || + Main.projectile[i].type == typeBody2) + { + Main.projectile[i].Kill(); + } + } + } + int maxMinionScale = player.maxMinions; + if (maxMinionScale > 10) + { + maxMinionScale = 10; + } + int damage = (int)(35 * ((player.minionDamage * 5 / 3) + ((player.minionDamage * 0.46f) * (maxMinionScale - 1)))); + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); + Vector2 vector3 = Main.MouseWorld - vector2; + float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) + { + velX = (float)player.direction; + velY = 0f; + dist = 10f; + } + else + { + dist = 10f / dist; + } + velX *= dist; + velY *= dist; + int head = -1; + int tail = -1; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == owner) + { + if (head == -1 && Main.projectile[i].type == typeHead) + { + head = i; + } + else if (tail == -1 && Main.projectile[i].type == typeTail) + { + tail = i; + } + if (head != -1 && tail != -1) + { + break; + } + } + } + if (head == -1 && tail == -1) + { + float num77 = Vector2.Dot(value, vector3); + if (num77 > 0f) + { + player.ChangeDir(1); + } + else + { + player.ChangeDir(-1); + } + velX = 0f; + velY = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormHead"), damage, 1f, owner); + + int prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, 1f, owner, (float)prev); + + prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, 1f, owner, (float)prev); + Main.projectile[prev].localAI[1] = (float)curr; + Main.projectile[prev].netUpdate = true; + + prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormTail"), damage, 1f, owner, (float)prev); + Main.projectile[prev].localAI[1] = (float)curr; + Main.projectile[prev].netUpdate = true; + } + else if (head != -1 && tail != -1) + { + int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, 1f, owner, Main.projectile[tail].ai[0]); + int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, 1f, owner, (float)body); + + Main.projectile[body].localAI[1] = (float)back; + Main.projectile[body].ai[1] = 1f; + Main.projectile[body].minionSlots = 0f; + Main.projectile[body].netUpdate = true; + + Main.projectile[back].localAI[1] = (float)tail; + Main.projectile[back].netUpdate = true; + Main.projectile[back].minionSlots = 0f; + Main.projectile[back].ai[1] = 1f; + + Main.projectile[tail].ai[0] = (float)back; + Main.projectile[tail].netUpdate = true; + Main.projectile[tail].ai[1] = 1f; + } + } + } + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.auricBoost = true; + player.maxMinions += 7; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaHelmet"); + recipe.AddIngredient(null, "GodSlayerHornedHelm"); + recipe.AddIngredient(null, "BloodflareHelmet"); + recipe.AddIngredient(null, "TarragonHornedHelm"); + recipe.AddIngredient(null, "AuricOre", 60); + recipe.AddIngredient(null, "EndothermicEnergy", 10); + recipe.AddIngredient(null, "NightmareFuel", 10); + recipe.AddIngredient(null, "Phantoplasm", 8); + recipe.AddIngredient(null, "DarksunFragment", 6); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(null, "HellcasterFragment", 5); + recipe.AddIngredient(null, "CoreofCalamity", 2); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddIngredient(null, "PsychoticAmulet"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.cs b/Items/Armor/AuricTeslaWireHemmedVisage.cs index 82e892e044..51281e882d 100644 --- a/Items/Armor/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/AuricTeslaWireHemmedVisage.cs @@ -1,99 +1,99 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class AuricTeslaWireHemmedVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Tesla Wire-Hemmed Visage"); - Tooltip.SetDefault("20% increased magic damage and critical strike chance, +100 max mana, and 20% reduced mana usage\n" + - "Not moving boosts all damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(1, 80, 0, 0); - item.defense = 24; //132 - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("AuricTeslaBodyArmor") && legs.type == mod.ItemType("AuricTeslaCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Magic Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + - "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tarraSet = true; - modPlayer.tarraMage = true; - modPlayer.bloodflareSet = true; - modPlayer.bloodflareMage = true; - modPlayer.godSlayer = true; - modPlayer.godSlayerMage = true; - modPlayer.silvaSet = true; - modPlayer.silvaMage = true; - modPlayer.auricSet = true; - player.thorns += 3f; - player.lavaMax += 240; - player.ignoreWater = true; - player.crimsonRegen = true; - if (player.lavaWet) - { - player.statDefense += 30; - player.lifeRegen += 10; - } - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.auricBoost = true; - player.manaCost *= 0.8f; - player.magicDamage += 0.2f; - player.magicCrit += 20; - player.statManaMax2 += 100; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SilvaMaskedCap"); - recipe.AddIngredient(null, "GodSlayerVisage"); - recipe.AddIngredient(null, "BloodflareHornedMask"); - recipe.AddIngredient(null, "TarragonMask"); - recipe.AddIngredient(null, "AuricOre", 60); - recipe.AddIngredient(null, "EndothermicEnergy", 10); - recipe.AddIngredient(null, "NightmareFuel", 10); - recipe.AddIngredient(null, "Phantoplasm", 8); - recipe.AddIngredient(null, "DarksunFragment", 6); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(null, "HellcasterFragment", 5); - recipe.AddIngredient(null, "CoreofCalamity", 2); - recipe.AddIngredient(null, "GalacticaSingularity"); - recipe.AddIngredient(null, "PsychoticAmulet"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class AuricTeslaWireHemmedVisage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Tesla Wire-Hemmed Visage"); + Tooltip.SetDefault("20% increased magic damage and critical strike chance, +100 max mana, and 20% reduced mana usage\n" + + "Not moving boosts all damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(1, 80, 0, 0); + item.defense = 24; //132 + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("AuricTeslaBodyArmor") && legs.type == mod.ItemType("AuricTeslaCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Magic Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + + "All projectiles spawn healing auric orbs on enemy hits\n" + + "Max run speed and acceleration boosted by 10%"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tarraSet = true; + modPlayer.tarraMage = true; + modPlayer.bloodflareSet = true; + modPlayer.bloodflareMage = true; + modPlayer.godSlayer = true; + modPlayer.godSlayerMage = true; + modPlayer.silvaSet = true; + modPlayer.silvaMage = true; + modPlayer.auricSet = true; + player.thorns += 3f; + player.lavaMax += 240; + player.ignoreWater = true; + player.crimsonRegen = true; + if (player.lavaWet) + { + player.statDefense += 30; + player.lifeRegen += 10; + } + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.auricBoost = true; + player.manaCost *= 0.8f; + player.magicDamage += 0.2f; + player.magicCrit += 20; + player.statManaMax2 += 100; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SilvaMaskedCap"); + recipe.AddIngredient(null, "GodSlayerVisage"); + recipe.AddIngredient(null, "BloodflareHornedMask"); + recipe.AddIngredient(null, "TarragonMask"); + recipe.AddIngredient(null, "AuricOre", 60); + recipe.AddIngredient(null, "EndothermicEnergy", 10); + recipe.AddIngredient(null, "NightmareFuel", 10); + recipe.AddIngredient(null, "Phantoplasm", 8); + recipe.AddIngredient(null, "DarksunFragment", 6); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(null, "HellcasterFragment", 5); + recipe.AddIngredient(null, "CoreofCalamity", 2); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddIngredient(null, "PsychoticAmulet"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/BloodflareBodyArmor.cs b/Items/Armor/BloodflareBodyArmor.cs index d6c963e61c..e24bee2ed1 100644 --- a/Items/Armor/BloodflareBodyArmor.cs +++ b/Items/Armor/BloodflareBodyArmor.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class BloodflareBodyArmor : ModItem - { - public override void SetStaticDefaults() - { - 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"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 48, 0, 0); - item.defense = 35; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 40; - player.meleeDamage += 0.12f; - player.meleeCrit += 8; - player.magicDamage += 0.12f; - player.magicCrit += 8; - player.rangedDamage += 0.12f; - player.rangedCrit += 8; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; - player.minionDamage += 0.12f; - if (player.lavaWet) - { - player.statDefense += 30; - player.lifeRegen += 10; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 16); - recipe.AddIngredient(null, "RuinousSoul", 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class BloodflareBodyArmor : ModItem + { + public override void SetStaticDefaults() + { + 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"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 48, 0, 0); + item.defense = 35; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 40; + player.meleeDamage += 0.12f; + player.meleeCrit += 8; + player.magicDamage += 0.12f; + player.magicCrit += 8; + player.rangedDamage += 0.12f; + player.rangedCrit += 8; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; + player.minionDamage += 0.12f; + if (player.lavaWet) + { + player.statDefense += 30; + player.lifeRegen += 10; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 16); + recipe.AddIngredient(null, "RuinousSoul", 4); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/BloodflareCuisses.cs b/Items/Armor/BloodflareCuisses.cs index cde79c94e3..2fa2f83dd3 100644 --- a/Items/Armor/BloodflareCuisses.cs +++ b/Items/Armor/BloodflareCuisses.cs @@ -1,55 +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.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class BloodflareCuisses : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodflare Cuisses"); - Tooltip.SetDefault("30% increased movement speed, 10% increased damage and 7% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 36, 0, 0); - item.defense = 29; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.3f; - player.meleeDamage += 0.1f; - player.meleeCrit += 7; - player.magicDamage += 0.1f; - player.magicCrit += 7; - player.rangedDamage += 0.1f; - player.rangedCrit += 7; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; - player.minionDamage += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 13); - recipe.AddIngredient(null, "RuinousSoul", 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class BloodflareCuisses : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Cuisses"); + Tooltip.SetDefault("30% increased movement speed, 10% increased damage and 7% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 36, 0, 0); + item.defense = 29; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.3f; + player.meleeDamage += 0.1f; + player.meleeCrit += 7; + player.magicDamage += 0.1f; + player.magicCrit += 7; + player.rangedDamage += 0.1f; + player.rangedCrit += 7; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; + player.minionDamage += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 13); + recipe.AddIngredient(null, "RuinousSoul", 3); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs index f6d88148ee..ef915e28a8 100644 --- a/Items/Armor/BloodflareHelm.cs +++ b/Items/Armor/BloodflareHelm.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class BloodflareHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodflare Helm"); - Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased rogue damage and critical strike chance, 15% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 28; //85 - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("BloodflareBodyArmor") && legs.type == mod.ItemType("BloodflareCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bloodflareSet = true; - modPlayer.bloodflareThrowing = true; - modPlayer.rogueStealthMax = 1.35f; - player.setBonus = "Greatly increases life regen\n" + - "Enemies below 50% life have a chance to drop hearts when struck\n" + - "Enemies above 50% life have a chance to drop mana stars when struck\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + - "Being over 80% life boosts your defense by 30 and rogue crit by 5%\n" + - "Being below 80% life boosts your rogue damage by 10%\n" + - "Rogue critical strikes have a 50% chance to heal you\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 135\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - player.crimsonRegen = true; - } - - public override void UpdateEquip(Player player) - { - player.lavaMax += 240; - player.ignoreWater = true; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; - player.moveSpeed += 0.15f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 11); - recipe.AddIngredient(null, "RuinousSoul", 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class BloodflareHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Helm"); + Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + + "10% increased rogue damage and critical strike chance, 15% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 28; //85 + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("BloodflareBodyArmor") && legs.type == mod.ItemType("BloodflareCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.bloodflareSet = true; + modPlayer.bloodflareThrowing = true; + modPlayer.rogueStealthMax = 1.35f; + player.setBonus = "Greatly increases life regen\n" + + "Enemies below 50% life have a chance to drop hearts when struck\n" + + "Enemies above 50% life have a chance to drop mana stars when struck\n" + + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + + "Being over 80% life boosts your defense by 30 and rogue crit by 5%\n" + + "Being below 80% life boosts your rogue damage by 10%\n" + + "Rogue critical strikes have a 50% chance to heal you\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 135\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + player.crimsonRegen = true; + } + + public override void UpdateEquip(Player player) + { + player.lavaMax += 240; + player.ignoreWater = true; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; + player.moveSpeed += 0.15f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 11); + recipe.AddIngredient(null, "RuinousSoul", 2); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/BloodflareHelmet.cs b/Items/Armor/BloodflareHelmet.cs index 828cc0ef9d..05cd7c6fb2 100644 --- a/Items/Armor/BloodflareHelmet.cs +++ b/Items/Armor/BloodflareHelmet.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class BloodflareHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodflare Helmet"); - Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "+3 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 16; //85 - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("BloodflareBodyArmor") && legs.type == mod.ItemType("BloodflareCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bloodflareSet = true; - modPlayer.bloodflareSummon = true; - player.setBonus = "55% increased minion damage\n" + - "Greatly increases life regen\n" + - "Enemies below 50% life have a chance to drop hearts when struck\n" + - "Enemies above 50% life have a chance to drop mana stars when struck\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + - "Summons polterghast mines to circle you\n" + - "At 90% life and above you gain 10% increased minion damage\n" + - "At 50% life and below you gain 20 defense and 2 life regen"; - player.crimsonRegen = true; - player.minionDamage += 0.55f; - } - - public override void UpdateEquip(Player player) - { - player.lavaMax += 240; - player.ignoreWater = true; - player.maxMinions += 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 11); - recipe.AddIngredient(null, "RuinousSoul", 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class BloodflareHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Helmet"); + Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + + "+3 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 16; //85 + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("BloodflareBodyArmor") && legs.type == mod.ItemType("BloodflareCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.bloodflareSet = true; + modPlayer.bloodflareSummon = true; + player.setBonus = "55% increased minion damage\n" + + "Greatly increases life regen\n" + + "Enemies below 50% life have a chance to drop hearts when struck\n" + + "Enemies above 50% life have a chance to drop mana stars when struck\n" + + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + + "Summons polterghast mines to circle you\n" + + "At 90% life and above you gain 10% increased minion damage\n" + + "At 50% life and below you gain 20 defense and 2 life regen"; + player.crimsonRegen = true; + player.minionDamage += 0.55f; + } + + public override void UpdateEquip(Player player) + { + player.lavaMax += 240; + player.ignoreWater = true; + player.maxMinions += 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 11); + recipe.AddIngredient(null, "RuinousSoul", 2); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/BloodflareHornedHelm.cs b/Items/Armor/BloodflareHornedHelm.cs index c8ec9eeabb..e0c9b6fa10 100644 --- a/Items/Armor/BloodflareHornedHelm.cs +++ b/Items/Armor/BloodflareHornedHelm.cs @@ -1,74 +1,74 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class BloodflareHornedHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodflare Horned Helm"); - Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased ranged damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 34; //85 - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("BloodflareBodyArmor") && legs.type == mod.ItemType("BloodflareCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bloodflareSet = true; - modPlayer.bloodflareRanged = true; - player.setBonus = "Greatly increases life regen\n" + - "Enemies below 50% life have a chance to drop hearts when struck\n" + - "Enemies above 50% life have a chance to drop mana stars when struck\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + - "Press Y to unleash the lost souls of polterghast to destroy your enemies\n" + - "This effect has a 30 second cooldown\n" + - "Ranged weapons have a chance to fire bloodsplosion orbs"; - player.crimsonRegen = true; - } - - public override void UpdateEquip(Player player) - { - player.lavaMax += 240; - player.ignoreWater = true; - player.rangedDamage += 0.1f; - player.rangedCrit += 10; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 11); - recipe.AddIngredient(null, "RuinousSoul", 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class BloodflareHornedHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Horned Helm"); + Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + + "10% increased ranged damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 34; //85 + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("BloodflareBodyArmor") && legs.type == mod.ItemType("BloodflareCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.bloodflareSet = true; + modPlayer.bloodflareRanged = true; + player.setBonus = "Greatly increases life regen\n" + + "Enemies below 50% life have a chance to drop hearts when struck\n" + + "Enemies above 50% life have a chance to drop mana stars when struck\n" + + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + + "Press Y to unleash the lost souls of polterghast to destroy your enemies\n" + + "This effect has a 30 second cooldown\n" + + "Ranged weapons have a chance to fire bloodsplosion orbs"; + player.crimsonRegen = true; + } + + public override void UpdateEquip(Player player) + { + player.lavaMax += 240; + player.ignoreWater = true; + player.rangedDamage += 0.1f; + player.rangedCrit += 10; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 11); + recipe.AddIngredient(null, "RuinousSoul", 2); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs index a7fa952867..6d3f37de0f 100644 --- a/Items/Armor/BloodflareHornedMask.cs +++ b/Items/Armor/BloodflareHornedMask.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class BloodflareHornedMask : ModItem - { - public override void SetStaticDefaults() - { - 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, +100 max mana, and 17% reduced mana usage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 22; //85 - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("BloodflareBodyArmor") && legs.type == mod.ItemType("BloodflareCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bloodflareSet = true; - modPlayer.bloodflareMage = true; - player.setBonus = "Greatly increases life regen\n" + - "Enemies below 50% life have a chance to drop hearts when struck\n" + - "Enemies above 50% life have a chance to drop mana stars when struck\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + - "Magic weapons will sometimes fire ghostly bolts\n" + - "Magic critical strikes cause flame explosions every 2 seconds"; - player.crimsonRegen = true; - } - - public override void UpdateEquip(Player player) - { - player.manaCost *= 0.83f; - player.lavaMax += 240; - player.ignoreWater = true; - player.magicDamage += 0.1f; - player.magicCrit += 10; - player.statManaMax2 += 100; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 11); - recipe.AddIngredient(null, "RuinousSoul", 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class BloodflareHornedMask : ModItem + { + public override void SetStaticDefaults() + { + 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, +100 max mana, and 17% reduced mana usage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 22; //85 + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("BloodflareBodyArmor") && legs.type == mod.ItemType("BloodflareCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.bloodflareSet = true; + modPlayer.bloodflareMage = true; + player.setBonus = "Greatly increases life regen\n" + + "Enemies below 50% life have a chance to drop hearts when struck\n" + + "Enemies above 50% life have a chance to drop mana stars when struck\n" + + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + + "Magic weapons will sometimes fire ghostly bolts\n" + + "Magic critical strikes cause flame explosions every 2 seconds"; + player.crimsonRegen = true; + } + + public override void UpdateEquip(Player player) + { + player.manaCost *= 0.83f; + player.lavaMax += 240; + player.ignoreWater = true; + player.magicDamage += 0.1f; + player.magicCrit += 10; + player.statManaMax2 += 100; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 11); + recipe.AddIngredient(null, "RuinousSoul", 2); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/BloodflareMask.cs b/Items/Armor/BloodflareMask.cs index 0ca2e20a69..5d66ed69ae 100644 --- a/Items/Armor/BloodflareMask.cs +++ b/Items/Armor/BloodflareMask.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class BloodflareMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodflare Mask"); - Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased melee damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 49; //85 - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("BloodflareBodyArmor") && legs.type == mod.ItemType("BloodflareCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bloodflareSet = true; - modPlayer.bloodflareMelee = true; - player.setBonus = "Greatly increases life regen\n" + - "Enemies are more likely to target you\n" + - "Enemies below 50% life have a chance to drop hearts when struck\n" + - "Enemies above 50% life have a chance to drop mana stars when struck\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + - "True melee strikes will heal you\n" + - "After striking an enemy 15 times with true melee you will enter a blood frenzy for 5 seconds\n" + - "During this you will gain 25% increased melee damage, critical strike chance, and contact damage is halved\n" + - "This effect has a 30 second cooldown"; - player.crimsonRegen = true; - player.aggro += 900; - } - - public override void UpdateEquip(Player player) - { - player.lavaMax += 240; - player.ignoreWater = true; - player.meleeDamage += 0.1f; - player.meleeCrit += 10; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 11); - recipe.AddIngredient(null, "RuinousSoul", 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class BloodflareMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Mask"); + Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + + "10% increased melee damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 49; //85 + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("BloodflareBodyArmor") && legs.type == mod.ItemType("BloodflareCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.bloodflareSet = true; + modPlayer.bloodflareMelee = true; + player.setBonus = "Greatly increases life regen\n" + + "Enemies are more likely to target you\n" + + "Enemies below 50% life have a chance to drop hearts when struck\n" + + "Enemies above 50% life have a chance to drop mana stars when struck\n" + + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + + "True melee strikes will heal you\n" + + "After striking an enemy 15 times with true melee you will enter a blood frenzy for 5 seconds\n" + + "During this you will gain 25% increased melee damage, critical strike chance, and contact damage is halved\n" + + "This effect has a 30 second cooldown"; + player.crimsonRegen = true; + player.aggro += 900; + } + + public override void UpdateEquip(Player player) + { + player.lavaMax += 240; + player.ignoreWater = true; + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 11); + recipe.AddIngredient(null, "RuinousSoul", 2); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/CalamitasMask.cs b/Items/Armor/CalamitasMask.cs index 0969164914..eff9f9fb74 100644 --- a/Items/Armor/CalamitasMask.cs +++ b/Items/Armor/CalamitasMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class CalamitasMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class CalamitasMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/CrabulonMask.cs b/Items/Armor/CrabulonMask.cs index 035db984de..2591e70837 100644 --- a/Items/Armor/CrabulonMask.cs +++ b/Items/Armor/CrabulonMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class CrabulonMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crabulon Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class CrabulonMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/CryogenMask.cs b/Items/Armor/CryogenMask.cs index db29bc60b2..fa1b7e0e73 100644 --- a/Items/Armor/CryogenMask.cs +++ b/Items/Armor/CryogenMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class CryogenMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class CryogenMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/DaedalusBreastplate.cs b/Items/Armor/DaedalusBreastplate.cs index 1746b2ad96..8790b35ab7 100644 --- a/Items/Armor/DaedalusBreastplate.cs +++ b/Items/Armor/DaedalusBreastplate.cs @@ -1,53 +1,53 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class DaedalusBreastplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Breastplate"); - Tooltip.SetDefault("3% increased damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 20, 0, 0); - item.rare = 5; - item.defense = 17; //41 - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 3; - player.meleeDamage += 0.03f; - player.magicCrit += 3; - player.magicDamage += 0.03f; - player.rangedCrit += 3; - player.rangedDamage += 0.03f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; - player.minionDamage += 0.03f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class DaedalusBreastplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Breastplate"); + Tooltip.SetDefault("3% increased damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 20, 0, 0); + item.rare = 5; + item.defense = 17; //41 + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 3; + player.meleeDamage += 0.03f; + player.magicCrit += 3; + player.magicDamage += 0.03f; + player.rangedCrit += 3; + player.rangedDamage += 0.03f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; + player.minionDamage += 0.03f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DaedalusHat.cs b/Items/Armor/DaedalusHat.cs index 79e0eb947a..634db1362e 100644 --- a/Items/Armor/DaedalusHat.cs +++ b/Items/Armor/DaedalusHat.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class DaedalusHat : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Hood"); - Tooltip.SetDefault("13% increased magic damage and 7% increased magic critical strike chance\n" + - "10% decreased mana usage and +60 max mana"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; - item.defense = 5; //35 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("DaedalusBreastplate") && legs.type == mod.ItemType("DaedalusLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased magic damage\n" + - "You have a 10% chance to absorb physical attacks and projectiles when hit\n" + - "If you absorb an attack you are healed for 1/2 of that attack's damage"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.daedalusAbsorb = true; - player.magicDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.manaCost *= 0.9f; - player.magicDamage += 0.13f; - player.magicCrit += 7; - player.statManaMax2 += 60; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DaedalusHat : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Hood"); + Tooltip.SetDefault("13% increased magic damage and 7% increased magic critical strike chance\n" + + "10% decreased mana usage and +60 max mana"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; + item.defense = 5; //35 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("DaedalusBreastplate") && legs.type == mod.ItemType("DaedalusLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased magic damage\n" + + "You have a 10% chance to absorb physical attacks and projectiles when hit\n" + + "If you absorb an attack you are healed for 1/2 of that attack's damage"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.daedalusAbsorb = true; + player.magicDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.manaCost *= 0.9f; + player.magicDamage += 0.13f; + player.magicCrit += 7; + player.statManaMax2 += 60; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DaedalusHeadgear.cs b/Items/Armor/DaedalusHeadgear.cs index 5d694087bd..3c69d22f53 100644 --- a/Items/Armor/DaedalusHeadgear.cs +++ b/Items/Armor/DaedalusHeadgear.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class DaedalusHeadgear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Circlet"); - Tooltip.SetDefault("5% increased minion damage and +2 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; - item.defense = 3; //33 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("DaedalusBreastplate") && legs.type == mod.ItemType("DaedalusLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "20% increased minion damage\n" + - "A daedalus crystal floats above you to protect you"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.daedalusCrystal = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("DaedalusCrystal")) == -1) - { - player.AddBuff(mod.BuffType("DaedalusCrystal"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("DaedalusCrystal")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("DaedalusCrystal"), (int)(95f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - } - player.minionDamage += 0.2f; - } - - public override void UpdateEquip(Player player) - { - player.minionDamage += 0.05f; - player.maxMinions += 2; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DaedalusHeadgear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Circlet"); + Tooltip.SetDefault("5% increased minion damage and +2 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; + item.defense = 3; //33 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("DaedalusBreastplate") && legs.type == mod.ItemType("DaedalusLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "20% increased minion damage\n" + + "A daedalus crystal floats above you to protect you"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.daedalusCrystal = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("DaedalusCrystal")) == -1) + { + player.AddBuff(mod.BuffType("DaedalusCrystal"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("DaedalusCrystal")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("DaedalusCrystal"), (int)(95f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + } + player.minionDamage += 0.2f; + } + + public override void UpdateEquip(Player player) + { + player.minionDamage += 0.05f; + player.maxMinions += 2; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DaedalusHelm.cs b/Items/Armor/DaedalusHelm.cs index 0b9d3f8246..b586708aeb 100644 --- a/Items/Armor/DaedalusHelm.cs +++ b/Items/Armor/DaedalusHelm.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class DaedalusHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Helm"); - Tooltip.SetDefault("10% increased melee damage and critical strike chance\n" + - "10% increased melee and movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; - item.defense = 21; //51 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("DaedalusBreastplate") && legs.type == mod.ItemType("DaedalusLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased melee damage\n" + - "You have a 33% chance to reflect projectiles back at enemies\n" + - "If you reflect a projectile you are also healed for 1/5 of that projectile's damage"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.daedalusReflect = true; - player.meleeDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.meleeSpeed += 0.1f; - player.moveSpeed += 0.1f; - player.meleeDamage += 0.1f; - player.meleeCrit += 10; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DaedalusHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Helm"); + Tooltip.SetDefault("10% increased melee damage and critical strike chance\n" + + "10% increased melee and movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; + item.defense = 21; //51 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("DaedalusBreastplate") && legs.type == mod.ItemType("DaedalusLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased melee damage\n" + + "You have a 33% chance to reflect projectiles back at enemies\n" + + "If you reflect a projectile you are also healed for 1/5 of that projectile's damage"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.daedalusReflect = true; + player.meleeDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.meleeSpeed += 0.1f; + player.moveSpeed += 0.1f; + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DaedalusHelmet.cs b/Items/Armor/DaedalusHelmet.cs index 354d161e12..0bb1fa32a9 100644 --- a/Items/Armor/DaedalusHelmet.cs +++ b/Items/Armor/DaedalusHelmet.cs @@ -1,67 +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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class DaedalusHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Headgear"); - Tooltip.SetDefault("13% increased ranged damage and 7% increased ranged critical strike chance\n" + - "Reduces ammo usage by 20%"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; - item.defense = 9; //39 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("DaedalusBreastplate") && legs.type == mod.ItemType("DaedalusLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased ranged damage\n" + - "Getting hit causes you to emit a blast of crystal shards"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.daedalusShard = true; - player.rangedDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.ammoCost80 = true; - player.rangedDamage += 0.13f; - player.rangedCrit += 7; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DaedalusHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Headgear"); + Tooltip.SetDefault("13% increased ranged damage and 7% increased ranged critical strike chance\n" + + "Reduces ammo usage by 20%"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; + item.defense = 9; //39 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("DaedalusBreastplate") && legs.type == mod.ItemType("DaedalusLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased ranged damage\n" + + "Getting hit causes you to emit a blast of crystal shards"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.daedalusShard = true; + player.rangedDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.ammoCost80 = true; + player.rangedDamage += 0.13f; + player.rangedCrit += 7; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DaedalusLeggings.cs b/Items/Armor/DaedalusLeggings.cs index 5548860ee6..786f09eb12 100644 --- a/Items/Armor/DaedalusLeggings.cs +++ b/Items/Armor/DaedalusLeggings.cs @@ -1,50 +1,50 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class DaedalusLeggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Leggings"); - Tooltip.SetDefault("3% increased critical strike chance\n" + - "10% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.defense = 13; //41 - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 3; - player.magicCrit += 3; - player.rangedCrit += 3; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - player.moveSpeed += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class DaedalusLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Leggings"); + Tooltip.SetDefault("3% increased critical strike chance\n" + + "10% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.defense = 13; //41 + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 3; + player.magicCrit += 3; + player.rangedCrit += 3; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + player.moveSpeed += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index 4f9eed435f..9e9e70af04 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class DaedalusVisor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Facemask"); - Tooltip.SetDefault("13% increased rogue damage and 7% increased rogue critical strike chance, increases rogue velocity by 15%\n" + - "17% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; - item.defense = 7; //37 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("DaedalusBreastplate") && legs.type == mod.ItemType("DaedalusLeggings"); - } - - public override void DrawHair(ref bool drawHair, ref bool drawAltHair) - { - drawHair = true; - drawAltHair = true; - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "5% increased rogue damage\n" + - "Rogue projectiles throw out crystal shards as they travel\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 110\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.daedalusSplit = true; - modPlayer.rogueStealthMax = 1.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.15f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.13f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; - player.moveSpeed += 0.17f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DaedalusVisor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Facemask"); + Tooltip.SetDefault("13% increased rogue damage and 7% increased rogue critical strike chance, increases rogue velocity by 15%\n" + + "17% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; + item.defense = 7; //37 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("DaedalusBreastplate") && legs.type == mod.ItemType("DaedalusLeggings"); + } + + public override void DrawHair(ref bool drawHair, ref bool drawAltHair) + { + drawHair = true; + drawAltHair = true; + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "5% increased rogue damage\n" + + "Rogue projectiles throw out crystal shards as they travel\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 110\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.daedalusSplit = true; + modPlayer.rogueStealthMax = 1.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.15f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.13f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; + player.moveSpeed += 0.17f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DemonshadeBreastplate.cs b/Items/Armor/DemonshadeBreastplate.cs index b727393f9a..a3d0f10e7e 100644 --- a/Items/Armor/DemonshadeBreastplate.cs +++ b/Items/Armor/DemonshadeBreastplate.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class DemonshadeBreastplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demonshade Breastplate"); - Tooltip.SetDefault("20% increased melee speed, 15% increased damage and critical strike chance\n" + - "Enemies take ungodly damage when they touch you\n" + - "Increased max life and mana by 200\n" + - "Standing still lets you absorb the shadows and boost your life regen"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(4, 0, 0, 0); - item.defense = 50; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.shadeRegen = true; - player.thorns = 100f; - player.statLifeMax2 += 200; - player.statManaMax2 += 200; - player.magicCrit += 15; - player.magicDamage += 0.15f; - player.meleeCrit += 15; - player.meleeDamage += 0.15f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 15; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; - player.rangedCrit += 15; - player.rangedDamage += 0.15f; - player.minionDamage += 0.15f; - player.meleeSpeed += 0.2f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 15); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class DemonshadeBreastplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demonshade Breastplate"); + Tooltip.SetDefault("20% increased melee speed, 15% increased damage and critical strike chance\n" + + "Enemies take ungodly damage when they touch you\n" + + "Increased max life and mana by 200\n" + + "Standing still lets you absorb the shadows and boost your life regen"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(4, 0, 0, 0); + item.defense = 50; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.shadeRegen = true; + player.thorns = 100f; + player.statLifeMax2 += 200; + player.statManaMax2 += 200; + player.magicCrit += 15; + player.magicDamage += 0.15f; + player.meleeCrit += 15; + player.meleeDamage += 0.15f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 15; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; + player.rangedCrit += 15; + player.rangedDamage += 0.15f; + player.minionDamage += 0.15f; + player.meleeSpeed += 0.2f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 15); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DemonshadeGreaves.cs b/Items/Armor/DemonshadeGreaves.cs index 33d6a0cd93..c6c2f5b167 100644 --- a/Items/Armor/DemonshadeGreaves.cs +++ b/Items/Armor/DemonshadeGreaves.cs @@ -1,46 +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.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class DemonshadeGreaves : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demonshade Greaves"); - Tooltip.SetDefault("Shadow speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(3, 0, 0, 0); - item.defense = 50; //15 - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.shadowSpeed = true; - player.moveSpeed += 1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 11); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class DemonshadeGreaves : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demonshade Greaves"); + Tooltip.SetDefault("Shadow speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(3, 0, 0, 0); + item.defense = 50; //15 + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.shadowSpeed = true; + player.moveSpeed += 1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 11); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs index 9f7dd85a81..e262235af7 100644 --- a/Items/Armor/DemonshadeHelm.cs +++ b/Items/Armor/DemonshadeHelm.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class DemonshadeHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demonshade Helm"); - Tooltip.SetDefault("30% increased damage and 15% increased critical strike chance, +10 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(5, 0, 0, 0); - item.defense = 50; //15 - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("DemonshadeBreastplate") && legs.type == mod.ItemType("DemonshadeGreaves"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "100% increased minion damage\n" + - "All attacks inflict the demon flame debuff\n" + - "Shadowbeams and demon scythes will fire down when you are hit\n" + - "A friendly red devil follows you around\n" + - "Press Y to enrage nearby enemies with a dark magic spell for 10 seconds\n" + - "This makes them do 25% more damage but they also take 125% more damage"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.dsSetBonus = true; - if (player.whoAmI == Main.myPlayer && !modPlayer.chibii) - { - modPlayer.redDevil = true; - if (player.FindBuffIndex(mod.BuffType("RedDevil")) == -1) - { - player.AddBuff(mod.BuffType("RedDevil"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("RedDevil")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("RedDevil"), 10000, 0f, Main.myPlayer, 0f, 0f); - } - } - player.minionDamage += 1f; - } - - public override void UpdateEquip(Player player) - { - player.maxMinions += 10; - player.meleeDamage += 0.3f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.3f; - player.rangedDamage += 0.3f; - player.magicDamage += 0.3f; - player.minionDamage += 0.3f; - player.meleeCrit += 15; - player.magicCrit += 15; - player.rangedCrit += 15; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 15; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 8); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DemonshadeHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demonshade Helm"); + Tooltip.SetDefault("30% increased damage and 15% increased critical strike chance, +10 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(5, 0, 0, 0); + item.defense = 50; //15 + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("DemonshadeBreastplate") && legs.type == mod.ItemType("DemonshadeGreaves"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "100% increased minion damage\n" + + "All attacks inflict the demon flame debuff\n" + + "Shadowbeams and demon scythes will fire down when you are hit\n" + + "A friendly red devil follows you around\n" + + "Press Y to enrage nearby enemies with a dark magic spell for 10 seconds\n" + + "This makes them do 25% more damage but they also take 125% more damage"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.dsSetBonus = true; + if (player.whoAmI == Main.myPlayer && !modPlayer.chibii) + { + modPlayer.redDevil = true; + if (player.FindBuffIndex(mod.BuffType("RedDevil")) == -1) + { + player.AddBuff(mod.BuffType("RedDevil"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("RedDevil")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("RedDevil"), 10000, 0f, Main.myPlayer, 0f, 0f); + } + } + player.minionDamage += 1f; + } + + public override void UpdateEquip(Player player) + { + player.maxMinions += 10; + player.meleeDamage += 0.3f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.3f; + player.rangedDamage += 0.3f; + player.magicDamage += 0.3f; + player.minionDamage += 0.3f; + player.meleeCrit += 15; + player.magicCrit += 15; + player.rangedCrit += 15; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 15; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 8); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DesertScourgeMask.cs b/Items/Armor/DesertScourgeMask.cs index baeaf5d6b9..c00294006a 100644 --- a/Items/Armor/DesertScourgeMask.cs +++ b/Items/Armor/DesertScourgeMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class DesertScourgeMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DesertScourgeMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/DevourerofGodsMask.cs b/Items/Armor/DevourerofGodsMask.cs index 5a66cc221b..ec0a3bfd55 100644 --- a/Items/Armor/DevourerofGodsMask.cs +++ b/Items/Armor/DevourerofGodsMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class DevourerofGodsMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devourer of Gods Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DevourerofGodsMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devourer of Gods Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/GodSlayerChestplate.cs b/Items/Armor/GodSlayerChestplate.cs index 987cf71b92..b40d52fe41 100644 --- a/Items/Armor/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayerChestplate.cs @@ -1,64 +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.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class GodSlayerChestplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Chestplate"); - 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" + - "11% increased damage and 6% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 60, 0, 0); - item.defense = 41; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.godSlayerReflect = true; - player.thorns += 0.5f; - player.statLifeMax2 += 60; - player.moveSpeed += 0.15f; - player.meleeDamage += 0.11f; - player.meleeCrit += 6; - player.magicDamage += 0.11f; - player.magicCrit += 6; - player.rangedDamage += 0.11f; - player.rangedCrit += 6; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.11f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 6; - player.minionDamage += 0.11f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 23); - recipe.AddIngredient(null, "NightmareFuel", 11); - recipe.AddIngredient(null, "EndothermicEnergy", 11); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class GodSlayerChestplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Chestplate"); + 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" + + "11% increased damage and 6% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 60, 0, 0); + item.defense = 41; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.godSlayerReflect = true; + player.thorns += 0.5f; + player.statLifeMax2 += 60; + player.moveSpeed += 0.15f; + player.meleeDamage += 0.11f; + player.meleeCrit += 6; + player.magicDamage += 0.11f; + player.magicCrit += 6; + player.rangedDamage += 0.11f; + player.rangedCrit += 6; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.11f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 6; + player.minionDamage += 0.11f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 23); + recipe.AddIngredient(null, "NightmareFuel", 11); + recipe.AddIngredient(null, "EndothermicEnergy", 11); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs index f75d882057..956273ade2 100644 --- a/Items/Armor/GodSlayerHelm.cs +++ b/Items/Armor/GodSlayerHelm.cs @@ -1,71 +1,71 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class GodSlayerHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Horned Greathelm"); - Tooltip.SetDefault("14% increased melee damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 48; //96 - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("GodSlayerChestplate") && legs.type == mod.ItemType("GodSlayerLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.godSlayer = true; - modPlayer.godSlayerDamage = true; - player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + - "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + - "Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" + - "Enemies take a lot of damage when they hit you\n" + - "An attack that would deal 80 damage or less will have its damage reduced to 1"; - player.thorns += 2.5f; - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.14f; - player.meleeCrit += 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 14); - recipe.AddIngredient(null, "NightmareFuel", 8); - recipe.AddIngredient(null, "EndothermicEnergy", 8); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class GodSlayerHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Horned Greathelm"); + Tooltip.SetDefault("14% increased melee damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 75, 0, 0); + item.defense = 48; //96 + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("GodSlayerChestplate") && legs.type == mod.ItemType("GodSlayerLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.godSlayer = true; + modPlayer.godSlayerDamage = true; + player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + + "This effect can only occur once every 45 seconds\n" + + "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + + "Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" + + "Enemies take a lot of damage when they hit you\n" + + "An attack that would deal 80 damage or less will have its damage reduced to 1"; + player.thorns += 2.5f; + } + + public override void UpdateEquip(Player player) + { + player.meleeDamage += 0.14f; + player.meleeCrit += 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 14); + recipe.AddIngredient(null, "NightmareFuel", 8); + recipe.AddIngredient(null, "EndothermicEnergy", 8); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs index 35e63b7e6b..2106b587a3 100644 --- a/Items/Armor/GodSlayerHelmet.cs +++ b/Items/Armor/GodSlayerHelmet.cs @@ -1,69 +1,69 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class GodSlayerHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Helmet"); - Tooltip.SetDefault("14% increased ranged damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 35; //96 - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("GodSlayerChestplate") && legs.type == mod.ItemType("GodSlayerLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.godSlayer = true; - modPlayer.godSlayerRanged = true; - player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + - "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + - "Your ranged critical hits have a chance to critically hit, causing 4 times the damage\n" + - "You have a chance to fire a god killer shrapnel round while firing ranged weapons"; - } - - public override void UpdateEquip(Player player) - { - player.rangedDamage += 0.14f; - player.rangedCrit += 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 14); - recipe.AddIngredient(null, "NightmareFuel", 8); - recipe.AddIngredient(null, "EndothermicEnergy", 8); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class GodSlayerHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Helmet"); + Tooltip.SetDefault("14% increased ranged damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 75, 0, 0); + item.defense = 35; //96 + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("GodSlayerChestplate") && legs.type == mod.ItemType("GodSlayerLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.godSlayer = true; + modPlayer.godSlayerRanged = true; + player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + + "This effect can only occur once every 45 seconds\n" + + "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + + "Your ranged critical hits have a chance to critically hit, causing 4 times the damage\n" + + "You have a chance to fire a god killer shrapnel round while firing ranged weapons"; + } + + public override void UpdateEquip(Player player) + { + player.rangedDamage += 0.14f; + player.rangedCrit += 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 14); + recipe.AddIngredient(null, "NightmareFuel", 8); + recipe.AddIngredient(null, "EndothermicEnergy", 8); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/GodSlayerHornedHelm.cs b/Items/Armor/GodSlayerHornedHelm.cs index 602a3d60c4..07d5414351 100644 --- a/Items/Armor/GodSlayerHornedHelm.cs +++ b/Items/Armor/GodSlayerHornedHelm.cs @@ -1,193 +1,193 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class GodSlayerHornedHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Horned Helm"); - Tooltip.SetDefault("+3 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 12; //96 - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("GodSlayerChestplate") && legs.type == mod.ItemType("GodSlayerLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.godSlayer = true; - modPlayer.godSlayerSummon = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("Mechworm")) == -1) - { - player.AddBuff(mod.BuffType("Mechworm"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("MechwormHead")] < 1) - { - int owner = player.whoAmI; - int typeHead = mod.ProjectileType("MechwormHead"); - int typeBody = mod.ProjectileType("MechwormBody"); - int typeBody2 = mod.ProjectileType("MechwormBody2"); - int typeTail = mod.ProjectileType("MechwormTail"); - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) - { - if (Main.projectile[i].type == typeHead || Main.projectile[i].type == typeTail || Main.projectile[i].type == typeBody || - Main.projectile[i].type == typeBody2) - { - Main.projectile[i].Kill(); - } - } - } - int maxMinionScale = player.maxMinions; - if (maxMinionScale > 10) - { - maxMinionScale = 10; - } - int damage = (int)(35 * ((player.minionDamage * 5 / 3) + ((player.minionDamage * 0.46f) * (maxMinionScale - 1)))); - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; - float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) - { - velX = (float)player.direction; - velY = 0f; - dist = 10f; - } - else - { - dist = 10f / dist; - } - velX *= dist; - velY *= dist; - int head = -1; - int tail = -1; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) - { - if (head == -1 && Main.projectile[i].type == typeHead) - { - head = i; - } - else if (tail == -1 && Main.projectile[i].type == typeTail) - { - tail = i; - } - if (head != -1 && tail != -1) - { - break; - } - } - } - if (head == -1 && tail == -1) - { - float num77 = Vector2.Dot(value, vector3); - if (num77 > 0f) - { - player.ChangeDir(1); - } - else - { - player.ChangeDir(-1); - } - velX = 0f; - velY = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormHead"), damage, 1f, owner); - - int prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, 1f, owner, (float)prev); - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, 1f, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormTail"), damage, 1f, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - } - else if (head != -1 && tail != -1) - { - int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, 1f, owner, Main.projectile[tail].ai[0]); - int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, 1f, owner, (float)body); - - Main.projectile[body].localAI[1] = (float)back; - Main.projectile[body].ai[1] = 1f; - Main.projectile[body].minionSlots = 0f; - Main.projectile[body].netUpdate = true; - - Main.projectile[back].localAI[1] = (float)tail; - Main.projectile[back].netUpdate = true; - Main.projectile[back].minionSlots = 0f; - Main.projectile[back].ai[1] = 1f; - - Main.projectile[tail].ai[0] = (float)back; - Main.projectile[tail].netUpdate = true; - Main.projectile[tail].ai[1] = 1f; - } - } - } - player.setBonus = "65% increased minion damage\n" + - "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + - "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + - "Hitting enemies will summon god slayer phantoms\n" + - "Summons a god-eating mechworm to fight for you"; - player.minionDamage += 0.65f; - } - - public override void UpdateEquip(Player player) - { - player.maxMinions += 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 14); - recipe.AddIngredient(null, "NightmareFuel", 8); - recipe.AddIngredient(null, "EndothermicEnergy", 8); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class GodSlayerHornedHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Horned Helm"); + Tooltip.SetDefault("+3 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 75, 0, 0); + item.defense = 12; //96 + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("GodSlayerChestplate") && legs.type == mod.ItemType("GodSlayerLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.godSlayer = true; + modPlayer.godSlayerSummon = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("Mechworm")) == -1) + { + player.AddBuff(mod.BuffType("Mechworm"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("MechwormHead")] < 1) + { + int owner = player.whoAmI; + int typeHead = mod.ProjectileType("MechwormHead"); + int typeBody = mod.ProjectileType("MechwormBody"); + int typeBody2 = mod.ProjectileType("MechwormBody2"); + int typeTail = mod.ProjectileType("MechwormTail"); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == owner) + { + if (Main.projectile[i].type == typeHead || Main.projectile[i].type == typeTail || Main.projectile[i].type == typeBody || + Main.projectile[i].type == typeBody2) + { + Main.projectile[i].Kill(); + } + } + } + int maxMinionScale = player.maxMinions; + if (maxMinionScale > 10) + { + maxMinionScale = 10; + } + int damage = (int)(35 * ((player.minionDamage * 5 / 3) + ((player.minionDamage * 0.46f) * (maxMinionScale - 1)))); + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); + Vector2 vector3 = Main.MouseWorld - vector2; + float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) + { + velX = (float)player.direction; + velY = 0f; + dist = 10f; + } + else + { + dist = 10f / dist; + } + velX *= dist; + velY *= dist; + int head = -1; + int tail = -1; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == owner) + { + if (head == -1 && Main.projectile[i].type == typeHead) + { + head = i; + } + else if (tail == -1 && Main.projectile[i].type == typeTail) + { + tail = i; + } + if (head != -1 && tail != -1) + { + break; + } + } + } + if (head == -1 && tail == -1) + { + float num77 = Vector2.Dot(value, vector3); + if (num77 > 0f) + { + player.ChangeDir(1); + } + else + { + player.ChangeDir(-1); + } + velX = 0f; + velY = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormHead"), damage, 1f, owner); + + int prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, 1f, owner, (float)prev); + + prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, 1f, owner, (float)prev); + Main.projectile[prev].localAI[1] = (float)curr; + Main.projectile[prev].netUpdate = true; + + prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormTail"), damage, 1f, owner, (float)prev); + Main.projectile[prev].localAI[1] = (float)curr; + Main.projectile[prev].netUpdate = true; + } + else if (head != -1 && tail != -1) + { + int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, 1f, owner, Main.projectile[tail].ai[0]); + int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, 1f, owner, (float)body); + + Main.projectile[body].localAI[1] = (float)back; + Main.projectile[body].ai[1] = 1f; + Main.projectile[body].minionSlots = 0f; + Main.projectile[body].netUpdate = true; + + Main.projectile[back].localAI[1] = (float)tail; + Main.projectile[back].netUpdate = true; + Main.projectile[back].minionSlots = 0f; + Main.projectile[back].ai[1] = 1f; + + Main.projectile[tail].ai[0] = (float)back; + Main.projectile[tail].netUpdate = true; + Main.projectile[tail].ai[1] = 1f; + } + } + } + player.setBonus = "65% increased minion damage\n" + + "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + + "This effect can only occur once every 45 seconds\n" + + "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + + "Hitting enemies will summon god slayer phantoms\n" + + "Summons a god-eating mechworm to fight for you"; + player.minionDamage += 0.65f; + } + + public override void UpdateEquip(Player player) + { + player.maxMinions += 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 14); + recipe.AddIngredient(null, "NightmareFuel", 8); + recipe.AddIngredient(null, "EndothermicEnergy", 8); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/GodSlayerLeggings.cs b/Items/Armor/GodSlayerLeggings.cs index 431580380f..05aafed0f6 100644 --- a/Items/Armor/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayerLeggings.cs @@ -1,57 +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; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class GodSlayerLeggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Leggings"); - Tooltip.SetDefault("35% increased movement speed\n" + - "10% increased damage and 6% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 45, 0, 0); - item.defense = 35; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.35f; - player.meleeDamage += 0.1f; - player.meleeCrit += 6; - player.magicDamage += 0.1f; - player.magicCrit += 6; - player.rangedDamage += 0.1f; - player.rangedCrit += 6; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 6; - player.minionDamage += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 18); - recipe.AddIngredient(null, "NightmareFuel", 9); - recipe.AddIngredient(null, "EndothermicEnergy", 9); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class GodSlayerLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Leggings"); + Tooltip.SetDefault("35% increased movement speed\n" + + "10% increased damage and 6% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 45, 0, 0); + item.defense = 35; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.35f; + player.meleeDamage += 0.1f; + player.meleeCrit += 6; + player.magicDamage += 0.1f; + player.magicCrit += 6; + player.rangedDamage += 0.1f; + player.rangedCrit += 6; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 6; + player.minionDamage += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 18); + recipe.AddIngredient(null, "NightmareFuel", 9); + recipe.AddIngredient(null, "EndothermicEnergy", 9); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index 549cb32c81..5c511e2a14 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -1,75 +1,75 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class GodSlayerMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Mask"); - Tooltip.SetDefault("14% increased rogue damage and critical strike chance, 18% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 29; //96 - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("GodSlayerChestplate") && legs.type == mod.ItemType("GodSlayerLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.godSlayer = true; - modPlayer.godSlayerThrowing = true; - modPlayer.rogueStealthMax = 1.4f; - player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + - "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + - "While at full HP all of your rogue stats are boosted by 10%\n" + - "If you take over 80 damage in one hit you will be given extra immunity frames\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 140\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.14f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 14; - player.moveSpeed += 0.18f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 14); - recipe.AddIngredient(null, "NightmareFuel", 8); - recipe.AddIngredient(null, "EndothermicEnergy", 8); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class GodSlayerMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Mask"); + Tooltip.SetDefault("14% increased rogue damage and critical strike chance, 18% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 75, 0, 0); + item.defense = 29; //96 + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("GodSlayerChestplate") && legs.type == mod.ItemType("GodSlayerLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.godSlayer = true; + modPlayer.godSlayerThrowing = true; + modPlayer.rogueStealthMax = 1.4f; + player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + + "This effect can only occur once every 45 seconds\n" + + "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + + "While at full HP all of your rogue stats are boosted by 10%\n" + + "If you take over 80 damage in one hit you will be given extra immunity frames\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 140\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.14f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 14; + player.moveSpeed += 0.18f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 14); + recipe.AddIngredient(null, "NightmareFuel", 8); + recipe.AddIngredient(null, "EndothermicEnergy", 8); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/GodSlayerVisage.cs b/Items/Armor/GodSlayerVisage.cs index 0b1d4502d2..dcc3951413 100644 --- a/Items/Armor/GodSlayerVisage.cs +++ b/Items/Armor/GodSlayerVisage.cs @@ -1,72 +1,72 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class GodSlayerVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Visage"); - Tooltip.SetDefault("14% increased magic damage and critical strike chance\n" + - "+100 max mana and 17% reduced mana usage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 21; //96 - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("GodSlayerChestplate") && legs.type == mod.ItemType("GodSlayerLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.godSlayer = true; - modPlayer.godSlayerMage = true; - player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + - "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + - "Enemies will release god slayer flames and healing flames when hit with magic attacks\n" + - "Taking damage will cause you to release a magical god slayer explosion"; - } - - public override void UpdateEquip(Player player) - { - player.manaCost *= 0.83f; - player.magicDamage += 0.14f; - player.magicCrit += 14; - player.statManaMax2 += 100; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 14); - recipe.AddIngredient(null, "NightmareFuel", 8); - recipe.AddIngredient(null, "EndothermicEnergy", 8); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class GodSlayerVisage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Visage"); + Tooltip.SetDefault("14% increased magic damage and critical strike chance\n" + + "+100 max mana and 17% reduced mana usage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 75, 0, 0); + item.defense = 21; //96 + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("GodSlayerChestplate") && legs.type == mod.ItemType("GodSlayerLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.godSlayer = true; + modPlayer.godSlayerMage = true; + player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + + "This effect can only occur once every 45 seconds\n" + + "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + + "Enemies will release god slayer flames and healing flames when hit with magic attacks\n" + + "Taking damage will cause you to release a magical god slayer explosion"; + } + + public override void UpdateEquip(Player player) + { + player.manaCost *= 0.83f; + player.magicDamage += 0.14f; + player.magicCrit += 14; + player.statManaMax2 += 100; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 14); + recipe.AddIngredient(null, "NightmareFuel", 8); + recipe.AddIngredient(null, "EndothermicEnergy", 8); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/HiveMindMask.cs b/Items/Armor/HiveMindMask.cs index 1c3c0539f6..8e4164f0f4 100644 --- a/Items/Armor/HiveMindMask.cs +++ b/Items/Armor/HiveMindMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class HiveMindMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Mind Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class HiveMindMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Mind Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/LeviathanMask.cs b/Items/Armor/LeviathanMask.cs index e913f874bf..bdd62e0f54 100644 --- a/Items/Armor/LeviathanMask.cs +++ b/Items/Armor/LeviathanMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class LeviathanMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leviathan Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class LeviathanMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviathan Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/MolluskShelleggings.cs b/Items/Armor/MolluskShelleggings.cs index 2c941ef087..17f5304ada 100644 --- a/Items/Armor/MolluskShelleggings.cs +++ b/Items/Armor/MolluskShelleggings.cs @@ -1,56 +1,56 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class MolluskShelleggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mollusk Shelleggings"); - Tooltip.SetDefault("5% increased damage and 4% increased critical strike chance\n" + - "5% decreased movement speed"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 18; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.defense = 15; - } - - public override void UpdateEquip(Player player) - { - const float damageUp = 0.12f; - 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 void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("SeaPrism"), 20); - recipe.AddIngredient(mod.ItemType("MolluskHusk"), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class MolluskShelleggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mollusk Shelleggings"); + Tooltip.SetDefault("5% increased damage and 4% increased critical strike chance\n" + + "5% decreased movement speed"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 18; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.defense = 15; + } + + public override void UpdateEquip(Player player) + { + const float damageUp = 0.12f; + 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 void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("SeaPrism"), 20); + recipe.AddIngredient(mod.ItemType("MolluskHusk"), 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/MolluskShellmet.cs b/Items/Armor/MolluskShellmet.cs index 2c4662e808..f3ae1997aa 100644 --- a/Items/Armor/MolluskShellmet.cs +++ b/Items/Armor/MolluskShellmet.cs @@ -1,87 +1,87 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -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" + - "You can move freely through liquids"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 22; - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; - item.defense = 18; - } - - 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; - } - - 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.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); - } - } - } - - 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(); - } - } -} +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +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" + + "You can move freely through liquids"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 22; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = 5; + item.defense = 18; + } + + 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; + } + + 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.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); + } + } + } + + 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/MolluskShellplate.cs b/Items/Armor/MolluskShellplate.cs index 4460f5b742..f6ca9991cc 100644 --- a/Items/Armor/MolluskShellplate.cs +++ b/Items/Armor/MolluskShellplate.cs @@ -1,56 +1,56 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class MolluskShellplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mollusk Shellplate"); - Tooltip.SetDefault("10% increased damage and 6% increased critical strike chance\n" + - "15% decreased movement speed"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 22; - item.value = Item.buyPrice(0, 20, 0, 0); - item.rare = 5; - item.defense = 22; - } - - public override void UpdateEquip(Player player) - { - const float damageUp = 0.1f; - const int critUp = 6; - 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.15f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("SeaPrism"), 25); - recipe.AddIngredient(mod.ItemType("MolluskHusk"), 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class MolluskShellplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mollusk Shellplate"); + Tooltip.SetDefault("10% increased damage and 6% increased critical strike chance\n" + + "15% decreased movement speed"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 22; + item.value = Item.buyPrice(0, 20, 0, 0); + item.rare = 5; + item.defense = 22; + } + + public override void UpdateEquip(Player player) + { + const float damageUp = 0.1f; + const int critUp = 6; + 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.15f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("SeaPrism"), 25); + recipe.AddIngredient(mod.ItemType("MolluskHusk"), 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlueChestplate.cs index 7dd92b7300..10b00dacc6 100644 --- a/Items/Armor/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlueChestplate.cs @@ -1,62 +1,62 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class OmegaBlueChestplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omega Blue Chestplate"); - Tooltip.SetDefault(@"12% increased damage and 8% increased critical strike chance -Your attacks inflict Crush Depth -No positive life regen"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.sellPrice(0, 38, 0, 0); - item.rare = 10; - item.defense = 28; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void UpdateEquip(Player player) - { - const float damageUp = 0.12f; - const int critUp = 8; - 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; - - //insert enable crush depth, disable positive life regen - player.GetModPlayer().omegaBlueChestplate = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("ReaperTooth"), 16); - recipe.AddIngredient(mod.ItemType("Lumenite"), 8); - recipe.AddIngredient(mod.ItemType("Tenebris"), 8); - recipe.AddIngredient(mod.ItemType("RuinousSoul"), 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class OmegaBlueChestplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omega Blue Chestplate"); + Tooltip.SetDefault(@"12% increased damage and 8% increased critical strike chance +Your attacks inflict Crush Depth +No positive life regen"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.sellPrice(0, 38, 0, 0); + item.rare = 10; + item.defense = 28; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void UpdateEquip(Player player) + { + const float damageUp = 0.12f; + const int critUp = 8; + 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; + + //insert enable crush depth, disable positive life regen + player.GetModPlayer().omegaBlueChestplate = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("ReaperTooth"), 16); + recipe.AddIngredient(mod.ItemType("Lumenite"), 8); + recipe.AddIngredient(mod.ItemType("Tenebris"), 8); + recipe.AddIngredient(mod.ItemType("RuinousSoul"), 4); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlueHelmet.cs index f69ccbc51e..9ada7387d9 100644 --- a/Items/Armor/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlueHelmet.cs @@ -1,115 +1,115 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class OmegaBlueHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omega Blue Helmet"); - Tooltip.SetDefault(@"You can move freely through liquids -12% increased damage and 8% increased critical strike chance -+2 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.sellPrice(0, 35, 0, 0); - item.rare = 10; - item.defense = 19; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - - const float damageUp = 0.12f; - const int critUp = 8; - 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.maxMinions += 2; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("OmegaBlueChestplate") && legs.type == mod.ItemType("OmegaBlueLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = @"Increases armor penetration by 50 -10% increased damage and critical strike chance -Short-ranged tentacles heal you by sucking enemy life -Press Y to activate abyssal madness for 5 seconds -Abyssal madness increases damage, critical strike chance, and tentacle aggression/range -This effect has a 30 second cooldown"; - - player.armorPenetration += 50; - - //raise rev caps - player.GetModPlayer().omegaBlueSet = true; - - if (player.GetModPlayer().omegaBlueCooldown > 0) - { - if (player.GetModPlayer().omegaBlueCooldown == 1) //dust when ready to use again - { - for (int i = 0; i < 66; i++) - { - int d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); - Main.dust[d].noGravity = true; - Main.dust[d].noLight = true; - Main.dust[d].fadeIn = 1f; - Main.dust[d].velocity *= 6.6f; - } - } - player.GetModPlayer().omegaBlueCooldown--; - } - - if (player.GetModPlayer().omegaBlueCooldown > 1500) - { - player.GetModPlayer().omegaBlueHentai = true; - - int d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 1.6f); - Main.dust[d].noGravity = true; - Main.dust[d].noLight = true; - Main.dust[d].fadeIn = 1f; - Main.dust[d].velocity *= 3f; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("ReaperTooth"), 11); - recipe.AddIngredient(mod.ItemType("Lumenite"), 5); - recipe.AddIngredient(mod.ItemType("Tenebris"), 5); - recipe.AddIngredient(mod.ItemType("RuinousSoul"), 2); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class OmegaBlueHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omega Blue Helmet"); + Tooltip.SetDefault(@"You can move freely through liquids +12% increased damage and 8% increased critical strike chance ++2 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.sellPrice(0, 35, 0, 0); + item.rare = 10; + item.defense = 19; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + + const float damageUp = 0.12f; + const int critUp = 8; + 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.maxMinions += 2; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("OmegaBlueChestplate") && legs.type == mod.ItemType("OmegaBlueLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = @"Increases armor penetration by 50 +10% increased damage and critical strike chance +Short-ranged tentacles heal you by sucking enemy life +Press Y to activate abyssal madness for 5 seconds +Abyssal madness increases damage, critical strike chance, and tentacle aggression/range +This effect has a 30 second cooldown"; + + player.armorPenetration += 50; + + //raise rev caps + player.GetModPlayer().omegaBlueSet = true; + + if (player.GetModPlayer().omegaBlueCooldown > 0) + { + if (player.GetModPlayer().omegaBlueCooldown == 1) //dust when ready to use again + { + for (int i = 0; i < 66; i++) + { + int d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 2.6f); + Main.dust[d].noGravity = true; + Main.dust[d].noLight = true; + Main.dust[d].fadeIn = 1f; + Main.dust[d].velocity *= 6.6f; + } + } + player.GetModPlayer().omegaBlueCooldown--; + } + + if (player.GetModPlayer().omegaBlueCooldown > 1500) + { + player.GetModPlayer().omegaBlueHentai = true; + + int d = Dust.NewDust(player.position, player.width, player.height, 20, 0, 0, 100, Color.Transparent, 1.6f); + Main.dust[d].noGravity = true; + Main.dust[d].noLight = true; + Main.dust[d].fadeIn = 1f; + Main.dust[d].velocity *= 3f; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("ReaperTooth"), 11); + recipe.AddIngredient(mod.ItemType("Lumenite"), 5); + recipe.AddIngredient(mod.ItemType("Tenebris"), 5); + recipe.AddIngredient(mod.ItemType("RuinousSoul"), 2); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/OmegaBlueLeggings.cs b/Items/Armor/OmegaBlueLeggings.cs index 458b6a7502..afaf18e622 100644 --- a/Items/Armor/OmegaBlueLeggings.cs +++ b/Items/Armor/OmegaBlueLeggings.cs @@ -1,60 +1,60 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class OmegaBlueLeggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omega Blue Leggings"); - Tooltip.SetDefault(@"30% increased movement speed -12% increased damage and 8% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.sellPrice(0, 35, 25, 0); - item.rare = 10; - item.defense = 22; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void UpdateEquip(Player player) - { - const float damageUp = 0.12f; - const int critUp = 8; - 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.3f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("ReaperTooth"), 13); - recipe.AddIngredient(mod.ItemType("Lumenite"), 6); - recipe.AddIngredient(mod.ItemType("Tenebris"), 6); - recipe.AddIngredient(mod.ItemType("RuinousSoul"), 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class OmegaBlueLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omega Blue Leggings"); + Tooltip.SetDefault(@"30% increased movement speed +12% increased damage and 8% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.sellPrice(0, 35, 25, 0); + item.rare = 10; + item.defense = 22; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void UpdateEquip(Player player) + { + const float damageUp = 0.12f; + const int critUp = 8; + 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.3f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("ReaperTooth"), 13); + recipe.AddIngredient(mod.ItemType("Lumenite"), 6); + recipe.AddIngredient(mod.ItemType("Tenebris"), 6); + recipe.AddIngredient(mod.ItemType("RuinousSoul"), 3); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/PerforatorMask.cs b/Items/Armor/PerforatorMask.cs index 0574975e9c..78f0e815d9 100644 --- a/Items/Armor/PerforatorMask.cs +++ b/Items/Armor/PerforatorMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class PerforatorMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perforator Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class PerforatorMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perforator Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/PlaguebringerGoliathMask.cs b/Items/Armor/PlaguebringerGoliathMask.cs index b0c5d63f92..65b85841d3 100644 --- a/Items/Armor/PlaguebringerGoliathMask.cs +++ b/Items/Armor/PlaguebringerGoliathMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class PlaguebringerGoliathMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plaguebringer Goliath Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class PlaguebringerGoliathMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer Goliath Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/ProvidenceMask.cs b/Items/Armor/ProvidenceMask.cs index c45584f46c..88e776edec 100644 --- a/Items/Armor/ProvidenceMask.cs +++ b/Items/Armor/ProvidenceMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ProvidenceMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Providence Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class ProvidenceMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Providence Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/ReaverCap.cs b/Items/Armor/ReaverCap.cs index 8f38a1b7d4..eec96062ba 100644 --- a/Items/Armor/ReaverCap.cs +++ b/Items/Armor/ReaverCap.cs @@ -1,74 +1,74 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverCap : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Headgear"); - Tooltip.SetDefault("15% increased rogue damage, 5% increased rogue velocity and critical strike chance\n" + - "20% increased movement speed and can move freely through liquids"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; - item.defense = 10; //43 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("ReaverScaleMail") && legs.type == mod.ItemType("ReaverCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.reaverSpore = true; - modPlayer.rogueStealthMax = 1.15f; - player.setBonus = "5% increased rogue damage\n" + - "You emit a cloud of spores when you are hit\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 115\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.05f; - player.moveSpeed += 0.2f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class ReaverCap : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Headgear"); + Tooltip.SetDefault("15% increased rogue damage, 5% increased rogue velocity and critical strike chance\n" + + "20% increased movement speed and can move freely through liquids"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; + item.defense = 10; //43 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("ReaverScaleMail") && legs.type == mod.ItemType("ReaverCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.reaverSpore = true; + modPlayer.rogueStealthMax = 1.15f; + player.setBonus = "5% increased rogue damage\n" + + "You emit a cloud of spores when you are hit\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 115\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.05f; + player.moveSpeed += 0.2f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/ReaverCuisses.cs b/Items/Armor/ReaverCuisses.cs index 5034b378d4..eb873005ec 100644 --- a/Items/Armor/ReaverCuisses.cs +++ b/Items/Armor/ReaverCuisses.cs @@ -1,50 +1,50 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class ReaverCuisses : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Cuisses"); - Tooltip.SetDefault("5% increased critical strike chance\n" + - "12% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = 7; - item.defense = 14; - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 5; - player.magicCrit += 5; - player.rangedCrit += 5; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - player.moveSpeed += 0.12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class ReaverCuisses : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Cuisses"); + Tooltip.SetDefault("5% increased critical strike chance\n" + + "12% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 18, 0, 0); + item.rare = 7; + item.defense = 14; + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 5; + player.magicCrit += 5; + player.rangedCrit += 5; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + player.moveSpeed += 0.12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/ReaverHelm.cs b/Items/Armor/ReaverHelm.cs index 54dddc5013..75b180de05 100644 --- a/Items/Armor/ReaverHelm.cs +++ b/Items/Armor/ReaverHelm.cs @@ -1,72 +1,72 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Helm"); - Tooltip.SetDefault("15% increased melee damage, 10% increased melee speed, and 5% increased melee critical strike chance\n" + - "10% increased movement speed and can move freely through liquids"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; - item.defense = 25; //58 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("ReaverScaleMail") && legs.type == mod.ItemType("ReaverCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.thorns += 0.33f; - modPlayer.reaverBlast = true; - player.setBonus = "5% increased melee damage\n" + - "Melee projectiles explode on hit\n" + - "Reaver thorns\n" + - "Rage activates when you are damaged"; - player.meleeDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.meleeDamage += 0.15f; - player.meleeCrit += 5; - player.meleeSpeed += 0.1f; - player.moveSpeed += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class ReaverHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Helm"); + Tooltip.SetDefault("15% increased melee damage, 10% increased melee speed, and 5% increased melee critical strike chance\n" + + "10% increased movement speed and can move freely through liquids"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; + item.defense = 25; //58 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("ReaverScaleMail") && legs.type == mod.ItemType("ReaverCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.thorns += 0.33f; + modPlayer.reaverBlast = true; + player.setBonus = "5% increased melee damage\n" + + "Melee projectiles explode on hit\n" + + "Reaver thorns\n" + + "Rage activates when you are damaged"; + player.meleeDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.meleeDamage += 0.15f; + player.meleeCrit += 5; + player.meleeSpeed += 0.1f; + player.moveSpeed += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/ReaverHelmet.cs b/Items/Armor/ReaverHelmet.cs index d08b0a8097..953388a145 100644 --- a/Items/Armor/ReaverHelmet.cs +++ b/Items/Armor/ReaverHelmet.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Helmet"); - Tooltip.SetDefault("5% increased minion damage, +2 max minions, and increased minion knockback\n" + - "10% increased movement speed and can move freely through liquids"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; - item.defense = 3; //36 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("ReaverScaleMail") && legs.type == mod.ItemType("ReaverCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "16% increased minion damage\n" + - "Summons a reaver orb that emits spore gas when enemies are near"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.reaverOrb = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("ReaverOrb")) == -1) - { - player.AddBuff(mod.BuffType("ReaverOrb"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("ReaverOrb")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("ReaverOrb"), (int)(80f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - } - player.minionDamage += 0.16f; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.minionDamage += 0.05f; - player.minionKB += 1f; - player.maxMinions += 2; - player.moveSpeed += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class ReaverHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Helmet"); + Tooltip.SetDefault("5% increased minion damage, +2 max minions, and increased minion knockback\n" + + "10% increased movement speed and can move freely through liquids"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; + item.defense = 3; //36 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("ReaverScaleMail") && legs.type == mod.ItemType("ReaverCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "16% increased minion damage\n" + + "Summons a reaver orb that emits spore gas when enemies are near"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.reaverOrb = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("ReaverOrb")) == -1) + { + player.AddBuff(mod.BuffType("ReaverOrb"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("ReaverOrb")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("ReaverOrb"), (int)(80f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + } + player.minionDamage += 0.16f; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.minionDamage += 0.05f; + player.minionKB += 1f; + player.maxMinions += 2; + player.moveSpeed += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/ReaverMask.cs b/Items/Armor/ReaverMask.cs index 3287f37bcc..c914911cf1 100644 --- a/Items/Armor/ReaverMask.cs +++ b/Items/Armor/ReaverMask.cs @@ -1,70 +1,70 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Mask"); - Tooltip.SetDefault("15% increased magic damage, 12% reduced mana cost, and 5% increased magic critical strike chance\n" + - "10% increased movement speed, can move freely through liquids, and +80 max mana"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; - item.defense = 7; //40 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("ReaverScaleMail") && legs.type == mod.ItemType("ReaverCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.reaverBurst = true; - player.setBonus = "5% increased magic damage\n" + - "Your magic projectiles emit a burst of spore gas on enemy hits"; - player.magicDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.magicDamage += 0.15f; - player.magicCrit += 5; - player.manaCost *= 0.88f; - player.moveSpeed += 0.1f; - player.statManaMax2 += 80; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class ReaverMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Mask"); + Tooltip.SetDefault("15% increased magic damage, 12% reduced mana cost, and 5% increased magic critical strike chance\n" + + "10% increased movement speed, can move freely through liquids, and +80 max mana"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; + item.defense = 7; //40 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("ReaverScaleMail") && legs.type == mod.ItemType("ReaverCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.reaverBurst = true; + player.setBonus = "5% increased magic damage\n" + + "Your magic projectiles emit a burst of spore gas on enemy hits"; + player.magicDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.magicDamage += 0.15f; + player.magicCrit += 5; + player.manaCost *= 0.88f; + player.moveSpeed += 0.1f; + player.statManaMax2 += 80; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/ReaverScaleMail.cs b/Items/Armor/ReaverScaleMail.cs index 521de6601b..9cb6fbf4a3 100644 --- a/Items/Armor/ReaverScaleMail.cs +++ b/Items/Armor/ReaverScaleMail.cs @@ -1,55 +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.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class ReaverScaleMail : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Scale Mail"); - Tooltip.SetDefault("9% increased damage and 4% increased critical strike chance\n" + - "+20 max life"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 7; - item.defense = 19; - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 20; - player.meleeCrit += 4; - player.meleeDamage += 0.09f; - player.magicCrit += 4; - player.magicDamage += 0.09f; - player.rangedCrit += 4; - player.rangedDamage += 0.09f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 4; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.09f; - player.minionDamage += 0.09f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class ReaverScaleMail : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Scale Mail"); + Tooltip.SetDefault("9% increased damage and 4% increased critical strike chance\n" + + "+20 max life"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 7; + item.defense = 19; + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 20; + player.meleeCrit += 4; + player.meleeDamage += 0.09f; + player.magicCrit += 4; + player.magicDamage += 0.09f; + player.rangedCrit += 4; + player.rangedDamage += 0.09f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 4; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.09f; + player.minionDamage += 0.09f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/ReaverVisage.cs b/Items/Armor/ReaverVisage.cs index 1af9c4f14e..5570652bc2 100644 --- a/Items/Armor/ReaverVisage.cs +++ b/Items/Armor/ReaverVisage.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Visage"); - Tooltip.SetDefault("15% increased ranged damage, 20% decreased ammo usage, and 5% increased ranged critical strike chance\n" + - "10% increased movement speed and can move freely through liquids"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; - item.defense = 13; //46 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("ReaverScaleMail") && legs.type == mod.ItemType("ReaverCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.reaverDoubleTap = true; - player.setBonus = "5% increased ranged damage\n" + - "While using a ranged weapon you have a 10% chance to fire a powerful rocket"; - player.rangedDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.rangedDamage += 0.15f; - player.rangedCrit += 5; - player.ammoCost80 = true; - player.moveSpeed += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class ReaverVisage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Visage"); + Tooltip.SetDefault("15% increased ranged damage, 20% decreased ammo usage, and 5% increased ranged critical strike chance\n" + + "10% increased movement speed and can move freely through liquids"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; + item.defense = 13; //46 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("ReaverScaleMail") && legs.type == mod.ItemType("ReaverCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.reaverDoubleTap = true; + player.setBonus = "5% increased ranged damage\n" + + "While using a ranged weapon you have a 10% chance to fire a powerful rocket"; + player.rangedDamage += 0.05f; + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.rangedDamage += 0.15f; + player.rangedCrit += 5; + player.ammoCost80 = true; + player.moveSpeed += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/ShroomiteVisage.cs b/Items/Armor/ShroomiteVisage.cs index cfe768f120..1b8a6d5436 100644 --- a/Items/Armor/ShroomiteVisage.cs +++ b/Items/Armor/ShroomiteVisage.cs @@ -1,57 +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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ShroomiteVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shroomite Visage"); - Tooltip.SetDefault("25% increased ranged damage for flamethrowers"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; - item.defense = 11; //62 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ItemID.ShroomiteBreastplate && legs.type == ItemID.ShroomiteLeggings; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.shroomiteStealth = true; - player.setBonus = "Ranged stealth while standing still"; - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.flamethrowerBoost = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ShroomiteBar, 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class ShroomiteVisage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shroomite Visage"); + Tooltip.SetDefault("25% increased ranged damage for flamethrowers"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 8; + item.defense = 11; //62 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ItemID.ShroomiteBreastplate && legs.type == ItemID.ShroomiteLeggings; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.shroomiteStealth = true; + player.setBonus = "Ranged stealth while standing still"; + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.flamethrowerBoost = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ShroomiteBar, 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs index 397064a148..42898e9a5b 100644 --- a/Items/Armor/SilvaArmor.cs +++ b/Items/Armor/SilvaArmor.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class SilvaArmor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Armor"); - Tooltip.SetDefault("+80 max life\n" + - "20% increased movement speed\n" + - "12% increased damage and 8% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 72, 0, 0); - item.defense = 44; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 80; - player.moveSpeed += 0.2f; - player.meleeDamage += 0.12f; - player.meleeCrit += 8; - player.rangedDamage += 0.12f; - player.rangedCrit += 8; - player.magicDamage += 0.12f; - player.magicCrit += 8; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; - player.minionDamage += 0.12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddIngredient(null, "EffulgentFeather", 10); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "Tenebris", 12); - recipe.AddIngredient(null, "NightmareFuel", 16); - recipe.AddIngredient(null, "EndothermicEnergy", 16); - recipe.AddIngredient(null, "LeadCore"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class SilvaArmor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Armor"); + Tooltip.SetDefault("+80 max life\n" + + "20% increased movement speed\n" + + "12% increased damage and 8% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 72, 0, 0); + item.defense = 44; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 80; + player.moveSpeed += 0.2f; + player.meleeDamage += 0.12f; + player.meleeCrit += 8; + player.rangedDamage += 0.12f; + player.rangedCrit += 8; + player.magicDamage += 0.12f; + player.magicCrit += 8; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; + player.minionDamage += 0.12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddIngredient(null, "EffulgentFeather", 10); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "Tenebris", 12); + recipe.AddIngredient(null, "NightmareFuel", 16); + recipe.AddIngredient(null, "EndothermicEnergy", 16); + recipe.AddIngredient(null, "LeadCore"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/SilvaHelm.cs b/Items/Armor/SilvaHelm.cs index c4f7e245a4..953bc0501c 100644 --- a/Items/Armor/SilvaHelm.cs +++ b/Items/Armor/SilvaHelm.cs @@ -1,77 +1,77 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SilvaHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Helm"); - Tooltip.SetDefault("13% increased melee damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 52; //110 - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("SilvaArmor") && legs.type == mod.ItemType("SilvaLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.silvaSet = true; - modPlayer.silvaMelee = true; - player.setBonus = "You are immune to almost all debuffs\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 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" + - "Melee projectiles have a 25% chance to stun enemies for a very brief moment"; - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.13f; - player.meleeCrit += 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "EffulgentFeather", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Tenebris", 6); - recipe.AddIngredient(null, "NightmareFuel", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 14); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SilvaHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Helm"); + Tooltip.SetDefault("13% increased melee damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 52; //110 + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("SilvaArmor") && legs.type == mod.ItemType("SilvaLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.silvaSet = true; + modPlayer.silvaMelee = true; + player.setBonus = "You are immune to almost all debuffs\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 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" + + "Melee projectiles have a 25% chance to stun enemies for a very brief moment"; + } + + public override void UpdateEquip(Player player) + { + player.meleeDamage += 0.13f; + player.meleeCrit += 13; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "EffulgentFeather", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Tenebris", 6); + recipe.AddIngredient(null, "NightmareFuel", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index 45d04bee4c..3be537dba2 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.cs @@ -1,88 +1,88 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SilvaHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Helmet"); - Tooltip.SetDefault("+5 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 13; //110 - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("SilvaArmor") && legs.type == mod.ItemType("SilvaLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.silvaSet = true; - modPlayer.silvaSummon = true; - player.setBonus = "75% increased minion damage\n" + - "You are immune to almost all debuffs\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 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"; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("SilvaCrystal")) == -1) - { - player.AddBuff(mod.BuffType("SilvaCrystal"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("SilvaCrystal")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SilvaCrystal"), (int)(1500f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - } - player.minionDamage += 0.75f; - } - - public override void UpdateEquip(Player player) - { - player.maxMinions += 5; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "EffulgentFeather", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Tenebris", 6); - recipe.AddIngredient(null, "NightmareFuel", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 14); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SilvaHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Helmet"); + Tooltip.SetDefault("+5 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 13; //110 + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("SilvaArmor") && legs.type == mod.ItemType("SilvaLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.silvaSet = true; + modPlayer.silvaSummon = true; + player.setBonus = "75% increased minion damage\n" + + "You are immune to almost all debuffs\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 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"; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("SilvaCrystal")) == -1) + { + player.AddBuff(mod.BuffType("SilvaCrystal"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("SilvaCrystal")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SilvaCrystal"), (int)(1500f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + } + player.minionDamage += 0.75f; + } + + public override void UpdateEquip(Player player) + { + player.maxMinions += 5; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "EffulgentFeather", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Tenebris", 6); + recipe.AddIngredient(null, "NightmareFuel", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/SilvaHornedHelm.cs b/Items/Armor/SilvaHornedHelm.cs index ad1d94e723..e82b7cc25e 100644 --- a/Items/Armor/SilvaHornedHelm.cs +++ b/Items/Armor/SilvaHornedHelm.cs @@ -1,76 +1,76 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SilvaHornedHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Horned Helm"); - Tooltip.SetDefault("13% increased ranged damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 36; //110 - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("SilvaArmor") && legs.type == mod.ItemType("SilvaLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.silvaSet = true; - modPlayer.silvaRanged = true; - player.setBonus = "You are immune to almost all debuffs\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 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"; - } - - public override void UpdateEquip(Player player) - { - player.rangedDamage += 0.13f; - player.rangedCrit += 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "EffulgentFeather", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Tenebris", 6); - recipe.AddIngredient(null, "NightmareFuel", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 14); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SilvaHornedHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Horned Helm"); + Tooltip.SetDefault("13% increased ranged damage and critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 36; //110 + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("SilvaArmor") && legs.type == mod.ItemType("SilvaLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.silvaSet = true; + modPlayer.silvaRanged = true; + player.setBonus = "You are immune to almost all debuffs\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 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"; + } + + public override void UpdateEquip(Player player) + { + player.rangedDamage += 0.13f; + player.rangedCrit += 13; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "EffulgentFeather", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Tenebris", 6); + recipe.AddIngredient(null, "NightmareFuel", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/SilvaLeggings.cs b/Items/Armor/SilvaLeggings.cs index 115e8e2211..63e4830351 100644 --- a/Items/Armor/SilvaLeggings.cs +++ b/Items/Armor/SilvaLeggings.cs @@ -1,60 +1,60 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class SilvaLeggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Leggings"); - Tooltip.SetDefault("45% increased movement speed\n" + - "12% increased damage and 7% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 54, 0, 0); - item.defense = 39; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.45f; - player.meleeDamage += 0.12f; - player.meleeCrit += 7; - player.rangedDamage += 0.12f; - player.rangedCrit += 7; - player.magicDamage += 0.12f; - player.magicCrit += 7; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; - player.minionDamage += 0.12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DarksunFragment", 7); - recipe.AddIngredient(null, "EffulgentFeather", 7); - recipe.AddIngredient(null, "CosmiliteBar", 7); - recipe.AddIngredient(null, "Tenebris", 9); - recipe.AddIngredient(null, "NightmareFuel", 15); - recipe.AddIngredient(null, "EndothermicEnergy", 15); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class SilvaLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Leggings"); + Tooltip.SetDefault("45% increased movement speed\n" + + "12% increased damage and 7% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 54, 0, 0); + item.defense = 39; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.45f; + player.meleeDamage += 0.12f; + player.meleeCrit += 7; + player.rangedDamage += 0.12f; + player.rangedCrit += 7; + player.magicDamage += 0.12f; + player.magicCrit += 7; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; + player.minionDamage += 0.12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DarksunFragment", 7); + recipe.AddIngredient(null, "EffulgentFeather", 7); + recipe.AddIngredient(null, "CosmiliteBar", 7); + recipe.AddIngredient(null, "Tenebris", 9); + recipe.AddIngredient(null, "NightmareFuel", 15); + recipe.AddIngredient(null, "EndothermicEnergy", 15); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/SilvaMask.cs b/Items/Armor/SilvaMask.cs index 787a49e4f4..c90ba3db90 100644 --- a/Items/Armor/SilvaMask.cs +++ b/Items/Armor/SilvaMask.cs @@ -1,82 +1,82 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SilvaMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Mask"); - Tooltip.SetDefault("13% increased rogue damage and critical strike chance, 20% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 30; //110 - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("SilvaArmor") && legs.type == mod.ItemType("SilvaLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.silvaSet = true; - modPlayer.silvaThrowing = true; - modPlayer.rogueStealthMax = 1.5f; - player.setBonus = "You are immune to almost all debuffs\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 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" + - "Rogue stealth builds while not attacking and not moving, up to a max of 150\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.13f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 13; - player.moveSpeed += 0.2f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "EffulgentFeather", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Tenebris", 6); - recipe.AddIngredient(null, "NightmareFuel", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 14); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SilvaMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Mask"); + Tooltip.SetDefault("13% increased rogue damage and critical strike chance, 20% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 30; //110 + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("SilvaArmor") && legs.type == mod.ItemType("SilvaLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.silvaSet = true; + modPlayer.silvaThrowing = true; + modPlayer.rogueStealthMax = 1.5f; + player.setBonus = "You are immune to almost all debuffs\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 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" + + "Rogue stealth builds while not attacking and not moving, up to a max of 150\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.13f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 13; + player.moveSpeed += 0.2f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "EffulgentFeather", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Tenebris", 6); + recipe.AddIngredient(null, "NightmareFuel", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index 8f27ed7b33..7106ac5929 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -1,79 +1,79 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SilvaMaskedCap : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Masked Cap"); - Tooltip.SetDefault("13% increased magic damage and critical strike chance\n" + - "+100 max mana and 19% reduced mana usage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 21; //110 - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("SilvaArmor") && legs.type == mod.ItemType("SilvaLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.silvaSet = true; - modPlayer.silvaMage = true; - player.setBonus = "You are immune to almost all debuffs\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 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"; - } - - public override void UpdateEquip(Player player) - { - player.manaCost *= 0.81f; - player.magicDamage += 0.13f; - player.magicCrit += 13; - player.statManaMax2 += 100; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "EffulgentFeather", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Tenebris", 6); - recipe.AddIngredient(null, "NightmareFuel", 14); - recipe.AddIngredient(null, "EndothermicEnergy", 14); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SilvaMaskedCap : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Masked Cap"); + Tooltip.SetDefault("13% increased magic damage and critical strike chance\n" + + "+100 max mana and 19% reduced mana usage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 90, 0, 0); + item.defense = 21; //110 + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("SilvaArmor") && legs.type == mod.ItemType("SilvaLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.silvaSet = true; + modPlayer.silvaMage = true; + player.setBonus = "You are immune to almost all debuffs\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 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"; + } + + public override void UpdateEquip(Player player) + { + player.manaCost *= 0.81f; + player.magicDamage += 0.13f; + player.magicCrit += 13; + player.statManaMax2 += 100; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "EffulgentFeather", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Tenebris", 6); + recipe.AddIngredient(null, "NightmareFuel", 14); + recipe.AddIngredient(null, "EndothermicEnergy", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/SirensHeart.cs b/Items/Armor/SirensHeart.cs index 1b8b55cb5d..4ee9b40faa 100644 --- a/Items/Armor/SirensHeart.cs +++ b/Items/Armor/SirensHeart.cs @@ -1,69 +1,69 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - public class SirensHeart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren's Heart (Blue)"); - Tooltip.SetDefault("Transforms the holder into a siren\n" + - "Siren scales give increased defense (gives more defense in hardmode and post-ML)\n" + - "Siren sight reveals enemy locations (blue-only)\n" + - "Increases life regen (gives more life regen in hardmode and post-ML)\n" + - "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 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" + - "Most of these effects are only active after Skeletron has been defeated\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.accessory = true; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 7; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(); - modPlayer.sirenBoobs = true; - if (hideVisual) - { - modPlayer.sirenBoobsHide = true; - } - } - } - - public class SirenHead : EquipTexture - { - public override bool DrawHead() - { - return false; - } - } - - public class SirenBody : EquipTexture - { - public override bool DrawBody() - { - return false; - } - } - - public class SirenLegs : EquipTexture - { - public override bool DrawLegs() - { - return false; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + public class SirensHeart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Siren's Heart (Blue)"); + Tooltip.SetDefault("Transforms the holder into a siren\n" + + "Siren scales give increased defense (gives more defense in hardmode and post-ML)\n" + + "Siren sight reveals enemy locations (blue-only)\n" + + "Increases life regen (gives more life regen in hardmode and post-ML)\n" + + "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 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" + + "Most of these effects are only active after Skeletron has been defeated\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.accessory = true; + item.value = Item.buyPrice(0, 45, 0, 0); + item.rare = 7; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(); + modPlayer.sirenBoobs = true; + if (hideVisual) + { + modPlayer.sirenBoobsHide = true; + } + } + } + + public class SirenHead : EquipTexture + { + public override bool DrawHead() + { + return false; + } + } + + public class SirenBody : EquipTexture + { + public override bool DrawBody() + { + return false; + } + } + + public class SirenLegs : EquipTexture + { + public override bool DrawLegs() + { + return false; + } + } +} diff --git a/Items/Armor/SirensHeartAlt.cs b/Items/Armor/SirensHeartAlt.cs index 7bda159e4c..b31d2d60a5 100644 --- a/Items/Armor/SirensHeartAlt.cs +++ b/Items/Armor/SirensHeartAlt.cs @@ -1,69 +1,69 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - public class SirensHeartAlt : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren's Heart (Green)"); - Tooltip.SetDefault("Transforms the holder into a siren\n" + - "Siren scales give increased defense (gives more defense in hardmode and post-ML)\n" + - "Siren sight reveals danger locations (green-only)\n" + - "Increases life regen (gives more life regen in hardmode and post-ML)\n" + - "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 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" + - "Most of these effects are only active after Skeletron has been defeated\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.accessory = true; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 7; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(); - modPlayer.sirenBoobsAlt = true; - if (hideVisual) - { - modPlayer.sirenBoobsAltHide = true; - } - } - } - - public class SirenHeadAlt : EquipTexture - { - public override bool DrawHead() - { - return false; - } - } - - public class SirenBodyAlt : EquipTexture - { - public override bool DrawBody() - { - return false; - } - } - - public class SirenLegsAlt : EquipTexture - { - public override bool DrawLegs() - { - return false; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + public class SirensHeartAlt : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Siren's Heart (Green)"); + Tooltip.SetDefault("Transforms the holder into a siren\n" + + "Siren scales give increased defense (gives more defense in hardmode and post-ML)\n" + + "Siren sight reveals danger locations (green-only)\n" + + "Increases life regen (gives more life regen in hardmode and post-ML)\n" + + "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 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" + + "Most of these effects are only active after Skeletron has been defeated\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.accessory = true; + item.value = Item.buyPrice(0, 45, 0, 0); + item.rare = 7; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(); + modPlayer.sirenBoobsAlt = true; + if (hideVisual) + { + modPlayer.sirenBoobsAltHide = true; + } + } + } + + public class SirenHeadAlt : EquipTexture + { + public override bool DrawHead() + { + return false; + } + } + + public class SirenBodyAlt : EquipTexture + { + public override bool DrawBody() + { + return false; + } + } + + public class SirenLegsAlt : EquipTexture + { + public override bool DrawLegs() + { + return false; + } + } +} diff --git a/Items/Armor/SlimeGodMask.cs b/Items/Armor/SlimeGodMask.cs index d3410d3bc9..12b02cb439 100644 --- a/Items/Armor/SlimeGodMask.cs +++ b/Items/Armor/SlimeGodMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SlimeGodMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slime God Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SlimeGodMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/SlimeGodMask2.cs b/Items/Armor/SlimeGodMask2.cs index 24320035e0..a5c7a0cbf2 100644 --- a/Items/Armor/SlimeGodMask2.cs +++ b/Items/Armor/SlimeGodMask2.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SlimeGodMask2 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slime God Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class SlimeGodMask2 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/Armor/StatigelArmor.cs b/Items/Armor/StatigelArmor.cs index 8a8df45a2d..3b6fcdd1b7 100644 --- a/Items/Armor/StatigelArmor.cs +++ b/Items/Armor/StatigelArmor.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.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class StatigelArmor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statigel Armor"); - Tooltip.SetDefault("5% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 4; - item.defense = 10; - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 5; - player.magicCrit += 5; - player.rangedCrit += 5; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 8); - recipe.AddIngredient(ItemID.HellstoneBar, 13); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class StatigelArmor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statigel Armor"); + Tooltip.SetDefault("5% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 4; + item.defense = 10; + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 5; + player.magicCrit += 5; + player.rangedCrit += 5; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 8); + recipe.AddIngredient(ItemID.HellstoneBar, 13); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/StatigelCap.cs b/Items/Armor/StatigelCap.cs index 7fbeaa4e14..ba3433e900 100644 --- a/Items/Armor/StatigelCap.cs +++ b/Items/Armor/StatigelCap.cs @@ -1,64 +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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class StatigelCap : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statigel Cap"); - Tooltip.SetDefault("10% increased magic damage and 10% decreased mana cost\n" + - "7% increased magic critical strike chance and +30 max mana"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; - item.defense = 5; //22 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("StatigelArmor") && legs.type == mod.ItemType("StatigelGreaves"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.statigelSet = true; - player.doubleJumpSail = true; - player.jumpBoost = true; - } - - public override void UpdateEquip(Player player) - { - player.magicDamage += 0.1f; - player.magicCrit += 7; - player.manaCost *= 0.9f; - player.statManaMax2 += 30; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 5); - recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class StatigelCap : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statigel Cap"); + Tooltip.SetDefault("10% increased magic damage and 10% decreased mana cost\n" + + "7% increased magic critical strike chance and +30 max mana"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 4; + item.defense = 5; //22 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("StatigelArmor") && legs.type == mod.ItemType("StatigelGreaves"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + + "Grants an extra jump and increased jump height"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.statigelSet = true; + player.doubleJumpSail = true; + player.jumpBoost = true; + } + + public override void UpdateEquip(Player player) + { + player.magicDamage += 0.1f; + player.magicCrit += 7; + player.manaCost *= 0.9f; + player.statManaMax2 += 30; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 5); + recipe.AddIngredient(ItemID.HellstoneBar, 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/StatigelGreaves.cs b/Items/Armor/StatigelGreaves.cs index 1450e86ff5..f60b150341 100644 --- a/Items/Armor/StatigelGreaves.cs +++ b/Items/Armor/StatigelGreaves.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class StatigelGreaves : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statigel Greaves"); - Tooltip.SetDefault("5% increased damage and movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 4; - item.defense = 8; - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.05f; - player.magicDamage += 0.05f; - player.rangedDamage += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - player.minionDamage += 0.05f; - player.moveSpeed += 0.05f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 6); - recipe.AddIngredient(ItemID.HellstoneBar, 11); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class StatigelGreaves : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statigel Greaves"); + Tooltip.SetDefault("5% increased damage and movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 4; + item.defense = 8; + } + + public override void UpdateEquip(Player player) + { + player.meleeDamage += 0.05f; + player.magicDamage += 0.05f; + player.rangedDamage += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + player.minionDamage += 0.05f; + player.moveSpeed += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 6); + recipe.AddIngredient(ItemID.HellstoneBar, 11); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/StatigelHeadgear.cs b/Items/Armor/StatigelHeadgear.cs index 8b9f43dafc..61d1c40333 100644 --- a/Items/Armor/StatigelHeadgear.cs +++ b/Items/Armor/StatigelHeadgear.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class StatigelHeadgear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statigel Headgear"); - Tooltip.SetDefault("10% increased ranged damage\n" + - "7% increased ranged critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; - item.defense = 7; //25 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("StatigelArmor") && legs.type == mod.ItemType("StatigelGreaves"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.statigelSet = true; - player.doubleJumpSail = true; - player.jumpBoost = true; - } - - public override void UpdateEquip(Player player) - { - player.rangedDamage += 0.1f; - player.rangedCrit += 7; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 5); - recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class StatigelHeadgear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statigel Headgear"); + Tooltip.SetDefault("10% increased ranged damage\n" + + "7% increased ranged critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 4; + item.defense = 7; //25 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("StatigelArmor") && legs.type == mod.ItemType("StatigelGreaves"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + + "Grants an extra jump and increased jump height"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.statigelSet = true; + player.doubleJumpSail = true; + player.jumpBoost = true; + } + + public override void UpdateEquip(Player player) + { + player.rangedDamage += 0.1f; + player.rangedCrit += 7; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 5); + recipe.AddIngredient(ItemID.HellstoneBar, 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/StatigelHelm.cs b/Items/Armor/StatigelHelm.cs index 5b750fd7c0..7ee86abf6a 100644 --- a/Items/Armor/StatigelHelm.cs +++ b/Items/Armor/StatigelHelm.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class StatigelHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statigel Helm"); - Tooltip.SetDefault("10% increased melee damage and melee speed\n" + - "7% increased melee critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; - item.defense = 9; //27 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("StatigelArmor") && legs.type == mod.ItemType("StatigelGreaves"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.statigelSet = true; - player.doubleJumpSail = true; - player.jumpBoost = true; - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.1f; - player.meleeCrit += 7; - player.meleeSpeed += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 5); - recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class StatigelHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statigel Helm"); + Tooltip.SetDefault("10% increased melee damage and melee speed\n" + + "7% increased melee critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 4; + item.defense = 9; //27 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("StatigelArmor") && legs.type == mod.ItemType("StatigelGreaves"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + + "Grants an extra jump and increased jump height"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.statigelSet = true; + player.doubleJumpSail = true; + player.jumpBoost = true; + } + + public override void UpdateEquip(Player player) + { + player.meleeDamage += 0.1f; + player.meleeCrit += 7; + player.meleeSpeed += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 5); + recipe.AddIngredient(ItemID.HellstoneBar, 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/StatigelHood.cs b/Items/Armor/StatigelHood.cs index 82fdfec0a2..549a099602 100644 --- a/Items/Armor/StatigelHood.cs +++ b/Items/Armor/StatigelHood.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class StatigelHood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statigel Hood"); - Tooltip.SetDefault("Increased minion knockback and +1 max minion"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; - item.defense = 4; //20 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("StatigelArmor") && legs.type == mod.ItemType("StatigelGreaves"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "18% increased minion damage\n" + - "Summons a mini slime god to fight for you, the type depends on what world evil you have\n" + - "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.statigelSet = true; - modPlayer.slimeGod = true; - player.doubleJumpSail = true; - player.jumpBoost = true; - player.minionDamage += 0.18f; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("SlimeGod")) == -1) - { - player.AddBuff(mod.BuffType("SlimeGod"), 3600, true); - } - if (WorldGen.crimson && player.ownedProjectileCounts[mod.ProjectileType("SlimeGodAlt")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SlimeGodAlt"), (int)(33f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - else if (!WorldGen.crimson && player.ownedProjectileCounts[mod.ProjectileType("SlimeGod")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SlimeGod"), (int)(33f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - } - } - - public override void UpdateEquip(Player player) - { - player.minionKB += 1.5f; - player.maxMinions++; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 5); - recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class StatigelHood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statigel Hood"); + Tooltip.SetDefault("Increased minion knockback and +1 max minion"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 4; + item.defense = 4; //20 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("StatigelArmor") && legs.type == mod.ItemType("StatigelGreaves"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "18% increased minion damage\n" + + "Summons a mini slime god to fight for you, the type depends on what world evil you have\n" + + "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + + "Grants an extra jump and increased jump height"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.statigelSet = true; + modPlayer.slimeGod = true; + player.doubleJumpSail = true; + player.jumpBoost = true; + player.minionDamage += 0.18f; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("SlimeGod")) == -1) + { + player.AddBuff(mod.BuffType("SlimeGod"), 3600, true); + } + if (WorldGen.crimson && player.ownedProjectileCounts[mod.ProjectileType("SlimeGodAlt")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SlimeGodAlt"), (int)(33f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + else if (!WorldGen.crimson && player.ownedProjectileCounts[mod.ProjectileType("SlimeGod")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SlimeGod"), (int)(33f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + } + } + + public override void UpdateEquip(Player player) + { + player.minionKB += 1.5f; + player.maxMinions++; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 5); + recipe.AddIngredient(ItemID.HellstoneBar, 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index 579240bf26..0cd06230e5 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class StatigelMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Statigel Mask"); - Tooltip.SetDefault("10% increased rogue damage and 33% chance to not consume rogue items\n" + - "7% increased rogue critical strike chance and 12% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; - item.defense = 6; //23 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("StatigelArmor") && legs.type == mod.ItemType("StatigelGreaves"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 105\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.statigelSet = true; - modPlayer.rogueStealthMax = 1.05f; - player.doubleJumpSail = true; - player.jumpBoost = true; - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingAmmoCost66 = true; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; - player.moveSpeed += 0.12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 5); - recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class StatigelMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Statigel Mask"); + Tooltip.SetDefault("10% increased rogue damage and 33% chance to not consume rogue items\n" + + "7% increased rogue critical strike chance and 12% increased movement speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 4; + item.defense = 6; //23 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("StatigelArmor") && legs.type == mod.ItemType("StatigelGreaves"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + + "Grants an extra jump and increased jump height\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 105\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.statigelSet = true; + modPlayer.rogueStealthMax = 1.05f; + player.doubleJumpSail = true; + player.jumpBoost = true; + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingAmmoCost66 = true; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; + player.moveSpeed += 0.12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 5); + recipe.AddIngredient(ItemID.HellstoneBar, 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TarragonBreastplate.cs b/Items/Armor/TarragonBreastplate.cs index 8efa432380..4d84cdb0fc 100644 --- a/Items/Armor/TarragonBreastplate.cs +++ b/Items/Armor/TarragonBreastplate.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class TarragonBreastplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Breastplate"); - Tooltip.SetDefault("10% increased damage and 5% increased critical strike chance\n" + - "+2 life regen and +40 max life\n" + - "Breastplate of the exiler"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.lifeRegen = 2; - item.value = Item.buyPrice(0, 40, 0, 0); - item.defense = 37; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 40; - player.meleeDamage += 0.1f; - player.meleeCrit += 5; - player.magicDamage += 0.1f; - player.magicCrit += 5; - player.rangedDamage += 0.1f; - player.rangedCrit += 5; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - player.minionDamage += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 15); - recipe.AddIngredient(null, "DivineGeode", 18); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class TarragonBreastplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Breastplate"); + Tooltip.SetDefault("10% increased damage and 5% increased critical strike chance\n" + + "+2 life regen and +40 max life\n" + + "Breastplate of the exiler"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.lifeRegen = 2; + item.value = Item.buyPrice(0, 40, 0, 0); + item.defense = 37; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 40; + player.meleeDamage += 0.1f; + player.meleeCrit += 5; + player.magicDamage += 0.1f; + player.magicCrit += 5; + player.rangedDamage += 0.1f; + player.rangedCrit += 5; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + player.minionDamage += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 15); + recipe.AddIngredient(null, "DivineGeode", 18); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TarragonHelm.cs b/Items/Armor/TarragonHelm.cs index f95849292d..5d72cf40b1 100644 --- a/Items/Armor/TarragonHelm.cs +++ b/Items/Armor/TarragonHelm.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class TarragonHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Helm"); - Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + - "Can move freely through liquids\n" + - "5% increased damage reduction\n" + - "10% increased melee damage and critical strike chance\n" + - "Helm of the disciple of ancients"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 33; //98 - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("TarragonBreastplate") && legs.type == mod.ItemType("TarragonLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tarraSet = true; - modPlayer.tarraMelee = true; - player.setBonus = "Increased heart pickup range\n" + - "Enemies have a chance to drop extra hearts on death\n" + - "You have a 25% chance to gain a life regen buff when you take damage\n" + - "Press Y to cloak yourself in life energy that heavily reduces enemy contact damage for 10 seconds\n" + - "This has a 30 second cooldown"; - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.1f; - player.meleeCrit += 10; - player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(null, "DivineGeode", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class TarragonHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Helm"); + Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + + "Can move freely through liquids\n" + + "5% increased damage reduction\n" + + "10% increased melee damage and critical strike chance\n" + + "Helm of the disciple of ancients"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 50, 0, 0); + item.defense = 33; //98 + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("TarragonBreastplate") && legs.type == mod.ItemType("TarragonLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tarraSet = true; + modPlayer.tarraMelee = true; + player.setBonus = "Increased heart pickup range\n" + + "Enemies have a chance to drop extra hearts on death\n" + + "You have a 25% chance to gain a life regen buff when you take damage\n" + + "Press Y to cloak yourself in life energy that heavily reduces enemy contact damage for 10 seconds\n" + + "This has a 30 second cooldown"; + } + + public override void UpdateEquip(Player player) + { + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + player.endurance += 0.05f; + player.lavaMax += 240; + player.ignoreWater = true; + player.buffImmune[BuffID.CursedInferno] = true; + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.Cursed] = true; + player.buffImmune[BuffID.Chilled] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(null, "DivineGeode", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TarragonHelmet.cs b/Items/Armor/TarragonHelmet.cs index 10d6c04b91..8b5f6c07d1 100644 --- a/Items/Armor/TarragonHelmet.cs +++ b/Items/Armor/TarragonHelmet.cs @@ -1,86 +1,86 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class TarragonHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Helmet"); - Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + - "Can move freely through liquids and 12% increased movement speed\n" + - "10% increased rogue damage and critical strike chance\n" + - "5% increased damage reduction"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 15; //98 - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("TarragonBreastplate") && legs.type == mod.ItemType("TarragonLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tarraSet = true; - modPlayer.tarraThrowing = true; - modPlayer.rogueStealthMax = 1.3f; - player.setBonus = "Reduces enemy spawn rates\n" + - "Increased heart pickup range\n" + - "Enemies have a chance to drop extra hearts on death\n" + - "After every 25 rogue critical hits you will gain 5 seconds of damage immunity\n" + - "This effect can only occur once every 30 seconds\n" + - "While under the effects of a debuff you gain 10% increased rogue damage\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 130\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; - player.moveSpeed += 0.12f; - player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(null, "DivineGeode", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class TarragonHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Helmet"); + Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + + "Can move freely through liquids and 12% increased movement speed\n" + + "10% increased rogue damage and critical strike chance\n" + + "5% increased damage reduction"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 50, 0, 0); + item.defense = 15; //98 + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("TarragonBreastplate") && legs.type == mod.ItemType("TarragonLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tarraSet = true; + modPlayer.tarraThrowing = true; + modPlayer.rogueStealthMax = 1.3f; + player.setBonus = "Reduces enemy spawn rates\n" + + "Increased heart pickup range\n" + + "Enemies have a chance to drop extra hearts on death\n" + + "After every 25 rogue critical hits you will gain 5 seconds of damage immunity\n" + + "This effect can only occur once every 30 seconds\n" + + "While under the effects of a debuff you gain 10% increased rogue damage\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 130\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; + player.moveSpeed += 0.12f; + player.endurance += 0.05f; + player.lavaMax += 240; + player.ignoreWater = true; + player.buffImmune[BuffID.CursedInferno] = true; + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.Cursed] = true; + player.buffImmune[BuffID.Chilled] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(null, "DivineGeode", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TarragonHornedHelm.cs b/Items/Armor/TarragonHornedHelm.cs index aa2f4ae415..ca23cd6236 100644 --- a/Items/Armor/TarragonHornedHelm.cs +++ b/Items/Armor/TarragonHornedHelm.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class TarragonHornedHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Horned Helm"); - Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + - "Can move freely through liquids\n" + - "5% increased damage reduction and +3 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 3; //98 - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("TarragonBreastplate") && legs.type == mod.ItemType("TarragonLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tarraSet = true; - modPlayer.tarraSummon = true; - player.setBonus = "50% increased minion damage\n" + - "Reduces enemy spawn rates\n" + - "Increased heart pickup range\n" + - "Enemies have a chance to drop extra hearts on death\n" + - "At full health you gain +2 max minions and 10% increased minion damage\n" + - "Summons a life aura around you that damages nearby enemies"; - player.minionDamage += 0.5f; - } - - public override void UpdateEquip(Player player) - { - player.maxMinions += 3; - player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(null, "DivineGeode", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class TarragonHornedHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Horned Helm"); + Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + + "Can move freely through liquids\n" + + "5% increased damage reduction and +3 max minions"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 50, 0, 0); + item.defense = 3; //98 + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("TarragonBreastplate") && legs.type == mod.ItemType("TarragonLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tarraSet = true; + modPlayer.tarraSummon = true; + player.setBonus = "50% increased minion damage\n" + + "Reduces enemy spawn rates\n" + + "Increased heart pickup range\n" + + "Enemies have a chance to drop extra hearts on death\n" + + "At full health you gain +2 max minions and 10% increased minion damage\n" + + "Summons a life aura around you that damages nearby enemies"; + player.minionDamage += 0.5f; + } + + public override void UpdateEquip(Player player) + { + player.maxMinions += 3; + player.endurance += 0.05f; + player.lavaMax += 240; + player.ignoreWater = true; + player.buffImmune[BuffID.CursedInferno] = true; + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.Cursed] = true; + player.buffImmune[BuffID.Chilled] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(null, "DivineGeode", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TarragonLeggings.cs b/Items/Armor/TarragonLeggings.cs index 21f20033e5..28fa201ac4 100644 --- a/Items/Armor/TarragonLeggings.cs +++ b/Items/Armor/TarragonLeggings.cs @@ -1,61 +1,61 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class TarragonLeggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Leggings"); - Tooltip.SetDefault("20% increased movement speed; greater speed boost if health is lower\n" + - "6% increased damage and critical strike chance\n" + - "Leggings of a fabled explorer"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 30, 0, 0); - item.defense = 32; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.20f; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.moveSpeed += 0.15f; - } - player.meleeDamage += 0.06f; - player.meleeCrit += 6; - player.magicDamage += 0.06f; - player.magicCrit += 6; - player.rangedDamage += 0.06f; - player.rangedCrit += 6; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.06f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 6; - player.minionDamage += 0.06f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 11); - recipe.AddIngredient(null, "DivineGeode", 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class TarragonLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Leggings"); + Tooltip.SetDefault("20% increased movement speed; greater speed boost if health is lower\n" + + "6% increased damage and critical strike chance\n" + + "Leggings of a fabled explorer"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 30, 0, 0); + item.defense = 32; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.20f; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.moveSpeed += 0.15f; + } + player.meleeDamage += 0.06f; + player.meleeCrit += 6; + player.magicDamage += 0.06f; + player.magicCrit += 6; + player.rangedDamage += 0.06f; + player.rangedCrit += 6; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.06f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 6; + player.minionDamage += 0.06f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 11); + recipe.AddIngredient(null, "DivineGeode", 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TarragonMask.cs b/Items/Armor/TarragonMask.cs index 5f3bd3bf10..1beacdd488 100644 --- a/Items/Armor/TarragonMask.cs +++ b/Items/Armor/TarragonMask.cs @@ -1,82 +1,82 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class TarragonMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Mask"); - 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, +100 max mana, and 15% reduced mana usage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 10; //98 - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("TarragonBreastplate") && legs.type == mod.ItemType("TarragonLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tarraSet = true; - modPlayer.tarraMage = true; - player.setBonus = "Reduces enemy spawn rates\n" + - "Increased heart pickup range\n" + - "Enemies have a chance to drop extra hearts on death\n" + - "On every 5th critical strike you will fire a leaf storm\n" + - "Magic projectiles have a 50% chance to heal you on enemy hits\n" + - "Amount healed is based on projectile damage"; - } - - public override void UpdateEquip(Player player) - { - player.manaCost *= 0.85f; - player.magicDamage += 0.1f; - 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; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(null, "DivineGeode", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class TarragonMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Mask"); + 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, +100 max mana, and 15% reduced mana usage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 50, 0, 0); + item.defense = 10; //98 + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("TarragonBreastplate") && legs.type == mod.ItemType("TarragonLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tarraSet = true; + modPlayer.tarraMage = true; + player.setBonus = "Reduces enemy spawn rates\n" + + "Increased heart pickup range\n" + + "Enemies have a chance to drop extra hearts on death\n" + + "On every 5th critical strike you will fire a leaf storm\n" + + "Magic projectiles have a 50% chance to heal you on enemy hits\n" + + "Amount healed is based on projectile damage"; + } + + public override void UpdateEquip(Player player) + { + player.manaCost *= 0.85f; + player.magicDamage += 0.1f; + 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; + player.buffImmune[BuffID.Cursed] = true; + player.buffImmune[BuffID.Chilled] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(null, "DivineGeode", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TarragonVisage.cs b/Items/Armor/TarragonVisage.cs index 7b7a51e428..dd618669ba 100644 --- a/Items/Armor/TarragonVisage.cs +++ b/Items/Armor/TarragonVisage.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class TarragonVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Visage"); - 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 ranged damage and critical strike chance\n" + - "5% increased damage reduction"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 50, 0, 0); - item.defense = 21; //98 - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("TarragonBreastplate") && legs.type == mod.ItemType("TarragonLeggings"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.tarraSet = true; - modPlayer.tarraRanged = true; - player.setBonus = "Reduces enemy spawn rates\n" + - "Increased heart pickup range\n" + - "Enemies have a chance to drop extra hearts on death\n" + - "Ranged critical strikes will cause an explosion of leaves\n" + - "Ranged projectiles have a chance to split into life energy on death"; - } - - public override void UpdateEquip(Player player) - { - player.rangedDamage += 0.1f; - player.rangedCrit += 10; - player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(null, "DivineGeode", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class TarragonVisage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Visage"); + 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 ranged damage and critical strike chance\n" + + "5% increased damage reduction"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 50, 0, 0); + item.defense = 21; //98 + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("TarragonBreastplate") && legs.type == mod.ItemType("TarragonLeggings"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.tarraSet = true; + modPlayer.tarraRanged = true; + player.setBonus = "Reduces enemy spawn rates\n" + + "Increased heart pickup range\n" + + "Enemies have a chance to drop extra hearts on death\n" + + "Ranged critical strikes will cause an explosion of leaves\n" + + "Ranged projectiles have a chance to split into life energy on death"; + } + + public override void UpdateEquip(Player player) + { + player.rangedDamage += 0.1f; + player.rangedCrit += 10; + player.endurance += 0.05f; + player.lavaMax += 240; + player.ignoreWater = true; + player.buffImmune[BuffID.CursedInferno] = true; + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.Cursed] = true; + player.buffImmune[BuffID.Chilled] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(null, "DivineGeode", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/VictideBreastplate.cs b/Items/Armor/VictideBreastplate.cs index 979dc3c149..0a566361fc 100644 --- a/Items/Armor/VictideBreastplate.cs +++ b/Items/Armor/VictideBreastplate.cs @@ -1,55 +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; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class VictideBreastplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Breastplate"); - Tooltip.SetDefault("5% increased damage reduction and critical strike chance\n" + - "Defense increased while submerged in liquid"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 2; - item.defense = 5; //9 - } - - public override void UpdateEquip(Player player) - { - player.endurance += 0.05f; - player.meleeCrit += 5; - player.rangedCrit += 5; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - player.magicCrit += 5; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.statDefense += 5; - player.endurance += 0.1f; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class VictideBreastplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Breastplate"); + Tooltip.SetDefault("5% increased damage reduction and critical strike chance\n" + + "Defense increased while submerged in liquid"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 2; + item.defense = 5; //9 + } + + public override void UpdateEquip(Player player) + { + player.endurance += 0.05f; + player.meleeCrit += 5; + player.rangedCrit += 5; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + player.magicCrit += 5; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.statDefense += 5; + player.endurance += 0.1f; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs index c0890303d2..aad635eafd 100644 --- a/Items/Armor/VictideHeadgear.cs +++ b/Items/Armor/VictideHeadgear.cs @@ -1,70 +1,70 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class VictideHeadgear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Headgear"); - Tooltip.SetDefault("5% increased rogue damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; - item.defense = 3; //10 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("VictideBreastplate") && legs.type == mod.ItemType("VictideLeggings"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Increased life regen and rogue damage while submerged in liquid\n" + - "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + - "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.victideSet = true; - modPlayer.rogueStealthMax = 1f; - player.ignoreWater = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - player.lifeRegen += 3; - } - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class VictideHeadgear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Headgear"); + Tooltip.SetDefault("5% increased rogue damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 1, 50, 0); + item.rare = 2; + item.defense = 3; //10 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("VictideBreastplate") && legs.type == mod.ItemType("VictideLeggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Increased life regen and rogue damage while submerged in liquid\n" + + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + + "This seashell does true damage and does not benefit from any damage class\n" + + "Slightly reduces breath loss in the abyss\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.victideSet = true; + modPlayer.rogueStealthMax = 1f; + player.ignoreWater = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + player.lifeRegen += 3; + } + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/VictideHelm.cs b/Items/Armor/VictideHelm.cs index 467101fbf4..3a72a4beef 100644 --- a/Items/Armor/VictideHelm.cs +++ b/Items/Armor/VictideHelm.cs @@ -1,65 +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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class VictideHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Helm"); - Tooltip.SetDefault("5% increased melee damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; - item.defense = 4; //11 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("VictideBreastplate") && legs.type == mod.ItemType("VictideLeggings"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Increased life regen and melee damage while submerged in liquid\n" + - "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + - "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.victideSet = true; - player.ignoreWater = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.meleeDamage += 0.1f; - player.lifeRegen += 3; - } - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.05f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class VictideHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Helm"); + Tooltip.SetDefault("5% increased melee damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 1, 50, 0); + item.rare = 2; + item.defense = 4; //11 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("VictideBreastplate") && legs.type == mod.ItemType("VictideLeggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Increased life regen and melee damage while submerged in liquid\n" + + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + + "This seashell does true damage and does not benefit from any damage class\n" + + "Slightly reduces breath loss in the abyss"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.victideSet = true; + player.ignoreWater = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.meleeDamage += 0.1f; + player.lifeRegen += 3; + } + } + + public override void UpdateEquip(Player player) + { + player.meleeDamage += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/VictideHelmet.cs b/Items/Armor/VictideHelmet.cs index 51ded7feae..645d0bae8d 100644 --- a/Items/Armor/VictideHelmet.cs +++ b/Items/Armor/VictideHelmet.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class VictideHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Helmet"); - Tooltip.SetDefault("9% increased minion damage\n" + - "+1 max minion"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; - item.defense = 1; //8 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("VictideBreastplate") && legs.type == mod.ItemType("VictideLeggings"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Increased life regen and minion damage while submerged in liquid\n" + - "Summons a sea urchin to protect you\n" + - "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + - "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.victideSet = true; - modPlayer.urchin = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("Urchin")) == -1) - { - player.AddBuff(mod.BuffType("Urchin"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("Urchin")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("Urchin"), (int)(7f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - } - player.ignoreWater = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.minionDamage += 0.1f; - player.lifeRegen += 3; - } - } - - public override void UpdateEquip(Player player) - { - player.minionDamage += 0.09f; - player.maxMinions++; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class VictideHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Helmet"); + Tooltip.SetDefault("9% increased minion damage\n" + + "+1 max minion"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 1, 50, 0); + item.rare = 2; + item.defense = 1; //8 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("VictideBreastplate") && legs.type == mod.ItemType("VictideLeggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Increased life regen and minion damage while submerged in liquid\n" + + "Summons a sea urchin to protect you\n" + + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + + "This seashell does true damage and does not benefit from any damage class\n" + + "Slightly reduces breath loss in the abyss"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.victideSet = true; + modPlayer.urchin = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("Urchin")) == -1) + { + player.AddBuff(mod.BuffType("Urchin"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("Urchin")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("Urchin"), (int)(7f * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + } + player.ignoreWater = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.minionDamage += 0.1f; + player.lifeRegen += 3; + } + } + + public override void UpdateEquip(Player player) + { + player.minionDamage += 0.09f; + player.maxMinions++; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/VictideLeggings.cs b/Items/Armor/VictideLeggings.cs index ba5e4bab36..90c5b799c6 100644 --- a/Items/Armor/VictideLeggings.cs +++ b/Items/Armor/VictideLeggings.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.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class VictideLeggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Leggings"); - Tooltip.SetDefault("Movement speed increased by 8%\n" + - "Speed greatly increased while submerged in liquid"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 2; - item.defense = 4; //9 - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.08f; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.moveSpeed += 0.5f; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 4); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class VictideLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Leggings"); + Tooltip.SetDefault("Movement speed increased by 8%\n" + + "Speed greatly increased while submerged in liquid"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 50, 0); + item.rare = 2; + item.defense = 4; //9 + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.08f; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.moveSpeed += 0.5f; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 4); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/VictideMask.cs b/Items/Armor/VictideMask.cs index 36966cdbf9..8b58b01422 100644 --- a/Items/Armor/VictideMask.cs +++ b/Items/Armor/VictideMask.cs @@ -1,65 +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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class VictideMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Mask"); - Tooltip.SetDefault("5% increased magic damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; - item.defense = 2; //9 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("VictideBreastplate") && legs.type == mod.ItemType("VictideLeggings"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Increased life regen and magic damage while submerged in liquid\n" + - "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + - "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.victideSet = true; - player.ignoreWater = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.magicDamage += 0.1f; - player.lifeRegen += 3; - } - } - - public override void UpdateEquip(Player player) - { - player.magicDamage += 0.05f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class VictideMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Mask"); + Tooltip.SetDefault("5% increased magic damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 1, 50, 0); + item.rare = 2; + item.defense = 2; //9 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("VictideBreastplate") && legs.type == mod.ItemType("VictideLeggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Increased life regen and magic damage while submerged in liquid\n" + + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + + "This seashell does true damage and does not benefit from any damage class\n" + + "Slightly reduces breath loss in the abyss"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.victideSet = true; + player.ignoreWater = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.magicDamage += 0.1f; + player.lifeRegen += 3; + } + } + + public override void UpdateEquip(Player player) + { + player.magicDamage += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/VictideVisage.cs b/Items/Armor/VictideVisage.cs index 06ec86ae2e..9d0109500e 100644 --- a/Items/Armor/VictideVisage.cs +++ b/Items/Armor/VictideVisage.cs @@ -1,65 +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.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class VictideVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Visage"); - Tooltip.SetDefault("5% increased ranged damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; - item.defense = 3; //10 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("VictideBreastplate") && legs.type == mod.ItemType("VictideLeggings"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Increased life regen and ranged damage while submerged in liquid\n" + - "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + - "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.victideSet = true; - player.ignoreWater = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.rangedDamage += 0.1f; - player.lifeRegen += 3; - } - } - - public override void UpdateEquip(Player player) - { - player.rangedDamage += 0.05f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class VictideVisage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Visage"); + Tooltip.SetDefault("5% increased ranged damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 1, 50, 0); + item.rare = 2; + item.defense = 3; //10 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("VictideBreastplate") && legs.type == mod.ItemType("VictideLeggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Increased life regen and ranged damage while submerged in liquid\n" + + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + + "This seashell does true damage and does not benefit from any damage class\n" + + "Slightly reduces breath loss in the abyss"; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.victideSet = true; + player.ignoreWater = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.rangedDamage += 0.1f; + player.lifeRegen += 3; + } + } + + public override void UpdateEquip(Player player) + { + player.rangedDamage += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/WulfrumArmor.cs b/Items/Armor/WulfrumArmor.cs index dfdab1577a..4c6dc02a5c 100644 --- a/Items/Armor/WulfrumArmor.cs +++ b/Items/Armor/WulfrumArmor.cs @@ -1,48 +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; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class WulfrumArmor : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Armor"); - Tooltip.SetDefault("3% increased critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 1; - item.defense = 2; - } - - public override void UpdateEquip(Player player) - { - player.meleeCrit += 3; - player.magicCrit += 3; - player.rangedCrit += 3; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class WulfrumArmor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Armor"); + Tooltip.SetDefault("3% increased critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 50, 0); + item.rare = 1; + item.defense = 2; + } + + public override void UpdateEquip(Player player) + { + player.meleeCrit += 3; + player.magicCrit += 3; + player.rangedCrit += 3; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/WulfrumHeadgear.cs b/Items/Armor/WulfrumHeadgear.cs index 1ef0d43fed..d716ec94fc 100644 --- a/Items/Armor/WulfrumHeadgear.cs +++ b/Items/Armor/WulfrumHeadgear.cs @@ -1,60 +1,60 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class WulfrumHeadgear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Headgear"); - Tooltip.SetDefault("3% increased ranged damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; - item.defense = 2; //7 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("WulfrumArmor") && legs.type == mod.ItemType("WulfrumLeggings"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "+3 defense\n" + - "+5 defense when below 50% life"; - player.statDefense += 3; //10 - if (player.statLife <= (player.statLifeMax2 * 0.5f)) - { - player.statDefense += 5; //15 - } - } - - public override void UpdateEquip(Player player) - { - player.rangedDamage += 0.03f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class WulfrumHeadgear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Headgear"); + Tooltip.SetDefault("3% increased ranged damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; + item.defense = 2; //7 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("WulfrumArmor") && legs.type == mod.ItemType("WulfrumLeggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "+3 defense\n" + + "+5 defense when below 50% life"; + player.statDefense += 3; //10 + if (player.statLife <= (player.statLifeMax2 * 0.5f)) + { + player.statDefense += 5; //15 + } + } + + public override void UpdateEquip(Player player) + { + player.rangedDamage += 0.03f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/WulfrumHelm.cs b/Items/Armor/WulfrumHelm.cs index 52e3f55404..85eaaa0c05 100644 --- a/Items/Armor/WulfrumHelm.cs +++ b/Items/Armor/WulfrumHelm.cs @@ -1,60 +1,60 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class WulfrumHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Helm"); - Tooltip.SetDefault("3% increased melee damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; - item.defense = 3; //8 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("WulfrumArmor") && legs.type == mod.ItemType("WulfrumLeggings"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "+3 defense\n" + - "+5 defense when below 50% life"; - player.statDefense += 3; //11 - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.statDefense += 5; //16 - } - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.03f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class WulfrumHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Helm"); + Tooltip.SetDefault("3% increased melee damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; + item.defense = 3; //8 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("WulfrumArmor") && legs.type == mod.ItemType("WulfrumLeggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "+3 defense\n" + + "+5 defense when below 50% life"; + player.statDefense += 3; //11 + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.statDefense += 5; //16 + } + } + + public override void UpdateEquip(Player player) + { + player.meleeDamage += 0.03f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/WulfrumHelmet.cs b/Items/Armor/WulfrumHelmet.cs index cb3bacdf4d..a5fa75f77c 100644 --- a/Items/Armor/WulfrumHelmet.cs +++ b/Items/Armor/WulfrumHelmet.cs @@ -1,61 +1,61 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class WulfrumHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Helmet"); - Tooltip.SetDefault("6% increased minion damage\n" + - "+1 max minion"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("WulfrumArmor") && legs.type == mod.ItemType("WulfrumLeggings"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "+3 defense\n" + - "+5 defense when below 50% life"; - player.statDefense += 3; //8 - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.statDefense += 5; //13 - } - } - - public override void UpdateEquip(Player player) - { - player.minionDamage += 0.06f; - player.maxMinions++; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class WulfrumHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Helmet"); + Tooltip.SetDefault("6% increased minion damage\n" + + "+1 max minion"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("WulfrumArmor") && legs.type == mod.ItemType("WulfrumLeggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "+3 defense\n" + + "+5 defense when below 50% life"; + player.statDefense += 3; //8 + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.statDefense += 5; //13 + } + } + + public override void UpdateEquip(Player player) + { + player.minionDamage += 0.06f; + player.maxMinions++; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/WulfrumHood.cs b/Items/Armor/WulfrumHood.cs index d099b50575..9cd66299b7 100644 --- a/Items/Armor/WulfrumHood.cs +++ b/Items/Armor/WulfrumHood.cs @@ -1,60 +1,60 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class WulfrumHood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Hood"); - Tooltip.SetDefault("3% increased magic damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; - item.defense = 1; //6 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("WulfrumArmor") && legs.type == mod.ItemType("WulfrumLeggings"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "+3 defense\n" + - "+5 defense when below 50% life"; - player.statDefense += 3; //9 - if (player.statLife <= (player.statLifeMax2 * 0.5f)) - { - player.statDefense += 5; //14 - } - } - - public override void UpdateEquip(Player player) - { - player.magicDamage += 0.03f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class WulfrumHood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Hood"); + Tooltip.SetDefault("3% increased magic damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; + item.defense = 1; //6 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("WulfrumArmor") && legs.type == mod.ItemType("WulfrumLeggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "+3 defense\n" + + "+5 defense when below 50% life"; + player.statDefense += 3; //9 + if (player.statLife <= (player.statLifeMax2 * 0.5f)) + { + player.statDefense += 5; //14 + } + } + + public override void UpdateEquip(Player player) + { + player.magicDamage += 0.03f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/WulfrumLeggings.cs b/Items/Armor/WulfrumLeggings.cs index 23b4abf057..5118fa76b4 100644 --- a/Items/Armor/WulfrumLeggings.cs +++ b/Items/Armor/WulfrumLeggings.cs @@ -1,44 +1,44 @@ -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.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class WulfrumLeggings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Leggings"); - Tooltip.SetDefault("Movement speed increased by 5%"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 25, 0); - item.rare = 1; - item.defense = 1; - } - - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.05f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 8); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class WulfrumLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Leggings"); + Tooltip.SetDefault("Movement speed increased by 5%"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 25, 0); + item.rare = 1; + item.defense = 1; + } + + public override void UpdateEquip(Player player) + { + player.moveSpeed += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 8); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/WulfrumMask.cs b/Items/Armor/WulfrumMask.cs index 6c78277da8..950b0932b4 100644 --- a/Items/Armor/WulfrumMask.cs +++ b/Items/Armor/WulfrumMask.cs @@ -1,61 +1,61 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class WulfrumMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Mask"); - Tooltip.SetDefault("3% increased rogue damage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; - item.defense = 1; //6 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("WulfrumArmor") && legs.type == mod.ItemType("WulfrumLeggings"); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "+3 defense\n" + - "+5 defense when below 50% life"; - player.statDefense += 3; //9 - if (player.statLife <= (player.statLifeMax2 * 0.5f)) - { - player.statDefense += 5; //14 - } - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class WulfrumMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Mask"); + Tooltip.SetDefault("3% increased rogue damage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 0, 75, 0); + item.rare = 1; + item.defense = 1; //6 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("WulfrumArmor") && legs.type == mod.ItemType("WulfrumLeggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "+3 defense\n" + + "+5 defense when below 50% life"; + player.statDefense += 3; //9 + if (player.statLife <= (player.statLifeMax2 * 0.5f)) + { + player.statDefense += 5; //14 + } + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/XerocCuisses.cs b/Items/Armor/XerocCuisses.cs index d5cbd84b01..0c6500b7e2 100644 --- a/Items/Armor/XerocCuisses.cs +++ b/Items/Armor/XerocCuisses.cs @@ -1,50 +1,50 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Legs)] - public class XerocCuisses : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Cuisses"); - Tooltip.SetDefault("5% increased rogue damage and critical strike chance\n" + - "20% increased movement speed\n" + - "Speed of the cosmos"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 9; - item.defense = 24; - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - player.moveSpeed += 0.2f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar", 18); - recipe.AddIngredient(ItemID.LunarBar, 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class XerocCuisses : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Cuisses"); + Tooltip.SetDefault("5% increased rogue damage and critical strike chance\n" + + "20% increased movement speed\n" + + "Speed of the cosmos"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 9; + item.defense = 24; + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + player.moveSpeed += 0.2f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar", 18); + recipe.AddIngredient(ItemID.LunarBar, 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 567546ad03..1ceaad55d6 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.cs @@ -1,86 +1,86 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class XerocMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Mask"); - Tooltip.SetDefault("11% increased rogue damage and critical strike chance, 22% increased movement speed\n" + - "Temporary immunity to lava and immunity to cursed, fire, cursed inferno, and chilled\n" + - "Wrath of the cosmos"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 40, 0, 0); - item.rare = 9; - item.defense = 20; //71 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("XerocPlateMail") && legs.type == mod.ItemType("XerocCuisses"); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.xerocSet = true; - modPlayer.rogueStealthMax = 1.25f; - player.setBonus = "9% increased rogue damage and velocity\n" + - "All projectile types have special effects on enemy hits\n" + - "Imbued with cosmic wrath and rage when you are damaged\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 125\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.AddBuff(BuffID.Wrath, 2); - player.AddBuff(BuffID.Rage, 2); - } - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.09f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.09f; - } - - public override void UpdateEquip(Player player) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.11f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 11; - player.moveSpeed += 0.22f; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar", 12); - recipe.AddIngredient(ItemID.LunarBar, 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class XerocMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Mask"); + Tooltip.SetDefault("11% increased rogue damage and critical strike chance, 22% increased movement speed\n" + + "Temporary immunity to lava and immunity to cursed, fire, cursed inferno, and chilled\n" + + "Wrath of the cosmos"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 40, 0, 0); + item.rare = 9; + item.defense = 20; //71 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("XerocPlateMail") && legs.type == mod.ItemType("XerocCuisses"); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.xerocSet = true; + modPlayer.rogueStealthMax = 1.25f; + player.setBonus = "9% increased rogue damage and velocity\n" + + "All projectile types have special effects on enemy hits\n" + + "Imbued with cosmic wrath and rage when you are damaged\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 125\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(BuffID.Wrath, 2); + player.AddBuff(BuffID.Rage, 2); + } + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.09f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.09f; + } + + public override void UpdateEquip(Player player) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.11f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 11; + player.moveSpeed += 0.22f; + player.lavaMax += 240; + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.CursedInferno] = true; + player.buffImmune[BuffID.Cursed] = true; + player.buffImmune[BuffID.Chilled] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar", 12); + recipe.AddIngredient(ItemID.LunarBar, 8); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs index 96fd699b75..8537051210 100644 --- a/Items/Armor/XerocPlateMail.cs +++ b/Items/Armor/XerocPlateMail.cs @@ -1,52 +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.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class XerocPlateMail : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Plate Mail"); - Tooltip.SetDefault("+20 max life\n" + - "6% increased movement speed\n" + - "7% increased rogue damage and critical strike chance\n" + - "Armor of the cosmos"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 32, 0, 0); - item.rare = 9; - item.defense = 27; - } - - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 20; - player.moveSpeed += 0.06f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.07f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar", 22); - recipe.AddIngredient(ItemID.LunarBar, 16); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class XerocPlateMail : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Plate Mail"); + Tooltip.SetDefault("+20 max life\n" + + "6% increased movement speed\n" + + "7% increased rogue damage and critical strike chance\n" + + "Armor of the cosmos"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 32, 0, 0); + item.rare = 9; + item.defense = 27; + } + + public override void UpdateEquip(Player player) + { + player.statLifeMax2 += 20; + player.moveSpeed += 0.06f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.07f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar", 22); + recipe.AddIngredient(ItemID.LunarBar, 16); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/YharonMask.cs b/Items/Armor/YharonMask.cs index 72a5a4af61..5cb30de93d 100644 --- a/Items/Armor/YharonMask.cs +++ b/Items/Armor/YharonMask.cs @@ -1,27 +1,27 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class YharonMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharon Mask"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 20; - item.rare = 1; - item.vanity = true; - } - - public override bool DrawHead() - { - return false; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class YharonMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharon Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() + { + return false; + } + } +} diff --git a/Items/AshenKey.cs b/Items/AshenKey.cs index a86ffe7427..19c070e2e1 100644 --- a/Items/AshenKey.cs +++ b/Items/AshenKey.cs @@ -1,31 +1,31 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class AshenKey : ModItem - { - public override void SetStaticDefaults() - { - Tooltip.SetDefault("Used in crafting to lock/unlock ashen chests"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 99; - item.value = 100; - item.rare = 1; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldenKey); - recipe.SetResult(this, 1); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class AshenKey : ModItem + { + public override void SetStaticDefaults() + { + Tooltip.SetDefault("Used in crafting to lock/unlock ashen chests"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 99; + item.value = 100; + item.rare = 1; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldenKey); + recipe.SetResult(this, 1); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Astrageldon/AstrageldonBag.cs b/Items/Astrageldon/AstrageldonBag.cs index d1c840b6db..b9c81e00af 100644 --- a/Items/Astrageldon/AstrageldonBag.cs +++ b/Items/Astrageldon/AstrageldonBag.cs @@ -1,75 +1,75 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Astrageldon -{ - public class AstrageldonBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = 9; - bossBagNPC = mod.NPCType("Astrageldon"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("StarlightFuelCell")); - if (NPC.downedMoonlord) - { - player.QuickSpawnItem(mod.ItemType("SquishyBeanMount")); - } - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - player.QuickSpawnItem(mod.ItemType("AstralJelly"), Main.rand.Next(12, 17)); - player.QuickSpawnItem(mod.ItemType("Stardust"), Main.rand.Next(30, 41)); - player.QuickSpawnItem(ItemID.FallenStar, Main.rand.Next(30, 51)); - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.HallowedKey); - } - if (Main.rand.Next(4) == 0) - { - player.QuickSpawnItem(mod.ItemType("Nebulash")); - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("AureusMask")); - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Astrageldon +{ + public class AstrageldonBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.expert = true; + item.rare = 9; + bossBagNPC = mod.NPCType("Astrageldon"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("StarlightFuelCell")); + if (NPC.downedMoonlord) + { + player.QuickSpawnItem(mod.ItemType("SquishyBeanMount")); + } + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + player.QuickSpawnItem(mod.ItemType("AstralJelly"), Main.rand.Next(12, 17)); + player.QuickSpawnItem(mod.ItemType("Stardust"), Main.rand.Next(30, 41)); + player.QuickSpawnItem(ItemID.FallenStar, Main.rand.Next(30, 51)); + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.HallowedKey); + } + if (Main.rand.Next(4) == 0) + { + player.QuickSpawnItem(mod.ItemType("Nebulash")); + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("AureusMask")); + } + } + } +} diff --git a/Items/Astrageldon/AstralChunk.cs b/Items/Astrageldon/AstralChunk.cs index e62fc6964a..9f96a254b5 100644 --- a/Items/Astrageldon/AstralChunk.cs +++ b/Items/Astrageldon/AstralChunk.cs @@ -1,52 +1,52 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Astrageldon -{ - public class AstralChunk : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Chunk"); - Tooltip.SetDefault("Summons Astrum Aureus"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 7; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("Astrageldon")); - } - - public override bool UseItem(Player player) - { - if (Main.netMode != 1) - { - int num = NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-50, 50))), (int)(player.position.Y - 150f), mod.NPCType("Astrageldon"), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(SoundID.Roar, player.position, 0); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Stardust", 15); - recipe.AddIngredient(ItemID.FallenStar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Astrageldon +{ + public class AstralChunk : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Chunk"); + Tooltip.SetDefault("Summons Astrum Aureus"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 7; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("Astrageldon")); + } + + public override bool UseItem(Player player) + { + if (Main.netMode != 1) + { + int num = NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-50, 50))), (int)(player.position.Y - 150f), mod.NPCType("Astrageldon"), 0, 0f, 0f, 0f, 0f, 255); + Main.PlaySound(SoundID.Roar, player.position, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Stardust", 15); + recipe.AddIngredient(ItemID.FallenStar, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Astrageldon/AstralJelly.cs b/Items/Astrageldon/AstralJelly.cs index 4292dc0bfb..6e3ada3617 100644 --- a/Items/Astrageldon/AstralJelly.cs +++ b/Items/Astrageldon/AstralJelly.cs @@ -1,54 +1,54 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; - -namespace CalamityMod.Items.Astrageldon -{ - public class AstralJelly : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aureus Cell"); - Tooltip.SetDefault("Gives mana regeneration and magic power for 6 minutes\n" + - "Restores 200 mana"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.rare = 7; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = Item.buyPrice(0, 4, 50, 0); - item.buffType = BuffID.WellFed; - item.buffTime = 108000; - } - - public override void OnConsumeItem(Player player) - { - player.statMana += 200; - if (player.statMana > player.statManaMax2) - { - player.statMana = player.statManaMax2; - } - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); - if (Main.myPlayer == player.whoAmI) - { - player.ManaEffect(200); - } - player.AddBuff(BuffID.ManaRegeneration, 21600); - player.AddBuff(BuffID.MagicPower, 21600); - player.AddBuff(BuffID.WellFed, 108000); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.Astrageldon +{ + public class AstralJelly : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aureus Cell"); + Tooltip.SetDefault("Gives mana regeneration and magic power for 6 minutes\n" + + "Restores 200 mana"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.useAnimation = 17; + item.useTime = 17; + item.rare = 7; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.value = Item.buyPrice(0, 4, 50, 0); + item.buffType = BuffID.WellFed; + item.buffTime = 108000; + } + + public override void OnConsumeItem(Player player) + { + player.statMana += 200; + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); + if (Main.myPlayer == player.whoAmI) + { + player.ManaEffect(200); + } + player.AddBuff(BuffID.ManaRegeneration, 21600); + player.AddBuff(BuffID.MagicPower, 21600); + player.AddBuff(BuffID.WellFed, 108000); + } + } +} diff --git a/Items/AstralHamaxe.cs b/Items/AstralHamaxe.cs index 56e3a9d59f..74b94531d9 100644 --- a/Items/AstralHamaxe.cs +++ b/Items/AstralHamaxe.cs @@ -54,4 +54,4 @@ namespace CalamityMod.Items recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/AstralPickaxe.cs b/Items/AstralPickaxe.cs index 1d9cc3dd98..e154c8a9fb 100644 --- a/Items/AstralPickaxe.cs +++ b/Items/AstralPickaxe.cs @@ -53,4 +53,4 @@ namespace CalamityMod.Items } } } -} \ No newline at end of file +} diff --git a/Items/AstrumDeus/AstrumDeusBag.cs b/Items/AstrumDeus/AstrumDeusBag.cs index 91ea4b0f4e..eaa142534a 100644 --- a/Items/AstrumDeus/AstrumDeusBag.cs +++ b/Items/AstrumDeus/AstrumDeusBag.cs @@ -1,73 +1,73 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.AstrumDeus -{ - public class AstrumDeusBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = 9; - bossBagNPC = mod.NPCType("AstrumDeusHeadSpectral"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - 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) - { - player.QuickSpawnItem(mod.ItemType("Starfall")); - } - player.QuickSpawnItem(mod.ItemType("AstralBulwark")); - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("AstrumDeusMask")); - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.AstrumDeus +{ + public class AstrumDeusBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.expert = true; + item.rare = 9; + bossBagNPC = mod.NPCType("AstrumDeusHeadSpectral"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + 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) + { + player.QuickSpawnItem(mod.ItemType("Starfall")); + } + player.QuickSpawnItem(mod.ItemType("AstralBulwark")); + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("AstrumDeusMask")); + } + } + } +} diff --git a/Items/AstrumDeus/Starcore.cs b/Items/AstrumDeus/Starcore.cs index fa4d71e54a..57a443547a 100644 --- a/Items/AstrumDeus/Starcore.cs +++ b/Items/AstrumDeus/Starcore.cs @@ -1,55 +1,55 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.AstrumDeus -{ - public class Starcore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starcore"); - Tooltip.SetDefault("May the stars guide your way\n" + - "Summons Astrum Deus\n" + - "Not consumable"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.rare = 9; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")) && !NPC.AnyNPCs(mod.NPCType("AstrumDeusHeadSpectral")); - } - - public override bool UseItem(Player player) - { - for (int x = 0; x < 10; x++) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AstrumDeusHead")); - } - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AstrumDeusHeadSpectral")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Stardust", 25); - recipe.AddIngredient(null, "AstralJelly", 8); - recipe.AddIngredient(null, "AstralBar", 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.AstrumDeus +{ + public class Starcore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starcore"); + Tooltip.SetDefault("May the stars guide your way\n" + + "Summons Astrum Deus\n" + + "Not consumable"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.rare = 9; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")) && !NPC.AnyNPCs(mod.NPCType("AstrumDeusHeadSpectral")); + } + + public override bool UseItem(Player player) + { + for (int x = 0; x < 10; x++) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AstrumDeusHead")); + } + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("AstrumDeusHeadSpectral")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Stardust", 25); + recipe.AddIngredient(null, "AstralJelly", 8); + recipe.AddIngredient(null, "AstralBar", 4); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/BarofLife.cs b/Items/BarofLife.cs index 8a0eb877c3..aa2705f600 100644 --- a/Items/BarofLife.cs +++ b/Items/BarofLife.cs @@ -1,39 +1,39 @@ -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 -{ - public class BarofLife : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bar of Life"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 8; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar"); - recipe.AddIngredient(null, "DraedonBar"); - recipe.AddIngredient(null, "CruptixBar"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class BarofLife : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bar of Life"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 8; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar"); + recipe.AddIngredient(null, "DraedonBar"); + recipe.AddIngredient(null, "CruptixBar"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/BearEye.cs b/Items/BearEye.cs index 8a4a2924cc..13a8fb7d43 100644 --- a/Items/BearEye.cs +++ b/Items/BearEye.cs @@ -1,40 +1,40 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class BearEye : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bear's Eye"); - Tooltip.SetDefault("Summons a pet guardian angel"); - } - 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("Bear"); - item.buffType = mod.BuffType("BearBuff"); - item.rare = 5; - item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); - } - - public override void UseStyle(Player player) - { - if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - { - player.AddBuff(item.buffType, 15, true); - } - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class BearEye : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bear's Eye"); + Tooltip.SetDefault("Summons a pet guardian angel"); + } + 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("Bear"); + item.buffType = mod.BuffType("BearBuff"); + item.rare = 5; + item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 15, true); + } + } + } +} diff --git a/Items/BeastialPickaxe.cs b/Items/BeastialPickaxe.cs index b2beeeff93..21be52506a 100644 --- a/Items/BeastialPickaxe.cs +++ b/Items/BeastialPickaxe.cs @@ -1,59 +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 -{ - public class BeastialPickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beastial Pickaxe"); - } - - public override void SetDefaults() - { - item.damage = 35; - item.melee = true; - item.width = 48; - item.height = 48; - item.useTime = 7; - item.useAnimation = 15; - item.useTurn = true; - item.pick = 200; - item.useStyle = 1; - item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 61); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - } - } -} \ No newline at end of file +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 +{ + public class BeastialPickaxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beastial Pickaxe"); + } + + public override void SetDefaults() + { + item.damage = 35; + item.melee = true; + item.width = 48; + item.height = 48; + item.useTime = 7; + item.useAnimation = 15; + item.useTurn = true; + item.pick = 200; + item.useStyle = 1; + item.knockBack = 4.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 61); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + } + } +} diff --git a/Items/BeetleJuice.cs b/Items/BeetleJuice.cs index f8fbbf2085..ef9862b58a 100644 --- a/Items/BeetleJuice.cs +++ b/Items/BeetleJuice.cs @@ -1,28 +1,28 @@ -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 -{ - public class BeetleJuice : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beetle Juice"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} \ No newline at end of file +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 +{ + public class BeetleJuice : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beetle Juice"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + } +} diff --git a/Items/BerserkerWaraxe.cs b/Items/BerserkerWaraxe.cs index f4eed1481d..05b6d4ef05 100644 --- a/Items/BerserkerWaraxe.cs +++ b/Items/BerserkerWaraxe.cs @@ -1,59 +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 -{ - public class BerserkerWaraxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Berserker Waraxe"); - } - - public override void SetDefaults() - { - item.damage = 51; - item.melee = true; - item.width = 58; - item.height = 52; - item.useTime = 27; - item.useAnimation = 27; - item.useTurn = true; - item.axe = 30; - item.useStyle = 1; - item.knockBack = 8; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 61); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - } - } -} \ No newline at end of file +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 +{ + public class BerserkerWaraxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Berserker Waraxe"); + } + + public override void SetDefaults() + { + item.damage = 51; + item.melee = true; + item.width = 58; + item.height = 52; + item.useTime = 27; + item.useAnimation = 27; + item.useTurn = true; + item.axe = 30; + item.useStyle = 1; + item.knockBack = 8; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 9); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 61); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + } + } +} diff --git a/Items/BlightedLens.cs b/Items/BlightedLens.cs index 1e20680285..30007e4307 100644 --- a/Items/BlightedLens.cs +++ b/Items/BlightedLens.cs @@ -1,28 +1,28 @@ -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 -{ - public class BlightedLens : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blighted Lens"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 22; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} \ No newline at end of file +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 +{ + public class BlightedLens : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blighted Lens"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 22; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + } +} diff --git a/Items/BloodIdol.cs b/Items/BloodIdol.cs index ad32126f2e..e4fc42a9af 100644 --- a/Items/BloodIdol.cs +++ b/Items/BloodIdol.cs @@ -1,65 +1,65 @@ -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 Terraria.GameContent.Events; - -namespace CalamityMod.Items -{ - public class BloodIdol : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Relic"); - Tooltip.SetDefault("Summons a blood moon"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item66; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return !Main.bloodMoon && !Main.dayTime; - } - - public override bool UseItem(Player player) - { - Main.bloodMoon = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodlettingEssence", 2); - recipe.AddIngredient(null, "UnholyCore", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FetidEssence", 2); - recipe.AddIngredient(null, "UnholyCore", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Terraria.GameContent.Events; + +namespace CalamityMod.Items +{ + public class BloodIdol : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Relic"); + Tooltip.SetDefault("Summons a blood moon"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item66; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return !Main.bloodMoon && !Main.dayTime; + } + + public override bool UseItem(Player player) + { + Main.bloodMoon = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodlettingEssence", 2); + recipe.AddIngredient(null, "UnholyCore", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FetidEssence", 2); + recipe.AddIngredient(null, "UnholyCore", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/BloodOrange.cs b/Items/BloodOrange.cs index 2b32bc6812..eb4c547d34 100644 --- a/Items/BloodOrange.cs +++ b/Items/BloodOrange.cs @@ -1,73 +1,73 @@ -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 BloodOrange : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Orange"); - Tooltip.SetDefault("Permanently increases maximum life by 25\n" + - "Can only be used if the max amount of life fruit has been consumed"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 5; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.bOrange || player.statLifeMax < 500) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(25); - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bOrange = true; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(null, "EssenceofChaos", 5); - recipe.AddIngredient(null, "EssenceofCinder", 5); - recipe.AddIngredient(null, "EssenceofEleum", 5); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddIngredient(ItemID.SoulofLight, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 BloodOrange : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Orange"); + Tooltip.SetDefault("Permanently increases maximum life by 25\n" + + "Can only be used if the max amount of life fruit has been consumed"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 5; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.bOrange || player.statLifeMax < 500) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(25); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.bOrange = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddIngredient(null, "EssenceofChaos", 5); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddIngredient(null, "EssenceofEleum", 5); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddIngredient(ItemID.SoulofLight, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/BloodOrb.cs b/Items/BloodOrb.cs index 7c6407e85b..aa5906f167 100644 --- a/Items/BloodOrb.cs +++ b/Items/BloodOrb.cs @@ -1,35 +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 -{ - public class BloodOrb : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Orb"); - } - - public override void SetDefaults() - { - item.width = 10; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.75f * num, 0f * num, 0f * num); - } - } -} \ No newline at end of file +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 +{ + public class BloodOrb : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Orb"); + } + + public override void SetDefaults() + { + item.width = 10; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.75f * num, 0f * num, 0f * num); + } + } +} diff --git a/Items/BloodlettingEssence.cs b/Items/BloodlettingEssence.cs index 4fd720bc2f..db3d919c2b 100644 --- a/Items/BloodlettingEssence.cs +++ b/Items/BloodlettingEssence.cs @@ -1,29 +1,29 @@ -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 -{ - public class BloodlettingEssence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodletting Essence"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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 +{ + public class BloodlettingEssence : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodletting Essence"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/Bloodstone.cs b/Items/Bloodstone.cs index b3f102a48d..4a91593215 100644 --- a/Items/Bloodstone.cs +++ b/Items/Bloodstone.cs @@ -1,29 +1,29 @@ -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 -{ - public class Bloodstone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodstone"); - } - - public override void SetDefaults() - { - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - } -} \ No newline at end of file +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 +{ + public class Bloodstone : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodstone"); + } + + public override void SetDefaults() + { + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + } +} diff --git a/Items/BloodstoneCore.cs b/Items/BloodstoneCore.cs index 34c0934d9f..15d7f38a2a 100644 --- a/Items/BloodstoneCore.cs +++ b/Items/BloodstoneCore.cs @@ -1,40 +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 -{ - public class BloodstoneCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodstone Core"); - } - - public override void SetDefaults() - { - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Bloodstone", 5); - recipe.AddIngredient(null, "BloodOrb", 2); - recipe.AddIngredient(null, "Phantoplasm"); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this, 2); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class BloodstoneCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodstone Core"); + } + + public override void SetDefaults() + { + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Bloodstone", 5); + recipe.AddIngredient(null, "BloodOrb", 2); + recipe.AddIngredient(null, "Phantoplasm"); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this, 2); + recipe.AddRecipe(); + } + } +} diff --git a/Items/BlossomPickaxe.cs b/Items/BlossomPickaxe.cs index 008593de7b..26962bc8ca 100644 --- a/Items/BlossomPickaxe.cs +++ b/Items/BlossomPickaxe.cs @@ -1,57 +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 -{ - public class BlossomPickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blossom Pickaxe"); - Tooltip.SetDefault("Can mine Auric Ore"); - } - - public override void SetDefaults() - { - item.damage = 90; - item.melee = true; - item.width = 52; - item.height = 56; - item.useTime = 5; - item.useAnimation = 10; - item.useTurn = true; - item.pick = 275; - item.useStyle = 1; - item.knockBack = 6.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.tileBoost += 6; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 75); - } - } - } -} \ No newline at end of file +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 +{ + public class BlossomPickaxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blossom Pickaxe"); + Tooltip.SetDefault("Can mine Auric Ore"); + } + + public override void SetDefaults() + { + item.damage = 90; + item.melee = true; + item.width = 52; + item.height = 56; + item.useTime = 5; + item.useAnimation = 10; + item.useTurn = true; + item.pick = 275; + item.useStyle = 1; + item.knockBack = 6.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.tileBoost += 6; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 75); + } + } + } +} diff --git a/Items/BossRush.cs b/Items/BossRush.cs index 963c0cce2b..cd2570da6c 100644 --- a/Items/BossRush.cs +++ b/Items/BossRush.cs @@ -1,77 +1,77 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.Items -{ - public class BossRush : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terminus"); - Tooltip.SetDefault("A ritualistic artifact, thought to have brought upon The End many millennia ago\n" + - "Sealed away in the abyss, far from those that would seek to misuse it\n" + - "Activates Boss Rush Mode, using it again will deactivate Boss Rush Mode"); - } - - public override void SetDefaults() - { - item.rare = 1; - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item123; - item.consumable = false; - } - - public override bool UseItem(Player player) - { - for (int doom = 0; doom < 200; doom++) - { - if (Main.npc[doom].active && Main.npc[doom].boss) - { - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - if (!CalamityWorld.bossRushActive) - { - CalamityWorld.bossRushStage = 0; - CalamityWorld.bossRushActive = true; - string key = "Mods.CalamityMod.BossRushStartText"; - 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 - { - CalamityWorld.bossRushStage = 0; - 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(); - } - return true; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.Items +{ + public class BossRush : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terminus"); + Tooltip.SetDefault("A ritualistic artifact, thought to have brought upon The End many millennia ago\n" + + "Sealed away in the abyss, far from those that would seek to misuse it\n" + + "Activates Boss Rush Mode, using it again will deactivate Boss Rush Mode"); + } + + public override void SetDefaults() + { + item.rare = 1; + item.width = 28; + item.height = 28; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item123; + item.consumable = false; + } + + public override bool UseItem(Player player) + { + for (int doom = 0; doom < 200; doom++) + { + if (Main.npc[doom].active && Main.npc[doom].boss) + { + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + if (!CalamityWorld.bossRushActive) + { + CalamityWorld.bossRushStage = 0; + CalamityWorld.bossRushActive = true; + string key = "Mods.CalamityMod.BossRushStartText"; + 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 + { + CalamityWorld.bossRushStage = 0; + 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(); + } + return true; + } + } +} diff --git a/Items/Brimrose.cs b/Items/Brimrose.cs index 8533e4b77a..e120caccfa 100644 --- a/Items/Brimrose.cs +++ b/Items/Brimrose.cs @@ -1,32 +1,32 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Items -{ - class Brimrose : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimrose"); - Tooltip.SetDefault("Summons a brimrose mount"); - } - - public override void SetDefaults() - { - item.width = 64; - item.height = 64; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 1; - item.value = Item.buyPrice(1, 50, 0, 0); - item.rare = 9; - item.expert = true; - item.UseSound = SoundID.Item3; - item.noMelee = true; - item.mountType = mod.MountType("PhuppersChair"); - } - } -} +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items +{ + class Brimrose : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimrose"); + Tooltip.SetDefault("Summons a brimrose mount"); + } + + public override void SetDefaults() + { + item.width = 64; + item.height = 64; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 1; + item.value = Item.buyPrice(1, 50, 0, 0); + item.rare = 9; + item.expert = true; + item.UseSound = SoundID.Item3; + item.noMelee = true; + item.mountType = mod.MountType("PhuppersChair"); + } + } +} diff --git a/Items/BrimstoneKey.cs b/Items/BrimstoneKey.cs index 3564313920..a49310ece4 100644 --- a/Items/BrimstoneKey.cs +++ b/Items/BrimstoneKey.cs @@ -1,31 +1,31 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class BrimstoneKey : ModItem - { - public override void SetStaticDefaults() - { - Tooltip.SetDefault("Grants access to Locked Ashen Chests"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 1; - item.value = 100; - item.rare = 1; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ShadowKey); - recipe.SetResult(this, 1); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class BrimstoneKey : ModItem + { + public override void SetStaticDefaults() + { + Tooltip.SetDefault("Grants access to Locked Ashen Chests"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 1; + item.value = 100; + item.rare = 1; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ShadowKey); + recipe.SetResult(this, 1); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} diff --git a/Items/BrimstoneWaifu/Abaddon.cs b/Items/BrimstoneWaifu/Abaddon.cs index f34f02e832..0ceb8190aa 100644 --- a/Items/BrimstoneWaifu/Abaddon.cs +++ b/Items/BrimstoneWaifu/Abaddon.cs @@ -1,35 +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.BrimstoneWaifu -{ - [AutoloadEquip(EquipType.Head)] - public class Abaddon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abaddon"); - Tooltip.SetDefault("Makes you immune to Brimstone Flames"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - } - } -} \ No newline at end of file +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.BrimstoneWaifu +{ + [AutoloadEquip(EquipType.Head)] + public class Abaddon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abaddon"); + Tooltip.SetDefault("Makes you immune to Brimstone Flames"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + } + } +} diff --git a/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs b/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs index cf92930734..1fc6d1e54b 100644 --- a/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs +++ b/Items/BrimstoneWaifu/BrimstoneWaifuBag.cs @@ -1,85 +1,85 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.BrimstoneWaifu -{ - public class BrimstoneWaifuBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = 9; - bossBagNPC = mod.NPCType("BrimstoneElemental"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("CharredRelic")); - if (CalamityWorld.downedProvidence) - { - player.QuickSpawnItem(mod.ItemType("Brimrose")); - } - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("Abaddon")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Abaddon")); - player.QuickSpawnItem(mod.ItemType("Brimlance")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("Abaddon")); - player.QuickSpawnItem(mod.ItemType("SeethingDischarge")); - break; - } - if (CalamityWorld.downedProvidence) - { - player.QuickSpawnItem(mod.ItemType("Bloodstone"), Main.rand.Next(25, 36)); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(mod.ItemType("RoseStone")); - } - player.QuickSpawnItem(ItemID.SoulofFright, Main.rand.Next(25, 41)); - player.QuickSpawnItem(mod.ItemType("EssenceofChaos"), Main.rand.Next(5, 10)); - player.QuickSpawnItem(mod.ItemType("Gehenna")); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.BrimstoneWaifu +{ + public class BrimstoneWaifuBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.expert = true; + item.rare = 9; + bossBagNPC = mod.NPCType("BrimstoneElemental"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("CharredRelic")); + if (CalamityWorld.downedProvidence) + { + player.QuickSpawnItem(mod.ItemType("Brimrose")); + } + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("Abaddon")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Abaddon")); + player.QuickSpawnItem(mod.ItemType("Brimlance")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("Abaddon")); + player.QuickSpawnItem(mod.ItemType("SeethingDischarge")); + break; + } + if (CalamityWorld.downedProvidence) + { + player.QuickSpawnItem(mod.ItemType("Bloodstone"), Main.rand.Next(25, 36)); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(mod.ItemType("RoseStone")); + } + player.QuickSpawnItem(ItemID.SoulofFright, Main.rand.Next(25, 41)); + player.QuickSpawnItem(mod.ItemType("EssenceofChaos"), Main.rand.Next(5, 10)); + player.QuickSpawnItem(mod.ItemType("Gehenna")); + } + } +} diff --git a/Items/BrimstoneWaifu/CharredIdol.cs b/Items/BrimstoneWaifu/CharredIdol.cs index 88db85f8d0..3b7fabc647 100644 --- a/Items/BrimstoneWaifu/CharredIdol.cs +++ b/Items/BrimstoneWaifu/CharredIdol.cs @@ -1,51 +1,51 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.BrimstoneWaifu -{ - public class CharredIdol : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Charred Idol"); - Tooltip.SetDefault("Use in the Brimstone Crag at your own risk\n" + - "Summons the Brimstone Elemental"); - } - - 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; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - return modPlayer.ZoneCalamity && !NPC.AnyNPCs(mod.NPCType("BrimstoneElemental")); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("BrimstoneElemental")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(null, "EssenceofChaos", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.BrimstoneWaifu +{ + public class CharredIdol : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Charred Idol"); + Tooltip.SetDefault("Use in the Brimstone Crag at your own risk\n" + + "Summons the Brimstone Elemental"); + } + + 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; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + return modPlayer.ZoneCalamity && !NPC.AnyNPCs(mod.NPCType("BrimstoneElemental")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("BrimstoneElemental")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddIngredient(null, "EssenceofChaos", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/BrimstoneWaifu/Gehenna.cs b/Items/BrimstoneWaifu/Gehenna.cs index 8e7cb78f68..e045b5950b 100644 --- a/Items/BrimstoneWaifu/Gehenna.cs +++ b/Items/BrimstoneWaifu/Gehenna.cs @@ -1,70 +1,70 @@ -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.BrimstoneWaifu -{ - public class Gehenna : ModItem - { - public const int FireProjectiles = 2; - public const float FireAngleSpread = 120; - public int FireCountdown = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gehenna"); - Tooltip.SetDefault("Drops brimstone fireballs from the sky occasionally"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (FireCountdown == 0) - { - FireCountdown = 600; - } - if (FireCountdown > 0) - { - FireCountdown--; - if (FireCountdown == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int speed2 = 25; - float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; - float spawnY = -1000 + player.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = player.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; - for (int i = 0; i < FireProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("BrimstoneHellfireballFriendly2"), 54, 5f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].tileCollide = false; - Main.projectile[projectile].timeLeft = 50; - } - } - } - } - } - } -} \ No newline at end of file +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.BrimstoneWaifu +{ + public class Gehenna : ModItem + { + public const int FireProjectiles = 2; + public const float FireAngleSpread = 120; + public int FireCountdown = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gehenna"); + Tooltip.SetDefault("Drops brimstone fireballs from the sky occasionally"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (FireCountdown == 0) + { + FireCountdown = 600; + } + if (FireCountdown > 0) + { + FireCountdown--; + if (FireCountdown == 0) + { + if (player.whoAmI == Main.myPlayer) + { + int speed2 = 25; + float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; + float spawnY = -1000 + player.Center.Y; + Vector2 baseSpawn = new Vector2(spawnX, spawnY); + Vector2 baseVelocity = player.Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity = baseVelocity * speed2; + for (int i = 0; i < FireProjectiles; i++) + { + Vector2 spawn = baseSpawn; + spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("BrimstoneHellfireballFriendly2"), 54, 5f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].tileCollide = false; + Main.projectile[projectile].timeLeft = 50; + } + } + } + } + } + } +} diff --git a/Items/BrimstoneWaifu/RoseStone.cs b/Items/BrimstoneWaifu/RoseStone.cs index cc58c4a800..11a4d9c35b 100644 --- a/Items/BrimstoneWaifu/RoseStone.cs +++ b/Items/BrimstoneWaifu/RoseStone.cs @@ -1,67 +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; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.BrimstoneWaifu -{ - public class RoseStone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rose Stone"); - Tooltip.SetDefault("One of the ancient relics\n" + - "Increases max life by 20, life regen by 1, and all damage by 3%\n" + - "Summons a brimstone elemental to fight for you"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.elementalHeart) - { - return false; - } - return true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.6f, 0f, 0.25f); - player.lifeRegen += 1; - player.statLifeMax2 += 20; - player.meleeDamage += 0.03f; - player.magicDamage += 0.03f; - player.rangedDamage += 0.03f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; - player.minionDamage += 0.03f; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.brimstoneWaifu = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("BrimstoneWaifu")) == -1) - { - player.AddBuff(mod.BuffType("BrimstoneWaifu"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("BigBustyRose"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - } -} +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.BrimstoneWaifu +{ + public class RoseStone : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rose Stone"); + Tooltip.SetDefault("One of the ancient relics\n" + + "Increases max life by 20, life regen by 1, and all damage by 3%\n" + + "Summons a brimstone elemental to fight for you"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.elementalHeart) + { + return false; + } + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.6f, 0f, 0.25f); + player.lifeRegen += 1; + player.statLifeMax2 += 20; + player.meleeDamage += 0.03f; + player.magicDamage += 0.03f; + player.rangedDamage += 0.03f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; + player.minionDamage += 0.03f; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.brimstoneWaifu = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("BrimstoneWaifu")) == -1) + { + player.AddBuff(mod.BuffType("BrimstoneWaifu"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("BigBustyRose")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("BigBustyRose"), (int)(45f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + } +} diff --git a/Items/BulbofDoom.cs b/Items/BulbofDoom.cs index a050bd73e7..086f2a92ed 100644 --- a/Items/BulbofDoom.cs +++ b/Items/BulbofDoom.cs @@ -1,58 +1,58 @@ -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; - -namespace CalamityMod.Items -{ - public class BulbofDoom : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Portabulb"); - Tooltip.SetDefault("Summons Plantera"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.rare = 7; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneJungle && !NPC.AnyNPCs(NPCID.Plantera); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Plantera); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.JungleSpores, 15); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddIngredient(ItemID.SoulofLight, 10); - recipe.AddIngredient(null, "MurkyPaste", 3); - recipe.AddIngredient(null, "ManeaterBulb"); - recipe.AddIngredient(null, "TrapperBulb"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.Items +{ + public class BulbofDoom : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Portabulb"); + Tooltip.SetDefault("Summons Plantera"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.rare = 7; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneJungle && !NPC.AnyNPCs(NPCID.Plantera); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Plantera); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.JungleSpores, 15); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddIngredient(ItemID.SoulofLight, 10); + recipe.AddIngredient(null, "MurkyPaste", 3); + recipe.AddIngredient(null, "ManeaterBulb"); + recipe.AddIngredient(null, "TrapperBulb"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Bumblefuck/BirbPheromones.cs b/Items/Bumblefuck/BirbPheromones.cs index 5449089f99..1aed994771 100644 --- a/Items/Bumblefuck/BirbPheromones.cs +++ b/Items/Bumblefuck/BirbPheromones.cs @@ -1,54 +1,54 @@ -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; - -namespace CalamityMod.Items.Bumblefuck -{ - public class BirbPheromones : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Birb Pheromones"); - Tooltip.SetDefault("Attracts the bumbling birb"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 10; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Bumblefuck")); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Bumblefuck")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarBar, 3); - recipe.AddIngredient(ItemID.FragmentSolar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.Items.Bumblefuck +{ + public class BirbPheromones : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Birb Pheromones"); + Tooltip.SetDefault("Attracts the bumbling birb"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 10; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Bumblefuck")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Bumblefuck")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarBar, 3); + recipe.AddIngredient(ItemID.FragmentSolar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Bumblefuck/BumblebirbBag.cs b/Items/Bumblefuck/BumblebirbBag.cs index 0d77ad245d..f3eebfaf60 100644 --- a/Items/Bumblefuck/BumblebirbBag.cs +++ b/Items/Bumblefuck/BumblebirbBag.cs @@ -1,73 +1,73 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Bumblefuck -{ - public class BumblebirbBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = 9; - bossBagNPC = mod.NPCType("Bumblefuck"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("RedLightningContainer")); - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - if (Main.rand.Next(40) == 0) - { - player.QuickSpawnItem(mod.ItemType("Swordsplosion")); - } - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("RougeSlash")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("GildedProboscis")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("GoldenEagle")); - break; - } - player.QuickSpawnItem(mod.ItemType("EffulgentFeather"), Main.rand.Next(9, 15)); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Bumblefuck +{ + public class BumblebirbBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.expert = true; + item.rare = 9; + bossBagNPC = mod.NPCType("Bumblefuck"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("RedLightningContainer")); + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + if (Main.rand.Next(40) == 0) + { + player.QuickSpawnItem(mod.ItemType("Swordsplosion")); + } + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("RougeSlash")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("GildedProboscis")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("GoldenEagle")); + break; + } + player.QuickSpawnItem(mod.ItemType("EffulgentFeather"), Main.rand.Next(9, 15)); + } + } +} diff --git a/Items/Bumblefuck/EffulgentFeather.cs b/Items/Bumblefuck/EffulgentFeather.cs index 7d56efa5b8..d3d015c4c0 100644 --- a/Items/Bumblefuck/EffulgentFeather.cs +++ b/Items/Bumblefuck/EffulgentFeather.cs @@ -1,31 +1,31 @@ -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.Bumblefuck -{ - public class EffulgentFeather : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Effulgent Feather"); - Tooltip.SetDefault("It vibrates with fluffy golden energy"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 12)); - } - - public override void SetDefaults() - { - item.width = 24; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 6, 50, 0); - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - } -} \ No newline at end of file +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.Bumblefuck +{ + public class EffulgentFeather : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Effulgent Feather"); + Tooltip.SetDefault("It vibrates with fluffy golden energy"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 12)); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 6, 50, 0); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + } +} diff --git a/Items/Calamitas/BlightedEyeball.cs b/Items/Calamitas/BlightedEyeball.cs index 998bcd3d5a..ffd309ab11 100644 --- a/Items/Calamitas/BlightedEyeball.cs +++ b/Items/Calamitas/BlightedEyeball.cs @@ -1,52 +1,52 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Calamitas -{ - public class BlightedEyeball : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eye of Desolation"); - Tooltip.SetDefault("Tonight is going to be a horrific night...\n" + - "Summons Calamitas\n" + - "Not consumable"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.rare = 6; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("Calamitas")) && !NPC.AnyNPCs(mod.NPCType("CalamitasRun3")); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Calamitas")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddIngredient(null, "EssenceofChaos", 7); - recipe.AddIngredient(ItemID.SoulofFright, 5); - recipe.AddIngredient(null, "BlightedLens", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Calamitas +{ + public class BlightedEyeball : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of Desolation"); + Tooltip.SetDefault("Tonight is going to be a horrific night...\n" + + "Summons Calamitas\n" + + "Not consumable"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.rare = 6; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !NPC.AnyNPCs(mod.NPCType("Calamitas")) && !NPC.AnyNPCs(mod.NPCType("CalamitasRun3")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Calamitas")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddIngredient(null, "EssenceofChaos", 7); + recipe.AddIngredient(ItemID.SoulofFright, 5); + recipe.AddIngredient(null, "BlightedLens", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Calamitas/CalamitasBag.cs b/Items/Calamitas/CalamitasBag.cs index a64072c94a..ca79ddbade 100644 --- a/Items/Calamitas/CalamitasBag.cs +++ b/Items/Calamitas/CalamitasBag.cs @@ -1,84 +1,84 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Calamitas -{ - public class CalamitasBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("CalamitasRun3"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("Animosity")); - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("CalamitasInferno")); - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("CalamitasMask")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("TheEyeofCalamitas")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("BlightedEyeStaff")); - } - if (CalamityWorld.downedProvidence) - { - player.QuickSpawnItem(mod.ItemType("Bloodstone"), Main.rand.Next(35, 46)); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(mod.ItemType("ChaosStone")); - } - player.QuickSpawnItem(mod.ItemType("CalamityDust"), Main.rand.Next(14, 19)); - player.QuickSpawnItem(mod.ItemType("EssenceofChaos"), Main.rand.Next(5, 10)); - player.QuickSpawnItem(mod.ItemType("BlightedLens"), Main.rand.Next(1, 4)); - player.QuickSpawnItem(mod.ItemType("CalamityRing")); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Calamitas +{ + public class CalamitasBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("CalamitasRun3"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("Animosity")); + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("CalamitasInferno")); + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("CalamitasMask")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("TheEyeofCalamitas")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("BlightedEyeStaff")); + } + if (CalamityWorld.downedProvidence) + { + player.QuickSpawnItem(mod.ItemType("Bloodstone"), Main.rand.Next(35, 46)); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(mod.ItemType("ChaosStone")); + } + player.QuickSpawnItem(mod.ItemType("CalamityDust"), Main.rand.Next(14, 19)); + player.QuickSpawnItem(mod.ItemType("EssenceofChaos"), Main.rand.Next(5, 10)); + player.QuickSpawnItem(mod.ItemType("BlightedLens"), Main.rand.Next(1, 4)); + player.QuickSpawnItem(mod.ItemType("CalamityRing")); + } + } +} diff --git a/Items/Calamitas/CalamityDust.cs b/Items/Calamitas/CalamityDust.cs index e0cf8058ef..4c08e6bbcb 100644 --- a/Items/Calamitas/CalamityDust.cs +++ b/Items/Calamitas/CalamityDust.cs @@ -1,35 +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.Calamitas -{ - public class CalamityDust : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ashes of Calamity"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = 7; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.25f * num, 0.05f * num, 0.25f * num); - } - } -} \ No newline at end of file +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.Calamitas +{ + public class CalamityDust : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ashes of Calamity"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 4, 50, 0); + item.rare = 7; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.25f * num, 0.05f * num, 0.25f * num); + } + } +} diff --git a/Items/Calamitas/CalamityRing.cs b/Items/Calamitas/CalamityRing.cs index 68b5ef96d1..9049312428 100644 --- a/Items/Calamitas/CalamityRing.cs +++ b/Items/Calamitas/CalamityRing.cs @@ -1,78 +1,78 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Calamitas -{ - public class CalamityRing : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Void of Calamity"); - Tooltip.SetDefault("Cursed?\n15% increase to all damage\nBrimstone fire rains down while invincibility is active"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 22; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 9; - item.accessory = true; - item.expert = true; - } - - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.calamityRing) - { - return false; - } - return true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.calamityRing = true; - player.meleeDamage += 0.15f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; - player.rangedDamage += 0.15f; - player.magicDamage += 0.15f; - player.minionDamage += 0.15f; - player.endurance -= 0.3f; - if (player.whoAmI == Main.myPlayer) - { - if (player.immune) - { - if (Main.rand.Next(10) == 0) - { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("StandingFire"), 30, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - } - } - } - } - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Calamitas +{ + public class CalamityRing : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Void of Calamity"); + Tooltip.SetDefault("Cursed?\n15% increase to all damage\nBrimstone fire rains down while invincibility is active"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 22; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 9; + item.accessory = true; + item.expert = true; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.calamityRing) + { + return false; + } + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.calamityRing = true; + player.meleeDamage += 0.15f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; + player.rangedDamage += 0.15f; + player.magicDamage += 0.15f; + player.minionDamage += 0.15f; + player.endurance -= 0.3f; + if (player.whoAmI == Main.myPlayer) + { + if (player.immune) + { + if (Main.rand.Next(10) == 0) + { + for (int l = 0; l < 1; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("StandingFire"), 30, 5f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + } + } + } + } + } + } +} diff --git a/Items/Calamitas/ChaosStone.cs b/Items/Calamitas/ChaosStone.cs index a2c020252c..76770034fd 100644 --- a/Items/Calamitas/ChaosStone.cs +++ b/Items/Calamitas/ChaosStone.cs @@ -1,44 +1,44 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Calamitas -{ - public class ChaosStone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Stone"); - Tooltip.SetDefault("One of the ancient relics\n" + - "Increases max mana by 50, all damage by 3%, and reduces mana usage by 5%"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.85f, 0f, 0f); - player.statManaMax2 += 50; - player.manaCost *= 0.95f; - player.meleeDamage += 0.03f; - player.magicDamage += 0.03f; - player.rangedDamage += 0.03f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; - player.minionDamage += 0.03f; - } - } -} +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Calamitas +{ + public class ChaosStone : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Stone"); + Tooltip.SetDefault("One of the ancient relics\n" + + "Increases max mana by 50, all damage by 3%, and reduces mana usage by 5%"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.85f, 0f, 0f); + player.statManaMax2 += 50; + player.manaCost *= 0.95f; + player.meleeDamage += 0.03f; + player.magicDamage += 0.03f; + player.rangedDamage += 0.03f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; + player.minionDamage += 0.03f; + } + } +} diff --git a/Items/CalamitousEssence.cs b/Items/CalamitousEssence.cs index 2dd7ac58c7..d238eeacc8 100644 --- a/Items/CalamitousEssence.cs +++ b/Items/CalamitousEssence.cs @@ -1,38 +1,38 @@ -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.NPCs; - -namespace CalamityMod.Items -{ - public class CalamitousEssence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitous Essence"); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.1f * num, 0.1f * num, 0.1f * num); - } - - public override void SetDefaults() - { - item.width = 10; - item.height = 14; - item.maxStack = 999; - item.rare = 10; - item.value = Item.buyPrice(0, 10, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - } -} \ No newline at end of file +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.NPCs; + +namespace CalamityMod.Items +{ + public class CalamitousEssence : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitous Essence"); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.1f * num, 0.1f * num, 0.1f * num); + } + + public override void SetDefaults() + { + item.width = 10; + item.height = 14; + item.maxStack = 999; + item.rare = 10; + item.value = Item.buyPrice(0, 10, 0, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/AccretionDisk.cs b/Items/CalamityCustomThrowingDamage/AccretionDisk.cs index 77bd75f048..8a853b517b 100644 --- a/Items/CalamityCustomThrowingDamage/AccretionDisk.cs +++ b/Items/CalamityCustomThrowingDamage/AccretionDisk.cs @@ -1,55 +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 AccretionDisk : CalamityDamageItem - { +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 AccretionDisk : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Disk"); Tooltip.SetDefault("Throws a disk that has a chance to generate several disks if enemies are near it"); } - public override void SafeSetDefaults() - { - item.width = 38; - item.damage = 157; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.height = 38; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("AccretionDisk"); - item.shootSpeed = 13f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MangroveChakram"); - recipe.AddIngredient(null, "FlameScythe"); - recipe.AddIngredient(null, "SeashellBoomerang"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 38; + item.damage = 157; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 9f; + item.UseSound = SoundID.Item1; + item.height = 38; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("AccretionDisk"); + item.shootSpeed = 13f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MangroveChakram"); + recipe.AddIngredient(null, "FlameScythe"); + recipe.AddIngredient(null, "SeashellBoomerang"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs b/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs index 66d84c9ff5..2c231731c5 100644 --- a/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs +++ b/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs @@ -1,50 +1,50 @@ -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 AdamantiteThrowingAxe : CalamityDamageItem - { +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 AdamantiteThrowingAxe : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Adamantite Throwing Axe"); } - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 37; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 3.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1600; - item.rare = 4; - item.shoot = mod.ProjectileType("AdamantiteThrowingAxeProjectile"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AdamantiteBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 25); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 37; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 3.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 30; + item.maxStack = 999; + item.value = 1600; + item.rare = 4; + item.shoot = mod.ProjectileType("AdamantiteThrowingAxeProjectile"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AdamantiteBar); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 25); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs b/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs index d3ab1147e1..10994c96b5 100644 --- a/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs +++ b/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs @@ -1,51 +1,51 @@ -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 BallisticPoisonBomb : CalamityDamageItem - { +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 BallisticPoisonBomb : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ballistic Poison Bomb"); Tooltip.SetDefault("Throws a sticky bomb that explodes into spikes and poison clouds"); } - public override void SafeSetDefaults() - { - item.width = 30; - item.damage = 55; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 38; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("BallisticPoisonBomb"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "SulphurousSand", 20); - recipe.AddIngredient(null, "Tenebris", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 30; + item.damage = 55; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 38; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("BallisticPoisonBomb"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "SulphurousSand", 20); + recipe.AddIngredient(null, "Tenebris", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/BrackishFlask.cs b/Items/CalamityCustomThrowingDamage/BrackishFlask.cs index 28a76c0955..f48ac25e8a 100644 --- a/Items/CalamityCustomThrowingDamage/BrackishFlask.cs +++ b/Items/CalamityCustomThrowingDamage/BrackishFlask.cs @@ -1,50 +1,50 @@ -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 BrackishFlask : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brackish Flask"); - Tooltip.SetDefault("Explodes into poisonous seawater blasts"); - } - - public override void SafeSetDefaults() - { - item.width = 28; - item.damage = 40; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 35; - item.useStyle = 1; - item.useTime = 35; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.height = 30; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("BrackishFlask"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IOU"); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - 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 BrackishFlask : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brackish Flask"); + Tooltip.SetDefault("Explodes into poisonous seawater blasts"); + } + + public override void SafeSetDefaults() + { + item.width = 28; + item.damage = 40; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 35; + item.useStyle = 1; + item.useTime = 35; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item106; + item.autoReuse = true; + item.height = 30; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("BrackishFlask"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IOU"); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Brimblade.cs b/Items/CalamityCustomThrowingDamage/Brimblade.cs index 5032fca519..b46e26d55b 100644 --- a/Items/CalamityCustomThrowingDamage/Brimblade.cs +++ b/Items/CalamityCustomThrowingDamage/Brimblade.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.CalamityCustomThrowingDamage -{ - public class Brimblade : CalamityDamageItem - { +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 Brimblade : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Brimblade"); Tooltip.SetDefault("Throws a blade that splits on enemy hits"); } - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 32; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.height = 26; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = mod.ProjectileType("Brimblade"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 4); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 32; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.height = 26; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.shoot = mod.ProjectileType("Brimblade"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 4); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/CalamityCustomThrowingDamagePlayer.cs b/Items/CalamityCustomThrowingDamage/CalamityCustomThrowingDamagePlayer.cs index d683967c10..bb38455d19 100644 --- a/Items/CalamityCustomThrowingDamage/CalamityCustomThrowingDamagePlayer.cs +++ b/Items/CalamityCustomThrowingDamage/CalamityCustomThrowingDamagePlayer.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.CalamityCustomThrowingDamage -{ - public class CalamityCustomThrowingDamagePlayer : ModPlayer - { - public static CalamityCustomThrowingDamagePlayer ModPlayer(Player player) - { - return player.GetModPlayer(); - } - - public float throwingDamage = 1f; - public float throwingVelocity = 1f; - public int throwingCrit = 4; - public bool throwingAmmoCost66 = false; - public bool throwingAmmoCost50 = false; - - public override void ResetEffects() - { - ResetVariables(); - } - - public override void UpdateDead() - { - ResetVariables(); - } - - private void ResetVariables() - { - throwingDamage = 1f; - throwingVelocity = 1f; - throwingCrit = 4; - throwingAmmoCost66 = false; - throwingAmmoCost50 = false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public class CalamityCustomThrowingDamagePlayer : ModPlayer + { + public static CalamityCustomThrowingDamagePlayer ModPlayer(Player player) + { + return player.GetModPlayer(); + } + + public float throwingDamage = 1f; + public float throwingVelocity = 1f; + public int throwingCrit = 4; + public bool throwingAmmoCost66 = false; + public bool throwingAmmoCost50 = false; + + public override void ResetEffects() + { + ResetVariables(); + } + + public override void UpdateDead() + { + ResetVariables(); + } + + private void ResetVariables() + { + throwingDamage = 1f; + throwingVelocity = 1f; + throwingCrit = 4; + throwingAmmoCost66 = false; + throwingAmmoCost50 = false; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs b/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs index e2869599d9..589b8f7a9c 100644 --- a/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs +++ b/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ModLoader.IO; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.CalamityCustomThrowingDamage -{ - public abstract class CalamityDamageItem : ModItem - { - public virtual void SafeSetDefaults() - { - } - - public sealed override void SetDefaults() - { - SafeSetDefaults(); - item.melee = false; - item.ranged = true; - item.magic = false; - item.thrown = false; - item.summon = false; - } - - public override void GetWeaponDamage(Player player, ref int damage) - { - damage = (int)((double)item.damage * (double)(CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage + 5E-06f)); //plus one otherwise weird shit happens - } - - public override void GetWeaponCrit(Player player, ref int crit) - { - crit = (item.crit + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit); //change crit back to normal - } - - public override void GetWeaponKnockback(Player player, ref float knockback) - { - if (player.shroomiteStealth) - { - knockback /= 1f + (1f - player.stealth) * 0.5f; - } - if (player.setVortex) - { - knockback /= 1f + (1f - player.stealth) * 0.5f; - } - } - - public override void ModifyTooltips(List tooltips) - { - TooltipLine tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria"); - if (tt != null) - { - string[] splitText = tt.text.Split(' '); - string damageValue = splitText.First(); - string damageWord = splitText.Last(); - tt.text = damageValue + " rogue " + damageWord; - } - } - - public override bool ConsumeItem(Player player) - { - if (CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingAmmoCost50) - { - if (Main.rand.Next(1, 101) > 50) - return false; - } - if (CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingAmmoCost66) - { - if (Main.rand.Next(1, 101) > 66) - return false; - } - return true; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public abstract class CalamityDamageItem : ModItem + { + public virtual void SafeSetDefaults() + { + } + + public sealed override void SetDefaults() + { + SafeSetDefaults(); + item.melee = false; + item.ranged = true; + item.magic = false; + item.thrown = false; + item.summon = false; + } + + public override void GetWeaponDamage(Player player, ref int damage) + { + damage = (int)((double)item.damage * (double)(CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage + 5E-06f)); //plus one otherwise weird shit happens + } + + public override void GetWeaponCrit(Player player, ref int crit) + { + crit = (item.crit + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit); //change crit back to normal + } + + public override void GetWeaponKnockback(Player player, ref float knockback) + { + if (player.shroomiteStealth) + { + knockback /= 1f + (1f - player.stealth) * 0.5f; + } + if (player.setVortex) + { + knockback /= 1f + (1f - player.stealth) * 0.5f; + } + } + + public override void ModifyTooltips(List tooltips) + { + TooltipLine tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria"); + if (tt != null) + { + string[] splitText = tt.text.Split(' '); + string damageValue = splitText.First(); + string damageWord = splitText.Last(); + tt.text = damageValue + " rogue " + damageWord; + } + } + + public override bool ConsumeItem(Player player) + { + if (CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingAmmoCost50) + { + if (Main.rand.Next(1, 101) > 50) + return false; + } + if (CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingAmmoCost66) + { + if (Main.rand.Next(1, 101) > 66) + return false; + } + return true; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Celestus.cs b/Items/CalamityCustomThrowingDamage/Celestus.cs index 759756dec2..de7b6ae1fd 100644 --- a/Items/CalamityCustomThrowingDamage/Celestus.cs +++ b/Items/CalamityCustomThrowingDamage/Celestus.cs @@ -1,61 +1,61 @@ -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 Celestus : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestus"); - Tooltip.SetDefault("Throws a scythe that splits into multiple scythes on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 20; - item.damage = 480; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 10; - item.useStyle = 1; - item.useTime = 10; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.height = 20; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("Celestus"); - item.shootSpeed = 25f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AccretionDisk"); - recipe.AddIngredient(null, "ShatteredSun"); - recipe.AddIngredient(null, "ExecutionersBlade"); - recipe.AddIngredient(null, "Pwnagehammer"); - recipe.AddIngredient(null, "SpearofPaleolith"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "HellcasterFragment", 3); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "AuricOre", 25); - recipe.AddTile(null, "DraedonsForge"); - 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 Celestus : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestus"); + Tooltip.SetDefault("Throws a scythe that splits into multiple scythes on enemy hits"); + } + + public override void SafeSetDefaults() + { + item.width = 20; + item.damage = 480; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 10; + item.useStyle = 1; + item.useTime = 10; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.height = 20; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Celestus"); + item.shootSpeed = 25f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AccretionDisk"); + recipe.AddIngredient(null, "ShatteredSun"); + recipe.AddIngredient(null, "ExecutionersBlade"); + recipe.AddIngredient(null, "Pwnagehammer"); + recipe.AddIngredient(null, "SpearofPaleolith"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "HellcasterFragment", 3); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/CobaltKunai.cs b/Items/CalamityCustomThrowingDamage/CobaltKunai.cs index 266350f729..9e44027d5f 100644 --- a/Items/CalamityCustomThrowingDamage/CobaltKunai.cs +++ b/Items/CalamityCustomThrowingDamage/CobaltKunai.cs @@ -1,51 +1,51 @@ -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 CobaltKunai : CalamityDamageItem - { +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 CobaltKunai : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cobalt Kunai"); } - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 28; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.scale = 0.75f; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 40; - item.maxStack = 999; - item.value = 900; - item.rare = 4; - item.shoot = mod.ProjectileType("CobaltKunaiProjectile"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CobaltBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 30); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 18; + item.damage = 28; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.scale = 0.75f; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 40; + item.maxStack = 999; + item.value = 900; + item.rare = 4; + item.shoot = mod.ProjectileType("CobaltKunaiProjectile"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CobaltBar); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 30); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/CosmicKunai.cs b/Items/CalamityCustomThrowingDamage/CosmicKunai.cs index f90ef7f377..71e0707f01 100644 --- a/Items/CalamityCustomThrowingDamage/CosmicKunai.cs +++ b/Items/CalamityCustomThrowingDamage/CosmicKunai.cs @@ -1,42 +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.CalamityCustomThrowingDamage -{ - public class CosmicKunai : CalamityDamageItem - { +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 CosmicKunai : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Kunai"); Tooltip.SetDefault("Fires a stream of short-range kunai"); } - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 75; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 1; - item.useAnimation = 5; - item.useStyle = 1; - item.knockBack = 5f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.height = 48; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("CosmicKunai"); - item.shootSpeed = 28f; - item.rare = 9; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - } -} + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 75; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 1; + item.useAnimation = 5; + item.useStyle = 1; + item.knockBack = 5f; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.height = 48; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("CosmicKunai"); + item.shootSpeed = 28f; + item.rare = 9; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs b/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs index 3ca714737b..2990dbe90e 100644 --- a/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs +++ b/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs @@ -1,43 +1,43 @@ -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 CrushsawCrasher : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crushsaw Crasher"); - Tooltip.SetDefault("Throws bouncing axes"); - } - - public override void SafeSetDefaults() - { - item.width = 38; - item.damage = 65; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 22; - item.value = Item.buyPrice(0, 60, 0, 0); - 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) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } -} +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 CrushsawCrasher : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crushsaw Crasher"); + Tooltip.SetDefault("Throws bouncing axes"); + } + + public override void SafeSetDefaults() + { + item.width = 38; + item.damage = 65; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 22; + item.value = Item.buyPrice(0, 60, 0, 0); + 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) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs b/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs index 731c1de1ea..ee08c8e36c 100644 --- a/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs +++ b/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs @@ -1,50 +1,50 @@ -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 CrystalPiercer : CalamityDamageItem - { +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 CrystalPiercer : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal Piercer"); } - public override void SafeSetDefaults() - { - item.width = 62; - item.damage = 43; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.maxStack = 999; - item.value = 2500; - item.rare = 5; - item.shoot = mod.ProjectileType("CrystalPiercerProjectile"); - item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 20); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 62; + item.damage = 43; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; + item.maxStack = 999; + item.value = 2500; + item.rare = 5; + item.shoot = mod.ProjectileType("CrystalPiercerProjectile"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 20); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Crystalline.cs b/Items/CalamityCustomThrowingDamage/Crystalline.cs index d73ce5400a..ad9f721625 100644 --- a/Items/CalamityCustomThrowingDamage/Crystalline.cs +++ b/Items/CalamityCustomThrowingDamage/Crystalline.cs @@ -1,52 +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 -{ - public class Crystalline : CalamityDamageItem - { +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 Crystalline : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Crystalline"); Tooltip.SetDefault("Splits into several projectiles as it travels"); } - public override void SafeSetDefaults() - { - item.width = 44; - item.damage = 18; - item.crit += 4; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.knockBack = 3f; - 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("Crystalline"); - item.shootSpeed = 10f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumKnife", 50); - recipe.AddIngredient(ItemID.Diamond, 3); - recipe.AddIngredient(ItemID.FallenStar, 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 44; + item.damage = 18; + item.crit += 4; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 3f; + 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("Crystalline"); + item.shootSpeed = 10f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumKnife", 50); + recipe.AddIngredient(ItemID.Diamond, 3); + recipe.AddIngredient(ItemID.FallenStar, 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/CursedDagger.cs b/Items/CalamityCustomThrowingDamage/CursedDagger.cs index d3eb9e1e5b..227ce73606 100644 --- a/Items/CalamityCustomThrowingDamage/CursedDagger.cs +++ b/Items/CalamityCustomThrowingDamage/CursedDagger.cs @@ -1,40 +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 -{ - public class CursedDagger : CalamityDamageItem - { +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 CursedDagger : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cursed Dagger"); Tooltip.SetDefault("Throws bouncing daggers"); } - public override void SafeSetDefaults() - { - item.width = 34; - item.damage = 34; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 16; - item.useStyle = 1; - item.useTime = 16; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 34; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("CursedDagger"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - } -} + public override void SafeSetDefaults() + { + item.width = 34; + item.damage = 34; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 16; + item.useStyle = 1; + item.useTime = 16; + item.knockBack = 4.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 34; + item.value = Item.buyPrice(0, 36, 0, 0); + 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 d3e292fd96..8b49910d63 100644 --- a/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs +++ b/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs @@ -1,51 +1,51 @@ -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 DuststormInABottle : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Duststorm in a Bottle"); - Tooltip.SetDefault("Explodes into a dust cloud"); - } - - public override void SafeSetDefaults() - { - item.width = 20; - item.damage = 47; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.knockBack = 5f; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.height = 24; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("DuststormInABottle"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HolyWater, 20); - recipe.AddIngredient(null, "GrandScale"); - recipe.AddIngredient(ItemID.SandstorminaBottle); - recipe.AddTile(TileID.MythrilAnvil); - 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 DuststormInABottle : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Duststorm in a Bottle"); + Tooltip.SetDefault("Explodes into a dust cloud"); + } + + public override void SafeSetDefaults() + { + item.width = 20; + item.damage = 47; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.knockBack = 5f; + item.UseSound = SoundID.Item106; + item.autoReuse = true; + item.height = 24; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("DuststormInABottle"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HolyWater, 20); + recipe.AddIngredient(null, "GrandScale"); + recipe.AddIngredient(ItemID.SandstorminaBottle); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs b/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs index fd2f7e19a9..df73b0de30 100644 --- a/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs +++ b/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs @@ -1,114 +1,114 @@ -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 EmpyreanKnivesThrown : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Empyrean Knives"); - Tooltip.SetDefault("Throws a flurry of bouncing knives that can heal the user"); - } - - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 650; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 3f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("EmpyreanKnives"); - item.shootSpeed = 15f; - item.GetGlobalItem(mod).rogue = true; - 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); - 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 *= num80; - num79 *= num80; - int num146 = 4; - if (Main.rand.Next(2) == 0) - { - num146++; - } - if (Main.rand.Next(4) == 0) - { - num146++; - } - if (Main.rand.Next(8) == 0) - { - num146++; - } - if (Main.rand.Next(16) == 0) - { - num146++; - } - for (int num147 = 0; num147 < num146; num147++) - { - float num148 = num78; - float num149 = num79; - float num150 = 0.05f * (float)num147; - num148 += (float)Main.rand.Next(-25, 26) * num150; - num149 += (float)Main.rand.Next(-25, 26) * num150; - num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); - num80 = num72 / num80; - num148 *= num80; - num149 *= num80; - float x4 = vector2.X; - float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 1f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.VampireKnives); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddIngredient(null, "TheEmpyrean"); - recipe.AddTile(null, "DraedonsForge"); - 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 EmpyreanKnivesThrown : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Empyrean Knives"); + Tooltip.SetDefault("Throws a flurry of bouncing knives that can heal the user"); + } + + public override void SafeSetDefaults() + { + item.width = 18; + item.damage = 650; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 3f; + item.UseSound = SoundID.Item39; + item.autoReuse = true; + item.height = 20; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EmpyreanKnives"); + item.shootSpeed = 15f; + item.GetGlobalItem(mod).rogue = true; + 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); + 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 *= num80; + num79 *= num80; + int num146 = 4; + if (Main.rand.Next(2) == 0) + { + num146++; + } + if (Main.rand.Next(4) == 0) + { + num146++; + } + if (Main.rand.Next(8) == 0) + { + num146++; + } + if (Main.rand.Next(16) == 0) + { + num146++; + } + for (int num147 = 0; num147 < num146; num147++) + { + float num148 = num78; + float num149 = num79; + float num150 = 0.05f * (float)num147; + num148 += (float)Main.rand.Next(-25, 26) * num150; + num149 += (float)Main.rand.Next(-25, 26) * num150; + num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); + num80 = num72 / num80; + num148 *= num80; + num149 *= num80; + float x4 = vector2.X; + float y4 = vector2.Y; + Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 1f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.VampireKnives); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddIngredient(null, "TheEmpyrean"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Eradicator.cs b/Items/CalamityCustomThrowingDamage/Eradicator.cs index 35bf8cb49c..d698117ba0 100644 --- a/Items/CalamityCustomThrowingDamage/Eradicator.cs +++ b/Items/CalamityCustomThrowingDamage/Eradicator.cs @@ -1,48 +1,48 @@ -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.CalamityCustomThrowingDamage -{ - public class Eradicator : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); - } - - public override void SafeSetDefaults() - { - item.width = 38; - item.damage = 300; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.height = 54; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("EradicatorProjectile"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(mod.GetTexture("Items/CalamityCustomThrowingDamage/EradicatorGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - } -} +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.CalamityCustomThrowingDamage +{ + public class Eradicator : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); + } + + public override void SafeSetDefaults() + { + item.width = 38; + item.damage = 300; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.height = 54; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EradicatorProjectile"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(31f, 29f); + spriteBatch.Draw(mod.GetTexture("Items/CalamityCustomThrowingDamage/EradicatorGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs b/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs index 66a148ed8e..28adf358a4 100644 --- a/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs +++ b/Items/CalamityCustomThrowingDamage/ExecutionersBlade.cs @@ -1,50 +1,50 @@ -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 ExecutionersBlade : CalamityDamageItem - { +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 ExecutionersBlade : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Executioner's Blade"); Tooltip.SetDefault("Throws a stream of homing blades"); } - public override void SafeSetDefaults() - { - item.width = 50; - item.damage = 550; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 3; - item.useAnimation = 9; - item.useStyle = 1; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("ExecutionersBlade"); - item.shootSpeed = 26f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 11); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 50; + item.damage = 550; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 3; + item.useAnimation = 9; + item.useStyle = 1; + item.knockBack = 6.75f; + item.UseSound = SoundID.Item73; + item.autoReuse = true; + item.height = 50; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("ExecutionersBlade"); + item.shootSpeed = 26f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 11); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/FeatherKnife.cs b/Items/CalamityCustomThrowingDamage/FeatherKnife.cs index c145f715af..54b91c12a9 100644 --- a/Items/CalamityCustomThrowingDamage/FeatherKnife.cs +++ b/Items/CalamityCustomThrowingDamage/FeatherKnife.cs @@ -1,50 +1,50 @@ -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 FeatherKnife : CalamityDamageItem - { +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 FeatherKnife : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Feather Knife"); } - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 20; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 2f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 32; - item.maxStack = 999; - item.value = 300; - item.rare = 3; - item.shoot = mod.ProjectileType("FeatherKnifeProjectile"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar"); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this, 30); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 18; + item.damage = 20; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 13; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 2f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 32; + item.maxStack = 999; + item.value = 300; + item.rare = 3; + item.shoot = mod.ProjectileType("FeatherKnifeProjectile"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar"); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this, 30); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/FlameScythe.cs b/Items/CalamityCustomThrowingDamage/FlameScythe.cs index e1d4d67ead..3382058195 100644 --- a/Items/CalamityCustomThrowingDamage/FlameScythe.cs +++ b/Items/CalamityCustomThrowingDamage/FlameScythe.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.CalamityCustomThrowingDamage -{ - public class FlameScythe : CalamityDamageItem - { +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 FlameScythe : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Flame Scythe"); Tooltip.SetDefault("Throws a scythe that explodes on enemy hits"); } - public override void SafeSetDefaults() - { - item.width = 50; - item.damage = 145; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.height = 48; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("FlameScytheProjectile"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 50; + item.damage = 145; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.height = 48; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("FlameScytheProjectile"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 9); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/FrostyFlare.cs b/Items/CalamityCustomThrowingDamage/FrostyFlare.cs index a4e5fe41b5..101d90cf10 100644 --- a/Items/CalamityCustomThrowingDamage/FrostyFlare.cs +++ b/Items/CalamityCustomThrowingDamage/FrostyFlare.cs @@ -1,42 +1,42 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.CalamityCustomThrowingDamage -{ - public class FrostyFlare : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frosty Flare"); - Tooltip.SetDefault("Sticks to enemies\n" + - "Generates a localized hailstorm\n'Do not insert in flare gun'"); - } - - public override void SafeSetDefaults() - { - item.damage = 32; - item.noUseGraphic = true; - item.noMelee = true; - item.width = 10; - item.height = 22; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = 1; - item.useTurn = false; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 0, 5, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("FrostyFlare"); - item.shootSpeed = 22f; - item.maxStack = 999; - item.consumable = true; - item.GetGlobalItem(mod).rogue = true; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public class FrostyFlare : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frosty Flare"); + Tooltip.SetDefault("Sticks to enemies\n" + + "Generates a localized hailstorm\n'Do not insert in flare gun'"); + } + + public override void SafeSetDefaults() + { + item.damage = 32; + item.noUseGraphic = true; + item.noMelee = true; + item.width = 10; + item.height = 22; + item.useTime = 16; + item.useAnimation = 16; + item.useStyle = 1; + item.useTurn = false; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 0, 5, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("FrostyFlare"); + 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 d5161ead36..3416c165b7 100644 --- a/Items/CalamityCustomThrowingDamage/GelDart.cs +++ b/Items/CalamityCustomThrowingDamage/GelDart.cs @@ -1,51 +1,51 @@ -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 GelDart : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gel Dart"); - Tooltip.SetDefault("Throws bouncing darts"); - } - - public override void SafeSetDefaults() - { - item.width = 14; - item.damage = 25; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 11; - item.useStyle = 1; - item.useTime = 11; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 28; - item.maxStack = 999; - item.value = 1000; - item.rare = 4; - item.shoot = mod.ProjectileType("GelDartProjectile"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 150); - 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 GelDart : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gel Dart"); + Tooltip.SetDefault("Throws bouncing darts"); + } + + public override void SafeSetDefaults() + { + item.width = 14; + item.damage = 25; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 11; + item.useStyle = 1; + item.useTime = 11; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 28; + item.maxStack = 999; + item.value = 1000; + item.rare = 4; + item.shoot = mod.ProjectileType("GelDartProjectile"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs b/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs index 932b9ea767..ded89a82cf 100644 --- a/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs +++ b/Items/CalamityCustomThrowingDamage/GhoulishGouger.cs @@ -1,40 +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 -{ - public class GhoulishGouger : CalamityDamageItem - { +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 +{ + public class GhoulishGouger : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ghoulish Gouger"); Tooltip.SetDefault("Throws a ghoulish scythe that ignores immunity frames"); } - public override void SafeSetDefaults() - { - item.width = 68; - item.damage = 160; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useTime = 12; - item.useStyle = 1; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("GhoulishGouger"); - item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - } -} + public override void SafeSetDefaults() + { + item.width = 68; + item.damage = 160; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useTime = 12; + item.useStyle = 1; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("GhoulishGouger"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs b/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs index ceba1b6522..d4a40e3960 100644 --- a/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs +++ b/Items/CalamityCustomThrowingDamage/HeavenfallenStardisk.cs @@ -1,48 +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 -{ - public class HeavenfallenStardisk : CalamityDamageItem - { +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 HeavenfallenStardisk : CalamityDamageItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Heavenfallen Stardisk"); - Tooltip.SetDefault("Throws a stardisk upwards which then launches itself towards your mouse cursor,\n" + + DisplayName.SetDefault("Heavenfallen Stardisk"); + Tooltip.SetDefault("Throws a stardisk upwards which then launches itself towards your mouse cursor,\n" + "explodes into several astral energy bolts if the thrower is moving vertically when throwing it and during its impact"); } - public override void SafeSetDefaults() - { - item.width = 38; - item.height = 34; - item.damage = 150; - item.crit += 20; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 23; - item.useStyle = 1; - item.useTime = 23; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("HeavenfallenStardisk"); - item.shootSpeed = 10f; - 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) - { - Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} + public override void SafeSetDefaults() + { + item.width = 38; + item.height = 34; + item.damage = 150; + item.crit += 20; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 23; + item.useStyle = 1; + item.useTime = 23; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("HeavenfallenStardisk"); + item.shootSpeed = 10f; + 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) + { + Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/IceStar.cs b/Items/CalamityCustomThrowingDamage/IceStar.cs index 4a06de8181..cf8cc4f86b 100644 --- a/Items/CalamityCustomThrowingDamage/IceStar.cs +++ b/Items/CalamityCustomThrowingDamage/IceStar.cs @@ -1,53 +1,53 @@ -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 IceStar : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Star"); - Tooltip.SetDefault("Throws homing ice stars\n" + - "Ice Stars are too brittle to be recovered after being thrown"); - } - - public override void SafeSetDefaults() - { - item.width = 62; - item.damage = 35; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.crit = 7; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.maxStack = 999; - item.value = 3000; - item.rare = 5; - item.shoot = mod.ProjectileType("IceStarProjectile"); - item.shootSpeed = 14f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar"); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this, 50); - 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 IceStar : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Star"); + Tooltip.SetDefault("Throws homing ice stars\n" + + "Ice Stars are too brittle to be recovered after being thrown"); + } + + public override void SafeSetDefaults() + { + item.width = 62; + item.damage = 35; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.crit = 7; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; + item.maxStack = 999; + item.value = 3000; + item.rare = 5; + item.shoot = mod.ProjectileType("IceStarProjectile"); + item.shootSpeed = 14f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar"); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(this, 50); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/IchorSpear.cs b/Items/CalamityCustomThrowingDamage/IchorSpear.cs index 9ebe90d2d4..de3252cf8f 100644 --- a/Items/CalamityCustomThrowingDamage/IchorSpear.cs +++ b/Items/CalamityCustomThrowingDamage/IchorSpear.cs @@ -1,39 +1,39 @@ -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 IchorSpear : CalamityDamageItem - { +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 IchorSpear : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ichor Spear"); } - public override void SafeSetDefaults() - { - item.width = 52; - item.damage = 40; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 6f; - 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; - } - } -} + public override void SafeSetDefaults() + { + item.width = 52; + item.damage = 40; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 6f; + 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; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Lionfish.cs b/Items/CalamityCustomThrowingDamage/Lionfish.cs index 7a0a96835b..69e61e4818 100644 --- a/Items/CalamityCustomThrowingDamage/Lionfish.cs +++ b/Items/CalamityCustomThrowingDamage/Lionfish.cs @@ -1,40 +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 -{ - public class Lionfish : CalamityDamageItem - { +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 Lionfish : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Lionfish"); Tooltip.SetDefault("Sticks to enemies and injects a potent toxin"); } - public override void SafeSetDefaults() - { - item.width = 40; - item.damage = 54; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 40; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.shoot = mod.ProjectileType("Lionfish"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - } -} + public override void SafeSetDefaults() + { + item.width = 40; + item.damage = 54; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 40; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.shoot = mod.ProjectileType("Lionfish"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Malachite.cs b/Items/CalamityCustomThrowingDamage/Malachite.cs index acab340202..7bbbe57ed9 100644 --- a/Items/CalamityCustomThrowingDamage/Malachite.cs +++ b/Items/CalamityCustomThrowingDamage/Malachite.cs @@ -1,79 +1,79 @@ -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 Malachite : CalamityDamageItem - { +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 Malachite : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Malachite"); - Tooltip.SetDefault("Legendary Drop\n" + + Tooltip.SetDefault("Legendary Drop\n" + "Throws a stream of kunai that stick to enemies and explode\n" + - "Right click to throw a single kunai that pierces, after piercing an enemy it emits a massive explosion on the next enemy hit\n" + + "Right click to throw a single kunai that pierces, after piercing an enemy it emits a massive explosion on the next enemy hit\n" + "Revengeance drop"); } - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 62; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 1; - item.knockBack = 1.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 58; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("Malachite"); - item.shootSpeed = 10f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 17; - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 10; - item.useAnimation = 10; - item.UseSound = SoundID.Item109; - } - else - { - item.useTime = 5; - item.useAnimation = 5; - item.UseSound = SoundID.Item1; - } - 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("MalachiteBolt"), (int)((double)damage * 1.75), knockBack, player.whoAmI, 0f, 0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Malachite"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } -} + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 62; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 1; + item.knockBack = 1.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 58; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("Malachite"); + item.shootSpeed = 10f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 17; + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 10; + item.useAnimation = 10; + item.UseSound = SoundID.Item109; + } + else + { + item.useTime = 5; + item.useAnimation = 5; + item.UseSound = SoundID.Item1; + } + 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("MalachiteBolt"), (int)((double)damage * 1.75), knockBack, player.whoAmI, 0f, 0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Malachite"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/MangroveChakram.cs b/Items/CalamityCustomThrowingDamage/MangroveChakram.cs index ea51cfa9f9..f85c08e805 100644 --- a/Items/CalamityCustomThrowingDamage/MangroveChakram.cs +++ b/Items/CalamityCustomThrowingDamage/MangroveChakram.cs @@ -1,47 +1,47 @@ -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 MangroveChakram : CalamityDamageItem - { +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 MangroveChakram : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mangrove Chakram"); } - public override void SafeSetDefaults() - { - item.width = 38; - item.damage = 84; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.height = 38; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("MangroveChakramProjectile"); - item.shootSpeed = 15.5f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 38; + item.damage = 84; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.height = 38; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("MangroveChakramProjectile"); + item.shootSpeed = 15.5f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs b/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs index 4dad92791e..e577072168 100644 --- a/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs +++ b/Items/CalamityCustomThrowingDamage/MoltenAmputator.cs @@ -1,41 +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.CalamityCustomThrowingDamage -{ - public class MoltenAmputator : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Molten Amputator"); - Tooltip.SetDefault("Throws a scythe that emits molten globs on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 60; - item.damage = 250; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.height = 60; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("MoltenAmputator"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - } -} +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 MoltenAmputator : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Molten Amputator"); + Tooltip.SetDefault("Throws a scythe that emits molten globs on enemy hits"); + } + + public override void SafeSetDefaults() + { + item.width = 60; + item.damage = 250; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 9f; + item.UseSound = SoundID.Item1; + item.height = 60; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("MoltenAmputator"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Mycoroot.cs b/Items/CalamityCustomThrowingDamage/Mycoroot.cs index 1be358bbdb..ed1859d310 100644 --- a/Items/CalamityCustomThrowingDamage/Mycoroot.cs +++ b/Items/CalamityCustomThrowingDamage/Mycoroot.cs @@ -1,48 +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 -{ - public class Mycoroot : CalamityDamageItem - { +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 Mycoroot : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mycoroot"); Tooltip.SetDefault("Fires a stream of short-range fungal roots"); } - - public override void SafeSetDefaults() - { - item.width = 32; - item.damage = 10; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = 1; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 32; - item.rare = 2; - 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) - { - 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); - return false; - } - } -} + + public override void SafeSetDefaults() + { + item.width = 32; + item.damage = 10; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 5; + item.useAnimation = 5; + item.useStyle = 1; + item.knockBack = 1.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 32; + item.rare = 2; + 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) + { + 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); + return false; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/MythrilKnife.cs b/Items/CalamityCustomThrowingDamage/MythrilKnife.cs index 7e01ee8ed0..a55ffec660 100644 --- a/Items/CalamityCustomThrowingDamage/MythrilKnife.cs +++ b/Items/CalamityCustomThrowingDamage/MythrilKnife.cs @@ -1,50 +1,50 @@ -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 MythrilKnife : CalamityDamageItem - { +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 MythrilKnife : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mythril Knife"); } - public override void SafeSetDefaults() - { - item.width = 12; - item.damage = 32; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 10; - item.useStyle = 1; - item.useTime = 10; - item.knockBack = 1.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1100; - item.rare = 4; - item.shoot = mod.ProjectileType("MythrilKnifeProjectile"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MythrilBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 40); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 12; + item.damage = 32; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 10; + item.useStyle = 1; + item.useTime = 10; + item.knockBack = 1.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 30; + item.maxStack = 999; + item.value = 1100; + item.rare = 4; + item.shoot = mod.ProjectileType("MythrilKnifeProjectile"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MythrilBar); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 40); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs b/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs index 19e8cf48ee..0cf506a26a 100644 --- a/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs +++ b/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs @@ -1,51 +1,51 @@ -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 OrichalcumSpikedGemstone : CalamityDamageItem - { +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 OrichalcumSpikedGemstone : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Orichalcum Spiked Gemstone"); } - public override void SafeSetDefaults() - { - item.width = 14; - item.damage = 25; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 2f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 24; - item.shoot = 330; - item.maxStack = 999; - item.value = 1200; - item.rare = 4; - item.shoot = mod.ProjectileType("OrichalcumSpikedGemstoneProjectile"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.OrichalcumBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 50); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 14; + item.damage = 25; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 13; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 2f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 24; + item.shoot = 330; + item.maxStack = 999; + item.value = 1200; + item.rare = 4; + item.shoot = mod.ProjectileType("OrichalcumSpikedGemstoneProjectile"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.OrichalcumBar); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 50); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs b/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs index a65f21183d..7e9683b2db 100644 --- a/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs +++ b/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs @@ -1,51 +1,51 @@ -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 PalladiumJavelin : CalamityDamageItem - { +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 PalladiumJavelin : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Palladium Javelin"); } - public override void SafeSetDefaults() - { - item.width = 44; - item.damage = 41; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.shoot = 330; - item.maxStack = 999; - item.value = 1200; - item.rare = 4; - item.shoot = mod.ProjectileType("PalladiumJavelinProjectile"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PalladiumBar); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 20); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 44; + item.damage = 41; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; + item.shoot = 330; + item.maxStack = 999; + item.value = 1200; + item.rare = 4; + item.shoot = mod.ProjectileType("PalladiumJavelinProjectile"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PalladiumBar); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 20); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Prismalline.cs b/Items/CalamityCustomThrowingDamage/Prismalline.cs index 09bc67d704..3506b0c997 100644 --- a/Items/CalamityCustomThrowingDamage/Prismalline.cs +++ b/Items/CalamityCustomThrowingDamage/Prismalline.cs @@ -1,52 +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 -{ - public class Prismalline : CalamityDamageItem - { +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 Prismalline : CalamityDamageItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Prismalline"); + DisplayName.SetDefault("Prismalline"); Tooltip.SetDefault("Throws daggers that split after a while"); } - public override void SafeSetDefaults() - { - item.width = 46; - item.damage = 22; - item.crit += 4; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 46; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("Prismalline"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Crystalline"); - recipe.AddIngredient(null, "EssenceofEleum", 5); - recipe.AddIngredient(null, "SeaPrism", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 46; + item.damage = 22; + item.crit += 4; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 46; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("Prismalline"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Crystalline"); + recipe.AddIngredient(null, "EssenceofEleum", 5); + recipe.AddIngredient(null, "SeaPrism", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs b/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs index 9a3994df93..9c314fe7de 100644 --- a/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs +++ b/Items/CalamityCustomThrowingDamage/ProfanedTrident.cs @@ -1,41 +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.CalamityCustomThrowingDamage -{ - public class ProfanedTrident : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernal Spear"); - Tooltip.SetDefault("Throws a homing spear that explodes on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 72; - item.damage = 1500; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("ProfanedTrident"); - item.shootSpeed = 28f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - } -} +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 ProfanedTrident : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernal Spear"); + Tooltip.SetDefault("Throws a homing spear that explodes on enemy hits"); + } + + public override void SafeSetDefaults() + { + item.width = 72; + item.damage = 1500; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 13; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 72; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("ProfanedTrident"); + item.shootSpeed = 28f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs b/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs index 52f206713b..153ace28d5 100644 --- a/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs +++ b/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs @@ -1,53 +1,53 @@ -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 Pwnagehammer : CalamityDamageItem - { +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 Pwnagehammer : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Pwnagehammer"); Tooltip.SetDefault("Throws an extremely fast hammer"); } - public override void SafeSetDefaults() - { - item.width = 68; - item.damage = 90; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 10f; - item.UseSound = SoundID.Item1; - item.height = 68; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = mod.ProjectileType("Pwnagehammer"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pwnhammer); - recipe.AddIngredient(ItemID.HallowedBar, 7); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 68; + item.damage = 90; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 10f; + item.UseSound = SoundID.Item1; + item.height = 68; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.shoot = mod.ProjectileType("Pwnagehammer"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Pwnhammer); + recipe.AddIngredient(ItemID.HallowedBar, 7); + recipe.AddIngredient(ItemID.SoulofMight, 3); + recipe.AddIngredient(ItemID.SoulofSight, 3); + recipe.AddIngredient(ItemID.SoulofFright, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/RadiantStar.cs b/Items/CalamityCustomThrowingDamage/RadiantStar.cs index 7d7894e683..2af5c363d3 100644 --- a/Items/CalamityCustomThrowingDamage/RadiantStar.cs +++ b/Items/CalamityCustomThrowingDamage/RadiantStar.cs @@ -1,53 +1,53 @@ -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 RadiantStar : CalamityDamageItem - { +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 RadiantStar : CalamityDamageItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Radiant Star"); + DisplayName.SetDefault("Radiant Star"); Tooltip.SetDefault("Throws daggers that explode and split after a while"); } - public override void SafeSetDefaults() - { - item.width = 52; - item.damage = 50; //33 - item.crit += 8; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.shoot = mod.ProjectileType("RadiantStar"); - item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Prismalline"); - recipe.AddIngredient(null, "AstralBar", 10); - recipe.AddIngredient(null, "Stardust", 15); - recipe.AddIngredient(ItemID.FallenStar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 52; + item.damage = 50; //33 + item.crit += 8; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 48; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.shoot = mod.ProjectileType("RadiantStar"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Prismalline"); + recipe.AddIngredient(null, "AstralBar", 10); + recipe.AddIngredient(null, "Stardust", 15); + recipe.AddIngredient(ItemID.FallenStar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/RotBall.cs b/Items/CalamityCustomThrowingDamage/RotBall.cs index 7eb9aada0c..3d77643f0d 100644 --- a/Items/CalamityCustomThrowingDamage/RotBall.cs +++ b/Items/CalamityCustomThrowingDamage/RotBall.cs @@ -1,53 +1,53 @@ -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 RotBall : CalamityDamageItem - { +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 RotBall : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Rot Ball"); - } - - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 20; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.crit = 8; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 26; - item.maxStack = 999; - item.value = 1000; - item.rare = 3; - item.shoot = mod.ProjectileType("RotBallProjectile"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueShadowScale"); - recipe.AddIngredient(ItemID.RottenChunk); - recipe.AddIngredient(ItemID.DemoniteBar); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } -} + } + + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 20; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 13; + item.crit = 8; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 26; + item.maxStack = 999; + item.value = 1000; + item.rare = 3; + item.shoot = mod.ProjectileType("RotBallProjectile"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueShadowScale"); + recipe.AddIngredient(ItemID.RottenChunk); + recipe.AddIngredient(ItemID.DemoniteBar); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/RoyalKnives.cs b/Items/CalamityCustomThrowingDamage/RoyalKnives.cs index 3dc87fd0c8..87acf9c077 100644 --- a/Items/CalamityCustomThrowingDamage/RoyalKnives.cs +++ b/Items/CalamityCustomThrowingDamage/RoyalKnives.cs @@ -1,113 +1,113 @@ -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 RoyalKnives : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Illustrious Knives"); - Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user"); - } - - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 1600; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 3f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("RoyalKnife"); - item.shootSpeed = 9f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - 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 *= num80; - num79 *= num80; - int num146 = 4; - if (Main.rand.Next(2) == 0) - { - num146++; - } - if (Main.rand.Next(4) == 0) - { - num146++; - } - if (Main.rand.Next(8) == 0) - { - num146++; - } - if (Main.rand.Next(16) == 0) - { - num146++; - } - for (int num147 = 0; num147 < num146; num147++) - { - float num148 = num78; - float num149 = num79; - float num150 = 0.05f * (float)num147; - num148 += (float)Main.rand.Next(-35, 36) * num150; - num149 += (float)Main.rand.Next(-35, 36) * num150; - num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); - num80 = num72 / num80; - num148 *= num80; - num149 *= num80; - float x4 = vector2.X; - float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, mod.ProjectileType("RoyalKnife"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(null, "CoreofCalamity", 3); - recipe.AddIngredient(null, "EmpyreanKnivesThrown"); - recipe.AddTile(null, "DraedonsForge"); - 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 RoyalKnives : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Illustrious Knives"); + Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user"); + } + + public override void SafeSetDefaults() + { + item.width = 18; + item.damage = 1600; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 3f; + item.UseSound = SoundID.Item39; + item.autoReuse = true; + item.height = 20; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("RoyalKnife"); + item.shootSpeed = 9f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + 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 *= num80; + num79 *= num80; + int num146 = 4; + if (Main.rand.Next(2) == 0) + { + num146++; + } + if (Main.rand.Next(4) == 0) + { + num146++; + } + if (Main.rand.Next(8) == 0) + { + num146++; + } + if (Main.rand.Next(16) == 0) + { + num146++; + } + for (int num147 = 0; num147 < num146; num147++) + { + float num148 = num78; + float num149 = num79; + float num150 = 0.05f * (float)num147; + num148 += (float)Main.rand.Next(-35, 36) * num150; + num149 += (float)Main.rand.Next(-35, 36) * num150; + num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); + num80 = num72 / num80; + num148 *= num80; + num149 *= num80; + float x4 = vector2.X; + float y4 = vector2.Y; + Projectile.NewProjectile(x4, y4, num148, num149, mod.ProjectileType("RoyalKnife"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(null, "CoreofCalamity", 3); + recipe.AddIngredient(null, "EmpyreanKnivesThrown"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/SandDollar.cs b/Items/CalamityCustomThrowingDamage/SandDollar.cs index 11f4d6b736..8243a26b98 100644 --- a/Items/CalamityCustomThrowingDamage/SandDollar.cs +++ b/Items/CalamityCustomThrowingDamage/SandDollar.cs @@ -1,54 +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; - -namespace CalamityMod.Items.CalamityCustomThrowingDamage -{ - public class SandDollar : CalamityDamageItem - { +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 SandDollar : CalamityDamageItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Sand Dollar"); + DisplayName.SetDefault("Sand Dollar"); Tooltip.SetDefault("Stacks up to 2"); } - public override void SafeSetDefaults() - { - item.width = 30; - item.height = 28; - item.damage = 30; - item.thrown = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 1; - item.maxStack = 2; - item.knockBack = 3.5f; - item.autoReuse = true; - item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("SandDollarProj"); - item.shootSpeed = 14f; - item.GetGlobalItem(mod).rogue = true; - } - - public override bool CanUseItem(Player player) - { - int MAX = item.stack; - int launched = 0; - foreach (Projectile projectile in Main.projectile) - if (projectile.type == item.shoot && projectile.owner == item.owner && projectile.active) - { - launched++; - } - return (launched >= MAX) ? false : true; - } - } -} + public override void SafeSetDefaults() + { + item.width = 30; + item.height = 28; + item.damage = 30; + item.thrown = true; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 1; + item.maxStack = 2; + item.knockBack = 3.5f; + item.autoReuse = true; + item.UseSound = SoundID.Item1; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("SandDollarProj"); + item.shootSpeed = 14f; + item.GetGlobalItem(mod).rogue = true; + } + + public override bool CanUseItem(Player player) + { + int MAX = item.stack; + int launched = 0; + foreach (Projectile projectile in Main.projectile) + if (projectile.type == item.shoot && projectile.owner == item.owner && projectile.active) + { + launched++; + } + return (launched >= MAX) ? false : true; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs b/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs index da9d3880c0..11053c7ac7 100644 --- a/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs +++ b/Items/CalamityCustomThrowingDamage/ScourgeoftheCosmosThrown.cs @@ -1,59 +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.CalamityCustomThrowingDamage -{ - public class ScourgeoftheCosmosThrown : CalamityDamageItem - { +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 ScourgeoftheCosmosThrown : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Scourge of the Cosmos"); Tooltip.SetDefault("Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on death and tile hits"); } - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 1500; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 5f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); - item.shootSpeed = 15f; - item.GetGlobalItem(mod).rogue = true; - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ScourgeoftheCorruptor); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddIngredient(null, "XerocPitchfork", 200); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 18; + item.damage = 1500; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 5f; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.height = 20; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); + item.shootSpeed = 15f; + item.GetGlobalItem(mod).rogue = true; + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ScourgeoftheCorruptor); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddIngredient(null, "XerocPitchfork", 200); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs b/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs index f85d2c49b0..328cc8dbaa 100644 --- a/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs +++ b/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs @@ -1,40 +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 -{ - public class ScourgeoftheDesert : CalamityDamageItem - { +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 ScourgeoftheDesert : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Scourge of the Desert"); - Tooltip.SetDefault("Gains velocity over time"); + Tooltip.SetDefault("Gains velocity over time"); } - public override void SafeSetDefaults() - { - item.width = 44; - item.damage = 16; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 3.5f; - 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("ScourgeoftheDesert"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - } -} + public override void SafeSetDefaults() + { + item.width = 44; + item.damage = 16; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 3.5f; + 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("ScourgeoftheDesert"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs b/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs index 906416c62b..6a959f705e 100644 --- a/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs +++ b/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs @@ -1,50 +1,50 @@ -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 SeafoamBomb : CalamityDamageItem - { +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 SeafoamBomb : CalamityDamageItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Seafoam Bomb"); + DisplayName.SetDefault("Seafoam Bomb"); Tooltip.SetDefault("Throws a bomb that explodes into a bubble which deals extra damage to enemies"); } - public override void SafeSetDefaults() - { - item.width = 26; - item.height = 44; - item.damage = 18; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("SeafoamBomb"); - item.shootSpeed = 8f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Bomb, 25); - recipe.AddIngredient(null, "SeaPrism", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 26; + item.height = 44; + item.damage = 18; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("SeafoamBomb"); + item.shootSpeed = 8f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Bomb, 25); + recipe.AddIngredient(null, "SeaPrism", 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs b/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs index e0045d4549..99a7719c17 100644 --- a/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs +++ b/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs @@ -1,47 +1,47 @@ -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 SeashellBoomerang : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seashell Boomerang"); - } - - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 15; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.height = 34; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("SeashellBoomerangProjectile"); - item.shootSpeed = 11.5f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddTile(TileID.Anvils); - 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 SeashellBoomerang : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seashell Boomerang"); + } + + public override void SafeSetDefaults() + { + item.width = 18; + item.damage = 15; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.height = 34; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("SeashellBoomerangProjectile"); + item.shootSpeed = 11.5f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/ShatteredSun.cs b/Items/CalamityCustomThrowingDamage/ShatteredSun.cs index f6223aaf23..1b6cadf3b7 100644 --- a/Items/CalamityCustomThrowingDamage/ShatteredSun.cs +++ b/Items/CalamityCustomThrowingDamage/ShatteredSun.cs @@ -1,52 +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 -{ - public class ShatteredSun : CalamityDamageItem - { +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 ShatteredSun : CalamityDamageItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Shattered Sun"); + DisplayName.SetDefault("Shattered Sun"); Tooltip.SetDefault("Throws daggers that split twice and explode upon contact"); } - public override void SafeSetDefaults() - { - item.width = 56; - item.height = 56; - item.damage = 50; - item.crit += 10; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 11; - item.useStyle = 1; - item.useTime = 11; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("ShatteredSun"); - item.shootSpeed = 25f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "RadiantStar"); - recipe.AddIngredient(null, "DivineGeode", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 56; + item.height = 56; + item.damage = 50; + item.crit += 10; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 11; + item.useStyle = 1; + item.useTime = 11; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("ShatteredSun"); + item.shootSpeed = 25f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "RadiantStar"); + recipe.AddIngredient(null, "DivineGeode", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/SnapClam.cs b/Items/CalamityCustomThrowingDamage/SnapClam.cs index 669f28fd88..c384bc4651 100644 --- a/Items/CalamityCustomThrowingDamage/SnapClam.cs +++ b/Items/CalamityCustomThrowingDamage/SnapClam.cs @@ -1,41 +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.CalamityCustomThrowingDamage -{ - public class SnapClam : CalamityDamageItem - { +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 SnapClam : CalamityDamageItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Snap Clam"); + DisplayName.SetDefault("Snap Clam"); Tooltip.SetDefault("Can latch on enemies and deal damage over time"); } - public override void SafeSetDefaults() - { - item.width = 26; - item.height = 16; - item.damage = 15; - item.thrown = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 1; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("SnapClamProj"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - } -} + public override void SafeSetDefaults() + { + item.width = 26; + item.height = 16; + item.damage = 15; + item.thrown = true; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 1; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 2, 0, 0); + 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 7785fa4a16..79e228c4df 100644 --- a/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs +++ b/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs @@ -1,57 +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 SpearofPaleolith : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear of Paleolith"); - Tooltip.SetDefault("Throws an ancient spear that shatters enemy armor\n" + - "Spears rain fossil shards as they travel"); - } - - public override void SafeSetDefaults() - { - item.width = 54; - item.damage = 65; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 27; - item.useStyle = 1; - item.useTime = 27; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("SpearofPaleolith"); - item.shootSpeed = 35f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.AdamantiteBar, 4); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.TitaniumBar, 4); - recipe.AddTile(TileID.Anvils); - 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 SpearofPaleolith : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear of Paleolith"); + Tooltip.SetDefault("Throws an ancient spear that shatters enemy armor\n" + + "Spears rain fossil shards as they travel"); + } + + public override void SafeSetDefaults() + { + item.width = 54; + item.damage = 65; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 27; + item.useStyle = 1; + item.useTime = 27; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 54; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("SpearofPaleolith"); + item.shootSpeed = 35f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.AdamantiteBar, 4); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.TitaniumBar, 4); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/StellarKnife.cs b/Items/CalamityCustomThrowingDamage/StellarKnife.cs index 8b5e644799..69096adad0 100644 --- a/Items/CalamityCustomThrowingDamage/StellarKnife.cs +++ b/Items/CalamityCustomThrowingDamage/StellarKnife.cs @@ -1,42 +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.CalamityCustomThrowingDamage -{ - public class StellarKnife : CalamityDamageItem - { +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 StellarKnife : CalamityDamageItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Stellar Knife"); - Tooltip.SetDefault("Throws knives that stop middair and then home into enemies\n" + + DisplayName.SetDefault("Stellar Knife"); + Tooltip.SetDefault("Throws knives that stop middair and then home into enemies\n" + "Za Warudo"); } - public override void SafeSetDefaults() - { - item.width = 32; - item.height = 34; - item.damage = 60; - item.crit += 4; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 8; - item.useStyle = 1; - item.useTime = 8; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("StellarKnife"); - item.shootSpeed = 10f; - item.GetGlobalItem(mod).rogue = true; - } - } -} + public override void SafeSetDefaults() + { + item.width = 32; + item.height = 34; + item.damage = 60; + item.crit += 4; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 8; + item.useStyle = 1; + item.useTime = 8; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("StellarKnife"); + item.shootSpeed = 10f; + item.GetGlobalItem(mod).rogue = true; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs b/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs index 9010098d24..eb113069fd 100644 --- a/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs +++ b/Items/CalamityCustomThrowingDamage/TarragonThrowingDart.cs @@ -1,50 +1,50 @@ -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 TarragonThrowingDart : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tarragon Throwing Dart"); - } - - public override void SafeSetDefaults() - { - item.width = 34; - item.damage = 380; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 11; - item.useStyle = 1; - item.useTime = 11; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 34; - item.maxStack = 999; - item.value = 25000; - item.shoot = mod.ProjectileType("TarragonThrowingDartProjectile"); - item.shootSpeed = 24f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - 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 TarragonThrowingDart : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tarragon Throwing Dart"); + } + + public override void SafeSetDefaults() + { + item.width = 34; + item.damage = 380; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 11; + item.useStyle = 1; + item.useTime = 11; + item.knockBack = 4.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 34; + item.maxStack = 999; + item.value = 25000; + item.shoot = mod.ProjectileType("TarragonThrowingDartProjectile"); + item.shootSpeed = 24f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs b/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs index 990a7b021b..e27398cada 100644 --- a/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs +++ b/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs @@ -1,51 +1,51 @@ -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 TitaniumShuriken : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Titanium Shuriken"); - } - - public override void SafeSetDefaults() - { - item.width = 38; - item.damage = 31; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 9; - item.crit = 10; - item.useStyle = 1; - item.useTime = 9; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 38; - item.maxStack = 999; - item.value = 2000; - item.rare = 4; - item.shoot = mod.ProjectileType("TitaniumShurikenProjectile"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 30); - 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 TitaniumShuriken : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titanium Shuriken"); + } + + public override void SafeSetDefaults() + { + item.width = 38; + item.damage = 31; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 9; + item.crit = 10; + item.useStyle = 1; + item.useTime = 9; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 38; + item.maxStack = 999; + item.value = 2000; + item.rare = 4; + item.shoot = mod.ProjectileType("TitaniumShurikenProjectile"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitaniumBar); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 30); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/ToothBall.cs b/Items/CalamityCustomThrowingDamage/ToothBall.cs index 810ebb3c01..02311acabe 100644 --- a/Items/CalamityCustomThrowingDamage/ToothBall.cs +++ b/Items/CalamityCustomThrowingDamage/ToothBall.cs @@ -1,53 +1,53 @@ -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 ToothBall : CalamityDamageItem - { +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 ToothBall : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Tooth Ball"); } - - public override void SafeSetDefaults() - { - item.width = 30; - item.damage = 20; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.crit = 8; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1000; - item.rare = 3; - item.shoot = mod.ProjectileType("ToothBallProjectile"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample"); - recipe.AddIngredient(ItemID.Vertebrae); - recipe.AddIngredient(ItemID.CrimtaneBar); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } -} + + public override void SafeSetDefaults() + { + item.width = 30; + item.damage = 20; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 13; + item.crit = 8; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 30; + item.maxStack = 999; + item.value = 1000; + item.rare = 3; + item.shoot = mod.ProjectileType("ToothBallProjectile"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample"); + recipe.AddIngredient(ItemID.Vertebrae); + recipe.AddIngredient(ItemID.CrimtaneBar); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs b/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs index 943b5b1276..ca126e4e2e 100644 --- a/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs +++ b/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs @@ -1,52 +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 -{ - public class TruePaladinsHammer : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Paladin's Hammer"); - Tooltip.SetDefault("Explodes on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 14; - item.damage = 180; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 13; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 20f; - item.UseSound = SoundID.Item1; - item.height = 28; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("OPHammer"); - item.shootSpeed = 14f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PaladinsHammer); - recipe.AddIngredient(null, "CalamityDust", 5); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddIngredient(null, "CruptixBar", 5); - recipe.AddTile(TileID.MythrilAnvil); - 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 TruePaladinsHammer : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Paladin's Hammer"); + Tooltip.SetDefault("Explodes on enemy hits"); + } + + public override void SafeSetDefaults() + { + item.width = 14; + item.damage = 180; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 13; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 20f; + item.UseSound = SoundID.Item1; + item.height = 28; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("OPHammer"); + item.shootSpeed = 14f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PaladinsHammer); + recipe.AddIngredient(null, "CalamityDust", 5); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddIngredient(null, "CruptixBar", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/UrchinStinger.cs b/Items/CalamityCustomThrowingDamage/UrchinStinger.cs index ca64eb7d3f..b08fa97dd6 100644 --- a/Items/CalamityCustomThrowingDamage/UrchinStinger.cs +++ b/Items/CalamityCustomThrowingDamage/UrchinStinger.cs @@ -1,41 +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.CalamityCustomThrowingDamage -{ - public class UrchinStinger : CalamityDamageItem - { +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 UrchinStinger : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Urchin Stinger"); } - public override void SafeSetDefaults() - { - item.width = 10; - item.damage = 15; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 26; - item.maxStack = 999; - item.value = 200; - item.rare = 1; - item.shoot = mod.ProjectileType("UrchinStinger"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - } -} + public override void SafeSetDefaults() + { + item.width = 10; + item.damage = 15; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 1.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 26; + item.maxStack = 999; + item.value = 200; + item.rare = 1; + item.shoot = mod.ProjectileType("UrchinStinger"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Valediction.cs b/Items/CalamityCustomThrowingDamage/Valediction.cs index 6b5cbd1131..e2c68db9d3 100644 --- a/Items/CalamityCustomThrowingDamage/Valediction.cs +++ b/Items/CalamityCustomThrowingDamage/Valediction.cs @@ -1,40 +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 -{ - public class Valediction : CalamityDamageItem - { +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 +{ + public class Valediction : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Valediction"); Tooltip.SetDefault("Throws a homing reaper scythe"); } - public override void SafeSetDefaults() - { - item.width = 80; - item.damage = 405; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useTime = 15; - item.useStyle = 1; - item.knockBack = 7f; - 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("Valediction"); - item.shootSpeed = 20f; - item.GetGlobalItem(mod).rogue = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - } -} + public override void SafeSetDefaults() + { + item.width = 80; + item.damage = 405; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useTime = 15; + item.useStyle = 1; + item.knockBack = 7f; + 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("Valediction"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs b/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs index 02c611c5e3..c22f21e8cd 100644 --- a/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs +++ b/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs @@ -1,50 +1,50 @@ -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 WulfrumKnife : CalamityDamageItem - { +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 WulfrumKnife : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Knife"); } - public override void SafeSetDefaults() - { - item.width = 22; - item.damage = 8; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 1f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 38; - item.maxStack = 999; - item.value = 100; - item.rare = 1; - item.shoot = mod.ProjectileType("WulfrumKnife"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard"); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 50); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 22; + item.damage = 8; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 1f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 38; + item.maxStack = 999; + item.value = 100; + item.rare = 1; + item.shoot = mod.ProjectileType("WulfrumKnife"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard"); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 50); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs b/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs index 03cc98c790..a75edcc729 100644 --- a/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs +++ b/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs @@ -1,50 +1,50 @@ -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 XerocPitchfork : CalamityDamageItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Pitchfork"); - } - - public override void SafeSetDefaults() - { - item.width = 48; - item.damage = 360; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; - item.maxStack = 999; - item.value = 10000; - item.rare = 9; - item.shoot = mod.ProjectileType("XerocPitchforkProjectile"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).rogue = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 20); - 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 XerocPitchfork : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Pitchfork"); + } + + public override void SafeSetDefaults() + { + item.width = 48; + item.damage = 360; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 48; + item.maxStack = 999; + item.value = 10000; + item.rare = 9; + item.shoot = mod.ProjectileType("XerocPitchforkProjectile"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 20); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 9a9412a2b2..014b382c96 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1,1991 +1,1991 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.Utilities; -using Terraria.ModLoader; -using Terraria.ModLoader.IO; -using CalamityMod; -using CalamityMod.NPCs; -using CalamityMod.Items.CalamityCustomThrowingDamage; -using CalamityMod.World; - -namespace CalamityMod.Items -{ - public class CalamityGlobalItem : GlobalItem - { - #region Instances - public override bool InstancePerEntity - { - get - { - return true; - } - } - - public override bool CloneNewInstances - { - get - { - return true; - } - } - #endregion - - public bool rogue = false; - - public int timesUsed = 0; - - public int postMoonLordRarity = 0; - - #region SetDefaults - public override void SetDefaults(Item item) - { - if (postMoonLordRarity != 0 && item.rare != 10) - item.rare = 10; - - if (item.maxStack == 99 || item.type == ItemID.Dynamite || item.type == ItemID.StickyDynamite || - item.type == ItemID.BouncyDynamite || item.type == ItemID.StickyBomb || item.type == ItemID.BouncyBomb) - item.maxStack = 999; - - if (item.type >= ItemID.GreenSolution && item.type <= ItemID.RedSolution) - item.value = Item.buyPrice(0, 0, 5, 0); - - if (CalamityMod.weaponAutoreuseList.Contains(item.type)) - item.autoReuse = true; - - if (item.type == ItemID.PsychoKnife) - item.damage *= 4; - else if (CalamityMod.doubleDamageBuffList.Contains(item.type)) - item.damage *= 2; - else if (CalamityMod.sixtySixDamageBuffList.Contains(item.type)) - item.damage = (int)((double)item.damage * 1.66); - else if (CalamityMod.fiftyDamageBuffList.Contains(item.type)) - item.damage = (int)((double)item.damage * 1.5); - else if (CalamityMod.thirtyThreeDamageBuffList.Contains(item.type)) - item.damage = (int)((double)item.damage * 1.33); - else if (CalamityMod.twentyFiveDamageBuffList.Contains(item.type)) - item.damage = (int)((double)item.damage * 1.25); - else if (CalamityMod.twentyDamageBuffList.Contains(item.type)) - item.damage = (int)((double)item.damage * 1.2); - else if (item.type == ItemID.Frostbrand || item.type == ItemID.MagnetSphere) - item.damage = (int)((double)item.damage * 1.1); - else if (item.type == ItemID.Razorpine) - item.damage = (int)((double)item.damage * 0.95); - else if (item.type == ItemID.LastPrism) - item.damage = (int)((double)item.damage * 0.85); - else if (CalamityMod.quarterDamageNerfList.Contains(item.type)) - item.damage = (int)((double)item.damage * 0.75); - - if (item.type == ItemID.BookStaff) - item.mana = 10; - else if (item.type == ItemID.UnholyTrident) - item.mana = 14; - else if (item.type == ItemID.FrostStaff) - item.mana = 9; - else if (item.type == ItemID.BookofSkulls) - item.mana = 12; - else if (item.type == ItemID.BlizzardStaff) - item.mana = 7; - else if (item.type == ItemID.SolarFlareHelmet) //total defense pre-buff = 78 post-buff = 94 - item.defense = 29; //5 more defense - else if (item.type == ItemID.SolarFlareBreastplate) - item.defense = 41; //7 more defense - else if (item.type == ItemID.SolarFlareLeggings) - item.defense = 24; //4 more defense - else if (item.type == ItemID.GladiatorHelmet) //total defense pre-buff = 7 post-buff = 21 - item.defense = 4; //2 more defense - else if (item.type == ItemID.GladiatorBreastplate) - item.defense = 7; //4 more defense - else if (item.type == ItemID.GladiatorLeggings) - item.defense = 5; //3 more defense - else if (item.type == ItemID.HallowedPlateMail) //total defense pre-buff = 31, 50, 35 post-buff = 36, 55, 40 - item.defense = 18; //3 more defense - else if (item.type == ItemID.HallowedGreaves) - item.defense = 13; //2 more defense - } - #endregion - - #region Shoot - public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (rogue) - { - speedX *= CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity; - speedY *= CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity; - } - if (player.GetModPlayer(mod).luxorsGift) - { - if (player.whoAmI == Main.myPlayer) - { - if (item.melee && item.type != mod.ItemType("Murasama")) - { - 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; - speedY *= 1.25f; - } - if (player.GetModPlayer(mod).bloodflareMage) //0 - 99 - { - if (item.magic && Main.rand.Next(0, 100) >= 95) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhostlyBolt"), (int)((double)damage * (player.GetModPlayer(mod).auricSet ? 4.2 : 2.6)), 1f, player.whoAmI, 0f, 0f); - } - } - } - if (player.GetModPlayer(mod).bloodflareRanged) //0 - 99 - { - if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 98) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodBomb"), (int)((double)damage * (player.GetModPlayer(mod).auricSet ? 2.2 : 1.6)), 2f, player.whoAmI, 0f, 0f); - } - } - } - if (player.GetModPlayer(mod).tarraMage) - { - if (player.GetModPlayer(mod).tarraCrits >= 5 && player.whoAmI == Main.myPlayer) - { - player.GetModPlayer(mod).tarraCrits = 0; - int num106 = 9 + Main.rand.Next(3); - for (int num107 = 0; num107 < num106; num107++) - { - float num110 = 0.025f * (float)num107; - float hardar = speedX + (float)Main.rand.Next(-25, 26) * num110; - float hordor = speedY + (float)Main.rand.Next(-25, 26) * num110; - float num84 = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - num84 = item.shootSpeed / num84; - hardar *= num84; - hordor *= num84; - Projectile.NewProjectile(position.X, position.Y, hardar, hordor, 206, (int)((double)damage * 0.2), knockBack, player.whoAmI, 0.0f, 0.0f); - } - } - } - if (player.GetModPlayer(mod).ataxiaBolt) - { - if (item.ranged && !rogue && Main.rand.Next(2) == 0) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("ChaosFlare"), (int)((double)damage * 0.25), 2f, player.whoAmI, 0f, 0f); - } - } - } - if (player.GetModPlayer(mod).godSlayerRanged) //0 - 99 - { - if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 95) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("GodSlayerShrapnelRound"), (int)((double)damage * (player.GetModPlayer(mod).auricSet ? 3.2 : 2.1)), 2f, player.whoAmI, 0f, 0f); - } - } - } - if (player.GetModPlayer(mod).ataxiaVolley) - { - if (rogue && Main.rand.Next(10) == 0) - { - if (player.whoAmI == Main.myPlayer) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 20); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - Vector2 vector2 = new Vector2(player.Center.X, player.Center.Y); - 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), mod.ProjectileType("ChaosFlare2"), (int)((double)damage * 0.5), 1.25f, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("ChaosFlare2"), (int)((double)damage * 0.5), 1.25f, player.whoAmI, 0f, 0f); - } - } - } - } - if (player.GetModPlayer(mod).reaverDoubleTap) //0 - 99 - { - if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 90) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("MiniRocket"), (int)((double)damage * 1.3), 2f, player.whoAmI, 0f, 0f); - } - } - } - if (player.GetModPlayer(mod).victideSet) - { - if ((item.ranged || item.melee || item.magic || - rogue || item.summon) && item.rare < 8 && Main.rand.Next(10) == 0) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("Seashell"), damage * 2, 1f, player.whoAmI, 0f, 0f); - } - } - } - return true; - } - #endregion - - #region SavingAndLoading - public override bool NeedsSaving(Item item) - { - return true; - } - - public override TagCompound Save(Item item) - { - return new TagCompound - { - { - "rogue", rogue - }, - { - "timesUsed", timesUsed - }, - { - "rarity", postMoonLordRarity - } - }; - } - - public override void Load(Item item, TagCompound tag) - { - rogue = tag.GetBool("rogue"); - timesUsed = tag.GetInt("timesUsed"); - postMoonLordRarity = tag.GetInt("rarity"); - } - - public override void LoadLegacy(Item item, BinaryReader reader) - { - int loadVersion = reader.ReadInt32(); - postMoonLordRarity = reader.ReadInt32(); - timesUsed = reader.ReadInt32(); - - if (loadVersion == 0) - { - BitsByte flags = reader.ReadByte(); - rogue = flags[0]; - } - else - { - ErrorLogger.Log("CalamityMod: Unknown loadVersion: " + loadVersion); - } - } - - public override void NetSend(Item item, BinaryWriter writer) - { - BitsByte flags = new BitsByte(); - flags[0] = rogue; - - writer.Write(flags); - writer.Write(postMoonLordRarity); - writer.Write(timesUsed); - } - - public override void NetReceive(Item item, BinaryReader reader) - { - BitsByte flags = reader.ReadByte(); - rogue = flags[0]; - - postMoonLordRarity = reader.ReadInt32(); - timesUsed = reader.ReadInt32(); - } - #endregion - - #region Pickup Item Changes - public override bool OnPickup(Item item, Player player) - { - 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 -= (boostedHeart ? 5 : 10); - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect((boostedHeart ? -5 : -10), true); - } - } - if (boostedHeart) - { - player.statLife += 5; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(5, true); - } - } - } - return true; - } - #endregion - - #region Use Item Changes - public override bool CanUseItem(Item item, Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (item.type == ItemID.MonkStaffT1) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - if (item.type == ItemID.SpaceGun && player.spaceGun) - { - if (player.statMana >= (int)((float)3 * player.manaCost)) - { - player.manaRegenDelay = (int)player.maxRegenDelay; - player.statMana -= (int)((float)3 * player.manaCost); - } - else if (player.manaFlower) - { - player.QuickMana(); - if (player.statMana >= (int)((float)3 * player.manaCost)) - { - player.manaRegenDelay = (int)player.maxRegenDelay; - player.statMana -= (int)((float)3 * player.manaCost); - } - else - { - return false; - } - } - else - { - return false; - } - return true; - } - if ((item.type == ItemID.RegenerationPotion || item.type == ItemID.LifeforcePotion) && player.FindBuffIndex(mod.BuffType("Cadence")) > -1) - { - return false; - } - if (item.type == mod.ItemType("CrumblingPotion") && player.FindBuffIndex(mod.BuffType("ArmorShattering")) > -1) - { - return false; - } - if (item.type == ItemID.WrathPotion && player.FindBuffIndex(mod.BuffType("HolyWrathBuff")) > -1) - { - return false; - } - if (item.type == ItemID.RagePotion && player.FindBuffIndex(mod.BuffType("ProfanedRageBuff")) > -1) - { - return false; - } - if ((item.type == ItemID.SuperAbsorbantSponge || item.type == ItemID.EmptyBucket) && modPlayer.ZoneAbyss) - { - return false; - } - if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) - { - return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); - } - if (item.type == ItemID.RodofDiscord) - { - if (modPlayer.scarfCooldown) - { - player.AddBuff(BuffID.ChaosState, 720); - } - } - return true; - } - #endregion - - #region Modify Tooltips - public override void ModifyTooltips(Item item, List tooltips) - { - TooltipLine tt2 = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria"); - if (tt2 != null) - { - switch (postMoonLordRarity) - { - case 12: - tt2.overrideColor = new Color(0, 255, 200); - break; - case 13: - tt2.overrideColor = new Color(0, 255, 0); - break; - case 14: - tt2.overrideColor = new Color(43, 96, 222); - break; - case 15: - tt2.overrideColor = new Color(108, 45, 199); - break; - case 16: - tt2.overrideColor = new Color(255, 0, 255); - break; - case 17: //Legendary Weapons - if (item.type == mod.ItemType("Malachite")) - tt2.overrideColor = new Color(Main.DiscoR, 203, 103); - if (item.type == mod.ItemType("AegisBlade") || item.type == mod.ItemType("YharimsCrystal")) - tt2.overrideColor = new Color(255, Main.DiscoG, 53); - if (item.type == mod.ItemType("BrinyBaron")) - tt2.overrideColor = new Color(53, Main.DiscoG, 255); - if (item.type == mod.ItemType("CosmicDischarge")) - tt2.overrideColor = new Color(150, Main.DiscoG, 255); - if (item.type == mod.ItemType("BlossomFlux")) - tt2.overrideColor = new Color(Main.DiscoR, 203, 103); - if (item.type == mod.ItemType("SHPC")) - tt2.overrideColor = new Color(255, Main.DiscoG, 155); - if (item.type == mod.ItemType("Vesuvius")) - tt2.overrideColor = new Color(255, Main.DiscoG, 0); - break; - case 18: //Fabstaff - tt2.overrideColor = new Color(Main.DiscoR, 100, 255); - break; - case 19: //Blushie Staff - tt2.overrideColor = new Color(0, 0, 255); - break; - case 20: //Non-Expert Rainbow - tt2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - break; - 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; - } - } - if (item.type == ItemID.SuperAbsorbantSponge) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Capable of soaking up an endless amount of water\n" + - "Cannot be used in the Abyss"; - } - } - } - if (item.type == ItemID.EmptyBucket) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "1 defense\n" + - "Cannot be used in the Abyss"; - } - } - } - if (item.type == ItemID.CrimsonHeart) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Summons a heart to provide light\n" + - "Provides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.ShadowOrb) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Creates a magical shadow orb\n" + - "Provides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.MagicLantern) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Summons a magic lantern that exposes nearby treasure\n" + - "Provides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.ArcticDivingGear) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Provides light under water and extra mobility on ice\n" + - "Provides a small amount of light in the abyss\n" + - "Moderately reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.JellyfishNecklace) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides light under water\n" + - "Provides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.JellyfishDivingGear) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Provides light under water\n" + - "Provides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.FairyBell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Summons a magical fairy\n" + - "Provides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.DD2PetGhost) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Summons a pet flickerwick to provide light\n" + - "Provides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.ShinePotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "BuffTime") - { - line2.text = "5 minute duration\n" + - "Provides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.WispinaBottle) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Summons a Wisp to provide light\n" + - "Provides a large amount of light in the abyss"; - } - } - } - if (item.type == ItemID.SuspiciousLookingTentacle) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "'I know what you're thinking...'\n" + - "Provides a large amount of light in the abyss"; - } - } - } - if (item.type == ItemID.GillsPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "BuffTime") - { - line2.text = "2 minute duration\n" + - "Greatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.DivingHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Greatly extends underwater breathing\n" + - "Moderately reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.NeptunesShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Transforms the holder into merfolk when entering water\n" + - "Greatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.MoonShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Turns the holder into a werewolf at night and a merfolk when entering water\n" + - "Greatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.CelestialShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Minor increases to all stats\n" + - "Greatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.WormScarf) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduces damage taken by 10%"; - } - } - } - if (item.type == ItemID.SpectreHood) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% decreased magic damage"; - } - } - } - if (item.type == ItemID.ApprenticeHat) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries and reduces mana costs by 10%\n" + - "30% increased minion damage"; - } - } - } - if (item.type == ItemID.ApprenticeRobe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "10% increased magic damage"; - } - } - } - if (item.type == ItemID.ApprenticeTrousers) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - } - } - if (item.type == ItemID.SquireGreatHelm) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries and increases your life regeneration\n" + - "30% increased minion damage and 20% increased melee critical strike chance"; - } - } - } - if (item.type == ItemID.SquirePlating) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "15% increased melee damage"; - } - } - } - if (item.type == ItemID.SquireGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - } - } - if (item.type == ItemID.HuntressWig) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries and increases ranged critical strike chance by 10%\n" + - "30% increased minion damage"; - } - } - } - if (item.type == ItemID.HuntressJerkin) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased ranged damage"; - } - } - } - if (item.type == ItemID.HuntressPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - } - } - if (item.type == ItemID.MonkBrows) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries and increases melee attack speed by 20%\n" + - "30% increased minion damage and 10% increased melee critical strike chance"; - } - } - } - if (item.type == ItemID.MonkShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased melee damage"; - } - } - } - if (item.type == ItemID.MonkPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = ""; - } - } - } - if (item.type == ItemID.ApprenticeAltHead) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "60% increased minion damage and 25% increased magic damage and critical strike chance"; - } - } - } - if (item.type == ItemID.ApprenticeAltShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = ""; - } - } - } - if (item.type == ItemID.ApprenticeAltPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = ""; - } - } - } - if (item.type == ItemID.MonkAltHead) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries\n" + - "Increases melee damage, speed, and critical strike chance by 20% and minion damage by 60%"; - } - } - } - if (item.type == ItemID.MonkAltShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = ""; - } - } - } - if (item.type == ItemID.MonkAltPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - } - } - if (item.type == ItemID.HuntressAltHead) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "60% increased minion damage and 10% increased ranged critical strike chance\n" + - "25% increased ranged damage"; - } - } - } - if (item.type == ItemID.HuntressAltShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = ""; - } - } - } - if (item.type == ItemID.HuntressAltPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% increased movement speed"; - } - } - } - if (item.type == ItemID.SquireAltHead) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of sentries and grants you 60% minion damage\n" + - "20% increased melee critical strike chance"; - } - } - } - if (item.type == ItemID.SquireAltShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Massively increased life regeneration"; - } - } - } - if (item.type == ItemID.SquireAltPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "30% increased movement speed"; - } - } - } - if (item.type == ItemID.ObsidianSkinPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides immunity to direct damage from touching lava\n" + - "Provides temporary immunity to lava burn damage\n" + - "Reduces lava burn damage"; - } - } - } - if (item.type == ItemID.ObsidianRose) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduced direct damage from touching lava\n" + - "Greatly reduces lava burn damage"; - } - } - } - if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: Reduces the mana cost of the Space Gun by 50%"; - } - } - } - if (item.type == ItemID.CopperHelmet || item.type == ItemID.CopperChainmail || item.type == ItemID.CopperGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 15% increased mining speed"; - } - } - } - if (item.type == ItemID.TinHelmet || item.type == ItemID.TinChainmail || item.type == ItemID.TinGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 10% increased mining speed"; - } - } - } - if (item.type == ItemID.IronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 25% increased mining speed"; - } - } - } - if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 20% increased mining speed"; - } - } - } - if (item.type == ItemID.SilverHelmet || item.type == ItemID.SilverChainmail || item.type == ItemID.SilverGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 35% increased mining speed"; - } - } - } - if (item.type == ItemID.TungstenHelmet || item.type == ItemID.TungstenChainmail || item.type == ItemID.TungstenGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 30% increased mining speed"; - } - } - } - if (item.type == ItemID.GoldHelmet || item.type == ItemID.GoldChainmail || item.type == ItemID.GoldGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 45% increased mining speed"; - } - } - } - if (item.type == ItemID.PlatinumHelmet || item.type == ItemID.PlatinumChainmail || item.type == ItemID.PlatinumGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +4 defense and 40% increased mining speed"; - } - } - } - if (item.type == ItemID.GladiatorHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "5% increased rogue damage"; - } - } - } - if (item.type == ItemID.GladiatorBreastplate) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "7 defense\n" + - "5% increased rogue critical strike chance"; - } - } - } - if (item.type == ItemID.GladiatorLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "5 defense\n" + - "5% increased rogue velocity"; - } - } - } - if (item.type == ItemID.ObsidianHelm) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "5% increased rogue damage"; - } - } - } - if (item.type == ItemID.ObsidianShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "5 defense\n" + - "5% increased rogue critical strike chance"; - } - } - } - if (item.type == ItemID.ObsidianPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "5% increased rogue velocity"; - } - } - } - if (item.type == ItemID.MagicQuiver) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases arrow damage by 10% and greatly increases arrow speed"; - } - } - } - if (item.type == ItemID.AngelWings || item.type == ItemID.DemonWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 100"; - } - } - } - if (item.type == ItemID.Jetpack) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 115"; - } - } - } - if (item.type == ItemID.ButterflyWings || item.type == ItemID.FairyWings || item.type == ItemID.BeeWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130"; - } - } - } - if (item.type == ItemID.HarpyWings || item.type == ItemID.BoneWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 140"; - } - } - } - if (item.type == ItemID.FlameWings || item.type == ItemID.FrozenWings || item.type == ItemID.GhostWings || - item.type == ItemID.BeetleWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160"; - } - } - } - if (item.type == ItemID.FinWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 100"; - } - } - } - if (item.type == ItemID.FishronWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 8\n" + - "Acceleration multiplier: 2\n" + - "Good vertical speed\n" + - "Flight time: 180"; - } - } - } - if (item.type == ItemID.SteampunkWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180"; - } - } - } - if (item.type == ItemID.LeafWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160"; - } - } - } - if (item.type == ItemID.BatWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 140"; - } - } - } - if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || - item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || - item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || - item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "'Great for impersonating devs!'\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 150"; - } - } - } - if (item.type == ItemID.TatteredFairyWings || item.type == ItemID.SpookyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180"; - } - } - } - if (item.type == ItemID.Hoverboard) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 170"; - } - } - } - if (item.type == ItemID.FestiveWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 170"; - } - } - } - if (item.type == ItemID.MothronWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 160"; - } - } - } - if (item.type == ItemID.WingsSolar || item.type == ItemID.WingsStardust) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 180"; - } - } - } - if (item.type == ItemID.WingsVortex || item.type == ItemID.WingsNebula) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1.5\n" + - "Good vertical speed\n" + - "Flight time: 160"; - } - } - } - if (item.type == ItemID.BetsyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Allows flight and slow fall\n" + - "Horizontal speed: 6\n" + - "Acceleration multiplier: 2.5\n" + - "Good vertical speed\n" + - "Flight time: 150"; - } - } - } - if (item.accessory) - { - if (item.prefix == 67) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") - { - line2.text = "+1% critical strike chance"; - } - } - } - if (item.prefix == 68) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") - { - line2.text = "+2% critical strike chance"; - } - } - } - if (item.prefix == 62) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = "+1 defense\n" + - "+0.25% damage reduction"; - } - } - } - if (item.prefix == 63) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = "+2 defense\n" + - "+0.5% damage reduction"; - } - } - } - if (item.prefix == 64) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = "+3 defense\n" + - "+0.75% damage reduction"; - } - } - } - if (item.prefix == 65) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = "+4 defense\n" + - "+1% damage reduction"; - } - } - } - } - } - #endregion - - #region BossBagChanges - public override void OpenVanillaBag(string context, Player player, int arg) - { - bool revenge = CalamityWorld.revenge; - bool defiled = CalamityWorld.defiled; - if (context == "bossBag") - { - switch (arg) - { - case ItemID.KingSlimeBossBag: - if (revenge) - player.QuickSpawnItem(mod.ItemType("CrownJewel")); - break; - case ItemID.EyeOfCthulhuBossBag: - player.QuickSpawnItem(mod.ItemType("VictoryShard"), Main.rand.Next(3, 6)); - if (Main.rand.Next(3) == 0) - player.QuickSpawnItem(mod.ItemType("TeardropCleaver")); - 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) - player.QuickSpawnItem(mod.ItemType("Meowthrower")); - if (Main.rand.Next(8) == 0) - player.QuickSpawnItem(mod.ItemType("RogueEmblem")); - if (Main.rand.Next(5) == 0) - { - switch (Main.rand.Next(2)) - { - case 0: - player.QuickSpawnItem(ItemID.CrimsonKey); - break; - case 1: - player.QuickSpawnItem(ItemID.CorruptionKey); - break; - } - } - break; - case ItemID.DestroyerBossBag: - if (revenge) - { - if (Main.rand.Next(100) == 0) - player.QuickSpawnItem(mod.ItemType("SHPC")); - else if (defiled) - { - if (Main.rand.Next(20) == 0) - player.QuickSpawnItem(mod.ItemType("SHPC")); - } - } - break; - case ItemID.PlanteraBossBag: - player.QuickSpawnItem(mod.ItemType("LivingShard"), Main.rand.Next(8, 12)); - if (Main.rand.Next(5) == 0) - player.QuickSpawnItem(ItemID.JungleKey); - if (revenge) - { - if (Main.rand.Next(100) == 0) - player.QuickSpawnItem(mod.ItemType("BlossomFlux")); - else if (defiled) - { - if (Main.rand.Next(20) == 0) - player.QuickSpawnItem(mod.ItemType("BlossomFlux")); - } - } - break; - case ItemID.GolemBossBag: - if (revenge) - { - if (Main.rand.Next(100) == 0) - player.QuickSpawnItem(mod.ItemType("AegisBlade")); - else if (defiled) - { - if (Main.rand.Next(20) == 0) - player.QuickSpawnItem(mod.ItemType("AegisBlade")); - } - } - break; - case ItemID.FishronBossBag: - if (revenge) - { - if (Main.rand.Next(100) == 0) - player.QuickSpawnItem(mod.ItemType("BrinyBaron")); - else if (defiled) - { - if (Main.rand.Next(20) == 0) - player.QuickSpawnItem(mod.ItemType("BrinyBaron")); - } - } - break; - case ItemID.BossBagBetsy: - if (revenge) - { - if (Main.rand.Next(100) == 0) - player.QuickSpawnItem(mod.ItemType("Vesuvius")); - else if (defiled) - { - if (Main.rand.Next(20) == 0) - player.QuickSpawnItem(mod.ItemType("Vesuvius")); - } - } - 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) - { - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - } - } - #endregion - - #region Armor Set Changes - public override string IsArmorSet(Item head, Item body, Item legs) - { - if (head.type == ItemID.CopperHelmet && body.type == ItemID.CopperChainmail && legs.type == ItemID.CopperGreaves) - return "Copper"; - if (head.type == ItemID.TinHelmet && body.type == ItemID.TinChainmail && legs.type == ItemID.TinGreaves) - return "Tin"; - if (head.type == ItemID.IronHelmet && body.type == ItemID.IronChainmail && legs.type == ItemID.IronGreaves) - return "Iron"; - if (head.type == ItemID.LeadHelmet && body.type == ItemID.LeadChainmail && legs.type == ItemID.LeadGreaves) - return "Lead"; - if (head.type == ItemID.SilverHelmet && body.type == ItemID.SilverChainmail && legs.type == ItemID.SilverGreaves) - return "Silver"; - if (head.type == ItemID.TungstenHelmet && body.type == ItemID.TungstenChainmail && legs.type == ItemID.TungstenGreaves) - return "Tungsten"; - if (head.type == ItemID.GoldHelmet && body.type == ItemID.GoldChainmail && legs.type == ItemID.GoldGreaves) - return "Gold"; - if (head.type == ItemID.PlatinumHelmet && body.type == ItemID.PlatinumChainmail && legs.type == ItemID.PlatinumGreaves) - return "Platinum"; - if (head.type == ItemID.GladiatorHelmet && body.type == ItemID.GladiatorBreastplate && legs.type == ItemID.GladiatorLeggings) - return "Gladiator"; - if (head.type == ItemID.ObsidianHelm && body.type == ItemID.ObsidianShirt && legs.type == ItemID.ObsidianPants) - return "Obsidian"; - if (head.type == ItemID.PumpkinHelmet && body.type == ItemID.PumpkinBreastplate && legs.type == ItemID.PumpkinLeggings) - return "PumpMyAssFull"; - return ""; - } - - public override void UpdateArmorSet(Player player, string set) - { - if (set == "Copper") - player.pickSpeed -= 0.15f; - else if (set == "Tin") - player.pickSpeed -= 0.1f; - else if (set == "Iron") - player.pickSpeed -= 0.25f; - else if (set == "Lead") - player.pickSpeed -= 0.2f; - else if (set == "Silver") - player.pickSpeed -= 0.35f; - else if (set == "Tungsten") - player.pickSpeed -= 0.3f; - else if (set == "Gold") - player.pickSpeed -= 0.45f; - else if (set == "Platinum") - player.pickSpeed -= 0.4f; - else if (set == "Gladiator") - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.rogueStealthMax = 1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.1f; - player.statDefense += 5; - player.setBonus = "+5 defense\n" + - "10% increased rogue damage and velocity\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - } - else if (set == "Obsidian") - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.rogueStealthMax = 1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; - player.statDefense += 3; - player.fireWalk = true; - player.lavaMax += 300; - player.setBonus = "+3 defense\n" + - "10% increased rogue damage and critical strike chance\n" + - "Grants immunity to fire blocks and temporary immunity to lava"; - } - else if (set == "PumpMyAssFull") - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - } - #endregion - - #region Equip Changes - public override void UpdateEquip(Item item, Player player) - { - #region Head - if (item.type == ItemID.SpectreHood) - player.magicDamage += 0.2f; - else if (item.type == ItemID.GladiatorHelmet || item.type == ItemID.ObsidianHelm) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - else if (item.type == ItemID.CrimsonHelmet) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; - else if (item.type == ItemID.ApprenticeHat) - player.minionDamage += 0.3f; - else if (item.type == ItemID.SquireGreatHelm) - { - player.minionDamage += 0.3f; - player.meleeCrit += 20; - } - else if (item.type == ItemID.HuntressWig) - player.minionDamage += 0.3f; - else if (item.type == ItemID.MonkBrows) - { - player.minionDamage += 0.3f; - player.meleeCrit += 10; - } - else if (item.type == ItemID.ApprenticeAltHead) - { - player.minionDamage += 0.5f; - player.magicDamage += 0.15f; - player.magicCrit += 25; - } - else if (item.type == ItemID.MonkAltHead) - { - player.minionDamage += 0.4f; - player.meleeSpeed += 0.2f; - player.meleeCrit += 20; - } - else if (item.type == ItemID.HuntressAltHead) - { - player.minionDamage += 0.5f; - player.rangedDamage += 0.25f; - } - else if (item.type == ItemID.SquireAltHead) - { - player.minionDamage += 0.5f; - player.meleeCrit += 20; - } - #endregion - - #region Body - if (item.type == ItemID.GladiatorBreastplate || item.type == ItemID.ObsidianShirt) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - else if (item.type == ItemID.CrimsonScalemail) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; - else if (item.type == ItemID.PalladiumBreastplate) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; - } - else if (item.type == ItemID.CobaltBreastplate) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - else if (item.type == ItemID.MythrilChainmail) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - else if (item.type == ItemID.OrichalcumBreastplate) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 6; - else if (item.type == ItemID.AdamantiteBreastplate) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.06f; - else if (item.type == ItemID.TitaniumBreastplate) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.04f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - } - else if (item.type == ItemID.HallowedPlateMail) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; - else if (item.type == ItemID.ChlorophytePlateMail) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; - } - else if (item.type == ItemID.Gi) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - } - else if (item.type == ItemID.ApprenticeRobe) - player.minionDamage -= 0.2f; - else if (item.type == ItemID.SquirePlating) - player.minionDamage -= 0.15f; - else if (item.type == ItemID.HuntressJerkin) - player.minionDamage -= 0.2f; - else if (item.type == ItemID.MonkShirt) - player.minionDamage -= 0.2f; - else if (item.type == ItemID.ApprenticeAltShirt) - { - player.minionDamage -= 0.3f; - player.magicDamage -= 0.15f; - } - else if (item.type == ItemID.MonkAltShirt) - { - player.minionDamage -= 0.2f; - player.meleeSpeed -= 0.2f; - } - else if (item.type == ItemID.HuntressAltShirt) - { - player.minionDamage -= 0.25f; - player.meleeSpeed -= 0.2f; - } - else if (item.type == ItemID.SquireAltShirt) - player.minionDamage -= 0.3f; - #endregion - - #region Legs - if (item.type == ItemID.GladiatorLeggings || item.type == ItemID.ObsidianPants) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.05f; - else if (item.type == ItemID.CrimsonGreaves) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; - else if (item.type == ItemID.PalladiumLeggings) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 1; - } - else if (item.type == ItemID.MythrilGreaves) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - else if (item.type == ItemID.AdamantiteLeggings) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 4; - else if (item.type == ItemID.TitaniumLeggings) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; - } - else if (item.type == ItemID.HallowedGreaves) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.07f; - else if (item.type == ItemID.ChlorophyteGreaves) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; - else if (item.type == ItemID.ApprenticeTrousers) - { - player.magicCrit -= 20; - player.moveSpeed += 0.2f; - } - else if (item.type == ItemID.SquireGreaves) - { - player.minionDamage -= 0.15f; - player.meleeCrit -= 20; - } - else if (item.type == ItemID.HuntressPants) - player.minionDamage -= 0.1f; - else if (item.type == ItemID.MonkPants) - { - player.minionDamage -= 0.1f; - player.meleeCrit -= 10; - } - else if (item.type == ItemID.ApprenticeAltPants) - { - player.minionDamage -= 0.2f; - player.magicCrit -= 25; - } - else if (item.type == ItemID.MonkAltPants) - { - player.minionDamage -= 0.2f; - player.meleeCrit -= 20; - } - else if (item.type == ItemID.HuntressAltPants) - player.minionDamage -= 0.25f; - if (item.type == ItemID.SquireAltPants) - { - player.minionDamage -= 0.2f; - player.meleeCrit -= 20; - } - #endregion - } - #endregion - - #region Accessory Changes - public override void UpdateAccessory(Item item, Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - - if (item.type == ItemID.JellyfishNecklace || item.type == ItemID.JellyfishDivingGear || item.type == ItemID.ArcticDivingGear) - modPlayer.jellyfishNecklace = true; - - if (item.type == ItemID.WormScarf) - player.endurance -= 0.07f; - - if (item.type == ItemID.AvengerEmblem) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; - if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell || (item.type == ItemID.MoonStone && !Main.dayTime) || - (item.type == ItemID.SunStone && Main.dayTime)) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; - } - if (item.type == ItemID.DestroyerEmblem) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; - } - if (item.type == ItemID.EyeoftheGolem) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; - if (item.type == ItemID.PutridScent) - { - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; - } - - if (item.prefix == 62) - player.endurance += 0.0025f; - if (item.prefix == 63) - player.endurance += 0.005f; - if (item.prefix == 64) - player.endurance += 0.0075f; - if (item.prefix == 65) - player.endurance += 0.01f; - if (item.prefix == 67) - { - player.meleeCrit -= 1; - player.rangedCrit -= 1; - player.magicCrit -= 1; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 1; - } - if (item.prefix == 68) - { - player.meleeCrit -= 2; - player.rangedCrit -= 2; - player.magicCrit -= 2; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; - } - if (item.prefix == 69) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.01f; - if (item.prefix == 70) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; - if (item.prefix == 71) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; - if (item.prefix == 72) - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.04f; - } - #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); - if (flightSpeedMult > 1.2f) - flightSpeedMult = 1.2f; - - speed *= flightSpeedMult; - - float flightAccMult = 1f + - (modPlayer.draconicSurge ? 0.15f : 0f); - if (flightAccMult > 1.2f) - flightAccMult = 1.2f; - - 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 ? 10 : 0) + - (modPlayer.planteraLore ? 20 : 0) + - (modPlayer.polterghastLore ? 30 : 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?) - /// - /// The player using the item. - /// The type of dust to use. - /// The chance per frame to spawn the dust (0f-1f) - /// The minimum distance between the player and the dust - /// The maximum distance between the player and the dust - /// The minimum random rotation offset for the dust - /// The maximum random rotation offset for the dust - /// The minimum speed that the dust should travel - /// The maximum speed that the dust should travel - public static Dust MeleeDustHelper(Player player, int dustType, float chancePerFrame, float minDistance, float maxDistance, float minRandRot = -0.2f, float maxRandRot = 0.2f, float minSpeed = 0.9f, float maxSpeed = 1.1f) - { - if (Main.rand.NextFloat(1f) < chancePerFrame) - { - //Calculate values - //distance from player, - //the vector offset from the player center - //the vector between the pos and the player - float distance = Main.rand.NextFloat(minDistance, maxDistance); - Vector2 offset = (player.itemRotation - (MathHelper.PiOver4 * player.direction) + Main.rand.NextFloat(minRandRot, maxRandRot)).ToRotationVector2() * distance * player.direction; - Vector2 pos = player.Center + offset; - Vector2 vec = pos - player.Center; - //spawn the dust - Dust d = Dust.NewDustPerfect(pos, dustType); - //normalise vector and multiply by velocity magnitude - vec.Normalize(); - d.velocity = vec * Main.rand.NextFloat(minSpeed, maxSpeed); - return d; - } - return null; - } - } -} +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Utilities; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using CalamityMod; +using CalamityMod.NPCs; +using CalamityMod.Items.CalamityCustomThrowingDamage; +using CalamityMod.World; + +namespace CalamityMod.Items +{ + public class CalamityGlobalItem : GlobalItem + { + #region Instances + public override bool InstancePerEntity + { + get + { + return true; + } + } + + public override bool CloneNewInstances + { + get + { + return true; + } + } + #endregion + + public bool rogue = false; + + public int timesUsed = 0; + + public int postMoonLordRarity = 0; + + #region SetDefaults + public override void SetDefaults(Item item) + { + if (postMoonLordRarity != 0 && item.rare != 10) + item.rare = 10; + + if (item.maxStack == 99 || item.type == ItemID.Dynamite || item.type == ItemID.StickyDynamite || + item.type == ItemID.BouncyDynamite || item.type == ItemID.StickyBomb || item.type == ItemID.BouncyBomb) + item.maxStack = 999; + + if (item.type >= ItemID.GreenSolution && item.type <= ItemID.RedSolution) + item.value = Item.buyPrice(0, 0, 5, 0); + + if (CalamityMod.weaponAutoreuseList.Contains(item.type)) + item.autoReuse = true; + + if (item.type == ItemID.PsychoKnife) + item.damage *= 4; + else if (CalamityMod.doubleDamageBuffList.Contains(item.type)) + item.damage *= 2; + else if (CalamityMod.sixtySixDamageBuffList.Contains(item.type)) + item.damage = (int)((double)item.damage * 1.66); + else if (CalamityMod.fiftyDamageBuffList.Contains(item.type)) + item.damage = (int)((double)item.damage * 1.5); + else if (CalamityMod.thirtyThreeDamageBuffList.Contains(item.type)) + item.damage = (int)((double)item.damage * 1.33); + else if (CalamityMod.twentyFiveDamageBuffList.Contains(item.type)) + item.damage = (int)((double)item.damage * 1.25); + else if (CalamityMod.twentyDamageBuffList.Contains(item.type)) + item.damage = (int)((double)item.damage * 1.2); + else if (item.type == ItemID.Frostbrand || item.type == ItemID.MagnetSphere) + item.damage = (int)((double)item.damage * 1.1); + else if (item.type == ItemID.Razorpine) + item.damage = (int)((double)item.damage * 0.95); + else if (item.type == ItemID.LastPrism) + item.damage = (int)((double)item.damage * 0.85); + else if (CalamityMod.quarterDamageNerfList.Contains(item.type)) + item.damage = (int)((double)item.damage * 0.75); + + if (item.type == ItemID.BookStaff) + item.mana = 10; + else if (item.type == ItemID.UnholyTrident) + item.mana = 14; + else if (item.type == ItemID.FrostStaff) + item.mana = 9; + else if (item.type == ItemID.BookofSkulls) + item.mana = 12; + else if (item.type == ItemID.BlizzardStaff) + item.mana = 7; + else if (item.type == ItemID.SolarFlareHelmet) //total defense pre-buff = 78 post-buff = 94 + item.defense = 29; //5 more defense + else if (item.type == ItemID.SolarFlareBreastplate) + item.defense = 41; //7 more defense + else if (item.type == ItemID.SolarFlareLeggings) + item.defense = 24; //4 more defense + else if (item.type == ItemID.GladiatorHelmet) //total defense pre-buff = 7 post-buff = 21 + item.defense = 4; //2 more defense + else if (item.type == ItemID.GladiatorBreastplate) + item.defense = 7; //4 more defense + else if (item.type == ItemID.GladiatorLeggings) + item.defense = 5; //3 more defense + else if (item.type == ItemID.HallowedPlateMail) //total defense pre-buff = 31, 50, 35 post-buff = 36, 55, 40 + item.defense = 18; //3 more defense + else if (item.type == ItemID.HallowedGreaves) + item.defense = 13; //2 more defense + } + #endregion + + #region Shoot + public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (rogue) + { + speedX *= CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity; + speedY *= CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity; + } + if (player.GetModPlayer(mod).luxorsGift) + { + if (player.whoAmI == Main.myPlayer) + { + if (item.melee && item.type != mod.ItemType("Murasama")) + { + 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; + speedY *= 1.25f; + } + if (player.GetModPlayer(mod).bloodflareMage) //0 - 99 + { + if (item.magic && Main.rand.Next(0, 100) >= 95) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhostlyBolt"), (int)((double)damage * (player.GetModPlayer(mod).auricSet ? 4.2 : 2.6)), 1f, player.whoAmI, 0f, 0f); + } + } + } + if (player.GetModPlayer(mod).bloodflareRanged) //0 - 99 + { + if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 98) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodBomb"), (int)((double)damage * (player.GetModPlayer(mod).auricSet ? 2.2 : 1.6)), 2f, player.whoAmI, 0f, 0f); + } + } + } + if (player.GetModPlayer(mod).tarraMage) + { + if (player.GetModPlayer(mod).tarraCrits >= 5 && player.whoAmI == Main.myPlayer) + { + player.GetModPlayer(mod).tarraCrits = 0; + int num106 = 9 + Main.rand.Next(3); + for (int num107 = 0; num107 < num106; num107++) + { + float num110 = 0.025f * (float)num107; + float hardar = speedX + (float)Main.rand.Next(-25, 26) * num110; + float hordor = speedY + (float)Main.rand.Next(-25, 26) * num110; + float num84 = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + num84 = item.shootSpeed / num84; + hardar *= num84; + hordor *= num84; + Projectile.NewProjectile(position.X, position.Y, hardar, hordor, 206, (int)((double)damage * 0.2), knockBack, player.whoAmI, 0.0f, 0.0f); + } + } + } + if (player.GetModPlayer(mod).ataxiaBolt) + { + if (item.ranged && !rogue && Main.rand.Next(2) == 0) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("ChaosFlare"), (int)((double)damage * 0.25), 2f, player.whoAmI, 0f, 0f); + } + } + } + if (player.GetModPlayer(mod).godSlayerRanged) //0 - 99 + { + if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 95) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("GodSlayerShrapnelRound"), (int)((double)damage * (player.GetModPlayer(mod).auricSet ? 3.2 : 2.1)), 2f, player.whoAmI, 0f, 0f); + } + } + } + if (player.GetModPlayer(mod).ataxiaVolley) + { + if (rogue && Main.rand.Next(10) == 0) + { + if (player.whoAmI == Main.myPlayer) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 20); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + Vector2 vector2 = new Vector2(player.Center.X, player.Center.Y); + 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), mod.ProjectileType("ChaosFlare2"), (int)((double)damage * 0.5), 1.25f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("ChaosFlare2"), (int)((double)damage * 0.5), 1.25f, player.whoAmI, 0f, 0f); + } + } + } + } + if (player.GetModPlayer(mod).reaverDoubleTap) //0 - 99 + { + if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 90) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("MiniRocket"), (int)((double)damage * 1.3), 2f, player.whoAmI, 0f, 0f); + } + } + } + if (player.GetModPlayer(mod).victideSet) + { + if ((item.ranged || item.melee || item.magic || + rogue || item.summon) && item.rare < 8 && Main.rand.Next(10) == 0) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, mod.ProjectileType("Seashell"), damage * 2, 1f, player.whoAmI, 0f, 0f); + } + } + } + return true; + } + #endregion + + #region SavingAndLoading + public override bool NeedsSaving(Item item) + { + return true; + } + + public override TagCompound Save(Item item) + { + return new TagCompound + { + { + "rogue", rogue + }, + { + "timesUsed", timesUsed + }, + { + "rarity", postMoonLordRarity + } + }; + } + + public override void Load(Item item, TagCompound tag) + { + rogue = tag.GetBool("rogue"); + timesUsed = tag.GetInt("timesUsed"); + postMoonLordRarity = tag.GetInt("rarity"); + } + + public override void LoadLegacy(Item item, BinaryReader reader) + { + int loadVersion = reader.ReadInt32(); + postMoonLordRarity = reader.ReadInt32(); + timesUsed = reader.ReadInt32(); + + if (loadVersion == 0) + { + BitsByte flags = reader.ReadByte(); + rogue = flags[0]; + } + else + { + ErrorLogger.Log("CalamityMod: Unknown loadVersion: " + loadVersion); + } + } + + public override void NetSend(Item item, BinaryWriter writer) + { + BitsByte flags = new BitsByte(); + flags[0] = rogue; + + writer.Write(flags); + writer.Write(postMoonLordRarity); + writer.Write(timesUsed); + } + + public override void NetReceive(Item item, BinaryReader reader) + { + BitsByte flags = reader.ReadByte(); + rogue = flags[0]; + + postMoonLordRarity = reader.ReadInt32(); + timesUsed = reader.ReadInt32(); + } + #endregion + + #region Pickup Item Changes + public override bool OnPickup(Item item, Player player) + { + 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 -= (boostedHeart ? 5 : 10); + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect((boostedHeart ? -5 : -10), true); + } + } + if (boostedHeart) + { + player.statLife += 5; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(5, true); + } + } + } + return true; + } + #endregion + + #region Use Item Changes + public override bool CanUseItem(Item item, Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (item.type == ItemID.MonkStaffT1) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + if (item.type == ItemID.SpaceGun && player.spaceGun) + { + if (player.statMana >= (int)((float)3 * player.manaCost)) + { + player.manaRegenDelay = (int)player.maxRegenDelay; + player.statMana -= (int)((float)3 * player.manaCost); + } + else if (player.manaFlower) + { + player.QuickMana(); + if (player.statMana >= (int)((float)3 * player.manaCost)) + { + player.manaRegenDelay = (int)player.maxRegenDelay; + player.statMana -= (int)((float)3 * player.manaCost); + } + else + { + return false; + } + } + else + { + return false; + } + return true; + } + if ((item.type == ItemID.RegenerationPotion || item.type == ItemID.LifeforcePotion) && player.FindBuffIndex(mod.BuffType("Cadence")) > -1) + { + return false; + } + if (item.type == mod.ItemType("CrumblingPotion") && player.FindBuffIndex(mod.BuffType("ArmorShattering")) > -1) + { + return false; + } + if (item.type == ItemID.WrathPotion && player.FindBuffIndex(mod.BuffType("HolyWrathBuff")) > -1) + { + return false; + } + if (item.type == ItemID.RagePotion && player.FindBuffIndex(mod.BuffType("ProfanedRageBuff")) > -1) + { + return false; + } + if ((item.type == ItemID.SuperAbsorbantSponge || item.type == ItemID.EmptyBucket) && modPlayer.ZoneAbyss) + { + return false; + } + if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) + { + return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); + } + if (item.type == ItemID.RodofDiscord) + { + if (modPlayer.scarfCooldown) + { + player.AddBuff(BuffID.ChaosState, 720); + } + } + return true; + } + #endregion + + #region Modify Tooltips + public override void ModifyTooltips(Item item, List tooltips) + { + TooltipLine tt2 = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria"); + if (tt2 != null) + { + switch (postMoonLordRarity) + { + case 12: + tt2.overrideColor = new Color(0, 255, 200); + break; + case 13: + tt2.overrideColor = new Color(0, 255, 0); + break; + case 14: + tt2.overrideColor = new Color(43, 96, 222); + break; + case 15: + tt2.overrideColor = new Color(108, 45, 199); + break; + case 16: + tt2.overrideColor = new Color(255, 0, 255); + break; + case 17: //Legendary Weapons + if (item.type == mod.ItemType("Malachite")) + tt2.overrideColor = new Color(Main.DiscoR, 203, 103); + if (item.type == mod.ItemType("AegisBlade") || item.type == mod.ItemType("YharimsCrystal")) + tt2.overrideColor = new Color(255, Main.DiscoG, 53); + if (item.type == mod.ItemType("BrinyBaron")) + tt2.overrideColor = new Color(53, Main.DiscoG, 255); + if (item.type == mod.ItemType("CosmicDischarge")) + tt2.overrideColor = new Color(150, Main.DiscoG, 255); + if (item.type == mod.ItemType("BlossomFlux")) + tt2.overrideColor = new Color(Main.DiscoR, 203, 103); + if (item.type == mod.ItemType("SHPC")) + tt2.overrideColor = new Color(255, Main.DiscoG, 155); + if (item.type == mod.ItemType("Vesuvius")) + tt2.overrideColor = new Color(255, Main.DiscoG, 0); + break; + case 18: //Fabstaff + tt2.overrideColor = new Color(Main.DiscoR, 100, 255); + break; + case 19: //Blushie Staff + tt2.overrideColor = new Color(0, 0, 255); + break; + case 20: //Non-Expert Rainbow + tt2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + break; + 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; + } + } + if (item.type == ItemID.SuperAbsorbantSponge) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Capable of soaking up an endless amount of water\n" + + "Cannot be used in the Abyss"; + } + } + } + if (item.type == ItemID.EmptyBucket) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "1 defense\n" + + "Cannot be used in the Abyss"; + } + } + } + if (item.type == ItemID.CrimsonHeart) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Summons a heart to provide light\n" + + "Provides a small amount of light in the abyss"; + } + } + } + if (item.type == ItemID.ShadowOrb) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Creates a magical shadow orb\n" + + "Provides a small amount of light in the abyss"; + } + } + } + if (item.type == ItemID.MagicLantern) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Summons a magic lantern that exposes nearby treasure\n" + + "Provides a small amount of light in the abyss"; + } + } + } + if (item.type == ItemID.ArcticDivingGear) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Provides light under water and extra mobility on ice\n" + + "Provides a small amount of light in the abyss\n" + + "Moderately reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.JellyfishNecklace) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Provides light under water\n" + + "Provides a small amount of light in the abyss"; + } + } + } + if (item.type == ItemID.JellyfishDivingGear) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Provides light under water\n" + + "Provides a small amount of light in the abyss"; + } + } + } + if (item.type == ItemID.FairyBell) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Summons a magical fairy\n" + + "Provides a moderate amount of light in the abyss"; + } + } + } + if (item.type == ItemID.DD2PetGhost) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Summons a pet flickerwick to provide light\n" + + "Provides a moderate amount of light in the abyss"; + } + } + } + if (item.type == ItemID.ShinePotion) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "BuffTime") + { + line2.text = "5 minute duration\n" + + "Provides a moderate amount of light in the abyss"; + } + } + } + if (item.type == ItemID.WispinaBottle) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Summons a Wisp to provide light\n" + + "Provides a large amount of light in the abyss"; + } + } + } + if (item.type == ItemID.SuspiciousLookingTentacle) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "'I know what you're thinking...'\n" + + "Provides a large amount of light in the abyss"; + } + } + } + if (item.type == ItemID.GillsPotion) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "BuffTime") + { + line2.text = "2 minute duration\n" + + "Greatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.DivingHelmet) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Greatly extends underwater breathing\n" + + "Moderately reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.NeptunesShell) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Transforms the holder into merfolk when entering water\n" + + "Greatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.MoonShell) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Turns the holder into a werewolf at night and a merfolk when entering water\n" + + "Greatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.CelestialShell) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Minor increases to all stats\n" + + "Greatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.WormScarf) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Reduces damage taken by 10%"; + } + } + } + if (item.type == ItemID.SpectreHood) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% decreased magic damage"; + } + } + } + if (item.type == ItemID.ApprenticeHat) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries and reduces mana costs by 10%\n" + + "30% increased minion damage"; + } + } + } + if (item.type == ItemID.ApprenticeRobe) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "10% increased magic damage"; + } + } + } + if (item.type == ItemID.ApprenticeTrousers) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + } + } + if (item.type == ItemID.SquireGreatHelm) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries and increases your life regeneration\n" + + "30% increased minion damage and 20% increased melee critical strike chance"; + } + } + } + if (item.type == ItemID.SquirePlating) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "15% increased melee damage"; + } + } + } + if (item.type == ItemID.SquireGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + } + } + if (item.type == ItemID.HuntressWig) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries and increases ranged critical strike chance by 10%\n" + + "30% increased minion damage"; + } + } + } + if (item.type == ItemID.HuntressJerkin) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased ranged damage"; + } + } + } + if (item.type == ItemID.HuntressPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + } + } + if (item.type == ItemID.MonkBrows) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries and increases melee attack speed by 20%\n" + + "30% increased minion damage and 10% increased melee critical strike chance"; + } + } + } + if (item.type == ItemID.MonkShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased melee damage"; + } + } + } + if (item.type == ItemID.MonkPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = ""; + } + } + } + if (item.type == ItemID.ApprenticeAltHead) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "60% increased minion damage and 25% increased magic damage and critical strike chance"; + } + } + } + if (item.type == ItemID.ApprenticeAltShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = ""; + } + } + } + if (item.type == ItemID.ApprenticeAltPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = ""; + } + } + } + if (item.type == ItemID.MonkAltHead) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries\n" + + "Increases melee damage, speed, and critical strike chance by 20% and minion damage by 60%"; + } + } + } + if (item.type == ItemID.MonkAltShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = ""; + } + } + } + if (item.type == ItemID.MonkAltPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + } + } + if (item.type == ItemID.HuntressAltHead) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "60% increased minion damage and 10% increased ranged critical strike chance\n" + + "25% increased ranged damage"; + } + } + } + if (item.type == ItemID.HuntressAltShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = ""; + } + } + } + if (item.type == ItemID.HuntressAltPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% increased movement speed"; + } + } + } + if (item.type == ItemID.SquireAltHead) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of sentries and grants you 60% minion damage\n" + + "20% increased melee critical strike chance"; + } + } + } + if (item.type == ItemID.SquireAltShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Massively increased life regeneration"; + } + } + } + if (item.type == ItemID.SquireAltPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "30% increased movement speed"; + } + } + } + if (item.type == ItemID.ObsidianSkinPotion) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Provides immunity to direct damage from touching lava\n" + + "Provides temporary immunity to lava burn damage\n" + + "Reduces lava burn damage"; + } + } + } + if (item.type == ItemID.ObsidianRose) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Reduced direct damage from touching lava\n" + + "Greatly reduces lava burn damage"; + } + } + } + if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: Reduces the mana cost of the Space Gun by 50%"; + } + } + } + if (item.type == ItemID.CopperHelmet || item.type == ItemID.CopperChainmail || item.type == ItemID.CopperGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +2 defense and 15% increased mining speed"; + } + } + } + if (item.type == ItemID.TinHelmet || item.type == ItemID.TinChainmail || item.type == ItemID.TinGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +2 defense and 10% increased mining speed"; + } + } + } + if (item.type == ItemID.IronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +2 defense and 25% increased mining speed"; + } + } + } + if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 20% increased mining speed"; + } + } + } + if (item.type == ItemID.SilverHelmet || item.type == ItemID.SilverChainmail || item.type == ItemID.SilverGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 35% increased mining speed"; + } + } + } + if (item.type == ItemID.TungstenHelmet || item.type == ItemID.TungstenChainmail || item.type == ItemID.TungstenGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 30% increased mining speed"; + } + } + } + if (item.type == ItemID.GoldHelmet || item.type == ItemID.GoldChainmail || item.type == ItemID.GoldGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 45% increased mining speed"; + } + } + } + if (item.type == ItemID.PlatinumHelmet || item.type == ItemID.PlatinumChainmail || item.type == ItemID.PlatinumGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +4 defense and 40% increased mining speed"; + } + } + } + if (item.type == ItemID.GladiatorHelmet) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "4 defense\n" + + "5% increased rogue damage"; + } + } + } + if (item.type == ItemID.GladiatorBreastplate) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "7 defense\n" + + "5% increased rogue critical strike chance"; + } + } + } + if (item.type == ItemID.GladiatorLeggings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "5 defense\n" + + "5% increased rogue velocity"; + } + } + } + if (item.type == ItemID.ObsidianHelm) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "4 defense\n" + + "5% increased rogue damage"; + } + } + } + if (item.type == ItemID.ObsidianShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "5 defense\n" + + "5% increased rogue critical strike chance"; + } + } + } + if (item.type == ItemID.ObsidianPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "4 defense\n" + + "5% increased rogue velocity"; + } + } + } + if (item.type == ItemID.MagicQuiver) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases arrow damage by 10% and greatly increases arrow speed"; + } + } + } + if (item.type == ItemID.AngelWings || item.type == ItemID.DemonWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.25\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 100"; + } + } + } + if (item.type == ItemID.Jetpack) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 115"; + } + } + } + if (item.type == ItemID.ButterflyWings || item.type == ItemID.FairyWings || item.type == ItemID.BeeWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 130"; + } + } + } + if (item.type == ItemID.HarpyWings || item.type == ItemID.BoneWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 140"; + } + } + } + if (item.type == ItemID.FlameWings || item.type == ItemID.FrozenWings || item.type == ItemID.GhostWings || + item.type == ItemID.BeetleWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160"; + } + } + } + if (item.type == ItemID.FinWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 0\n" + + "Acceleration multiplier: 0\n" + + "Average vertical speed\n" + + "Flight time: 100"; + } + } + } + if (item.type == ItemID.FishronWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 8\n" + + "Acceleration multiplier: 2\n" + + "Good vertical speed\n" + + "Flight time: 180"; + } + } + } + if (item.type == ItemID.SteampunkWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 180"; + } + } + } + if (item.type == ItemID.LeafWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160"; + } + } + } + if (item.type == ItemID.BatWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 0\n" + + "Acceleration multiplier: 0\n" + + "Average vertical speed\n" + + "Flight time: 140"; + } + } + } + if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || + item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || + item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || + item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "'Great for impersonating devs!'\n" + + "Horizontal speed: 7\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 150"; + } + } + } + if (item.type == ItemID.TatteredFairyWings || item.type == ItemID.SpookyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 180"; + } + } + } + if (item.type == ItemID.Hoverboard) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.25\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 170"; + } + } + } + if (item.type == ItemID.FestiveWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 170"; + } + } + } + if (item.type == ItemID.MothronWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 0\n" + + "Acceleration multiplier: 0\n" + + "Average vertical speed\n" + + "Flight time: 160"; + } + } + } + if (item.type == ItemID.WingsSolar || item.type == ItemID.WingsStardust) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 9\n" + + "Acceleration multiplier: 2.5\n" + + "Great vertical speed\n" + + "Flight time: 180"; + } + } + } + if (item.type == ItemID.WingsVortex || item.type == ItemID.WingsNebula) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.5\n" + + "Acceleration multiplier: 1.5\n" + + "Good vertical speed\n" + + "Flight time: 160"; + } + } + } + if (item.type == ItemID.BetsyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Allows flight and slow fall\n" + + "Horizontal speed: 6\n" + + "Acceleration multiplier: 2.5\n" + + "Good vertical speed\n" + + "Flight time: 150"; + } + } + } + if (item.accessory) + { + if (item.prefix == 67) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") + { + line2.text = "+1% critical strike chance"; + } + } + } + if (item.prefix == 68) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") + { + line2.text = "+2% critical strike chance"; + } + } + } + if (item.prefix == 62) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + { + line2.text = "+1 defense\n" + + "+0.25% damage reduction"; + } + } + } + if (item.prefix == 63) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + { + line2.text = "+2 defense\n" + + "+0.5% damage reduction"; + } + } + } + if (item.prefix == 64) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + { + line2.text = "+3 defense\n" + + "+0.75% damage reduction"; + } + } + } + if (item.prefix == 65) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + { + line2.text = "+4 defense\n" + + "+1% damage reduction"; + } + } + } + } + } + #endregion + + #region BossBagChanges + public override void OpenVanillaBag(string context, Player player, int arg) + { + bool revenge = CalamityWorld.revenge; + bool defiled = CalamityWorld.defiled; + if (context == "bossBag") + { + switch (arg) + { + case ItemID.KingSlimeBossBag: + if (revenge) + player.QuickSpawnItem(mod.ItemType("CrownJewel")); + break; + case ItemID.EyeOfCthulhuBossBag: + player.QuickSpawnItem(mod.ItemType("VictoryShard"), Main.rand.Next(3, 6)); + if (Main.rand.Next(3) == 0) + player.QuickSpawnItem(mod.ItemType("TeardropCleaver")); + 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) + player.QuickSpawnItem(mod.ItemType("Meowthrower")); + if (Main.rand.Next(8) == 0) + player.QuickSpawnItem(mod.ItemType("RogueEmblem")); + if (Main.rand.Next(5) == 0) + { + switch (Main.rand.Next(2)) + { + case 0: + player.QuickSpawnItem(ItemID.CrimsonKey); + break; + case 1: + player.QuickSpawnItem(ItemID.CorruptionKey); + break; + } + } + break; + case ItemID.DestroyerBossBag: + if (revenge) + { + if (Main.rand.Next(100) == 0) + player.QuickSpawnItem(mod.ItemType("SHPC")); + else if (defiled) + { + if (Main.rand.Next(20) == 0) + player.QuickSpawnItem(mod.ItemType("SHPC")); + } + } + break; + case ItemID.PlanteraBossBag: + player.QuickSpawnItem(mod.ItemType("LivingShard"), Main.rand.Next(8, 12)); + if (Main.rand.Next(5) == 0) + player.QuickSpawnItem(ItemID.JungleKey); + if (revenge) + { + if (Main.rand.Next(100) == 0) + player.QuickSpawnItem(mod.ItemType("BlossomFlux")); + else if (defiled) + { + if (Main.rand.Next(20) == 0) + player.QuickSpawnItem(mod.ItemType("BlossomFlux")); + } + } + break; + case ItemID.GolemBossBag: + if (revenge) + { + if (Main.rand.Next(100) == 0) + player.QuickSpawnItem(mod.ItemType("AegisBlade")); + else if (defiled) + { + if (Main.rand.Next(20) == 0) + player.QuickSpawnItem(mod.ItemType("AegisBlade")); + } + } + break; + case ItemID.FishronBossBag: + if (revenge) + { + if (Main.rand.Next(100) == 0) + player.QuickSpawnItem(mod.ItemType("BrinyBaron")); + else if (defiled) + { + if (Main.rand.Next(20) == 0) + player.QuickSpawnItem(mod.ItemType("BrinyBaron")); + } + } + break; + case ItemID.BossBagBetsy: + if (revenge) + { + if (Main.rand.Next(100) == 0) + player.QuickSpawnItem(mod.ItemType("Vesuvius")); + else if (defiled) + { + if (Main.rand.Next(20) == 0) + player.QuickSpawnItem(mod.ItemType("Vesuvius")); + } + } + 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) + { + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + } + } + #endregion + + #region Armor Set Changes + public override string IsArmorSet(Item head, Item body, Item legs) + { + if (head.type == ItemID.CopperHelmet && body.type == ItemID.CopperChainmail && legs.type == ItemID.CopperGreaves) + return "Copper"; + if (head.type == ItemID.TinHelmet && body.type == ItemID.TinChainmail && legs.type == ItemID.TinGreaves) + return "Tin"; + if (head.type == ItemID.IronHelmet && body.type == ItemID.IronChainmail && legs.type == ItemID.IronGreaves) + return "Iron"; + if (head.type == ItemID.LeadHelmet && body.type == ItemID.LeadChainmail && legs.type == ItemID.LeadGreaves) + return "Lead"; + if (head.type == ItemID.SilverHelmet && body.type == ItemID.SilverChainmail && legs.type == ItemID.SilverGreaves) + return "Silver"; + if (head.type == ItemID.TungstenHelmet && body.type == ItemID.TungstenChainmail && legs.type == ItemID.TungstenGreaves) + return "Tungsten"; + if (head.type == ItemID.GoldHelmet && body.type == ItemID.GoldChainmail && legs.type == ItemID.GoldGreaves) + return "Gold"; + if (head.type == ItemID.PlatinumHelmet && body.type == ItemID.PlatinumChainmail && legs.type == ItemID.PlatinumGreaves) + return "Platinum"; + if (head.type == ItemID.GladiatorHelmet && body.type == ItemID.GladiatorBreastplate && legs.type == ItemID.GladiatorLeggings) + return "Gladiator"; + if (head.type == ItemID.ObsidianHelm && body.type == ItemID.ObsidianShirt && legs.type == ItemID.ObsidianPants) + return "Obsidian"; + if (head.type == ItemID.PumpkinHelmet && body.type == ItemID.PumpkinBreastplate && legs.type == ItemID.PumpkinLeggings) + return "PumpMyAssFull"; + return ""; + } + + public override void UpdateArmorSet(Player player, string set) + { + if (set == "Copper") + player.pickSpeed -= 0.15f; + else if (set == "Tin") + player.pickSpeed -= 0.1f; + else if (set == "Iron") + player.pickSpeed -= 0.25f; + else if (set == "Lead") + player.pickSpeed -= 0.2f; + else if (set == "Silver") + player.pickSpeed -= 0.35f; + else if (set == "Tungsten") + player.pickSpeed -= 0.3f; + else if (set == "Gold") + player.pickSpeed -= 0.45f; + else if (set == "Platinum") + player.pickSpeed -= 0.4f; + else if (set == "Gladiator") + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.rogueStealthMax = 1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.1f; + player.statDefense += 5; + player.setBonus = "+5 defense\n" + + "10% increased rogue damage and velocity\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + } + else if (set == "Obsidian") + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.rogueStealthMax = 1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; + player.statDefense += 3; + player.fireWalk = true; + player.lavaMax += 300; + player.setBonus = "+3 defense\n" + + "10% increased rogue damage and critical strike chance\n" + + "Grants immunity to fire blocks and temporary immunity to lava"; + } + else if (set == "PumpMyAssFull") + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + } + #endregion + + #region Equip Changes + public override void UpdateEquip(Item item, Player player) + { + #region Head + if (item.type == ItemID.SpectreHood) + player.magicDamage += 0.2f; + else if (item.type == ItemID.GladiatorHelmet || item.type == ItemID.ObsidianHelm) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + else if (item.type == ItemID.CrimsonHelmet) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; + else if (item.type == ItemID.ApprenticeHat) + player.minionDamage += 0.3f; + else if (item.type == ItemID.SquireGreatHelm) + { + player.minionDamage += 0.3f; + player.meleeCrit += 20; + } + else if (item.type == ItemID.HuntressWig) + player.minionDamage += 0.3f; + else if (item.type == ItemID.MonkBrows) + { + player.minionDamage += 0.3f; + player.meleeCrit += 10; + } + else if (item.type == ItemID.ApprenticeAltHead) + { + player.minionDamage += 0.5f; + player.magicDamage += 0.15f; + player.magicCrit += 25; + } + else if (item.type == ItemID.MonkAltHead) + { + player.minionDamage += 0.4f; + player.meleeSpeed += 0.2f; + player.meleeCrit += 20; + } + else if (item.type == ItemID.HuntressAltHead) + { + player.minionDamage += 0.5f; + player.rangedDamage += 0.25f; + } + else if (item.type == ItemID.SquireAltHead) + { + player.minionDamage += 0.5f; + player.meleeCrit += 20; + } + #endregion + + #region Body + if (item.type == ItemID.GladiatorBreastplate || item.type == ItemID.ObsidianShirt) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + else if (item.type == ItemID.CrimsonScalemail) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; + else if (item.type == ItemID.PalladiumBreastplate) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; + } + else if (item.type == ItemID.CobaltBreastplate) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + else if (item.type == ItemID.MythrilChainmail) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + else if (item.type == ItemID.OrichalcumBreastplate) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 6; + else if (item.type == ItemID.AdamantiteBreastplate) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.06f; + else if (item.type == ItemID.TitaniumBreastplate) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.04f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + } + else if (item.type == ItemID.HallowedPlateMail) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; + else if (item.type == ItemID.ChlorophytePlateMail) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; + } + else if (item.type == ItemID.Gi) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + } + else if (item.type == ItemID.ApprenticeRobe) + player.minionDamage -= 0.2f; + else if (item.type == ItemID.SquirePlating) + player.minionDamage -= 0.15f; + else if (item.type == ItemID.HuntressJerkin) + player.minionDamage -= 0.2f; + else if (item.type == ItemID.MonkShirt) + player.minionDamage -= 0.2f; + else if (item.type == ItemID.ApprenticeAltShirt) + { + player.minionDamage -= 0.3f; + player.magicDamage -= 0.15f; + } + else if (item.type == ItemID.MonkAltShirt) + { + player.minionDamage -= 0.2f; + player.meleeSpeed -= 0.2f; + } + else if (item.type == ItemID.HuntressAltShirt) + { + player.minionDamage -= 0.25f; + player.meleeSpeed -= 0.2f; + } + else if (item.type == ItemID.SquireAltShirt) + player.minionDamage -= 0.3f; + #endregion + + #region Legs + if (item.type == ItemID.GladiatorLeggings || item.type == ItemID.ObsidianPants) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity += 0.05f; + else if (item.type == ItemID.CrimsonGreaves) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; + else if (item.type == ItemID.PalladiumLeggings) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 1; + } + else if (item.type == ItemID.MythrilGreaves) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + else if (item.type == ItemID.AdamantiteLeggings) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 4; + else if (item.type == ItemID.TitaniumLeggings) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 3; + } + else if (item.type == ItemID.HallowedGreaves) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.07f; + else if (item.type == ItemID.ChlorophyteGreaves) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; + else if (item.type == ItemID.ApprenticeTrousers) + { + player.magicCrit -= 20; + player.moveSpeed += 0.2f; + } + else if (item.type == ItemID.SquireGreaves) + { + player.minionDamage -= 0.15f; + player.meleeCrit -= 20; + } + else if (item.type == ItemID.HuntressPants) + player.minionDamage -= 0.1f; + else if (item.type == ItemID.MonkPants) + { + player.minionDamage -= 0.1f; + player.meleeCrit -= 10; + } + else if (item.type == ItemID.ApprenticeAltPants) + { + player.minionDamage -= 0.2f; + player.magicCrit -= 25; + } + else if (item.type == ItemID.MonkAltPants) + { + player.minionDamage -= 0.2f; + player.meleeCrit -= 20; + } + else if (item.type == ItemID.HuntressAltPants) + player.minionDamage -= 0.25f; + if (item.type == ItemID.SquireAltPants) + { + player.minionDamage -= 0.2f; + player.meleeCrit -= 20; + } + #endregion + } + #endregion + + #region Accessory Changes + public override void UpdateAccessory(Item item, Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + + if (item.type == ItemID.JellyfishNecklace || item.type == ItemID.JellyfishDivingGear || item.type == ItemID.ArcticDivingGear) + modPlayer.jellyfishNecklace = true; + + if (item.type == ItemID.WormScarf) + player.endurance -= 0.07f; + + if (item.type == ItemID.AvengerEmblem) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; + if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell || (item.type == ItemID.MoonStone && !Main.dayTime) || + (item.type == ItemID.SunStone && Main.dayTime)) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; + } + if (item.type == ItemID.DestroyerEmblem) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; + } + if (item.type == ItemID.EyeoftheGolem) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 10; + if (item.type == ItemID.PutridScent) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + } + + if (item.prefix == 62) + player.endurance += 0.0025f; + if (item.prefix == 63) + player.endurance += 0.005f; + if (item.prefix == 64) + player.endurance += 0.0075f; + if (item.prefix == 65) + player.endurance += 0.01f; + if (item.prefix == 67) + { + player.meleeCrit -= 1; + player.rangedCrit -= 1; + player.magicCrit -= 1; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 1; + } + if (item.prefix == 68) + { + player.meleeCrit -= 2; + player.rangedCrit -= 2; + player.magicCrit -= 2; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 2; + } + if (item.prefix == 69) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.01f; + if (item.prefix == 70) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.02f; + if (item.prefix == 71) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; + if (item.prefix == 72) + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.04f; + } + #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); + if (flightSpeedMult > 1.2f) + flightSpeedMult = 1.2f; + + speed *= flightSpeedMult; + + float flightAccMult = 1f + + (modPlayer.draconicSurge ? 0.15f : 0f); + if (flightAccMult > 1.2f) + flightAccMult = 1.2f; + + 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 ? 10 : 0) + + (modPlayer.planteraLore ? 20 : 0) + + (modPlayer.polterghastLore ? 30 : 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?) + /// + /// The player using the item. + /// The type of dust to use. + /// The chance per frame to spawn the dust (0f-1f) + /// The minimum distance between the player and the dust + /// The maximum distance between the player and the dust + /// The minimum random rotation offset for the dust + /// The maximum random rotation offset for the dust + /// The minimum speed that the dust should travel + /// The maximum speed that the dust should travel + public static Dust MeleeDustHelper(Player player, int dustType, float chancePerFrame, float minDistance, float maxDistance, float minRandRot = -0.2f, float maxRandRot = 0.2f, float minSpeed = 0.9f, float maxSpeed = 1.1f) + { + if (Main.rand.NextFloat(1f) < chancePerFrame) + { + //Calculate values + //distance from player, + //the vector offset from the player center + //the vector between the pos and the player + float distance = Main.rand.NextFloat(minDistance, maxDistance); + Vector2 offset = (player.itemRotation - (MathHelper.PiOver4 * player.direction) + Main.rand.NextFloat(minRandRot, maxRandRot)).ToRotationVector2() * distance * player.direction; + Vector2 pos = player.Center + offset; + Vector2 vec = pos - player.Center; + //spawn the dust + Dust d = Dust.NewDustPerfect(pos, dustType); + //normalise vector and multiply by velocity magnitude + vec.Normalize(); + d.velocity = vec * Main.rand.NextFloat(minSpeed, maxSpeed); + return d; + } + return null; + } + } +} diff --git a/Items/ChaoswarpedSlashaxe.cs b/Items/ChaoswarpedSlashaxe.cs index bc322a1807..de05900f03 100644 --- a/Items/ChaoswarpedSlashaxe.cs +++ b/Items/ChaoswarpedSlashaxe.cs @@ -1,59 +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 -{ - public class ChaoswarpedSlashaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaoswarped Slashaxe"); - } - - public override void SetDefaults() - { - item.damage = 68; - item.melee = true; - item.width = 50; - item.height = 50; - item.useTime = 31; - item.useAnimation = 31; - item.useTurn = true; - item.axe = 40; - item.useStyle = 1; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 127); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - } -} \ No newline at end of file +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 +{ + public class ChaoswarpedSlashaxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaoswarped Slashaxe"); + } + + public override void SetDefaults() + { + item.damage = 68; + item.melee = true; + item.width = 50; + item.height = 50; + item.useTime = 31; + item.useAnimation = 31; + item.useTurn = true; + item.axe = 40; + item.useStyle = 1; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 9); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 127); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Items/CharredRelic.cs b/Items/CharredRelic.cs index 566fcf5a87..7f9f743cf1 100644 --- a/Items/CharredRelic.cs +++ b/Items/CharredRelic.cs @@ -1,36 +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 -{ - public class CharredRelic : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Charred Relic"); - Tooltip.SetDefault("Contains a small amount of brimstone"); - } - - public override void SetDefaults() - { - item.shoot = mod.ProjectileType("Brimgling"); - item.buffType = mod.BuffType("BrimlingBuff"); - item.rare = 4; - item.UseSound = SoundID.NPCHit51; - } - - 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 +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 +{ + public class CharredRelic : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Charred Relic"); + Tooltip.SetDefault("Contains a small amount of brimstone"); + } + + public override void SetDefaults() + { + item.shoot = mod.ProjectileType("Brimgling"); + item.buffType = mod.BuffType("BrimlingBuff"); + item.rare = 4; + item.UseSound = SoundID.NPCHit51; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } + } +} diff --git a/Items/CometShard.cs b/Items/CometShard.cs index d8b81c7a99..4d53bfc47a 100644 --- a/Items/CometShard.cs +++ b/Items/CometShard.cs @@ -1,69 +1,69 @@ -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 CometShard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Comet Shard"); - Tooltip.SetDefault("Permanently increases maximum mana by 50"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 5; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item29; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.cShard) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.ManaEffect(50); - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.cShard = true; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddIngredient(ItemID.FallenStar, 50); - recipe.AddIngredient(null, "Stardust", 150); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 CometShard : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet Shard"); + Tooltip.SetDefault("Permanently increases maximum mana by 50"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 5; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item29; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.cShard) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.ManaEffect(50); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.cShard = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 10); + recipe.AddIngredient(ItemID.FallenStar, 50); + recipe.AddIngredient(null, "Stardust", 150); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CoreofCalamity.cs b/Items/CoreofCalamity.cs index 1118aa06ed..0d32855b15 100644 --- a/Items/CoreofCalamity.cs +++ b/Items/CoreofCalamity.cs @@ -1,44 +1,44 @@ -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 -{ - public class CoreofCalamity : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Core of Calamity"); - } - - public override void SetDefaults() - { - item.width = 40; - item.height = 40; - item.maxStack = 99; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 8; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CoreofCinder", 5); - recipe.AddIngredient(null, "CoreofEleum", 5); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class CoreofCalamity : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Core of Calamity"); + } + + public override void SetDefaults() + { + item.width = 40; + item.height = 40; + item.maxStack = 99; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 8; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CoreofCinder", 5); + recipe.AddIngredient(null, "CoreofEleum", 5); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CoreofChaos.cs b/Items/CoreofChaos.cs index 0c00683ad9..d2b16184e1 100644 --- a/Items/CoreofChaos.cs +++ b/Items/CoreofChaos.cs @@ -1,46 +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 -{ - public class CoreofChaos : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Core of Chaos"); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.maxStack = 999; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 8; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofChaos"); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class CoreofChaos : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Core of Chaos"); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.maxStack = 999; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 8; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofChaos"); + recipe.AddIngredient(ItemID.Ectoplasm); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CoreofCinder.cs b/Items/CoreofCinder.cs index 083f12d93c..92c1ded8b4 100644 --- a/Items/CoreofCinder.cs +++ b/Items/CoreofCinder.cs @@ -1,46 +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 -{ - public class CoreofCinder : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Core of Sunlight"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.maxStack = 999; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 8; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.3f * num, 0.3f * num, 0.05f * num); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofCinder"); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class CoreofCinder : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Core of Sunlight"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.maxStack = 999; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 8; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.3f * num, 0.3f * num, 0.05f * num); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddIngredient(ItemID.Ectoplasm); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CoreofEleum.cs b/Items/CoreofEleum.cs index 53120799ec..ca6614c735 100644 --- a/Items/CoreofEleum.cs +++ b/Items/CoreofEleum.cs @@ -1,46 +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 -{ - public class CoreofEleum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Core of Eleum"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.maxStack = 999; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 8; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.15f * num, 0.05f * num, 0.5f * num); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofEleum"); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class CoreofEleum : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Core of Eleum"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.maxStack = 999; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 8; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.15f * num, 0.05f * num, 0.5f * num); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofEleum"); + recipe.AddIngredient(ItemID.Ectoplasm); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CosmicPlushie.cs b/Items/CosmicPlushie.cs index 5eb6b4ff81..554fd0179b 100644 --- a/Items/CosmicPlushie.cs +++ b/Items/CosmicPlushie.cs @@ -1,41 +1,41 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class CosmicPlushie : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Plushie"); - Tooltip.SetDefault("Summons the devourer of the cosmos...?\nSharp objects possibly included\nSuppresses friendly red devils"); - } - public override void SetDefaults() - { - item.damage = 0; - item.useStyle = 1; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.width = 28; - item.height = 36; - 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; - } - - public override void UseStyle(Player player) - { - if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - { - player.AddBuff(item.buffType, 15, true); - } - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class CosmicPlushie : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Plushie"); + Tooltip.SetDefault("Summons the devourer of the cosmos...?\nSharp objects possibly included\nSuppresses friendly red devils"); + } + public override void SetDefaults() + { + item.damage = 0; + item.useStyle = 1; + item.useAnimation = 20; + item.useTime = 20; + item.noMelee = true; + item.width = 28; + item.height = 36; + 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; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 15, true); + } + } + } +} diff --git a/Items/Cosmolight.cs b/Items/Cosmolight.cs index 9c0fb938ea..7862a0ac83 100644 --- a/Items/Cosmolight.cs +++ b/Items/Cosmolight.cs @@ -1,66 +1,66 @@ -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.NPCs; - -namespace CalamityMod.Items -{ - public class Cosmolight : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmolight"); - Tooltip.SetDefault("Changes night to day and vice versa"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item60; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return !CalamityGlobalNPC.AnyBossNPCS(); - } - - public override bool UseItem(Player player) - { - Main.time = 0.0; - Main.dayTime = !Main.dayTime; - if (Main.dayTime) - { - if (++Main.moonPhase >= 8) - { - Main.moonPhase = 0; - } - } - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Daylight"); - recipe.AddIngredient(null, "Moonlight"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.NPCs; + +namespace CalamityMod.Items +{ + public class Cosmolight : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmolight"); + Tooltip.SetDefault("Changes night to day and vice versa"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item60; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return !CalamityGlobalNPC.AnyBossNPCS(); + } + + public override bool UseItem(Player player) + { + Main.time = 0.0; + Main.dayTime = !Main.dayTime; + if (Main.dayTime) + { + if (++Main.moonPhase >= 8) + { + Main.moonPhase = 0; + } + } + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Daylight"); + recipe.AddIngredient(null, "Moonlight"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Crabulon/CrabulonBag.cs b/Items/Crabulon/CrabulonBag.cs index 57824ffdc2..b237d03d20 100644 --- a/Items/Crabulon/CrabulonBag.cs +++ b/Items/Crabulon/CrabulonBag.cs @@ -1,78 +1,78 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Crabulon -{ - public class CrabulonBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("CrabulonIdle"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("MushroomPlasmaRoot")); - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("CrabulonMask")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("HyphaeRod")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("MycelialClaws")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Mycoroot")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Fungicide")); - } - player.QuickSpawnItem(ItemID.GlowingMushroom, Main.rand.Next(25, 36)); - player.QuickSpawnItem(ItemID.MushroomGrassSeeds, Main.rand.Next(5, 11)); - player.QuickSpawnItem(mod.ItemType("FungalClump")); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Crabulon +{ + public class CrabulonBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("CrabulonIdle"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("MushroomPlasmaRoot")); + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("CrabulonMask")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("HyphaeRod")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("MycelialClaws")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Mycoroot")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Fungicide")); + } + player.QuickSpawnItem(ItemID.GlowingMushroom, Main.rand.Next(25, 36)); + player.QuickSpawnItem(ItemID.MushroomGrassSeeds, Main.rand.Next(5, 11)); + player.QuickSpawnItem(mod.ItemType("FungalClump")); + } + } +} diff --git a/Items/Crabulon/DecapoditaSprout.cs b/Items/Crabulon/DecapoditaSprout.cs index b9ac8707e1..4569fdd547 100644 --- a/Items/Crabulon/DecapoditaSprout.cs +++ b/Items/Crabulon/DecapoditaSprout.cs @@ -1,51 +1,51 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Crabulon -{ - public class DecapoditaSprout : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Decapodita Sprout"); - Tooltip.SetDefault("Summons Crabulon"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 2; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneGlowshroom && !NPC.AnyNPCs(mod.NPCType("CrabulonIdle")); - } - - public override bool UseItem(Player player) - { - if (Main.netMode != 1) - { - NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-50, 51))), (int)(player.position.Y - 50f), mod.NPCType("CrabulonIdle"), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(SoundID.Roar, player.position, 0); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GlowingMushroom, 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Crabulon +{ + public class DecapoditaSprout : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Decapodita Sprout"); + Tooltip.SetDefault("Summons Crabulon"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 2; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneGlowshroom && !NPC.AnyNPCs(mod.NPCType("CrabulonIdle")); + } + + public override bool UseItem(Player player) + { + if (Main.netMode != 1) + { + NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-50, 51))), (int)(player.position.Y - 50f), mod.NPCType("CrabulonIdle"), 0, 0f, 0f, 0f, 0f, 255); + Main.PlaySound(SoundID.Roar, player.position, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GlowingMushroom, 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Crabulon/FungalClump.cs b/Items/Crabulon/FungalClump.cs index 4091e73d01..6f972cb3ef 100644 --- a/Items/Crabulon/FungalClump.cs +++ b/Items/Crabulon/FungalClump.cs @@ -1,64 +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.Crabulon -{ - public class FungalClump : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fungal Clump"); - Tooltip.SetDefault("Summons a fungal clump to fight for you\n" + - "The clump latches onto enemies and steals their life for you"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.fungalClump) - { - return false; - } - return true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fungalClump = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("FungalClump")) == -1) - { - player.AddBuff(mod.BuffType("FungalClump"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("FungalClump"), (int)(10f * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); - } - } - } - } -} \ No newline at end of file +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.Crabulon +{ + public class FungalClump : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fungal Clump"); + Tooltip.SetDefault("Summons a fungal clump to fight for you\n" + + "The clump latches onto enemies and steals their life for you"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 26; + item.value = Item.buyPrice(0, 9, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.fungalClump) + { + return false; + } + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fungalClump = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("FungalClump")) == -1) + { + player.AddBuff(mod.BuffType("FungalClump"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("FungalClump")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("FungalClump"), (int)(10f * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); + } + } + } + } +} diff --git a/Items/CruptixBar.cs b/Items/CruptixBar.cs index 722c16b7e1..d1867f465c 100644 --- a/Items/CruptixBar.cs +++ b/Items/CruptixBar.cs @@ -1,37 +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 -{ - public class CruptixBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaotic Bar"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 8; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ChaoticOre", 5); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class CruptixBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaotic Bar"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 8; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ChaoticOre", 5); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Cryogen/CryoBar.cs b/Items/Cryogen/CryoBar.cs index 3fb48cf8ea..d64c71b9c8 100644 --- a/Items/Cryogen/CryoBar.cs +++ b/Items/Cryogen/CryoBar.cs @@ -1,29 +1,29 @@ -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.Cryogen -{ - public class CryoBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frigid Bar"); - Tooltip.SetDefault("Cold to the touch"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} \ No newline at end of file +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.Cryogen +{ + public class CryoBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frigid Bar"); + Tooltip.SetDefault("Cold to the touch"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + } +} diff --git a/Items/Cryogen/CryoKey.cs b/Items/Cryogen/CryoKey.cs index e153ed2115..1ae26468e0 100644 --- a/Items/Cryogen/CryoKey.cs +++ b/Items/Cryogen/CryoKey.cs @@ -1,51 +1,51 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Cryogen -{ - public class CryoKey : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryo Key"); - Tooltip.SetDefault("Summons Cryogen"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 5; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneSnow && !NPC.AnyNPCs(mod.NPCType("Cryogen")); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Cryogen")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IceBlock, 50); - recipe.AddIngredient(ItemID.SoulofNight, 3); - recipe.AddIngredient(ItemID.SoulofLight, 3); - recipe.AddIngredient(null, "EssenceofEleum", 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Cryogen +{ + public class CryoKey : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryo Key"); + Tooltip.SetDefault("Summons Cryogen"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 5; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneSnow && !NPC.AnyNPCs(mod.NPCType("Cryogen")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Cryogen")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IceBlock, 50); + recipe.AddIngredient(ItemID.SoulofNight, 3); + recipe.AddIngredient(ItemID.SoulofLight, 3); + recipe.AddIngredient(null, "EssenceofEleum", 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Cryogen/CryoStone.cs b/Items/Cryogen/CryoStone.cs index 8ace9c4d9a..fc8a8395e4 100644 --- a/Items/Cryogen/CryoStone.cs +++ b/Items/Cryogen/CryoStone.cs @@ -1,44 +1,44 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Cryogen -{ - public class CryoStone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryo Stone"); - Tooltip.SetDefault("One of the ancient relics\n" + - "Increases damage reduction by 5% and all damage by 3%"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.defense = 6; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.25f, 0.6f); - player.endurance += 0.05f; - player.meleeDamage += 0.03f; - player.magicDamage += 0.03f; - player.rangedDamage += 0.03f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; - player.minionDamage += 0.03f; - } - } -} +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Cryogen +{ + public class CryoStone : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryo Stone"); + Tooltip.SetDefault("One of the ancient relics\n" + + "Increases damage reduction by 5% and all damage by 3%"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.defense = 6; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.25f, 0.6f); + player.endurance += 0.05f; + player.meleeDamage += 0.03f; + player.magicDamage += 0.03f; + player.rangedDamage += 0.03f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.03f; + player.minionDamage += 0.03f; + } + } +} diff --git a/Items/Cryogen/CryogenBag.cs b/Items/Cryogen/CryogenBag.cs index dc8fdef17d..733d9a2ea0 100644 --- a/Items/Cryogen/CryogenBag.cs +++ b/Items/Cryogen/CryogenBag.cs @@ -1,105 +1,105 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Cryogen -{ - public class CryogenBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("Cryogen"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("FrostFlare")); - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("CryogenMask")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("GlacialCrusher")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Avalanche")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("BittercoldStaff")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("IceStar"), Main.rand.Next(150, 201)); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("EffluviumBow")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Icebreaker")); - } - if (Main.rand.Next(3) == 0) - { - 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); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(mod.ItemType("CryoStone")); - } - player.QuickSpawnItem(ItemID.SoulofMight, Main.rand.Next(25, 41)); - player.QuickSpawnItem(mod.ItemType("CryoBar"), Main.rand.Next(20, 41)); - player.QuickSpawnItem(mod.ItemType("EssenceofEleum"), Main.rand.Next(5, 10)); - player.QuickSpawnItem(mod.ItemType("SoulofCryogen")); - player.QuickSpawnItem(ItemID.FrostCore); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Cryogen +{ + public class CryogenBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("Cryogen"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("FrostFlare")); + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("CryogenMask")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("GlacialCrusher")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Avalanche")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("BittercoldStaff")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("IceStar"), Main.rand.Next(150, 201)); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("EffluviumBow")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Icebreaker")); + } + if (Main.rand.Next(3) == 0) + { + 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); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(mod.ItemType("CryoStone")); + } + player.QuickSpawnItem(ItemID.SoulofMight, Main.rand.Next(25, 41)); + player.QuickSpawnItem(mod.ItemType("CryoBar"), Main.rand.Next(20, 41)); + player.QuickSpawnItem(mod.ItemType("EssenceofEleum"), Main.rand.Next(5, 10)); + player.QuickSpawnItem(mod.ItemType("SoulofCryogen")); + player.QuickSpawnItem(ItemID.FrostCore); + } + } +} diff --git a/Items/Cryogen/SoulofCryogen.cs b/Items/Cryogen/SoulofCryogen.cs index 485fc3313b..537abf7e99 100644 --- a/Items/Cryogen/SoulofCryogen.cs +++ b/Items/Cryogen/SoulofCryogen.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Cryogen -{ - [AutoloadEquip(EquipType.Wings)] - public class SoulofCryogen : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul of Cryogen"); - Tooltip.SetDefault("The magic of the ancient ice castle is yours\n" + - "Counts as wings\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "5% increase to all damage and pick speed\n" + - "All melee attacks and projectiles inflict frostburn"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 39, 99, 99); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed *= 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0f * num, 0.3f * num, 0.3f * num); - } - - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.5f; - ascentWhenRising = 0.1f; - maxCanAscendMultiplier = 0.5f; - maxAscentMultiplier = 1.5f; - constantAscend = 0.1f; - } - - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 6.25f; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - CalamityCustomThrowingDamagePlayer modPlayer2 = CalamityCustomThrowingDamagePlayer.ModPlayer(player); - modPlayer.cryogenSoul = true; - player.pickSpeed -= 0.05f; - player.magicDamage += 0.05f; - player.rangedDamage += 0.05f; - player.meleeDamage += 0.05f; - player.minionDamage += 0.05f; - modPlayer2.throwingDamage += 0.05f; - player.wingTimeMax = 100; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Cryogen +{ + [AutoloadEquip(EquipType.Wings)] + public class SoulofCryogen : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul of Cryogen"); + Tooltip.SetDefault("The magic of the ancient ice castle is yours\n" + + "Counts as wings\n" + + "Horizontal speed: 6.25\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 100\n" + + "5% increase to all damage and pick speed\n" + + "All melee attacks and projectiles inflict frostburn"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 39, 99, 99); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed *= 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0f * num, 0.3f * num, 0.3f * num); + } + + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + ascentWhenFalling = 0.5f; + ascentWhenRising = 0.1f; + maxCanAscendMultiplier = 0.5f; + maxAscentMultiplier = 1.5f; + constantAscend = 0.1f; + } + + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 6.25f; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityCustomThrowingDamagePlayer modPlayer2 = CalamityCustomThrowingDamagePlayer.ModPlayer(player); + modPlayer.cryogenSoul = true; + player.pickSpeed -= 0.05f; + player.magicDamage += 0.05f; + player.rangedDamage += 0.05f; + player.meleeDamage += 0.05f; + player.minionDamage += 0.05f; + modPlayer2.throwingDamage += 0.05f; + player.wingTimeMax = 100; + } + } +} diff --git a/Items/CrystylCrusher.cs b/Items/CrystylCrusher.cs index 3276103879..54b76b1e4b 100644 --- a/Items/CrystylCrusher.cs +++ b/Items/CrystylCrusher.cs @@ -1,72 +1,72 @@ -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 -{ - public class CrystylCrusher : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystyl Crusher"); - Tooltip.SetDefault("Gotta dig faster, gotta go deeper"); - } - - public override void SetDefaults() - { - item.damage = 255; - item.melee = true; - item.width = 70; - item.height = 70; - item.useTime = 1; - item.useAnimation = 30; - item.useTurn = true; - item.pick = 5000; - item.useStyle = 1; - item.knockBack = 9f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.tileBoost += 50; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GallantPickaxe"); - recipe.AddIngredient(null, "BlossomPickaxe"); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(3) == 0) - { - int num307 = Main.rand.Next(3); - if (num307 == 0) - { - num307 = 173; - } - else if (num307 == 1) - { - num307 = 57; - } - else - { - num307 = 58; - } - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, num307); - } - } - } -} \ No newline at end of file +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 +{ + public class CrystylCrusher : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystyl Crusher"); + Tooltip.SetDefault("Gotta dig faster, gotta go deeper"); + } + + public override void SetDefaults() + { + item.damage = 255; + item.melee = true; + item.width = 70; + item.height = 70; + item.useTime = 1; + item.useAnimation = 30; + item.useTurn = true; + item.pick = 5000; + item.useStyle = 1; + item.knockBack = 9f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.tileBoost += 50; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GallantPickaxe"); + recipe.AddIngredient(null, "BlossomPickaxe"); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(3) == 0) + { + int num307 = Main.rand.Next(3); + if (num307 == 0) + { + num307 = 173; + } + else if (num307 == 1) + { + num307 = 57; + } + else + { + num307 = 58; + } + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, num307); + } + } + } +} diff --git a/Items/DarksunFragment.cs b/Items/DarksunFragment.cs index a730792010..af232da0d4 100644 --- a/Items/DarksunFragment.cs +++ b/Items/DarksunFragment.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.Items; - -namespace CalamityMod.Items -{ - public class DarksunFragment : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Darksun Fragment"); - Tooltip.SetDefault("A shard of lunar and solar energy"); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.5f * num, 0.5f * num); - } - - public override void SetDefaults() - { - 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; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + public class DarksunFragment : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Darksun Fragment"); + Tooltip.SetDefault("A shard of lunar and solar energy"); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.5f * num, 0.5f * num); + } + + public override void SetDefaults() + { + 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/Daylight.cs b/Items/Daylight.cs index 192f9c9d9a..df3e1131e8 100644 --- a/Items/Daylight.cs +++ b/Items/Daylight.cs @@ -1,58 +1,58 @@ -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.NPCs; - -namespace CalamityMod.Items -{ - public class Daylight : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daylight"); - Tooltip.SetDefault("Summons the sun"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item60; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); - } - - public override bool UseItem(Player player) - { - Main.dayTime = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofLight, 7); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.NPCs; + +namespace CalamityMod.Items +{ + public class Daylight : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daylight"); + Tooltip.SetDefault("Summons the sun"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item60; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); + } + + public override bool UseItem(Player player) + { + Main.dayTime = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofLight, 7); + recipe.AddIngredient(ItemID.HellstoneBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DemonicBoneAsh.cs b/Items/DemonicBoneAsh.cs index af3c0d7464..761f3cfdac 100644 --- a/Items/DemonicBoneAsh.cs +++ b/Items/DemonicBoneAsh.cs @@ -1,28 +1,28 @@ -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 -{ - public class DemonicBoneAsh : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demonic Bone Ash"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 3; - } - } -} \ No newline at end of file +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 +{ + public class DemonicBoneAsh : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demonic Bone Ash"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 3; + } + } +} diff --git a/Items/DesertFeather.cs b/Items/DesertFeather.cs index b5a294b974..f2e332c7fc 100644 --- a/Items/DesertFeather.cs +++ b/Items/DesertFeather.cs @@ -1,28 +1,28 @@ -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 -{ - public class DesertFeather : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Feather"); - } - - public override void SetDefaults() - { - item.width = 24; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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 +{ + public class DesertFeather : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Feather"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/DesertScourge/AeroStone.cs b/Items/DesertScourge/AeroStone.cs index 51e2f669ce..75ac26fa09 100644 --- a/Items/DesertScourge/AeroStone.cs +++ b/Items/DesertScourge/AeroStone.cs @@ -1,43 +1,43 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.DesertScourge -{ - public class AeroStone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aero Stone"); - Tooltip.SetDefault("One of the ancient relics\n" + - "Increases movement speed by 10%, jump speed by 200%, and all damage by 3%"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityCustomThrowingDamagePlayer modPlayer = CalamityCustomThrowingDamagePlayer.ModPlayer(player); - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.425f, 0.425f); - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 2.0f; - player.meleeDamage += 0.03f; - player.magicDamage += 0.03f; - player.rangedDamage += 0.03f; - modPlayer.throwingDamage += 0.03f; - player.minionDamage += 0.03f; - } - } -} +using System; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.DesertScourge +{ + public class AeroStone : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aero Stone"); + Tooltip.SetDefault("One of the ancient relics\n" + + "Increases movement speed by 10%, jump speed by 200%, and all damage by 3%"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityCustomThrowingDamagePlayer modPlayer = CalamityCustomThrowingDamagePlayer.ModPlayer(player); + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.425f, 0.425f); + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 2.0f; + player.meleeDamage += 0.03f; + player.magicDamage += 0.03f; + player.rangedDamage += 0.03f; + modPlayer.throwingDamage += 0.03f; + player.minionDamage += 0.03f; + } + } +} diff --git a/Items/DesertScourge/DesertScourgeBag.cs b/Items/DesertScourge/DesertScourgeBag.cs index 70c7f0940f..34aca61ecd 100644 --- a/Items/DesertScourge/DesertScourgeBag.cs +++ b/Items/DesertScourge/DesertScourgeBag.cs @@ -1,157 +1,157 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.DesertScourge -{ - public class DesertScourgeBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("DesertScourgeHead"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("DesertScourgeMask")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("SeaboundStaff")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("StormSpray")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Barinade")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("AquaticDischarge")); - } - if (Main.rand.Next(12) == 0) - { - player.QuickSpawnItem(ItemID.HighTestFishingLine); - } - if (Main.rand.Next(12) == 0) - { - player.QuickSpawnItem(ItemID.AnglerTackleBag); - } - if (Main.rand.Next(12) == 0) - { - player.QuickSpawnItem(ItemID.TackleBox); - } - if (Main.rand.Next(9) == 0) - { - player.QuickSpawnItem(ItemID.AnglerEarring); - } - if (Main.rand.Next(9) == 0) - { - player.QuickSpawnItem(ItemID.FishermansGuide); - } - if (Main.rand.Next(9) == 0) - { - player.QuickSpawnItem(ItemID.WeatherRadio); - } - if (Main.rand.Next(9) == 0) - { - player.QuickSpawnItem(ItemID.Sextant); - } - if (Main.rand.Next(4) == 0) - { - player.QuickSpawnItem(ItemID.AnglerHat); - } - if (Main.rand.Next(4) == 0) - { - player.QuickSpawnItem(ItemID.AnglerVest); - } - if (Main.rand.Next(4) == 0) - { - player.QuickSpawnItem(ItemID.AnglerPants); - } - if (Main.rand.Next(4) == 0) - { - player.QuickSpawnItem(ItemID.CratePotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(4) == 0) - { - player.QuickSpawnItem(ItemID.FishingPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(4) == 0) - { - player.QuickSpawnItem(ItemID.SonarPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(9) == 0) - { - 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(18) == 0) - { - player.QuickSpawnItem(ItemID.GoldenBugNet); - } - } - player.QuickSpawnItem(mod.ItemType("OceanCrest")); - player.QuickSpawnItem(mod.ItemType("VictoryShard"), Main.rand.Next(10, 17)); - player.QuickSpawnItem(ItemID.Coral, Main.rand.Next(7, 12)); - player.QuickSpawnItem(ItemID.Seashell, Main.rand.Next(7, 12)); - player.QuickSpawnItem(ItemID.Starfish, Main.rand.Next(7, 12)); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.DesertScourge +{ + public class DesertScourgeBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("DesertScourgeHead"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("DesertScourgeMask")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("SeaboundStaff")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("StormSpray")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Barinade")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("AquaticDischarge")); + } + if (Main.rand.Next(12) == 0) + { + player.QuickSpawnItem(ItemID.HighTestFishingLine); + } + if (Main.rand.Next(12) == 0) + { + player.QuickSpawnItem(ItemID.AnglerTackleBag); + } + if (Main.rand.Next(12) == 0) + { + player.QuickSpawnItem(ItemID.TackleBox); + } + if (Main.rand.Next(9) == 0) + { + player.QuickSpawnItem(ItemID.AnglerEarring); + } + if (Main.rand.Next(9) == 0) + { + player.QuickSpawnItem(ItemID.FishermansGuide); + } + if (Main.rand.Next(9) == 0) + { + player.QuickSpawnItem(ItemID.WeatherRadio); + } + if (Main.rand.Next(9) == 0) + { + player.QuickSpawnItem(ItemID.Sextant); + } + if (Main.rand.Next(4) == 0) + { + player.QuickSpawnItem(ItemID.AnglerHat); + } + if (Main.rand.Next(4) == 0) + { + player.QuickSpawnItem(ItemID.AnglerVest); + } + if (Main.rand.Next(4) == 0) + { + player.QuickSpawnItem(ItemID.AnglerPants); + } + if (Main.rand.Next(4) == 0) + { + player.QuickSpawnItem(ItemID.CratePotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(4) == 0) + { + player.QuickSpawnItem(ItemID.FishingPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(4) == 0) + { + player.QuickSpawnItem(ItemID.SonarPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(9) == 0) + { + 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(18) == 0) + { + player.QuickSpawnItem(ItemID.GoldenBugNet); + } + } + player.QuickSpawnItem(mod.ItemType("OceanCrest")); + player.QuickSpawnItem(mod.ItemType("VictoryShard"), Main.rand.Next(10, 17)); + player.QuickSpawnItem(ItemID.Coral, Main.rand.Next(7, 12)); + player.QuickSpawnItem(ItemID.Seashell, Main.rand.Next(7, 12)); + player.QuickSpawnItem(ItemID.Starfish, Main.rand.Next(7, 12)); + } + } +} diff --git a/Items/DesertScourge/DriedSeafood.cs b/Items/DesertScourge/DriedSeafood.cs index d40401d8f6..44ca1e5172 100644 --- a/Items/DesertScourge/DriedSeafood.cs +++ b/Items/DesertScourge/DriedSeafood.cs @@ -1,58 +1,58 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Items.DesertScourge -{ - public class DriedSeafood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Medallion"); - Tooltip.SetDefault("The desert sand stirs...\n" + - "Summons the Desert Scourge"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.maxStack = 20; - item.rare = 2; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneDesert && !NPC.AnyNPCs(mod.NPCType("DesertScourgeHead")); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHead")); - if (CalamityWorld.revenge) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); - } - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SandBlock, 15); - recipe.AddIngredient(ItemID.AntlionMandible, 3); - recipe.AddIngredient(ItemID.Cactus, 10); - recipe.AddIngredient(null, "StormlionMandible"); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Items.DesertScourge +{ + public class DriedSeafood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Medallion"); + Tooltip.SetDefault("The desert sand stirs...\n" + + "Summons the Desert Scourge"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.maxStack = 20; + item.rare = 2; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneDesert && !NPC.AnyNPCs(mod.NPCType("DesertScourgeHead")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHead")); + if (CalamityWorld.revenge) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DesertScourgeHeadSmall")); + } + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SandBlock, 15); + recipe.AddIngredient(ItemID.AntlionMandible, 3); + recipe.AddIngredient(ItemID.Cactus, 10); + recipe.AddIngredient(null, "StormlionMandible"); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DesertScourge/OceanCrest.cs b/Items/DesertScourge/OceanCrest.cs index fcc698a2e4..4e9892e325 100644 --- a/Items/DesertScourge/OceanCrest.cs +++ b/Items/DesertScourge/OceanCrest.cs @@ -1,40 +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.DesertScourge -{ - public class OceanCrest : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ocean Crest"); - Tooltip.SetDefault("Most ocean enemies become friendly and provides waterbreathing"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 9; - item.accessory = true; - item.expert = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.npcTypeNoAggro[65] = true; - player.npcTypeNoAggro[220] = true; - player.npcTypeNoAggro[64] = true; - player.npcTypeNoAggro[67] = true; - player.npcTypeNoAggro[221] = true; - player.gills = true; - } - } -} \ No newline at end of file +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.DesertScourge +{ + public class OceanCrest : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ocean Crest"); + Tooltip.SetDefault("Most ocean enemies become friendly and provides waterbreathing"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 26; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 9; + item.accessory = true; + item.expert = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.npcTypeNoAggro[65] = true; + player.npcTypeNoAggro[220] = true; + player.npcTypeNoAggro[64] = true; + player.npcTypeNoAggro[67] = true; + player.npcTypeNoAggro[221] = true; + player.gills = true; + } + } +} diff --git a/Items/DesertScourge/VictoryShard.cs b/Items/DesertScourge/VictoryShard.cs index b8bc40ef5a..c8ec551990 100644 --- a/Items/DesertScourge/VictoryShard.cs +++ b/Items/DesertScourge/VictoryShard.cs @@ -1,28 +1,28 @@ -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.DesertScourge -{ - public class VictoryShard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victory Shard"); - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 14; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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.DesertScourge +{ + public class VictoryShard : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victory Shard"); + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 14; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/DevourerMunsters/ArmoredShell.cs b/Items/DevourerMunsters/ArmoredShell.cs index 7ece9551bd..fa9bd83fe4 100644 --- a/Items/DevourerMunsters/ArmoredShell.cs +++ b/Items/DevourerMunsters/ArmoredShell.cs @@ -1,28 +1,28 @@ -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.DevourerMunsters -{ - public class ArmoredShell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armored Shell"); - } - - public override void SetDefaults() - { - item.width = 24; - item.height = 30; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - } -} \ No newline at end of file +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.DevourerMunsters +{ + public class ArmoredShell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Armored Shell"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 30; + item.maxStack = 999; + item.value = Item.buyPrice(0, 7, 0, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + } +} diff --git a/Items/DevourerMunsters/DarkPlasma.cs b/Items/DevourerMunsters/DarkPlasma.cs index 787677adfb..ac3a2c1e93 100644 --- a/Items/DevourerMunsters/DarkPlasma.cs +++ b/Items/DevourerMunsters/DarkPlasma.cs @@ -1,37 +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.DevourerMunsters -{ - public class DarkPlasma : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Plasma"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 8)); - } - - public override void SetDefaults() - { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0f * num, 0.45f * num, 0.7f * num); - } - } -} \ No newline at end of file +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.DevourerMunsters +{ + public class DarkPlasma : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Plasma"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 8)); + } + + public override void SetDefaults() + { + item.width = 15; + item.height = 12; + item.maxStack = 999; + item.value = Item.buyPrice(0, 7, 0, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0f * num, 0.45f * num, 0.7f * num); + } + } +} diff --git a/Items/DevourerMunsters/RuneofCos.cs b/Items/DevourerMunsters/RuneofCos.cs index f0830ee3f0..ff6b255c6f 100644 --- a/Items/DevourerMunsters/RuneofCos.cs +++ b/Items/DevourerMunsters/RuneofCos.cs @@ -1,74 +1,74 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.DevourerMunsters -{ - public class RuneofCos : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rune of Kos"); - Tooltip.SetDefault("A relic of the profaned flame\n" + - "Contains the power hunted relentlessly by the sentinels of the cosmic devourer\n" + - "When used in certain areas of the world it will unleash them\n" + - "Not consumable"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.rare = 9; - item.UseSound = SoundID.Item44; - item.consumable = false; - item.shoot = mod.ProjectileType("VoidSpawn"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool CanUseItem(Player player) - { - return (player.ZoneSkyHeight || player.ZoneUnderworldHeight || player.ZoneDungeon) && - (!NPC.AnyNPCs(mod.NPCType("StormWeaverHead")) && !NPC.AnyNPCs(mod.NPCType("StormWeaverHeadNaked")) && !NPC.AnyNPCs(mod.NPCType("CeaselessVoid")) && !NPC.AnyNPCs(mod.NPCType("CosmicWraith"))); - } - - public override bool UseItem(Player player) - { - if (player.ZoneDungeon) - { - for (int num662 = 0; num662 < 2; num662++) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("DarkEnergySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - } - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CeaselessVoid")); - } - else if (player.ZoneUnderworldHeight) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CosmicWraith")); - } - else if (player.ZoneSkyHeight) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("StormWeaverHead")); - } - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyEssence", 40); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddIngredient(ItemID.FragmentSolar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.DevourerMunsters +{ + public class RuneofCos : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rune of Kos"); + Tooltip.SetDefault("A relic of the profaned flame\n" + + "Contains the power hunted relentlessly by the sentinels of the cosmic devourer\n" + + "When used in certain areas of the world it will unleash them\n" + + "Not consumable"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.rare = 9; + item.UseSound = SoundID.Item44; + item.consumable = false; + item.shoot = mod.ProjectileType("VoidSpawn"); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + return (player.ZoneSkyHeight || player.ZoneUnderworldHeight || player.ZoneDungeon) && + (!NPC.AnyNPCs(mod.NPCType("StormWeaverHead")) && !NPC.AnyNPCs(mod.NPCType("StormWeaverHeadNaked")) && !NPC.AnyNPCs(mod.NPCType("CeaselessVoid")) && !NPC.AnyNPCs(mod.NPCType("CosmicWraith"))); + } + + public override bool UseItem(Player player) + { + if (player.ZoneDungeon) + { + for (int num662 = 0; num662 < 2; num662++) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("DarkEnergySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); + } + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CeaselessVoid")); + } + else if (player.ZoneUnderworldHeight) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CosmicWraith")); + } + else if (player.ZoneSkyHeight) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("StormWeaverHead")); + } + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyEssence", 40); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddIngredient(ItemID.FragmentSolar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DevourerMunsters/TwistingNether.cs b/Items/DevourerMunsters/TwistingNether.cs index d1deeec6ff..1ddf5c3054 100644 --- a/Items/DevourerMunsters/TwistingNether.cs +++ b/Items/DevourerMunsters/TwistingNether.cs @@ -1,37 +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.DevourerMunsters -{ - public class TwistingNether : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Twisting Nether"); - } - - public override void SetDefaults() - { - 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; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.1f * num, 0.7f * num); - } - } -} \ No newline at end of file +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.DevourerMunsters +{ + public class TwistingNether : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Twisting Nether"); + } + + public override void SetDefaults() + { + 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; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.1f * num, 0.7f * num); + } + } +} diff --git a/Items/DifficultyItems/Armageddon.cs b/Items/DifficultyItems/Armageddon.cs index efaa8f0efd..b0ad348840 100644 --- a/Items/DifficultyItems/Armageddon.cs +++ b/Items/DifficultyItems/Armageddon.cs @@ -89,4 +89,4 @@ namespace CalamityMod.Items.DifficultyItems recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/DifficultyItems/Death.cs b/Items/DifficultyItems/Death.cs index a69393acfc..423b4469d9 100644 --- a/Items/DifficultyItems/Death.cs +++ b/Items/DifficultyItems/Death.cs @@ -98,4 +98,4 @@ namespace CalamityMod.Items.DifficultyItems recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/DifficultyItems/DefiledRune.cs b/Items/DifficultyItems/DefiledRune.cs index ebde8c7e0a..4bc3d17543 100644 --- a/Items/DifficultyItems/DefiledRune.cs +++ b/Items/DifficultyItems/DefiledRune.cs @@ -99,4 +99,4 @@ namespace CalamityMod.Items.DifficultyItems recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/DifficultyItems/MLGRune.cs b/Items/DifficultyItems/MLGRune.cs index 26218b7130..8f8041641f 100644 --- a/Items/DifficultyItems/MLGRune.cs +++ b/Items/DifficultyItems/MLGRune.cs @@ -38,4 +38,4 @@ namespace CalamityMod.Items.DifficultyItems return true; } } -} \ No newline at end of file +} diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index 05895534f7..cb82586509 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -146,4 +146,4 @@ namespace CalamityMod.Items.DifficultyItems recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/DimensionalSoulArtifact.cs b/Items/DimensionalSoulArtifact.cs index 4c754401d8..ef4c413b2a 100644 --- a/Items/DimensionalSoulArtifact.cs +++ b/Items/DimensionalSoulArtifact.cs @@ -1,49 +1,49 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class DimensionalSoulArtifact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dimensional Soul Artifact"); - Tooltip.SetDefault("Power\n" + - "Boosts all damage by 25%\n" + - "But at what cost?"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = Item.buyPrice(1, 50, 0, 0); - item.accessory = true; - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.dArtifact = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Cinderplate", 5); - recipe.AddIngredient(null, "EssenceofEleum", 10); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "ExodiumClusterOre", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class DimensionalSoulArtifact : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dimensional Soul Artifact"); + Tooltip.SetDefault("Power\n" + + "Boosts all damage by 25%\n" + + "But at what cost?"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = Item.buyPrice(1, 50, 0, 0); + item.accessory = true; + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.dArtifact = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate", 5); + recipe.AddIngredient(null, "EssenceofEleum", 10); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "ExodiumClusterOre", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonBar.cs b/Items/DraedonBar.cs index 665cdd3e06..00a5c10150 100644 --- a/Items/DraedonBar.cs +++ b/Items/DraedonBar.cs @@ -1,37 +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 -{ - public class DraedonBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perennial Bar"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = 7; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PerennialOre", 5); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class DraedonBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perennial Bar"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 4, 50, 0); + item.rare = 7; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PerennialOre", 5); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DraedonsRemote.cs b/Items/DraedonsRemote.cs index 8694cb4ab4..dcab2833e4 100644 --- a/Items/DraedonsRemote.cs +++ b/Items/DraedonsRemote.cs @@ -1,48 +1,48 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class DraedonsRemote : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Draedon's Remote"); - Tooltip.SetDefault("Mayhem..."); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.maxStack = 20; - item.rare = 8; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !NPC.AnyNPCs(NPCID.TheDestroyer) && !NPC.AnyNPCs(NPCID.SkeletronPrime) && !NPC.AnyNPCs(NPCID.Spazmatism) && !NPC.AnyNPCs(NPCID.Retinazer); - } - - public override bool UseItem(Player player) - { - CalamityGlobalNPC.DraedonMayhem = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - NPC.SpawnOnPlayer(player.whoAmI, NPCID.TheDestroyer); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.SkeletronPrime); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Spazmatism); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Retinazer); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class DraedonsRemote : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon's Remote"); + Tooltip.SetDefault("Mayhem..."); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.maxStack = 20; + item.rare = 8; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return !Main.dayTime && !NPC.AnyNPCs(NPCID.TheDestroyer) && !NPC.AnyNPCs(NPCID.SkeletronPrime) && !NPC.AnyNPCs(NPCID.Spazmatism) && !NPC.AnyNPCs(NPCID.Retinazer); + } + + public override bool UseItem(Player player) + { + CalamityGlobalNPC.DraedonMayhem = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + NPC.SpawnOnPlayer(player.whoAmI, NPCID.TheDestroyer); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.SkeletronPrime); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Spazmatism); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Retinazer); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + } +} diff --git a/Items/Dragonfruit.cs b/Items/Dragonfruit.cs index f4ea23e0cd..0b8b8b8360 100644 --- a/Items/Dragonfruit.cs +++ b/Items/Dragonfruit.cs @@ -1,75 +1,75 @@ -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 Dragonfruit : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dragonfruit"); - Tooltip.SetDefault("Permanently increases maximum life by 25\n" + - "Can only be used if the max amount of life fruit has been consumed"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item4; - item.consumable = true; - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.dFruit || player.statLifeMax < 500) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(25); - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.dFruit = true; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddIngredient(ItemID.FragmentSolar, 15); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Dragonfruit : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragonfruit"); + Tooltip.SetDefault("Permanently increases maximum life by 25\n" + + "Can only be used if the max amount of life fruit has been consumed"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.dFruit || player.statLifeMax < 500) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(25); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.dFruit = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddIngredient(ItemID.FragmentSolar, 15); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/EbonianGel.cs b/Items/EbonianGel.cs index c493819692..bd3256a9eb 100644 --- a/Items/EbonianGel.cs +++ b/Items/EbonianGel.cs @@ -1,28 +1,28 @@ -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 -{ - public class EbonianGel : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blighted Gel"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 14; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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 +{ + public class EbonianGel : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blighted Gel"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 14; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/Ectoblood.cs b/Items/Ectoblood.cs index b52ef365a9..6e1b54ba17 100644 --- a/Items/Ectoblood.cs +++ b/Items/Ectoblood.cs @@ -1,28 +1,28 @@ -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 -{ - public class Ectoblood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ectoblood"); - } - - public override void SetDefaults() - { - item.width = 24; - item.height = 32; - item.maxStack = 999; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 8; - } - } -} \ No newline at end of file +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 +{ + public class Ectoblood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ectoblood"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 32; + item.maxStack = 999; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 8; + } + } +} diff --git a/Items/Ectoheart.cs b/Items/Ectoheart.cs index 9d445b6c03..a66782af57 100644 --- a/Items/Ectoheart.cs +++ b/Items/Ectoheart.cs @@ -1,57 +1,57 @@ -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 Ectoheart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ectoheart"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 5 less seconds to charge\n" + - "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 5)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.adrenalineBoostThree) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.adrenalineBoostThree = true; - } - return true; - } - } -} \ No newline at end of file +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 Ectoheart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ectoheart"); + Tooltip.SetDefault("Permanently makes Adrenaline Mode take 5 less seconds to charge\n" + + "Revengeance drop"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 5)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.adrenalineBoostThree) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.adrenalineBoostThree = true; + } + return true; + } + } +} diff --git a/Items/EidolonTablet.cs b/Items/EidolonTablet.cs index 01a04f8409..783ab96108 100644 --- a/Items/EidolonTablet.cs +++ b/Items/EidolonTablet.cs @@ -1,42 +1,42 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class EidolonTablet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Tablet"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 9; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(NPCID.CultistBoss) && !NPC.LunarApocalypseIsUp && !NPC.AnyNPCs(NPCID.CultistTablet); - } - - public override bool UseItem(Player player) - { - if (Main.netMode != 1) - { - int num1302 = NPC.NewNPC((int)player.Center.X + 30, (int)player.Center.Y - 90, NPCID.CultistBoss, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1302].direction = (Main.npc[num1302].spriteDirection = Math.Sign(player.Center.X - (float)player.Center.X - 30f)); - } - return true; - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class EidolonTablet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Tablet"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 9; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(NPCID.CultistBoss) && !NPC.LunarApocalypseIsUp && !NPC.AnyNPCs(NPCID.CultistTablet); + } + + public override bool UseItem(Player player) + { + if (Main.netMode != 1) + { + int num1302 = NPC.NewNPC((int)player.Center.X + 30, (int)player.Center.Y - 90, NPCID.CultistBoss, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1302].direction = (Main.npc[num1302].spriteDirection = Math.Sign(player.Center.X - (float)player.Center.X - 30f)); + } + return true; + } + } +} diff --git a/Items/Elderberry.cs b/Items/Elderberry.cs index 3c3c25f762..006fc6cd13 100644 --- a/Items/Elderberry.cs +++ b/Items/Elderberry.cs @@ -1,71 +1,71 @@ -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 Elderberry : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elderberry"); - Tooltip.SetDefault("Permanently increases maximum life by 25\n" + - "Can only be used if the max amount of life fruit has been consumed"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 10; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.eBerry || player.statLifeMax < 500) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(25); - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.eBerry = true; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(null, "UeliaceBar", 10); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddIngredient(null, "UnholyEssence", 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Elderberry : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elderberry"); + Tooltip.SetDefault("Permanently increases maximum life by 25\n" + + "Can only be used if the max amount of life fruit has been consumed"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 10; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.eBerry || player.statLifeMax < 500) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(25); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eBerry = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddIngredient(null, "UeliaceBar", 10); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddIngredient(null, "UnholyEssence", 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/EldritchSoulArtifact.cs b/Items/EldritchSoulArtifact.cs index b6b6c2de48..59366367f4 100644 --- a/Items/EldritchSoulArtifact.cs +++ b/Items/EldritchSoulArtifact.cs @@ -1,48 +1,48 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class EldritchSoulArtifact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eldritch Soul Artifact"); - Tooltip.SetDefault("Knowledge\n" + - "Boosts melee speed by 10%, shoot speed by 25%, rogue damage by 15%, max minions by 2, and reduces mana cost by 15%"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = Item.buyPrice(1, 50, 0, 0); - item.accessory = true; - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.eArtifact = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Cinderplate", 5); - recipe.AddIngredient(null, "EssenceofChaos", 10); - recipe.AddIngredient(null, "Phantoplasm", 10); - recipe.AddIngredient(null, "ExodiumClusterOre", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class EldritchSoulArtifact : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eldritch Soul Artifact"); + Tooltip.SetDefault("Knowledge\n" + + "Boosts melee speed by 10%, shoot speed by 25%, rogue damage by 15%, max minions by 2, and reduces mana cost by 15%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = Item.buyPrice(1, 50, 0, 0); + item.accessory = true; + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eArtifact = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate", 5); + recipe.AddIngredient(null, "EssenceofChaos", 10); + recipe.AddIngredient(null, "Phantoplasm", 10); + recipe.AddIngredient(null, "ExodiumClusterOre", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/ElectrolyteGelPack.cs b/Items/ElectrolyteGelPack.cs index 932c6fac8c..765cb97651 100644 --- a/Items/ElectrolyteGelPack.cs +++ b/Items/ElectrolyteGelPack.cs @@ -1,55 +1,55 @@ -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 ElectrolyteGelPack : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Electrolyte Gel Pack"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 4; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.adrenalineBoostOne) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.adrenalineBoostOne = true; - } - return true; - } - } -} \ No newline at end of file +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 ElectrolyteGelPack : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Electrolyte Gel Pack"); + Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 4; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.adrenalineBoostOne) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.adrenalineBoostOne = true; + } + return true; + } + } +} diff --git a/Items/EndothermicEnergy.cs b/Items/EndothermicEnergy.cs index 47bb6de727..6c7c646ea3 100644 --- a/Items/EndothermicEnergy.cs +++ b/Items/EndothermicEnergy.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.Items; - -namespace CalamityMod.Items -{ - public class EndothermicEnergy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Endothermic Energy"); - Tooltip.SetDefault("Great for preventing heat stroke"); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0f * num, 0f * num, 1.2f * num); - } - - public override void SetDefaults() - { - 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; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + public class EndothermicEnergy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Endothermic Energy"); + Tooltip.SetDefault("Great for preventing heat stroke"); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0f * num, 0f * num, 1.2f * num); + } + + public override void SetDefaults() + { + 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/EssenceofChaos.cs b/Items/EssenceofChaos.cs index ace10277a3..8981c7d6ee 100644 --- a/Items/EssenceofChaos.cs +++ b/Items/EssenceofChaos.cs @@ -1,38 +1,38 @@ -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.NPCs; - -namespace CalamityMod.Items -{ - public class EssenceofChaos : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Essence of Chaos"); - Tooltip.SetDefault("The essence of chaotic creatures"); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); - } - - public override void SetDefaults() - { - item.width = 8; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} \ No newline at end of file +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.NPCs; + +namespace CalamityMod.Items +{ + public class EssenceofChaos : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Essence of Chaos"); + Tooltip.SetDefault("The essence of chaotic creatures"); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); + } + + public override void SetDefaults() + { + item.width = 8; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + } +} diff --git a/Items/EssenceofCinder.cs b/Items/EssenceofCinder.cs index 6524d24bff..421db7aa87 100644 --- a/Items/EssenceofCinder.cs +++ b/Items/EssenceofCinder.cs @@ -1,38 +1,38 @@ -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.NPCs; - -namespace CalamityMod.Items -{ - public class EssenceofCinder : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Essence of Sunlight"); - Tooltip.SetDefault("The essence of sky, light, and storm creatures"); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.3f * num, 0.3f * num, 0.05f * num); - } - - public override void SetDefaults() - { - item.width = 8; - item.height = 22; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} \ No newline at end of file +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.NPCs; + +namespace CalamityMod.Items +{ + public class EssenceofCinder : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Essence of Sunlight"); + Tooltip.SetDefault("The essence of sky, light, and storm creatures"); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.3f * num, 0.3f * num, 0.05f * num); + } + + public override void SetDefaults() + { + item.width = 8; + item.height = 22; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + } +} diff --git a/Items/EssenceofEleum.cs b/Items/EssenceofEleum.cs index 02c3bdc969..7555587b33 100644 --- a/Items/EssenceofEleum.cs +++ b/Items/EssenceofEleum.cs @@ -1,38 +1,38 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.Items; - -namespace CalamityMod.Items -{ - public class EssenceofEleum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Essence of Eleum"); - Tooltip.SetDefault("The essence of cold creatures"); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.15f * num, 0.05f * num, 0.5f * num); - } - - public override void SetDefaults() - { - item.width = 8; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; +using CalamityMod.Items; + +namespace CalamityMod.Items +{ + public class EssenceofEleum : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Essence of Eleum"); + Tooltip.SetDefault("The essence of cold creatures"); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.15f * num, 0.05f * num, 0.5f * num); + } + + public override void SetDefaults() + { + item.width = 8; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + } +} diff --git a/Items/EtherealCore.cs b/Items/EtherealCore.cs index cfd2fd5517..43c90e67ec 100644 --- a/Items/EtherealCore.cs +++ b/Items/EtherealCore.cs @@ -1,70 +1,70 @@ -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 EtherealCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ethereal Core"); - Tooltip.SetDefault("Permanently increases maximum mana by 50"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 10; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item29; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.eCore) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.ManaEffect(50); - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.eCore = true; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 25); - recipe.AddIngredient(null, "AstralBar", 25); - recipe.AddIngredient(ItemID.FragmentNebula, 20); - recipe.AddIngredient(ItemID.FallenStar, 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 EtherealCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ethereal Core"); + Tooltip.SetDefault("Permanently increases maximum mana by 50"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 10; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item29; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.eCore) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.ManaEffect(50); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eCore = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 25); + recipe.AddIngredient(null, "AstralBar", 25); + recipe.AddIngredient(ItemID.FragmentNebula, 20); + recipe.AddIngredient(ItemID.FallenStar, 50); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Fabsol.cs b/Items/Fabsol.cs index f428ad8649..c09870e839 100644 --- a/Items/Fabsol.cs +++ b/Items/Fabsol.cs @@ -1,31 +1,31 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items -{ - class Fabsol : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fabsol"); - Tooltip.SetDefault("Summons an alicorn\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 1; - item.rare = 9; - item.value = Item.buyPrice(3, 0, 0, 0); - item.expert = true; - item.UseSound = SoundID.Item3; - item.noMelee = true; - item.mountType = mod.MountType("Fab"); - } - } -} +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items +{ + class Fabsol : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fabsol"); + Tooltip.SetDefault("Summons an alicorn\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 1; + item.rare = 9; + item.value = Item.buyPrice(3, 0, 0, 0); + item.expert = true; + item.UseSound = SoundID.Item3; + item.noMelee = true; + item.mountType = mod.MountType("Fab"); + } + } +} diff --git a/Items/FabsolStuff/BloodyMary.cs b/Items/FabsolStuff/BloodyMary.cs index de6e649b3d..f7809be9f5 100644 --- a/Items/FabsolStuff/BloodyMary.cs +++ b/Items/FabsolStuff/BloodyMary.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class BloodyMary : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Mary"); - Tooltip.SetDefault(@"Boosts damage, movement speed, and melee speed by 15% and crit chance by 7% during a Blood Moon -Reduces life regen by 2 and defense by 6 -Extra spicy and bloody!"); - } - - 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("BloodyMary"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 10, 0, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class BloodyMary : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Mary"); + Tooltip.SetDefault(@"Boosts damage, movement speed, and melee speed by 15% and crit chance by 7% during a Blood Moon +Reduces life regen by 2 and defense by 6 +Extra spicy and bloody!"); + } + + 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("BloodyMary"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 10, 0, 0); + } + } +} diff --git a/Items/FabsolStuff/BlueCandle.cs b/Items/FabsolStuff/BlueCandle.cs index 9e91c6a42f..b9d155c100 100644 --- a/Items/FabsolStuff/BlueCandle.cs +++ b/Items/FabsolStuff/BlueCandle.cs @@ -1,32 +1,32 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class BlueCandle: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Weightless Candle"); - Tooltip.SetDefault("When placed down nearby players have their movement speed increased by 15%, wing time by 10%, and acceleration by 5%"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 40; - 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, 50, 0, 0); - item.rare = 6; - item.createTile = mod.TileType("BlueCandle"); - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class BlueCandle: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Weightless Candle"); + Tooltip.SetDefault("When placed down nearby players have their movement speed increased by 15%, wing time by 10%, and acceleration by 5%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 40; + 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, 50, 0, 0); + item.rare = 6; + item.createTile = mod.TileType("BlueCandle"); + } + } +} diff --git a/Items/FabsolStuff/CaribbeanRum.cs b/Items/FabsolStuff/CaribbeanRum.cs index 4e64dd1287..94e985182e 100644 --- a/Items/FabsolStuff/CaribbeanRum.cs +++ b/Items/FabsolStuff/CaribbeanRum.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class CaribbeanRum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Caribbean Rum"); - Tooltip.SetDefault(@"Boosts life regen by 2 and movement speed and wing flight time by 20% -Makes you floaty and reduces defense by 12 -Why is the rum gone?"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 4; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("CaribbeanRum"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 20, 0, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class CaribbeanRum : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Caribbean Rum"); + Tooltip.SetDefault(@"Boosts life regen by 2 and movement speed and wing flight time by 20% +Makes you floaty and reduces defense by 12 +Why is the rum gone?"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 4; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("CaribbeanRum"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 20, 0, 0); + } + } +} diff --git a/Items/FabsolStuff/CinnamonRoll.cs b/Items/FabsolStuff/CinnamonRoll.cs index 3536dfc13e..4b447ff377 100644 --- a/Items/FabsolStuff/CinnamonRoll.cs +++ b/Items/FabsolStuff/CinnamonRoll.cs @@ -1,38 +1,38 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class CinnamonRoll : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cinnamon Roll"); - Tooltip.SetDefault(@"Boosts mana regeneration rate and all fire-based weapon damage by 15% -Cursed flame, shadowflame, god slayer inferno, brimstone flame, and frostburn weapons will not receive this benefit -The weapon must be more fire-related than anything else -Reduces defense by 12 -A great-tasting cinnamon whiskey with a touch of cream soda"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 4; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("CinnamonRoll"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 16, 60, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class CinnamonRoll : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cinnamon Roll"); + Tooltip.SetDefault(@"Boosts mana regeneration rate and all fire-based weapon damage by 15% +Cursed flame, shadowflame, god slayer inferno, brimstone flame, and frostburn weapons will not receive this benefit +The weapon must be more fire-related than anything else +Reduces defense by 12 +A great-tasting cinnamon whiskey with a touch of cream soda"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 4; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("CinnamonRoll"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 16, 60, 0); + } + } +} diff --git a/Items/FabsolStuff/Everclear.cs b/Items/FabsolStuff/Everclear.cs index b097d1cb4c..38e4a56b43 100644 --- a/Items/FabsolStuff/Everclear.cs +++ b/Items/FabsolStuff/Everclear.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class Everclear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Everclear"); - Tooltip.SetDefault(@"Boosts damage by 25% -Reduces life regen by 10 and defense by 40 -This is the most potent booze I have, be careful with it"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 2; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Everclear"); - item.buffTime = 900; //15 seconds - item.value = Item.buyPrice(0, 6, 60, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class Everclear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Everclear"); + Tooltip.SetDefault(@"Boosts damage by 25% +Reduces life regen by 10 and defense by 40 +This is the most potent booze I have, be careful with it"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 2; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Everclear"); + item.buffTime = 900; //15 seconds + item.value = Item.buyPrice(0, 6, 60, 0); + } + } +} diff --git a/Items/FabsolStuff/EvergreenGin.cs b/Items/FabsolStuff/EvergreenGin.cs index 0d7f25ded8..c283df7376 100644 --- a/Items/FabsolStuff/EvergreenGin.cs +++ b/Items/FabsolStuff/EvergreenGin.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class EvergreenGin : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Evergreen Gin"); - Tooltip.SetDefault(@"Boosts nature-based weapon damage by 15% and damage reduction by 5% -Reduces life regen by 1 -It tastes like a Christmas tree if you can imagine that"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 4; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("EvergreenGin"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 16, 60, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class EvergreenGin : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Evergreen Gin"); + Tooltip.SetDefault(@"Boosts nature-based weapon damage by 15% and damage reduction by 5% +Reduces life regen by 1 +It tastes like a Christmas tree if you can imagine that"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 4; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("EvergreenGin"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 16, 60, 0); + } + } +} diff --git a/Items/FabsolStuff/FabsolsVodka.cs b/Items/FabsolStuff/FabsolsVodka.cs index fb7eb0de46..4ef2f3dcca 100644 --- a/Items/FabsolStuff/FabsolsVodka.cs +++ b/Items/FabsolStuff/FabsolsVodka.cs @@ -1,51 +1,51 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class FabsolsVodka : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fabsol's Vodka"); - Tooltip.SetDefault("Boosts all damage stats by 8% but lowers defense by 20\n" + - "Increases immune time after being struck"); - } - - 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("FabsolVodka"); - item.buffTime = 54000; - item.value = Item.buyPrice(0, 10, 0, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ale); - recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddIngredient(ItemID.CrystalShard, 5); - recipe.AddIngredient(ItemID.UnicornHorn); - recipe.AddTile(TileID.Kegs); - 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 +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class FabsolsVodka : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fabsol's Vodka"); + Tooltip.SetDefault("Boosts all damage stats by 8% but lowers defense by 20\n" + + "Increases immune time after being struck"); + } + + 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("FabsolVodka"); + item.buffTime = 54000; + item.value = Item.buyPrice(0, 10, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Ale); + recipe.AddIngredient(ItemID.PixieDust, 10); + recipe.AddIngredient(ItemID.CrystalShard, 5); + recipe.AddIngredient(ItemID.UnicornHorn); + recipe.AddTile(TileID.Kegs); + 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(); + } + } +} diff --git a/Items/FabsolStuff/Fireball.cs b/Items/FabsolStuff/Fireball.cs index 80d695bc12..4e1b3d49e8 100644 --- a/Items/FabsolStuff/Fireball.cs +++ b/Items/FabsolStuff/Fireball.cs @@ -1,38 +1,38 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class Fireball : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fireball"); - Tooltip.SetDefault(@"Boosts all fire-based weapon damage by 10% -Cursed flame, shadowflame, god slayer inferno, brimstone flame, and frostburn weapons will not receive this benefit -The weapon must be more fire-related than anything else -Reduces life regen by 1 -A great-tasting cinnamon whiskey"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 2; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Fireball"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 6, 60, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class Fireball : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fireball"); + Tooltip.SetDefault(@"Boosts all fire-based weapon damage by 10% +Cursed flame, shadowflame, god slayer inferno, brimstone flame, and frostburn weapons will not receive this benefit +The weapon must be more fire-related than anything else +Reduces life regen by 1 +A great-tasting cinnamon whiskey"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 2; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Fireball"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 6, 60, 0); + } + } +} diff --git a/Items/FabsolStuff/GrapeBeer.cs b/Items/FabsolStuff/GrapeBeer.cs index ae065bdd7c..3f03294b0f 100644 --- a/Items/FabsolStuff/GrapeBeer.cs +++ b/Items/FabsolStuff/GrapeBeer.cs @@ -1,68 +1,68 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class GrapeBeer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grape Beer"); - Tooltip.SetDefault(@"Reduces defense by 2 and movement speed by 5% -This crap is abhorrent but you might like it -Restores 100 life and mana"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 1; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("GrapeBeer"); - item.buffTime = 3600; //3600 = 1 minute - item.value = Item.buyPrice(0, 0, 65, 0); - } - - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override bool ConsumeItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override void OnConsumeItem(Player player) - { - player.statLife += 100; - player.statMana += 100; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (player.statMana > player.statManaMax2) - { - player.statMana = player.statManaMax2; - } - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(100, true); - player.ManaEffect(100); - } - player.AddBuff(mod.BuffType("GrapeBeer"), 3600); - player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2700 : 3600)); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class GrapeBeer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grape Beer"); + Tooltip.SetDefault(@"Reduces defense by 2 and movement speed by 5% +This crap is abhorrent but you might like it +Restores 100 life and mana"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 1; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("GrapeBeer"); + item.buffTime = 3600; //3600 = 1 minute + item.value = Item.buyPrice(0, 0, 65, 0); + } + + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override bool ConsumeItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override void OnConsumeItem(Player player) + { + player.statLife += 100; + player.statMana += 100; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(100, true); + player.ManaEffect(100); + } + player.AddBuff(mod.BuffType("GrapeBeer"), 3600); + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2700 : 3600)); + } + } +} diff --git a/Items/FabsolStuff/Margarita.cs b/Items/FabsolStuff/Margarita.cs index ad44a15723..dae07197e4 100644 --- a/Items/FabsolStuff/Margarita.cs +++ b/Items/FabsolStuff/Margarita.cs @@ -1,69 +1,69 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class Margarita : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Margarita"); - Tooltip.SetDefault(@"Makes you immune to most debuffs -Reduces defense by 6 and life regen by 1 -One of the best drinks ever created, enjoy it while it lasts -Restores 200 life and mana"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 5; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Margarita"); - item.buffTime = 10800; //3 minutes - item.value = Item.buyPrice(0, 23, 30, 0); - } - - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override bool ConsumeItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override void OnConsumeItem(Player player) - { - player.statLife += 200; - player.statMana += 200; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (player.statMana > player.statManaMax2) - { - player.statMana = player.statManaMax2; - } - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(200, true); - player.ManaEffect(200); - } - player.AddBuff(mod.BuffType("Margarita"), 10800); - player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2700 : 3600)); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class Margarita : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Margarita"); + Tooltip.SetDefault(@"Makes you immune to most debuffs +Reduces defense by 6 and life regen by 1 +One of the best drinks ever created, enjoy it while it lasts +Restores 200 life and mana"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 5; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Margarita"); + item.buffTime = 10800; //3 minutes + item.value = Item.buyPrice(0, 23, 30, 0); + } + + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override bool ConsumeItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override void OnConsumeItem(Player player) + { + player.statLife += 200; + player.statMana += 200; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(200, true); + player.ManaEffect(200); + } + player.AddBuff(mod.BuffType("Margarita"), 10800); + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2700 : 3600)); + } + } +} diff --git a/Items/FabsolStuff/Moonshine.cs b/Items/FabsolStuff/Moonshine.cs index 4bde3d9e4b..ee53de76d0 100644 --- a/Items/FabsolStuff/Moonshine.cs +++ b/Items/FabsolStuff/Moonshine.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class Moonshine : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moonshine"); - Tooltip.SetDefault(@"Increases defense by 10 and damage reduction by 5% -Reduces life regen by 1 -This stuff is pretty strong but I'm sure you can handle it"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 2; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Moonshine"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 3, 30, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class Moonshine : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moonshine"); + Tooltip.SetDefault(@"Increases defense by 10 and damage reduction by 5% +Reduces life regen by 1 +This stuff is pretty strong but I'm sure you can handle it"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 2; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Moonshine"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 3, 30, 0); + } + } +} diff --git a/Items/FabsolStuff/MoscowMule.cs b/Items/FabsolStuff/MoscowMule.cs index ff7fc82aa7..577e9d5b37 100644 --- a/Items/FabsolStuff/MoscowMule.cs +++ b/Items/FabsolStuff/MoscowMule.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class MoscowMule : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moscow Mule"); - Tooltip.SetDefault(@"Boosts damage and knockback by 9% and critical strike chance by 3% -Reduces life regen by 2 -I once heard the copper mug can be toxic and I told 'em 'listen dummy, I'm already poisoning myself'"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 4; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("MoscowMule"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 16, 60, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class MoscowMule : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moscow Mule"); + Tooltip.SetDefault(@"Boosts damage and knockback by 9% and critical strike chance by 3% +Reduces life regen by 2 +I once heard the copper mug can be toxic and I told 'em 'listen dummy, I'm already poisoning myself'"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 4; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("MoscowMule"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 16, 60, 0); + } + } +} diff --git a/Items/FabsolStuff/OddMushroom.cs b/Items/FabsolStuff/OddMushroom.cs index 7a511c584b..ab5d2a7b72 100644 --- a/Items/FabsolStuff/OddMushroom.cs +++ b/Items/FabsolStuff/OddMushroom.cs @@ -1,36 +1,36 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; - -namespace CalamityMod.Items.FabsolStuff -{ - public class OddMushroom : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Odd Mushroom"); - Tooltip.SetDefault("Trippy"); - } - - public override void SetDefaults() - { - item.width = 42; - item.height = 48; - item.useTurn = true; - item.maxStack = 30; - item.useAnimation = 17; - item.useTime = 17; - item.rare = 3; - item.useStyle = 2; - item.UseSound = SoundID.Item2; - item.consumable = true; - item.buffType = mod.BuffType("Trippy"); - item.buffTime = 216000; - item.value = Item.buyPrice(1, 0, 0, 0); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.FabsolStuff +{ + public class OddMushroom : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Odd Mushroom"); + Tooltip.SetDefault("Trippy"); + } + + public override void SetDefaults() + { + item.width = 42; + item.height = 48; + item.useTurn = true; + item.maxStack = 30; + item.useAnimation = 17; + item.useTime = 17; + item.rare = 3; + item.useStyle = 2; + item.UseSound = SoundID.Item2; + item.consumable = true; + item.buffType = mod.BuffType("Trippy"); + item.buffTime = 216000; + item.value = Item.buyPrice(1, 0, 0, 0); + } + } +} diff --git a/Items/FabsolStuff/PinkCandle.cs b/Items/FabsolStuff/PinkCandle.cs index 7e9553cb23..22f9ab386a 100644 --- a/Items/FabsolStuff/PinkCandle.cs +++ b/Items/FabsolStuff/PinkCandle.cs @@ -1,33 +1,33 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class PinkCandle: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vigorous Candle"); - Tooltip.SetDefault("When placed down nearby players regenerate 0.4% of their maximum health per second\n" + - "This is separate from normal life regeneration, bypassing caps and not being affected by damage taken or current movement"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 40; - 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, 50, 0, 0); - item.rare = 6; - item.createTile = mod.TileType("PinkCandle"); - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class PinkCandle: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vigorous Candle"); + Tooltip.SetDefault("When placed down nearby players regenerate 0.4% of their maximum health per second\n" + + "This is separate from normal life regeneration, bypassing caps and not being affected by damage taken or current movement"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 40; + 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, 50, 0, 0); + item.rare = 6; + item.createTile = mod.TileType("PinkCandle"); + } + } +} diff --git a/Items/FabsolStuff/PurpleCandle.cs b/Items/FabsolStuff/PurpleCandle.cs index 1689920ec4..3237192f7c 100644 --- a/Items/FabsolStuff/PurpleCandle.cs +++ b/Items/FabsolStuff/PurpleCandle.cs @@ -1,32 +1,32 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class PurpleCandle: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Resilient Candle"); - Tooltip.SetDefault("When placed down nearby players have the effectiveness of their defense increased by 5%"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 40; - 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, 50, 0, 0); - item.rare = 6; - item.createTile = mod.TileType("PurpleCandle"); - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class PurpleCandle: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Resilient Candle"); + Tooltip.SetDefault("When placed down nearby players have the effectiveness of their defense increased by 5%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 40; + 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, 50, 0, 0); + item.rare = 6; + item.createTile = mod.TileType("PurpleCandle"); + } + } +} diff --git a/Items/FabsolStuff/RedWine.cs b/Items/FabsolStuff/RedWine.cs index b17a978fb5..d14240836c 100644 --- a/Items/FabsolStuff/RedWine.cs +++ b/Items/FabsolStuff/RedWine.cs @@ -1,61 +1,61 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class RedWine : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Wine"); - Tooltip.SetDefault(@"Reduces life regen by 1 -Too dry for my taste -Restores 200 life"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 1; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("RedWine"); - item.buffTime = 900; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override bool ConsumeItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override void OnConsumeItem(Player player) - { - player.statLife += 200; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(200, true); - } - player.AddBuff(mod.BuffType("RedWine"), 900); - player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2700 : 3600)); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class RedWine : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Wine"); + Tooltip.SetDefault(@"Reduces life regen by 1 +Too dry for my taste +Restores 200 life"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 1; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("RedWine"); + item.buffTime = 900; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override bool ConsumeItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override void OnConsumeItem(Player player) + { + player.statLife += 200; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(200, true); + } + player.AddBuff(mod.BuffType("RedWine"), 900); + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 2700 : 3600)); + } + } +} diff --git a/Items/FabsolStuff/Rum.cs b/Items/FabsolStuff/Rum.cs index a5bacff209..6c8f4c820e 100644 --- a/Items/FabsolStuff/Rum.cs +++ b/Items/FabsolStuff/Rum.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class Rum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rum"); - Tooltip.SetDefault(@"Boosts life regen by 2 and movement speed by 10% -Reduces defense by 8 -Sweet and potent, just how I like it"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 2; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Rum"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 5, 0, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class Rum : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rum"); + Tooltip.SetDefault(@"Boosts life regen by 2 and movement speed by 10% +Reduces defense by 8 +Sweet and potent, just how I like it"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 2; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Rum"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 5, 0, 0); + } + } +} diff --git a/Items/FabsolStuff/Screwdriver.cs b/Items/FabsolStuff/Screwdriver.cs index d68f4bc548..13fe296833 100644 --- a/Items/FabsolStuff/Screwdriver.cs +++ b/Items/FabsolStuff/Screwdriver.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class Screwdriver : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Screwdriver"); - Tooltip.SetDefault(@"Boosts piercing projectile damage by 10% -Reduces life regen by 1 -Do you have a screw loose?"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 4; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Screwdriver"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 16, 60, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class Screwdriver : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Screwdriver"); + Tooltip.SetDefault(@"Boosts piercing projectile damage by 10% +Reduces life regen by 1 +Do you have a screw loose?"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 4; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Screwdriver"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 16, 60, 0); + } + } +} diff --git a/Items/FabsolStuff/StarBeamRye.cs b/Items/FabsolStuff/StarBeamRye.cs index 7c0be1206c..4afc771f5b 100644 --- a/Items/FabsolStuff/StarBeamRye.cs +++ b/Items/FabsolStuff/StarBeamRye.cs @@ -1,37 +1,37 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class StarBeamRye : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star Beam Rye"); - Tooltip.SetDefault(@"Boosts max mana by 50, magic damage by 8%, -and reduces mana usage by 10% -Reduces defense by 6 and life regen by 1 -Made from some stuff I found near the Astral Meteor crash site, don't worry it's safe, trust me"); - } - - 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("StarBeamRye"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 13, 30, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class StarBeamRye : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star Beam Rye"); + Tooltip.SetDefault(@"Boosts max mana by 50, magic damage by 8%, +and reduces mana usage by 10% +Reduces defense by 6 and life regen by 1 +Made from some stuff I found near the Astral Meteor crash site, don't worry it's safe, trust me"); + } + + 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("StarBeamRye"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 13, 30, 0); + } + } +} diff --git a/Items/FabsolStuff/Tequila.cs b/Items/FabsolStuff/Tequila.cs index 6dfad6258e..f53f19713e 100644 --- a/Items/FabsolStuff/Tequila.cs +++ b/Items/FabsolStuff/Tequila.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class Tequila : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tequila"); - Tooltip.SetDefault(@"Boosts damage, damage reduction, and knockback by 3%, crit chance by 2%, and defense by 5 during daytime -Reduces life regen by 1 -Great for mixing up daytime drinks"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 2; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Tequila"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 5, 0, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class Tequila : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tequila"); + Tooltip.SetDefault(@"Boosts damage, damage reduction, and knockback by 3%, crit chance by 2%, and defense by 5 during daytime +Reduces life regen by 1 +Great for mixing up daytime drinks"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 2; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Tequila"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 5, 0, 0); + } + } +} diff --git a/Items/FabsolStuff/TequilaSunrise.cs b/Items/FabsolStuff/TequilaSunrise.cs index 3bf377be31..7309e02d3e 100644 --- a/Items/FabsolStuff/TequilaSunrise.cs +++ b/Items/FabsolStuff/TequilaSunrise.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class TequilaSunrise : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tequila Sunrise"); - Tooltip.SetDefault(@"Boosts damage, damage reduction, and knockback by 7%, crit chance by 3%, and defense by 15 during daytime -Reduces life regen by 1 -The greatest daytime drink I've ever had"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 4; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("TequilaSunrise"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 20, 0, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class TequilaSunrise : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tequila Sunrise"); + Tooltip.SetDefault(@"Boosts damage, damage reduction, and knockback by 7%, crit chance by 3%, and defense by 15 during daytime +Reduces life regen by 1 +The greatest daytime drink I've ever had"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 4; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("TequilaSunrise"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 20, 0, 0); + } + } +} diff --git a/Items/FabsolStuff/Vodka.cs b/Items/FabsolStuff/Vodka.cs index a8cef3c37b..31397eccf2 100644 --- a/Items/FabsolStuff/Vodka.cs +++ b/Items/FabsolStuff/Vodka.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class Vodka : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vodka"); - Tooltip.SetDefault(@"Boosts damage by 6% and critical strike chance by 2% -Reduces life regen by 1 and defense by 4 -The number one alcohol for creating great mixed drinks"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 2; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Vodka"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 3, 30, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class Vodka : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vodka"); + Tooltip.SetDefault(@"Boosts damage by 6% and critical strike chance by 2% +Reduces life regen by 1 and defense by 4 +The number one alcohol for creating great mixed drinks"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 2; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Vodka"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 3, 30, 0); + } + } +} diff --git a/Items/FabsolStuff/Whiskey.cs b/Items/FabsolStuff/Whiskey.cs index 8fe3fa05d2..5ace4b90ef 100644 --- a/Items/FabsolStuff/Whiskey.cs +++ b/Items/FabsolStuff/Whiskey.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class Whiskey : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Whiskey"); - Tooltip.SetDefault(@"Boosts damage and knockback by 4% and critical strike chance by 2% -Reduces defense by 8 -The burning sensation makes it tastier"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 2; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Whiskey"); - item.buffTime = 18000; //5 minutes - item.value = Item.buyPrice(0, 3, 30, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class Whiskey : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Whiskey"); + Tooltip.SetDefault(@"Boosts damage and knockback by 4% and critical strike chance by 2% +Reduces defense by 8 +The burning sensation makes it tastier"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 2; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Whiskey"); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 3, 30, 0); + } + } +} diff --git a/Items/FabsolStuff/WhiteWine.cs b/Items/FabsolStuff/WhiteWine.cs index 18c0a054ae..0674932a20 100644 --- a/Items/FabsolStuff/WhiteWine.cs +++ b/Items/FabsolStuff/WhiteWine.cs @@ -1,37 +1,37 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class WhiteWine : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("White Wine"); - Tooltip.SetDefault(@"Boosts magic damage by 10% -Reduces defense by 6 and life regen by 1 -I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 4; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.healMana = 400; - item.buffType = mod.BuffType("WhiteWine"); - item.buffTime = 10800; //3 minutes - item.value = Item.buyPrice(0, 16, 60, 0); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class WhiteWine : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("White Wine"); + Tooltip.SetDefault(@"Boosts magic damage by 10% +Reduces defense by 6 and life regen by 1 +I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 4; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.healMana = 400; + item.buffType = mod.BuffType("WhiteWine"); + item.buffTime = 10800; //3 minutes + item.value = Item.buyPrice(0, 16, 60, 0); + } + } +} diff --git a/Items/FabsolStuff/YellowCandle.cs b/Items/FabsolStuff/YellowCandle.cs index 3e73d07b30..7daf4d8ab3 100644 --- a/Items/FabsolStuff/YellowCandle.cs +++ b/Items/FabsolStuff/YellowCandle.cs @@ -1,32 +1,32 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.FabsolStuff -{ - public class YellowCandle: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spiteful Candle"); - Tooltip.SetDefault("When placed down nearby enemies take 5% more damage, this bypasses enemy DR"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 40; - 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, 50, 0, 0); - item.rare = 6; - item.createTile = mod.TileType("YellowCandle"); - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.FabsolStuff +{ + public class YellowCandle: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spiteful Candle"); + Tooltip.SetDefault("When placed down nearby enemies take 5% more damage, this bypasses enemy DR"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 40; + 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, 50, 0, 0); + item.rare = 6; + item.createTile = mod.TileType("YellowCandle"); + } + } +} diff --git a/Items/FetidEssence.cs b/Items/FetidEssence.cs index 58494f98ee..3c85215cd1 100644 --- a/Items/FetidEssence.cs +++ b/Items/FetidEssence.cs @@ -1,29 +1,29 @@ -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 -{ - public class FetidEssence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fetid Essence"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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 +{ + public class FetidEssence : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fetid Essence"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/FlamebeakHampick.cs b/Items/FlamebeakHampick.cs index f70fa58d31..00cc1ad320 100644 --- a/Items/FlamebeakHampick.cs +++ b/Items/FlamebeakHampick.cs @@ -1,62 +1,62 @@ -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 -{ - public class FlamebeakHampick : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flamebeak Hampick"); - Tooltip.SetDefault("Capable of mining Lihzahrd Bricks"); - } - - public override void SetDefaults() - { - item.damage = 58; - item.melee = true; - item.width = 52; - item.height = 50; - item.useTime = 6; - item.useAnimation = 15; - item.useTurn = true; - item.pick = 210; - item.hammer = 130; - item.useStyle = 1; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.tileBoost += 2; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 127); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - } -} \ No newline at end of file +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 +{ + public class FlamebeakHampick : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flamebeak Hampick"); + Tooltip.SetDefault("Capable of mining Lihzahrd Bricks"); + } + + public override void SetDefaults() + { + item.damage = 58; + item.melee = true; + item.width = 52; + item.height = 50; + item.useTime = 6; + item.useAnimation = 15; + item.useTurn = true; + item.pick = 210; + item.hammer = 130; + item.useStyle = 1; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.tileBoost += 2; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 127); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Items/FoxDrive.cs b/Items/FoxDrive.cs index 53cc7f416c..37e957be64 100644 --- a/Items/FoxDrive.cs +++ b/Items/FoxDrive.cs @@ -1,37 +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 -{ - public class FoxDrive : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fox Drive"); - Tooltip.SetDefault("'It contains 1 file on it'\n'Fox.cs'"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.ZephyrFish); - item.shoot = mod.ProjectileType("Fox"); - item.buffType = mod.BuffType("Fox"); - item.rare = 9; - item.expert = true; - } - - 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 +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 +{ + public class FoxDrive : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fox Drive"); + Tooltip.SetDefault("'It contains 1 file on it'\n'Fox.cs'"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.ZephyrFish); + item.shoot = mod.ProjectileType("Fox"); + item.buffType = mod.BuffType("Fox"); + item.rare = 9; + item.expert = true; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } + } +} diff --git a/Items/GalacticaSingularity.cs b/Items/GalacticaSingularity.cs index 8156974477..42cf8a21f9 100644 --- a/Items/GalacticaSingularity.cs +++ b/Items/GalacticaSingularity.cs @@ -1,50 +1,50 @@ -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 -{ - public class GalacticaSingularity : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Galactica Singularity"); - Tooltip.SetDefault("A shard of the cosmos"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 19)); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.maxStack = 999; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 10; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentSolar); - recipe.AddIngredient(ItemID.FragmentVortex); - recipe.AddIngredient(ItemID.FragmentStardust); - recipe.AddIngredient(ItemID.FragmentNebula); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 1f * num, 0.3f * num, 0.3f * num); - } - } -} \ No newline at end of file +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 +{ + public class GalacticaSingularity : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Galactica Singularity"); + Tooltip.SetDefault("A shard of the cosmos"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 19)); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.maxStack = 999; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 10; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FragmentSolar); + recipe.AddIngredient(ItemID.FragmentVortex); + recipe.AddIngredient(ItemID.FragmentStardust); + recipe.AddIngredient(ItemID.FragmentNebula); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 1f * num, 0.3f * num, 0.3f * num); + } + } +} diff --git a/Items/GallantPickaxe.cs b/Items/GallantPickaxe.cs index 30e1830b30..fdcf9b9e4c 100644 --- a/Items/GallantPickaxe.cs +++ b/Items/GallantPickaxe.cs @@ -1,64 +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 -{ - public class GallantPickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gallant Pickaxe"); - Tooltip.SetDefault("Can mine Uelibloom Ore"); - } - - public override void SetDefaults() - { - item.damage = 80; - item.melee = true; - item.width = 54; - item.height = 54; - item.useTime = 6; - item.useAnimation = 12; - item.useTurn = true; - item.pick = 250; - item.useStyle = 1; - item.knockBack = 6f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.tileBoost += 5; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar", 9); - recipe.AddIngredient(null, "GalacticaSingularity"); - recipe.AddRecipeGroup("LunarPickaxe"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 58); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 300); - } - } -} \ No newline at end of file +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 +{ + public class GallantPickaxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gallant Pickaxe"); + Tooltip.SetDefault("Can mine Uelibloom Ore"); + } + + public override void SetDefaults() + { + item.damage = 80; + item.melee = true; + item.width = 54; + item.height = 54; + item.useTime = 6; + item.useAnimation = 12; + item.useTurn = true; + item.pick = 250; + item.useStyle = 1; + item.knockBack = 6f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.tileBoost += 5; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar", 9); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddRecipeGroup("LunarPickaxe"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 58); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 300); + } + } +} diff --git a/Items/Gelpick.cs b/Items/Gelpick.cs index 943095610c..2f97015d27 100644 --- a/Items/Gelpick.cs +++ b/Items/Gelpick.cs @@ -1,60 +1,60 @@ -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 -{ - public class Gelpick : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gelpick"); - } - - public override void SetDefaults() - { - item.damage = 12; - item.melee = true; - item.width = 46; - item.height = 46; - item.useTime = 20; - item.useAnimation = 20; - item.pick = 100; - item.useStyle = 1; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 15); - recipe.AddIngredient(ItemID.Gel, 30); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.Anvils); - 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, 20); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Slimed, 180); - } - } -} \ No newline at end of file +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 +{ + public class Gelpick : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gelpick"); + } + + public override void SetDefaults() + { + item.damage = 12; + item.melee = true; + item.width = 46; + item.height = 46; + item.useTime = 20; + item.useAnimation = 20; + item.pick = 100; + item.useStyle = 1; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 15); + recipe.AddIngredient(ItemID.Gel, 30); + recipe.AddIngredient(ItemID.HellstoneBar, 5); + recipe.AddTile(TileID.Anvils); + 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, 20); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Slimed, 180); + } + } +} diff --git a/Items/GodlySoulArtifact.cs b/Items/GodlySoulArtifact.cs index 9f3ec3eef1..bee9051a05 100644 --- a/Items/GodlySoulArtifact.cs +++ b/Items/GodlySoulArtifact.cs @@ -1,48 +1,48 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class GodlySoulArtifact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Godly Soul Artifact"); - Tooltip.SetDefault("Loyalty\n" + - "Boosts max minions by 8"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.value = Item.buyPrice(1, 50, 0, 0); - item.accessory = true; - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.gArtifact = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Cinderplate", 5); - recipe.AddIngredient(null, "EssenceofCinder", 10); - recipe.AddIngredient(null, "HellcasterFragment", 10); - recipe.AddIngredient(null, "ExodiumClusterOre", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items +{ + public class GodlySoulArtifact : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Godly Soul Artifact"); + Tooltip.SetDefault("Loyalty\n" + + "Boosts max minions by 8"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.value = Item.buyPrice(1, 50, 0, 0); + item.accessory = true; + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.gArtifact = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate", 5); + recipe.AddIngredient(null, "EssenceofCinder", 10); + recipe.AddIngredient(null, "HellcasterFragment", 10); + recipe.AddIngredient(null, "ExodiumClusterOre", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/GreatSandShark/GrandScale.cs b/Items/GreatSandShark/GrandScale.cs index 72246aa677..37ff33e9be 100644 --- a/Items/GreatSandShark/GrandScale.cs +++ b/Items/GreatSandShark/GrandScale.cs @@ -1,29 +1,29 @@ -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.GreatSandShark -{ - public class GrandScale : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grand Scale"); - Tooltip.SetDefault("Large scale of an apex predator"); - } - - public override void SetDefaults() - { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = 7; - } - } -} \ No newline at end of file +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.GreatSandShark +{ + public class GrandScale : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grand Scale"); + Tooltip.SetDefault("Large scale of an apex predator"); + } + + public override void SetDefaults() + { + item.width = 15; + item.height = 12; + item.maxStack = 999; + item.value = Item.buyPrice(0, 4, 50, 0); + item.rare = 7; + } + } +} diff --git a/Items/GreatSandShark/SandstormsCore.cs b/Items/GreatSandShark/SandstormsCore.cs index 928d0d271d..767af06b94 100644 --- a/Items/GreatSandShark/SandstormsCore.cs +++ b/Items/GreatSandShark/SandstormsCore.cs @@ -1,50 +1,50 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.GreatSandShark -{ - public class SandstormsCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sandstorm's Core"); - Tooltip.SetDefault("Summons the Great Sand Shark"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 7; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneDesert && !NPC.AnyNPCs(mod.NPCType("GreatSandShark")); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("GreatSandShark")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.GreatSandShark +{ + public class SandstormsCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sandstorm's Core"); + Tooltip.SetDefault("Summons the Great Sand Shark"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 7; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneDesert && !NPC.AnyNPCs(mod.NPCType("GreatSandShark")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("GreatSandShark")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/GreatbayPickaxe.cs b/Items/GreatbayPickaxe.cs index 5254bcf17b..28fbd7f806 100644 --- a/Items/GreatbayPickaxe.cs +++ b/Items/GreatbayPickaxe.cs @@ -1,47 +1,47 @@ -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 -{ - public class GreatbayPickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Greatbay Pickaxe"); - Tooltip.SetDefault("Can mine Meteorite"); - } - - public override void SetDefaults() - { - item.damage = 9; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTime = 16; - item.useAnimation = 16; - item.useTurn = true; - item.pick = 60; - item.useStyle = 1; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class GreatbayPickaxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Greatbay Pickaxe"); + Tooltip.SetDefault("Can mine Meteorite"); + } + + public override void SetDefaults() + { + item.damage = 9; + item.melee = true; + item.width = 44; + item.height = 44; + item.useTime = 16; + item.useAnimation = 16; + item.useTurn = true; + item.pick = 60; + item.useStyle = 1; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 3); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/GypsyPowder.cs b/Items/GypsyPowder.cs index c38b0535d4..162081878e 100644 --- a/Items/GypsyPowder.cs +++ b/Items/GypsyPowder.cs @@ -1,28 +1,28 @@ -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 -{ - public class GypsyPowder : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gypsy Powder"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} \ No newline at end of file +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 +{ + public class GypsyPowder : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gypsy Powder"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + } +} diff --git a/Items/HadarianMembrane.cs b/Items/HadarianMembrane.cs index 589dcd3d56..4af14cec25 100644 --- a/Items/HadarianMembrane.cs +++ b/Items/HadarianMembrane.cs @@ -1,29 +1,29 @@ -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 -{ - public class HadarianMembrane : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hadarian Membrane"); - Tooltip.SetDefault("The membrane of an astral creature's wings"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 22; - item.maxStack = 999; - item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = 7; - } - } -} \ No newline at end of file +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 +{ + public class HadarianMembrane : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hadarian Membrane"); + Tooltip.SetDefault("The membrane of an astral creature's wings"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 22; + item.maxStack = 999; + item.value = Item.buyPrice(0, 4, 50, 0); + item.rare = 7; + } + } +} diff --git a/Items/HiveMind/HiveMindBag.cs b/Items/HiveMind/HiveMindBag.cs index 863b932037..3b0adb4411 100644 --- a/Items/HiveMind/HiveMindBag.cs +++ b/Items/HiveMind/HiveMindBag.cs @@ -1,94 +1,94 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.HiveMind -{ - public class HiveMindBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("HiveMindP2"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("ShaderainStaff")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("LeechingDagger")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("ShadowdropStaff")); - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("HiveMindMask")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("PerfectDark")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Shadethrower")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("RotBall"), Main.rand.Next(50, 76)); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("DankStaff")); - } - player.QuickSpawnItem(mod.ItemType("RottenBrain")); - player.QuickSpawnItem(ItemID.RottenChunk, Main.rand.Next(10, 21)); - player.QuickSpawnItem(ItemID.DemoniteBar, Main.rand.Next(9, 15)); - player.QuickSpawnItem(mod.ItemType("TrueShadowScale"), Main.rand.Next(30, 41)); - if (Main.hardMode) - { - player.QuickSpawnItem(ItemID.CursedFlame, Main.rand.Next(15, 31)); - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.HiveMind +{ + public class HiveMindBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("HiveMindP2"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("ShaderainStaff")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("LeechingDagger")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("ShadowdropStaff")); + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("HiveMindMask")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("PerfectDark")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Shadethrower")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("RotBall"), Main.rand.Next(50, 76)); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("DankStaff")); + } + player.QuickSpawnItem(mod.ItemType("RottenBrain")); + player.QuickSpawnItem(ItemID.RottenChunk, Main.rand.Next(10, 21)); + player.QuickSpawnItem(ItemID.DemoniteBar, Main.rand.Next(9, 15)); + player.QuickSpawnItem(mod.ItemType("TrueShadowScale"), Main.rand.Next(30, 41)); + if (Main.hardMode) + { + player.QuickSpawnItem(ItemID.CursedFlame, Main.rand.Next(15, 31)); + } + } + } +} diff --git a/Items/HiveMind/RottenBrain.cs b/Items/HiveMind/RottenBrain.cs index 3fda271be2..80f7ee325d 100644 --- a/Items/HiveMind/RottenBrain.cs +++ b/Items/HiveMind/RottenBrain.cs @@ -1,63 +1,63 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.HiveMind -{ - public class RottenBrain : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rotten Brain"); - Tooltip.SetDefault("10% increased damage when below 75% life\n5% decreased movement speed when below 50% life\nShade rains down when you are hit"); - } - - public override void SetDefaults() - { - item.width = 34; - item.height = 34; - item.value = Item.buyPrice(0, 9, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.immune) - { - if (Main.rand.Next(8) == 0) - { - if (player.whoAmI == Main.myPlayer) - { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("AuraRain"), 18, 2f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].tileCollide = false; - } - } - } - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.rBrain = true; - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.HiveMind +{ + public class RottenBrain : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rotten Brain"); + Tooltip.SetDefault("10% increased damage when below 75% life\n5% decreased movement speed when below 50% life\nShade rains down when you are hit"); + } + + public override void SetDefaults() + { + item.width = 34; + item.height = 34; + item.value = Item.buyPrice(0, 9, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.immune) + { + if (Main.rand.Next(8) == 0) + { + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 1; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("AuraRain"), 18, 2f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + Main.projectile[num19].tileCollide = false; + } + } + } + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.rBrain = true; + } + } +} diff --git a/Items/HiveMind/Teratoma.cs b/Items/HiveMind/Teratoma.cs index 28f0c311ce..4582ffef72 100644 --- a/Items/HiveMind/Teratoma.cs +++ b/Items/HiveMind/Teratoma.cs @@ -1,58 +1,58 @@ -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; - -namespace CalamityMod.Items.HiveMind -{ - public class Teratoma : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Teratoma"); - Tooltip.SetDefault("Summons the Hive Mind"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 3; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneCorrupt && !NPC.AnyNPCs(mod.NPCType("HiveMind")) && !NPC.AnyNPCs(mod.NPCType("HiveMindP2")); - } - - public override bool UseItem(Player player) - { - if (Main.netMode != 1) - { - int num = NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-100, 100))), (int)(player.position.Y - 150f), mod.NPCType("HiveMind"), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(SoundID.Roar, player.position, 0); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 9); - recipe.AddIngredient(null, "TrueShadowScale", 5); - recipe.AddIngredient(ItemID.DemoniteBar, 2); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.Items.HiveMind +{ + public class Teratoma : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Teratoma"); + Tooltip.SetDefault("Summons the Hive Mind"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 3; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneCorrupt && !NPC.AnyNPCs(mod.NPCType("HiveMind")) && !NPC.AnyNPCs(mod.NPCType("HiveMindP2")); + } + + public override bool UseItem(Player player) + { + if (Main.netMode != 1) + { + int num = NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-100, 100))), (int)(player.position.Y - 150f), mod.NPCType("HiveMind"), 0, 0f, 0f, 0f, 0f, 255); + Main.PlaySound(SoundID.Roar, player.position, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 9); + recipe.AddIngredient(null, "TrueShadowScale", 5); + recipe.AddIngredient(ItemID.DemoniteBar, 2); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/HiveMind/TrueShadowScale.cs b/Items/HiveMind/TrueShadowScale.cs index 59cd811cdc..2c8c6d3cf1 100644 --- a/Items/HiveMind/TrueShadowScale.cs +++ b/Items/HiveMind/TrueShadowScale.cs @@ -1,28 +1,28 @@ -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.HiveMind -{ - public class TrueShadowScale : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Shadow Scale"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 22; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 2; - } - } -} \ No newline at end of file +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.HiveMind +{ + public class TrueShadowScale : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Shadow Scale"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 22; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 50, 0); + item.rare = 2; + } + } +} diff --git a/Items/InfernalBlood.cs b/Items/InfernalBlood.cs index 98f45e56b4..83b195042c 100644 --- a/Items/InfernalBlood.cs +++ b/Items/InfernalBlood.cs @@ -1,55 +1,55 @@ -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 InfernalBlood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernal Blood"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% (60% in Death Mode) more damage\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 8; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.rageBoostTwo) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.rageBoostTwo = true; - } - return true; - } - } -} \ No newline at end of file +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 InfernalBlood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernal Blood"); + Tooltip.SetDefault("Permanently makes Rage Mode do 15% (60% in Death Mode) more damage\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 8; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.rageBoostTwo) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.rageBoostTwo = true; + } + return true; + } + } +} diff --git a/Items/IronHeart.cs b/Items/IronHeart.cs index 11338a65e9..48ef198c54 100644 --- a/Items/IronHeart.cs +++ b/Items/IronHeart.cs @@ -1,93 +1,93 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.Items -{ - public class IronHeart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Iron Heart"); - Tooltip.SetDefault("Makes dying while a boss is alive permanently kill you.\n" + - "Can be toggled on and off.\n" + - "Using this while a boss is alive will permanently kill you.\n" + - "Cannot be activated if any boss has been killed."); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 28; - item.expert = true; - item.rare = 9; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.UseSound = SoundID.Item119; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - if (CalamityWorld.downedBossAny) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - for (int doom = 0; doom < 200; doom++) - { - if (Main.npc[doom].active && Main.npc[doom].boss) - { - player.KillMeForGood(); - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - if (!CalamityWorld.ironHeart) - { - CalamityWorld.ironHeart = true; - string key = "Mods.CalamityMod.IronHeartText"; - Color messageColor = Color.LightSkyBlue; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else - { - CalamityWorld.ironHeart = false; - string key = "Mods.CalamityMod.IronHeartText2"; - Color messageColor = Color.LightSkyBlue; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - return true; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.Items +{ + public class IronHeart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Iron Heart"); + Tooltip.SetDefault("Makes dying while a boss is alive permanently kill you.\n" + + "Can be toggled on and off.\n" + + "Using this while a boss is alive will permanently kill you.\n" + + "Cannot be activated if any boss has been killed."); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 28; + item.expert = true; + item.rare = 9; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.UseSound = SoundID.Item119; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + if (CalamityWorld.downedBossAny) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + for (int doom = 0; doom < 200; doom++) + { + if (Main.npc[doom].active && Main.npc[doom].boss) + { + player.KillMeForGood(); + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + if (!CalamityWorld.ironHeart) + { + CalamityWorld.ironHeart = true; + string key = "Mods.CalamityMod.IronHeartText"; + Color messageColor = Color.LightSkyBlue; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else + { + CalamityWorld.ironHeart = false; + string key = "Mods.CalamityMod.IronHeartText2"; + Color messageColor = Color.LightSkyBlue; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + return true; + } + } +} diff --git a/Items/Levi.cs b/Items/Levi.cs index 870af9b89a..4db6bead65 100644 --- a/Items/Levi.cs +++ b/Items/Levi.cs @@ -1,36 +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 -{ - public class Levi : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Levi"); - Tooltip.SetDefault("Summons a baby Leviathan pet"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.ZephyrFish); - item.shoot = mod.ProjectileType("Levi"); - item.buffType = mod.BuffType("Levi"); - item.rare = 10; - } - - 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 +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 +{ + public class Levi : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Levi"); + Tooltip.SetDefault("Summons a baby Leviathan pet"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.ZephyrFish); + item.shoot = mod.ProjectileType("Levi"); + item.buffType = mod.BuffType("Levi"); + item.rare = 10; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } + } +} diff --git a/Items/Leviathan/EnchantedPearl.cs b/Items/Leviathan/EnchantedPearl.cs index c344b5d415..275d2164e5 100644 --- a/Items/Leviathan/EnchantedPearl.cs +++ b/Items/Leviathan/EnchantedPearl.cs @@ -1,35 +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.Leviathan -{ - public class EnchantedPearl : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Enchanted Pearl"); - Tooltip.SetDefault("Increases fishing skill\nCrate potion effect, does not stack with crate potions"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 7; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.fishingSkill += 10; - player.cratePotion = true; - } - } -} \ No newline at end of file +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.Leviathan +{ + public class EnchantedPearl : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Enchanted Pearl"); + Tooltip.SetDefault("Increases fishing skill\nCrate potion effect, does not stack with crate potions"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 7; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.fishingSkill += 10; + player.cratePotion = true; + } + } +} diff --git a/Items/Leviathan/IOU.cs b/Items/Leviathan/IOU.cs index c8f784edfc..32eca08ce4 100644 --- a/Items/Leviathan/IOU.cs +++ b/Items/Leviathan/IOU.cs @@ -1,28 +1,28 @@ -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.Leviathan -{ - public class IOU : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("IOU an item"); - Tooltip.SetDefault("Use to craft any Leviathan weapon you want\nCombine with Living Shards from Plantera to get your item!"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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.Leviathan +{ + public class IOU : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("IOU an item"); + Tooltip.SetDefault("Use to craft any Leviathan weapon you want\nCombine with Living Shards from Plantera to get your item!"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/Leviathan/LeviathanAmbergris.cs b/Items/Leviathan/LeviathanAmbergris.cs index 993b5f8915..a69955f28f 100644 --- a/Items/Leviathan/LeviathanAmbergris.cs +++ b/Items/Leviathan/LeviathanAmbergris.cs @@ -1,105 +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; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Leviathan -{ - public class LeviathanAmbergris : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leviathan Ambergris"); - Tooltip.SetDefault("You leave behind poisonous seawater as you move\n" + - "75% increased movement speed, 10% increase to all damage, and plus 20 defense while submerged in liquid\n" + - "If you are damaged while submerged in liquid you will gain a damaging aura for a short time\n" + - "Being outside of liquid increases all damage by 5% and increases damage reduction by 5%"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 22; - item.value = Item.buyPrice(0, 30, 0, 0); - item.accessory = true; - item.expert = true; - item.rare = 9; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.ignoreWater = true; - if (!player.lavaWet && !player.honeyWet) - { - if (!Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.endurance += 0.05f; - player.meleeDamage += 0.05f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; - player.rangedDamage += 0.05f; - player.magicDamage += 0.05f; - player.minionDamage += 0.05f; - } - else - { - player.meleeDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - player.rangedDamage += 0.1f; - player.magicDamage += 0.1f; - player.minionDamage += 0.1f; - player.statDefense += 20; - player.moveSpeed += 0.75f; - } - } - if (((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1)) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 50, 5f, player.whoAmI, 0f, 0f); - } - } - int seaCounter = 0; - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 0.5f, 1.25f); - int num = BuffID.Venom; - float num2 = 200f; - bool flag = seaCounter % 60 == 0; - int num3 = 15; - int random = Main.rand.Next(5); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0 && player.immune && (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir))) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (nPC.FindBuffIndex(num) == -1) - { - nPC.AddBuff(num, 300, false); - } - if (flag) - { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != 0) - { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - seaCounter++; - if (seaCounter >= 180) - { - seaCounter = 0; - } - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Leviathan +{ + public class LeviathanAmbergris : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviathan Ambergris"); + Tooltip.SetDefault("You leave behind poisonous seawater as you move\n" + + "75% increased movement speed, 10% increase to all damage, and plus 20 defense while submerged in liquid\n" + + "If you are damaged while submerged in liquid you will gain a damaging aura for a short time\n" + + "Being outside of liquid increases all damage by 5% and increases damage reduction by 5%"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 22; + item.value = Item.buyPrice(0, 30, 0, 0); + item.accessory = true; + item.expert = true; + item.rare = 9; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.ignoreWater = true; + if (!player.lavaWet && !player.honeyWet) + { + if (!Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.endurance += 0.05f; + player.meleeDamage += 0.05f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.05f; + player.rangedDamage += 0.05f; + player.magicDamage += 0.05f; + player.minionDamage += 0.05f; + } + else + { + player.meleeDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + player.rangedDamage += 0.1f; + player.magicDamage += 0.1f; + player.minionDamage += 0.1f; + player.statDefense += 20; + player.moveSpeed += 0.75f; + } + } + if (((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1)) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 50, 5f, player.whoAmI, 0f, 0f); + } + } + int seaCounter = 0; + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 0.5f, 1.25f); + int num = BuffID.Venom; + float num2 = 200f; + bool flag = seaCounter % 60 == 0; + int num3 = 15; + int random = Main.rand.Next(5); + if (player.whoAmI == Main.myPlayer) + { + if (random == 0 && player.immune && (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir))) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1) + { + nPC.AddBuff(num, 300, false); + } + if (flag) + { + nPC.StrikeNPC(num3, 0f, 0, false, false, false); + if (Main.netMode != 0) + { + NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + seaCounter++; + if (seaCounter >= 180) + { + seaCounter = 0; + } + } + } +} diff --git a/Items/Leviathan/LeviathanBag.cs b/Items/Leviathan/LeviathanBag.cs index f86e6e839b..5dc97ef039 100644 --- a/Items/Leviathan/LeviathanBag.cs +++ b/Items/Leviathan/LeviathanBag.cs @@ -1,128 +1,128 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Leviathan -{ - public class LeviathanBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("Siren"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - bool hardMode = Main.hardMode; - if (CalamityWorld.revenge) - { - if (Main.rand.Next(100) == 0) - { - player.QuickSpawnItem(mod.ItemType("TheCommunity")); - } - else if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - player.QuickSpawnItem(mod.ItemType("TheCommunity")); - } - } - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.QuickSpawnItem(mod.ItemType("EnchantedPearl")); - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.HotlineFishingHook); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.BottomlessBucket); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(ItemID.SuperAbsorbantSponge); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.CratePotion, Main.rand.Next(5, 9)); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.FishingPotion, Main.rand.Next(5, 9)); - } - if (Main.rand.Next(5) == 0) - { - player.QuickSpawnItem(ItemID.SonarPotion, Main.rand.Next(5, 9)); - } - if (!hardMode) - { - player.QuickSpawnItem(mod.ItemType("IOU")); - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("LeviathanMask")); - } - if (hardMode) - { - player.TryGettingDevArmor(); - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Atlantis")); //done - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("BrackishFlask")); //done - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Leviatitan")); //done - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("LureofEnthrallment")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("SirensSong")); //done - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Greentide")); //done - } - player.QuickSpawnItem(mod.ItemType("LeviathanAmbergris")); //done - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Leviathan +{ + public class LeviathanBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("Siren"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + bool hardMode = Main.hardMode; + if (CalamityWorld.revenge) + { + if (Main.rand.Next(100) == 0) + { + player.QuickSpawnItem(mod.ItemType("TheCommunity")); + } + else if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + player.QuickSpawnItem(mod.ItemType("TheCommunity")); + } + } + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.QuickSpawnItem(mod.ItemType("EnchantedPearl")); + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.HotlineFishingHook); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.BottomlessBucket); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(ItemID.SuperAbsorbantSponge); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.CratePotion, Main.rand.Next(5, 9)); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.FishingPotion, Main.rand.Next(5, 9)); + } + if (Main.rand.Next(5) == 0) + { + player.QuickSpawnItem(ItemID.SonarPotion, Main.rand.Next(5, 9)); + } + if (!hardMode) + { + player.QuickSpawnItem(mod.ItemType("IOU")); + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("LeviathanMask")); + } + if (hardMode) + { + player.TryGettingDevArmor(); + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Atlantis")); //done + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("BrackishFlask")); //done + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Leviatitan")); //done + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("LureofEnthrallment")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("SirensSong")); //done + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Greentide")); //done + } + player.QuickSpawnItem(mod.ItemType("LeviathanAmbergris")); //done + } + } + } +} diff --git a/Items/LivingShard.cs b/Items/LivingShard.cs index 142ff02c00..d8062750ce 100644 --- a/Items/LivingShard.cs +++ b/Items/LivingShard.cs @@ -1,29 +1,29 @@ -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.NPCs; - -namespace CalamityMod.Items -{ - public class LivingShard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Living Shard"); - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 14; - item.maxStack = 999; - item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = 7; - } - } -} \ No newline at end of file +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.NPCs; + +namespace CalamityMod.Items +{ + public class LivingShard : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Living Shard"); + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 14; + item.maxStack = 999; + item.value = Item.buyPrice(0, 4, 50, 0); + item.rare = 7; + } + } +} diff --git a/Items/LoreItems/Knowledge.cs b/Items/LoreItems/Knowledge.cs index 626f5dcb1c..8494cffbe6 100644 --- a/Items/LoreItems/Knowledge.cs +++ b/Items/LoreItems/Knowledge.cs @@ -42,4 +42,4 @@ namespace CalamityMod.Items.LoreItems } } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge10.cs b/Items/LoreItems/Knowledge10.cs index e668f8fa53..8200d31a9e 100644 --- a/Items/LoreItems/Knowledge10.cs +++ b/Items/LoreItems/Knowledge10.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge11.cs b/Items/LoreItems/Knowledge11.cs index d72edf520d..ed13af2312 100644 --- a/Items/LoreItems/Knowledge11.cs +++ b/Items/LoreItems/Knowledge11.cs @@ -84,4 +84,4 @@ namespace CalamityMod.Items.LoreItems return true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge12.cs b/Items/LoreItems/Knowledge12.cs index 00ff91c0a4..07704e87c5 100644 --- a/Items/LoreItems/Knowledge12.cs +++ b/Items/LoreItems/Knowledge12.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.eaterOfWorldsLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge13.cs b/Items/LoreItems/Knowledge13.cs index 8fc509edce..8df26be3fb 100644 --- a/Items/LoreItems/Knowledge13.cs +++ b/Items/LoreItems/Knowledge13.cs @@ -42,4 +42,4 @@ namespace CalamityMod.Items.LoreItems } } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge14.cs b/Items/LoreItems/Knowledge14.cs index 5b0f6259b0..2022fbd205 100644 --- a/Items/LoreItems/Knowledge14.cs +++ b/Items/LoreItems/Knowledge14.cs @@ -42,4 +42,4 @@ namespace CalamityMod.Items.LoreItems } } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge15.cs b/Items/LoreItems/Knowledge15.cs index a9247d70c9..ee791a1ead 100644 --- a/Items/LoreItems/Knowledge15.cs +++ b/Items/LoreItems/Knowledge15.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Items.LoreItems player.statDefense -= 10; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge16.cs b/Items/LoreItems/Knowledge16.cs index 3e28de5a05..ec9713577f 100644 --- a/Items/LoreItems/Knowledge16.cs +++ b/Items/LoreItems/Knowledge16.cs @@ -38,4 +38,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.queenBeeLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge17.cs b/Items/LoreItems/Knowledge17.cs index 91322d07bb..3f8b04a9ef 100644 --- a/Items/LoreItems/Knowledge17.cs +++ b/Items/LoreItems/Knowledge17.cs @@ -42,4 +42,4 @@ namespace CalamityMod.Items.LoreItems } } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge18.cs b/Items/LoreItems/Knowledge18.cs index e5323202d5..24a47232f7 100644 --- a/Items/LoreItems/Knowledge18.cs +++ b/Items/LoreItems/Knowledge18.cs @@ -40,4 +40,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.wallOfFleshLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge19.cs b/Items/LoreItems/Knowledge19.cs index bbbacf8a08..afaf8db5d3 100644 --- a/Items/LoreItems/Knowledge19.cs +++ b/Items/LoreItems/Knowledge19.cs @@ -40,4 +40,4 @@ namespace CalamityMod.Items.LoreItems player.statDefense -= 10; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge2.cs b/Items/LoreItems/Knowledge2.cs index 6e48a84c20..023d1d6d77 100644 --- a/Items/LoreItems/Knowledge2.cs +++ b/Items/LoreItems/Knowledge2.cs @@ -42,4 +42,4 @@ namespace CalamityMod.Items.LoreItems } } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge20.cs b/Items/LoreItems/Knowledge20.cs index 990b6f7f35..6dac7e4962 100644 --- a/Items/LoreItems/Knowledge20.cs +++ b/Items/LoreItems/Knowledge20.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge21.cs b/Items/LoreItems/Knowledge21.cs index 6ec601ce6e..e51c2cf659 100644 --- a/Items/LoreItems/Knowledge21.cs +++ b/Items/LoreItems/Knowledge21.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.destroyerLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge22.cs b/Items/LoreItems/Knowledge22.cs index cfcf3f3169..561aa67c26 100644 --- a/Items/LoreItems/Knowledge22.cs +++ b/Items/LoreItems/Knowledge22.cs @@ -41,4 +41,4 @@ namespace CalamityMod.Items.LoreItems } } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge23.cs b/Items/LoreItems/Knowledge23.cs index 235f3f864f..dabea1117a 100644 --- a/Items/LoreItems/Knowledge23.cs +++ b/Items/LoreItems/Knowledge23.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.skeletronPrimeLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge24.cs b/Items/LoreItems/Knowledge24.cs index 9a7c4bb5ae..728133a04d 100644 --- a/Items/LoreItems/Knowledge24.cs +++ b/Items/LoreItems/Knowledge24.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.calamitasLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge25.cs b/Items/LoreItems/Knowledge25.cs index 29f8bde6ee..355caa3f08 100644 --- a/Items/LoreItems/Knowledge25.cs +++ b/Items/LoreItems/Knowledge25.cs @@ -40,4 +40,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.planteraLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge26.cs b/Items/LoreItems/Knowledge26.cs index a38e8a12b8..fa45512b79 100644 --- a/Items/LoreItems/Knowledge26.cs +++ b/Items/LoreItems/Knowledge26.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.brimstoneElementalLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge27.cs b/Items/LoreItems/Knowledge27.cs index 2825e7e90a..81bf00fe9e 100644 --- a/Items/LoreItems/Knowledge27.cs +++ b/Items/LoreItems/Knowledge27.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.aquaticScourgeLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge28.cs b/Items/LoreItems/Knowledge28.cs index 6a96701fec..ddbf7130a6 100644 --- a/Items/LoreItems/Knowledge28.cs +++ b/Items/LoreItems/Knowledge28.cs @@ -40,4 +40,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.leviathanAndSirenLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge29.cs b/Items/LoreItems/Knowledge29.cs index 290badf12d..a8e062d53c 100644 --- a/Items/LoreItems/Knowledge29.cs +++ b/Items/LoreItems/Knowledge29.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.astrumDeusLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge3.cs b/Items/LoreItems/Knowledge3.cs index df624c9e83..682193b72a 100644 --- a/Items/LoreItems/Knowledge3.cs +++ b/Items/LoreItems/Knowledge3.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems player.nightVision = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge30.cs b/Items/LoreItems/Knowledge30.cs index 90722a6c3b..ae00858f9b 100644 --- a/Items/LoreItems/Knowledge30.cs +++ b/Items/LoreItems/Knowledge30.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.astrumAureusLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge31.cs b/Items/LoreItems/Knowledge31.cs index 85b2829658..ba4b30fbea 100644 --- a/Items/LoreItems/Knowledge31.cs +++ b/Items/LoreItems/Knowledge31.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.golemLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge32.cs b/Items/LoreItems/Knowledge32.cs index 12ee6fbee4..0d53877e7f 100644 --- a/Items/LoreItems/Knowledge32.cs +++ b/Items/LoreItems/Knowledge32.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.plaguebringerGoliathLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge33.cs b/Items/LoreItems/Knowledge33.cs index 6557db22b0..9b6f2639e2 100644 --- a/Items/LoreItems/Knowledge33.cs +++ b/Items/LoreItems/Knowledge33.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.ravagerLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge34.cs b/Items/LoreItems/Knowledge34.cs index ac75d29f2d..bf712de328 100644 --- a/Items/LoreItems/Knowledge34.cs +++ b/Items/LoreItems/Knowledge34.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge35.cs b/Items/LoreItems/Knowledge35.cs index 646080c447..6379eb0817 100644 --- a/Items/LoreItems/Knowledge35.cs +++ b/Items/LoreItems/Knowledge35.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge36.cs b/Items/LoreItems/Knowledge36.cs index ba48f87213..c01cbf52dc 100644 --- a/Items/LoreItems/Knowledge36.cs +++ b/Items/LoreItems/Knowledge36.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge37.cs b/Items/LoreItems/Knowledge37.cs index 6839effa87..0f810ef917 100644 --- a/Items/LoreItems/Knowledge37.cs +++ b/Items/LoreItems/Knowledge37.cs @@ -40,4 +40,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.moonLordLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge38.cs b/Items/LoreItems/Knowledge38.cs index fb9e712ea0..bcede33c50 100644 --- a/Items/LoreItems/Knowledge38.cs +++ b/Items/LoreItems/Knowledge38.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge39.cs b/Items/LoreItems/Knowledge39.cs index 1c0a3fbf14..1cc3a2a998 100644 --- a/Items/LoreItems/Knowledge39.cs +++ b/Items/LoreItems/Knowledge39.cs @@ -40,4 +40,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.providenceLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge4.cs b/Items/LoreItems/Knowledge4.cs index 4b92d41c5b..fd24ef46fd 100644 --- a/Items/LoreItems/Knowledge4.cs +++ b/Items/LoreItems/Knowledge4.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Items.LoreItems } } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge40.cs b/Items/LoreItems/Knowledge40.cs index db0a5a424e..3796ff64c2 100644 --- a/Items/LoreItems/Knowledge40.cs +++ b/Items/LoreItems/Knowledge40.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge41.cs b/Items/LoreItems/Knowledge41.cs index 49bdac30ce..35c4f6e8fb 100644 --- a/Items/LoreItems/Knowledge41.cs +++ b/Items/LoreItems/Knowledge41.cs @@ -40,4 +40,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.polterghastLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge42.cs b/Items/LoreItems/Knowledge42.cs index 51b2c52a76..86c2de0501 100644 --- a/Items/LoreItems/Knowledge42.cs +++ b/Items/LoreItems/Knowledge42.cs @@ -40,4 +40,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.DoGLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge43.cs b/Items/LoreItems/Knowledge43.cs index f39404dcf0..2dafda3007 100644 --- a/Items/LoreItems/Knowledge43.cs +++ b/Items/LoreItems/Knowledge43.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge44.cs b/Items/LoreItems/Knowledge44.cs index 6aacc283b6..8b1a037b92 100644 --- a/Items/LoreItems/Knowledge44.cs +++ b/Items/LoreItems/Knowledge44.cs @@ -40,4 +40,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.yharonLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge45.cs b/Items/LoreItems/Knowledge45.cs index 1a8aeb040d..108d4a2bb8 100644 --- a/Items/LoreItems/Knowledge45.cs +++ b/Items/LoreItems/Knowledge45.cs @@ -41,4 +41,4 @@ namespace CalamityMod.Items.LoreItems modPlayer.SCalLore = true; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge5.cs b/Items/LoreItems/Knowledge5.cs index 6f5e097695..612de2ede3 100644 --- a/Items/LoreItems/Knowledge5.cs +++ b/Items/LoreItems/Knowledge5.cs @@ -44,4 +44,4 @@ namespace CalamityMod.Items.LoreItems } } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge6.cs b/Items/LoreItems/Knowledge6.cs index 6761e068ff..739987fabc 100644 --- a/Items/LoreItems/Knowledge6.cs +++ b/Items/LoreItems/Knowledge6.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge7.cs b/Items/LoreItems/Knowledge7.cs index ab83466970..23284a6249 100644 --- a/Items/LoreItems/Knowledge7.cs +++ b/Items/LoreItems/Knowledge7.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge8.cs b/Items/LoreItems/Knowledge8.cs index 4641de4482..7df30f1784 100644 --- a/Items/LoreItems/Knowledge8.cs +++ b/Items/LoreItems/Knowledge8.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/LoreItems/Knowledge9.cs b/Items/LoreItems/Knowledge9.cs index 8f9d172957..9cf9da8074 100644 --- a/Items/LoreItems/Knowledge9.cs +++ b/Items/LoreItems/Knowledge9.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.LoreItems return false; } } -} \ No newline at end of file +} diff --git a/Items/MLGRune2.cs b/Items/MLGRune2.cs index 6f3c47d9f6..b2ff4f4180 100644 --- a/Items/MLGRune2.cs +++ b/Items/MLGRune2.cs @@ -57,4 +57,4 @@ namespace CalamityMod.Items return true; } } -} \ No newline at end of file +} diff --git a/Items/ManeaterBulb.cs b/Items/ManeaterBulb.cs index fd59f0c5f5..289b8c4f5b 100644 --- a/Items/ManeaterBulb.cs +++ b/Items/ManeaterBulb.cs @@ -1,28 +1,28 @@ -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 -{ - public class ManeaterBulb : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Maneater Bulb"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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 +{ + public class ManeaterBulb : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Maneater Bulb"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/MarniteObliterator.cs b/Items/MarniteObliterator.cs index 9f03f8bf81..0d13d43c9d 100644 --- a/Items/MarniteObliterator.cs +++ b/Items/MarniteObliterator.cs @@ -1,56 +1,56 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class MarniteObliterator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Marnite Obliterator"); - } - - public override void SetDefaults() - { - item.damage = 13; - item.melee = true; - item.width = 36; - item.height = 18; - item.useTime = 7; - item.useAnimation = 25; - item.channel = true; - item.noUseGraphic = true; - item.noMelee = true; - item.pick = 57; - item.axe = 10; - item.tileBoost++; - item.useStyle = 5; - item.knockBack = 3; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item23; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MarniteObliterator"); - item.shootSpeed = 40f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumBar, 3); - recipe.AddIngredient(ItemID.Granite, 5); - recipe.AddIngredient(ItemID.Marble, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldBar, 3); - recipe.AddIngredient(ItemID.Granite, 5); - recipe.AddIngredient(ItemID.Marble, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class MarniteObliterator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Marnite Obliterator"); + } + + public override void SetDefaults() + { + item.damage = 13; + item.melee = true; + item.width = 36; + item.height = 18; + item.useTime = 7; + item.useAnimation = 25; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + item.pick = 57; + item.axe = 10; + item.tileBoost++; + item.useStyle = 5; + item.knockBack = 3; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item23; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MarniteObliterator"); + item.shootSpeed = 40f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PlatinumBar, 3); + recipe.AddIngredient(ItemID.Granite, 5); + recipe.AddIngredient(ItemID.Marble, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldBar, 3); + recipe.AddIngredient(ItemID.Granite, 5); + recipe.AddIngredient(ItemID.Marble, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/MeldBlob.cs b/Items/MeldBlob.cs index f4184e7482..e4f6b2ebd4 100644 --- a/Items/MeldBlob.cs +++ b/Items/MeldBlob.cs @@ -1,28 +1,28 @@ -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 -{ - public class MeldBlob : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Meld Blob"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 14; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 9; - } - } -} \ No newline at end of file +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 +{ + public class MeldBlob : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Meld Blob"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 14; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 9; + } + } +} diff --git a/Items/MeldiateBar.cs b/Items/MeldiateBar.cs index af9d8fe3c8..705c9c2f31 100644 --- a/Items/MeldiateBar.cs +++ b/Items/MeldiateBar.cs @@ -1,39 +1,39 @@ -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 -{ - public class MeldiateBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Meld Bar"); - } - - public override void SetDefaults() - { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = Item.buyPrice(0, 5, 50, 0); - item.rare = 9; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddIngredient(ItemID.HallowedBar); - recipe.AddIngredient(null, "MeldBlob", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class MeldiateBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Meld Bar"); + } + + public override void SetDefaults() + { + item.width = 15; + item.height = 12; + item.maxStack = 999; + item.value = Item.buyPrice(0, 5, 50, 0); + item.rare = 9; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Ectoplasm); + recipe.AddIngredient(ItemID.HallowedBar); + recipe.AddIngredient(null, "MeldBlob", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } +} diff --git a/Items/MiracleFruit.cs b/Items/MiracleFruit.cs index 1d9e544c19..a6f4cb96d4 100644 --- a/Items/MiracleFruit.cs +++ b/Items/MiracleFruit.cs @@ -1,71 +1,71 @@ -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 MiracleFruit : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Miracle Fruit"); - Tooltip.SetDefault("Permanently increases maximum life by 25\n" + - "Can only be used if the max amount of life fruit has been consumed"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 7; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.mFruit || player.statLifeMax < 500) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(25); - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.mFruit = true; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(null, "AstralJelly", 5); - recipe.AddIngredient(null, "LivingShard", 10); - recipe.AddIngredient(null, "Stardust", 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 MiracleFruit : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Miracle Fruit"); + Tooltip.SetDefault("Permanently increases maximum life by 25\n" + + "Can only be used if the max amount of life fruit has been consumed"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 7; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.mFruit || player.statLifeMax < 500) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(25); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.mFruit = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeFruit, 5); + recipe.AddIngredient(null, "AstralJelly", 5); + recipe.AddIngredient(null, "LivingShard", 10); + recipe.AddIngredient(null, "Stardust", 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Moonlight.cs b/Items/Moonlight.cs index d734951ec0..1065568eb8 100644 --- a/Items/Moonlight.cs +++ b/Items/Moonlight.cs @@ -1,58 +1,58 @@ -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.NPCs; - -namespace CalamityMod.Items -{ - public class Moonlight : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moonlight"); - Tooltip.SetDefault("Summons the moon"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = 4; - item.UseSound = SoundID.Item60; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); - } - - public override bool UseItem(Player player) - { - Main.dayTime = false; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofNight, 7); - recipe.AddIngredient(null, "CryoBar", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.NPCs; + +namespace CalamityMod.Items +{ + public class Moonlight : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moonlight"); + Tooltip.SetDefault("Summons the moon"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 4; + item.UseSound = SoundID.Item60; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); + } + + public override bool UseItem(Player player) + { + Main.dayTime = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofNight, 7); + recipe.AddIngredient(null, "CryoBar", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Mounts/Fab.cs b/Items/Mounts/Fab.cs index b8294053b8..bf7ac4f4e7 100644 --- a/Items/Mounts/Fab.cs +++ b/Items/Mounts/Fab.cs @@ -1,118 +1,118 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; -using System; -using CalamityMod.Items; -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 = 34; - 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 = 7; //-8 - mountData.playerHeadOffset = 36; //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) > 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; - } - } - } -} +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items; +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 = 34; + 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 = 7; //-8 + mountData.playerHeadOffset = 36; //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) > 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/PhuppersChair.cs b/Items/Mounts/PhuppersChair.cs index 6457b23356..e2a728aa13 100644 --- a/Items/Mounts/PhuppersChair.cs +++ b/Items/Mounts/PhuppersChair.cs @@ -1,64 +1,64 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Items.Mounts -{ - class PhuppersChair : ModMountData - { - public override void SetDefaults() - { - mountData.spawnDust = 235; - mountData.spawnDustNoGravity = true; - mountData.buff = mod.BuffType("BrimstoneMount"); - mountData.heightBoost = 12; - mountData.flightTimeMax = int.MaxValue - 1; - mountData.fatigueMax = int.MaxValue - 1; - mountData.fallDamage = 0f; - mountData.usesHover = true; - mountData.runSpeed = 12f; - mountData.dashSpeed = 12f; - mountData.acceleration = 0.2f; - mountData.jumpHeight = 10; - mountData.jumpSpeed = 4f; - mountData.blockExtraJumps = false; - mountData.totalFrames = 4; - int[] array = new int[mountData.totalFrames]; - for (int l = 0; l < array.Length; l++) - { - array[l] = 12; - } - mountData.playerYOffsets = array; - mountData.xOffset = 1; - mountData.bodyFrame = 3; - mountData.yOffset = 0; - mountData.playerHeadOffset = 18; - mountData.standingFrameCount = 4; - mountData.standingFrameDelay = 4; - mountData.standingFrameStart = 0; - mountData.runningFrameCount = 4; - mountData.runningFrameDelay = 16; - mountData.runningFrameStart = 0; - mountData.flyingFrameCount = 4; - mountData.flyingFrameDelay = 4; - mountData.flyingFrameStart = 0; - mountData.inAirFrameCount = 4; - mountData.inAirFrameDelay = 4; - mountData.inAirFrameStart = 0; - mountData.idleFrameCount = 4; - mountData.idleFrameDelay = 8; - mountData.idleFrameStart = 0; - mountData.idleFrameLoop = true; - mountData.swimFrameCount = 4; - mountData.swimFrameDelay = 4; - mountData.swimFrameStart = 0; - if (Main.netMode != 2) - { - mountData.textureWidth = mountData.backTexture.Width; - mountData.textureHeight = mountData.backTexture.Height; - } - } - } -} +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Mounts +{ + class PhuppersChair : ModMountData + { + public override void SetDefaults() + { + mountData.spawnDust = 235; + mountData.spawnDustNoGravity = true; + mountData.buff = mod.BuffType("BrimstoneMount"); + mountData.heightBoost = 12; + mountData.flightTimeMax = int.MaxValue - 1; + mountData.fatigueMax = int.MaxValue - 1; + mountData.fallDamage = 0f; + mountData.usesHover = true; + mountData.runSpeed = 12f; + mountData.dashSpeed = 12f; + mountData.acceleration = 0.2f; + mountData.jumpHeight = 10; + mountData.jumpSpeed = 4f; + mountData.blockExtraJumps = false; + mountData.totalFrames = 4; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + array[l] = 12; + } + mountData.playerYOffsets = array; + mountData.xOffset = 1; + mountData.bodyFrame = 3; + mountData.yOffset = 0; + mountData.playerHeadOffset = 18; + mountData.standingFrameCount = 4; + mountData.standingFrameDelay = 4; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = 4; + mountData.runningFrameDelay = 16; + mountData.runningFrameStart = 0; + mountData.flyingFrameCount = 4; + mountData.flyingFrameDelay = 4; + mountData.flyingFrameStart = 0; + mountData.inAirFrameCount = 4; + mountData.inAirFrameDelay = 4; + mountData.inAirFrameStart = 0; + mountData.idleFrameCount = 4; + mountData.idleFrameDelay = 8; + mountData.idleFrameStart = 0; + mountData.idleFrameLoop = true; + mountData.swimFrameCount = 4; + mountData.swimFrameDelay = 4; + mountData.swimFrameStart = 0; + if (Main.netMode != 2) + { + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } + } +} diff --git a/Items/Mounts/SquishyBean.cs b/Items/Mounts/SquishyBean.cs index 1fce9191af..5fe8474d6e 100644 --- a/Items/Mounts/SquishyBean.cs +++ b/Items/Mounts/SquishyBean.cs @@ -1,88 +1,88 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; -using System; -using CalamityMod.Items; - -namespace CalamityMod.Items.Mounts -{ - class SquishyBean : ModMountData - { - public override void SetDefaults() - { - mountData.buff = mod.BuffType("SquishyBeanBuff"); - mountData.heightBoost = 58; - mountData.fallDamage = -1; - mountData.runSpeed = 5f; - mountData.dashSpeed = 8f; - mountData.fatigueMax = 0; - mountData.jumpHeight = 20; - mountData.acceleration = 0.1f; - mountData.jumpSpeed = 40f; //20 - mountData.blockExtraJumps = true; - mountData.totalFrames = 4; - mountData.constantJump = true; - mountData.usesHover = false; - int[] array = new int[mountData.totalFrames]; - for (int l = 0; l < array.Length; l++) - { - switch (l) - { - case 0: - array[l] = 44; - break; - case 1: - array[l] = 46; - break; - case 2: - array[l] = 48; - break; - case 3: - array[l] = 48; - break; - } - } - mountData.playerYOffsets = array; - mountData.xOffset = 0; - mountData.bodyFrame = 3; - mountData.yOffset = 19; - mountData.playerHeadOffset = 30; - mountData.standingFrameCount = 1; - mountData.standingFrameDelay = 12; - mountData.standingFrameStart = 0; - mountData.runningFrameCount = 4; - mountData.runningFrameDelay = 24; - mountData.runningFrameStart = 0; - mountData.flyingFrameCount = 0; - mountData.flyingFrameDelay = 0; - mountData.flyingFrameStart = 0; - mountData.inAirFrameCount = 1; - mountData.inAirFrameDelay = 12; - mountData.inAirFrameStart = 0; - mountData.idleFrameCount = 4; - mountData.idleFrameDelay = 12; - mountData.idleFrameStart = 0; - mountData.idleFrameLoop = true; - mountData.flyingFrameCount = 4; - mountData.flyingFrameDelay = 12; - mountData.flyingFrameStart = 0; - 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 void UpdateEffects(Player player) - { - player.statDefense += 60; - player.gravity = 2f; - player.maxFallSpeed = 25f; - } - } -} - +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items; + +namespace CalamityMod.Items.Mounts +{ + class SquishyBean : ModMountData + { + public override void SetDefaults() + { + mountData.buff = mod.BuffType("SquishyBeanBuff"); + mountData.heightBoost = 58; + mountData.fallDamage = -1; + mountData.runSpeed = 5f; + mountData.dashSpeed = 8f; + mountData.fatigueMax = 0; + mountData.jumpHeight = 20; + mountData.acceleration = 0.1f; + mountData.jumpSpeed = 40f; //20 + mountData.blockExtraJumps = true; + mountData.totalFrames = 4; + mountData.constantJump = true; + mountData.usesHover = false; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + switch (l) + { + case 0: + array[l] = 44; + break; + case 1: + array[l] = 46; + break; + case 2: + array[l] = 48; + break; + case 3: + array[l] = 48; + break; + } + } + mountData.playerYOffsets = array; + mountData.xOffset = 0; + mountData.bodyFrame = 3; + mountData.yOffset = 19; + mountData.playerHeadOffset = 30; + mountData.standingFrameCount = 1; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = 4; + mountData.runningFrameDelay = 24; + mountData.runningFrameStart = 0; + mountData.flyingFrameCount = 0; + mountData.flyingFrameDelay = 0; + mountData.flyingFrameStart = 0; + mountData.inAirFrameCount = 1; + mountData.inAirFrameDelay = 12; + mountData.inAirFrameStart = 0; + mountData.idleFrameCount = 4; + mountData.idleFrameDelay = 12; + mountData.idleFrameStart = 0; + mountData.idleFrameLoop = true; + mountData.flyingFrameCount = 4; + mountData.flyingFrameDelay = 12; + mountData.flyingFrameStart = 0; + 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 void UpdateEffects(Player player) + { + player.statDefense += 60; + player.gravity = 2f; + player.maxFallSpeed = 25f; + } + } +} + diff --git a/Items/MurkyPaste.cs b/Items/MurkyPaste.cs index 71a6c849f6..5e62873983 100644 --- a/Items/MurkyPaste.cs +++ b/Items/MurkyPaste.cs @@ -1,28 +1,28 @@ -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 -{ - public class MurkyPaste : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Murky Paste"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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 +{ + public class MurkyPaste : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Murky Paste"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/MurkySludge.cs b/Items/MurkySludge.cs index 2fb35bdb49..196296b55c 100644 --- a/Items/MurkySludge.cs +++ b/Items/MurkySludge.cs @@ -1,28 +1,28 @@ -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 -{ - public class MurkySludge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Murky Sludge"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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 +{ + public class MurkySludge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Murky Sludge"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/MushroomPlasmaRoot.cs b/Items/MushroomPlasmaRoot.cs index 830d5bebea..c039fdc2c7 100644 --- a/Items/MushroomPlasmaRoot.cs +++ b/Items/MushroomPlasmaRoot.cs @@ -1,55 +1,55 @@ -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 MushroomPlasmaRoot : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mushroom Plasma Root"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% (60% in Death Mode) more damage\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 2; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.rageBoostOne) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.rageBoostOne = true; - } - return true; - } - } -} \ No newline at end of file +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 MushroomPlasmaRoot : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mushroom Plasma Root"); + Tooltip.SetDefault("Permanently makes Rage Mode do 15% (60% in Death Mode) more damage\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 2; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.rageBoostOne) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.rageBoostOne = true; + } + return true; + } + } +} diff --git a/Items/NightmareFuel.cs b/Items/NightmareFuel.cs index 97ef5535b0..cad77d7135 100644 --- a/Items/NightmareFuel.cs +++ b/Items/NightmareFuel.cs @@ -1,39 +1,39 @@ -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.NPCs; - -namespace CalamityMod.Items -{ - public class NightmareFuel : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nightmare Fuel"); - Tooltip.SetDefault("May drain your sanity"); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.7f * num, 0.7f * num, 0f * num); - } - - public override void SetDefaults() - { - 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; - } - } -} \ No newline at end of file +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.NPCs; + +namespace CalamityMod.Items +{ + public class NightmareFuel : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nightmare Fuel"); + Tooltip.SetDefault("May drain your sanity"); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.7f * num, 0.7f * num, 0f * num); + } + + public override void SetDefaults() + { + 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/OldPowerCell.cs b/Items/OldPowerCell.cs index 0803a853fd..f6044db35b 100644 --- a/Items/OldPowerCell.cs +++ b/Items/OldPowerCell.cs @@ -1,60 +1,60 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class OldPowerCell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Old Power Cell"); - Tooltip.SetDefault("Summons the ancient golem when used in the Temple"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 7; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - bool canSummon = false; - if ((double)player.Center.Y > Main.worldSurface * 16.0) - { - int num = (int)player.Center.X / 16; - int num2 = (int)player.Center.Y / 16; - Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == 87) - { - canSummon = true; - } - } - return canSummon && !NPC.AnyNPCs(NPCID.Golem); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Golem); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarTabletFragment, 10); - recipe.AddIngredient(null, "EssenceofCinder", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class OldPowerCell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Old Power Cell"); + Tooltip.SetDefault("Summons the ancient golem when used in the Temple"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 7; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + bool canSummon = false; + if ((double)player.Center.Y > Main.worldSurface * 16.0) + { + int num = (int)player.Center.X / 16; + int num2 = (int)player.Center.Y / 16; + Tile tile = Framing.GetTileSafely(num, num2); + if (tile.wall == 87) + { + canSummon = true; + } + } + return canSummon && !NPC.AnyNPCs(NPCID.Golem); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Golem); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarTabletFragment, 10); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Patreon/ApronOfAffection.cs b/Items/Patreon/ApronOfAffection.cs index 0e453e4acf..47829dc0f9 100644 --- a/Items/Patreon/ApronOfAffection.cs +++ b/Items/Patreon/ApronOfAffection.cs @@ -1,41 +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.Patreon; - -namespace CalamityMod.Items.Patreon -{ - [AutoloadEquip(EquipType.Body)] - public class ApronOfAffection : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ace's Apron of Affection"); - Tooltip.SetDefault("Great for hugging people"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.rare = 5; - item.GetGlobalItem(mod).postMoonLordRarity = 21; - item.value = Item.buyPrice(0, 15, 0, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Robe); - recipe.AddIngredient(ItemID.LovePotion, 10); - recipe.AddIngredient(ItemID.LifeCrystal); - recipe.AddTile(TileID.Loom); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Patreon; + +namespace CalamityMod.Items.Patreon +{ + [AutoloadEquip(EquipType.Body)] + public class ApronOfAffection : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ace's Apron of Affection"); + Tooltip.SetDefault("Great for hugging people"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.rare = 5; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.value = Item.buyPrice(0, 15, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Robe); + recipe.AddIngredient(ItemID.LovePotion, 10); + recipe.AddIngredient(ItemID.LifeCrystal); + recipe.AddTile(TileID.Loom); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Patreon/Ataraxia.cs b/Items/Patreon/Ataraxia.cs index 3f015e091c..f8ea1a89f1 100644 --- a/Items/Patreon/Ataraxia.cs +++ b/Items/Patreon/Ataraxia.cs @@ -8,139 +8,139 @@ using Terraria.ModLoader; using CalamityMod.Items; namespace CalamityMod.Items.Patreon -{ - public class Ataraxia : ModItem - { - public static int BaseDamage = 3120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataraxia"); - Tooltip.SetDefault("Equanimity"); - } - - public override void SetDefaults() - { - item.width = 94; - item.height = 92; - item.melee = true; - item.damage = BaseDamage; - item.knockBack = 2.5f; - item.useAnimation = 18; - item.useTime = 18; - item.autoReuse = true; - item.useTurn = true; - - item.useStyle = 1; - item.UseSound = SoundID.Item1; - - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; - item.value = Item.buyPrice(2, 50, 0, 0); - - item.shoot = mod.ProjectileType("AtaraxiaMain"); - item.shootSpeed = 9f; - } - - public override void GetWeaponDamage(Player player, ref int damage) - { - float damageBoost = (float)BaseDamage * player.GetModPlayer(mod).ataraxiaDamageBoost; - float damageAdd = damageBoost + (float)BaseDamage; - damage = (int)(damageAdd * player.meleeDamage); - } - - // Fires one large and two small projectiles which stay together in formation. - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - // Play the Terra Blade sound upon firing - Main.PlaySound(SoundID.Item60, position); - - // Center projectile - int centerID = mod.ProjectileType("AtaraxiaMain"); - int centerDamage = damage; - Vector2 centerVec = new Vector2(speedX, speedY); - int center = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, centerID, centerDamage, knockBack, player.whoAmI, 0.0f, 0.0f); - - // Side projectiles (these deal 75% damage) - int sideID = mod.ProjectileType("AtaraxiaSide"); - int sideDamage = (int)(0.75f * centerDamage); - Vector2 speed = new Vector2(speedX, speedY); - speed.Normalize(); - speed *= 22f; - Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 leftOffset = speed.RotatedBy((double)(MathHelper.PiOver4), default(Vector2)); - Vector2 rightOffset = speed.RotatedBy((double)(-MathHelper.PiOver4), default(Vector2)); - leftOffset -= 1.4f * speed; - rightOffset -= 1.4f * speed; - Projectile.NewProjectile(rrp.X + leftOffset.X, rrp.Y + leftOffset.Y, speedX, speedY, sideID, sideDamage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(rrp.X + rightOffset.X, rrp.Y + rightOffset.Y, speedX, speedY, sideID, sideDamage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - // On-hit, tosses out five homing projectiles. This is not like Holy Collider. - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 480); - target.AddBuff(BuffID.Ichor, 480); - - // Does not summon extra projectiles versus dummies. - if (target.type == NPCID.TargetDummy) - return; - - // Individual true melee homing missiles deal 10% of the weapon's base damage. - int numSplits = 5; - int trueMeleeID = mod.ProjectileType("AtaraxiaHoming"); - int trueMeleeDamage = (int)(0.1f * damage); - float angleVariance = MathHelper.TwoPi / (float)numSplits; - float spinOffsetAngle = MathHelper.Pi / (2f * numSplits); - Vector2 posVec = new Vector2(8f, 0f).RotatedByRandom(MathHelper.TwoPi); - - for (int i = 0; i < numSplits; ++i) - { - posVec = posVec.RotatedBy(angleVariance); - Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); - velocity.Normalize(); - velocity *= 8f; - Projectile.NewProjectile(target.Center + posVec, velocity, trueMeleeID, trueMeleeDamage, knockback, player.whoAmI, 0.0f, 0.0f); - } - } - - // Spawn some fancy dust while swinging - public override void MeleeEffects(Player player, Rectangle hitbox) - { - int dustCount = Main.rand.Next(3, 6); - Vector2 corner = new Vector2(hitbox.X + hitbox.Width / 4, hitbox.Y + hitbox.Height / 4); - for (int i = 0; i < dustCount; ++i) - { - // Pick a random dust to spawn - int dustID = -1; - switch (Main.rand.Next(5)) - { - case 0: - case 1: dustID = 70; break; - case 2: dustID = 71; break; - default: dustID = 86; break; - } - int idx = Dust.NewDust(corner, hitbox.Width / 2, hitbox.Height / 2, dustID); - Main.dust[idx].noGravity = true; - } - } - - public override void AddRecipes() +{ + public class Ataraxia : ModItem + { + public static int BaseDamage = 3120; + + public override void SetStaticDefaults() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ItemID.BrokenHeroSword); - r.AddIngredient(null, "CosmiliteBar", 25); - r.AddIngredient(null, "Phantoplasm", 35); - r.AddIngredient(null, "NightmareFuel", 90); - r.AddIngredient(null, "EndothermicEnergy", 90); - r.AddIngredient(null, "DarksunFragment", 65); - r.AddIngredient(null, "BarofLife", 15); - r.AddIngredient(null, "CoreofCalamity", 5); - r.AddIngredient(null, "HellcasterFragment", 10); - r.AddTile(null, "DraedonsForge"); - r.SetResult(this); - r.AddRecipe(); - } + DisplayName.SetDefault("Ataraxia"); + Tooltip.SetDefault("Equanimity"); + } + + public override void SetDefaults() + { + item.width = 94; + item.height = 92; + item.melee = true; + item.damage = BaseDamage; + item.knockBack = 2.5f; + item.useAnimation = 18; + item.useTime = 18; + item.autoReuse = true; + item.useTurn = true; + + item.useStyle = 1; + item.UseSound = SoundID.Item1; + + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.value = Item.buyPrice(2, 50, 0, 0); + + item.shoot = mod.ProjectileType("AtaraxiaMain"); + item.shootSpeed = 9f; + } + + public override void GetWeaponDamage(Player player, ref int damage) + { + float damageBoost = (float)BaseDamage * player.GetModPlayer(mod).ataraxiaDamageBoost; + float damageAdd = damageBoost + (float)BaseDamage; + damage = (int)(damageAdd * player.meleeDamage); + } + + // Fires one large and two small projectiles which stay together in formation. + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + // Play the Terra Blade sound upon firing + Main.PlaySound(SoundID.Item60, position); + + // Center projectile + int centerID = mod.ProjectileType("AtaraxiaMain"); + int centerDamage = damage; + Vector2 centerVec = new Vector2(speedX, speedY); + int center = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, centerID, centerDamage, knockBack, player.whoAmI, 0.0f, 0.0f); + + // Side projectiles (these deal 75% damage) + int sideID = mod.ProjectileType("AtaraxiaSide"); + int sideDamage = (int)(0.75f * centerDamage); + Vector2 speed = new Vector2(speedX, speedY); + speed.Normalize(); + speed *= 22f; + Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 leftOffset = speed.RotatedBy((double)(MathHelper.PiOver4), default(Vector2)); + Vector2 rightOffset = speed.RotatedBy((double)(-MathHelper.PiOver4), default(Vector2)); + leftOffset -= 1.4f * speed; + rightOffset -= 1.4f * speed; + Projectile.NewProjectile(rrp.X + leftOffset.X, rrp.Y + leftOffset.Y, speedX, speedY, sideID, sideDamage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(rrp.X + rightOffset.X, rrp.Y + rightOffset.Y, speedX, speedY, sideID, sideDamage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + // On-hit, tosses out five homing projectiles. This is not like Holy Collider. + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 480); + target.AddBuff(BuffID.Ichor, 480); + + // Does not summon extra projectiles versus dummies. + if (target.type == NPCID.TargetDummy) + return; + + // Individual true melee homing missiles deal 10% of the weapon's base damage. + int numSplits = 5; + int trueMeleeID = mod.ProjectileType("AtaraxiaHoming"); + int trueMeleeDamage = (int)(0.1f * damage); + float angleVariance = MathHelper.TwoPi / (float)numSplits; + float spinOffsetAngle = MathHelper.Pi / (2f * numSplits); + Vector2 posVec = new Vector2(8f, 0f).RotatedByRandom(MathHelper.TwoPi); + + for (int i = 0; i < numSplits; ++i) + { + posVec = posVec.RotatedBy(angleVariance); + Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); + velocity.Normalize(); + velocity *= 8f; + Projectile.NewProjectile(target.Center + posVec, velocity, trueMeleeID, trueMeleeDamage, knockback, player.whoAmI, 0.0f, 0.0f); + } + } + + // Spawn some fancy dust while swinging + public override void MeleeEffects(Player player, Rectangle hitbox) + { + int dustCount = Main.rand.Next(3, 6); + Vector2 corner = new Vector2(hitbox.X + hitbox.Width / 4, hitbox.Y + hitbox.Height / 4); + for (int i = 0; i < dustCount; ++i) + { + // Pick a random dust to spawn + int dustID = -1; + switch (Main.rand.Next(5)) + { + case 0: + case 1: dustID = 70; break; + case 2: dustID = 71; break; + default: dustID = 86; break; + } + int idx = Dust.NewDust(corner, hitbox.Width / 2, hitbox.Height / 2, dustID); + Main.dust[idx].noGravity = true; + } + } + + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.AddIngredient(ItemID.BrokenHeroSword); + r.AddIngredient(null, "CosmiliteBar", 25); + r.AddIngredient(null, "Phantoplasm", 35); + r.AddIngredient(null, "NightmareFuel", 90); + r.AddIngredient(null, "EndothermicEnergy", 90); + r.AddIngredient(null, "DarksunFragment", 65); + r.AddIngredient(null, "BarofLife", 15); + r.AddIngredient(null, "CoreofCalamity", 5); + r.AddIngredient(null, "HellcasterFragment", 10); + r.AddTile(null, "DraedonsForge"); + r.SetResult(this); + r.AddRecipe(); + } } } diff --git a/Items/Patreon/DarkSpark.cs b/Items/Patreon/DarkSpark.cs index c889c356df..ed85b61cfd 100644 --- a/Items/Patreon/DarkSpark.cs +++ b/Items/Patreon/DarkSpark.cs @@ -1,63 +1,63 @@ -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 DarkSpark : 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.Patreon +{ + public class DarkSpark : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Spark"); - Tooltip.SetDefault("And everything under the sun is in tune,\n" + + Tooltip.SetDefault("And everything under the sun is in tune,\n" + "But the sun is eclipsed by the moon."); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); } - public override void SetDefaults() - { - item.damage = 100; - item.magic = true; - item.mana = 10; - item.width = 16; - item.height = 16; - item.useTime = 10; - item.useAnimation = 10; - item.reuseDelay = 5; - item.useStyle = 4; - item.UseSound = SoundID.Item13; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 0f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("DarkSpark"); - item.shootSpeed = 30f; - item.GetGlobalItem(mod).postMoonLordRarity = 21; - } - - 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("DarkSpark"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LastPrism); - recipe.AddIngredient(null, "DarkPlasma", 10); - recipe.AddIngredient(null, "RuinousSoul", 20); - recipe.AddIngredient(null, "DivineGeode", 30); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 100; + item.magic = true; + item.mana = 10; + item.width = 16; + item.height = 16; + item.useTime = 10; + item.useAnimation = 10; + item.reuseDelay = 5; + item.useStyle = 4; + item.UseSound = SoundID.Item13; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 0f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("DarkSpark"); + item.shootSpeed = 30f; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + } + + 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("DarkSpark"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LastPrism); + recipe.AddIngredient(null, "DarkPlasma", 10); + recipe.AddIngredient(null, "RuinousSoul", 20); + recipe.AddIngredient(null, "DivineGeode", 30); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Patreon/DivineRetribution.cs b/Items/Patreon/DivineRetribution.cs index 4c72794f51..25bf6cc811 100644 --- a/Items/Patreon/DivineRetribution.cs +++ b/Items/Patreon/DivineRetribution.cs @@ -1,102 +1,102 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Patreon -{ - public class DivineRetribution : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Divine Retribution"); - Tooltip.SetDefault("Mage is superior to rogue; look, we got a donor weapon to prove it!"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 60; - item.magic = true; - item.mana = 15; - item.width = 66; - item.height = 88; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.shootSpeed = 19f; - item.shoot = mod.ProjectileType("DivineRetribution"); - item.GetGlobalItem(mod).postMoonLordRarity = 21; - } - - 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)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - int num107 = Main.rand.Next(5, 7); - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); //200 - 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 speedX6 = num78 + (float)Main.rand.Next(-60, 61) * 0.02f; - float speedY7 = num79 + (float)Main.rand.Next(-60, 61) * 0.02f; - float ai1 = (Main.rand.NextFloat() + 0.5f); - int bullet2 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, -speedY7, type, damage, knockBack, player.whoAmI, 0.0f, ai1); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DivineGeode", 8); - recipe.AddIngredient(null, "UndinesRetribution"); - recipe.AddIngredient(null, "UeliaceBar", 6); - recipe.AddIngredient(null, "UnholyEssence", 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Patreon +{ + public class DivineRetribution : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Divine Retribution"); + Tooltip.SetDefault("Mage is superior to rogue; look, we got a donor weapon to prove it!"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 60; + item.magic = true; + item.mana = 15; + item.width = 66; + item.height = 88; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item73; + item.autoReuse = true; + item.shootSpeed = 19f; + item.shoot = mod.ProjectileType("DivineRetribution"); + item.GetGlobalItem(mod).postMoonLordRarity = 21; + } + + 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)); + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + int num107 = Main.rand.Next(5, 7); + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); //200 + 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 speedX6 = num78 + (float)Main.rand.Next(-60, 61) * 0.02f; + float speedY7 = num79 + (float)Main.rand.Next(-60, 61) * 0.02f; + float ai1 = (Main.rand.NextFloat() + 0.5f); + int bullet2 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, -speedY7, type, damage, knockBack, player.whoAmI, 0.0f, ai1); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DivineGeode", 8); + recipe.AddIngredient(null, "UndinesRetribution"); + recipe.AddIngredient(null, "UeliaceBar", 6); + recipe.AddIngredient(null, "UnholyEssence", 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Patreon/FaceMelter.cs b/Items/Patreon/FaceMelter.cs index 6e49f9b371..bf60518148 100644 --- a/Items/Patreon/FaceMelter.cs +++ b/Items/Patreon/FaceMelter.cs @@ -1,102 +1,102 @@ -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 FaceMelter : 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.Patreon +{ + public class FaceMelter : ModItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Face Melter"); - Tooltip.SetDefault("Fires music notes\n" + - "Right click summons an amplifier that shoots towards your mouse\n" + + DisplayName.SetDefault("Face Melter"); + Tooltip.SetDefault("Fires music notes\n" + + "Right click summons an amplifier that shoots towards your mouse\n" + "WOOO!! FAAAAAAANTASYY WORLDDDDD!"); - } - - public override void SetDefaults() - { - item.damage = 250; - item.magic = true; - item.mana = 5; - item.width = 56; - item.height = 50; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; - item.value = Item.buyPrice(1, 80, 0, 0); - item.shoot = mod.ProjectileType("MelterNote1"); - item.UseSound = SoundID.Item47; - item.autoReuse = true; - item.shootSpeed = 20f; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TheAxe); - recipe.AddIngredient(ItemID.MagicalHarp); - recipe.AddIngredient(null, "SirensSong"); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "NightmareFuel", 10); - recipe.AddIngredient(null, "EndothermicEnergy", 10); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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) - { - if (player.altFunctionUse == 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - item.useTime = 20; - item.useAnimation = 20; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MelterAmp"), damage, knockBack, player.whoAmI); - return false; - } - else - { - item.useTime = 5; - item.useAnimation = 5; - float SpeedX = speedX; - float SpeedY = speedY; - int note = Main.rand.Next(0, 2); - if (note == 0) - { - damage = (int)(damage * 1.5f); - type = mod.ProjectileType("MelterNote1"); - } - else - { - SpeedX *= 1.5f; - SpeedY *= 1.5f; - type = mod.ProjectileType("MelterNote2"); - } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 250; + item.magic = true; + item.mana = 5; + item.width = 56; + item.height = 50; + item.useTime = 5; + item.useAnimation = 5; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.value = Item.buyPrice(1, 80, 0, 0); + item.shoot = mod.ProjectileType("MelterNote1"); + item.UseSound = SoundID.Item47; + item.autoReuse = true; + item.shootSpeed = 20f; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TheAxe); + recipe.AddIngredient(ItemID.MagicalHarp); + recipe.AddIngredient(null, "SirensSong"); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "NightmareFuel", 10); + recipe.AddIngredient(null, "EndothermicEnergy", 10); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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) + { + if (player.altFunctionUse == 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + item.useTime = 20; + item.useAnimation = 20; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MelterAmp"), damage, knockBack, player.whoAmI); + return false; + } + else + { + item.useTime = 5; + item.useAnimation = 5; + float SpeedX = speedX; + float SpeedY = speedY; + int note = Main.rand.Next(0, 2); + if (note == 0) + { + damage = (int)(damage * 1.5f); + type = mod.ProjectileType("MelterNote1"); + } + else + { + SpeedX *= 1.5f; + SpeedY *= 1.5f; + type = mod.ProjectileType("MelterNote2"); + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } + } +} diff --git a/Items/Patreon/ForgottenDragonEgg.cs b/Items/Patreon/ForgottenDragonEgg.cs index 2d54eee8df..df2326be9d 100644 --- a/Items/Patreon/ForgottenDragonEgg.cs +++ b/Items/Patreon/ForgottenDragonEgg.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Patreon } } } -} \ No newline at end of file +} diff --git a/Items/Patreon/HandheldTank.cs b/Items/Patreon/HandheldTank.cs index 328407b761..78117719eb 100644 --- a/Items/Patreon/HandheldTank.cs +++ b/Items/Patreon/HandheldTank.cs @@ -7,61 +7,61 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Patreon -{ - public class HandheldTank : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Handheld Tank"); - } - - public override void SetDefaults() - { - item.width = 110; - item.height = 46; - item.ranged = true; - item.damage = 1850; - item.crit += 15; - item.knockBack = 16f; - item.useTime = 71; - item.useAnimation = 71; - item.autoReuse = true; - - item.useStyle = 5; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TankCannon"); - item.noMelee = true; - - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; - - item.shoot = mod.ProjectileType("HandheldTankShell"); - item.shootSpeed = 6f; - item.useAmmo = AmmoID.Rocket; - } - - 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("HandheldTankShell"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-33, 0); - } - - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(null, "Shroomer"); - r.AddIngredient(ItemID.IronBar, 50); - r.anyIronBar = true; - r.AddIngredient(null, "DivineGeode", 5); - r.AddIngredient(ItemID.TigerSkin); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); - } +{ + public class HandheldTank : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Handheld Tank"); + } + + public override void SetDefaults() + { + item.width = 110; + item.height = 46; + item.ranged = true; + item.damage = 1850; + item.crit += 15; + item.knockBack = 16f; + item.useTime = 71; + item.useAnimation = 71; + item.autoReuse = true; + + item.useStyle = 5; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TankCannon"); + item.noMelee = true; + + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + + item.shoot = mod.ProjectileType("HandheldTankShell"); + item.shootSpeed = 6f; + item.useAmmo = AmmoID.Rocket; + } + + 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("HandheldTankShell"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-33, 0); + } + + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.AddIngredient(null, "Shroomer"); + r.AddIngredient(ItemID.IronBar, 50); + r.anyIronBar = true; + r.AddIngredient(null, "DivineGeode", 5); + r.AddIngredient(ItemID.TigerSkin); + r.AddTile(TileID.LunarCraftingStation); + r.SetResult(this); + r.AddRecipe(); + } } } diff --git a/Items/Patreon/Keelhaul.cs b/Items/Patreon/Keelhaul.cs index a34b7eb941..aa94d9a5a7 100644 --- a/Items/Patreon/Keelhaul.cs +++ b/Items/Patreon/Keelhaul.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Patreon -{ - public class Keelhaul : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Patreon +{ + public class Keelhaul : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Keelhaul"); - Tooltip.SetDefault("Summons a geyser upon hitting an enemy\n"+ + Tooltip.SetDefault("Summons a geyser upon hitting an enemy\n"+ "Crumple 'em like paper"); } - - public override void SetDefaults() - { - item.width = 42; - item.height = 42; - item.damage = 55; - item.mana = 50; - item.magic = true; - item.noMelee = true; - item.useTime = 30; - item.useAnimation = 30; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 2f; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.rare = 8; - item.GetGlobalItem(mod).postMoonLordRarity = 21; - item.value = Item.buyPrice(0, 80, 0, 0); - item.shoot = mod.ProjectileType("KeelhaulBubble"); - item.shootSpeed = 15f; - } - } -} + + public override void SetDefaults() + { + item.width = 42; + item.height = 42; + item.damage = 55; + item.mana = 50; + item.magic = true; + item.noMelee = true; + item.useTime = 30; + item.useAnimation = 30; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 2f; + item.UseSound = SoundID.Item102; + item.autoReuse = true; + item.rare = 8; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.value = Item.buyPrice(0, 80, 0, 0); + item.shoot = mod.ProjectileType("KeelhaulBubble"); + item.shootSpeed = 15f; + } + } +} diff --git a/Items/Patreon/LightGodsBrilliance.cs b/Items/Patreon/LightGodsBrilliance.cs index 1b414ee78e..21a61de1a5 100644 --- a/Items/Patreon/LightGodsBrilliance.cs +++ b/Items/Patreon/LightGodsBrilliance.cs @@ -1,76 +1,76 @@ -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 LightGodsBrilliance : ModItem - { - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Light God's Brilliance"); - Tooltip.SetDefault("Casts small, homing light beads along with explosive light balls"); - } - - public override void SetDefaults() - { - item.damage = 100; - item.magic = true; - item.mana = 4; - item.width = 34; - item.height = 36; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LightBead"); - item.shootSpeed = 25f; - item.GetGlobalItem(mod).postMoonLordRarity = 21; - } - - 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 = Main.rand.Next(2, 5); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - } - if (Main.rand.Next(3) == 0) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LightBall"), (int)((double)damage * 2.0), knockBack, player.whoAmI, 0.0f, 0.0f); - } - - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadecrystalTome"); - recipe.AddIngredient(null, "AbyssalTome"); - recipe.AddIngredient(ItemID.HolyWater, 10); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(ItemID.SoulofLight, 30); - recipe.AddIngredient(null, "EffulgentFeather", 5); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 LightGodsBrilliance : ModItem + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light God's Brilliance"); + Tooltip.SetDefault("Casts small, homing light beads along with explosive light balls"); + } + + public override void SetDefaults() + { + item.damage = 100; + item.magic = true; + item.mana = 4; + item.width = 34; + item.height = 36; + item.useTime = 3; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LightBead"); + item.shootSpeed = 25f; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + } + + 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 = Main.rand.Next(2, 5); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + } + if (Main.rand.Next(3) == 0) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LightBall"), (int)((double)damage * 2.0), knockBack, player.whoAmI, 0.0f, 0.0f); + } + + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadecrystalTome"); + recipe.AddIngredient(null, "AbyssalTome"); + recipe.AddIngredient(ItemID.HolyWater, 10); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(ItemID.SoulofLight, 30); + recipe.AddIngredient(null, "EffulgentFeather", 5); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Patreon/NormalityRelocator.cs b/Items/Patreon/NormalityRelocator.cs index 50b5a299ed..f4d8ed9b2a 100644 --- a/Items/Patreon/NormalityRelocator.cs +++ b/Items/Patreon/NormalityRelocator.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items.Patreon -{ - public class NormalityRelocator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Normality Relocator"); - Tooltip.SetDefault("I'll be there in the blink of an eye\n" + - "Press Z to teleport to the position of the mouse\n" + - "Boosts movement and fall speed by 10%\n" + - "Works while in the inventory"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 7)); - } - - public override void SetDefaults() - { - item.width = 38; - item.height = 38; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; - } - - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.normalityRelocator = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RodofDiscord); - recipe.AddIngredient(ItemID.FragmentStardust, 30); - recipe.AddIngredient(null, "ExodiumClusterOre", 10); - recipe.AddIngredient(null, "Cinderplate", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.Patreon +{ + public class NormalityRelocator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Normality Relocator"); + Tooltip.SetDefault("I'll be there in the blink of an eye\n" + + "Press Z to teleport to the position of the mouse\n" + + "Boosts movement and fall speed by 10%\n" + + "Works while in the inventory"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 7)); + } + + public override void SetDefaults() + { + item.width = 38; + item.height = 38; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.normalityRelocator = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RodofDiscord); + recipe.AddIngredient(ItemID.FragmentStardust, 30); + recipe.AddIngredient(null, "ExodiumClusterOre", 10); + recipe.AddIngredient(null, "Cinderplate", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Patreon/ProfanedSoulArtifact.cs b/Items/Patreon/ProfanedSoulArtifact.cs index 4c629118fe..53b4b894a9 100644 --- a/Items/Patreon/ProfanedSoulArtifact.cs +++ b/Items/Patreon/ProfanedSoulArtifact.cs @@ -1,53 +1,53 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items.Patreon -{ - public class ProfanedSoulArtifact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Soul Artifact"); - 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" + - "If you get hit their effects will disappear for 5 seconds"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); - } - - public override void SetDefaults() - { - item.width = 32; - item.height = 40; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.accessory = true; - item.GetGlobalItem(mod).postMoonLordRarity = 21; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.pArtifact = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Cinderplate", 5); - recipe.AddIngredient(null, "CoreofCinder"); - recipe.AddIngredient(null, "DivineGeode", 5); - recipe.AddIngredient(null, "ExodiumClusterOre", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.Patreon +{ + public class ProfanedSoulArtifact : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Soul Artifact"); + 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" + + "If you get hit their effects will disappear for 5 seconds"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + } + + public override void SetDefaults() + { + item.width = 32; + item.height = 40; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.pArtifact = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate", 5); + recipe.AddIngredient(null, "CoreofCinder"); + recipe.AddIngredient(null, "DivineGeode", 5); + recipe.AddIngredient(null, "ExodiumClusterOre", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Patreon/ThePack.cs b/Items/Patreon/ThePack.cs index fb237674a4..c447a651d2 100644 --- a/Items/Patreon/ThePack.cs +++ b/Items/Patreon/ThePack.cs @@ -1,65 +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.Patreon -{ - public class ThePack : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Pack"); - Tooltip.SetDefault("Fires large homing rockets that explode into more homing mini rockets when in proximity to an enemy"); - } - - public override void SetDefaults() - { - item.damage = 3000; - item.crit += 10; - item.ranged = true; - item.width = 96; - item.height = 40; - item.useTime = 50; - item.useAnimation = 50; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 21; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("ThePackMissile"); - item.useAmmo = 771; - } - - public override Vector2? HoldoutOffset() - { - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ThePackMissile"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Scorpion"); - recipe.AddIngredient(ItemID.MarbleBlock, 50); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "ArmoredShell", 4); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 ThePack : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Pack"); + Tooltip.SetDefault("Fires large homing rockets that explode into more homing mini rockets when in proximity to an enemy"); + } + + public override void SetDefaults() + { + item.damage = 3000; + item.crit += 10; + item.ranged = true; + item.width = 96; + item.height = 40; + item.useTime = 50; + item.useAnimation = 50; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("ThePackMissile"); + item.useAmmo = 771; + } + + public override Vector2? HoldoutOffset() + { + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ThePackMissile"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Scorpion"); + recipe.AddIngredient(ItemID.MarbleBlock, 50); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "ArmoredShell", 4); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Perforator/BloodSample.cs b/Items/Perforator/BloodSample.cs index 47a9cba72f..fe5fc5eadd 100644 --- a/Items/Perforator/BloodSample.cs +++ b/Items/Perforator/BloodSample.cs @@ -1,28 +1,28 @@ -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.Perforator -{ - public class BloodSample : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Sample"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 22; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 2; - } - } -} \ No newline at end of file +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.Perforator +{ + public class BloodSample : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Sample"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 22; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 50, 0); + item.rare = 2; + } + } +} diff --git a/Items/Perforator/BloodyWormFood.cs b/Items/Perforator/BloodyWormFood.cs index b417c8743d..e60753bdd7 100644 --- a/Items/Perforator/BloodyWormFood.cs +++ b/Items/Perforator/BloodyWormFood.cs @@ -1,55 +1,55 @@ -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; - -namespace CalamityMod.Items.Perforator -{ - public class BloodyWormFood : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Worm Food"); - Tooltip.SetDefault("Summons the Perforator Hive"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 3; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneCrimson && !NPC.AnyNPCs(mod.NPCType("PerforatorHive")); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PerforatorHive")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vertebrae, 9); - recipe.AddIngredient(null, "BloodSample", 5); - recipe.AddIngredient(ItemID.CrimtaneBar, 2); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.Items.Perforator +{ + public class BloodyWormFood : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Worm Food"); + Tooltip.SetDefault("Summons the Perforator Hive"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 3; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneCrimson && !NPC.AnyNPCs(mod.NPCType("PerforatorHive")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PerforatorHive")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Vertebrae, 9); + recipe.AddIngredient(null, "BloodSample", 5); + recipe.AddIngredient(ItemID.CrimtaneBar, 2); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Perforator/BloodyWormTooth.cs b/Items/Perforator/BloodyWormTooth.cs index e0715d3c5c..72e0e77ef4 100644 --- a/Items/Perforator/BloodyWormTooth.cs +++ b/Items/Perforator/BloodyWormTooth.cs @@ -1,37 +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.Perforator -{ - public class BloodyWormTooth : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Worm Tooth"); - Tooltip.SetDefault("5% increased damage reduction and increased melee stats\n" + - "10% increased damage reduction and melee stats when below 50% life"); - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 15; - item.value = Item.buyPrice(0, 9, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bloodyWormTooth = true; - } - } -} \ No newline at end of file +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.Perforator +{ + public class BloodyWormTooth : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Worm Tooth"); + Tooltip.SetDefault("5% increased damage reduction and increased melee stats\n" + + "10% increased damage reduction and melee stats when below 50% life"); + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 15; + item.value = Item.buyPrice(0, 9, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.bloodyWormTooth = true; + } + } +} diff --git a/Items/Perforator/PerforatorBag.cs b/Items/Perforator/PerforatorBag.cs index 6853f740d8..9f5f4cad6f 100644 --- a/Items/Perforator/PerforatorBag.cs +++ b/Items/Perforator/PerforatorBag.cs @@ -1,98 +1,98 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Perforator -{ - public class PerforatorBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("PerforatorHive"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("PerforatorMask")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Aorta")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("BloodyRupture")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("SausageMaker")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("BloodBath")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("VeinBurster")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Eviscerator")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("ToothBall"), Main.rand.Next(50, 76)); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("BloodClotStaff")); - } - player.QuickSpawnItem(mod.ItemType("BloodyWormTooth")); - player.QuickSpawnItem(ItemID.Vertebrae, Main.rand.Next(10, 21)); - player.QuickSpawnItem(ItemID.CrimtaneBar, Main.rand.Next(9, 15)); - player.QuickSpawnItem(mod.ItemType("BloodSample"), Main.rand.Next(30, 41)); - if (Main.hardMode) - { - player.QuickSpawnItem(ItemID.Ichor, Main.rand.Next(15, 31)); - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Perforator +{ + public class PerforatorBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("PerforatorHive"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("PerforatorMask")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Aorta")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("BloodyRupture")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("SausageMaker")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("BloodBath")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("VeinBurster")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Eviscerator")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("ToothBall"), Main.rand.Next(50, 76)); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("BloodClotStaff")); + } + player.QuickSpawnItem(mod.ItemType("BloodyWormTooth")); + player.QuickSpawnItem(ItemID.Vertebrae, Main.rand.Next(10, 21)); + player.QuickSpawnItem(ItemID.CrimtaneBar, Main.rand.Next(9, 15)); + player.QuickSpawnItem(mod.ItemType("BloodSample"), Main.rand.Next(30, 41)); + if (Main.hardMode) + { + player.QuickSpawnItem(ItemID.Ichor, Main.rand.Next(15, 31)); + } + } + } +} diff --git a/Items/Permafrost/AbsoluteZero.cs b/Items/Permafrost/AbsoluteZero.cs index a2e035898b..94eb240a2e 100644 --- a/Items/Permafrost/AbsoluteZero.cs +++ b/Items/Permafrost/AbsoluteZero.cs @@ -1,43 +1,43 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class AbsoluteZero : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Absolute Zero"); - Tooltip.SetDefault("Ancient blade imbued with the Archmage of Ice's magic\nShoots dark ice crystals\nThe blade creates frost explosions on direct hits"); - } - public override void SetDefaults() - { - item.damage = 42; - item.melee = true; - item.width = 58; - item.height = 58; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 1; - item.useTurn = false; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DarkIceZero"); - item.shootSpeed = 3f; - } - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) - { - target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(mod.BuffType("GlacialState"), 300); - - int p = Projectile.NewProjectile(target.Center, Vector2.Zero, mod.ProjectileType("DarkIceZero"), damage, knockBack * 3f, player.whoAmI); - Main.projectile[p].Kill(); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class AbsoluteZero : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Absolute Zero"); + Tooltip.SetDefault("Ancient blade imbued with the Archmage of Ice's magic\nShoots dark ice crystals\nThe blade creates frost explosions on direct hits"); + } + public override void SetDefaults() + { + item.damage = 42; + item.melee = true; + item.width = 58; + item.height = 58; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 1; + item.useTurn = false; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DarkIceZero"); + item.shootSpeed = 3f; + } + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { + target.AddBuff(BuffID.Frostburn, 600); + target.AddBuff(mod.BuffType("GlacialState"), 300); + + 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/ArcticBearPaw.cs b/Items/Permafrost/ArcticBearPaw.cs index 98d907b334..2c8b031622 100644 --- a/Items/Permafrost/ArcticBearPaw.cs +++ b/Items/Permafrost/ArcticBearPaw.cs @@ -1,38 +1,38 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class ArcticBearPaw : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arctic Bear Paw"); - Tooltip.SetDefault(@"Fires spiritual claws that ignore walls and confuse enemies -'The savage mauling that fits in your pocket'"); - } - public override void SetDefaults() - { - item.damage = 70; - item.magic = true; - item.mana = 18; - item.width = 34; - item.height = 22; - item.useTime = 28; - item.useAnimation = 28; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 10f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ArcticBearPaw"); - item.shootSpeed = 27f; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class ArcticBearPaw : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arctic Bear Paw"); + Tooltip.SetDefault(@"Fires spiritual claws that ignore walls and confuse enemies +'The savage mauling that fits in your pocket'"); + } + public override void SetDefaults() + { + item.damage = 70; + item.magic = true; + item.mana = 18; + item.width = 34; + item.height = 22; + item.useTime = 28; + item.useAnimation = 28; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 10f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ArcticBearPaw"); + item.shootSpeed = 27f; + } + } +} diff --git a/Items/Permafrost/ColdheartIcicle.cs b/Items/Permafrost/ColdheartIcicle.cs index dd45efe97a..f1348c7f86 100644 --- a/Items/Permafrost/ColdheartIcicle.cs +++ b/Items/Permafrost/ColdheartIcicle.cs @@ -1,48 +1,48 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class ColdheartIcicle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Coldheart Icicle"); - Tooltip.SetDefault("Drains a percentage of enemy health on hit\nCannot inflict critical hits"); - } - public override void SetDefaults() - { - item.damage = 1; - item.melee = true; - item.width = 26; - item.height = 26; - item.useTime = 27; - item.useAnimation = 27; - item.autoReuse = true; - item.useStyle = 3; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - } - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { - damage = target.statLifeMax2 * 2 / 100; - target.statDefense = 0; - target.endurance = 0f; - crit = false; - } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { - damage = 1; - crit = false; - if (target.type != NPCID.TargetDummy && target.type != mod.NPCType("Providence")) - target.life -= target.lifeMax * 2 / 100; - target.checkDead(); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class ColdheartIcicle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Coldheart Icicle"); + Tooltip.SetDefault("Drains a percentage of enemy health on hit\nCannot inflict critical hits"); + } + public override void SetDefaults() + { + item.damage = 1; + item.melee = true; + item.width = 26; + item.height = 26; + item.useTime = 27; + item.useAnimation = 27; + item.autoReuse = true; + item.useStyle = 3; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + } + public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) + { + damage = target.statLifeMax2 * 2 / 100; + target.statDefense = 0; + target.endurance = 0f; + crit = false; + } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { + damage = 1; + crit = false; + if (target.type != NPCID.TargetDummy && target.type != mod.NPCType("Providence")) + target.life -= target.lifeMax * 2 / 100; + target.checkDead(); + } + } +} diff --git a/Items/Permafrost/CryogenicStaff.cs b/Items/Permafrost/CryogenicStaff.cs index 1ea596b14b..35ac5153f7 100644 --- a/Items/Permafrost/CryogenicStaff.cs +++ b/Items/Permafrost/CryogenicStaff.cs @@ -1,64 +1,64 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class CryogenicStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogenic Staff"); - 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; - item.mana = 10; - item.summon = true; - item.sentry = true; - item.width = 40; - item.height = 40; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - 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) - { - 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); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class CryogenicStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogenic Staff"); + 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; + item.mana = 10; + item.summon = true; + item.sentry = true; + item.width = 40; + item.height = 40; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + 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) + { + 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); + } + } +} diff --git a/Items/Permafrost/DeliciousMeat.cs b/Items/Permafrost/DeliciousMeat.cs index efab98bce3..92e6f2b138 100644 --- a/Items/Permafrost/DeliciousMeat.cs +++ b/Items/Permafrost/DeliciousMeat.cs @@ -1,33 +1,33 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class DeliciousMeat : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Delicious Meat"); - Tooltip.SetDefault("Minor improvements to all stats\n'So very delicious'"); - } - public override void SetDefaults() - { - item.width = 32; - item.height = 30; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 5; - item.maxStack = 30; - item.consumable = true; - item.useAnimation = 17; - item.useTime = 17; - item.UseSound = SoundID.Item2; - item.useStyle = 2; - item.useTurn = true; - item.buffType = BuffID.WellFed; - item.buffTime = 108000; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class DeliciousMeat : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Delicious Meat"); + Tooltip.SetDefault("Minor improvements to all stats\n'So very delicious'"); + } + public override void SetDefaults() + { + item.width = 32; + item.height = 30; + item.value = Item.buyPrice(0, 0, 50, 0); + item.rare = 5; + item.maxStack = 30; + item.consumable = true; + item.useAnimation = 17; + item.useTime = 17; + item.UseSound = SoundID.Item2; + item.useStyle = 2; + item.useTurn = true; + item.buffType = BuffID.WellFed; + item.buffTime = 108000; + } + } +} diff --git a/Items/Permafrost/EnchantedMetal.cs b/Items/Permafrost/EnchantedMetal.cs index 37d629d6b2..5325807d71 100644 --- a/Items/Permafrost/EnchantedMetal.cs +++ b/Items/Permafrost/EnchantedMetal.cs @@ -1,44 +1,44 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class EnchantedMetal : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Enchanted Metal"); - } - public override void SetDefaults() - { - item.width = 26; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.maxStack = 99; - } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(item.type, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.MechanicalEye); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(item.type, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.MechanicalSkull); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(item.type, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.MechanicalWorm); - recipe.AddRecipe(); - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class EnchantedMetal : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Enchanted Metal"); + } + public override void SetDefaults() + { + item.width = 26; + item.height = 20; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.maxStack = 99; + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(item.type, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.MechanicalEye); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(item.type, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.MechanicalSkull); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(item.type, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(ItemID.MechanicalWorm); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Permafrost/EternalBlizzard.cs b/Items/Permafrost/EternalBlizzard.cs index f46d41acc1..2896532bf4 100644 --- a/Items/Permafrost/EternalBlizzard.cs +++ b/Items/Permafrost/EternalBlizzard.cs @@ -1,44 +1,44 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class EternalBlizzard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eternal Blizzard"); - Tooltip.SetDefault("Wooden arrows turn into icicle arrows that shatter on impact"); - } - public override void SetDefaults() - { - item.damage = 48; - item.ranged = true; - item.width = 42; - item.height = 62; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.useAmmo = AmmoID.Arrow; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("IcicleArrow"); - item.shootSpeed = 11f; - } - 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 (type == ProjectileID.WoodenArrowFriendly) - type = mod.ProjectileType("IcicleArrow"); - - return true; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class EternalBlizzard : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eternal Blizzard"); + Tooltip.SetDefault("Wooden arrows turn into icicle arrows that shatter on impact"); + } + public override void SetDefaults() + { + item.damage = 48; + item.ranged = true; + item.width = 42; + item.height = 62; + item.useTime = 19; + item.useAnimation = 19; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.useAmmo = AmmoID.Arrow; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("IcicleArrow"); + item.shootSpeed = 11f; + } + 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 (type == ProjectileID.WoodenArrowFriendly) + type = mod.ProjectileType("IcicleArrow"); + + return true; + } + } +} diff --git a/Items/Permafrost/FrostbiteBlaster.cs b/Items/Permafrost/FrostbiteBlaster.cs index bb9b950726..f9cb4130d9 100644 --- a/Items/Permafrost/FrostbiteBlaster.cs +++ b/Items/Permafrost/FrostbiteBlaster.cs @@ -1,53 +1,53 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class FrostbiteBlaster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frostbite Blaster"); - Tooltip.SetDefault("Fires a spread of icicles"); - } - public override void SetDefaults() - { - item.damage = 31; - item.ranged = true; - item.width = 54; - item.height = 30; - item.useTime = 7; - item.useAnimation = 21; - item.reuseDelay = 54; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.useAmmo = AmmoID.Bullet; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = ProjectileID.Blizzard; - item.shootSpeed = 9f; - } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Main.PlaySound(SoundID.Item36, position); - - type = ProjectileID.Blizzard; - for (int i = 0; i < 2; i++) - { - float newSpeedX = speedX + Main.rand.Next(-40, 41) * 0.06f; - float newSpeedY = speedY + Main.rand.Next(-40, 41) * 0.06f; - int p = Projectile.NewProjectile(position.X, position.Y, newSpeedX, newSpeedY, type, damage, knockBack, player.whoAmI); - Main.projectile[p].magic = false; - Main.projectile[p].ranged = true; - } - return true; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class FrostbiteBlaster : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frostbite Blaster"); + Tooltip.SetDefault("Fires a spread of icicles"); + } + public override void SetDefaults() + { + item.damage = 31; + item.ranged = true; + item.width = 54; + item.height = 30; + item.useTime = 7; + item.useAnimation = 21; + item.reuseDelay = 54; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.useAmmo = AmmoID.Bullet; + item.UseSound = SoundID.Item36; + item.autoReuse = true; + item.shoot = ProjectileID.Blizzard; + item.shootSpeed = 9f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Main.PlaySound(SoundID.Item36, position); + + type = ProjectileID.Blizzard; + for (int i = 0; i < 2; i++) + { + float newSpeedX = speedX + Main.rand.Next(-40, 41) * 0.06f; + float newSpeedY = speedY + Main.rand.Next(-40, 41) * 0.06f; + int p = Projectile.NewProjectile(position.X, position.Y, newSpeedX, newSpeedY, type, damage, knockBack, player.whoAmI); + Main.projectile[p].magic = false; + Main.projectile[p].ranged = true; + } + return true; + } + } +} diff --git a/Items/Permafrost/IcicleArrow.cs b/Items/Permafrost/IcicleArrow.cs index 8866a3692c..0afc99de77 100644 --- a/Items/Permafrost/IcicleArrow.cs +++ b/Items/Permafrost/IcicleArrow.cs @@ -1,33 +1,33 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class IcicleArrow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icicle Arrow"); - Tooltip.SetDefault("Shatters into shards on impact"); - } - - public override void SetDefaults() - { - item.damage = 14; - item.ranged = true; - item.consumable = true; - item.width = 14; - item.height = 50; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 0, 0, 15); - item.rare = 3; - item.shoot = mod.ProjectileType("IcicleArrow"); - item.shootSpeed = 1.0f; - item.ammo = AmmoID.Arrow; - item.maxStack = 999; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class IcicleArrow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icicle Arrow"); + Tooltip.SetDefault("Shatters into shards on impact"); + } + + public override void SetDefaults() + { + item.damage = 14; + item.ranged = true; + item.consumable = true; + item.width = 14; + item.height = 50; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 0, 0, 15); + item.rare = 3; + item.shoot = mod.ProjectileType("IcicleArrow"); + item.shootSpeed = 1.0f; + item.ammo = AmmoID.Arrow; + item.maxStack = 999; + } + } +} diff --git a/Items/Permafrost/IcicleTrident.cs b/Items/Permafrost/IcicleTrident.cs index 602868ad68..8481ef9dfe 100644 --- a/Items/Permafrost/IcicleTrident.cs +++ b/Items/Permafrost/IcicleTrident.cs @@ -1,46 +1,46 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class IcicleTrident : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icicle Trident"); - Tooltip.SetDefault("Shoots piercing icicles"); - Item.staff[item.type] = true; - } - public override void SetDefaults() - { - item.damage = 69; - item.magic = true; - item.mana = 21; - item.width = 64; - item.height = 64; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TridentIcicle"); - item.shootSpeed = 12f; - } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 speed = new Vector2(speedX, speedY); - Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI); - Projectile.NewProjectile(position, speed.RotatedBy(MathHelper.ToRadians(5)), type, damage, knockBack, player.whoAmI); - Projectile.NewProjectile(position, speed.RotatedBy(MathHelper.ToRadians(-5)), type, damage, knockBack, player.whoAmI); - return false; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class IcicleTrident : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icicle Trident"); + Tooltip.SetDefault("Shoots piercing icicles"); + Item.staff[item.type] = true; + } + public override void SetDefaults() + { + item.damage = 69; + item.magic = true; + item.mana = 21; + item.width = 64; + item.height = 64; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TridentIcicle"); + item.shootSpeed = 12f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 speed = new Vector2(speedX, speedY); + Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position, speed.RotatedBy(MathHelper.ToRadians(5)), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position, speed.RotatedBy(MathHelper.ToRadians(-5)), type, damage, knockBack, player.whoAmI); + return false; + } + } +} diff --git a/Items/Permafrost/IcyBullet.cs b/Items/Permafrost/IcyBullet.cs index 2c320fffcb..a747586580 100644 --- a/Items/Permafrost/IcyBullet.cs +++ b/Items/Permafrost/IcyBullet.cs @@ -1,32 +1,32 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class IcyBullet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icy Bullet"); - Tooltip.SetDefault("Can hit up to three times\nBreaks into ice shards on last impact"); - } - public override void SetDefaults() - { - item.damage = 10; - item.ranged = true; - item.consumable = true; - item.width = 18; - item.height = 16; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 0, 0, 15); - item.rare = 3; - item.shoot = mod.ProjectileType("IcyBullet"); - item.shootSpeed = 5f; - item.ammo = AmmoID.Bullet; - item.maxStack = 999; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class IcyBullet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icy Bullet"); + Tooltip.SetDefault("Can hit up to three times\nBreaks into ice shards on last impact"); + } + public override void SetDefaults() + { + item.damage = 10; + item.ranged = true; + item.consumable = true; + item.width = 18; + item.height = 16; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 0, 0, 15); + item.rare = 3; + item.shoot = mod.ProjectileType("IcyBullet"); + item.shootSpeed = 5f; + item.ammo = AmmoID.Bullet; + item.maxStack = 999; + } + } +} diff --git a/Items/Permafrost/PermafrostsConcoction.cs b/Items/Permafrost/PermafrostsConcoction.cs index a65dfef523..e322dea976 100644 --- a/Items/Permafrost/PermafrostsConcoction.cs +++ b/Items/Permafrost/PermafrostsConcoction.cs @@ -1,36 +1,36 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class PermafrostsConcoction : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Permafrost's Concoction"); - Tooltip.SetDefault(@"Increases maximum mana by 50 -Increases life regen as life decreases -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; - item.width = 36; - item.height = 34; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 5; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.statManaMax2 += 50; - player.GetModPlayer().permafrostsConcoction = true; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class PermafrostsConcoction : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Permafrost's Concoction"); + Tooltip.SetDefault(@"Increases maximum mana by 50 +Increases life regen as life decreases +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; + item.width = 36; + item.height = 34; + item.value = Item.buyPrice(0, 45, 0, 0); + item.rare = 5; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.statManaMax2 += 50; + player.GetModPlayer().permafrostsConcoction = true; + } + } +} diff --git a/Items/Permafrost/Popo.cs b/Items/Permafrost/Popo.cs index bf38d0b79b..bf64e29552 100644 --- a/Items/Permafrost/Popo.cs +++ b/Items/Permafrost/Popo.cs @@ -1,66 +1,66 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class Popo : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magic Scarf and Hat"); - Tooltip.SetDefault("Transforms the holder into a snowman\n" + - "Don't let the demons steal your nose"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 30; - item.accessory = true; - item.value = 1000000; - item.rare = 5; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(); - modPlayer.snowman = true; - if (hideVisual) - { - modPlayer.snowmanHide = true; - } - } - } - - public class PopoHead : EquipTexture - { - public override bool DrawHead() - { - return false; - } - } - - public class PopoNoselessHead : EquipTexture - { - public override bool DrawHead() - { - return false; - } - } - - public class PopoBody : EquipTexture - { - public override bool DrawBody() - { - return false; - } - } - - public class PopoLegs : EquipTexture - { - public override bool DrawLegs() - { - return false; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class Popo : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magic Scarf and Hat"); + Tooltip.SetDefault("Transforms the holder into a snowman\n" + + "Don't let the demons steal your nose"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 30; + item.accessory = true; + item.value = 1000000; + item.rare = 5; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(); + modPlayer.snowman = true; + if (hideVisual) + { + modPlayer.snowmanHide = true; + } + } + } + + public class PopoHead : EquipTexture + { + public override bool DrawHead() + { + return false; + } + } + + public class PopoNoselessHead : EquipTexture + { + public override bool DrawHead() + { + return false; + } + } + + public class PopoBody : EquipTexture + { + public override bool DrawBody() + { + return false; + } + } + + public class PopoLegs : EquipTexture + { + public override bool DrawLegs() + { + return false; + } + } +} diff --git a/Items/Permafrost/WintersFury.cs b/Items/Permafrost/WintersFury.cs index 5019108264..60930756d6 100644 --- a/Items/Permafrost/WintersFury.cs +++ b/Items/Permafrost/WintersFury.cs @@ -1,59 +1,59 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Permafrost -{ - public class WintersFury : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Winter's Fury"); - Tooltip.SetDefault("The pages are freezing to the touch"); - } - public override void SetDefaults() - { - item.damage = 20; - item.magic = true; - item.mana = 9; - item.width = 28; - item.height = 30; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item9; - item.scale = 0.9f; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Icicle"); - item.shootSpeed = 12f; - } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (Main.rand.Next(3) != 0) - { - Vector2 speed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(Main.rand.Next(-15, 16))); - speed.Normalize(); - speed *= 15f; - speed.Y -= Math.Abs(speed.X) * 0.2f; - int p = Projectile.NewProjectile(position, speed, mod.ProjectileType("FrostShardFriendly"), damage, knockBack, player.whoAmI); - Main.projectile[p].minion = false; - Main.projectile[p].magic = true; - } - if (Main.rand.Next(3) == 0) - { - Main.PlaySound(SoundID.Item1, position); - Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, mod.ProjectileType("Snowball"), damage, knockBack * 2f, player.whoAmI); - } - speedX += Main.rand.Next(-40, 41) * 0.05f; - speedY += Main.rand.Next(-40, 41) * 0.05f; - return true; - } - } -} +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Permafrost +{ + public class WintersFury : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Winter's Fury"); + Tooltip.SetDefault("The pages are freezing to the touch"); + } + public override void SetDefaults() + { + item.damage = 20; + item.magic = true; + item.mana = 9; + item.width = 28; + item.height = 30; + item.useTime = 9; + item.useAnimation = 9; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item9; + item.scale = 0.9f; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Icicle"); + item.shootSpeed = 12f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (Main.rand.Next(3) != 0) + { + Vector2 speed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(Main.rand.Next(-15, 16))); + speed.Normalize(); + speed *= 15f; + speed.Y -= Math.Abs(speed.X) * 0.2f; + int p = Projectile.NewProjectile(position, speed, mod.ProjectileType("FrostShardFriendly"), damage, knockBack, player.whoAmI); + Main.projectile[p].minion = false; + Main.projectile[p].magic = true; + } + if (Main.rand.Next(3) == 0) + { + Main.PlaySound(SoundID.Item1, position); + Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, mod.ProjectileType("Snowball"), damage, knockBack * 2f, player.whoAmI); + } + speedX += Main.rand.Next(-40, 41) * 0.05f; + speedY += Main.rand.Next(-40, 41) * 0.05f; + return true; + } + } +} diff --git a/Items/PhantomHeart.cs b/Items/PhantomHeart.cs index c14005b1c3..cec903de81 100644 --- a/Items/PhantomHeart.cs +++ b/Items/PhantomHeart.cs @@ -1,69 +1,69 @@ -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 PhantomHeart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Heart"); - Tooltip.SetDefault("Permanently increases maximum mana by 50"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item29; - item.consumable = true; - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.pHeart) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - if (Main.myPlayer == player.whoAmI) - { - player.ManaEffect(50); - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.pHeart = true; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "RuinousSoul", 10); - recipe.AddIngredient(null, "Phantoplasm", 100); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 PhantomHeart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Heart"); + Tooltip.SetDefault("Permanently increases maximum mana by 50"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item29; + item.consumable = true; + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.pHeart) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + if (Main.myPlayer == player.whoAmI) + { + player.ManaEffect(50); + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.pHeart = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "RuinousSoul", 10); + recipe.AddIngredient(null, "Phantoplasm", 100); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Phantoplasm.cs b/Items/Phantoplasm.cs index 6152f6bd43..dacca1ed5f 100644 --- a/Items/Phantoplasm.cs +++ b/Items/Phantoplasm.cs @@ -1,35 +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 -{ - public class Phantoplasm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantoplasm"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 5)); - } - - public override void SetDefaults() - { - 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; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 0); - } - } -} \ No newline at end of file +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 +{ + public class Phantoplasm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantoplasm"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 5)); + } + + public override void SetDefaults() + { + 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; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 0); + } + } +} diff --git a/Items/Placeables/AbyssGravel.cs b/Items/Placeables/AbyssGravel.cs index 8323c6400a..df94b0d765 100644 --- a/Items/Placeables/AbyssGravel.cs +++ b/Items/Placeables/AbyssGravel.cs @@ -1,33 +1,33 @@ -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.Placeables -{ - public class AbyssGravel : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Gravel"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("AbyssGravel"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - } - } -} \ No newline at end of file +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.Placeables +{ + public class AbyssGravel : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Gravel"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("AbyssGravel"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + } + } +} diff --git a/Items/Placeables/AerialiteBrick.cs b/Items/Placeables/AerialiteBrick.cs index aaffdff26b..e7e64491fa 100644 --- a/Items/Placeables/AerialiteBrick.cs +++ b/Items/Placeables/AerialiteBrick.cs @@ -1,43 +1,43 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace CalamityMod.Items.Placeables -{ - public class AerialiteBrick : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("AerialiteBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("AerialiteOre"), 1); - recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Furnaces); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("AerialiteBrickWall"), 4); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - } - } -} +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace CalamityMod.Items.Placeables +{ + public class AerialiteBrick : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("AerialiteBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("AerialiteOre"), 1); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.Furnaces); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("AerialiteBrickWall"), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/AerialiteBrickWall.cs b/Items/Placeables/AerialiteBrickWall.cs index ad2beebe0a..a3d0afeaab 100644 --- a/Items/Placeables/AerialiteBrickWall.cs +++ b/Items/Placeables/AerialiteBrickWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AerialiteBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("AerialiteBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("AerialiteBrick")); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AerialiteBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("AerialiteBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("AerialiteBrick")); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/AerialiteOre.cs b/Items/Placeables/AerialiteOre.cs index 36c232fbc3..9dfa527d51 100644 --- a/Items/Placeables/AerialiteOre.cs +++ b/Items/Placeables/AerialiteOre.cs @@ -1,35 +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.Placeables -{ - public class AerialiteOre : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aerialite Ore"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("AerialiteOre"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 3; - } - } -} \ No newline at end of file +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.Placeables +{ + public class AerialiteOre : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aerialite Ore"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("AerialiteOre"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 3; + } + } +} diff --git a/Items/Placeables/AstrageldonTrophy.cs b/Items/Placeables/AstrageldonTrophy.cs index b24080578e..512a515653 100644 --- a/Items/Placeables/AstrageldonTrophy.cs +++ b/Items/Placeables/AstrageldonTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AstrageldonTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Aureus Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 19; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AstrageldonTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Aureus Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 19; + } + } +} diff --git a/Items/Placeables/AstralBar.cs b/Items/Placeables/AstralBar.cs index b582f7cc2c..129b8c426e 100644 --- a/Items/Placeables/AstralBar.cs +++ b/Items/Placeables/AstralBar.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables item.height = 16; item.maxStack = 99; item.rare = 9; - item.value = Item.buyPrice(0, 5, 50, 0); + item.value = Item.buyPrice(0, 5, 50, 0); } public override void AddRecipes() diff --git a/Items/Placeables/AstralBrick.cs b/Items/Placeables/AstralBrick.cs index c6d11884db..91a6d0415e 100644 --- a/Items/Placeables/AstralBrick.cs +++ b/Items/Placeables/AstralBrick.cs @@ -1,44 +1,44 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -// If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" -using Terraria.Localization; - -namespace CalamityMod.Items.Placeables -{ - public class AstralBrick : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("AstralBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("AstralOre"), 1); - recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Furnaces); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("AstralBrickWall"), 4); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - } - } -} +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +// If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" +using Terraria.Localization; + +namespace CalamityMod.Items.Placeables +{ + public class AstralBrick : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("AstralBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("AstralOre"), 1); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.Furnaces); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("AstralBrickWall"), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/AstralBrickWall.cs b/Items/Placeables/AstralBrickWall.cs index 7d248b955d..c00fb0f16b 100644 --- a/Items/Placeables/AstralBrickWall.cs +++ b/Items/Placeables/AstralBrickWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AstralBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("AstralBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("AstralBrick")); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AstralBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("AstralBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("AstralBrick")); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/AstralChest.cs b/Items/Placeables/AstralChest.cs index c67b8789e8..a7f10e3b53 100644 --- a/Items/Placeables/AstralChest.cs +++ b/Items/Placeables/AstralChest.cs @@ -1,27 +1,27 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AstralChest : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 22; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 500; - item.createTile = mod.TileType("AstralChestLocked"); - } - } -} \ No newline at end of file +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AstralChest : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 22; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 500; + item.createTile = mod.TileType("AstralChestLocked"); + } + } +} diff --git a/Items/Placeables/AstralOre.cs b/Items/Placeables/AstralOre.cs index 69983442bf..954b13bede 100644 --- a/Items/Placeables/AstralOre.cs +++ b/Items/Placeables/AstralOre.cs @@ -26,9 +26,9 @@ namespace CalamityMod.Items.Placeables item.consumable = true; item.width = 20; item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); item.rare = 9; } } -} \ No newline at end of file +} diff --git a/Items/Placeables/AstrumDeusTrophy.cs b/Items/Placeables/AstrumDeusTrophy.cs index 0ede4a15f9..aec2beb756 100644 --- a/Items/Placeables/AstrumDeusTrophy.cs +++ b/Items/Placeables/AstrumDeusTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class AstrumDeusTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 20; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class AstrumDeusTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 20; + } + } +} diff --git a/Items/Placeables/AuricOre.cs b/Items/Placeables/AuricOre.cs index 3b0c39ee06..15eff144ec 100644 --- a/Items/Placeables/AuricOre.cs +++ b/Items/Placeables/AuricOre.cs @@ -1,35 +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.Placeables -{ - public class AuricOre : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Ore"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("AuricOre"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 10; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - } -} \ No newline at end of file +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.Placeables +{ + public class AuricOre : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Ore"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("AuricOre"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 10; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + } +} diff --git a/Items/Placeables/Banners/AeroSlimeBanner.cs b/Items/Placeables/Banners/AeroSlimeBanner.cs index d7335f6d3f..788eb96d72 100644 --- a/Items/Placeables/Banners/AeroSlimeBanner.cs +++ b/Items/Placeables/Banners/AeroSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AeroSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 90; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AeroSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 90; + } + } +} diff --git a/Items/Placeables/Banners/AmberCrawlerBanner.cs b/Items/Placeables/Banners/AmberCrawlerBanner.cs index 5f165e9209..a7b58a3d19 100644 --- a/Items/Placeables/Banners/AmberCrawlerBanner.cs +++ b/Items/Placeables/Banners/AmberCrawlerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AmberCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 72; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AmberCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 72; + } + } +} diff --git a/Items/Placeables/Banners/AmethystCrawlerBanner.cs b/Items/Placeables/Banners/AmethystCrawlerBanner.cs index 00adb22d79..e79aba6dcd 100644 --- a/Items/Placeables/Banners/AmethystCrawlerBanner.cs +++ b/Items/Placeables/Banners/AmethystCrawlerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AmethystCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 66; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AmethystCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 66; + } + } +} diff --git a/Items/Placeables/Banners/AngryDogBanner.cs b/Items/Placeables/Banners/AngryDogBanner.cs index 6dbd070e22..5e4d0d6054 100644 --- a/Items/Placeables/Banners/AngryDogBanner.cs +++ b/Items/Placeables/Banners/AngryDogBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AngryDogBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 59; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AngryDogBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 59; + } + } +} diff --git a/Items/Placeables/Banners/AquaticAberrationBanner.cs b/Items/Placeables/Banners/AquaticAberrationBanner.cs index cfa1782798..694ad2a834 100644 --- a/Items/Placeables/Banners/AquaticAberrationBanner.cs +++ b/Items/Placeables/Banners/AquaticAberrationBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AquaticAberrationBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 10; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AquaticAberrationBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 10; + } + } +} diff --git a/Items/Placeables/Banners/AquaticParasiteBanner.cs b/Items/Placeables/Banners/AquaticParasiteBanner.cs index 6df33a6440..a48bf2d9fc 100644 --- a/Items/Placeables/Banners/AquaticParasiteBanner.cs +++ b/Items/Placeables/Banners/AquaticParasiteBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AquaticParasiteBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 0; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AquaticParasiteBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 0; + } + } +} diff --git a/Items/Placeables/Banners/AquaticSeekerBanner.cs b/Items/Placeables/Banners/AquaticSeekerBanner.cs index ea3aee661b..e66e0fc252 100644 --- a/Items/Placeables/Banners/AquaticSeekerBanner.cs +++ b/Items/Placeables/Banners/AquaticSeekerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AquaticSeekerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 6; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AquaticSeekerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 6; + } + } +} diff --git a/Items/Placeables/Banners/AquaticUrchinBanner.cs b/Items/Placeables/Banners/AquaticUrchinBanner.cs index aefc4ff886..f67d5d1a03 100644 --- a/Items/Placeables/Banners/AquaticUrchinBanner.cs +++ b/Items/Placeables/Banners/AquaticUrchinBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AquaticUrchinBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 7; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AquaticUrchinBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 7; + } + } +} diff --git a/Items/Placeables/Banners/AriesBanner.cs b/Items/Placeables/Banners/AriesBanner.cs index 67067b2133..28f03d055b 100644 --- a/Items/Placeables/Banners/AriesBanner.cs +++ b/Items/Placeables/Banners/AriesBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AriesBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 34; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AriesBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 34; + } + } +} diff --git a/Items/Placeables/Banners/ArmoredDiggerBanner.cs b/Items/Placeables/Banners/ArmoredDiggerBanner.cs index 490602d508..c5e3e12d07 100644 --- a/Items/Placeables/Banners/ArmoredDiggerBanner.cs +++ b/Items/Placeables/Banners/ArmoredDiggerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ArmoredDiggerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 77; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ArmoredDiggerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 77; + } + } +} diff --git a/Items/Placeables/Banners/AstralProbeBanner.cs b/Items/Placeables/Banners/AstralProbeBanner.cs index 490e544f11..0abc5e4282 100644 --- a/Items/Placeables/Banners/AstralProbeBanner.cs +++ b/Items/Placeables/Banners/AstralProbeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AstralProbeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 31; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AstralProbeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 31; + } + } +} diff --git a/Items/Placeables/Banners/AstralSlimeBanner.cs b/Items/Placeables/Banners/AstralSlimeBanner.cs index a813161c90..2b5b8e01f0 100644 --- a/Items/Placeables/Banners/AstralSlimeBanner.cs +++ b/Items/Placeables/Banners/AstralSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AstralSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 35; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AstralSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 35; + } + } +} diff --git a/Items/Placeables/Banners/AstralachneaBanner.cs b/Items/Placeables/Banners/AstralachneaBanner.cs index 1a4e46b847..eeaba9c514 100644 --- a/Items/Placeables/Banners/AstralachneaBanner.cs +++ b/Items/Placeables/Banners/AstralachneaBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AstralachneaBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 39; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AstralachneaBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 39; + } + } +} diff --git a/Items/Placeables/Banners/AtlasBanner.cs b/Items/Placeables/Banners/AtlasBanner.cs index 146b962648..390dbd44fc 100644 --- a/Items/Placeables/Banners/AtlasBanner.cs +++ b/Items/Placeables/Banners/AtlasBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AtlasBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 36; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class AtlasBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 36; + } + } +} diff --git a/Items/Placeables/Banners/BOHLDOHRBanner.cs b/Items/Placeables/Banners/BOHLDOHRBanner.cs index 13bc4de6f6..9b1b43ba0c 100644 --- a/Items/Placeables/Banners/BOHLDOHRBanner.cs +++ b/Items/Placeables/Banners/BOHLDOHRBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class BOHLDOHRBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 87; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class BOHLDOHRBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 87; + } + } +} diff --git a/Items/Placeables/Banners/BigSightseerBanner.cs b/Items/Placeables/Banners/BigSightseerBanner.cs index 49596f0ecf..806b50b1aa 100644 --- a/Items/Placeables/Banners/BigSightseerBanner.cs +++ b/Items/Placeables/Banners/BigSightseerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class BigSightseerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 33; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class BigSightseerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 33; + } + } +} diff --git a/Items/Placeables/Banners/BlightedEyeBanner.cs b/Items/Placeables/Banners/BlightedEyeBanner.cs index 8382c21374..3ecba81329 100644 --- a/Items/Placeables/Banners/BlightedEyeBanner.cs +++ b/Items/Placeables/Banners/BlightedEyeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class BlightedEyeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 54; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class BlightedEyeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 54; + } + } +} diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.cs b/Items/Placeables/Banners/BlindedAnglerBanner.cs index 7cff63cb0f..6ff5435e79 100644 --- a/Items/Placeables/Banners/BlindedAnglerBanner.cs +++ b/Items/Placeables/Banners/BlindedAnglerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class BlindedAnglerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 104; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class BlindedAnglerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 104; + } + } +} diff --git a/Items/Placeables/Banners/BloatfishBanner.cs b/Items/Placeables/Banners/BloatfishBanner.cs index d0370d60ee..9084ccaa60 100644 --- a/Items/Placeables/Banners/BloatfishBanner.cs +++ b/Items/Placeables/Banners/BloatfishBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class BloatfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 28; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class BloatfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 28; + } + } +} diff --git a/Items/Placeables/Banners/BloomSlimeBanner.cs b/Items/Placeables/Banners/BloomSlimeBanner.cs index 5afd14ef7c..212a27bc7b 100644 --- a/Items/Placeables/Banners/BloomSlimeBanner.cs +++ b/Items/Placeables/Banners/BloomSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class BloomSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 94; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class BloomSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 94; + } + } +} diff --git a/Items/Placeables/Banners/BobbitWormBanner.cs b/Items/Placeables/Banners/BobbitWormBanner.cs index 04d0b5da4f..386cafc726 100644 --- a/Items/Placeables/Banners/BobbitWormBanner.cs +++ b/Items/Placeables/Banners/BobbitWormBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class BobbitWormBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 29; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class BobbitWormBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 29; + } + } +} diff --git a/Items/Placeables/Banners/BoxJellyfishBanner.cs b/Items/Placeables/Banners/BoxJellyfishBanner.cs index 52d4ee9ce4..d4ce488575 100644 --- a/Items/Placeables/Banners/BoxJellyfishBanner.cs +++ b/Items/Placeables/Banners/BoxJellyfishBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class BoxJellyfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 13; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class BoxJellyfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 13; + } + } +} diff --git a/Items/Placeables/Banners/CalamityEyeBanner.cs b/Items/Placeables/Banners/CalamityEyeBanner.cs index ba053dcb22..bd6f7ffbb3 100644 --- a/Items/Placeables/Banners/CalamityEyeBanner.cs +++ b/Items/Placeables/Banners/CalamityEyeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CalamityEyeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 55; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CalamityEyeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 55; + } + } +} diff --git a/Items/Placeables/Banners/CatfishBanner.cs b/Items/Placeables/Banners/CatfishBanner.cs index bc3f3ed818..52729cbbf6 100644 --- a/Items/Placeables/Banners/CatfishBanner.cs +++ b/Items/Placeables/Banners/CatfishBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CatfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 4; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CatfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 4; + } + } +} diff --git a/Items/Placeables/Banners/ChaoticPufferBanner.cs b/Items/Placeables/Banners/ChaoticPufferBanner.cs index 3163e8cc26..a7524c90bd 100644 --- a/Items/Placeables/Banners/ChaoticPufferBanner.cs +++ b/Items/Placeables/Banners/ChaoticPufferBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ChaoticPufferBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 30; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ChaoticPufferBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 30; + } + } +} diff --git a/Items/Placeables/Banners/CharredSlimeBanner.cs b/Items/Placeables/Banners/CharredSlimeBanner.cs index 6f9846c771..126cd5dddd 100644 --- a/Items/Placeables/Banners/CharredSlimeBanner.cs +++ b/Items/Placeables/Banners/CharredSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CharredSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 93; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CharredSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 93; + } + } +} diff --git a/Items/Placeables/Banners/ClamBanner.cs b/Items/Placeables/Banners/ClamBanner.cs index 03d60bc316..9b17bf5d10 100644 --- a/Items/Placeables/Banners/ClamBanner.cs +++ b/Items/Placeables/Banners/ClamBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ClamBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 99; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ClamBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 99; + } + } +} diff --git a/Items/Placeables/Banners/CloudElementalBanner.cs b/Items/Placeables/Banners/CloudElementalBanner.cs index bd2d25bbae..e706e15f55 100644 --- a/Items/Placeables/Banners/CloudElementalBanner.cs +++ b/Items/Placeables/Banners/CloudElementalBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CloudElementalBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 58; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CloudElementalBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 58; + } + } +} diff --git a/Items/Placeables/Banners/CnidrionBanner.cs b/Items/Placeables/Banners/CnidrionBanner.cs index be20a8befd..0fc677b83e 100644 --- a/Items/Placeables/Banners/CnidrionBanner.cs +++ b/Items/Placeables/Banners/CnidrionBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CnidrionBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 63; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CnidrionBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 63; + } + } +} diff --git a/Items/Placeables/Banners/ColossalSquidBanner.cs b/Items/Placeables/Banners/ColossalSquidBanner.cs index baa6c82961..90f794fefb 100644 --- a/Items/Placeables/Banners/ColossalSquidBanner.cs +++ b/Items/Placeables/Banners/ColossalSquidBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ColossalSquidBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 23; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ColossalSquidBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 23; + } + } +} diff --git a/Items/Placeables/Banners/CosmicElementalBanner.cs b/Items/Placeables/Banners/CosmicElementalBanner.cs index 4bab83e559..bca429f3ec 100644 --- a/Items/Placeables/Banners/CosmicElementalBanner.cs +++ b/Items/Placeables/Banners/CosmicElementalBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CosmicElementalBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 75; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CosmicElementalBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 75; + } + } +} diff --git a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs index 93ad4e15fd..9bc369cfb4 100644 --- a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs +++ b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CrimulanBlightSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 89; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CrimulanBlightSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 89; + } + } +} diff --git a/Items/Placeables/Banners/CryoSlimeBanner.cs b/Items/Placeables/Banners/CryoSlimeBanner.cs index 761025f8dc..336718c196 100644 --- a/Items/Placeables/Banners/CryoSlimeBanner.cs +++ b/Items/Placeables/Banners/CryoSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CryoSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 91; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CryoSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 91; + } + } +} diff --git a/Items/Placeables/Banners/CryonBanner.cs b/Items/Placeables/Banners/CryonBanner.cs index 51a1132de6..40f537ce2f 100644 --- a/Items/Placeables/Banners/CryonBanner.cs +++ b/Items/Placeables/Banners/CryonBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CryonBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 60; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CryonBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 60; + } + } +} diff --git a/Items/Placeables/Banners/CrystalCrawlerBanner.cs b/Items/Placeables/Banners/CrystalCrawlerBanner.cs index 05dbd4c249..0eaf270edf 100644 --- a/Items/Placeables/Banners/CrystalCrawlerBanner.cs +++ b/Items/Placeables/Banners/CrystalCrawlerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CrystalCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 73; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CrystalCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 73; + } + } +} diff --git a/Items/Placeables/Banners/CultistAssassinBanner.cs b/Items/Placeables/Banners/CultistAssassinBanner.cs index c7d9b4aa9d..d3b180c4d4 100644 --- a/Items/Placeables/Banners/CultistAssassinBanner.cs +++ b/Items/Placeables/Banners/CultistAssassinBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CultistAssassinBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 95; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CultistAssassinBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 95; + } + } +} diff --git a/Items/Placeables/Banners/CuttlefishBanner.cs b/Items/Placeables/Banners/CuttlefishBanner.cs index 2f475f2553..e44a85bf30 100644 --- a/Items/Placeables/Banners/CuttlefishBanner.cs +++ b/Items/Placeables/Banners/CuttlefishBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class CuttlefishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 16; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class CuttlefishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 16; + } + } +} diff --git a/Items/Placeables/Banners/DespairStoneBanner.cs b/Items/Placeables/Banners/DespairStoneBanner.cs index b597dc4022..8bff1f7371 100644 --- a/Items/Placeables/Banners/DespairStoneBanner.cs +++ b/Items/Placeables/Banners/DespairStoneBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class DespairStoneBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 46; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class DespairStoneBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 46; + } + } +} diff --git a/Items/Placeables/Banners/DevilFishBanner.cs b/Items/Placeables/Banners/DevilFishBanner.cs index 8ddd0df23c..f15507e5b4 100644 --- a/Items/Placeables/Banners/DevilFishBanner.cs +++ b/Items/Placeables/Banners/DevilFishBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class DevilFishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 15; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class DevilFishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 15; + } + } +} diff --git a/Items/Placeables/Banners/DiamondCrawlerBanner.cs b/Items/Placeables/Banners/DiamondCrawlerBanner.cs index b3e4b5488b..2a6003d633 100644 --- a/Items/Placeables/Banners/DiamondCrawlerBanner.cs +++ b/Items/Placeables/Banners/DiamondCrawlerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class DiamondCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 71; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class DiamondCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 71; + } + } +} diff --git a/Items/Placeables/Banners/EarthElementalBanner.cs b/Items/Placeables/Banners/EarthElementalBanner.cs index 0599229fee..7449be0e50 100644 --- a/Items/Placeables/Banners/EarthElementalBanner.cs +++ b/Items/Placeables/Banners/EarthElementalBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class EarthElementalBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 76; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class EarthElementalBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 76; + } + } +} diff --git a/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs b/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs index 83a7206c46..aa43e4096b 100644 --- a/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs +++ b/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class EbonianBlightSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 88; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class EbonianBlightSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 88; + } + } +} diff --git a/Items/Placeables/Banners/EidolistBanner.cs b/Items/Placeables/Banners/EidolistBanner.cs index adf7ce2006..4c251463cd 100644 --- a/Items/Placeables/Banners/EidolistBanner.cs +++ b/Items/Placeables/Banners/EidolistBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class EidolistBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 25; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class EidolistBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 25; + } + } +} diff --git a/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs b/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs index 6b8d4dae36..c53804c937 100644 --- a/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs +++ b/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class EidolonWyrmJuvenileBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 27; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class EidolonWyrmJuvenileBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 27; + } + } +} diff --git a/Items/Placeables/Banners/EmeraldCrawlerBanner.cs b/Items/Placeables/Banners/EmeraldCrawlerBanner.cs index 6242f55d49..018a291adf 100644 --- a/Items/Placeables/Banners/EmeraldCrawlerBanner.cs +++ b/Items/Placeables/Banners/EmeraldCrawlerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class EmeraldCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 69; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class EmeraldCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 69; + } + } +} diff --git a/Items/Placeables/Banners/EutrophicRayBanner.cs b/Items/Placeables/Banners/EutrophicRayBanner.cs index b57ea2e16d..9313ef3ea2 100644 --- a/Items/Placeables/Banners/EutrophicRayBanner.cs +++ b/Items/Placeables/Banners/EutrophicRayBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class EutrophicRayBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 100; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class EutrophicRayBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 100; + } + } +} diff --git a/Items/Placeables/Banners/FlounderBanner.cs b/Items/Placeables/Banners/FlounderBanner.cs index 1e03b53038..f045c54883 100644 --- a/Items/Placeables/Banners/FlounderBanner.cs +++ b/Items/Placeables/Banners/FlounderBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class FlounderBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 1; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class FlounderBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 1; + } + } +} diff --git a/Items/Placeables/Banners/FrogfishBanner.cs b/Items/Placeables/Banners/FrogfishBanner.cs index 926b979915..9190524e54 100644 --- a/Items/Placeables/Banners/FrogfishBanner.cs +++ b/Items/Placeables/Banners/FrogfishBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class FrogfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 8; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class FrogfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 8; + } + } +} diff --git a/Items/Placeables/Banners/FusionFeederBanner.cs b/Items/Placeables/Banners/FusionFeederBanner.cs index d18049ccb9..1941ade897 100644 --- a/Items/Placeables/Banners/FusionFeederBanner.cs +++ b/Items/Placeables/Banners/FusionFeederBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class FusionFeederBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 42; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class FusionFeederBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 42; + } + } +} diff --git a/Items/Placeables/Banners/GhostBellBanner.cs b/Items/Placeables/Banners/GhostBellBanner.cs index 0660f85952..3ce53ad658 100644 --- a/Items/Placeables/Banners/GhostBellBanner.cs +++ b/Items/Placeables/Banners/GhostBellBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class GhostBellBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 101; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class GhostBellBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 101; + } + } +} diff --git a/Items/Placeables/Banners/GhostBellSmallBanner.cs b/Items/Placeables/Banners/GhostBellSmallBanner.cs index f2b4dc6cd8..327bb062c1 100644 --- a/Items/Placeables/Banners/GhostBellSmallBanner.cs +++ b/Items/Placeables/Banners/GhostBellSmallBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class GhostBellSmallBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 102; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class GhostBellSmallBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 102; + } + } +} diff --git a/Items/Placeables/Banners/GiantClamBanner.cs b/Items/Placeables/Banners/GiantClamBanner.cs index 81e47e013c..253af98643 100644 --- a/Items/Placeables/Banners/GiantClamBanner.cs +++ b/Items/Placeables/Banners/GiantClamBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class GiantClamBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 107; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class GiantClamBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 107; + } + } +} diff --git a/Items/Placeables/Banners/GiantSquidBanner.cs b/Items/Placeables/Banners/GiantSquidBanner.cs index a6664bc4e7..a32c3f6e78 100644 --- a/Items/Placeables/Banners/GiantSquidBanner.cs +++ b/Items/Placeables/Banners/GiantSquidBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class GiantSquidBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 20; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class GiantSquidBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 20; + } + } +} diff --git a/Items/Placeables/Banners/GnasherBanner.cs b/Items/Placeables/Banners/GnasherBanner.cs index 2be5f1b6b5..1bc34d3efc 100644 --- a/Items/Placeables/Banners/GnasherBanner.cs +++ b/Items/Placeables/Banners/GnasherBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class GnasherBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 2; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class GnasherBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 2; + } + } +} diff --git a/Items/Placeables/Banners/GreatSandSharkBanner.cs b/Items/Placeables/Banners/GreatSandSharkBanner.cs index 6354482493..6091a4f2d4 100644 --- a/Items/Placeables/Banners/GreatSandSharkBanner.cs +++ b/Items/Placeables/Banners/GreatSandSharkBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class GreatSandSharkBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 65; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class GreatSandSharkBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 65; + } + } +} diff --git a/Items/Placeables/Banners/GulperEelBanner.cs b/Items/Placeables/Banners/GulperEelBanner.cs index 50b165d501..14d7e95935 100644 --- a/Items/Placeables/Banners/GulperEelBanner.cs +++ b/Items/Placeables/Banners/GulperEelBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class GulperEelBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 26; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class GulperEelBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 26; + } + } +} diff --git a/Items/Placeables/Banners/HadarianBanner.cs b/Items/Placeables/Banners/HadarianBanner.cs index a0d5d901ea..2bb7928d6f 100644 --- a/Items/Placeables/Banners/HadarianBanner.cs +++ b/Items/Placeables/Banners/HadarianBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class HadarianBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 43; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class HadarianBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 43; + } + } +} diff --git a/Items/Placeables/Banners/HeatSpiritBanner.cs b/Items/Placeables/Banners/HeatSpiritBanner.cs index f3a6e8cbff..01920c10e1 100644 --- a/Items/Placeables/Banners/HeatSpiritBanner.cs +++ b/Items/Placeables/Banners/HeatSpiritBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class HeatSpiritBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 44; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class HeatSpiritBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 44; + } + } +} diff --git a/Items/Placeables/Banners/HiveBanner.cs b/Items/Placeables/Banners/HiveBanner.cs index 3992ea1595..fd64b338cb 100644 --- a/Items/Placeables/Banners/HiveBanner.cs +++ b/Items/Placeables/Banners/HiveBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class HiveBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 40; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class HiveBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 40; + } + } +} diff --git a/Items/Placeables/Banners/IceClasperBanner.cs b/Items/Placeables/Banners/IceClasperBanner.cs index 0df885ee80..6329c7cc01 100644 --- a/Items/Placeables/Banners/IceClasperBanner.cs +++ b/Items/Placeables/Banners/IceClasperBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class IceClasperBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 61; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class IceClasperBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 61; + } + } +} diff --git a/Items/Placeables/Banners/ImpiousImmolatorBanner.cs b/Items/Placeables/Banners/ImpiousImmolatorBanner.cs index 5195a4af12..b08aa4c7e4 100644 --- a/Items/Placeables/Banners/ImpiousImmolatorBanner.cs +++ b/Items/Placeables/Banners/ImpiousImmolatorBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ImpiousImmolatorBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 48; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ImpiousImmolatorBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 48; + } + } +} diff --git a/Items/Placeables/Banners/IrradiatedSlimeBanner.cs b/Items/Placeables/Banners/IrradiatedSlimeBanner.cs index bd088fa9dd..7dd1c6c6f3 100644 --- a/Items/Placeables/Banners/IrradiatedSlimeBanner.cs +++ b/Items/Placeables/Banners/IrradiatedSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class IrradiatedSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 97; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class IrradiatedSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 97; + } + } +} diff --git a/Items/Placeables/Banners/LaserfishBanner.cs b/Items/Placeables/Banners/LaserfishBanner.cs index 7c2afaa0e1..708bd65cd7 100644 --- a/Items/Placeables/Banners/LaserfishBanner.cs +++ b/Items/Placeables/Banners/LaserfishBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class LaserfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 21; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class LaserfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 21; + } + } +} diff --git a/Items/Placeables/Banners/LuminousCorvinaBanner.cs b/Items/Placeables/Banners/LuminousCorvinaBanner.cs index 01b9b98b2a..c7c34a05e0 100644 --- a/Items/Placeables/Banners/LuminousCorvinaBanner.cs +++ b/Items/Placeables/Banners/LuminousCorvinaBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class LuminousCorvinaBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 19; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class LuminousCorvinaBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 19; + } + } +} diff --git a/Items/Placeables/Banners/MantisBanner.cs b/Items/Placeables/Banners/MantisBanner.cs index dbe2d77187..6b45326d96 100644 --- a/Items/Placeables/Banners/MantisBanner.cs +++ b/Items/Placeables/Banners/MantisBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class MantisBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 37; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class MantisBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 37; + } + } +} diff --git a/Items/Placeables/Banners/MantisShrimpBanner.cs b/Items/Placeables/Banners/MantisShrimpBanner.cs index 6f257652f7..a35ccab3b2 100644 --- a/Items/Placeables/Banners/MantisShrimpBanner.cs +++ b/Items/Placeables/Banners/MantisShrimpBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class MantisShrimpBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 9; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class MantisShrimpBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 9; + } + } +} diff --git a/Items/Placeables/Banners/MaulerBanner.cs b/Items/Placeables/Banners/MaulerBanner.cs index 91c8b781a3..ed076423a0 100644 --- a/Items/Placeables/Banners/MaulerBanner.cs +++ b/Items/Placeables/Banners/MaulerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class MaulerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 5; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class MaulerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 5; + } + } +} diff --git a/Items/Placeables/Banners/MelterBanner.cs b/Items/Placeables/Banners/MelterBanner.cs index dd65c0dd20..a1f2a559d9 100644 --- a/Items/Placeables/Banners/MelterBanner.cs +++ b/Items/Placeables/Banners/MelterBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class MelterBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 78; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class MelterBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 78; + } + } +} diff --git a/Items/Placeables/Banners/MirageJellyBanner.cs b/Items/Placeables/Banners/MirageJellyBanner.cs index f31a81c548..2226bcaf8d 100644 --- a/Items/Placeables/Banners/MirageJellyBanner.cs +++ b/Items/Placeables/Banners/MirageJellyBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class MirageJellyBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 24; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class MirageJellyBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 24; + } + } +} diff --git a/Items/Placeables/Banners/MorayEelBanner.cs b/Items/Placeables/Banners/MorayEelBanner.cs index e1daaec10a..48e9618f96 100644 --- a/Items/Placeables/Banners/MorayEelBanner.cs +++ b/Items/Placeables/Banners/MorayEelBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class MorayEelBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 14; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class MorayEelBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 14; + } + } +} diff --git a/Items/Placeables/Banners/NovaBanner.cs b/Items/Placeables/Banners/NovaBanner.cs index fe587d3663..e5e9773023 100644 --- a/Items/Placeables/Banners/NovaBanner.cs +++ b/Items/Placeables/Banners/NovaBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class NovaBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 38; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class NovaBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 38; + } + } +} diff --git a/Items/Placeables/Banners/OarfishBanner.cs b/Items/Placeables/Banners/OarfishBanner.cs index 9b45828b44..bd470e9428 100644 --- a/Items/Placeables/Banners/OarfishBanner.cs +++ b/Items/Placeables/Banners/OarfishBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class OarfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 22; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class OarfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 22; + } + } +} diff --git a/Items/Placeables/Banners/OverloadedSoldierBanner.cs b/Items/Placeables/Banners/OverloadedSoldierBanner.cs index 34570f44a0..1a82c17cf7 100644 --- a/Items/Placeables/Banners/OverloadedSoldierBanner.cs +++ b/Items/Placeables/Banners/OverloadedSoldierBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class OverloadedSoldierBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 85; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class OverloadedSoldierBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 85; + } + } +} diff --git a/Items/Placeables/Banners/ParaseaBanner.cs b/Items/Placeables/Banners/ParaseaBanner.cs index 221a2fd96d..4c2f36425b 100644 --- a/Items/Placeables/Banners/ParaseaBanner.cs +++ b/Items/Placeables/Banners/ParaseaBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ParaseaBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 11; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ParaseaBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 11; + } + } +} diff --git a/Items/Placeables/Banners/PerennialSlimeBanner.cs b/Items/Placeables/Banners/PerennialSlimeBanner.cs index 54a6ca2f24..4889833ef2 100644 --- a/Items/Placeables/Banners/PerennialSlimeBanner.cs +++ b/Items/Placeables/Banners/PerennialSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class PerennialSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 92; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class PerennialSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 92; + } + } +} diff --git a/Items/Placeables/Banners/PestilentSlimeBanner.cs b/Items/Placeables/Banners/PestilentSlimeBanner.cs index 6ea94ab658..193d93ba31 100644 --- a/Items/Placeables/Banners/PestilentSlimeBanner.cs +++ b/Items/Placeables/Banners/PestilentSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class PestilentSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 79; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class PestilentSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 79; + } + } +} diff --git a/Items/Placeables/Banners/PhantomDebrisBanner.cs b/Items/Placeables/Banners/PhantomDebrisBanner.cs index acfac18416..8fd2f1afc0 100644 --- a/Items/Placeables/Banners/PhantomDebrisBanner.cs +++ b/Items/Placeables/Banners/PhantomDebrisBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class PhantomDebrisBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 86; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class PhantomDebrisBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 86; + } + } +} diff --git a/Items/Placeables/Banners/PhantomSpiritBanner.cs b/Items/Placeables/Banners/PhantomSpiritBanner.cs index 6e585cd466..790708ed93 100644 --- a/Items/Placeables/Banners/PhantomSpiritBanner.cs +++ b/Items/Placeables/Banners/PhantomSpiritBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class PhantomSpiritBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 84; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class PhantomSpiritBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 84; + } + } +} diff --git a/Items/Placeables/Banners/PitbullBanner.cs b/Items/Placeables/Banners/PitbullBanner.cs index 7fca34ce0c..c81af0d5da 100644 --- a/Items/Placeables/Banners/PitbullBanner.cs +++ b/Items/Placeables/Banners/PitbullBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class PitbullBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 53; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class PitbullBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 53; + } + } +} diff --git a/Items/Placeables/Banners/PlagueChargerBanner.cs b/Items/Placeables/Banners/PlagueChargerBanner.cs index 0f84268cee..64e45048f6 100644 --- a/Items/Placeables/Banners/PlagueChargerBanner.cs +++ b/Items/Placeables/Banners/PlagueChargerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class PlagueChargerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 81; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class PlagueChargerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 81; + } + } +} diff --git a/Items/Placeables/Banners/PlaguebringerBanner.cs b/Items/Placeables/Banners/PlaguebringerBanner.cs index 9a4f613066..a22330db84 100644 --- a/Items/Placeables/Banners/PlaguebringerBanner.cs +++ b/Items/Placeables/Banners/PlaguebringerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class PlaguebringerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 83; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class PlaguebringerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 83; + } + } +} diff --git a/Items/Placeables/Banners/PlagueshellBanner.cs b/Items/Placeables/Banners/PlagueshellBanner.cs index c905cc130e..ec1f12dc2e 100644 --- a/Items/Placeables/Banners/PlagueshellBanner.cs +++ b/Items/Placeables/Banners/PlagueshellBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class PlagueshellBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 80; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class PlagueshellBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 80; + } + } +} diff --git a/Items/Placeables/Banners/PrismTurtleBanner.cs b/Items/Placeables/Banners/PrismTurtleBanner.cs index af96a13038..a3e709f5be 100644 --- a/Items/Placeables/Banners/PrismTurtleBanner.cs +++ b/Items/Placeables/Banners/PrismTurtleBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class PrismTurtleBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 98; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class PrismTurtleBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 98; + } + } +} diff --git a/Items/Placeables/Banners/ProfanedEnergyBanner.cs b/Items/Placeables/Banners/ProfanedEnergyBanner.cs index e0dc29549d..b16002bc35 100644 --- a/Items/Placeables/Banners/ProfanedEnergyBanner.cs +++ b/Items/Placeables/Banners/ProfanedEnergyBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ProfanedEnergyBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 50; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ProfanedEnergyBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 50; + } + } +} diff --git a/Items/Placeables/Banners/ReaperSharkBanner.cs b/Items/Placeables/Banners/ReaperSharkBanner.cs index 4ed2ff6b28..85c3942184 100644 --- a/Items/Placeables/Banners/ReaperSharkBanner.cs +++ b/Items/Placeables/Banners/ReaperSharkBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ReaperSharkBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 96; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ReaperSharkBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 96; + } + } +} diff --git a/Items/Placeables/Banners/RubyCrawlerBanner.cs b/Items/Placeables/Banners/RubyCrawlerBanner.cs index 3e23d64dc0..4160bf0063 100644 --- a/Items/Placeables/Banners/RubyCrawlerBanner.cs +++ b/Items/Placeables/Banners/RubyCrawlerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class RubyCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 70; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class RubyCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 70; + } + } +} diff --git a/Items/Placeables/Banners/SandTortoiseBanner.cs b/Items/Placeables/Banners/SandTortoiseBanner.cs index f3e171e0e1..dba895cee9 100644 --- a/Items/Placeables/Banners/SandTortoiseBanner.cs +++ b/Items/Placeables/Banners/SandTortoiseBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class SandTortoiseBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 64; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class SandTortoiseBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 64; + } + } +} diff --git a/Items/Placeables/Banners/SapphireCrawlerBanner.cs b/Items/Placeables/Banners/SapphireCrawlerBanner.cs index 8ea18ab606..cf1e9d2825 100644 --- a/Items/Placeables/Banners/SapphireCrawlerBanner.cs +++ b/Items/Placeables/Banners/SapphireCrawlerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class SapphireCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 68; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class SapphireCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 68; + } + } +} diff --git a/Items/Placeables/Banners/ScornEaterBanner.cs b/Items/Placeables/Banners/ScornEaterBanner.cs index 3ef0fee62a..b3c5a0a060 100644 --- a/Items/Placeables/Banners/ScornEaterBanner.cs +++ b/Items/Placeables/Banners/ScornEaterBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ScornEaterBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 49; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ScornEaterBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 49; + } + } +} diff --git a/Items/Placeables/Banners/ScryllarBanner.cs b/Items/Placeables/Banners/ScryllarBanner.cs index 49f59595d2..d217342ae9 100644 --- a/Items/Placeables/Banners/ScryllarBanner.cs +++ b/Items/Placeables/Banners/ScryllarBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ScryllarBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 45; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ScryllarBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 45; + } + } +} diff --git a/Items/Placeables/Banners/SeaFloatyBanner.cs b/Items/Placeables/Banners/SeaFloatyBanner.cs index 73d3b83eed..7a0031f080 100644 --- a/Items/Placeables/Banners/SeaFloatyBanner.cs +++ b/Items/Placeables/Banners/SeaFloatyBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class SeaFloatyBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 103; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class SeaFloatyBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 103; + } + } +} diff --git a/Items/Placeables/Banners/SeaMinnowBanner.cs b/Items/Placeables/Banners/SeaMinnowBanner.cs index 640e7e7dc3..202e899f48 100644 --- a/Items/Placeables/Banners/SeaMinnowBanner.cs +++ b/Items/Placeables/Banners/SeaMinnowBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class SeaMinnowBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 105; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class SeaMinnowBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 105; + } + } +} diff --git a/Items/Placeables/Banners/SeaSerpentBanner.cs b/Items/Placeables/Banners/SeaSerpentBanner.cs index 6b72bfe987..6eeacc915d 100644 --- a/Items/Placeables/Banners/SeaSerpentBanner.cs +++ b/Items/Placeables/Banners/SeaSerpentBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class SeaSerpentBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 106; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class SeaSerpentBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 106; + } + } +} diff --git a/Items/Placeables/Banners/SeaUrchinBanner.cs b/Items/Placeables/Banners/SeaUrchinBanner.cs index 639c694efb..3edb68ee5f 100644 --- a/Items/Placeables/Banners/SeaUrchinBanner.cs +++ b/Items/Placeables/Banners/SeaUrchinBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class SeaUrchinBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 12; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class SeaUrchinBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 12; + } + } +} diff --git a/Items/Placeables/Banners/ShockstormShuttleBanner.cs b/Items/Placeables/Banners/ShockstormShuttleBanner.cs index 44ab143d44..189c720aff 100644 --- a/Items/Placeables/Banners/ShockstormShuttleBanner.cs +++ b/Items/Placeables/Banners/ShockstormShuttleBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ShockstormShuttleBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 57; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ShockstormShuttleBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 57; + } + } +} diff --git a/Items/Placeables/Banners/SmallSightseerBanner.cs b/Items/Placeables/Banners/SmallSightseerBanner.cs index 1f62408018..e4f4772e05 100644 --- a/Items/Placeables/Banners/SmallSightseerBanner.cs +++ b/Items/Placeables/Banners/SmallSightseerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class SmallSightseerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 32; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class SmallSightseerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 32; + } + } +} diff --git a/Items/Placeables/Banners/SoulSluperBanner.cs b/Items/Placeables/Banners/SoulSluperBanner.cs index 6a23e735ab..ea956dc03b 100644 --- a/Items/Placeables/Banners/SoulSluperBanner.cs +++ b/Items/Placeables/Banners/SoulSluperBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class SoulSlurperBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 47; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class SoulSlurperBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 47; + } + } +} diff --git a/Items/Placeables/Banners/StellarCulexBanner.cs b/Items/Placeables/Banners/StellarCulexBanner.cs index 16c0e35a23..db173d7044 100644 --- a/Items/Placeables/Banners/StellarCulexBanner.cs +++ b/Items/Placeables/Banners/StellarCulexBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class StellarCulexBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 41; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class StellarCulexBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 41; + } + } +} diff --git a/Items/Placeables/Banners/StormlionBanner.cs b/Items/Placeables/Banners/StormlionBanner.cs index de8c980d45..83f396cf44 100644 --- a/Items/Placeables/Banners/StormlionBanner.cs +++ b/Items/Placeables/Banners/StormlionBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class StormlionBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 62; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class StormlionBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 62; + } + } +} diff --git a/Items/Placeables/Banners/SunBatBanner.cs b/Items/Placeables/Banners/SunBatBanner.cs index 4290a51ea8..707a0b0ed3 100644 --- a/Items/Placeables/Banners/SunBatBanner.cs +++ b/Items/Placeables/Banners/SunBatBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class SunBatBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 74; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class SunBatBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 74; + } + } +} diff --git a/Items/Placeables/Banners/SunskaterBanner.cs b/Items/Placeables/Banners/SunskaterBanner.cs index 40de8e81d1..95ce0a0409 100644 --- a/Items/Placeables/Banners/SunskaterBanner.cs +++ b/Items/Placeables/Banners/SunskaterBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class SunskaterBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 56; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class SunskaterBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 56; + } + } +} diff --git a/Items/Placeables/Banners/TopazCrawlerBanner.cs b/Items/Placeables/Banners/TopazCrawlerBanner.cs index 2c1a31eb85..1cb1c5a71c 100644 --- a/Items/Placeables/Banners/TopazCrawlerBanner.cs +++ b/Items/Placeables/Banners/TopazCrawlerBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class TopazCrawlerBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 67; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class TopazCrawlerBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 67; + } + } +} diff --git a/Items/Placeables/Banners/ToxicMinnowBanner.cs b/Items/Placeables/Banners/ToxicMinnowBanner.cs index 1880e21218..268c4e00cc 100644 --- a/Items/Placeables/Banners/ToxicMinnowBanner.cs +++ b/Items/Placeables/Banners/ToxicMinnowBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ToxicMinnowBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 17; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ToxicMinnowBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 17; + } + } +} diff --git a/Items/Placeables/Banners/TrasherBanner.cs b/Items/Placeables/Banners/TrasherBanner.cs index da31316c1b..26ff62c516 100644 --- a/Items/Placeables/Banners/TrasherBanner.cs +++ b/Items/Placeables/Banners/TrasherBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class TrasherBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 3; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class TrasherBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 3; + } + } +} diff --git a/Items/Placeables/Banners/ViperfishBanner.cs b/Items/Placeables/Banners/ViperfishBanner.cs index 4c10b181b3..d36e64fa69 100644 --- a/Items/Placeables/Banners/ViperfishBanner.cs +++ b/Items/Placeables/Banners/ViperfishBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class ViperfishBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 18; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class ViperfishBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 18; + } + } +} diff --git a/Items/Placeables/Banners/VirulingBanner.cs b/Items/Placeables/Banners/VirulingBanner.cs index 1ea600bcab..d5739cde1f 100644 --- a/Items/Placeables/Banners/VirulingBanner.cs +++ b/Items/Placeables/Banners/VirulingBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class VirulingBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 82; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class VirulingBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 82; + } + } +} diff --git a/Items/Placeables/Banners/WulfrumDroneBanner.cs b/Items/Placeables/Banners/WulfrumDroneBanner.cs index d97a7185b6..40d829af9f 100644 --- a/Items/Placeables/Banners/WulfrumDroneBanner.cs +++ b/Items/Placeables/Banners/WulfrumDroneBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class WulfrumDroneBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 52; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class WulfrumDroneBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 52; + } + } +} diff --git a/Items/Placeables/Banners/WulfrumSlimeBanner.cs b/Items/Placeables/Banners/WulfrumSlimeBanner.cs index 792b46bf67..2d4f082cba 100644 --- a/Items/Placeables/Banners/WulfrumSlimeBanner.cs +++ b/Items/Placeables/Banners/WulfrumSlimeBanner.cs @@ -1,25 +1,25 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class WulfrumSlimeBanner : ModItem - { - public override void SetDefaults() - { - item.width = 10; - item.height = 24; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.rare = 1; - item.value = Item.buyPrice(0, 0, 10, 0); - item.createTile = mod.TileType("MonsterBanner"); - item.placeStyle = 51; - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class WulfrumSlimeBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 51; + } + } +} diff --git a/Items/Placeables/BlueBrickWallUnsafe.cs b/Items/Placeables/BlueBrickWallUnsafe.cs index 3db5a68ebe..5c5d8ddcb7 100644 --- a/Items/Placeables/BlueBrickWallUnsafe.cs +++ b/Items/Placeables/BlueBrickWallUnsafe.cs @@ -1,22 +1,22 @@ -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables -{ - public class BlueBrickWallUnsafe : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = WallID.BlueDungeonUnsafe; - } - } -} \ No newline at end of file +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class BlueBrickWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.BlueDungeonUnsafe; + } + } +} diff --git a/Items/Placeables/BlueSlabWallUnsafe.cs b/Items/Placeables/BlueSlabWallUnsafe.cs index 9f17fd3f37..8902199425 100644 --- a/Items/Placeables/BlueSlabWallUnsafe.cs +++ b/Items/Placeables/BlueSlabWallUnsafe.cs @@ -1,22 +1,22 @@ -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables -{ - public class BlueSlabWallUnsafe : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = WallID.BlueDungeonSlabUnsafe; - } - } -} \ No newline at end of file +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class BlueSlabWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.BlueDungeonSlabUnsafe; + } + } +} diff --git a/Items/Placeables/BlueTiledWallUnsafe.cs b/Items/Placeables/BlueTiledWallUnsafe.cs index 951af9fd66..0f5f4ae968 100644 --- a/Items/Placeables/BlueTiledWallUnsafe.cs +++ b/Items/Placeables/BlueTiledWallUnsafe.cs @@ -1,22 +1,22 @@ -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables -{ - public class BlueTiledWallUnsafe : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = WallID.BlueDungeonTileUnsafe; - } - } -} \ No newline at end of file +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class BlueTiledWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.BlueDungeonTileUnsafe; + } + } +} diff --git a/Items/Placeables/BrimstoneElementalTrophy.cs b/Items/Placeables/BrimstoneElementalTrophy.cs index 28074e400b..a0985c0630 100644 --- a/Items/Placeables/BrimstoneElementalTrophy.cs +++ b/Items/Placeables/BrimstoneElementalTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class BrimstoneElementalTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Elemental Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 21; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class BrimstoneElementalTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Elemental Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 21; + } + } +} diff --git a/Items/Placeables/BrimstoneSlag.cs b/Items/Placeables/BrimstoneSlag.cs index 715bd42dd2..d9c104fd37 100644 --- a/Items/Placeables/BrimstoneSlag.cs +++ b/Items/Placeables/BrimstoneSlag.cs @@ -1,35 +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.Placeables -{ - public class BrimstoneSlag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Slag"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("BrimstoneSlag"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = 1000; - item.rare = 3; - } - } -} \ No newline at end of file +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.Placeables +{ + public class BrimstoneSlag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Slag"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("BrimstoneSlag"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = 1000; + item.rare = 3; + } + } +} diff --git a/Items/Placeables/BrimstoneSlagWall.cs b/Items/Placeables/BrimstoneSlagWall.cs index 63077777b5..c2b4353e2a 100644 --- a/Items/Placeables/BrimstoneSlagWall.cs +++ b/Items/Placeables/BrimstoneSlagWall.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class BrimstoneSlagWall : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("BrimstoneSlagWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BrimstoneSlag"); - recipe.AddTile(18); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class BrimstoneSlagWall : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("BrimstoneSlagWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BrimstoneSlag"); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/BumblebirbTrophy.cs b/Items/Placeables/BumblebirbTrophy.cs index d05fd14d18..bfbb9e8382 100644 --- a/Items/Placeables/BumblebirbTrophy.cs +++ b/Items/Placeables/BumblebirbTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class BumblebirbTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bumblebirb Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 18; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class BumblebirbTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bumblebirb Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 18; + } + } +} diff --git a/Items/Placeables/CalamitasTrophy.cs b/Items/Placeables/CalamitasTrophy.cs index dd7eadbb0b..2cdb44d713 100644 --- a/Items/Placeables/CalamitasTrophy.cs +++ b/Items/Placeables/CalamitasTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CalamitasTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 7; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CalamitasTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 7; + } + } +} diff --git a/Items/Placeables/CataclysmTrophy.cs b/Items/Placeables/CataclysmTrophy.cs index 0a722a0d5d..d7468a1fa8 100644 --- a/Items/Placeables/CataclysmTrophy.cs +++ b/Items/Placeables/CataclysmTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CataclysmTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclysm Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 16; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CataclysmTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclysm Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 16; + } + } +} diff --git a/Items/Placeables/CatastropheTrophy.cs b/Items/Placeables/CatastropheTrophy.cs index 14111278e4..5ec3287464 100644 --- a/Items/Placeables/CatastropheTrophy.cs +++ b/Items/Placeables/CatastropheTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CatastropheTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastrophe Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 15; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CatastropheTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 15; + } + } +} diff --git a/Items/Placeables/CeaselessVoidTrophy.cs b/Items/Placeables/CeaselessVoidTrophy.cs index 2bb3e973f1..d8b651c358 100644 --- a/Items/Placeables/CeaselessVoidTrophy.cs +++ b/Items/Placeables/CeaselessVoidTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CeaselessVoidTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ceaseless Void Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 13; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CeaselessVoidTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ceaseless Void Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 13; + } + } +} diff --git a/Items/Placeables/ChaosCandle.cs b/Items/Placeables/ChaosCandle.cs index 8c4bdd7665..cfe1ca32d8 100644 --- a/Items/Placeables/ChaosCandle.cs +++ b/Items/Placeables/ChaosCandle.cs @@ -1,48 +1,48 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ChaosCandle: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Candle"); - Tooltip.SetDefault("The mere presence of this candle enrages surrounding enemies drastically"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 500; - item.createTile = mod.TileType("ChaosCandle"); - } - - public override void HoldItem(Player player) - { - player.GetModPlayer().chaosCandle = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WaterCandle, 3); - recipe.AddIngredient(ItemID.SoulofNight, 3); - recipe.AddIngredient(null, "CoreofChaos", 6); - recipe.AddIngredient(null, "ZergPotion"); - recipe.SetResult(this, 1); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ChaosCandle: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Candle"); + Tooltip.SetDefault("The mere presence of this candle enrages surrounding enemies drastically"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 500; + item.createTile = mod.TileType("ChaosCandle"); + } + + public override void HoldItem(Player player) + { + player.GetModPlayer().chaosCandle = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WaterCandle, 3); + recipe.AddIngredient(ItemID.SoulofNight, 3); + recipe.AddIngredient(null, "CoreofChaos", 6); + recipe.AddIngredient(null, "ZergPotion"); + recipe.SetResult(this, 1); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/ChaoticBrick.cs b/Items/Placeables/ChaoticBrick.cs index 037036de85..712084b09b 100644 --- a/Items/Placeables/ChaoticBrick.cs +++ b/Items/Placeables/ChaoticBrick.cs @@ -1,42 +1,42 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ChaoticBrick : ModItem - { - public override void SetDefaults() - { - item.width = 24; - item.height = 25; - item.maxStack = 999; - item.value = 0; - item.rare = 1; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("ChaoticBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.AddIngredient(null, "ChaoticOre", 1); - recipe.AddTile(17); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ChaoticBrickWall", 4); - recipe.AddTile(18); - recipe.SetResult(this, 1); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ChaoticBrick : ModItem + { + public override void SetDefaults() + { + item.width = 24; + item.height = 25; + item.maxStack = 999; + item.value = 0; + item.rare = 1; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("ChaoticBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.AddIngredient(null, "ChaoticOre", 1); + recipe.AddTile(17); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ChaoticBrickWall", 4); + recipe.AddTile(18); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/ChaoticBrickWall.cs b/Items/Placeables/ChaoticBrickWall.cs index 332580d1e6..cb552c661c 100644 --- a/Items/Placeables/ChaoticBrickWall.cs +++ b/Items/Placeables/ChaoticBrickWall.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ChaoticBrickWall : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("ChaoticBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ChaoticBrick", 1); - recipe.AddTile(18); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ChaoticBrickWall : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("ChaoticBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ChaoticBrick", 1); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/ChaoticOre.cs b/Items/Placeables/ChaoticOre.cs index c7e4c7a6bc..2b2e272ba4 100644 --- a/Items/Placeables/ChaoticOre.cs +++ b/Items/Placeables/ChaoticOre.cs @@ -1,35 +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.Placeables -{ - public class ChaoticOre : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaotic Ore"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("ChaoticOre"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 10; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 8; - } - } -} \ No newline at end of file +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.Placeables +{ + public class ChaoticOre : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaotic Ore"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("ChaoticOre"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 10; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 8; + } + } +} diff --git a/Items/Placeables/CharredOre.cs b/Items/Placeables/CharredOre.cs index 29c7246b6d..0046dcf7bc 100644 --- a/Items/Placeables/CharredOre.cs +++ b/Items/Placeables/CharredOre.cs @@ -1,35 +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.Placeables -{ - public class CharredOre : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Charred Ore"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("CharredOre"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 16; - item.height = 16; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 6; - } - } -} \ No newline at end of file +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.Placeables +{ + public class CharredOre : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Charred Ore"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("CharredOre"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 16; + item.height = 16; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 6; + } + } +} diff --git a/Items/Placeables/Cinderplate.cs b/Items/Placeables/Cinderplate.cs index 3b847f9c80..9c27126287 100644 --- a/Items/Placeables/Cinderplate.cs +++ b/Items/Placeables/Cinderplate.cs @@ -1,51 +1,51 @@ -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.Placeables -{ - public class Cinderplate : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cinderplate"); - Tooltip.SetDefault("It resonates with otherworldly energy."); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("Cinderplate"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Hellstone, 6); - recipe.AddIngredient(ItemID.Obsidian, 3); - 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 +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.Placeables +{ + public class Cinderplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cinderplate"); + Tooltip.SetDefault("It resonates with otherworldly energy."); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("Cinderplate"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Hellstone, 6); + recipe.AddIngredient(ItemID.Obsidian, 3); + 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(); + } + } +} diff --git a/Items/Placeables/CinderplateWall.cs b/Items/Placeables/CinderplateWall.cs index 467b1d1782..97e94b19d2 100644 --- a/Items/Placeables/CinderplateWall.cs +++ b/Items/Placeables/CinderplateWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CinderplateWall : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("CinderplateWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Cinderplate"); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CinderplateWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("CinderplateWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Cinderplate"); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/CrabulonTrophy.cs b/Items/Placeables/CrabulonTrophy.cs index 8ac457727a..8e578bf1f9 100644 --- a/Items/Placeables/CrabulonTrophy.cs +++ b/Items/Placeables/CrabulonTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CrabulonTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crabulon Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 9; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CrabulonTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 9; + } + } +} diff --git a/Items/Placeables/CryogenTrophy.cs b/Items/Placeables/CryogenTrophy.cs index 96ba4c773c..cbcdeb1112 100644 --- a/Items/Placeables/CryogenTrophy.cs +++ b/Items/Placeables/CryogenTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CryogenTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 3; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CryogenTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 3; + } + } +} diff --git a/Items/Placeables/CryonicBrick.cs b/Items/Placeables/CryonicBrick.cs index e6867ff237..d708749a3d 100644 --- a/Items/Placeables/CryonicBrick.cs +++ b/Items/Placeables/CryonicBrick.cs @@ -1,43 +1,43 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace CalamityMod.Items.Placeables -{ - public class CryonicBrick : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("CryonicBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("CryonicOre"), 1); - recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Furnaces); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("CryonicBrickWall"), 4); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - } - } -} +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace CalamityMod.Items.Placeables +{ + public class CryonicBrick : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("CryonicBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("CryonicOre"), 1); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.Furnaces); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("CryonicBrickWall"), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/CryonicBrickWall.cs b/Items/Placeables/CryonicBrickWall.cs index 9508bd4b26..5122b80ca2 100644 --- a/Items/Placeables/CryonicBrickWall.cs +++ b/Items/Placeables/CryonicBrickWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class CryonicBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("CryonicBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("CryonicBrick")); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class CryonicBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("CryonicBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("CryonicBrick")); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/CryonicOre.cs b/Items/Placeables/CryonicOre.cs index e5b42ff96c..134d303e92 100644 --- a/Items/Placeables/CryonicOre.cs +++ b/Items/Placeables/CryonicOre.cs @@ -1,35 +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.Placeables -{ - public class CryonicOre : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryonic Ore"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("CryonicOre"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 5; - } - } -} \ No newline at end of file +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.Placeables +{ + public class CryonicOre : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryonic Ore"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("CryonicOre"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 5; + } + } +} diff --git a/Items/Placeables/DesertScourgeTrophy.cs b/Items/Placeables/DesertScourgeTrophy.cs index 8f8853ed17..5d99d2bb0c 100644 --- a/Items/Placeables/DesertScourgeTrophy.cs +++ b/Items/Placeables/DesertScourgeTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class DesertScourgeTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 0; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class DesertScourgeTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 0; + } + } +} diff --git a/Items/Placeables/DevourerofGodsTrophy.cs b/Items/Placeables/DevourerofGodsTrophy.cs index de30b2ef2f..fab007a2f6 100644 --- a/Items/Placeables/DevourerofGodsTrophy.cs +++ b/Items/Placeables/DevourerofGodsTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class DevourerofGodsTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devourer of Gods Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 14; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class DevourerofGodsTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devourer of Gods Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 14; + } + } +} diff --git a/Items/Placeables/DraedonsForge.cs b/Items/Placeables/DraedonsForge.cs index c4df8dc8ca..851edd7973 100644 --- a/Items/Placeables/DraedonsForge.cs +++ b/Items/Placeables/DraedonsForge.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class DraedonsForge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Draedon's Forge"); - Tooltip.SetDefault("Used to craft uber-tier items"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 5000000; - item.rare = 10; - item.createTile = mod.TileType("DraedonsForge"); - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AdamantiteForge); - recipe.AddIngredient(ItemID.MythrilAnvil); - recipe.AddIngredient(ItemID.LunarCraftingStation); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumForge); - recipe.AddIngredient(ItemID.MythrilAnvil); - recipe.AddIngredient(ItemID.LunarCraftingStation); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumForge); - recipe.AddIngredient(ItemID.OrichalcumAnvil); - recipe.AddIngredient(ItemID.LunarCraftingStation); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AdamantiteForge); - recipe.AddIngredient(ItemID.OrichalcumAnvil); - recipe.AddIngredient(ItemID.LunarCraftingStation); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "NightmareFuel", 20); - recipe.AddIngredient(null, "EndothermicEnergy", 20); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class DraedonsForge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon's Forge"); + Tooltip.SetDefault("Used to craft uber-tier items"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 5000000; + item.rare = 10; + item.createTile = mod.TileType("DraedonsForge"); + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AdamantiteForge); + recipe.AddIngredient(ItemID.MythrilAnvil); + recipe.AddIngredient(ItemID.LunarCraftingStation); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitaniumForge); + recipe.AddIngredient(ItemID.MythrilAnvil); + recipe.AddIngredient(ItemID.LunarCraftingStation); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitaniumForge); + recipe.AddIngredient(ItemID.OrichalcumAnvil); + recipe.AddIngredient(ItemID.LunarCraftingStation); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AdamantiteForge); + recipe.AddIngredient(ItemID.OrichalcumAnvil); + recipe.AddIngredient(ItemID.LunarCraftingStation); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "NightmareFuel", 20); + recipe.AddIngredient(null, "EndothermicEnergy", 20); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/EutrophicSand.cs b/Items/Placeables/EutrophicSand.cs index f5699bdc5b..56a870db02 100644 --- a/Items/Placeables/EutrophicSand.cs +++ b/Items/Placeables/EutrophicSand.cs @@ -1,42 +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.Placeables -{ - public class EutrophicSand : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eutrophic Sand"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("EutrophicSand"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EutrophicSandWallSafe", 4); - recipe.AddTile(18); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Placeables +{ + public class EutrophicSand : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eutrophic Sand"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("EutrophicSand"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EutrophicSandWallSafe", 4); + recipe.AddTile(18); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/EutrophicSandWall.cs b/Items/Placeables/EutrophicSandWall.cs index 9b775bfeeb..a9f6c72029 100644 --- a/Items/Placeables/EutrophicSandWall.cs +++ b/Items/Placeables/EutrophicSandWall.cs @@ -1,24 +1,24 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class EutrophicSandWall : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("EutrophicSandWall"); - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class EutrophicSandWall : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("EutrophicSandWall"); + } + } +} diff --git a/Items/Placeables/EutrophicSandWallSafe.cs b/Items/Placeables/EutrophicSandWallSafe.cs index 477e76a6f5..da3d1ab41a 100644 --- a/Items/Placeables/EutrophicSandWallSafe.cs +++ b/Items/Placeables/EutrophicSandWallSafe.cs @@ -30,4 +30,4 @@ namespace CalamityMod.Items.Placeables recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/ExodiumClusterOre.cs b/Items/Placeables/ExodiumClusterOre.cs index ee832dd46e..edc2640dcb 100644 --- a/Items/Placeables/ExodiumClusterOre.cs +++ b/Items/Placeables/ExodiumClusterOre.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.Placeables -{ - public class ExodiumClusterOre : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Exodium Cluster"); - Tooltip.SetDefault("A cold cluster from the great unknown."); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("ExodiumOre"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 10; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarOre, 3); - recipe.AddIngredient(ItemID.FragmentStardust); - recipe.AddIngredient(ItemID.FragmentSolar); - recipe.AddIngredient(ItemID.FragmentVortex); - recipe.AddIngredient(ItemID.FragmentNebula); - recipe.SetResult(this); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Placeables +{ + public class ExodiumClusterOre : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exodium Cluster"); + Tooltip.SetDefault("A cold cluster from the great unknown."); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("ExodiumOre"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 10; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarOre, 3); + recipe.AddIngredient(ItemID.FragmentStardust); + recipe.AddIngredient(ItemID.FragmentSolar); + recipe.AddIngredient(ItemID.FragmentVortex); + recipe.AddIngredient(ItemID.FragmentNebula); + recipe.SetResult(this); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssBath.cs b/Items/Placeables/FurnitureAbyss/AbyssBath.cs index 2a797f8065..0d5dc1e658 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBath.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBath.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssBed.cs b/Items/Placeables/FurnitureAbyss/AbyssBed.cs index f37be2af46..f0ac71e8e2 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBed.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBed.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs b/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs index 3a13004e77..0be09955e2 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssBookcase.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs b/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs index 93b1bba8f1..ca7aceb713 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssCandelabra.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssCandle.cs b/Items/Placeables/FurnitureAbyss/AbyssCandle.cs index b3472aae20..0f680fd4fc 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssCandle.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssCandle.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssChair.cs b/Items/Placeables/FurnitureAbyss/AbyssChair.cs index 5f59c63274..bf2109e170 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChair.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChair.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs b/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs index a9788a9d59..3852c8f78c 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChandelier.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssChest.cs b/Items/Placeables/FurnitureAbyss/AbyssChest.cs index 512fd522d2..719678c5a2 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssChest.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssChest.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssClock.cs b/Items/Placeables/FurnitureAbyss/AbyssClock.cs index 899714c949..dac02ef974 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssClock.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssClock.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssDoor.cs b/Items/Placeables/FurnitureAbyss/AbyssDoor.cs index f725d3e171..1b395b0afb 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssDoor.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssDoor.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssDresser.cs b/Items/Placeables/FurnitureAbyss/AbyssDresser.cs index 578f973c82..df90fe7496 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssDresser.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssDresser.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssLamp.cs b/Items/Placeables/FurnitureAbyss/AbyssLamp.cs index a6b71b1148..b97d2de262 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssLamp.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssLamp.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssLantern.cs b/Items/Placeables/FurnitureAbyss/AbyssLantern.cs index 46077dd0ed..6b255dee56 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssLantern.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssLantern.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssPiano.cs b/Items/Placeables/FurnitureAbyss/AbyssPiano.cs index e74c052a90..3f62addbd1 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssPiano.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssPiano.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssSink.cs b/Items/Placeables/FurnitureAbyss/AbyssSink.cs index 84a0ba80c7..bd273f5d56 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSink.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSink.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssSofa.cs b/Items/Placeables/FurnitureAbyss/AbyssSofa.cs index e01eacc4b8..f765fa58d5 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssSofa.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssSofa.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssTable.cs b/Items/Placeables/FurnitureAbyss/AbyssTable.cs index 35af14d890..def0858170 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTable.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTable.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs index d26fdfe374..760d33ecf8 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs @@ -57,4 +57,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs b/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs index 4c8d3dbe3b..9bf338b491 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index f080188b0c..ecd83a862c 100644 --- a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.cs b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.cs index be2fc62ea4..cbab695f87 100644 --- a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.cs +++ b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientAltar.cs b/Items/Placeables/FurnitureAncient/AncientAltar.cs index b604476ca8..fe59672a93 100644 --- a/Items/Placeables/FurnitureAncient/AncientAltar.cs +++ b/Items/Placeables/FurnitureAncient/AncientAltar.cs @@ -37,4 +37,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientBasin.cs b/Items/Placeables/FurnitureAncient/AncientBasin.cs index 5a9e7c6c5a..a9d27fcbce 100644 --- a/Items/Placeables/FurnitureAncient/AncientBasin.cs +++ b/Items/Placeables/FurnitureAncient/AncientBasin.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientBath.cs b/Items/Placeables/FurnitureAncient/AncientBath.cs index 9f262cccba..02a382bf90 100644 --- a/Items/Placeables/FurnitureAncient/AncientBath.cs +++ b/Items/Placeables/FurnitureAncient/AncientBath.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientBed.cs b/Items/Placeables/FurnitureAncient/AncientBed.cs index 42967e0d8f..54d15fdaf7 100644 --- a/Items/Placeables/FurnitureAncient/AncientBed.cs +++ b/Items/Placeables/FurnitureAncient/AncientBed.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientBookcase.cs b/Items/Placeables/FurnitureAncient/AncientBookcase.cs index 2fc8ad178e..2f42f9505d 100644 --- a/Items/Placeables/FurnitureAncient/AncientBookcase.cs +++ b/Items/Placeables/FurnitureAncient/AncientBookcase.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientChair.cs b/Items/Placeables/FurnitureAncient/AncientChair.cs index cf3d72c0e1..5c4f1561a2 100644 --- a/Items/Placeables/FurnitureAncient/AncientChair.cs +++ b/Items/Placeables/FurnitureAncient/AncientChair.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientChandelier.cs b/Items/Placeables/FurnitureAncient/AncientChandelier.cs index 0f56a1f842..cef8672738 100644 --- a/Items/Placeables/FurnitureAncient/AncientChandelier.cs +++ b/Items/Placeables/FurnitureAncient/AncientChandelier.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientDoor.cs b/Items/Placeables/FurnitureAncient/AncientDoor.cs index e1bbb37ef1..f41150d117 100644 --- a/Items/Placeables/FurnitureAncient/AncientDoor.cs +++ b/Items/Placeables/FurnitureAncient/AncientDoor.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientDresser.cs b/Items/Placeables/FurnitureAncient/AncientDresser.cs index 8df2d0b04c..7935044322 100644 --- a/Items/Placeables/FurnitureAncient/AncientDresser.cs +++ b/Items/Placeables/FurnitureAncient/AncientDresser.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientLamp.cs b/Items/Placeables/FurnitureAncient/AncientLamp.cs index 87929e9ba2..351fa45913 100644 --- a/Items/Placeables/FurnitureAncient/AncientLamp.cs +++ b/Items/Placeables/FurnitureAncient/AncientLamp.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientLantern.cs b/Items/Placeables/FurnitureAncient/AncientLantern.cs index 4cd402728e..30dcce36a2 100644 --- a/Items/Placeables/FurnitureAncient/AncientLantern.cs +++ b/Items/Placeables/FurnitureAncient/AncientLantern.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientMonolith.cs b/Items/Placeables/FurnitureAncient/AncientMonolith.cs index c6c2caf2f5..76c7f40f9f 100644 --- a/Items/Placeables/FurnitureAncient/AncientMonolith.cs +++ b/Items/Placeables/FurnitureAncient/AncientMonolith.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientPiano.cs b/Items/Placeables/FurnitureAncient/AncientPiano.cs index 3d02430e78..7370a99f82 100644 --- a/Items/Placeables/FurnitureAncient/AncientPiano.cs +++ b/Items/Placeables/FurnitureAncient/AncientPiano.cs @@ -37,4 +37,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientSink.cs b/Items/Placeables/FurnitureAncient/AncientSink.cs index 114ddadf78..9c7e72e769 100644 --- a/Items/Placeables/FurnitureAncient/AncientSink.cs +++ b/Items/Placeables/FurnitureAncient/AncientSink.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientSofa.cs b/Items/Placeables/FurnitureAncient/AncientSofa.cs index 33f5483b1c..487466a0b2 100644 --- a/Items/Placeables/FurnitureAncient/AncientSofa.cs +++ b/Items/Placeables/FurnitureAncient/AncientSofa.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientTable.cs b/Items/Placeables/FurnitureAncient/AncientTable.cs index 0db9f33615..860616c8fa 100644 --- a/Items/Placeables/FurnitureAncient/AncientTable.cs +++ b/Items/Placeables/FurnitureAncient/AncientTable.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAncient/AncientWorkbench.cs b/Items/Placeables/FurnitureAncient/AncientWorkbench.cs index 9c32a656b7..9b93dde510 100644 --- a/Items/Placeables/FurnitureAncient/AncientWorkbench.cs +++ b/Items/Placeables/FurnitureAncient/AncientWorkbench.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenAltar.cs b/Items/Placeables/FurnitureAshen/AshenAltar.cs index 757a6088a1..78205994d1 100644 --- a/Items/Placeables/FurnitureAshen/AshenAltar.cs +++ b/Items/Placeables/FurnitureAshen/AshenAltar.cs @@ -39,4 +39,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenBasin.cs b/Items/Placeables/FurnitureAshen/AshenBasin.cs index 912b7d40c3..54d89c7d25 100644 --- a/Items/Placeables/FurnitureAshen/AshenBasin.cs +++ b/Items/Placeables/FurnitureAshen/AshenBasin.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenBath.cs b/Items/Placeables/FurnitureAshen/AshenBath.cs index cc8d592588..33042b684d 100644 --- a/Items/Placeables/FurnitureAshen/AshenBath.cs +++ b/Items/Placeables/FurnitureAshen/AshenBath.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenBed.cs b/Items/Placeables/FurnitureAshen/AshenBed.cs index 5c789216ea..b9233ade76 100644 --- a/Items/Placeables/FurnitureAshen/AshenBed.cs +++ b/Items/Placeables/FurnitureAshen/AshenBed.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenBookcase.cs b/Items/Placeables/FurnitureAshen/AshenBookcase.cs index 8536cf4273..5ba0dff076 100644 --- a/Items/Placeables/FurnitureAshen/AshenBookcase.cs +++ b/Items/Placeables/FurnitureAshen/AshenBookcase.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs index 4d1b5432cb..fef9541279 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenCandle.cs b/Items/Placeables/FurnitureAshen/AshenCandle.cs index 3090d1ca8b..5fcfe0b012 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandle.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandle.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenChair.cs b/Items/Placeables/FurnitureAshen/AshenChair.cs index 710116924b..79794b4809 100644 --- a/Items/Placeables/FurnitureAshen/AshenChair.cs +++ b/Items/Placeables/FurnitureAshen/AshenChair.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenChandelier.cs b/Items/Placeables/FurnitureAshen/AshenChandelier.cs index 30d7bb8151..ad9a9789a6 100644 --- a/Items/Placeables/FurnitureAshen/AshenChandelier.cs +++ b/Items/Placeables/FurnitureAshen/AshenChandelier.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenChest.cs b/Items/Placeables/FurnitureAshen/AshenChest.cs index c72d2359f0..e140ac90db 100644 --- a/Items/Placeables/FurnitureAshen/AshenChest.cs +++ b/Items/Placeables/FurnitureAshen/AshenChest.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenDoor.cs b/Items/Placeables/FurnitureAshen/AshenDoor.cs index 037f861b86..104187195a 100644 --- a/Items/Placeables/FurnitureAshen/AshenDoor.cs +++ b/Items/Placeables/FurnitureAshen/AshenDoor.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenDresser.cs b/Items/Placeables/FurnitureAshen/AshenDresser.cs index fe045e9977..087cb035ee 100644 --- a/Items/Placeables/FurnitureAshen/AshenDresser.cs +++ b/Items/Placeables/FurnitureAshen/AshenDresser.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenLamp.cs b/Items/Placeables/FurnitureAshen/AshenLamp.cs index a914615c8b..c7b37d4665 100644 --- a/Items/Placeables/FurnitureAshen/AshenLamp.cs +++ b/Items/Placeables/FurnitureAshen/AshenLamp.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenLantern.cs b/Items/Placeables/FurnitureAshen/AshenLantern.cs index 4196fefb96..8f1bcff1bb 100644 --- a/Items/Placeables/FurnitureAshen/AshenLantern.cs +++ b/Items/Placeables/FurnitureAshen/AshenLantern.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenMonolith.cs b/Items/Placeables/FurnitureAshen/AshenMonolith.cs index 41044b8116..39ea4be9d0 100644 --- a/Items/Placeables/FurnitureAshen/AshenMonolith.cs +++ b/Items/Placeables/FurnitureAshen/AshenMonolith.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenPiano.cs b/Items/Placeables/FurnitureAshen/AshenPiano.cs index d71adec666..5200204e3d 100644 --- a/Items/Placeables/FurnitureAshen/AshenPiano.cs +++ b/Items/Placeables/FurnitureAshen/AshenPiano.cs @@ -37,4 +37,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenPlatform.cs b/Items/Placeables/FurnitureAshen/AshenPlatform.cs index 9b07f10aad..f0e12233c5 100644 --- a/Items/Placeables/FurnitureAshen/AshenPlatform.cs +++ b/Items/Placeables/FurnitureAshen/AshenPlatform.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenSink.cs b/Items/Placeables/FurnitureAshen/AshenSink.cs index e7e92d7bef..7ada569af1 100644 --- a/Items/Placeables/FurnitureAshen/AshenSink.cs +++ b/Items/Placeables/FurnitureAshen/AshenSink.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenSlabWall.cs b/Items/Placeables/FurnitureAshen/AshenSlabWall.cs index f26a5863ad..24c503679f 100644 --- a/Items/Placeables/FurnitureAshen/AshenSlabWall.cs +++ b/Items/Placeables/FurnitureAshen/AshenSlabWall.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenSofa.cs b/Items/Placeables/FurnitureAshen/AshenSofa.cs index 06abbc677a..7c3d5e25ba 100644 --- a/Items/Placeables/FurnitureAshen/AshenSofa.cs +++ b/Items/Placeables/FurnitureAshen/AshenSofa.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenTable.cs b/Items/Placeables/FurnitureAshen/AshenTable.cs index a4cfd5b76e..168f27f784 100644 --- a/Items/Placeables/FurnitureAshen/AshenTable.cs +++ b/Items/Placeables/FurnitureAshen/AshenTable.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/AshenWorkbench.cs b/Items/Placeables/FurnitureAshen/AshenWorkbench.cs index 0f8e486445..dcfbe4754a 100644 --- a/Items/Placeables/FurnitureAshen/AshenWorkbench.cs +++ b/Items/Placeables/FurnitureAshen/AshenWorkbench.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/LockedAshenChest.cs b/Items/Placeables/FurnitureAshen/LockedAshenChest.cs index 67aca2f8fb..a2d472c245 100644 --- a/Items/Placeables/FurnitureAshen/LockedAshenChest.cs +++ b/Items/Placeables/FurnitureAshen/LockedAshenChest.cs @@ -44,4 +44,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlagWall.cs b/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlagWall.cs index 33a21fd292..5c9dae1e3c 100644 --- a/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlagWall.cs +++ b/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlagWall.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs index d0051ddaff..47724606e5 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicBed.cs b/Items/Placeables/FurnitureBotanic/BotanicBed.cs index ec92b4a894..0e8f969f65 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBed.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBed.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicBench.cs b/Items/Placeables/FurnitureBotanic/BotanicBench.cs index eebb1caae7..3589362896 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBench.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs index 39d427f4db..48249d6130 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs index 6e35be5451..6da3949eac 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs index 62d45b3d42..86a1c14851 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicChair.cs b/Items/Placeables/FurnitureBotanic/BotanicChair.cs index 8e799210e0..8702c2836d 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChair.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChair.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs index 869fe9623f..71d8c417bb 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicChest.cs b/Items/Placeables/FurnitureBotanic/BotanicChest.cs index abf318173f..22a9a71a56 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChest.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChest.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicClock.cs b/Items/Placeables/FurnitureBotanic/BotanicClock.cs index 4f885131ee..188d45159e 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicClock.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicClock.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs index 9c3a9dd65f..5eace0469b 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs index 8e22b2921e..9a9d558422 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs index 1d12c4c77a..c65374ae87 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs index 9686b15b7f..7fc464fab1 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs index f0591c9452..600734cc07 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicPlanter.cs b/Items/Placeables/FurnitureBotanic/BotanicPlanter.cs index 7ae3f63e60..0c808f7b5f 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPlanter.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPlanter.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs b/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs index 1e34f56a3e..c69d0eae97 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPlatform.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicSink.cs b/Items/Placeables/FurnitureBotanic/BotanicSink.cs index c44fc98304..0bcd73b147 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicSink.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicSink.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicTable.cs b/Items/Placeables/FurnitureBotanic/BotanicTable.cs index 880e43fc94..e59f08fde2 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicTable.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicTable.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs index 205e9bdc27..d6474070cd 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs index a12cc1421e..f5b9745672 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBath.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs index 57a9670e2d..23440906aa 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBed.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs index b2e5bf80e9..35f8b1741a 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBookcase.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBrickWall.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBrickWall.cs index 529ec13c4d..fed0eb39bb 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBrickWall.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBrickWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs index cbfda93828..ce6c9df010 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs index c225cc6b19..7f8bb2a2e8 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs index 54713f1665..cc7d71f543 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChair.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs index a65fa72688..d705beb5c5 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChandelier.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs index 5c48d0c491..fff9d6335f 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteChest.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs index b6f6c6565a..cad57bd108 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteClock.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs index 7ff45fa66c..ffcc0d77bc 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDoor.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs index 690807451f..3eda1a5f15 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteDresser.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs index 58d006f6a2..7713871ae0 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLamp.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs index d1e4dc6941..1a40cc6e70 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs index f388c694cd..21c6f16c78 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePiano.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs index 2528256ea3..02a94fb48b 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmilitePlatform.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs index b5b888c590..edf92dfe9f 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSconce.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs index 8694df4b85..de862b5673 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSink.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs index 3d99f456e1..685f1acd30 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteSofa.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs index 3e12b8e29d..a64cde15ed 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteTable.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs index 8e4f469379..c8cec143d5 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteWorkbench.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs index f05aeca3f0..0f0c78be67 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs index 86e88a9ec5..bb1820a618 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs index 66ca5db335..1daf8b385d 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs b/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs index 31e1070eed..d4467af200 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs index d61d5375a3..461b9ad8af 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs index eaff007fd6..a77ce691c8 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs index 391c0593de..eca2438df0 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs index 7e99757eaf..cc2bc0c9f4 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs b/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs index 9d7b092aef..f198fded3d 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs b/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs index 0adbfb08bd..d0bb38a33d 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCrafting.cs b/Items/Placeables/FurnitureEutrophic/EutrophicCrafting.cs index 1669515365..2cd3812492 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCrafting.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicCrafting.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs b/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs index dc280b25bf..95fc987ded 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs b/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs index f4b3f7bded..5df822caba 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs b/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs index 0d5da158bd..5fab394aa2 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs b/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs index 3ff9db18b6..449abbad63 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs index 031b0a3b8e..370df05b75 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs index b92bb1697a..ff61c062c9 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs b/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs index dcd426cc8d..b20001aca4 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs b/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs index 765db08921..7a0e18fc31 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs b/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs index 1cde0124c2..527e09c983 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureEutrophic/SmoothNavystoneWall.cs b/Items/Placeables/FurnitureEutrophic/SmoothNavystoneWall.cs index ac7771e9df..c7e3c226a0 100644 --- a/Items/Placeables/FurnitureEutrophic/SmoothNavystoneWall.cs +++ b/Items/Placeables/FurnitureEutrophic/SmoothNavystoneWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultBathtub.cs b/Items/Placeables/FurnitureOccult/OccultBathtub.cs index ab5658cdf4..cb63a263ae 100644 --- a/Items/Placeables/FurnitureOccult/OccultBathtub.cs +++ b/Items/Placeables/FurnitureOccult/OccultBathtub.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultBed.cs b/Items/Placeables/FurnitureOccult/OccultBed.cs index 2d4b8accb7..d00756bb64 100644 --- a/Items/Placeables/FurnitureOccult/OccultBed.cs +++ b/Items/Placeables/FurnitureOccult/OccultBed.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultBookcase.cs b/Items/Placeables/FurnitureOccult/OccultBookcase.cs index 8f8d24c923..3a665034b7 100644 --- a/Items/Placeables/FurnitureOccult/OccultBookcase.cs +++ b/Items/Placeables/FurnitureOccult/OccultBookcase.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultCandelabra.cs b/Items/Placeables/FurnitureOccult/OccultCandelabra.cs index 3468013110..796e349152 100644 --- a/Items/Placeables/FurnitureOccult/OccultCandelabra.cs +++ b/Items/Placeables/FurnitureOccult/OccultCandelabra.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultCandle.cs b/Items/Placeables/FurnitureOccult/OccultCandle.cs index f3a1d1b273..5fe3edc5d9 100644 --- a/Items/Placeables/FurnitureOccult/OccultCandle.cs +++ b/Items/Placeables/FurnitureOccult/OccultCandle.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultChair.cs b/Items/Placeables/FurnitureOccult/OccultChair.cs index 04ed8ec6d6..43e1ef86e9 100644 --- a/Items/Placeables/FurnitureOccult/OccultChair.cs +++ b/Items/Placeables/FurnitureOccult/OccultChair.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultChandelier.cs b/Items/Placeables/FurnitureOccult/OccultChandelier.cs index 25076f0761..90b9a20c7c 100644 --- a/Items/Placeables/FurnitureOccult/OccultChandelier.cs +++ b/Items/Placeables/FurnitureOccult/OccultChandelier.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultChest.cs b/Items/Placeables/FurnitureOccult/OccultChest.cs index 1660f986f2..980db2baa8 100644 --- a/Items/Placeables/FurnitureOccult/OccultChest.cs +++ b/Items/Placeables/FurnitureOccult/OccultChest.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultClock.cs b/Items/Placeables/FurnitureOccult/OccultClock.cs index 6d3bfbd0b5..6f49b9c9c2 100644 --- a/Items/Placeables/FurnitureOccult/OccultClock.cs +++ b/Items/Placeables/FurnitureOccult/OccultClock.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultDoor.cs b/Items/Placeables/FurnitureOccult/OccultDoor.cs index 0764f10cd8..48083ad36e 100644 --- a/Items/Placeables/FurnitureOccult/OccultDoor.cs +++ b/Items/Placeables/FurnitureOccult/OccultDoor.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultDresser.cs b/Items/Placeables/FurnitureOccult/OccultDresser.cs index e84d1cdc8b..8db17f208a 100644 --- a/Items/Placeables/FurnitureOccult/OccultDresser.cs +++ b/Items/Placeables/FurnitureOccult/OccultDresser.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultLamp.cs b/Items/Placeables/FurnitureOccult/OccultLamp.cs index 5bc0b086bd..8c1e1e2ae5 100644 --- a/Items/Placeables/FurnitureOccult/OccultLamp.cs +++ b/Items/Placeables/FurnitureOccult/OccultLamp.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultLantern.cs b/Items/Placeables/FurnitureOccult/OccultLantern.cs index 37e0fb4a9a..45655acfd5 100644 --- a/Items/Placeables/FurnitureOccult/OccultLantern.cs +++ b/Items/Placeables/FurnitureOccult/OccultLantern.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultPiano.cs b/Items/Placeables/FurnitureOccult/OccultPiano.cs index dbe720b587..7497d82d35 100644 --- a/Items/Placeables/FurnitureOccult/OccultPiano.cs +++ b/Items/Placeables/FurnitureOccult/OccultPiano.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultPlatform.cs b/Items/Placeables/FurnitureOccult/OccultPlatform.cs index d31e06c01d..18add28b5a 100644 --- a/Items/Placeables/FurnitureOccult/OccultPlatform.cs +++ b/Items/Placeables/FurnitureOccult/OccultPlatform.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultSink.cs b/Items/Placeables/FurnitureOccult/OccultSink.cs index 8999afaf2a..75a4cd01bc 100644 --- a/Items/Placeables/FurnitureOccult/OccultSink.cs +++ b/Items/Placeables/FurnitureOccult/OccultSink.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultSofa.cs b/Items/Placeables/FurnitureOccult/OccultSofa.cs index 9e27742e98..df19f38a50 100644 --- a/Items/Placeables/FurnitureOccult/OccultSofa.cs +++ b/Items/Placeables/FurnitureOccult/OccultSofa.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultStoneWall.cs b/Items/Placeables/FurnitureOccult/OccultStoneWall.cs index 1998307eed..bcbd498082 100644 --- a/Items/Placeables/FurnitureOccult/OccultStoneWall.cs +++ b/Items/Placeables/FurnitureOccult/OccultStoneWall.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultTable.cs b/Items/Placeables/FurnitureOccult/OccultTable.cs index 9f03590fd0..6cdbbe1c7f 100644 --- a/Items/Placeables/FurnitureOccult/OccultTable.cs +++ b/Items/Placeables/FurnitureOccult/OccultTable.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureOccult/OccultWorkBench.cs b/Items/Placeables/FurnitureOccult/OccultWorkBench.cs index 852bbe7776..f680329514 100644 --- a/Items/Placeables/FurnitureOccult/OccultWorkBench.cs +++ b/Items/Placeables/FurnitureOccult/OccultWorkBench.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureOccult recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlagueInfuser.cs b/Items/Placeables/FurniturePlaguedPlate/PlagueInfuser.cs index e9211d0fe3..a3c285c05b 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlagueInfuser.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlagueInfuser.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs index 0f6bfe782e..c60b6548d9 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs index 1f554746d7..93c48cb085 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs index 135e9bc9e0..027796558f 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs index c9befb649e..4986343c2d 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs index 81b57a4eb3..fb85350925 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs index 41e3d6a448..b4d2893051 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs index cf27ecb472..862383b629 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index 995efce0bc..5340bd9ff2 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs index 0b057fe453..2d0c8f70bf 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs index e386c6ce71..507a89e4cf 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -37,4 +37,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs index e3674b45bb..d952b1fa76 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs index bb2054de48..66de6bb3a6 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs index 6944f6e9e7..ecc61e264e 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs index eabe8cb129..d6d2779ee6 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs index 9ba0c2997c..206b204dca 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs index cef79e979f..26b176b893 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs index 26e6e72643..d060a0f323 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs index f67157645a..a4070a6449 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs index 8fc8193158..9eb22c4670 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWall.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWall.cs index 462829b50d..ed42d08300 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWall.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs index fa9fcf5b94..0ca29b3473 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBasin.cs b/Items/Placeables/FurnitureProfaned/ProfanedBasin.cs index 9b9661b7d8..ff1d332393 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBasin.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBasin.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBath.cs b/Items/Placeables/FurnitureProfaned/ProfanedBath.cs index 568db076e2..5d9d5b5c56 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBath.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBath.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBed.cs b/Items/Placeables/FurnitureProfaned/ProfanedBed.cs index 2f67bed151..acbc1a1043 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBed.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBed.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBench.cs b/Items/Placeables/FurnitureProfaned/ProfanedBench.cs index 4c1b07f7d6..cfb93b2213 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBench.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBench.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs index 086f10e145..bb14c8e055 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedBookcase.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs index 0ebf8fa446..b1172b7da2 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCandelabra.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs b/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs index 91e39b1aeb..abf374f309 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCandle.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChair.cs b/Items/Placeables/FurnitureProfaned/ProfanedChair.cs index 6b9ae3c85c..a56165abed 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChair.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChair.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs index 1a2a53f0a5..c13da5796f 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChandelier.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedChest.cs b/Items/Placeables/FurnitureProfaned/ProfanedChest.cs index 61b360ee40..46d4366767 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedChest.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedChest.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedClock.cs b/Items/Placeables/FurnitureProfaned/ProfanedClock.cs index 8d1e55d22c..9b15910381 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedClock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedClock.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCrystalWall.cs b/Items/Placeables/FurnitureProfaned/ProfanedCrystalWall.cs index 62a6d12d55..8a7df13e8f 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCrystalWall.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCrystalWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs b/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs index 68e2465c59..1d46638539 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedDoor.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs b/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs index c9ca5cebd5..86d7ec4617 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedDresser.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs b/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs index 30b692c51b..79c450e343 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedLamp.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs b/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs index e779d02b15..1de6fe5878 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedLantern.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs b/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs index d2cb2f1336..2756dbeba2 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedPiano.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs b/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs index 301af5f956..799f6ffe8e 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedPlatform.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedRockWall.cs b/Items/Placeables/FurnitureProfaned/ProfanedRockWall.cs index b8ca9fcdd5..af9b49f782 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedRockWall.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedRockWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSink.cs b/Items/Placeables/FurnitureProfaned/ProfanedSink.cs index 80f4b2385d..211862f13f 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedSink.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedSink.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSlabWall.cs b/Items/Placeables/FurnitureProfaned/ProfanedSlabWall.cs index 81c268ed64..8782e3796c 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedSlabWall.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedSlabWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedTable.cs b/Items/Placeables/FurnitureProfaned/ProfanedTable.cs index 7e55991040..0a61ea2dc0 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedTable.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedTable.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs b/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs index b28dd68ae9..1f5d020665 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedWorkbench.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureProfaned/RunicProfanedBrickWall.cs b/Items/Placeables/FurnitureProfaned/RunicProfanedBrickWall.cs index df6095f65b..f7bae60dd0 100644 --- a/Items/Placeables/FurnitureProfaned/RunicProfanedBrickWall.cs +++ b/Items/Placeables/FurnitureProfaned/RunicProfanedBrickWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaBasin.cs b/Items/Placeables/FurnitureSilva/SilvaBasin.cs index 54d058773e..3622d30fb5 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBasin.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBasin.cs @@ -41,4 +41,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs index b6a736b2fa..7649922506 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaBed.cs b/Items/Placeables/FurnitureSilva/SilvaBed.cs index 430f91329a..548d7df4dd 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBed.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBed.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaBench.cs b/Items/Placeables/FurnitureSilva/SilvaBench.cs index fa48176db6..0f2141c5e1 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBench.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs index 1c998366c3..1599d2272a 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs index 83325566f5..4a9a199b85 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaCandle.cs b/Items/Placeables/FurnitureSilva/SilvaCandle.cs index 59585b5f7a..44b794bd13 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandle.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandle.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaChair.cs b/Items/Placeables/FurnitureSilva/SilvaChair.cs index 37d8ea9b20..e8f0369662 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChair.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChair.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs index 5fc47435d5..7ab9f14c39 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs @@ -41,4 +41,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaChest.cs b/Items/Placeables/FurnitureSilva/SilvaChest.cs index e6cd851faf..21c2bd496b 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChest.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChest.cs @@ -41,4 +41,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaClock.cs b/Items/Placeables/FurnitureSilva/SilvaClock.cs index 894f63c2d2..2cf93d8f11 100644 --- a/Items/Placeables/FurnitureSilva/SilvaClock.cs +++ b/Items/Placeables/FurnitureSilva/SilvaClock.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaDoor.cs b/Items/Placeables/FurnitureSilva/SilvaDoor.cs index 98c48a1652..4cc08d8f5e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDoor.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDoor.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaDresser.cs b/Items/Placeables/FurnitureSilva/SilvaDresser.cs index e583a8b5f3..03b59dfc1c 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDresser.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDresser.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaLamp.cs b/Items/Placeables/FurnitureSilva/SilvaLamp.cs index 46de79af5e..5bb501f087 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLamp.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLamp.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaLantern.cs b/Items/Placeables/FurnitureSilva/SilvaLantern.cs index 0bf46375d2..9da333d9bf 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLantern.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLantern.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaPiano.cs b/Items/Placeables/FurnitureSilva/SilvaPiano.cs index 8f2b24fb10..59c00f0ced 100644 --- a/Items/Placeables/FurnitureSilva/SilvaPiano.cs +++ b/Items/Placeables/FurnitureSilva/SilvaPiano.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaPlatform.cs b/Items/Placeables/FurnitureSilva/SilvaPlatform.cs index 28d7d3cfd3..e5cc4dba3b 100644 --- a/Items/Placeables/FurnitureSilva/SilvaPlatform.cs +++ b/Items/Placeables/FurnitureSilva/SilvaPlatform.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaSink.cs b/Items/Placeables/FurnitureSilva/SilvaSink.cs index 4cb7fedf1f..78f20953a2 100644 --- a/Items/Placeables/FurnitureSilva/SilvaSink.cs +++ b/Items/Placeables/FurnitureSilva/SilvaSink.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaTable.cs b/Items/Placeables/FurnitureSilva/SilvaTable.cs index 046c1d7639..88f79bdef3 100644 --- a/Items/Placeables/FurnitureSilva/SilvaTable.cs +++ b/Items/Placeables/FurnitureSilva/SilvaTable.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaWall.cs b/Items/Placeables/FurnitureSilva/SilvaWall.cs index 4a6b0d357a..c632a8e438 100644 --- a/Items/Placeables/FurnitureSilva/SilvaWall.cs +++ b/Items/Placeables/FurnitureSilva/SilvaWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs index d9220529ae..ee381c3509 100644 --- a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StaticRefiner.cs b/Items/Placeables/FurnitureStatigel/StaticRefiner.cs index 7fbe2ad281..bee5988fb0 100644 --- a/Items/Placeables/FurnitureStatigel/StaticRefiner.cs +++ b/Items/Placeables/FurnitureStatigel/StaticRefiner.cs @@ -25,4 +25,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel item.createTile = mod.TileType("StaticRefiner"); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelBath.cs b/Items/Placeables/FurnitureStatigel/StatigelBath.cs index f30d0280d4..914f05666d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBath.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBath.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelBed.cs b/Items/Placeables/FurnitureStatigel/StatigelBed.cs index 9b4fc8203d..1ac6014f8f 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBed.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBed.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs index 84736b7d31..02c50a6731 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs index 8b36267177..2bb9c3bf8f 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs index 79ed428193..3614c89196 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelChair.cs b/Items/Placeables/FurnitureStatigel/StatigelChair.cs index 7821a44838..8124bdedc2 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChair.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChair.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs index c0463f100f..bf74ea1809 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelChest.cs b/Items/Placeables/FurnitureStatigel/StatigelChest.cs index 500c97a26a..df0e4467e8 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChest.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChest.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelClock.cs b/Items/Placeables/FurnitureStatigel/StatigelClock.cs index ad7298a081..726eb83657 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelClock.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelClock.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs index 2717aa17de..d08196713d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs index 608ee6fc8e..ddf098ace2 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs index 1bc7c0c66f..43eb98ec77 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs index 47e9ae5ece..d5c9cbe58d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs index 3b1b61f2fa..5a200c0e45 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs b/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs index ac8bee71e7..371605b98f 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelPlatform.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelSink.cs b/Items/Placeables/FurnitureStatigel/StatigelSink.cs index e91b79f235..c52a8a53e2 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSink.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSink.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs index e6f7dc182b..1faf25b9ad 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelTable.cs b/Items/Placeables/FurnitureStatigel/StatigelTable.cs index 2dcedd5ab8..f7d0e7833f 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelTable.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelTable.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelWall.cs b/Items/Placeables/FurnitureStatigel/StatigelWall.cs index 11e93ce7da..0266f28ca8 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelWall.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs b/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs index 7f77dea1f3..625f83a4f3 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelWorkbench.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusBathtub.cs b/Items/Placeables/FurnitureStratus/StratusBathtub.cs index aee87cdc57..f26dd44bc2 100644 --- a/Items/Placeables/FurnitureStratus/StratusBathtub.cs +++ b/Items/Placeables/FurnitureStratus/StratusBathtub.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusBed.cs b/Items/Placeables/FurnitureStratus/StratusBed.cs index e57af7e72d..7a45442246 100644 --- a/Items/Placeables/FurnitureStratus/StratusBed.cs +++ b/Items/Placeables/FurnitureStratus/StratusBed.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusBookcase.cs b/Items/Placeables/FurnitureStratus/StratusBookcase.cs index a792a586ad..96ac5f0792 100644 --- a/Items/Placeables/FurnitureStratus/StratusBookcase.cs +++ b/Items/Placeables/FurnitureStratus/StratusBookcase.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs index 99e6411c0e..eff76e7bb7 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusCandle.cs b/Items/Placeables/FurnitureStratus/StratusCandle.cs index 3b2e99fa17..73c28e768a 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandle.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandle.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusChair.cs b/Items/Placeables/FurnitureStratus/StratusChair.cs index f52a1261d5..95406f8599 100644 --- a/Items/Placeables/FurnitureStratus/StratusChair.cs +++ b/Items/Placeables/FurnitureStratus/StratusChair.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusChandelier.cs b/Items/Placeables/FurnitureStratus/StratusChandelier.cs index 3e783fca36..0cb13face3 100644 --- a/Items/Placeables/FurnitureStratus/StratusChandelier.cs +++ b/Items/Placeables/FurnitureStratus/StratusChandelier.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusChest.cs b/Items/Placeables/FurnitureStratus/StratusChest.cs index 9799c79920..64a2f7f9ad 100644 --- a/Items/Placeables/FurnitureStratus/StratusChest.cs +++ b/Items/Placeables/FurnitureStratus/StratusChest.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusClock.cs b/Items/Placeables/FurnitureStratus/StratusClock.cs index 2e19d39a1c..1ae8422d61 100644 --- a/Items/Placeables/FurnitureStratus/StratusClock.cs +++ b/Items/Placeables/FurnitureStratus/StratusClock.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusDoor.cs b/Items/Placeables/FurnitureStratus/StratusDoor.cs index 9ea5dee58a..a3bfe8032d 100644 --- a/Items/Placeables/FurnitureStratus/StratusDoor.cs +++ b/Items/Placeables/FurnitureStratus/StratusDoor.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusDresser.cs b/Items/Placeables/FurnitureStratus/StratusDresser.cs index f5732aa8b4..5bcbccb285 100644 --- a/Items/Placeables/FurnitureStratus/StratusDresser.cs +++ b/Items/Placeables/FurnitureStratus/StratusDresser.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusLamp.cs b/Items/Placeables/FurnitureStratus/StratusLamp.cs index 9c4a9fb54b..f08e421d8b 100644 --- a/Items/Placeables/FurnitureStratus/StratusLamp.cs +++ b/Items/Placeables/FurnitureStratus/StratusLamp.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusLantern.cs b/Items/Placeables/FurnitureStratus/StratusLantern.cs index c69a9bb46b..1c55a3051f 100644 --- a/Items/Placeables/FurnitureStratus/StratusLantern.cs +++ b/Items/Placeables/FurnitureStratus/StratusLantern.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusPiano.cs b/Items/Placeables/FurnitureStratus/StratusPiano.cs index 0f90607043..4e1884c404 100644 --- a/Items/Placeables/FurnitureStratus/StratusPiano.cs +++ b/Items/Placeables/FurnitureStratus/StratusPiano.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusPlatform.cs b/Items/Placeables/FurnitureStratus/StratusPlatform.cs index cbb06ba8c2..f129278552 100644 --- a/Items/Placeables/FurnitureStratus/StratusPlatform.cs +++ b/Items/Placeables/FurnitureStratus/StratusPlatform.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusSink.cs b/Items/Placeables/FurnitureStratus/StratusSink.cs index 247a4268c5..8d165c9b05 100644 --- a/Items/Placeables/FurnitureStratus/StratusSink.cs +++ b/Items/Placeables/FurnitureStratus/StratusSink.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusSofa.cs b/Items/Placeables/FurnitureStratus/StratusSofa.cs index af2632651c..c28cb29b8d 100644 --- a/Items/Placeables/FurnitureStratus/StratusSofa.cs +++ b/Items/Placeables/FurnitureStratus/StratusSofa.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusTable.cs b/Items/Placeables/FurnitureStratus/StratusTable.cs index 4c1e83167f..2cfa846853 100644 --- a/Items/Placeables/FurnitureStratus/StratusTable.cs +++ b/Items/Placeables/FurnitureStratus/StratusTable.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusWall.cs b/Items/Placeables/FurnitureStratus/StratusWall.cs index 42bf352929..3279d54caf 100644 --- a/Items/Placeables/FurnitureStratus/StratusWall.cs +++ b/Items/Placeables/FurnitureStratus/StratusWall.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureStratus/StratusWorkbench.cs b/Items/Placeables/FurnitureStratus/StratusWorkbench.cs index 57f6a53acf..90bdb8a939 100644 --- a/Items/Placeables/FurnitureStratus/StratusWorkbench.cs +++ b/Items/Placeables/FurnitureStratus/StratusWorkbench.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs index 70872b4146..b666973c0e 100644 --- a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs +++ b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.cs b/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.cs index e3b35389e3..d1cdcc179a 100644 --- a/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.cs +++ b/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidBath.cs b/Items/Placeables/FurnitureVoid/VoidBath.cs index 8f8aa0001c..9714365afd 100644 --- a/Items/Placeables/FurnitureVoid/VoidBath.cs +++ b/Items/Placeables/FurnitureVoid/VoidBath.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidBed.cs b/Items/Placeables/FurnitureVoid/VoidBed.cs index f7007eb8c8..2f48ab4911 100644 --- a/Items/Placeables/FurnitureVoid/VoidBed.cs +++ b/Items/Placeables/FurnitureVoid/VoidBed.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidBookcase.cs b/Items/Placeables/FurnitureVoid/VoidBookcase.cs index d3e7d75215..8f17b1ab33 100644 --- a/Items/Placeables/FurnitureVoid/VoidBookcase.cs +++ b/Items/Placeables/FurnitureVoid/VoidBookcase.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidCandelabra.cs b/Items/Placeables/FurnitureVoid/VoidCandelabra.cs index 7dad89159c..b06a2e1b7a 100644 --- a/Items/Placeables/FurnitureVoid/VoidCandelabra.cs +++ b/Items/Placeables/FurnitureVoid/VoidCandelabra.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidCandle.cs b/Items/Placeables/FurnitureVoid/VoidCandle.cs index aa82c8c7e2..6339434f4c 100644 --- a/Items/Placeables/FurnitureVoid/VoidCandle.cs +++ b/Items/Placeables/FurnitureVoid/VoidCandle.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidChair.cs b/Items/Placeables/FurnitureVoid/VoidChair.cs index 83b1a1515a..3ceffb6eba 100644 --- a/Items/Placeables/FurnitureVoid/VoidChair.cs +++ b/Items/Placeables/FurnitureVoid/VoidChair.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidChandelier.cs b/Items/Placeables/FurnitureVoid/VoidChandelier.cs index 7f0d907d41..39e3767c0e 100644 --- a/Items/Placeables/FurnitureVoid/VoidChandelier.cs +++ b/Items/Placeables/FurnitureVoid/VoidChandelier.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidChest.cs b/Items/Placeables/FurnitureVoid/VoidChest.cs index 054d400f13..87b107f5d7 100644 --- a/Items/Placeables/FurnitureVoid/VoidChest.cs +++ b/Items/Placeables/FurnitureVoid/VoidChest.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidClock.cs b/Items/Placeables/FurnitureVoid/VoidClock.cs index 318475d8c4..7c3e15f1bc 100644 --- a/Items/Placeables/FurnitureVoid/VoidClock.cs +++ b/Items/Placeables/FurnitureVoid/VoidClock.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidCondenser.cs b/Items/Placeables/FurnitureVoid/VoidCondenser.cs index cf069bc812..b1b5cb575a 100644 --- a/Items/Placeables/FurnitureVoid/VoidCondenser.cs +++ b/Items/Placeables/FurnitureVoid/VoidCondenser.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidDoor.cs b/Items/Placeables/FurnitureVoid/VoidDoor.cs index ae03a58a9d..6f9bb02e65 100644 --- a/Items/Placeables/FurnitureVoid/VoidDoor.cs +++ b/Items/Placeables/FurnitureVoid/VoidDoor.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidDresser.cs b/Items/Placeables/FurnitureVoid/VoidDresser.cs index 33b129f7b3..7f78b9f2ed 100644 --- a/Items/Placeables/FurnitureVoid/VoidDresser.cs +++ b/Items/Placeables/FurnitureVoid/VoidDresser.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidLamp.cs b/Items/Placeables/FurnitureVoid/VoidLamp.cs index ab33ac4264..5ea23e60cf 100644 --- a/Items/Placeables/FurnitureVoid/VoidLamp.cs +++ b/Items/Placeables/FurnitureVoid/VoidLamp.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidLantern.cs b/Items/Placeables/FurnitureVoid/VoidLantern.cs index 948a3f8af6..2237a1e069 100644 --- a/Items/Placeables/FurnitureVoid/VoidLantern.cs +++ b/Items/Placeables/FurnitureVoid/VoidLantern.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidPiano.cs b/Items/Placeables/FurnitureVoid/VoidPiano.cs index 58d027cfa0..de09dbf2d8 100644 --- a/Items/Placeables/FurnitureVoid/VoidPiano.cs +++ b/Items/Placeables/FurnitureVoid/VoidPiano.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidSink.cs b/Items/Placeables/FurnitureVoid/VoidSink.cs index 16b4399862..dc534e9972 100644 --- a/Items/Placeables/FurnitureVoid/VoidSink.cs +++ b/Items/Placeables/FurnitureVoid/VoidSink.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidSofa.cs b/Items/Placeables/FurnitureVoid/VoidSofa.cs index 2240c51d62..22e828c7f2 100644 --- a/Items/Placeables/FurnitureVoid/VoidSofa.cs +++ b/Items/Placeables/FurnitureVoid/VoidSofa.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidTable.cs b/Items/Placeables/FurnitureVoid/VoidTable.cs index 24922a9fc5..1ed6570767 100644 --- a/Items/Placeables/FurnitureVoid/VoidTable.cs +++ b/Items/Placeables/FurnitureVoid/VoidTable.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidWorkbench.cs b/Items/Placeables/FurnitureVoid/VoidWorkbench.cs index 7e13e53064..c9acf5cc26 100644 --- a/Items/Placeables/FurnitureVoid/VoidWorkbench.cs +++ b/Items/Placeables/FurnitureVoid/VoidWorkbench.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/FurnitureVoid/VoidstoneSlabWall.cs b/Items/Placeables/FurnitureVoid/VoidstoneSlabWall.cs index c38717cdd5..0d97dbced3 100644 --- a/Items/Placeables/FurnitureVoid/VoidstoneSlabWall.cs +++ b/Items/Placeables/FurnitureVoid/VoidstoneSlabWall.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.Placeables.FurnitureVoid recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/GreenBrickWallUnsafe.cs b/Items/Placeables/GreenBrickWallUnsafe.cs index b3bcc73fa3..baf708ec42 100644 --- a/Items/Placeables/GreenBrickWallUnsafe.cs +++ b/Items/Placeables/GreenBrickWallUnsafe.cs @@ -1,22 +1,22 @@ -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables -{ - public class GreenBrickWallUnsafe : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = WallID.GreenDungeonUnsafe; - } - } -} \ No newline at end of file +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class GreenBrickWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.GreenDungeonUnsafe; + } + } +} diff --git a/Items/Placeables/GreenSlabWallUnsafe.cs b/Items/Placeables/GreenSlabWallUnsafe.cs index 5b41b65cc5..74659f9854 100644 --- a/Items/Placeables/GreenSlabWallUnsafe.cs +++ b/Items/Placeables/GreenSlabWallUnsafe.cs @@ -1,22 +1,22 @@ -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables -{ - public class GreenSlabWallUnsafe : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = WallID.GreenDungeonSlabUnsafe; - } - } -} \ No newline at end of file +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class GreenSlabWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.GreenDungeonSlabUnsafe; + } + } +} diff --git a/Items/Placeables/GreenTiledWallUnsafe.cs b/Items/Placeables/GreenTiledWallUnsafe.cs index abf919f75d..9c5de0a502 100644 --- a/Items/Placeables/GreenTiledWallUnsafe.cs +++ b/Items/Placeables/GreenTiledWallUnsafe.cs @@ -1,22 +1,22 @@ -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables -{ - public class GreenTiledWallUnsafe : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = WallID.GreenDungeonTileUnsafe; - } - } -} \ No newline at end of file +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class GreenTiledWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.GreenDungeonTileUnsafe; + } + } +} diff --git a/Items/Placeables/HiveMindTrophy.cs b/Items/Placeables/HiveMindTrophy.cs index 1fb42b7491..904b755421 100644 --- a/Items/Placeables/HiveMindTrophy.cs +++ b/Items/Placeables/HiveMindTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class HiveMindTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Mind Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 8; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class HiveMindTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Mind Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 8; + } + } +} diff --git a/Items/Placeables/LeviathanTrophy.cs b/Items/Placeables/LeviathanTrophy.cs index cb2ef99dee..b32afbfab4 100644 --- a/Items/Placeables/LeviathanTrophy.cs +++ b/Items/Placeables/LeviathanTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class LeviathanTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leviathan Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 5; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class LeviathanTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviathan Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 5; + } + } +} diff --git a/Items/Placeables/Navystone.cs b/Items/Placeables/Navystone.cs index 76e7ecfc06..0c94775a48 100644 --- a/Items/Placeables/Navystone.cs +++ b/Items/Placeables/Navystone.cs @@ -1,47 +1,47 @@ -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.Placeables -{ - public class Navystone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Navystone"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("Navystone"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "NavystoneWallSafe", 4); - 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 +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.Placeables +{ + public class Navystone : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Navystone"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("Navystone"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "NavystoneWallSafe", 4); + 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(); + } + } +} diff --git a/Items/Placeables/NavystoneWall.cs b/Items/Placeables/NavystoneWall.cs index 5e7cf1aaed..01bd170848 100644 --- a/Items/Placeables/NavystoneWall.cs +++ b/Items/Placeables/NavystoneWall.cs @@ -1,33 +1,33 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class NavystoneWall : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("NavystoneWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Navystone"); - recipe.AddTile(18); - recipe.SetResult(this, 4); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class NavystoneWall : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("NavystoneWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Navystone"); + recipe.AddTile(18); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/NavystoneWallSafe.cs b/Items/Placeables/NavystoneWallSafe.cs index 6e0654052e..47c35e927a 100644 --- a/Items/Placeables/NavystoneWallSafe.cs +++ b/Items/Placeables/NavystoneWallSafe.cs @@ -30,4 +30,4 @@ namespace CalamityMod.Items.Placeables recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Placeables/PerennialBrick.cs b/Items/Placeables/PerennialBrick.cs index ddb1ba6aee..047341749c 100644 --- a/Items/Placeables/PerennialBrick.cs +++ b/Items/Placeables/PerennialBrick.cs @@ -1,43 +1,43 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace CalamityMod.Items.Placeables -{ - public class PerennialBrick : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("PerennialBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("PerennialOre"), 1); - recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.Furnaces); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("PerennialBrickWall"), 4); - recipe.SetResult(this, 1); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - } - } -} +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace CalamityMod.Items.Placeables +{ + public class PerennialBrick : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("PerennialBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("PerennialOre"), 1); + recipe.AddIngredient(ItemID.StoneBlock, 1); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.Furnaces); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("PerennialBrickWall"), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/PerennialBrickWall.cs b/Items/Placeables/PerennialBrickWall.cs index c021fc83a1..e153195285 100644 --- a/Items/Placeables/PerennialBrickWall.cs +++ b/Items/Placeables/PerennialBrickWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PerennialBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("PerennialBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("PerennialBrick")); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PerennialBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("PerennialBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("PerennialBrick")); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/PerennialOre.cs b/Items/Placeables/PerennialOre.cs index 8872d389e6..06723d09a5 100644 --- a/Items/Placeables/PerennialOre.cs +++ b/Items/Placeables/PerennialOre.cs @@ -1,35 +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.Placeables -{ - public class PerennialOre : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perennial Ore"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("PerennialOre"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 7; - } - } -} \ No newline at end of file +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.Placeables +{ + public class PerennialOre : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perennial Ore"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("PerennialOre"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 7; + } + } +} diff --git a/Items/Placeables/PerforatorTrophy.cs b/Items/Placeables/PerforatorTrophy.cs index 6cb365a6fc..603bca0e4b 100644 --- a/Items/Placeables/PerforatorTrophy.cs +++ b/Items/Placeables/PerforatorTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PerforatorTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perforator Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 1; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PerforatorTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perforator Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 1; + } + } +} diff --git a/Items/Placeables/PinkBrickWallUnsafe.cs b/Items/Placeables/PinkBrickWallUnsafe.cs index 520430739e..8acc2a6d40 100644 --- a/Items/Placeables/PinkBrickWallUnsafe.cs +++ b/Items/Placeables/PinkBrickWallUnsafe.cs @@ -1,22 +1,22 @@ -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables -{ - public class PinkBrickWallUnsafe : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = WallID.PinkDungeonUnsafe; - } - } -} \ No newline at end of file +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class PinkBrickWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.PinkDungeonUnsafe; + } + } +} diff --git a/Items/Placeables/PinkSlabWallUnsafe.cs b/Items/Placeables/PinkSlabWallUnsafe.cs index d495877511..b663c4c8d0 100644 --- a/Items/Placeables/PinkSlabWallUnsafe.cs +++ b/Items/Placeables/PinkSlabWallUnsafe.cs @@ -1,22 +1,22 @@ -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables -{ - public class PinkSlabWallUnsafe : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = WallID.PinkDungeonSlabUnsafe; - } - } -} \ No newline at end of file +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class PinkSlabWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.PinkDungeonSlabUnsafe; + } + } +} diff --git a/Items/Placeables/PinkTiledWallUnsafe.cs b/Items/Placeables/PinkTiledWallUnsafe.cs index 71c4e1d686..d0bd279704 100644 --- a/Items/Placeables/PinkTiledWallUnsafe.cs +++ b/Items/Placeables/PinkTiledWallUnsafe.cs @@ -1,22 +1,22 @@ -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables -{ - public class PinkTiledWallUnsafe : ModItem - { - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = WallID.PinkDungeonTileUnsafe; - } - } -} \ No newline at end of file +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables +{ + public class PinkTiledWallUnsafe : ModItem + { + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = WallID.PinkDungeonTileUnsafe; + } + } +} diff --git a/Items/Placeables/PlaguebringerGoliathTrophy.cs b/Items/Placeables/PlaguebringerGoliathTrophy.cs index da9e3d9aa2..8023ae6287 100644 --- a/Items/Placeables/PlaguebringerGoliathTrophy.cs +++ b/Items/Placeables/PlaguebringerGoliathTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PlaguebringerGoliathTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plaguebringer Goliath Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 4; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PlaguebringerGoliathTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer Goliath Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 4; + } + } +} diff --git a/Items/Placeables/PlantyMush.cs b/Items/Placeables/PlantyMush.cs index b1fdfd0a72..5e8a18b1c6 100644 --- a/Items/Placeables/PlantyMush.cs +++ b/Items/Placeables/PlantyMush.cs @@ -1,35 +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.Placeables -{ - public class PlantyMush : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Planty Mush"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("PlantyMush"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = 1750; - item.rare = 3; - } - } -} \ No newline at end of file +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.Placeables +{ + public class PlantyMush : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Planty Mush"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("PlantyMush"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = 1750; + item.rare = 3; + } + } +} diff --git a/Items/Placeables/PolterghastTrophy.cs b/Items/Placeables/PolterghastTrophy.cs index 3d2fda545d..8b4d25c633 100644 --- a/Items/Placeables/PolterghastTrophy.cs +++ b/Items/Placeables/PolterghastTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class PolterghastTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polterghast Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 17; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class PolterghastTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 17; + } + } +} diff --git a/Items/Placeables/PrismShard.cs b/Items/Placeables/PrismShard.cs index 06498a4879..d45e80c1fc 100644 --- a/Items/Placeables/PrismShard.cs +++ b/Items/Placeables/PrismShard.cs @@ -1,35 +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.Placeables -{ - public class PrismShard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prism Shard"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("SeaPrismCrystals"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 5, 0); - item.rare = 2; - } - } -} \ No newline at end of file +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.Placeables +{ + public class PrismShard : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism Shard"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("SeaPrismCrystals"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 26; + item.height = 26; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 5, 0); + item.rare = 2; + } + } +} diff --git a/Items/Placeables/ProvidenceTrophy.cs b/Items/Placeables/ProvidenceTrophy.cs index 1bf2c04df9..c6aab6b1d8 100644 --- a/Items/Placeables/ProvidenceTrophy.cs +++ b/Items/Placeables/ProvidenceTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class ProvidenceTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Providence Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 6; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ProvidenceTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Providence Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 6; + } + } +} diff --git a/Items/Placeables/RavagerTrophy.cs b/Items/Placeables/RavagerTrophy.cs index cdfcb7c6da..05ddf7faa5 100644 --- a/Items/Placeables/RavagerTrophy.cs +++ b/Items/Placeables/RavagerTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class RavagerTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 22; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class RavagerTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 22; + } + } +} diff --git a/Items/Placeables/SeaPrism.cs b/Items/Placeables/SeaPrism.cs index 421b8cf4ea..1a30ad2d99 100644 --- a/Items/Placeables/SeaPrism.cs +++ b/Items/Placeables/SeaPrism.cs @@ -1,44 +1,44 @@ -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.Placeables -{ - public class SeaPrism : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Prism"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("SeaPrism"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 2; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PrismShard", 5); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Placeables +{ + public class SeaPrism : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Prism"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("SeaPrism"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 2; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PrismShard", 5); + recipe.SetResult(this); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/SignusTrophy.cs b/Items/Placeables/SignusTrophy.cs index cffd2f6d53..dd9f05169d 100644 --- a/Items/Placeables/SignusTrophy.cs +++ b/Items/Placeables/SignusTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SignusTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Signus Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 11; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SignusTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Signus Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 11; + } + } +} diff --git a/Items/Placeables/SlimeGodTrophy.cs b/Items/Placeables/SlimeGodTrophy.cs index 6a8237c7d9..21ec7a8ddd 100644 --- a/Items/Placeables/SlimeGodTrophy.cs +++ b/Items/Placeables/SlimeGodTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class SlimeGodTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slime God Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 2; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SlimeGodTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 2; + } + } +} diff --git a/Items/Placeables/SulphurousSand.cs b/Items/Placeables/SulphurousSand.cs index 8da677a9ec..04174dd39b 100644 --- a/Items/Placeables/SulphurousSand.cs +++ b/Items/Placeables/SulphurousSand.cs @@ -1,33 +1,33 @@ -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.Placeables -{ - public class SulphurousSand : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sulphurous Sand"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("SulphurousSand"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - } - } -} \ No newline at end of file +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.Placeables +{ + public class SulphurousSand : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulphurous Sand"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("SulphurousSand"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + } + } +} diff --git a/Items/Placeables/Tenebris.cs b/Items/Placeables/Tenebris.cs index 3f01076672..4180d89e59 100644 --- a/Items/Placeables/Tenebris.cs +++ b/Items/Placeables/Tenebris.cs @@ -1,35 +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.Placeables -{ - public class Tenebris : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tenebris"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("Tenebris"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 7; - } - } -} \ No newline at end of file +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.Placeables +{ + public class Tenebris : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tenebris"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("Tenebris"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 7; + } + } +} diff --git a/Items/Placeables/TranquilityCandle.cs b/Items/Placeables/TranquilityCandle.cs index 181af803e5..e629996419 100644 --- a/Items/Placeables/TranquilityCandle.cs +++ b/Items/Placeables/TranquilityCandle.cs @@ -1,48 +1,48 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class TranquilityCandle: ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tranquility Candle"); - Tooltip.SetDefault("The mere presence of this candle calms surrounding enemies drastically"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 20; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 500; - item.createTile = mod.TileType("TranquilityCandle"); - } - - public override void HoldItem(Player player) - { - player.GetModPlayer().tranquilityCandle = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PeaceCandle, 3); - recipe.AddIngredient(ItemID.SoulofLight, 3); - recipe.AddIngredient(ItemID.PixieDust, 4); - recipe.AddIngredient(null, "ZenPotion"); - recipe.SetResult(this, 1); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class TranquilityCandle: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tranquility Candle"); + Tooltip.SetDefault("The mere presence of this candle calms surrounding enemies drastically"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 20; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 500; + item.createTile = mod.TileType("TranquilityCandle"); + } + + public override void HoldItem(Player player) + { + player.GetModPlayer().tranquilityCandle = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PeaceCandle, 3); + recipe.AddIngredient(ItemID.SoulofLight, 3); + recipe.AddIngredient(ItemID.PixieDust, 4); + recipe.AddIngredient(null, "ZenPotion"); + recipe.SetResult(this, 1); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/UelibloomBrick.cs b/Items/Placeables/UelibloomBrick.cs index 5bce51d21e..829834141e 100644 --- a/Items/Placeables/UelibloomBrick.cs +++ b/Items/Placeables/UelibloomBrick.cs @@ -1,43 +1,43 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace CalamityMod.Items.Placeables -{ - public class UelibloomBrick : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("UelibloomBrick"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("UelibloomOre")); - recipe.AddIngredient(ItemID.StoneBlock); - recipe.SetResult(this); - recipe.AddTile(TileID.Furnaces); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.GetItem("UelibloomBrickWall"), 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - } - } -} +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace CalamityMod.Items.Placeables +{ + public class UelibloomBrick : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("UelibloomBrick"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("UelibloomOre")); + recipe.AddIngredient(ItemID.StoneBlock); + recipe.SetResult(this); + recipe.AddTile(TileID.Furnaces); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("UelibloomBrickWall"), 4); + recipe.SetResult(this); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/UelibloomBrickWall.cs b/Items/Placeables/UelibloomBrickWall.cs index 3142aaece7..622952d782 100644 --- a/Items/Placeables/UelibloomBrickWall.cs +++ b/Items/Placeables/UelibloomBrickWall.cs @@ -1,34 +1,34 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class UelibloomBrickWall : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("UelibloomBrickWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("UelibloomBrick")); - recipe.SetResult(this, 4); - recipe.AddTile(18); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class UelibloomBrickWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("UelibloomBrickWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("UelibloomBrick")); + recipe.SetResult(this, 4); + recipe.AddTile(18); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/UelibloomOre.cs b/Items/Placeables/UelibloomOre.cs index d1e6239a30..1c1b660c42 100644 --- a/Items/Placeables/UelibloomOre.cs +++ b/Items/Placeables/UelibloomOre.cs @@ -1,46 +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.Placeables -{ - public class UelibloomOre : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Uelibloom Ore"); - } - - public override void SetDefaults() - { - item.createTile = mod.TileType("UelibloomOre"); - item.useStyle = 1; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 10; - item.height = 10; - item.maxStack = 999; - item.rare = 10; - item.value = Item.buyPrice(0, 0, 10, 0); - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 200); - } - } - } - } -} \ No newline at end of file +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.Placeables +{ + public class UelibloomOre : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Uelibloom Ore"); + } + + public override void SetDefaults() + { + item.createTile = mod.TileType("UelibloomOre"); + item.useStyle = 1; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 10; + item.height = 10; + item.maxStack = 999; + item.rare = 10; + item.value = Item.buyPrice(0, 0, 10, 0); + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 200); + } + } + } + } +} diff --git a/Items/Placeables/Voidstone.cs b/Items/Placeables/Voidstone.cs index acf963bcc4..5f8ac6ab67 100644 --- a/Items/Placeables/Voidstone.cs +++ b/Items/Placeables/Voidstone.cs @@ -1,38 +1,38 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -// If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" -using Terraria.Localization; - -namespace CalamityMod.Items.Placeables -{ - public class Voidstone : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.createTile = mod.TileType("Voidstone"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VoidstoneWall", 4); - recipe.SetResult(this); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - } - } -} +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +// If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" +using Terraria.Localization; + +namespace CalamityMod.Items.Placeables +{ + public class Voidstone : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = mod.TileType("Voidstone"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VoidstoneWall", 4); + recipe.SetResult(this); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/VoidstoneWall.cs b/Items/Placeables/VoidstoneWall.cs index e8439a0044..64ac9bac40 100644 --- a/Items/Placeables/VoidstoneWall.cs +++ b/Items/Placeables/VoidstoneWall.cs @@ -1,36 +1,36 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class VoidstoneWall : ModItem - { - public override void SetStaticDefaults() - { - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 12; - item.maxStack = 999; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 7; - item.useStyle = 1; - item.consumable = true; - item.createWall = mod.WallType("VoidstoneWall"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Voidstone"); - recipe.SetResult(this, 4); - recipe.AddTile(TileID.WorkBenches); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VoidstoneWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = 1; + item.consumable = true; + item.createWall = mod.WallType("VoidstoneWall"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Voidstone"); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/WeaverTrophy.cs b/Items/Placeables/WeaverTrophy.cs index 6125a8bd90..161201efd6 100644 --- a/Items/Placeables/WeaverTrophy.cs +++ b/Items/Placeables/WeaverTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class WeaverTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Weaver Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 12; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class WeaverTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Weaver Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 12; + } + } +} diff --git a/Items/Placeables/YharonTrophy.cs b/Items/Placeables/YharonTrophy.cs index 135f8ad93d..d740d691bc 100644 --- a/Items/Placeables/YharonTrophy.cs +++ b/Items/Placeables/YharonTrophy.cs @@ -1,29 +1,29 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables -{ - public class YharonTrophy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharon Trophy"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.maxStack = 99; - item.useTurn = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useTime = 10; - item.useStyle = 1; - item.consumable = true; - item.value = 50000; - item.rare = 1; - item.createTile = mod.TileType("BossTrophy"); - item.placeStyle = 10; - } - } -} \ No newline at end of file +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class YharonTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharon Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = mod.TileType("BossTrophy"); + item.placeStyle = 10; + } + } +} diff --git a/Items/PlaguebringerGoliath/Abomination.cs b/Items/PlaguebringerGoliath/Abomination.cs index fd0e9e029f..527e3ad341 100644 --- a/Items/PlaguebringerGoliath/Abomination.cs +++ b/Items/PlaguebringerGoliath/Abomination.cs @@ -1,58 +1,58 @@ -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; - -namespace CalamityMod.Items.PlaguebringerGoliath -{ - public class Abomination : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abombination"); - Tooltip.SetDefault("Calls in the airborne jungle abomination\n" + - "Summons the Plaguebringer Goliath"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.maxStack = 20; - item.rare = 8; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("PlaguebringerGoliath")); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PlaguebringerGoliath")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PlagueCellCluster", 10); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Stinger, 2); - recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.Items.PlaguebringerGoliath +{ + public class Abomination : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abombination"); + Tooltip.SetDefault("Calls in the airborne jungle abomination\n" + + "Summons the Plaguebringer Goliath"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 20; + item.rare = 8; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("PlaguebringerGoliath")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("PlaguebringerGoliath")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PlagueCellCluster", 10); + recipe.AddIngredient(ItemID.IronBar, 5); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.Stinger, 2); + recipe.AddIngredient(ItemID.Obsidian, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/PlaguebringerGoliath/BloomStone.cs b/Items/PlaguebringerGoliath/BloomStone.cs index ddbbacd798..7df668f9d2 100644 --- a/Items/PlaguebringerGoliath/BloomStone.cs +++ b/Items/PlaguebringerGoliath/BloomStone.cs @@ -1,175 +1,175 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.PlaguebringerGoliath -{ - public class BloomStone : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloom Stone"); - Tooltip.SetDefault("One of the ancient relics\n" + - "Enemies that get near you take damage and all damage is increased by 3%\n" + - "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 7)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityCustomThrowingDamagePlayer modPlayer2 = CalamityCustomThrowingDamagePlayer.ModPlayer(player); - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.25f, 0.4f, 0.2f); - player.meleeDamage += 0.03f; - player.magicDamage += 0.03f; - player.rangedDamage += 0.03f; - modPlayer2.throwingDamage += 0.03f; - player.minionDamage += 0.03f; - int bloomCounter = 0; - int num = 186; - float num2 = 150f; - bool flag = bloomCounter % 60 == 0; - int num3 = 10; - int random = Main.rand.Next(10); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (nPC.FindBuffIndex(num) == -1) - { - nPC.AddBuff(num, 120, false); - } - if (flag) - { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != 0) - { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - bloomCounter++; - if (bloomCounter >= 180) - { - bloomCounter = 0; - } - if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) - { - int num4 = (int)player.Center.X / 16; - int num5 = (int)(player.position.Y + (float)player.height - 1f) / 16; - if (Main.tile[num4, num5] == null) - { - Main.tile[num4, num5] = new Tile(); - } - if (!Main.tile[num4, num5].active() && Main.tile[num4, num5].liquid == 0 && Main.tile[num4, num5 + 1] != null && WorldGen.SolidTile(num4, num5 + 1)) - { - Main.tile[num4, num5].frameY = 0; - Main.tile[num4, num5].slope(0); - Main.tile[num4, num5].halfBrick(false); - if (Main.tile[num4, num5 + 1].type == 0) - { - if (Main.rand.Next(1000) == 0) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 227; - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); - } - } - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - if (Main.tile[num4, num5 + 1].type == 2) - { - if (Main.rand.Next(2) == 0) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 3; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); - } - } - else - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 73; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); - while (Main.tile[num4, num5].frameX == 144) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); - } - } - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - else if (Main.tile[num4, num5 + 1].type == 109) - { - if (Main.rand.Next(2) == 0) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 110; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); - while (Main.tile[num4, num5].frameX == 90) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); - } - } - else - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 113; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); - while (Main.tile[num4, num5].frameX == 90) - { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); - } - } - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - else if (Main.tile[num4, num5 + 1].type == 60) - { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 74; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(9, 17)); - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); - } - } - } - } - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.PlaguebringerGoliath +{ + public class BloomStone : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloom Stone"); + Tooltip.SetDefault("One of the ancient relics\n" + + "Enemies that get near you take damage and all damage is increased by 3%\n" + + "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 7)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 5; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityCustomThrowingDamagePlayer modPlayer2 = CalamityCustomThrowingDamagePlayer.ModPlayer(player); + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.25f, 0.4f, 0.2f); + player.meleeDamage += 0.03f; + player.magicDamage += 0.03f; + player.rangedDamage += 0.03f; + modPlayer2.throwingDamage += 0.03f; + player.minionDamage += 0.03f; + int bloomCounter = 0; + int num = 186; + float num2 = 150f; + bool flag = bloomCounter % 60 == 0; + int num3 = 10; + int random = Main.rand.Next(10); + if (player.whoAmI == Main.myPlayer) + { + if (random == 0) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1) + { + nPC.AddBuff(num, 120, false); + } + if (flag) + { + nPC.StrikeNPC(num3, 0f, 0, false, false, false); + if (Main.netMode != 0) + { + NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + bloomCounter++; + if (bloomCounter >= 180) + { + bloomCounter = 0; + } + if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) + { + int num4 = (int)player.Center.X / 16; + int num5 = (int)(player.position.Y + (float)player.height - 1f) / 16; + if (Main.tile[num4, num5] == null) + { + Main.tile[num4, num5] = new Tile(); + } + if (!Main.tile[num4, num5].active() && Main.tile[num4, num5].liquid == 0 && Main.tile[num4, num5 + 1] != null && WorldGen.SolidTile(num4, num5 + 1)) + { + Main.tile[num4, num5].frameY = 0; + Main.tile[num4, num5].slope(0); + Main.tile[num4, num5].halfBrick(false); + if (Main.tile[num4, num5 + 1].type == 0) + { + if (Main.rand.Next(1000) == 0) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 227; + Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); + } + } + if (Main.netMode == 1) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + if (Main.tile[num4, num5 + 1].type == 2) + { + if (Main.rand.Next(2) == 0) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 3; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); + } + } + else + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 73; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); + while (Main.tile[num4, num5].frameX == 144) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); + } + } + if (Main.netMode == 1) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + else if (Main.tile[num4, num5 + 1].type == 109) + { + if (Main.rand.Next(2) == 0) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 110; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); + while (Main.tile[num4, num5].frameX == 90) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); + } + } + else + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 113; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); + while (Main.tile[num4, num5].frameX == 90) + { + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); + } + } + if (Main.netMode == 1) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + else if (Main.tile[num4, num5 + 1].type == 60) + { + Main.tile[num4, num5].active(true); + Main.tile[num4, num5].type = 74; + Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(9, 17)); + if (Main.netMode == 1) + { + NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + } + } + } + } + } + } +} diff --git a/Items/PlaguebringerGoliath/PlagueCellCluster.cs b/Items/PlaguebringerGoliath/PlagueCellCluster.cs index 45279cda89..f177a533c8 100644 --- a/Items/PlaguebringerGoliath/PlagueCellCluster.cs +++ b/Items/PlaguebringerGoliath/PlagueCellCluster.cs @@ -1,28 +1,28 @@ -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.PlaguebringerGoliath -{ - public class PlagueCellCluster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Cell Canister"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 8; - } - } -} \ No newline at end of file +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.PlaguebringerGoliath +{ + public class PlagueCellCluster : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Cell Canister"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 8; + } + } +} diff --git a/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs b/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs index b4ba2cf528..d48580ab02 100644 --- a/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs +++ b/Items/PlaguebringerGoliath/PlaguebringerGoliathBag.cs @@ -1,108 +1,108 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.PlaguebringerGoliath -{ - public class PlaguebringerGoliathBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("PlaguebringerGoliath"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - if (Main.rand.Next(100) == 0) - { - player.QuickSpawnItem(mod.ItemType("Malachite")); - } - else if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - player.QuickSpawnItem(mod.ItemType("Malachite")); - } - } - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("PestilentDefiler")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("ThePlaguebringer")); - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("PlaguebringerGoliathMask")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("TheHive")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Malevolence")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("DiseasedPike")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("VirulentKatana")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("MepheticSprayer")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("PlagueStaff")); - } - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(mod.ItemType("BloomStone")); - } - player.QuickSpawnItem(mod.ItemType("ToxicHeart")); - player.QuickSpawnItem(mod.ItemType("PlagueCellCluster"), Main.rand.Next(13, 18)); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.PlaguebringerGoliath +{ + public class PlaguebringerGoliathBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("PlaguebringerGoliath"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + if (Main.rand.Next(100) == 0) + { + player.QuickSpawnItem(mod.ItemType("Malachite")); + } + else if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + player.QuickSpawnItem(mod.ItemType("Malachite")); + } + } + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("PestilentDefiler")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("ThePlaguebringer")); + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("PlaguebringerGoliathMask")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("TheHive")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Malevolence")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("DiseasedPike")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("VirulentKatana")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("MepheticSprayer")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("PlagueStaff")); + } + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(mod.ItemType("BloomStone")); + } + player.QuickSpawnItem(mod.ItemType("ToxicHeart")); + player.QuickSpawnItem(mod.ItemType("PlagueCellCluster"), Main.rand.Next(13, 18)); + } + } +} diff --git a/Items/PlaguebringerGoliath/ToxicHeart.cs b/Items/PlaguebringerGoliath/ToxicHeart.cs index 2fa955fd37..848f55b3be 100644 --- a/Items/PlaguebringerGoliath/ToxicHeart.cs +++ b/Items/PlaguebringerGoliath/ToxicHeart.cs @@ -1,71 +1,71 @@ -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.PlaguebringerGoliath -{ - public class ToxicHeart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Toxic Heart"); - Tooltip.SetDefault("Summons a damaging plague aura around the player to destroy nearby enemies"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 32; - item.value = Item.buyPrice(0, 30, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - int plagueCounter = 0; - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.05f, 1f, 0.1f); - int num = mod.BuffType("Plague"); - float num2 = 300f; - bool flag = plagueCounter % 60 == 0; - int num3 = 30; - int random = Main.rand.Next(10); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0) - { - for (int l = 0; l < 200; l++) - { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (nPC.FindBuffIndex(num) == -1) - { - nPC.AddBuff(num, 120, false); - } - if (flag) - { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != 0) - { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - plagueCounter++; - if (plagueCounter >= 180) - { - plagueCounter = 0; - } - } - } -} \ No newline at end of file +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.PlaguebringerGoliath +{ + public class ToxicHeart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxic Heart"); + Tooltip.SetDefault("Summons a damaging plague aura around the player to destroy nearby enemies"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 30, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + int plagueCounter = 0; + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.05f, 1f, 0.1f); + int num = mod.BuffType("Plague"); + float num2 = 300f; + bool flag = plagueCounter % 60 == 0; + int num3 = 30; + int random = Main.rand.Next(10); + if (player.whoAmI == Main.myPlayer) + { + if (random == 0) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1) + { + nPC.AddBuff(num, 120, false); + } + if (flag) + { + nPC.StrikeNPC(num3, 0f, 0, false, false, false); + if (Main.netMode != 0) + { + NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + plagueCounter++; + if (plagueCounter >= 180) + { + plagueCounter = 0; + } + } + } +} diff --git a/Items/Polterghast/Affliction.cs b/Items/Polterghast/Affliction.cs index ac024fb848..0a9609feb1 100644 --- a/Items/Polterghast/Affliction.cs +++ b/Items/Polterghast/Affliction.cs @@ -1,46 +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.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 override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 60, 0, 0); - item.accessory = true; - item.expert = true; - item.rare = 9; - } - - 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 +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.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 override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 60, 0, 0); + item.accessory = true; + item.expert = true; + item.rare = 9; + } + + 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); + } + } + } + } +} diff --git a/Items/Polterghast/NecroplasmicBeacon.cs b/Items/Polterghast/NecroplasmicBeacon.cs index 54faa06dcc..04ae6f0dd4 100644 --- a/Items/Polterghast/NecroplasmicBeacon.cs +++ b/Items/Polterghast/NecroplasmicBeacon.cs @@ -1,53 +1,53 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Items.Polterghast -{ - public class NecroplasmicBeacon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Necroplasmic Beacon"); - Tooltip.SetDefault("It's spooky\n" + - "Summons Polterghast\n" + - "Not consumable"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneDungeon && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && CalamityWorld.downedBossAny; - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Polterghast")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Phantoplasm", 100); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Items.Polterghast +{ + public class NecroplasmicBeacon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Necroplasmic Beacon"); + Tooltip.SetDefault("It's spooky\n" + + "Summons Polterghast\n" + + "Not consumable"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneDungeon && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && CalamityWorld.downedBossAny; + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Polterghast")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Phantoplasm", 100); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Polterghast/PolterghastBag.cs b/Items/Polterghast/PolterghastBag.cs index 0c5a84c49d..382dfadebc 100644 --- a/Items/Polterghast/PolterghastBag.cs +++ b/Items/Polterghast/PolterghastBag.cs @@ -1,86 +1,86 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Polterghast -{ - public class PolterghastBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("Polterghast"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("Ectoheart")); - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("BansheeHook")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("DaemonsFlame")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("EtherealSubjugator")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("FatesReveal")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("GhastlyVisage")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("GhoulishGouger")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("TerrorBlade")); - } - player.QuickSpawnItem(mod.ItemType("RuinousSoul"), Main.rand.Next(6, 11)); - player.QuickSpawnItem(mod.ItemType("Affliction")); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Polterghast +{ + public class PolterghastBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("Polterghast"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("Ectoheart")); + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("BansheeHook")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("DaemonsFlame")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("EtherealSubjugator")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("FatesReveal")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("GhastlyVisage")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("GhoulishGouger")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("TerrorBlade")); + } + player.QuickSpawnItem(mod.ItemType("RuinousSoul"), Main.rand.Next(6, 11)); + player.QuickSpawnItem(mod.ItemType("Affliction")); + } + } +} diff --git a/Items/Polterghast/RuinousSoul.cs b/Items/Polterghast/RuinousSoul.cs index 00566d8051..fa1fb30c84 100644 --- a/Items/Polterghast/RuinousSoul.cs +++ b/Items/Polterghast/RuinousSoul.cs @@ -1,29 +1,29 @@ -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.Polterghast -{ - public class RuinousSoul : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ruinous Soul"); - Tooltip.SetDefault("A shard of the distant past"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - } -} \ No newline at end of file +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.Polterghast +{ + public class RuinousSoul : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ruinous Soul"); + Tooltip.SetDefault("A shard of the distant past"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 7, 0, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + } +} diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index 7214303414..28b2809352 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -62,4 +62,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/BoundingPotion.cs b/Items/Potions/BoundingPotion.cs index e5d06a08de..165aa59b69 100644 --- a/Items/Potions/BoundingPotion.cs +++ b/Items/Potions/BoundingPotion.cs @@ -46,4 +46,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/CadencePotion.cs b/Items/Potions/CadencePotion.cs index c3b06c653c..a837d59a72 100644 --- a/Items/Potions/CadencePotion.cs +++ b/Items/Potions/CadencePotion.cs @@ -51,4 +51,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/CalamitasBrew.cs b/Items/Potions/CalamitasBrew.cs index 8dce3d7fce..4f346199ed 100644 --- a/Items/Potions/CalamitasBrew.cs +++ b/Items/Potions/CalamitasBrew.cs @@ -46,4 +46,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/CalciumPotion.cs b/Items/Potions/CalciumPotion.cs index 6da05ad64d..83c8e90e6f 100644 --- a/Items/Potions/CalciumPotion.cs +++ b/Items/Potions/CalciumPotion.cs @@ -45,4 +45,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/CeaselessHungerPotion.cs b/Items/Potions/CeaselessHungerPotion.cs index 39e06d0add..e956183377 100644 --- a/Items/Potions/CeaselessHungerPotion.cs +++ b/Items/Potions/CeaselessHungerPotion.cs @@ -47,4 +47,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/CrumblingPotion.cs b/Items/Potions/CrumblingPotion.cs index bcb3d5a41b..cf1ed7014f 100644 --- a/Items/Potions/CrumblingPotion.cs +++ b/Items/Potions/CrumblingPotion.cs @@ -48,4 +48,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/DraconicElixir.cs b/Items/Potions/DraconicElixir.cs index eb4b3d076b..09ade8321c 100644 --- a/Items/Potions/DraconicElixir.cs +++ b/Items/Potions/DraconicElixir.cs @@ -57,4 +57,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/GravityNormalizerPotion.cs b/Items/Potions/GravityNormalizerPotion.cs index 904085dac0..1cfdd59cf8 100644 --- a/Items/Potions/GravityNormalizerPotion.cs +++ b/Items/Potions/GravityNormalizerPotion.cs @@ -46,4 +46,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/HolyWrathPotion.cs b/Items/Potions/HolyWrathPotion.cs index c1a07a1c69..97222b0067 100644 --- a/Items/Potions/HolyWrathPotion.cs +++ b/Items/Potions/HolyWrathPotion.cs @@ -49,4 +49,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index 81d27ec963..be804d029f 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/PenumbraPotion.cs b/Items/Potions/PenumbraPotion.cs index dafa1d41c4..4e548b848a 100644 --- a/Items/Potions/PenumbraPotion.cs +++ b/Items/Potions/PenumbraPotion.cs @@ -48,4 +48,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/PhotosynthesisPotion.cs b/Items/Potions/PhotosynthesisPotion.cs index 685f7fec63..072623707f 100644 --- a/Items/Potions/PhotosynthesisPotion.cs +++ b/Items/Potions/PhotosynthesisPotion.cs @@ -49,4 +49,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/PotionofOmniscience.cs b/Items/Potions/PotionofOmniscience.cs index 0100701b8d..76bc983ecd 100644 --- a/Items/Potions/PotionofOmniscience.cs +++ b/Items/Potions/PotionofOmniscience.cs @@ -46,4 +46,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/ProfanedRagePotion.cs b/Items/Potions/ProfanedRagePotion.cs index 3271dfd67a..5a1cb15340 100644 --- a/Items/Potions/ProfanedRagePotion.cs +++ b/Items/Potions/ProfanedRagePotion.cs @@ -49,4 +49,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/PurifiedJam.cs b/Items/Potions/PurifiedJam.cs index fd312e9061..70eec3045d 100644 --- a/Items/Potions/PurifiedJam.cs +++ b/Items/Potions/PurifiedJam.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Items.Potions return true; } } -} \ No newline at end of file +} diff --git a/Items/Potions/RevivifyPotion.cs b/Items/Potions/RevivifyPotion.cs index cf9b275dca..113744cacd 100644 --- a/Items/Potions/RevivifyPotion.cs +++ b/Items/Potions/RevivifyPotion.cs @@ -56,4 +56,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/ShatteringPotion.cs b/Items/Potions/ShatteringPotion.cs index c101246a48..904a30f906 100644 --- a/Items/Potions/ShatteringPotion.cs +++ b/Items/Potions/ShatteringPotion.cs @@ -48,4 +48,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index ed958e4ca6..2712dab4a8 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -47,4 +47,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/SupremeHealingPotion.cs b/Items/Potions/SupremeHealingPotion.cs index 833a06843f..c232817181 100644 --- a/Items/Potions/SupremeHealingPotion.cs +++ b/Items/Potions/SupremeHealingPotion.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/SupremeManaPotion.cs b/Items/Potions/SupremeManaPotion.cs index fe8b150d1f..2f01de9bf7 100644 --- a/Items/Potions/SupremeManaPotion.cs +++ b/Items/Potions/SupremeManaPotion.cs @@ -42,4 +42,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/TitanScalePotion.cs b/Items/Potions/TitanScalePotion.cs index 005b46c17d..b30bf3e846 100644 --- a/Items/Potions/TitanScalePotion.cs +++ b/Items/Potions/TitanScalePotion.cs @@ -46,4 +46,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Potions/TriumphPotion.cs b/Items/Potions/TriumphPotion.cs index 40dc550fd5..69d56a8556 100644 --- a/Items/Potions/TriumphPotion.cs +++ b/Items/Potions/TriumphPotion.cs @@ -46,4 +46,4 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/ProfanedGuardian/ProfanedShard.cs b/Items/ProfanedGuardian/ProfanedShard.cs index d9bd7c50f2..73e30d78d3 100644 --- a/Items/ProfanedGuardian/ProfanedShard.cs +++ b/Items/ProfanedGuardian/ProfanedShard.cs @@ -1,55 +1,55 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; - -namespace CalamityMod.Items.ProfanedGuardian -{ - public class ProfanedShard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Shard"); - Tooltip.SetDefault("A shard of the unholy flame\n" + - "Summons the Profaned Guardians\n" + - "Can only be used during daytime"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("ProfanedGuardianBoss")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyEssence", 15); - recipe.AddIngredient(ItemID.LunarBar, 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.ProfanedGuardian +{ + public class ProfanedShard : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Shard"); + Tooltip.SetDefault("A shard of the unholy flame\n" + + "Summons the Profaned Guardians\n" + + "Can only be used during daytime"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("ProfanedGuardianBoss")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ProfanedGuardianBoss")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyEssence", 15); + recipe.AddIngredient(ItemID.LunarBar, 3); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Providence/DivineGeode.cs b/Items/Providence/DivineGeode.cs index 8bcce99127..be08ac5b98 100644 --- a/Items/Providence/DivineGeode.cs +++ b/Items/Providence/DivineGeode.cs @@ -1,37 +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.Providence -{ - public class DivineGeode : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Divine Geode"); - Tooltip.SetDefault("A chunk of crystallized holy energy"); - } - - public override void SetDefaults() - { - 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; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.45f * num, 0.3f * num, 0f * num); - } - } -} \ No newline at end of file +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.Providence +{ + public class DivineGeode : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Divine Geode"); + Tooltip.SetDefault("A chunk of crystallized holy energy"); + } + + public override void SetDefaults() + { + 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; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.45f * num, 0.3f * num, 0f * num); + } + } +} diff --git a/Items/Providence/ElysianAegis.cs b/Items/Providence/ElysianAegis.cs index 3feea5d83a..0598358c8c 100644 --- a/Items/Providence/ElysianAegis.cs +++ b/Items/Providence/ElysianAegis.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.Providence -{ - [AutoloadEquip(EquipType.Shield)] - public class ElysianAegis : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elysian Aegis"); - Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + - "+40 max life and increased life regen\n" + - "Grants a supreme holy flame dash\n" + - "Can be used to ram enemies\n" + - "Press N to activate buffs to all damage, crit chance, and defense\n" + - "Activating this buff will reduce your movement speed and increase enemy aggro\n" + - "Toggle visibility of this accessory to enable/disable the dash"); - } - - public override void SetDefaults() - { - item.width = 48; - item.height = 42; - item.value = Item.buyPrice(0, 60, 0, 0); - item.expert = true; - item.rare = 9; - item.defense = 8; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!hideVisual) { modPlayer.dashMod = 3; } - modPlayer.elysianAegis = true; - player.noKnockback = true; - player.fireWalk = true; - player.lifeRegen += 2; - player.statLifeMax2 += 40; - } - } -} \ No newline at end of file +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.Providence +{ + [AutoloadEquip(EquipType.Shield)] + public class ElysianAegis : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elysian Aegis"); + Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + + "+40 max life and increased life regen\n" + + "Grants a supreme holy flame dash\n" + + "Can be used to ram enemies\n" + + "Press N to activate buffs to all damage, crit chance, and defense\n" + + "Activating this buff will reduce your movement speed and increase enemy aggro\n" + + "Toggle visibility of this accessory to enable/disable the dash"); + } + + public override void SetDefaults() + { + item.width = 48; + item.height = 42; + item.value = Item.buyPrice(0, 60, 0, 0); + item.expert = true; + item.rare = 9; + item.defense = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!hideVisual) { modPlayer.dashMod = 3; } + modPlayer.elysianAegis = true; + player.noKnockback = true; + player.fireWalk = true; + player.lifeRegen += 2; + player.statLifeMax2 += 40; + } + } +} diff --git a/Items/Providence/ElysianWings.cs b/Items/Providence/ElysianWings.cs index dd1730f596..e5b75c6182 100644 --- a/Items/Providence/ElysianWings.cs +++ b/Items/Providence/ElysianWings.cs @@ -1,63 +1,63 @@ -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.Providence -{ - [AutoloadEquip(EquipType.Wings)] - public class ElysianWings : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elysian Wings"); - Tooltip.SetDefault("Horizontal speed: 9.75\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 180"); - } - - public override void SetDefaults() - { - item.width = 36; - item.height = 32; - item.value = Item.buyPrice(0, 45, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.moveSpeed += 0.4f; - player.lavaMax += 240; - player.wingTimeMax = 180; - modPlayer.elysianFire = true; - if (hideVisual) - { - modPlayer.elysianFire = false; - } - } - - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.85f; - ascentWhenRising = 0.15f; - maxCanAscendMultiplier = 1f; - maxAscentMultiplier = 3f; - constantAscend = 0.135f; - } - - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 9.75f; - acceleration *= 2.5f; - } - } -} \ No newline at end of file +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.Providence +{ + [AutoloadEquip(EquipType.Wings)] + public class ElysianWings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elysian Wings"); + Tooltip.SetDefault("Horizontal speed: 9.75\n" + + "Acceleration multiplier: 2.5\n" + + "Great vertical speed\n" + + "Flight time: 180"); + } + + public override void SetDefaults() + { + item.width = 36; + item.height = 32; + item.value = Item.buyPrice(0, 45, 0, 0); + item.expert = true; + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.moveSpeed += 0.4f; + player.lavaMax += 240; + player.wingTimeMax = 180; + modPlayer.elysianFire = true; + if (hideVisual) + { + modPlayer.elysianFire = false; + } + } + + public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + ascentWhenFalling = 0.85f; + ascentWhenRising = 0.15f; + maxCanAscendMultiplier = 1f; + maxAscentMultiplier = 3f; + constantAscend = 0.135f; + } + + public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) + { + speed = 9.75f; + acceleration *= 2.5f; + } + } +} diff --git a/Items/Providence/ProfanedCore.cs b/Items/Providence/ProfanedCore.cs index c8bf3daea4..16fee72621 100644 --- a/Items/Providence/ProfanedCore.cs +++ b/Items/Providence/ProfanedCore.cs @@ -1,47 +1,47 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; -using CalamityMod.World; - -namespace CalamityMod.Items.Providence -{ - public class ProfanedCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Core"); - Tooltip.SetDefault("The core of the unholy flame\n" + - "Summons Providence\n" + - "Can only be used during daytime"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - item.rare = 9; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Providence")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; +using CalamityMod.World; + +namespace CalamityMod.Items.Providence +{ + public class ProfanedCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Core"); + Tooltip.SetDefault("The core of the unholy flame\n" + + "Summons Providence\n" + + "Can only be used during daytime"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + item.rare = 9; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Providence")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + } +} diff --git a/Items/Providence/ProfanedCoreUnlimited.cs b/Items/Providence/ProfanedCoreUnlimited.cs index 2ddee71167..fa265eb0b8 100644 --- a/Items/Providence/ProfanedCoreUnlimited.cs +++ b/Items/Providence/ProfanedCoreUnlimited.cs @@ -1,57 +1,57 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; -using CalamityMod.World; - -namespace CalamityMod.Items.Providence -{ - public class ProfanedCoreUnlimited : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Core"); - Tooltip.SetDefault("The core of the unholy flame\n" + - "Summons Providence\n" + - "Can only be used during daytime\n" + - "Not consumable"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - item.rare = 9; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Providence")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ProfanedCore"); - recipe.AddIngredient(null, "UnholyEssence", 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; +using CalamityMod.World; + +namespace CalamityMod.Items.Providence +{ + public class ProfanedCoreUnlimited : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Core"); + Tooltip.SetDefault("The core of the unholy flame\n" + + "Summons Providence\n" + + "Can only be used during daytime\n" + + "Not consumable"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + item.rare = 9; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Providence")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedCore"); + recipe.AddIngredient(null, "UnholyEssence", 50); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Providence/ProvidenceBag.cs b/Items/Providence/ProvidenceBag.cs index 1cbae93c97..b0fb7e91e5 100644 --- a/Items/Providence/ProvidenceBag.cs +++ b/Items/Providence/ProvidenceBag.cs @@ -1,90 +1,90 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Providence -{ - public class ProvidenceBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("Providence"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("BlissfulBombardier")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("HolyCollider")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("MoltenAmputator")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("PurgeGuzzler")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("SolarFlare")); - } - if (Main.rand.Next(3) == 0) - { - 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")); - } - player.QuickSpawnItem(mod.ItemType("UnholyEssence"), Main.rand.Next(25, 36)); - player.QuickSpawnItem(mod.ItemType("DivineGeode"), Main.rand.Next(15, 26)); - player.QuickSpawnItem(mod.ItemType("RuneofCos")); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Providence +{ + public class ProvidenceBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("Providence"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("BlissfulBombardier")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("HolyCollider")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("MoltenAmputator")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("PurgeGuzzler")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("SolarFlare")); + } + if (Main.rand.Next(3) == 0) + { + 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")); + } + player.QuickSpawnItem(mod.ItemType("UnholyEssence"), Main.rand.Next(25, 36)); + player.QuickSpawnItem(mod.ItemType("DivineGeode"), Main.rand.Next(15, 26)); + player.QuickSpawnItem(mod.ItemType("RuneofCos")); + } + } +} diff --git a/Items/Providence/UnholyEssence.cs b/Items/Providence/UnholyEssence.cs index 2a1ea80bd8..16392193ca 100644 --- a/Items/Providence/UnholyEssence.cs +++ b/Items/Providence/UnholyEssence.cs @@ -1,39 +1,39 @@ -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.Providence -{ - public class UnholyEssence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Unholy Essence"); - Tooltip.SetDefault("The essence of profaned creatures"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); - } - - public override void SetDefaults() - { - 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; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - maxFallSpeed = 0f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.45f * num, 0.3f * num, 0f * num); - } - } -} \ No newline at end of file +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.Providence +{ + public class UnholyEssence : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Unholy Essence"); + Tooltip.SetDefault("The essence of profaned creatures"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); + } + + public override void SetDefaults() + { + 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; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + maxFallSpeed = 0f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.45f * num, 0.3f * num, 0f * num); + } + } +} diff --git a/Items/RedLightningContainer.cs b/Items/RedLightningContainer.cs index 27a5c6d285..0a730bf2fb 100644 --- a/Items/RedLightningContainer.cs +++ b/Items/RedLightningContainer.cs @@ -1,57 +1,57 @@ -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 RedLightningContainer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Lightning Container"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% (60% in Death Mode) more damage\n" + - "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 6)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.rageBoostThree) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.rageBoostThree = true; - } - return true; - } - } -} \ No newline at end of file +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 RedLightningContainer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Lightning Container"); + Tooltip.SetDefault("Permanently makes Rage Mode do 15% (60% in Death Mode) more damage\n" + + "Revengeance drop"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 6)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.rageBoostThree) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.rageBoostThree = true; + } + return true; + } + } +} diff --git a/Items/ReefclawHamaxe.cs b/Items/ReefclawHamaxe.cs index ce4f1d2cec..b3e399232d 100644 --- a/Items/ReefclawHamaxe.cs +++ b/Items/ReefclawHamaxe.cs @@ -1,47 +1,47 @@ -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 -{ - public class ReefclawHamaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reefclaw Hamaxe"); - } - - public override void SetDefaults() - { - item.damage = 15; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTime = 29; - item.useAnimation = 29; - item.useTurn = true; - item.axe = 13; - item.hammer = 50; - item.useStyle = 1; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class ReefclawHamaxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reefclaw Hamaxe"); + } + + public override void SetDefaults() + { + item.damage = 15; + item.melee = true; + item.width = 44; + item.height = 44; + item.useTime = 29; + item.useAnimation = 29; + item.useTurn = true; + item.axe = 13; + item.hammer = 50; + item.useStyle = 1; + item.knockBack = 6f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Rock.cs b/Items/Rock.cs index 04126246a3..e4b8dbc8c8 100644 --- a/Items/Rock.cs +++ b/Items/Rock.cs @@ -1,27 +1,27 @@ -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 -{ - public class Rock : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rock"); - Tooltip.SetDefault("The first object Xeroc ever created"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 0, 0, 1); - } - } -} \ No newline at end of file +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 +{ + public class Rock : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rock"); + Tooltip.SetDefault("The first object Xeroc ever created"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 0, 0, 1); + } + } +} diff --git a/Items/Scavenger/AncientMedallion.cs b/Items/Scavenger/AncientMedallion.cs index 1fc728eea8..14109e6d13 100644 --- a/Items/Scavenger/AncientMedallion.cs +++ b/Items/Scavenger/AncientMedallion.cs @@ -1,53 +1,53 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Scavenger -{ - public class AncientMedallion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient Medallion"); - Tooltip.SetDefault("A very old temple medallion\n" + - "Summons the Ravager"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 8; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("ScavengerBody")) && player.ZoneOverworldHeight; - } - - public override bool UseItem(Player player) - { - if (Main.netMode != 1) - { - NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-100, 101))), (int)(player.position.Y - 250f), mod.NPCType("ScavengerBody"), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(SoundID.Roar, player.position, 0); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarTabletFragment, 5); - recipe.AddIngredient(ItemID.LihzahrdBrick, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Scavenger +{ + public class AncientMedallion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient Medallion"); + Tooltip.SetDefault("A very old temple medallion\n" + + "Summons the Ravager"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 8; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("ScavengerBody")) && player.ZoneOverworldHeight; + } + + public override bool UseItem(Player player) + { + if (Main.netMode != 1) + { + NPC.NewNPC((int)(player.position.X + (float)(Main.rand.Next(-100, 101))), (int)(player.position.Y - 250f), mod.NPCType("ScavengerBody"), 0, 0f, 0f, 0f, 0f, 255); + Main.PlaySound(SoundID.Roar, player.position, 0); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarTabletFragment, 5); + recipe.AddIngredient(ItemID.LihzahrdBrick, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Scavenger/BloodPact.cs b/Items/Scavenger/BloodPact.cs index b802f3334a..72e2c7adde 100644 --- a/Items/Scavenger/BloodPact.cs +++ b/Items/Scavenger/BloodPact.cs @@ -1,36 +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.Scavenger -{ - public class BloodPact : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Pact"); - Tooltip.SetDefault("Doubles your max HP\n" + - "Allows you to be critically hit 25% of the time"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.rare = 8; - item.value = Item.buyPrice(0, 24, 0, 0); - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.bloodPact = true; - } - } -} \ No newline at end of file +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.Scavenger +{ + public class BloodPact : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Pact"); + Tooltip.SetDefault("Doubles your max HP\n" + + "Allows you to be critically hit 25% of the time"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.rare = 8; + item.value = Item.buyPrice(0, 24, 0, 0); + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.bloodPact = true; + } + } +} diff --git a/Items/Scavenger/FleshTotem.cs b/Items/Scavenger/FleshTotem.cs index 3c7dc77c0b..2b7bf212be 100644 --- a/Items/Scavenger/FleshTotem.cs +++ b/Items/Scavenger/FleshTotem.cs @@ -1,36 +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.Scavenger -{ - public class FleshTotem : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flesh Totem"); - Tooltip.SetDefault("Halves enemy contact damage\n" + - "When you take contact damage this effect has a 20 second cooldown"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.rare = 8; - item.value = Item.buyPrice(0, 24, 0, 0); - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.fleshTotem = true; - } - } -} \ No newline at end of file +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.Scavenger +{ + public class FleshTotem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flesh Totem"); + Tooltip.SetDefault("Halves enemy contact damage\n" + + "When you take contact damage this effect has a 20 second cooldown"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.rare = 8; + item.value = Item.buyPrice(0, 24, 0, 0); + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fleshTotem = true; + } + } +} diff --git a/Items/Scavenger/RavagerBag.cs b/Items/Scavenger/RavagerBag.cs index 706068b74b..96cc95bff5 100644 --- a/Items/Scavenger/RavagerBag.cs +++ b/Items/Scavenger/RavagerBag.cs @@ -1,107 +1,107 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Scavenger -{ - public class RavagerBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.expert = true; - item.rare = 9; - bossBagNPC = mod.NPCType("ScavengerBody"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("InfernalBlood")); - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - if (CalamityWorld.downedProvidence) - { - player.QuickSpawnItem(mod.ItemType("Bloodstone"), Main.rand.Next(60, 71)); - player.QuickSpawnItem(mod.ItemType("VerstaltiteBar"), Main.rand.Next(7, 13)); - player.QuickSpawnItem(mod.ItemType("DraedonBar"), Main.rand.Next(7, 13)); - player.QuickSpawnItem(mod.ItemType("CruptixBar"), Main.rand.Next(7, 13)); - player.QuickSpawnItem(mod.ItemType("CoreofCinder"), Main.rand.Next(2, 5)); - player.QuickSpawnItem(mod.ItemType("CoreofEleum"), Main.rand.Next(2, 5)); - player.QuickSpawnItem(mod.ItemType("CoreofChaos"), Main.rand.Next(2, 5)); - player.QuickSpawnItem(mod.ItemType("BarofLife")); - if (Main.rand.Next(2) == 0) - { - player.QuickSpawnItem(mod.ItemType("CoreofCalamity")); - } - player.QuickSpawnItem(mod.ItemType("BloodflareCore")); - } - else - { - player.QuickSpawnItem(mod.ItemType("VerstaltiteBar"), Main.rand.Next(2, 4)); - player.QuickSpawnItem(mod.ItemType("DraedonBar"), Main.rand.Next(2, 4)); - player.QuickSpawnItem(mod.ItemType("CruptixBar"), Main.rand.Next(2, 4)); - player.QuickSpawnItem(mod.ItemType("CoreofCinder"), Main.rand.Next(1, 4)); - player.QuickSpawnItem(mod.ItemType("CoreofEleum"), Main.rand.Next(1, 4)); - player.QuickSpawnItem(mod.ItemType("CoreofChaos"), Main.rand.Next(1, 4)); - } - if (Main.rand.Next(2) == 0) - { - player.QuickSpawnItem(mod.ItemType("BloodPact")); - } - if (Main.rand.Next(2) == 0) - { - player.QuickSpawnItem(mod.ItemType("FleshTotem")); - } - switch (Main.rand.Next(5)) - { - 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; - } - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Scavenger +{ + public class RavagerBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.expert = true; + item.rare = 9; + bossBagNPC = mod.NPCType("ScavengerBody"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("InfernalBlood")); + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + if (CalamityWorld.downedProvidence) + { + player.QuickSpawnItem(mod.ItemType("Bloodstone"), Main.rand.Next(60, 71)); + player.QuickSpawnItem(mod.ItemType("VerstaltiteBar"), Main.rand.Next(7, 13)); + player.QuickSpawnItem(mod.ItemType("DraedonBar"), Main.rand.Next(7, 13)); + player.QuickSpawnItem(mod.ItemType("CruptixBar"), Main.rand.Next(7, 13)); + player.QuickSpawnItem(mod.ItemType("CoreofCinder"), Main.rand.Next(2, 5)); + player.QuickSpawnItem(mod.ItemType("CoreofEleum"), Main.rand.Next(2, 5)); + player.QuickSpawnItem(mod.ItemType("CoreofChaos"), Main.rand.Next(2, 5)); + player.QuickSpawnItem(mod.ItemType("BarofLife")); + if (Main.rand.Next(2) == 0) + { + player.QuickSpawnItem(mod.ItemType("CoreofCalamity")); + } + player.QuickSpawnItem(mod.ItemType("BloodflareCore")); + } + else + { + player.QuickSpawnItem(mod.ItemType("VerstaltiteBar"), Main.rand.Next(2, 4)); + player.QuickSpawnItem(mod.ItemType("DraedonBar"), Main.rand.Next(2, 4)); + player.QuickSpawnItem(mod.ItemType("CruptixBar"), Main.rand.Next(2, 4)); + player.QuickSpawnItem(mod.ItemType("CoreofCinder"), Main.rand.Next(1, 4)); + player.QuickSpawnItem(mod.ItemType("CoreofEleum"), Main.rand.Next(1, 4)); + player.QuickSpawnItem(mod.ItemType("CoreofChaos"), Main.rand.Next(1, 4)); + } + if (Main.rand.Next(2) == 0) + { + player.QuickSpawnItem(mod.ItemType("BloodPact")); + } + if (Main.rand.Next(2) == 0) + { + player.QuickSpawnItem(mod.ItemType("FleshTotem")); + } + switch (Main.rand.Next(5)) + { + 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 671fa357b6..f24ad22aa9 100644 --- a/Items/ShadowspecBar.cs +++ b/Items/ShadowspecBar.cs @@ -1,45 +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 -{ - public class ShadowspecBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shadowspec Bar"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 10)); - } - - public override void SetDefaults() - { - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BarofLife", 3); - recipe.AddIngredient(null, "Phantoplasm", 3); - recipe.AddIngredient(null, "NightmareFuel", 3); - recipe.AddIngredient(null, "EndothermicEnergy", 3); - recipe.AddIngredient(null, "CalamitousEssence"); - recipe.AddIngredient(null, "DarksunFragment"); - recipe.AddIngredient(null, "HellcasterFragment"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this, 3); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class ShadowspecBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shadowspec Bar"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 10)); + } + + public override void SetDefaults() + { + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BarofLife", 3); + recipe.AddIngredient(null, "Phantoplasm", 3); + recipe.AddIngredient(null, "NightmareFuel", 3); + recipe.AddIngredient(null, "EndothermicEnergy", 3); + recipe.AddIngredient(null, "CalamitousEssence"); + recipe.AddIngredient(null, "DarksunFragment"); + recipe.AddIngredient(null, "HellcasterFragment"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + } + } +} diff --git a/Items/ShardlightPickaxe.cs b/Items/ShardlightPickaxe.cs index 363c3fc63a..8dde5a230f 100644 --- a/Items/ShardlightPickaxe.cs +++ b/Items/ShardlightPickaxe.cs @@ -1,59 +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 -{ - public class ShardlightPickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shardlight Pickaxe"); - } - - public override void SetDefaults() - { - item.damage = 28; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTime = 8; - item.useAnimation = 15; - item.useTurn = true; - item.pick = 190; - item.useStyle = 1; - item.knockBack = 4f; - 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, "VerstaltiteBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 29); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } - } -} \ No newline at end of file +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 +{ + public class ShardlightPickaxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shardlight Pickaxe"); + } + + public override void SetDefaults() + { + item.damage = 28; + item.melee = true; + item.width = 44; + item.height = 44; + item.useTime = 8; + item.useAnimation = 15; + item.useTurn = true; + item.pick = 190; + item.useStyle = 1; + item.knockBack = 4f; + 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, "VerstaltiteBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 29); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120); + } + } +} diff --git a/Items/ShrineItems/CorruptionEffigy.cs b/Items/ShrineItems/CorruptionEffigy.cs index 82f72c08bb..59d9f6d8d4 100644 --- a/Items/ShrineItems/CorruptionEffigy.cs +++ b/Items/ShrineItems/CorruptionEffigy.cs @@ -30,4 +30,4 @@ namespace CalamityMod.Items.ShrineItems item.createTile = mod.TileType("CorruptionEffigy"); } } -} \ No newline at end of file +} diff --git a/Items/ShrineItems/CrimsonEffigy.cs b/Items/ShrineItems/CrimsonEffigy.cs index 34463691e4..5e19adf79a 100644 --- a/Items/ShrineItems/CrimsonEffigy.cs +++ b/Items/ShrineItems/CrimsonEffigy.cs @@ -30,4 +30,4 @@ namespace CalamityMod.Items.ShrineItems item.createTile = mod.TileType("CrimsonEffigy"); } } -} \ No newline at end of file +} diff --git a/Items/ShrineItems/FungalSymbiote.cs b/Items/ShrineItems/FungalSymbiote.cs index 9cb65d5395..34dcb7621c 100644 --- a/Items/ShrineItems/FungalSymbiote.cs +++ b/Items/ShrineItems/FungalSymbiote.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.ShrineItems modPlayer.fungalSymbiote = true; } } -} \ No newline at end of file +} diff --git a/Items/ShrineItems/GladiatorsLocket.cs b/Items/ShrineItems/GladiatorsLocket.cs index 1078b09430..23228f531d 100644 --- a/Items/ShrineItems/GladiatorsLocket.cs +++ b/Items/ShrineItems/GladiatorsLocket.cs @@ -61,4 +61,4 @@ namespace CalamityMod.Items.ShrineItems } } } -} \ No newline at end of file +} diff --git a/Items/ShrineItems/LuxorsGift.cs b/Items/ShrineItems/LuxorsGift.cs index c2e60f27cb..198a7c4461 100644 --- a/Items/ShrineItems/LuxorsGift.cs +++ b/Items/ShrineItems/LuxorsGift.cs @@ -33,4 +33,4 @@ namespace CalamityMod.Items.ShrineItems modPlayer.luxorsGift = true; } } -} \ No newline at end of file +} diff --git a/Items/ShrineItems/TrinketofChi.cs b/Items/ShrineItems/TrinketofChi.cs index 65a875c56d..059105e1b7 100644 --- a/Items/ShrineItems/TrinketofChi.cs +++ b/Items/ShrineItems/TrinketofChi.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Items.ShrineItems modPlayer.trinketOfChi = true; } } -} \ No newline at end of file +} diff --git a/Items/ShrineItems/UnstablePrism.cs b/Items/ShrineItems/UnstablePrism.cs index d752d597a3..0f963853c2 100644 --- a/Items/ShrineItems/UnstablePrism.cs +++ b/Items/ShrineItems/UnstablePrism.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Items.ShrineItems modPlayer.unstablePrism = true; } } -} \ No newline at end of file +} diff --git a/Items/SkyfringePickaxe.cs b/Items/SkyfringePickaxe.cs index 891d904804..dc61905c77 100644 --- a/Items/SkyfringePickaxe.cs +++ b/Items/SkyfringePickaxe.cs @@ -1,56 +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 -{ - public class SkyfringePickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skyfringe Pickaxe"); - Tooltip.SetDefault("Able to mine Hellstone"); - } - - public override void SetDefaults() - { - item.damage = 12; - item.melee = true; - item.width = 44; - item.height = 44; - item.useTime = 16; - item.useAnimation = 16; - item.useTurn = true; - item.pick = 95; - item.useStyle = 1; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 7); - recipe.AddIngredient(ItemID.SunplateBlock, 3); - recipe.AddTile(TileID.SkyMill); - 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, 59); - } - } - } -} \ No newline at end of file +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 +{ + public class SkyfringePickaxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skyfringe Pickaxe"); + Tooltip.SetDefault("Able to mine Hellstone"); + } + + public override void SetDefaults() + { + item.damage = 12; + item.melee = true; + item.width = 44; + item.height = 44; + item.useTime = 16; + item.useAnimation = 16; + item.useTurn = true; + item.pick = 95; + item.useStyle = 1; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 7); + recipe.AddIngredient(ItemID.SunplateBlock, 3); + recipe.AddTile(TileID.SkyMill); + 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, 59); + } + } + } +} diff --git a/Items/SlimeGod/ManaOverloader.cs b/Items/SlimeGod/ManaOverloader.cs index 21d3b4a597..d7dad08c51 100644 --- a/Items/SlimeGod/ManaOverloader.cs +++ b/Items/SlimeGod/ManaOverloader.cs @@ -1,39 +1,39 @@ -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.SlimeGod -{ - public class ManaOverloader : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mana Overloader"); - Tooltip.SetDefault("Increases max mana by 50 and magic damage by 6%\n" + - "Life regen lowered by 3 if mana is above 50% of its maximum\n" + - "Spectre healing if mana is below 10% of its maximum"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 30; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 9; - item.accessory = true; - item.expert = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.manaOverloader = true; - player.statManaMax2 += 50; - } - } -} \ No newline at end of file +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.SlimeGod +{ + public class ManaOverloader : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mana Overloader"); + Tooltip.SetDefault("Increases max mana by 50 and magic damage by 6%\n" + + "Life regen lowered by 3 if mana is above 50% of its maximum\n" + + "Spectre healing if mana is below 10% of its maximum"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 9; + item.accessory = true; + item.expert = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.manaOverloader = true; + player.statManaMax2 += 50; + } + } +} diff --git a/Items/SlimeGod/OverloadedSludge.cs b/Items/SlimeGod/OverloadedSludge.cs index 5b7bd90296..1bdf4712f9 100644 --- a/Items/SlimeGod/OverloadedSludge.cs +++ b/Items/SlimeGod/OverloadedSludge.cs @@ -1,64 +1,64 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.SlimeGod -{ - public class OverloadedSludge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Overloaded Sludge"); - Tooltip.SetDefault("It looks corrupted\n" + - "Summons the Slime God"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.rare = 4; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && - !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGod")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodRun")); - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodCore")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EbonianGel", 25); - recipe.AddIngredient(ItemID.EbonstoneBlock, 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EbonianGel", 25); - recipe.AddIngredient(ItemID.CrimstoneBlock, 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SlimeGod +{ + public class OverloadedSludge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Overloaded Sludge"); + Tooltip.SetDefault("It looks corrupted\n" + + "Summons the Slime God"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 20; + item.rare = 4; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && + !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGod")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodRun")); + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SlimeGodCore")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EbonianGel", 25); + recipe.AddIngredient(ItemID.EbonstoneBlock, 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EbonianGel", 25); + recipe.AddIngredient(ItemID.CrimstoneBlock, 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/SlimeGod/PurifiedGel.cs b/Items/SlimeGod/PurifiedGel.cs index ee71ab43bb..123073d5e4 100644 --- a/Items/SlimeGod/PurifiedGel.cs +++ b/Items/SlimeGod/PurifiedGel.cs @@ -1,28 +1,28 @@ -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.SlimeGod -{ - public class PurifiedGel : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Purified Gel"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 14; - item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 50, 0); - item.rare = 4; - } - } -} \ No newline at end of file +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.SlimeGod +{ + public class PurifiedGel : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Purified Gel"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 14; + item.maxStack = 999; + item.value = Item.buyPrice(0, 2, 50, 0); + item.rare = 4; + } + } +} diff --git a/Items/SlimeGod/SlimeGodBag.cs b/Items/SlimeGod/SlimeGodBag.cs index 4fa523af59..e1cd9b0b87 100644 --- a/Items/SlimeGod/SlimeGodBag.cs +++ b/Items/SlimeGod/SlimeGodBag.cs @@ -1,95 +1,95 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Items.SlimeGod -{ - public class SlimeGodBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("SlimeGodRun"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("ElectrolyteGelPack")); - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - int maskChoice = Main.rand.Next(2); - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("OverloadedBlaster")); - } - if (Main.rand.Next(7) == 0) - { - if (maskChoice == 0) - { - player.QuickSpawnItem(mod.ItemType("SlimeGodMask")); - } - else - { - player.QuickSpawnItem(mod.ItemType("SlimeGodMask2")); - } - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("AbyssalTome")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("EldritchTome")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("CrimslimeStaff")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("CorroslimeStaff")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("GelDart"), Main.rand.Next(100, 126)); - } - player.QuickSpawnItem(mod.ItemType("StaticRefiner")); - player.QuickSpawnItem(mod.ItemType("ManaOverloader")); - player.QuickSpawnItem(ItemID.Gel, Main.rand.Next(150, 201)); - player.QuickSpawnItem(mod.ItemType("PurifiedGel"), Main.rand.Next(30, 51)); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Items.SlimeGod +{ + public class SlimeGodBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("SlimeGodRun"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("ElectrolyteGelPack")); + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + int maskChoice = Main.rand.Next(2); + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("OverloadedBlaster")); + } + if (Main.rand.Next(7) == 0) + { + if (maskChoice == 0) + { + player.QuickSpawnItem(mod.ItemType("SlimeGodMask")); + } + else + { + player.QuickSpawnItem(mod.ItemType("SlimeGodMask2")); + } + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("AbyssalTome")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("EldritchTome")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("CrimslimeStaff")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("CorroslimeStaff")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("GelDart"), Main.rand.Next(100, 126)); + } + player.QuickSpawnItem(mod.ItemType("StaticRefiner")); + player.QuickSpawnItem(mod.ItemType("ManaOverloader")); + player.QuickSpawnItem(ItemID.Gel, Main.rand.Next(150, 201)); + player.QuickSpawnItem(mod.ItemType("PurifiedGel"), Main.rand.Next(30, 51)); + } + } +} diff --git a/Items/SquishyBeanMount.cs b/Items/SquishyBeanMount.cs index 066c7132a4..00d9f83ba9 100644 --- a/Items/SquishyBeanMount.cs +++ b/Items/SquishyBeanMount.cs @@ -1,30 +1,30 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items -{ - class SquishyBeanMount : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Suspicious Looking Jelly Bean"); - Tooltip.SetDefault("JELLY BEAN"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 1; - item.rare = 9; - item.value = Item.buyPrice(1, 0, 0, 0); - item.expert = true; - item.UseSound = SoundID.Item3; - item.noMelee = true; - item.mountType = mod.MountType("SquishyBean"); - } - } -} +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items +{ + class SquishyBeanMount : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Suspicious Looking Jelly Bean"); + Tooltip.SetDefault("JELLY BEAN"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 1; + item.rare = 9; + item.value = Item.buyPrice(1, 0, 0, 0); + item.expert = true; + item.UseSound = SoundID.Item3; + item.noMelee = true; + item.mountType = mod.MountType("SquishyBean"); + } + } +} diff --git a/Items/Stardust.cs b/Items/Stardust.cs index 679c9fed43..ae148bb32f 100644 --- a/Items/Stardust.cs +++ b/Items/Stardust.cs @@ -1,28 +1,28 @@ -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 -{ - public class Stardust : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stardust"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 18; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} \ No newline at end of file +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 +{ + public class Stardust : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stardust"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 18; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + } +} diff --git a/Items/StarlightFuelCell.cs b/Items/StarlightFuelCell.cs index 14d7f89201..64f87e07f4 100644 --- a/Items/StarlightFuelCell.cs +++ b/Items/StarlightFuelCell.cs @@ -1,55 +1,55 @@ -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 StarlightFuelCell : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starlight Fuel Cell"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.rare = 7; - item.useTime = 30; - item.useStyle = 4; - item.UseSound = SoundID.Item122; - item.consumable = true; - } - - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.adrenalineBoostTwo) - { - return false; - } - return true; - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.adrenalineBoostTwo = true; - } - return true; - } - } -} \ No newline at end of file +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 StarlightFuelCell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starlight Fuel Cell"); + Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.useAnimation = 30; + item.rare = 7; + item.useTime = 30; + item.useStyle = 4; + item.UseSound = SoundID.Item122; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.adrenalineBoostTwo) + { + return false; + } + return true; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.adrenalineBoostTwo = true; + } + return true; + } + } +} diff --git a/Items/StarterBag.cs b/Items/StarterBag.cs index 4b0517e49d..fcc53aa5c0 100644 --- a/Items/StarterBag.cs +++ b/Items/StarterBag.cs @@ -1,54 +1,54 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items -{ - public class StarterBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starter Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 1; - } - - public override bool CanRightClick() - { - return true; - } - - public override void RightClick(Player player) - { - player.QuickSpawnItem(ItemID.CopperBroadsword); //melee needs - player.QuickSpawnItem(ItemID.CopperBow); //ranged needs - player.QuickSpawnItem(ItemID.WoodenArrow, 100); - player.QuickSpawnItem(ItemID.AmethystStaff); //mage needs - player.QuickSpawnItem(ItemID.ManaCrystal); - player.QuickSpawnItem(mod.ItemType("WulfrumKnife"), 150); - player.QuickSpawnItem(ItemID.SlimeStaff); //summoner needs - player.QuickSpawnItem(ItemID.CopperHammer); //tool needs - player.QuickSpawnItem(ItemID.MiningPotion); //mining needs - player.QuickSpawnItem(ItemID.SpelunkerPotion, 2); //mining/treasure needs - player.QuickSpawnItem(ItemID.SwiftnessPotion, 3); //movement needs - player.QuickSpawnItem(ItemID.GillsPotion, 2); //abyss needs - player.QuickSpawnItem(ItemID.ShinePotion); //mining needs - player.QuickSpawnItem(ItemID.SlimeCrown); //speedruns lul needs - player.QuickSpawnItem(ItemID.Chest, 3); //storage needs - player.QuickSpawnItem(ItemID.Torch, 25); //speedruns lul needs - player.QuickSpawnItem(ItemID.Bomb, 10); //speedruns lul needs - player.QuickSpawnItem(mod.ItemType("Death")); - player.QuickSpawnItem(mod.ItemType("DefiledRune")); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - player.QuickSpawnItem(calamityModMusic.ItemType("CalamityMusicbox")); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items +{ + public class StarterBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starter Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 1; + } + + public override bool CanRightClick() + { + return true; + } + + public override void RightClick(Player player) + { + player.QuickSpawnItem(ItemID.CopperBroadsword); //melee needs + player.QuickSpawnItem(ItemID.CopperBow); //ranged needs + player.QuickSpawnItem(ItemID.WoodenArrow, 100); + player.QuickSpawnItem(ItemID.AmethystStaff); //mage needs + player.QuickSpawnItem(ItemID.ManaCrystal); + player.QuickSpawnItem(mod.ItemType("WulfrumKnife"), 150); + player.QuickSpawnItem(ItemID.SlimeStaff); //summoner needs + player.QuickSpawnItem(ItemID.CopperHammer); //tool needs + player.QuickSpawnItem(ItemID.MiningPotion); //mining needs + player.QuickSpawnItem(ItemID.SpelunkerPotion, 2); //mining/treasure needs + player.QuickSpawnItem(ItemID.SwiftnessPotion, 3); //movement needs + player.QuickSpawnItem(ItemID.GillsPotion, 2); //abyss needs + player.QuickSpawnItem(ItemID.ShinePotion); //mining needs + player.QuickSpawnItem(ItemID.SlimeCrown); //speedruns lul needs + player.QuickSpawnItem(ItemID.Chest, 3); //storage needs + player.QuickSpawnItem(ItemID.Torch, 25); //speedruns lul needs + player.QuickSpawnItem(ItemID.Bomb, 10); //speedruns lul needs + player.QuickSpawnItem(mod.ItemType("Death")); + player.QuickSpawnItem(mod.ItemType("DefiledRune")); + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + player.QuickSpawnItem(calamityModMusic.ItemType("CalamityMusicbox")); + } + } +} diff --git a/Items/StormlionMandible.cs b/Items/StormlionMandible.cs index 6fbc8c97a0..d25921d463 100644 --- a/Items/StormlionMandible.cs +++ b/Items/StormlionMandible.cs @@ -1,28 +1,28 @@ -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 -{ - public class StormlionMandible : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stormlion Mandible"); - } - - public override void SetDefaults() - { - item.width = 12; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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 +{ + public class StormlionMandible : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stormlion Mandible"); + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/SunkenSea/AmidiasPendant.cs b/Items/SunkenSea/AmidiasPendant.cs index 921ae2a276..7aa6cc79ab 100644 --- a/Items/SunkenSea/AmidiasPendant.cs +++ b/Items/SunkenSea/AmidiasPendant.cs @@ -1,81 +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.SunkenSea -{ - public class AmidiasPendant : ModItem - { - public const int ShardProjectiles = 2; - public const float ShardAngleSpread = 120; - public int ShardCountdown = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amidias' Pendant"); - Tooltip.SetDefault("Periodically rains down prism shards"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 46; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 2; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (ShardCountdown == 0) - { - ShardCountdown = 120; - } - if (ShardCountdown > 0) - { - ShardCountdown--; - if (ShardCountdown == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int speed2 = 25; - float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; - float spawnY = -1000 + player.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = player.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; - for (int i = 0; i < ShardProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - (ShardProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-ShardAngleSpread / 2 + (ShardAngleSpread * i / (float)ShardProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int type = 0; - int damage = 0; - switch (Main.rand.Next(3)) - { - case 0: type = mod.ProjectileType("PendantProjectile1"); - damage = 15; break; - case 1: type = mod.ProjectileType("PendantProjectile2"); - damage = 15; break; - case 2: type = mod.ProjectileType("PendantProjectile3"); - damage = 30; break; - } - int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X / 3, velocity.Y / 2, type, damage, 5f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].tileCollide = false; - Main.projectile[projectile].timeLeft = 220; - } - } - } - } - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class AmidiasPendant : ModItem + { + public const int ShardProjectiles = 2; + public const float ShardAngleSpread = 120; + public int ShardCountdown = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amidias' Pendant"); + Tooltip.SetDefault("Periodically rains down prism shards"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 46; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 2; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (ShardCountdown == 0) + { + ShardCountdown = 120; + } + if (ShardCountdown > 0) + { + ShardCountdown--; + if (ShardCountdown == 0) + { + if (player.whoAmI == Main.myPlayer) + { + int speed2 = 25; + float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; + float spawnY = -1000 + player.Center.Y; + Vector2 baseSpawn = new Vector2(spawnX, spawnY); + Vector2 baseVelocity = player.Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity = baseVelocity * speed2; + for (int i = 0; i < ShardProjectiles; i++) + { + Vector2 spawn = baseSpawn; + spawn.X = spawn.X + i * 30 - (ShardProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-ShardAngleSpread / 2 + (ShardAngleSpread * i / (float)ShardProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + int type = 0; + int damage = 0; + switch (Main.rand.Next(3)) + { + case 0: type = mod.ProjectileType("PendantProjectile1"); + damage = 15; break; + case 1: type = mod.ProjectileType("PendantProjectile2"); + damage = 15; break; + case 2: type = mod.ProjectileType("PendantProjectile3"); + damage = 30; break; + } + int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X / 3, velocity.Y / 2, type, damage, 5f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].tileCollide = false; + Main.projectile[projectile].timeLeft = 220; + } + } + } + } + } + } +} diff --git a/Items/SunkenSea/GiantPearl.cs b/Items/SunkenSea/GiantPearl.cs index 8a7a1db40b..95d6d6dfbd 100644 --- a/Items/SunkenSea/GiantPearl.cs +++ b/Items/SunkenSea/GiantPearl.cs @@ -1,38 +1,38 @@ -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.SunkenSea -{ - public class GiantPearl : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Giant Pearl"); - Tooltip.SetDefault("You have a light aura around you\n" + - "Enemies within the aura are slowed down\n" + - "Does not work on bosses"); - } - - public override void SetDefaults() - { - item.width = 42; - item.height = 32; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 2; - item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.giantPearl = true; - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.45f, 0.8f, 0.8f); - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class GiantPearl : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Giant Pearl"); + Tooltip.SetDefault("You have a light aura around you\n" + + "Enemies within the aura are slowed down\n" + + "Does not work on bosses"); + } + + public override void SetDefaults() + { + item.width = 42; + item.height = 32; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 2; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.giantPearl = true; + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.45f, 0.8f, 0.8f); + } + } +} diff --git a/Items/SunkenSea/MolluskHusk.cs b/Items/SunkenSea/MolluskHusk.cs index 574c17fe23..ab31fca8c8 100644 --- a/Items/SunkenSea/MolluskHusk.cs +++ b/Items/SunkenSea/MolluskHusk.cs @@ -1,29 +1,29 @@ -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.SunkenSea -{ - public class MolluskHusk : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mollusk Husk"); - Tooltip.SetDefault("The remains of a mollusk"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 28; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class MolluskHusk : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mollusk Husk"); + Tooltip.SetDefault("The remains of a mollusk"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 28; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + } +} diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index 7b191a0794..c0f906e773 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -1,70 +1,70 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class SuperDummy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Super Dummy"); - Tooltip.SetDefault("Creates a super dummy\n" + - "Regenerates 1 million life per second\n" + - "Will not die when taking damage over time from debuffs\n" + - "Right click to kill all super dummies"); - } - - public override void SetDefaults() - { - item.damage = 0; - item.width = 20; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 1; - item.useTurn = true; - item.value = 0; - item.rare = 1; - item.autoReuse = true; - } - - public override bool AltFunctionUse (Player player) - { - return true; - } - - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].type == mod.NPCType("SuperDummy")) - { - Main.npc[i].life = 0; - Main.npc[i].lifeRegen = 0; - Main.npc[i].checkDead(); - } - } - } - else if (player.whoAmI == Main.myPlayer) - { - int x = (int) Main.MouseWorld.X - 9; - int y = (int) Main.MouseWorld.Y - 20; - NPC.NewNPC(x, y, mod.NPCType("SuperDummy")); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TargetDummy); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class SuperDummy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Super Dummy"); + Tooltip.SetDefault("Creates a super dummy\n" + + "Regenerates 1 million life per second\n" + + "Will not die when taking damage over time from debuffs\n" + + "Right click to kill all super dummies"); + } + + public override void SetDefaults() + { + item.damage = 0; + item.width = 20; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 1; + item.useTurn = true; + item.value = 0; + item.rare = 1; + item.autoReuse = true; + } + + public override bool AltFunctionUse (Player player) + { + return true; + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].type == mod.NPCType("SuperDummy")) + { + Main.npc[i].life = 0; + Main.npc[i].lifeRegen = 0; + Main.npc[i].checkDead(); + } + } + } + else if (player.whoAmI == Main.myPlayer) + { + int x = (int) Main.MouseWorld.X - 9; + int y = (int) Main.MouseWorld.Y - 20; + NPC.NewNPC(x, y, mod.NPCType("SuperDummy")); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TargetDummy); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/SupremeCalamitas/EyeofExtinction.cs b/Items/SupremeCalamitas/EyeofExtinction.cs index d343c29211..243313a171 100644 --- a/Items/SupremeCalamitas/EyeofExtinction.cs +++ b/Items/SupremeCalamitas/EyeofExtinction.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Items.SupremeCalamitas -{ - public class EyeofExtinction : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eye of Extinction"); - Tooltip.SetDefault("Death\n" + - "Summons Supreme Calamitas\n" + - "Creates a large square arena of blocks around your player\n" + - "Your player is the CENTER of the arena so be sure to use this item in a good location\n" + - "Not consumable"); - } - - public override void SetDefaults() - { - item.width = 40; - item.height = 40; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")) && CalamityWorld.downedBossAny; - } - - public override bool UseItem(Player player) - { - int surface = (int)Main.worldSurface; - for (int i = 0; i < Main.maxTilesX; i++) - { - for (int j = 0; j < surface; j++) - { - if (Main.tile[i, j] != null) - { - if (Main.tile[i, j].type == mod.TileType("ArenaTile")) - { - WorldGen.KillTile(i, j, false, false, false); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); - } - else - { - WorldGen.SquareTileFrame(i, j, true); - } - } - } - } - } - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SupremeCalamitas")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AuricOre", 50); - recipe.AddIngredient(null, "NightmareFuel", 30); - recipe.AddIngredient(null, "EndothermicEnergy", 30); - recipe.AddIngredient(null, "DarksunFragment", 25); - recipe.AddIngredient(null, "CosmiliteBar", 15); - recipe.AddIngredient(null, "Phantoplasm", 15); - recipe.AddIngredient(null, "HellcasterFragment", 5); - recipe.AddIngredient(null, "BlightedEyeball"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Items.SupremeCalamitas +{ + public class EyeofExtinction : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of Extinction"); + Tooltip.SetDefault("Death\n" + + "Summons Supreme Calamitas\n" + + "Creates a large square arena of blocks around your player\n" + + "Your player is the CENTER of the arena so be sure to use this item in a good location\n" + + "Not consumable"); + } + + public override void SetDefaults() + { + item.width = 40; + item.height = 40; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")) && CalamityWorld.downedBossAny; + } + + public override bool UseItem(Player player) + { + int surface = (int)Main.worldSurface; + for (int i = 0; i < Main.maxTilesX; i++) + { + for (int j = 0; j < surface; j++) + { + if (Main.tile[i, j] != null) + { + if (Main.tile[i, j].type == mod.TileType("ArenaTile")) + { + WorldGen.KillTile(i, j, false, false, false); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); + } + else + { + WorldGen.SquareTileFrame(i, j, true); + } + } + } + } + } + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("SupremeCalamitas")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AuricOre", 50); + recipe.AddIngredient(null, "NightmareFuel", 30); + recipe.AddIngredient(null, "EndothermicEnergy", 30); + recipe.AddIngredient(null, "DarksunFragment", 25); + recipe.AddIngredient(null, "CosmiliteBar", 15); + recipe.AddIngredient(null, "Phantoplasm", 15); + recipe.AddIngredient(null, "HellcasterFragment", 5); + recipe.AddIngredient(null, "BlightedEyeball"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/TheDevourerofGods/CosmicWorm.cs b/Items/TheDevourerofGods/CosmicWorm.cs index 2158a62c4f..da193e8363 100644 --- a/Items/TheDevourerofGods/CosmicWorm.cs +++ b/Items/TheDevourerofGods/CosmicWorm.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; -using CalamityMod.World; - -namespace CalamityMod.Items.TheDevourerofGods -{ - public class CosmicWorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Worm"); - Tooltip.SetDefault("Summons the Devourer of Gods\n" + - "Not consumable"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")) && !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")) && CalamityWorld.DoGSecondStageCountdown <= 0 && CalamityWorld.downedBossAny; - } - - public override bool UseItem(Player player) - { - string key = "Mods.CalamityMod.EdgyBossText12"; - Color messageColor = Color.Cyan; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DevourerofGodsHead")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ArmoredShell", 3); - recipe.AddIngredient(null, "TwistingNether"); - recipe.AddIngredient(null, "DarkPlasma"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; +using CalamityMod.World; + +namespace CalamityMod.Items.TheDevourerofGods +{ + public class CosmicWorm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Worm"); + Tooltip.SetDefault("Summons the Devourer of Gods\n" + + "Not consumable"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + return !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")) && !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")) && CalamityWorld.DoGSecondStageCountdown <= 0 && CalamityWorld.downedBossAny; + } + + public override bool UseItem(Player player) + { + string key = "Mods.CalamityMod.EdgyBossText12"; + Color messageColor = Color.Cyan; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("DevourerofGodsHead")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ArmoredShell", 3); + recipe.AddIngredient(null, "TwistingNether"); + recipe.AddIngredient(null, "DarkPlasma"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/TheDevourerofGods/CosmiliteBar.cs b/Items/TheDevourerofGods/CosmiliteBar.cs index 393b8a7631..2a6c707bec 100644 --- a/Items/TheDevourerofGods/CosmiliteBar.cs +++ b/Items/TheDevourerofGods/CosmiliteBar.cs @@ -1,37 +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.TheDevourerofGods -{ - public class CosmiliteBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmilite Bar"); - Tooltip.SetDefault("A chunk of highly-resistant cosmic steel"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0f * num, 0.5f * num); - } - } -} \ No newline at end of file +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.TheDevourerofGods +{ + public class CosmiliteBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmilite Bar"); + Tooltip.SetDefault("A chunk of highly-resistant cosmic steel"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 7, 0, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0f * num, 0.5f * num); + } + } +} diff --git a/Items/TheDevourerofGods/DevourerofGodsBag.cs b/Items/TheDevourerofGods/DevourerofGodsBag.cs index 4f35ba0e2e..dde871efe6 100644 --- a/Items/TheDevourerofGods/DevourerofGodsBag.cs +++ b/Items/TheDevourerofGods/DevourerofGodsBag.cs @@ -1,124 +1,124 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.World; - -namespace CalamityMod.Items.TheDevourerofGods -{ - public class DevourerofGodsBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("DevourerofGodsHeadS"); - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(18f, 20f); //18, 17 - spriteBatch.Draw(mod.GetTexture("Items/TheDevourerofGods/DevourerofGodsBagGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - if (player.GetModPlayer(mod).fabsolVodka) - { - player.QuickSpawnItem(mod.ItemType("Fabsol")); - } - if (CalamityWorld.death && player.difficulty == 2) - { - player.QuickSpawnItem(mod.ItemType("CosmicPlushie")); - } - if (Main.rand.Next(100) == 0) - { - player.QuickSpawnItem(mod.ItemType("CosmicDischarge")); - } - else if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - player.QuickSpawnItem(mod.ItemType("CosmicDischarge")); - } - } - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - 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")); - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("DevourerofGodsMask")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Eradicator")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Excelsus")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("TheObliterator")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("EradicatorMelee")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("Deathwind")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("StaffoftheMechworm")); - } - player.QuickSpawnItem(mod.ItemType("CosmiliteBar"), Main.rand.Next(30, 40)); - player.QuickSpawnItem(mod.ItemType("NebulousCore")); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.World; + +namespace CalamityMod.Items.TheDevourerofGods +{ + public class DevourerofGodsBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("DevourerofGodsHeadS"); + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(18f, 20f); //18, 17 + spriteBatch.Draw(mod.GetTexture("Items/TheDevourerofGods/DevourerofGodsBagGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + if (player.GetModPlayer(mod).fabsolVodka) + { + player.QuickSpawnItem(mod.ItemType("Fabsol")); + } + if (CalamityWorld.death && player.difficulty == 2) + { + player.QuickSpawnItem(mod.ItemType("CosmicPlushie")); + } + if (Main.rand.Next(100) == 0) + { + player.QuickSpawnItem(mod.ItemType("CosmicDischarge")); + } + else if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + player.QuickSpawnItem(mod.ItemType("CosmicDischarge")); + } + } + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + 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")); + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("DevourerofGodsMask")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Eradicator")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Excelsus")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("TheObliterator")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("EradicatorMelee")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("Deathwind")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("StaffoftheMechworm")); + } + player.QuickSpawnItem(mod.ItemType("CosmiliteBar"), Main.rand.Next(30, 40)); + player.QuickSpawnItem(mod.ItemType("NebulousCore")); + } + } +} diff --git a/Items/TheDevourerofGods/NebulousCore.cs b/Items/TheDevourerofGods/NebulousCore.cs index 9aca1fe187..cd596a3e44 100644 --- a/Items/TheDevourerofGods/NebulousCore.cs +++ b/Items/TheDevourerofGods/NebulousCore.cs @@ -1,120 +1,120 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.TheDevourerofGods -{ - public class NebulousCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nebulous Core"); - Tooltip.SetDefault("12% increased damage\n" + - "Summons floating nebula stars to protect you\n" + - "You have a 10% chance to survive an attack that would have killed you\n" + - "If this effect activates you will be healed by 100 HP"); - } - - public override void SetDefaults() - { - item.width = 16; - item.height = 14; - item.value = Item.buyPrice(0, 60, 0, 0); - item.accessory = true; - item.expert = true; - item.rare = 9; - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.35f * num, 0.05f * num, 0.35f * num); - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.nCore = true; - player.magicDamage += 0.12f; - player.meleeDamage += 0.12f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; - player.rangedDamage += 0.12f; - player.minionDamage += 0.12f; - int damage = 1500; - float knockBack = 3f; - 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("NebulaStar")) - { - num++; - } - } - if (Main.rand.Next(15) >= num && num < 10) - { - 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("NebulaStar") && (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("NebulaStar"), damage, knockBack, player.whoAmI, 0f, 0f); - return; - } - } - } - } - } - } - } - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.TheDevourerofGods +{ + public class NebulousCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nebulous Core"); + Tooltip.SetDefault("12% increased damage\n" + + "Summons floating nebula stars to protect you\n" + + "You have a 10% chance to survive an attack that would have killed you\n" + + "If this effect activates you will be healed by 100 HP"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 14; + item.value = Item.buyPrice(0, 60, 0, 0); + item.accessory = true; + item.expert = true; + item.rare = 9; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.35f * num, 0.05f * num, 0.35f * num); + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.nCore = true; + player.magicDamage += 0.12f; + player.meleeDamage += 0.12f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.12f; + player.rangedDamage += 0.12f; + player.minionDamage += 0.12f; + int damage = 1500; + float knockBack = 3f; + 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("NebulaStar")) + { + num++; + } + } + if (Main.rand.Next(15) >= num && num < 10) + { + 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("NebulaStar") && (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("NebulaStar"), damage, knockBack, player.whoAmI, 0f, 0f); + return; + } + } + } + } + } + } + } + } + } +} diff --git a/Items/TrapperBulb.cs b/Items/TrapperBulb.cs index 126b5e9331..493375896c 100644 --- a/Items/TrapperBulb.cs +++ b/Items/TrapperBulb.cs @@ -1,28 +1,28 @@ -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 -{ - public class TrapperBulb : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trapper Bulb"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} \ No newline at end of file +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 +{ + public class TrapperBulb : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trapper Bulb"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + } +} diff --git a/Items/TrashmanTrashcan.cs b/Items/TrashmanTrashcan.cs index 32cb846494..c76a1a6f9c 100644 --- a/Items/TrashmanTrashcan.cs +++ b/Items/TrashmanTrashcan.cs @@ -1,40 +1,40 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class TrashmanTrashcan : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trash Can"); - Tooltip.SetDefault("Summons the trash man"); - } - 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(0, 1, 0, 0); - item.shoot = mod.ProjectileType("DannyDevito"); - item.buffType = mod.BuffType("DannyDevito"); - item.rare = 5; - item.UseSound = SoundID.NPCDeath13; - } - - public override void UseStyle(Player player) - { - if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - { - player.AddBuff(item.buffType, 15, true); - } - } - } -} +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class TrashmanTrashcan : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trash Can"); + Tooltip.SetDefault("Summons the trash man"); + } + 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(0, 1, 0, 0); + item.shoot = mod.ProjectileType("DannyDevito"); + item.buffType = mod.BuffType("DannyDevito"); + item.rare = 5; + item.UseSound = SoundID.NPCDeath13; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 15, true); + } + } + } +} diff --git a/Items/UeliaceBar.cs b/Items/UeliaceBar.cs index d4036ebb6d..f530eb4a45 100644 --- a/Items/UeliaceBar.cs +++ b/Items/UeliaceBar.cs @@ -1,38 +1,38 @@ -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 -{ - public class UeliaceBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Uelibloom Bar"); - } - - public override void SetDefaults() - { - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UelibloomOre", 5); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class UeliaceBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Uelibloom Bar"); + } + + public override void SetDefaults() + { + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UelibloomOre", 5); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/UnholyCore.cs b/Items/UnholyCore.cs index 80f94fcb64..43cbe6a91e 100644 --- a/Items/UnholyCore.cs +++ b/Items/UnholyCore.cs @@ -1,38 +1,38 @@ -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 -{ - public class UnholyCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Unholy Core"); - } - - public override void SetDefaults() - { - item.width = 15; - item.height = 12; - item.maxStack = 999; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 6; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CharredOre", 4); - recipe.AddIngredient(ItemID.Hellstone, 4); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class UnholyCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Unholy Core"); + } + + public override void SetDefaults() + { + item.width = 15; + item.height = 12; + item.maxStack = 999; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 6; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CharredOre", 4); + recipe.AddIngredient(ItemID.Hellstone, 4); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/VerstaltiteBar.cs b/Items/VerstaltiteBar.cs index 3649005b35..341da0b491 100644 --- a/Items/VerstaltiteBar.cs +++ b/Items/VerstaltiteBar.cs @@ -1,37 +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 -{ - public class VerstaltiteBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryonic Bar"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryonicOre", 5); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class VerstaltiteBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryonic Bar"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryonicOre", 5); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/VictideBar.cs b/Items/VictideBar.cs index 8604bd219a..fc28e1937a 100644 --- a/Items/VictideBar.cs +++ b/Items/VictideBar.cs @@ -1,40 +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 -{ - public class VictideBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Victide Bar"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 2; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictoryShard"); - recipe.AddIngredient(ItemID.Coral); - recipe.AddIngredient(ItemID.Starfish); - recipe.AddIngredient(ItemID.Seashell); - recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class VictideBar : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Victide Bar"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 50, 0); + item.rare = 2; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictoryShard"); + recipe.AddIngredient(ItemID.Coral); + recipe.AddIngredient(ItemID.Starfish); + recipe.AddIngredient(ItemID.Seashell); + recipe.AddTile(TileID.Furnaces); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AMR.cs b/Items/Weapons/AMR.cs index 3c2707dad9..73dbeb8f33 100644 --- a/Items/Weapons/AMR.cs +++ b/Items/Weapons/AMR.cs @@ -1,64 +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 -{ - public class AMR : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Anti-materiel Rifle"); - Tooltip.SetDefault("Fires a .50 caliber sniper round that rips apart enemy defense and DR\n" + - "If you crit the target a second swarm of bullets will fire near the target"); - } - - public override void SetDefaults() - { - item.damage = 7000; - item.ranged = true; - item.width = 76; - item.crit += 20; - item.height = 30; - item.useTime = 60; - item.useAnimation = 60; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 9.5f; - 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 = 14; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Shroomer"); - recipe.AddIngredient(null, "CosmiliteBar", 10); - 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) - { - 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 +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 AMR : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anti-materiel Rifle"); + Tooltip.SetDefault("Fires a .50 caliber sniper round that rips apart enemy defense and DR\n" + + "If you crit the target a second swarm of bullets will fire near the target"); + } + + public override void SetDefaults() + { + item.damage = 7000; + item.ranged = true; + item.width = 76; + item.crit += 20; + item.height = 30; + item.useTime = 60; + item.useAnimation = 60; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 9.5f; + 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 = 14; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Shroomer"); + recipe.AddIngredient(null, "CosmiliteBar", 10); + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AMR"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/AbyssBlade.cs b/Items/Weapons/AbyssBlade.cs index 653713c654..e127fc3e56 100644 --- a/Items/Weapons/AbyssBlade.cs +++ b/Items/Weapons/AbyssBlade.cs @@ -1,66 +1,66 @@ -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 -{ - public class AbyssBlade : ModItem - { +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 +{ + public class AbyssBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Abyss Blade"); - 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" + + 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 = 110; - item.melee = true; - item.useAnimation = 17; - item.useTime = 17; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("DepthOrb"); - item.shootSpeed = 9f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DepthBlade"); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(null, "DepthCells", 15); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - 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, 33); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 300); - } - } -} + public override void SetDefaults() + { + item.width = 60; + item.damage = 110; + item.melee = true; + item.useAnimation = 17; + item.useTime = 17; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("DepthOrb"); + item.shootSpeed = 9f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DepthBlade"); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddIngredient(null, "DepthCells", 15); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 5); + 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, 33); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 300); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/Archerfish.cs b/Items/Weapons/AbyssWeapons/Archerfish.cs index 47142e0e14..a9bd115dc2 100644 --- a/Items/Weapons/AbyssWeapons/Archerfish.cs +++ b/Items/Weapons/AbyssWeapons/Archerfish.cs @@ -1,51 +1,51 @@ -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.AbyssWeapons -{ - public class Archerfish : 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.Weapons.AbyssWeapons +{ + public class Archerfish : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Archerfish"); Tooltip.SetDefault("Fires a stream of water"); } - public override void SetDefaults() - { - item.damage = 23; - item.ranged = true; - item.width = 78; - item.height = 36; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Archerfish"); - item.shootSpeed = 11f; - item.useAmmo = 97; - } - - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Archerfish"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 23; + item.ranged = true; + item.width = 78; + item.height = 36; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Archerfish"); + item.shootSpeed = 11f; + item.useAmmo = 97; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Archerfish"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/AbyssWeapons/BallOFugu.cs b/Items/Weapons/AbyssWeapons/BallOFugu.cs index cbe93dbaee..1f64dd2cb5 100644 --- a/Items/Weapons/AbyssWeapons/BallOFugu.cs +++ b/Items/Weapons/AbyssWeapons/BallOFugu.cs @@ -1,41 +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.Weapons.AbyssWeapons -{ - public class BallOFugu : 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.Weapons.AbyssWeapons +{ + public class BallOFugu : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ball O' Fugu"); Tooltip.SetDefault("Throws a fish that spews homing spikes"); } - public override void SetDefaults() - { - item.damage = 40; - item.melee = true; - item.width = 30; - item.height = 10; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = mod.ProjectileType("BallOFugu"); - item.shootSpeed = 12f; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 40; + item.melee = true; + item.width = 30; + item.height = 10; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.knockBack = 8f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.channel = true; + item.shoot = mod.ProjectileType("BallOFugu"); + item.shootSpeed = 12f; + } + } +} diff --git a/Items/Weapons/AbyssWeapons/BlackAnurian.cs b/Items/Weapons/AbyssWeapons/BlackAnurian.cs index 47a7967766..a1cd442c0b 100644 --- a/Items/Weapons/AbyssWeapons/BlackAnurian.cs +++ b/Items/Weapons/AbyssWeapons/BlackAnurian.cs @@ -1,58 +1,58 @@ -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.AbyssWeapons -{ - public class BlackAnurian : 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.Weapons.AbyssWeapons +{ + public class BlackAnurian : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Black Anurian"); Tooltip.SetDefault("Spews bubbles and homing plankton"); } - public override void SetDefaults() - { - item.damage = 40; - item.magic = true; - item.mana = 10; - item.width = 58; - item.height = 38; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item111; - item.autoReuse = true; - item.shootSpeed = 8f; - item.shoot = mod.ProjectileType("BlackAnurian"); - } - - 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) - { - int num6 = 2; - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("BlackAnurianPlankton"), (int)((double)damage * 0.5), knockBack, player.whoAmI, 0.0f, 0.0f); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * 0.5), knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 40; + item.magic = true; + item.mana = 10; + item.width = 58; + item.height = 38; + item.useTime = 14; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.75f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item111; + item.autoReuse = true; + item.shootSpeed = 8f; + item.shoot = mod.ProjectileType("BlackAnurian"); + } + + 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) + { + int num6 = 2; + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("BlackAnurianPlankton"), (int)((double)damage * 0.5), knockBack, player.whoAmI, 0.0f, 0.0f); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * 0.5), knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/AbyssWeapons/CalamarisLament.cs b/Items/Weapons/AbyssWeapons/CalamarisLament.cs index 5818882af1..9e22789109 100644 --- a/Items/Weapons/AbyssWeapons/CalamarisLament.cs +++ b/Items/Weapons/AbyssWeapons/CalamarisLament.cs @@ -1,73 +1,73 @@ -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.Weapons.AbyssWeapons -{ - public class CalamarisLament : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamari's Lament"); - Tooltip.SetDefault("Summons a squid to fight for you"); - } - - public override void SetDefaults() - { - item.damage = 158; - item.mana = 10; - item.width = 62; - item.height = 62; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item83; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Calamari"); - item.shootSpeed = 10f; - item.summon = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - 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 +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.Weapons.AbyssWeapons +{ + public class CalamarisLament : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamari's Lament"); + Tooltip.SetDefault("Summons a squid to fight for you"); + } + + public override void SetDefaults() + { + item.damage = 158; + item.mana = 10; + item.width = 62; + item.height = 62; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item83; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Calamari"); + item.shootSpeed = 10f; + item.summon = true; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + 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); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/DreadmineStaff.cs b/Items/Weapons/AbyssWeapons/DreadmineStaff.cs index 0697b3408b..9352cd43f4 100644 --- a/Items/Weapons/AbyssWeapons/DreadmineStaff.cs +++ b/Items/Weapons/AbyssWeapons/DreadmineStaff.cs @@ -1,68 +1,68 @@ -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.Weapons.AbyssWeapons -{ - public class DreadmineStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dreadmine Staff"); - Tooltip.SetDefault("Summons a dreadmine turret to fight for you"); - } - - public override void SetDefaults() - { - item.damage = 60; - item.mana = 10; - item.width = 44; - item.height = 44; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item113; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DreadmineTurret"); - item.shootSpeed = 10f; - item.summon = true; - item.sentry = 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) - { - 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 void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 30); - recipe.AddIngredient(null, "Tenebris", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Weapons.AbyssWeapons +{ + public class DreadmineStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dreadmine Staff"); + Tooltip.SetDefault("Summons a dreadmine turret to fight for you"); + } + + public override void SetDefaults() + { + item.damage = 60; + item.mana = 10; + item.width = 44; + item.height = 44; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 4.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item113; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DreadmineTurret"); + item.shootSpeed = 10f; + item.summon = true; + item.sentry = 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) + { + 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 void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 30); + recipe.AddIngredient(null, "Tenebris", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/EidolicWail.cs b/Items/Weapons/AbyssWeapons/EidolicWail.cs index 98e6e89832..816e18b163 100644 --- a/Items/Weapons/AbyssWeapons/EidolicWail.cs +++ b/Items/Weapons/AbyssWeapons/EidolicWail.cs @@ -1,48 +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.AbyssWeapons -{ - public class EidolicWail : 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.Weapons.AbyssWeapons +{ + public class EidolicWail : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Eidolic Wail"); - Tooltip.SetDefault("Earrape\n" + + Tooltip.SetDefault("Earrape\n" + "Fires a string of bouncing sound waves that become stronger as they travel"); } - public override void SetDefaults() - { - item.damage = 210; - item.magic = true; - item.mana = 10; - item.width = 60; - item.height = 60; - item.useTime = 12; - item.reuseDelay = 30; - item.useAnimation = 36; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"); - item.autoReuse = true; - item.shootSpeed = 5f; - item.shoot = mod.ProjectileType("EidolicWail"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 210; + item.magic = true; + item.mana = 10; + item.width = 60; + item.height = 60; + item.useTime = 12; + item.reuseDelay = 30; + item.useAnimation = 36; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"); + item.autoReuse = true; + item.shootSpeed = 5f; + item.shoot = mod.ProjectileType("EidolicWail"); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/FlakKraken.cs b/Items/Weapons/AbyssWeapons/FlakKraken.cs index 90d1729300..26469ba2b6 100644 --- a/Items/Weapons/AbyssWeapons/FlakKraken.cs +++ b/Items/Weapons/AbyssWeapons/FlakKraken.cs @@ -1,58 +1,58 @@ -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.AbyssWeapons -{ - public class FlakKraken : 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.Weapons.AbyssWeapons +{ + public class FlakKraken : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Flak Kraken"); Tooltip.SetDefault("Fires an energy reticle that becomes more powerful over time"); } - public override void SetDefaults() - { - item.damage = 54; - item.ranged = true; - item.width = 16; - item.height = 16; - item.useTime = 10; - item.useAnimation = 10; - item.reuseDelay = 5; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.shoot = mod.ProjectileType("FlakKrakenGun"); - item.shootSpeed = 30f; //30 - } - - 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("FlakKrakenGun"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DepthCells", 30); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 54; + item.ranged = true; + item.width = 16; + item.height = 16; + item.useTime = 10; + item.useAnimation = 10; + item.reuseDelay = 5; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 0f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.shoot = mod.ProjectileType("FlakKrakenGun"); + item.shootSpeed = 30f; //30 + } + + 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("FlakKrakenGun"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DepthCells", 30); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/HalibutCannon.cs b/Items/Weapons/AbyssWeapons/HalibutCannon.cs index da1c8cc325..0487368d2d 100644 --- a/Items/Weapons/AbyssWeapons/HalibutCannon.cs +++ b/Items/Weapons/AbyssWeapons/HalibutCannon.cs @@ -1,63 +1,63 @@ -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.AbyssWeapons -{ - public class HalibutCannon : 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.Weapons.AbyssWeapons +{ + public class HalibutCannon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Halibut Cannon"); - Tooltip.SetDefault("This weapon is overpowered, use at the risk of ruining your playthrough\n" + - "Revengeance drop"); + Tooltip.SetDefault("This weapon is overpowered, use at the risk of ruining your playthrough\n" + + "Revengeance drop"); } - public override void SetDefaults() - { - item.damage = 6; - item.ranged = true; - item.width = 108; - item.height = 54; - item.useTime = 10; - item.useAnimation = 20; - item.useStyle = 5; - item.rare = 10; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(1, 0, 0, 0); - item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 97; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 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) - { - if (Main.hardMode) { item.damage = 12; } - if (NPC.downedMoonlord) { item.damage = 24; } - int num6 = Main.rand.Next(25, 36); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - 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; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[shot].timeLeft = 180; - } - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 6; + item.ranged = true; + item.width = 108; + item.height = 54; + item.useTime = 10; + item.useAnimation = 20; + item.useStyle = 5; + item.rare = 10; + item.noMelee = true; + item.knockBack = 1f; + item.value = Item.buyPrice(1, 0, 0, 0); + item.UseSound = SoundID.Item38; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 97; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 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) + { + if (Main.hardMode) { item.damage = 12; } + if (NPC.downedMoonlord) { item.damage = 24; } + int num6 = Main.rand.Next(25, 36); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + 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; + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[shot].timeLeft = 180; + } + return false; + } + } +} diff --git a/Items/Weapons/AbyssWeapons/HerringStaff.cs b/Items/Weapons/AbyssWeapons/HerringStaff.cs index 367bd25d6e..58ccd36529 100644 --- a/Items/Weapons/AbyssWeapons/HerringStaff.cs +++ b/Items/Weapons/AbyssWeapons/HerringStaff.cs @@ -1,72 +1,72 @@ -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.Weapons.AbyssWeapons -{ - public class HerringStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Herring Staff"); - Tooltip.SetDefault("Summons a herring to fight for you"); - } - - public override void SetDefaults() - { - item.damage = 20; - item.mana = 10; - item.width = 46; - item.height = 46; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 1.25f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Herring"); - item.shootSpeed = 10f; - item.summon = true; - } - - 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 +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.Weapons.AbyssWeapons +{ + public class HerringStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Herring Staff"); + Tooltip.SetDefault("Summons a herring to fight for you"); + } + + public override void SetDefaults() + { + item.damage = 20; + item.mana = 10; + item.width = 46; + item.height = 46; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 1.25f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item21; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Herring"); + item.shootSpeed = 10f; + item.summon = true; + } + + 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); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/SoulEdge.cs b/Items/Weapons/AbyssWeapons/SoulEdge.cs index 1a55332fa3..bce8a34293 100644 --- a/Items/Weapons/AbyssWeapons/SoulEdge.cs +++ b/Items/Weapons/AbyssWeapons/SoulEdge.cs @@ -1,62 +1,62 @@ -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.AbyssWeapons -{ - public class SoulEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Edge"); - Tooltip.SetDefault("Fires the ghastly souls of long-deceased abyss dwellers"); - } - - public override void SetDefaults() - { - item.width = 88; - item.damage = 365; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 88; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("GhastlySoulLarge"); - item.shootSpeed = 12f; - 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 SpeedA = speedX; - float SpeedB = speedY; - int num6 = Main.rand.Next(2, 4); - 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; - float ai1 = (Main.rand.NextFloat() + 0.5f); - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, Main.rand.Next(type, type + 3), (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, ai1); - } - return false; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - } - } -} +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.AbyssWeapons +{ + public class SoulEdge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Edge"); + Tooltip.SetDefault("Fires the ghastly souls of long-deceased abyss dwellers"); + } + + public override void SetDefaults() + { + item.width = 88; + item.damage = 365; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 88; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("GhastlySoulLarge"); + item.shootSpeed = 12f; + 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 SpeedA = speedX; + float SpeedB = speedY; + int num6 = Main.rand.Next(2, 4); + 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; + float ai1 = (Main.rand.NextFloat() + 0.5f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, Main.rand.Next(type, type + 3), (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, ai1); + } + return false; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs index 5b9e9ef6e7..a7d4cd34b5 100644 --- a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs +++ b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.cs @@ -1,45 +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.Weapons.AbyssWeapons -{ - public class SulphuricAcidCannon : 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.Weapons.AbyssWeapons +{ + public class SulphuricAcidCannon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphuric Acid Cannon"); Tooltip.SetDefault("Fires an acidic bubble that sticks to enemies and emits sulphuric gas"); } - public override void SetDefaults() - { - item.damage = 220; - item.ranged = true; - item.width = 90; - item.height = 30; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; - item.autoReuse = true; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item95; - item.shoot = mod.ProjectileType("SulphuricAcidCannon2"); - item.shootSpeed = 7f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 220; + item.ranged = true; + item.width = 90; + item.height = 30; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.autoReuse = true; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item95; + item.shoot = mod.ProjectileType("SulphuricAcidCannon2"); + item.shootSpeed = 7f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/TyphonsGreed.cs b/Items/Weapons/AbyssWeapons/TyphonsGreed.cs index fc97e102f5..1e60077487 100644 --- a/Items/Weapons/AbyssWeapons/TyphonsGreed.cs +++ b/Items/Weapons/AbyssWeapons/TyphonsGreed.cs @@ -1,52 +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.Weapons.AbyssWeapons -{ - public class TyphonsGreed : 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.Weapons.AbyssWeapons +{ + public class TyphonsGreed : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Typhon's Greed"); Tooltip.SetDefault("Summons water spirits while in use"); } - public override void SetDefaults() - { - item.damage = 75; - item.melee = true; - item.width = 16; - item.height = 16; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.DD2_SkyDragonsFurySwing; - item.autoReuse = true; - item.channel = true; - item.shoot = mod.ProjectileType("TyphonsGreedStaff"); - item.shootSpeed = 24f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DepthCells", 30); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 75; + item.melee = true; + item.width = 16; + item.height = 16; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.DD2_SkyDragonsFurySwing; + item.autoReuse = true; + item.channel = true; + item.shoot = mod.ProjectileType("TyphonsGreedStaff"); + item.shootSpeed = 24f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DepthCells", 30); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AbyssWeapons/UndinesRetribution.cs b/Items/Weapons/AbyssWeapons/UndinesRetribution.cs index 7362f55754..51f1d8c2cc 100644 --- a/Items/Weapons/AbyssWeapons/UndinesRetribution.cs +++ b/Items/Weapons/AbyssWeapons/UndinesRetribution.cs @@ -1,100 +1,100 @@ -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.AbyssWeapons -{ - public class UndinesRetribution : 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.Weapons.AbyssWeapons +{ + public class UndinesRetribution : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Undine's Retribution"); - Tooltip.SetDefault("Casts a swarm of homing spears"); - Item.staff[item.type] = true; + Tooltip.SetDefault("Casts a swarm of homing spears"); + Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 30; - item.magic = true; - item.mana = 15; - item.width = 64; - item.height = 64; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item66; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("UndinesRetribution"); - } - - 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)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - for (int num108 = 0; num108 < 3; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); //200 - 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 speedX6 = num78 + (float)Main.rand.Next(-60, 61) * 0.02f; - float speedY7 = num79 + (float)Main.rand.Next(-60, 61) * 0.02f; - float ai1 = (Main.rand.NextFloat() + 0.5f); - int bullet2 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, -speedY7, type, damage, knockBack, player.whoAmI, 0.0f, ai1); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DepthCells", 30); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 30; + item.magic = true; + item.mana = 15; + item.width = 64; + item.height = 64; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item66; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("UndinesRetribution"); + } + + 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)); + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + for (int num108 = 0; num108 < 3; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); //200 + 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 speedX6 = num78 + (float)Main.rand.Next(-60, 61) * 0.02f; + float speedY7 = num79 + (float)Main.rand.Next(-60, 61) * 0.02f; + float ai1 = (Main.rand.NextFloat() + 0.5f); + int bullet2 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, -speedY7, type, damage, knockBack, player.whoAmI, 0.0f, ai1); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DepthCells", 30); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AccelerationBullet.cs b/Items/Weapons/AccelerationBullet.cs index f64dcacdd8..b87315f03f 100644 --- a/Items/Weapons/AccelerationBullet.cs +++ b/Items/Weapons/AccelerationBullet.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class AccelerationBullet : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class AccelerationBullet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Acceleration Round"); Tooltip.SetDefault("Gains speed over time"); } - public override void SetDefaults() - { - item.damage = 9; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = 250; - item.rare = 1; - item.shoot = mod.ProjectileType("AccelerationBullet"); - item.shootSpeed = 1f; - item.ammo = 97; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 150); - recipe.AddIngredient(null, "VictoryShard"); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 150); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 9; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.25f; + item.value = 250; + item.rare = 1; + item.shoot = mod.ProjectileType("AccelerationBullet"); + item.shootSpeed = 1f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MusketBall, 150); + recipe.AddIngredient(null, "VictoryShard"); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AccretionDiskMelee.cs b/Items/Weapons/AccretionDiskMelee.cs index 42806952a1..68aaa069f6 100644 --- a/Items/Weapons/AccretionDiskMelee.cs +++ b/Items/Weapons/AccretionDiskMelee.cs @@ -1,55 +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.Weapons -{ - public class AccretionDiskMelee : 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.Weapons +{ + public class AccretionDiskMelee : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Disk"); Tooltip.SetDefault("Throws a disk that has a chance to generate several disks if enemies are near it"); - } - - public override void SetDefaults() - { - item.width = 38; - item.damage = 157; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 38; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("AccretionDiskMelee"); - item.shootSpeed = 13f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MangroveChakramMelee"); - recipe.AddIngredient(null, "FlameScytheMelee"); - recipe.AddIngredient(null, "SeashellBoomerangMelee"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + } + + public override void SetDefaults() + { + item.width = 38; + item.damage = 157; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 9f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 38; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("AccretionDiskMelee"); + item.shootSpeed = 13f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MangroveChakramMelee"); + recipe.AddIngredient(null, "FlameScytheMelee"); + recipe.AddIngredient(null, "SeashellBoomerangMelee"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AcidBullet.cs b/Items/Weapons/AcidBullet.cs index 6205b18031..299837133d 100644 --- a/Items/Weapons/AcidBullet.cs +++ b/Items/Weapons/AcidBullet.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class AcidBullet : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class AcidBullet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Round"); - Tooltip.SetDefault("Explodes into acid that inflicts the plague\n" + + Tooltip.SetDefault("Explodes into acid that inflicts the plague\n" + "Does more damage the higher the target's defense"); } - public override void SetDefaults() - { - item.damage = 28; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 1250; - item.rare = 8; - item.shoot = mod.ProjectileType("AcidBullet"); - item.shootSpeed = 10f; - item.ammo = 97; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 150); - recipe.AddIngredient(null, "PlagueCellCluster"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 150); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 28; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 1250; + item.rare = 8; + item.shoot = mod.ProjectileType("AcidBullet"); + item.shootSpeed = 10f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MusketBall, 150); + recipe.AddIngredient(null, "PlagueCellCluster"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AegisBlade.cs b/Items/Weapons/AegisBlade.cs index 0649249212..57398ebf33 100644 --- a/Items/Weapons/AegisBlade.cs +++ b/Items/Weapons/AegisBlade.cs @@ -1,95 +1,95 @@ -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 -{ - public class AegisBlade : ModItem - { +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 +{ + public class AegisBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Aegis Blade"); - Tooltip.SetDefault("Legendary Drop\n" + + Tooltip.SetDefault("Legendary Drop\n" + "Striking an enemy with the blade causes an earthen eruption\n" + - "Right click to fire an aegis bolt that costs 4 mana\n" + + "Right click to fire an aegis bolt that costs 4 mana\n" + "Revengeance drop"); } - public override void SetDefaults() - { - item.width = 44; - item.damage = 61; - item.melee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.rare = 7; - item.value = Item.buyPrice(0, 60, 0, 0); - item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("NobodyKnows"); - item.GetGlobalItem(mod).postMoonLordRarity = 17; - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.noMelee = true; - item.mana = 4; - item.useTime = 20; - item.useAnimation = 20; - item.UseSound = SoundID.Item73; - } - else - { - item.noMelee = false; - item.mana = 0; - item.useTime = 15; - item.useAnimation = 15; - item.UseSound = SoundID.Item1; - } - 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("AegisBeam"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NobodyKnows"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } - - 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, 246, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); - } - } - - 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("AegisBlast"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } -} + public override void SetDefaults() + { + item.width = 44; + item.damage = 61; + item.melee = true; + item.useAnimation = 20; + item.useTime = 20; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 4.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; + item.rare = 7; + item.value = Item.buyPrice(0, 60, 0, 0); + item.shootSpeed = 9f; + item.shoot = mod.ProjectileType("NobodyKnows"); + item.GetGlobalItem(mod).postMoonLordRarity = 17; + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.noMelee = true; + item.mana = 4; + item.useTime = 20; + item.useAnimation = 20; + item.UseSound = SoundID.Item73; + } + else + { + item.noMelee = false; + item.mana = 0; + item.useTime = 15; + item.useAnimation = 15; + item.UseSound = SoundID.Item1; + } + 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("AegisBeam"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NobodyKnows"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } + + 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, 246, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); + } + } + + 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("AegisBlast"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } +} diff --git a/Items/Weapons/Aeries.cs b/Items/Weapons/Aeries.cs index 8749c8405e..d344b072f3 100644 --- a/Items/Weapons/Aeries.cs +++ b/Items/Weapons/Aeries.cs @@ -1,62 +1,62 @@ -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 Aeries : 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.Weapons +{ + public class Aeries : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Aeries"); Tooltip.SetDefault("Fires shockblast rounds that can steal enemy life"); } - public override void SetDefaults() - { - item.damage = 35; - item.ranged = true; - item.width = 50; - item.height = 32; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - 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; - } - - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ShockblastRound"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreBar, 5); - recipe.AddIngredient(null, "CursedCapper"); - recipe.AddIngredient(ItemID.ShroomiteBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 35; + item.ranged = true; + item.width = 50; + item.height = 32; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + 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; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ShockblastRound"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SpectreBar, 5); + recipe.AddIngredient(null, "CursedCapper"); + recipe.AddIngredient(ItemID.ShroomiteBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AethersWhisper.cs b/Items/Weapons/AethersWhisper.cs index b314b35823..821e49e39e 100644 --- a/Items/Weapons/AethersWhisper.cs +++ b/Items/Weapons/AethersWhisper.cs @@ -1,88 +1,88 @@ -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 AethersWhisper : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aether's Whisper"); - Tooltip.SetDefault("Inflicts several long-lasting debuffs and splits on tile hits\n" + - "Right click to change from magic to ranged damage"); - } - - public override void SetDefaults() - { - item.damage = 1050; - item.magic = true; - item.mana = 30; - item.width = 118; - item.height = 38; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("AetherBeam"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.ranged = true; - item.magic = false; - item.mana = 0; - } - else - { - item.ranged = false; - item.magic = true; - item.mana = 30; - } - return base.CanUseItem(player); - } - - public override 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"); - recipe.AddIngredient(null, "Zapper"); - recipe.AddIngredient(null, "SpectreRifle"); - recipe.AddIngredient(null, "TwistingNether", 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 AethersWhisper : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aether's Whisper"); + Tooltip.SetDefault("Inflicts several long-lasting debuffs and splits on tile hits\n" + + "Right click to change from magic to ranged damage"); + } + + public override void SetDefaults() + { + item.damage = 1050; + item.magic = true; + item.mana = 30; + item.width = 118; + item.height = 38; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("AetherBeam"); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.ranged = true; + item.magic = false; + item.mana = 0; + } + else + { + item.ranged = false; + item.magic = true; + item.mana = 30; + } + return base.CanUseItem(player); + } + + public override 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"); + recipe.AddIngredient(null, "Zapper"); + recipe.AddIngredient(null, "SpectreRifle"); + recipe.AddIngredient(null, "TwistingNether", 3); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Aftershock.cs b/Items/Weapons/Aftershock.cs index 6fde54e98e..495304f59f 100644 --- a/Items/Weapons/Aftershock.cs +++ b/Items/Weapons/Aftershock.cs @@ -1,93 +1,93 @@ -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 Aftershock : 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.Weapons +{ + public class Aftershock : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Aftershock"); Tooltip.SetDefault("Summons boulders from the sky on enemy hits"); } - public override void SetDefaults() - { - item.damage = 60; - item.melee = true; - item.width = 54; - item.height = 58; - item.useTime = 28; - item.useAnimation = 28; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = 12f; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 120); - 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; - 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); - 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(-10, 11) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("Aftershock"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, (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, 32); - } - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 60; + item.melee = true; + item.width = 54; + item.height = 58; + item.useTime = 28; + item.useAnimation = 28; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.shootSpeed = 12f; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 120); + 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; + 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); + 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(-10, 11) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("Aftershock"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, (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, 32); + } + } + } +} diff --git a/Items/Weapons/AirSpinner.cs b/Items/Weapons/AirSpinner.cs index c74ad0dbe1..7541d383af 100644 --- a/Items/Weapons/AirSpinner.cs +++ b/Items/Weapons/AirSpinner.cs @@ -1,45 +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.Weapons -{ - public class AirSpinner : 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.Weapons +{ + public class AirSpinner : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Air Spinner"); Tooltip.SetDefault("Fires feathers when enemies are near"); } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Valor); - item.damage = 20; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.autoReuse = false; - item.shoot = mod.ProjectileType("AirSpinnerProjectile"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 6); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Valor); + item.damage = 20; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 4; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.autoReuse = false; + item.shoot = mod.ProjectileType("AirSpinnerProjectile"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 6); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Alluvion.cs b/Items/Weapons/Alluvion.cs index fece75a150..c976f1ce94 100644 --- a/Items/Weapons/Alluvion.cs +++ b/Items/Weapons/Alluvion.cs @@ -1,102 +1,102 @@ -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 -{ - public class Alluvion : 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; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class Alluvion : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Alluvion"); - Tooltip.SetDefault("Moderate chance to convert wooden arrows to sharks\n" + - "Low chance to convert wooden arrows to typhoon arrows\n" + + Tooltip.SetDefault("Moderate chance to convert wooden arrows to sharks\n" + + "Low chance to convert wooden arrows to typhoon arrows\n" + "Fires a torrent of ten arrows at once"); - } - - public override void SetDefaults() - { - item.damage = 90; - item.ranged = true; - item.width = 60; - item.height = 90; - item.useTime = 9; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 17f; - item.useAmmo = 40; - 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) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 10; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 20f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - if (type == ProjectileID.WoodenArrowFriendly) - { - if (Main.rand.Next(12) == 0) - { - type = mod.ProjectileType("TorrentialArrow"); - } - if (Main.rand.Next(25) == 0) - { - type = 408; - } - if (Main.rand.Next(100) == 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(null, "Monsoon"); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 20); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 90; + item.ranged = true; + item.width = 60; + item.height = 90; + item.useTime = 9; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 17f; + item.useAmmo = 40; + 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) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 10; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 20f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + if (type == ProjectileID.WoodenArrowFriendly) + { + if (Main.rand.Next(12) == 0) + { + type = mod.ProjectileType("TorrentialArrow"); + } + if (Main.rand.Next(25) == 0) + { + type = 408; + } + if (Main.rand.Next(100) == 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(null, "Monsoon"); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 20); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AlphaRay.cs b/Items/Weapons/AlphaRay.cs index 430ff7f4b9..423ec4ce67 100644 --- a/Items/Weapons/AlphaRay.cs +++ b/Items/Weapons/AlphaRay.cs @@ -1,98 +1,98 @@ -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 AlphaRay : 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.Weapons +{ + public class AlphaRay : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Alpha Ray"); - Tooltip.SetDefault("Disintegrates everything with a tri-beam of energy and lasers\n" + + Tooltip.SetDefault("Disintegrates everything with a tri-beam of energy and lasers\n" + "Right click to fire a Y-shaped beam of destructive energy and a spread of lasers"); } - public override void SetDefaults() - { - item.damage = 240; - item.magic = true; - item.mana = 5; - item.width = 84; - item.height = 74; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = mod.ProjectileType("ParticleBeamofDoom"); - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - 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) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BigBeamofDeath"), (int)((double)damage * 1.7), knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - else - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 80f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage * 0.8), knockBack, player.whoAmI, 0.0f, 0.0f); - int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, 440, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[laser].timeLeft = 120; - Main.projectile[laser].tileCollide = false; - } - return false; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "DarksunFragment", 15); - recipe.AddIngredient(null, "Wingman", 2); - recipe.AddIngredient(null, "Genisis"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 240; + item.magic = true; + item.mana = 5; + item.width = 84; + item.height = 74; + item.useTime = 3; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shootSpeed = 6f; + item.shoot = mod.ProjectileType("ParticleBeamofDoom"); + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + 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) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BigBeamofDeath"), (int)((double)damage * 1.7), knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + else + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 3; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 80f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage * 0.8), knockBack, player.whoAmI, 0.0f, 0.0f); + int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, 440, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[laser].timeLeft = 120; + Main.projectile[laser].tileCollide = false; + } + return false; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "DarksunFragment", 15); + recipe.AddIngredient(null, "Wingman", 2); + recipe.AddIngredient(null, "Genisis"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AnarchyBlade.cs b/Items/Weapons/AnarchyBlade.cs index 328b094332..18a2d9a52c 100644 --- a/Items/Weapons/AnarchyBlade.cs +++ b/Items/Weapons/AnarchyBlade.cs @@ -1,82 +1,82 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items.Weapons -{ - public class AnarchyBlade : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.Weapons +{ + public class AnarchyBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Anarchy Blade"); - Tooltip.SetDefault("The lower your life the more damage this blade does\n" + - "Your hits will generate a large explosion\n" + + Tooltip.SetDefault("The lower your life the more damage this blade does\n" + + "Your hits will generate a large explosion\n" + "If you're below 50% life your hits have a chance to instantly kill regular enemies"); } - public override void SetDefaults() - { - item.width = 98; - item.damage = 110; - item.melee = true; - item.useAnimation = 19; - item.useTime = 19; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 98; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 5); - recipe.AddIngredient(null, "CoreofChaos", 3); - recipe.AddIngredient(ItemID.BrokenHeroSword); - 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, 235); - } - } - - public override void GetWeaponDamage(Player player, ref int damage) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - float damageAdd = (((float)lifeAmount * 0.1f) + (float)item.damage); - damage = (int)(damageAdd * player.meleeDamage); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 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) - { - if (!CalamityPlayer.areThereAnyDamnBosses && CalamityGlobalNPC.ShouldAffectNPC(target)) - { - target.life = 0; - target.HitEffect(0, 10.0); - target.active = false; - target.NPCLoot(); - } - } - } - } -} + public override void SetDefaults() + { + item.width = 98; + item.damage = 110; + item.melee = true; + item.useAnimation = 19; + item.useTime = 19; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 98; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 5); + recipe.AddIngredient(null, "CoreofChaos", 3); + recipe.AddIngredient(ItemID.BrokenHeroSword); + 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, 235); + } + } + + public override void GetWeaponDamage(Player player, ref int damage) + { + int lifeAmount = player.statLifeMax2 - player.statLife; + float damageAdd = (((float)lifeAmount * 0.1f) + (float)item.damage); + damage = (int)(damageAdd * player.meleeDamage); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 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) + { + if (!CalamityPlayer.areThereAnyDamnBosses && CalamityGlobalNPC.ShouldAffectNPC(target)) + { + target.life = 0; + target.HitEffect(0, 10.0); + target.active = false; + target.NPCLoot(); + } + } + } + } +} diff --git a/Items/Weapons/AncientCrusher.cs b/Items/Weapons/AncientCrusher.cs index c02d87312c..bfcd231504 100644 --- a/Items/Weapons/AncientCrusher.cs +++ b/Items/Weapons/AncientCrusher.cs @@ -1,53 +1,53 @@ -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 AncientCrusher : 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.Weapons +{ + public class AncientCrusher : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient Crusher"); Tooltip.SetDefault("Summons fossil spikes on enemy hits"); } - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Amber, 8); - recipe.AddIngredient(ItemID.FossilOre, 35); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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); - } - } -} + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Amber, 8); + recipe.AddIngredient(ItemID.FossilOre, 35); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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); + } + } +} diff --git a/Items/Weapons/AncientIceChunk.cs b/Items/Weapons/AncientIceChunk.cs index 47acee77aa..fc0189453f 100644 --- a/Items/Weapons/AncientIceChunk.cs +++ b/Items/Weapons/AncientIceChunk.cs @@ -1,77 +1,77 @@ -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.Weapons -{ - public class AncientIceChunk : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient Ice Chunk"); - Tooltip.SetDefault("Summons an ice clasper to fight for you"); - } - - public override void SetDefaults() - { - item.damage = 35; - item.mana = 10; - item.width = 30; - item.height = 30; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item30; - item.autoReuse = true; - item.shoot = mod.ProjectileType("IceClasper"); - 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; - 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; - } - } -} \ No newline at end of file +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.Weapons +{ + public class AncientIceChunk : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient Ice Chunk"); + Tooltip.SetDefault("Summons an ice clasper to fight for you"); + } + + public override void SetDefaults() + { + item.damage = 35; + item.mana = 10; + item.width = 30; + item.height = 30; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item30; + item.autoReuse = true; + item.shoot = mod.ProjectileType("IceClasper"); + 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; + 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; + } + } +} diff --git a/Items/Weapons/AncientShiv.cs b/Items/Weapons/AncientShiv.cs index 62a351e7b9..f605aa84e2 100644 --- a/Items/Weapons/AncientShiv.cs +++ b/Items/Weapons/AncientShiv.cs @@ -1,53 +1,53 @@ -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 -{ - public class AncientShiv : ModItem - { +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 +{ + public class AncientShiv : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient Shiv"); Tooltip.SetDefault("Enemies release a blue aura cloud on death"); } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 30; - item.height = 30; - item.damage = 35; - item.melee = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - } - - 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, 15); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BlueAura"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } -} + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 12; + item.useTime = 12; + item.width = 30; + item.height = 30; + item.damage = 35; + item.melee = true; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + } + + 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, 15); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BlueAura"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } +} diff --git a/Items/Weapons/Animosity.cs b/Items/Weapons/Animosity.cs index 8fa41bf3a8..bc49ec6b98 100644 --- a/Items/Weapons/Animosity.cs +++ b/Items/Weapons/Animosity.cs @@ -1,98 +1,98 @@ -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 Animosity : 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.Weapons +{ + public class Animosity : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Animosity"); Tooltip.SetDefault("50% chance to not consume ammo\n" + "Fires a powerful sniper round\n" + - "Right click to fire a burst of bullets\n" + + "Right click to fire a burst of bullets\n" + "Revengeance drop"); } - public override void SetDefaults() - { - item.damage = 25; - item.ranged = true; - item.width = 70; - item.height = 18; - item.useTime = 4; - item.reuseDelay = 15; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 11f; - item.useAmmo = 97; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 4; - item.reuseDelay = 13; - item.useAnimation = 12; - item.UseSound = SoundID.Item31; - item.shootSpeed = 10f; - } - else - { - item.useTime = 35; - item.reuseDelay = 0; - item.useAnimation = 35; - item.UseSound = SoundID.Item40; - item.shootSpeed = 15f; - } - 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) - { - 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); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 242, (int)((double)damage * 5.8f), knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.width = 70; + item.height = 18; + item.useTime = 4; + item.reuseDelay = 15; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 11f; + item.useAmmo = 97; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 4; + item.reuseDelay = 13; + item.useAnimation = 12; + item.UseSound = SoundID.Item31; + item.shootSpeed = 10f; + } + else + { + item.useTime = 35; + item.reuseDelay = 0; + item.useAnimation = 35; + item.UseSound = SoundID.Item40; + item.shootSpeed = 15f; + } + 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) + { + 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); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 242, (int)((double)damage * 5.8f), knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } + } +} diff --git a/Items/Weapons/Animus.cs b/Items/Weapons/Animus.cs index c88ffd0fbd..22140bcb2f 100644 --- a/Items/Weapons/Animus.cs +++ b/Items/Weapons/Animus.cs @@ -1,78 +1,78 @@ -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 Animus : 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.Weapons +{ + public class Animus : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Animus"); Tooltip.SetDefault("Randomizes its damage on enemy hits"); } - public override void SetDefaults() - { - item.width = 84; - item.damage = 4000; - item.melee = true; - item.useAnimation = 11; - item.useStyle = 1; - item.useTime = 11; - item.useTurn = true; - item.knockBack = 20f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 90; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BladeofEnmity"); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 6000); - int damageRan = Main.rand.Next(195); //0 to 195 - if (damageRan >= 50 && damageRan <= 99) //25% - { - item.damage = 6000; - } - else if (damageRan >= 100 && damageRan <= 139) //20% - { - item.damage = 9000; - } - else if (damageRan >= 140 && damageRan <= 169) //15% - { - item.damage = 15000; - } - else if (damageRan >= 170 && damageRan <= 189) //10% - { - item.damage = 30000; - } - else if (damageRan >= 190 && damageRan <= 194) //5% - { - item.damage = 50000; - } - else - { - item.damage = 4000; - } - } - } -} + public override void SetDefaults() + { + item.width = 84; + item.damage = 4000; + item.melee = true; + item.useAnimation = 11; + item.useStyle = 1; + item.useTime = 11; + item.useTurn = true; + item.knockBack = 20f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 90; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BladeofEnmity"); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 6000); + int damageRan = Main.rand.Next(195); //0 to 195 + if (damageRan >= 50 && damageRan <= 99) //25% + { + item.damage = 6000; + } + else if (damageRan >= 100 && damageRan <= 139) //20% + { + item.damage = 9000; + } + else if (damageRan >= 140 && damageRan <= 169) //15% + { + item.damage = 15000; + } + else if (damageRan >= 170 && damageRan <= 189) //10% + { + item.damage = 30000; + } + else if (damageRan >= 190 && damageRan <= 194) //5% + { + item.damage = 50000; + } + else + { + item.damage = 4000; + } + } + } +} diff --git a/Items/Weapons/ApoctosisArray.cs b/Items/Weapons/ApoctosisArray.cs index 28f25cdc15..a264ebb1ab 100644 --- a/Items/Weapons/ApoctosisArray.cs +++ b/Items/Weapons/ApoctosisArray.cs @@ -1,65 +1,65 @@ -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 -{ - public class ApoctosisArray : ModItem - { +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 +{ + public class ApoctosisArray : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Apoctosis Array"); - Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + + Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + "The higher your mana the more damage they will do"); } - public override void SetDefaults() - { - item.width = 98; - item.damage = 58; - item.magic = true; - item.mana = 12; - item.useAnimation = 7; - item.useTime = 7; - item.useStyle = 5; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item91; - item.autoReuse = true; - item.noMelee = true; - item.height = 34; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("IonBlast"); - item.shootSpeed = 8f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 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 manaAmount = ((float)player.statMana * 0.01f); - float damageMult = manaAmount; - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].scale = (manaAmount * 0.375f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IonBlaster"); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 98; + item.damage = 58; + item.magic = true; + item.mana = 12; + item.useAnimation = 7; + item.useTime = 7; + item.useStyle = 5; + item.knockBack = 6.75f; + item.UseSound = SoundID.Item91; + item.autoReuse = true; + item.noMelee = true; + item.height = 34; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("IonBlast"); + item.shootSpeed = 8f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-25, 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 manaAmount = ((float)player.statMana * 0.01f); + float damageMult = manaAmount; + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].scale = (manaAmount * 0.375f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IonBlaster"); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Apotheosis.cs b/Items/Weapons/Apotheosis.cs index 80f5d24bcb..5f368dae09 100644 --- a/Items/Weapons/Apotheosis.cs +++ b/Items/Weapons/Apotheosis.cs @@ -1,58 +1,58 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons -{ - public class Apotheosis : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Apotheosis"); - Tooltip.SetDefault("Unleashes interdimensional projection magic\n" + - "Eat worms"); - } - - public override void SetDefaults() - { - item.damage = 333; - item.magic = true; - item.mana = 42; - item.width = 16; - item.height = 16; - item.useTime = 42; - item.useAnimation = 42; - item.useStyle = 5; - item.useTurn = false; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ApothMark"); - item.shootSpeed = 15; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SubsumingVortex"); - recipe.AddIngredient(null, "CosmicDischarge"); - recipe.AddIngredient(null, "StaffoftheMechworm", 3); - recipe.AddIngredient(null, "Excelsus", 2); - recipe.AddIngredient(null, "DarksunFragment", 77); - recipe.AddIngredient(null, "NightmareFuel", 77); - recipe.AddIngredient(null, "EndothermicEnergy", 77); - recipe.AddIngredient(null, "CosmiliteBar", 77); - recipe.AddIngredient(null, "Phantoplasm", 77); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons +{ + public class Apotheosis : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Apotheosis"); + Tooltip.SetDefault("Unleashes interdimensional projection magic\n" + + "Eat worms"); + } + + public override void SetDefaults() + { + item.damage = 333; + item.magic = true; + item.mana = 42; + item.width = 16; + item.height = 16; + item.useTime = 42; + item.useAnimation = 42; + item.useStyle = 5; + item.useTurn = false; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item92; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ApothMark"); + item.shootSpeed = 15; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SubsumingVortex"); + recipe.AddIngredient(null, "CosmicDischarge"); + recipe.AddIngredient(null, "StaffoftheMechworm", 3); + recipe.AddIngredient(null, "Excelsus", 2); + recipe.AddIngredient(null, "DarksunFragment", 77); + recipe.AddIngredient(null, "NightmareFuel", 77); + recipe.AddIngredient(null, "EndothermicEnergy", 77); + recipe.AddIngredient(null, "CosmiliteBar", 77); + recipe.AddIngredient(null, "Phantoplasm", 77); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AquaticDissolution.cs b/Items/Weapons/AquaticDissolution.cs index 43ec0d29b9..3b35ebfab2 100644 --- a/Items/Weapons/AquaticDissolution.cs +++ b/Items/Weapons/AquaticDissolution.cs @@ -1,71 +1,71 @@ -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 -{ - public class AquaticDissolution : ModItem - { +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 +{ + public class AquaticDissolution : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Aquatic Dissolution"); Tooltip.SetDefault("Fires aquatic jets from the sky that bounce off tiles"); } - public override void SetDefaults() - { - item.width = 50; - item.damage = 165; - item.melee = true; - item.useAnimation = 16; - item.useTime = 16; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.height = 72; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("OceanBeam"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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 x = 0; x < 3; x++) - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-100, 100), player.position.Y - 600f, 0f, 8f, type, damage, knockBack, Main.myPlayer, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Mariana"); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(null, "BarofLife", 2); - recipe.AddIngredient(null, "Lumenite", 20); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 33, (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 SetDefaults() + { + item.width = 50; + item.damage = 165; + item.melee = true; + item.useAnimation = 16; + item.useTime = 16; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.height = 72; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("OceanBeam"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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 x = 0; x < 3; x++) + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-100, 100), player.position.Y - 600f, 0f, 8f, type, damage, knockBack, Main.myPlayer, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Mariana"); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(null, "BarofLife", 2); + recipe.AddIngredient(null, "Lumenite", 20); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 33, (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; + } + } + } +} diff --git a/Items/Weapons/AquaticScourge/Barinautical.cs b/Items/Weapons/AquaticScourge/Barinautical.cs index eedeab1204..018f2ddf7d 100644 --- a/Items/Weapons/AquaticScourge/Barinautical.cs +++ b/Items/Weapons/AquaticScourge/Barinautical.cs @@ -1,47 +1,47 @@ -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.AquaticScourge -{ - public class Barinautical : 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.Weapons.AquaticScourge +{ + public class Barinautical : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Barinautical"); Tooltip.SetDefault("Shoots a string of electric bolt arrows that explode"); - } - - public override void SetDefaults() - { - item.damage = 25; - item.ranged = true; - item.width = 30; - item.height = 42; - item.useTime = 2; - item.reuseDelay = 15; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 15f; - item.useAmmo = 40; - } - - 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("BoltArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.width = 30; + item.height = 42; + item.useTime = 2; + item.reuseDelay = 15; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 15f; + item.useAmmo = 40; + } + + 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("BoltArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/AquaticScourge/DeepseaStaff.cs b/Items/Weapons/AquaticScourge/DeepseaStaff.cs index fde63de6ed..b1fa883b4e 100644 --- a/Items/Weapons/AquaticScourge/DeepseaStaff.cs +++ b/Items/Weapons/AquaticScourge/DeepseaStaff.cs @@ -1,72 +1,72 @@ -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.Weapons.AquaticScourge -{ - public class DeepseaStaff : ModItem - { +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.Weapons.AquaticScourge +{ + public class DeepseaStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Deepsea Staff"); Tooltip.SetDefault("Summons an aquatic star to fight for you"); } - - public override void SetDefaults() - { - item.damage = 48; - item.mana = 10; - item.width = 46; - item.height = 46; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AquaticStar"); - item.shootSpeed = 10f; - item.summon = true; - } - - 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 + + public override void SetDefaults() + { + item.damage = 48; + item.mana = 10; + item.width = 46; + item.height = 46; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AquaticStar"); + item.shootSpeed = 10f; + item.summon = true; + } + + 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); + } + } +} diff --git a/Items/Weapons/AquaticScourge/Downpour.cs b/Items/Weapons/AquaticScourge/Downpour.cs index 6962ee8937..2d6127355e 100644 --- a/Items/Weapons/AquaticScourge/Downpour.cs +++ b/Items/Weapons/AquaticScourge/Downpour.cs @@ -1,47 +1,47 @@ -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.AquaticScourge -{ - public class Downpour : 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.Weapons.AquaticScourge +{ + public class Downpour : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Downpour"); Tooltip.SetDefault("Fires a spray of water that drips extra trails of water"); Item.staff[item.type] = true; } - - public override void SetDefaults() - { - item.damage = 43; - item.magic = true; - item.mana = 10; - item.width = 42; - item.height = 42; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item13; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WaterStream"); - item.shootSpeed = 14f; - } - - 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, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 43; + item.magic = true; + item.mana = 10; + item.width = 42; + item.height = 42; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item13; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WaterStream"); + item.shootSpeed = 14f; + } + + 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, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/AquaticScourge/SubmarineShocker.cs b/Items/Weapons/AquaticScourge/SubmarineShocker.cs index 8b1e936fcb..1da0fcc371 100644 --- a/Items/Weapons/AquaticScourge/SubmarineShocker.cs +++ b/Items/Weapons/AquaticScourge/SubmarineShocker.cs @@ -1,50 +1,50 @@ -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.AquaticScourge -{ - public class SubmarineShocker : ModItem - { +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.AquaticScourge +{ + public class SubmarineShocker : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Submarine Shocker"); Tooltip.SetDefault("Enemies release electric sparks on hit"); } - - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 32; - item.height = 32; - item.damage = 70; - item.melee = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - } - - 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, 226); - } - } - - 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("Spark"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } -} + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 10; + item.useTime = 10; + item.width = 32; + item.height = 32; + item.damage = 70; + item.melee = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + } + + 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, 226); + } + } + + 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("Spark"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } +} diff --git a/Items/Weapons/ArchAmaryllis.cs b/Items/Weapons/ArchAmaryllis.cs index f4ebaf5d36..f9d73356fc 100644 --- a/Items/Weapons/ArchAmaryllis.cs +++ b/Items/Weapons/ArchAmaryllis.cs @@ -1,16 +1,16 @@ -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 ArchAmaryllis : 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.Weapons +{ + public class ArchAmaryllis : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Arch Amaryllis"); @@ -18,34 +18,34 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 75; - 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 = 7.5f; - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GleamingMagnolia"); - recipe.AddIngredient(ItemID.FragmentNebula, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 75; + 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 = 7.5f; + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GleamingMagnolia"); + recipe.AddIngredient(ItemID.FragmentNebula, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ArcticArrow.cs b/Items/Weapons/ArcticArrow.cs index a3817bbc6c..13b098dd6d 100644 --- a/Items/Weapons/ArcticArrow.cs +++ b/Items/Weapons/ArcticArrow.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class ArcticArrow : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class ArcticArrow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Arctic Arrow"); Tooltip.SetDefault("Freezes enemies for a short time"); } - public override void SetDefaults() - { - item.damage = 16; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 1200; - item.rare = 3; - item.shoot = mod.ProjectileType("ArcticArrow"); - item.shootSpeed = 13f; - item.ammo = 40; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar"); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 16; + item.ranged = true; + item.width = 22; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 1200; + item.rare = 3; + item.shoot = mod.ProjectileType("ArcticArrow"); + item.shootSpeed = 13f; + item.ammo = 40; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar"); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ArkoftheAncients.cs b/Items/Weapons/ArkoftheAncients.cs index e177fdbdd3..d250b0d0aa 100644 --- a/Items/Weapons/ArkoftheAncients.cs +++ b/Items/Weapons/ArkoftheAncients.cs @@ -1,150 +1,150 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.Items.Weapons -{ - public class ArkoftheAncients : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class ArkoftheAncients : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Ancients"); Tooltip.SetDefault("A heavenly blade forged to vanquish all evil"); } - public override void SetDefaults() - { - item.width = 50; - item.damage = 55; - item.melee = true; - item.useAnimation = 22; - item.useTime = 22; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = mod.ProjectileType("EonBeam"); - item.shootSpeed = 12f; - } - - 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(2)) - { - case 0: type = mod.ProjectileType("EonBeam"); break; - case 1: type = 173; break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - float num72 = Main.rand.Next(18, 25); - damage = Main.rand.Next(40, 60); - 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 = 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); - 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(-120, 121) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddIngredient(null, "EssenceofEleum", 3); - recipe.AddIngredient(ItemID.Starfury); - recipe.AddIngredient(ItemID.EnchantedSword); - recipe.AddIngredient(ItemID.Excalibur); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddIngredient(null, "EssenceofEleum", 3); - recipe.AddIngredient(ItemID.Starfury); - recipe.AddIngredient(ItemID.Arkhalis); - recipe.AddIngredient(ItemID.Excalibur); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(5) == 0) - { - int num249 = Main.rand.Next(3); - if (num249 == 0) - { - num249 = 15; - } - else if (num249 == 1) - { - num249 = 57; - } - else - { - num249 = 58; - } - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, num249, (float)(player.direction * 2), 0f, 150, default(Color), 1.3f); - Main.dust[num250].velocity *= 0.2f; - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } - } -} + public override void SetDefaults() + { + item.width = 50; + item.damage = 55; + item.melee = true; + item.useAnimation = 22; + item.useTime = 22; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 12f; + } + + 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(2)) + { + case 0: type = mod.ProjectileType("EonBeam"); break; + case 1: type = 173; break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + float num72 = Main.rand.Next(18, 25); + damage = Main.rand.Next(40, 60); + 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 = 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); + 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(-120, 121) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddIngredient(null, "EssenceofEleum", 3); + recipe.AddIngredient(ItemID.Starfury); + recipe.AddIngredient(ItemID.EnchantedSword); + recipe.AddIngredient(ItemID.Excalibur); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddIngredient(null, "EssenceofEleum", 3); + recipe.AddIngredient(ItemID.Starfury); + recipe.AddIngredient(ItemID.Arkhalis); + recipe.AddIngredient(ItemID.Excalibur); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(5) == 0) + { + int num249 = Main.rand.Next(3); + if (num249 == 0) + { + num249 = 15; + } + else if (num249 == 1) + { + num249 = 57; + } + else + { + num249 = 58; + } + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, num249, (float)(player.direction * 2), 0f, 150, default(Color), 1.3f); + Main.dust[num250].velocity *= 0.2f; + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } + } +} diff --git a/Items/Weapons/ArkoftheCosmos.cs b/Items/Weapons/ArkoftheCosmos.cs index ece001a750..18fc4373b2 100644 --- a/Items/Weapons/ArkoftheCosmos.cs +++ b/Items/Weapons/ArkoftheCosmos.cs @@ -1,15 +1,15 @@ -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 -{ - public class ArkoftheCosmos : ModItem - { +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 +{ + public class ArkoftheCosmos : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Cosmos"); @@ -18,197 +18,197 @@ namespace CalamityMod.Items.Weapons "Projectiles also change based on moon events"); } - public override void SetDefaults() - { - item.width = 100; - item.damage = 680; - item.melee = true; - item.useAnimation = 15; - item.useTime = 15; - item.useTurn = true; - item.useStyle = 1; - item.crit += 15; - item.knockBack = 9.5f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.height = 100; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("EonBeam"); - item.shootSpeed = 28f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - 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; - } - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - Main.projectile[projectile].timeLeft = 160; - Main.projectile[projectile].tileCollide = false; - 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 = 4; - 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; - int projectileFire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("Galaxia2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - Main.projectile[projectileFire].timeLeft = 80; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FourSeasonsGalaxia"); - recipe.AddIngredient(null, "ArkoftheElements"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "HellcasterFragment", 3); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "AuricOre", 25); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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) - { - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - bool nebula = player.ZoneTowerNebula; - bool stardust = player.ZoneTowerStardust; - bool solar = player.ZoneTowerSolar; - bool vortex = player.ZoneTowerVortex; - bool bloodMoon = Main.bloodMoon; - bool snowMoon = Main.snowMoon; - bool pumpkinMoon = Main.pumpkinMoon; - if (bloodMoon) - { - player.AddBuff(BuffID.Battle, 600); - } - if (snowMoon) - { - player.AddBuff(BuffID.RapidHealing, 600); - } - if (pumpkinMoon) - { - player.AddBuff(BuffID.WellFed, 600); - } - if (jungle) - { - player.AddBuff(BuffID.Thorns, 600); - } - else if (snow) - { - player.AddBuff(BuffID.Warmth, 600); - } - else if (beach) - { - player.AddBuff(BuffID.Wet, 600); - } - else if (corrupt) - { - player.AddBuff(BuffID.Wrath, 600); - } - else if (crimson) - { - player.AddBuff(BuffID.Rage, 600); - } - else if (dungeon) - { - player.AddBuff(BuffID.Dangersense, 600); - } - else if (desert) - { - player.AddBuff(BuffID.Endurance, 600); - } - else if (glow) - { - player.AddBuff(BuffID.Spelunker, 600); - } - else if (hell) - { - player.AddBuff(BuffID.Inferno, 600); - } - else if (holy) - { - player.AddBuff(BuffID.Heartreach, 600); - } - else if (nebula) - { - player.AddBuff(BuffID.MagicPower, 600); - } - else if (stardust) - { - player.AddBuff(BuffID.Summoning, 600); - } - else if (solar) - { - player.AddBuff(BuffID.Titan, 600); - } - else if (vortex) - { - player.AddBuff(BuffID.AmmoReservation, 600); - } - else - { - player.AddBuff(BuffID.DryadsWard, 600); - } - } - } -} + public override void SetDefaults() + { + item.width = 100; + item.damage = 680; + item.melee = true; + item.useAnimation = 15; + item.useTime = 15; + item.useTurn = true; + item.useStyle = 1; + item.crit += 15; + item.knockBack = 9.5f; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.height = 100; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 28f; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + 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; + } + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + Main.projectile[projectile].timeLeft = 160; + Main.projectile[projectile].tileCollide = false; + 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 = 4; + 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; + int projectileFire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("Galaxia2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + Main.projectile[projectileFire].timeLeft = 80; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FourSeasonsGalaxia"); + recipe.AddIngredient(null, "ArkoftheElements"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "HellcasterFragment", 3); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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) + { + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + bool nebula = player.ZoneTowerNebula; + bool stardust = player.ZoneTowerStardust; + bool solar = player.ZoneTowerSolar; + bool vortex = player.ZoneTowerVortex; + bool bloodMoon = Main.bloodMoon; + bool snowMoon = Main.snowMoon; + bool pumpkinMoon = Main.pumpkinMoon; + if (bloodMoon) + { + player.AddBuff(BuffID.Battle, 600); + } + if (snowMoon) + { + player.AddBuff(BuffID.RapidHealing, 600); + } + if (pumpkinMoon) + { + player.AddBuff(BuffID.WellFed, 600); + } + if (jungle) + { + player.AddBuff(BuffID.Thorns, 600); + } + else if (snow) + { + player.AddBuff(BuffID.Warmth, 600); + } + else if (beach) + { + player.AddBuff(BuffID.Wet, 600); + } + else if (corrupt) + { + player.AddBuff(BuffID.Wrath, 600); + } + else if (crimson) + { + player.AddBuff(BuffID.Rage, 600); + } + else if (dungeon) + { + player.AddBuff(BuffID.Dangersense, 600); + } + else if (desert) + { + player.AddBuff(BuffID.Endurance, 600); + } + else if (glow) + { + player.AddBuff(BuffID.Spelunker, 600); + } + else if (hell) + { + player.AddBuff(BuffID.Inferno, 600); + } + else if (holy) + { + player.AddBuff(BuffID.Heartreach, 600); + } + else if (nebula) + { + player.AddBuff(BuffID.MagicPower, 600); + } + else if (stardust) + { + player.AddBuff(BuffID.Summoning, 600); + } + else if (solar) + { + player.AddBuff(BuffID.Titan, 600); + } + else if (vortex) + { + player.AddBuff(BuffID.AmmoReservation, 600); + } + else + { + player.AddBuff(BuffID.DryadsWard, 600); + } + } + } +} diff --git a/Items/Weapons/ArkoftheElements.cs b/Items/Weapons/ArkoftheElements.cs index c989fdea55..de8fd84dfa 100644 --- a/Items/Weapons/ArkoftheElements.cs +++ b/Items/Weapons/ArkoftheElements.cs @@ -1,124 +1,124 @@ -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 -{ - public class ArkoftheElements : ModItem - { +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 +{ + public class ArkoftheElements : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Elements"); Tooltip.SetDefault("A heavenly blade infused with the essence of Terraria"); } - public override void SetDefaults() - { - item.width = 84; - item.damage = 126; - item.melee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = 1; - item.crit += 10; - item.knockBack = 8.5f; - 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 = 12; - } - - 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; - } - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - Main.projectile[projectile].timeLeft = 160; - Main.projectile[projectile].tileCollide = false; - 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 = 4; - 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, mod.ProjectileType("ElementBall"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueArkoftheAncients"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "CoreofCalamity", 5); - recipe.AddIngredient(null, "BarofLife", 10); - recipe.AddIngredient(ItemID.LunarBar, 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - } - } -} + public override void SetDefaults() + { + item.width = 84; + item.damage = 126; + item.melee = true; + item.useAnimation = 20; + item.useTime = 20; + item.useTurn = true; + item.useStyle = 1; + item.crit += 10; + item.knockBack = 8.5f; + 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 = 12; + } + + 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; + } + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + Main.projectile[projectile].timeLeft = 160; + Main.projectile[projectile].tileCollide = false; + 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 = 4; + 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, mod.ProjectileType("ElementBall"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueArkoftheAncients"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "CoreofCalamity", 5); + recipe.AddIngredient(null, "BarofLife", 10); + recipe.AddIngredient(ItemID.LunarBar, 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + } + } +} diff --git a/Items/Weapons/ArterialAssault.cs b/Items/Weapons/ArterialAssault.cs index 1d996f5bdf..728a4c63e2 100644 --- a/Items/Weapons/ArterialAssault.cs +++ b/Items/Weapons/ArterialAssault.cs @@ -1,108 +1,108 @@ -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 ArterialAssault : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arterial Assault"); - Tooltip.SetDefault("Fires a chain of arrows from the sky\n" + - "Wooden arrows are converted to bloodfire arrows"); - } - - public override void SetDefaults() - { - item.damage = 232; - item.ranged = true; - item.width = 44; - item.height = 100; - item.useTime = 3; - item.reuseDelay = 10; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.25f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodfireArrow"); - item.shootSpeed = 30f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - 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; - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f; - vector2.Y -= 100f; - 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; - if (type == ProjectileID.WoodenArrowFriendly) - { - int bloodfire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("BloodfireArrow"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15)); - Main.projectile[bloodfire].tileCollide = false; - } - else - { - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; - } - return false; - } - } -} \ No newline at end of file +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 ArterialAssault : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arterial Assault"); + Tooltip.SetDefault("Fires a chain of arrows from the sky\n" + + "Wooden arrows are converted to bloodfire arrows"); + } + + public override void SetDefaults() + { + item.damage = 232; + item.ranged = true; + item.width = 44; + item.height = 100; + item.useTime = 3; + item.reuseDelay = 10; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.25f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item102; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodfireArrow"); + item.shootSpeed = 30f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + 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; + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f; + vector2.Y -= 100f; + 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; + if (type == ProjectileID.WoodenArrowFriendly) + { + int bloodfire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("BloodfireArrow"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15)); + Main.projectile[bloodfire].tileCollide = false; + } + else + { + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + } + return false; + } + } +} diff --git a/Items/Weapons/AsteroidStaff.cs b/Items/Weapons/AsteroidStaff.cs index b51b26e5b1..fa132f4764 100644 --- a/Items/Weapons/AsteroidStaff.cs +++ b/Items/Weapons/AsteroidStaff.cs @@ -1,16 +1,16 @@ -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 AsteroidStaff : 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.Weapons +{ + public class AsteroidStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Asteroid Staff"); @@ -18,86 +18,86 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 130; - item.magic = true; - item.mana = 20; - item.width = 50; - item.height = 50; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.75f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Asteroid"); - item.shootSpeed = 20f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteorStaff); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - 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; - } - num78 *= num80; - num79 *= num80; - int num112 = 3; - for (int num113 = 0; num113 < num112; num113++) - { - 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 * num113); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; - 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 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, type, damage, knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); - } - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 130; + item.magic = true; + item.mana = 20; + item.width = 50; + item.height = 50; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.75f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item88; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Asteroid"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteorStaff); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + 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; + } + num78 *= num80; + num79 *= num80; + int num112 = 3; + for (int num113 = 0; num113 < num112; num113++) + { + 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 * num113); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; + 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 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, type, damage, knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + } + return false; + } + } +} diff --git a/Items/Weapons/Astral/AstralBlade.cs b/Items/Weapons/Astral/AstralBlade.cs index bfbaeefd62..a64ce7bb43 100644 --- a/Items/Weapons/Astral/AstralBlade.cs +++ b/Items/Weapons/Astral/AstralBlade.cs @@ -54,4 +54,4 @@ namespace CalamityMod.Items.Weapons.Astral } } } -} \ No newline at end of file +} diff --git a/Items/Weapons/Astral/AstralBlaster.cs b/Items/Weapons/Astral/AstralBlaster.cs index 7e6569d28b..786dbdcc93 100644 --- a/Items/Weapons/Astral/AstralBlaster.cs +++ b/Items/Weapons/Astral/AstralBlaster.cs @@ -1,56 +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.Astral -{ - public class AstralBlaster : 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.Weapons.Astral +{ + public class AstralBlaster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Blaster"); Tooltip.SetDefault("Fires a homing astral round"); } - public override void SetDefaults() - { - item.damage = 150; - item.crit += 25; - item.ranged = true; - item.width = 40; - item.height = 24; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 14f; - item.shoot = mod.ProjectileType("AstralRound"); - item.useAmmo = 97; - } - - 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("AstralRound"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 150; + item.crit += 25; + item.ranged = true; + item.width = 40; + item.height = 24; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.75f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shootSpeed = 14f; + item.shoot = mod.ProjectileType("AstralRound"); + item.useAmmo = 97; + } + + 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("AstralRound"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Astral/AstralPike.cs b/Items/Weapons/Astral/AstralPike.cs index 48570acc59..f8058aa243 100644 --- a/Items/Weapons/Astral/AstralPike.cs +++ b/Items/Weapons/Astral/AstralPike.cs @@ -1,63 +1,63 @@ -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.Astral -{ - public class AstralPike : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Pike"); - Tooltip.SetDefault("Summons astral star swarms on critical hits"); - } - - public override void SetDefaults() - { - item.width = 44; - item.damage = 128; - item.crit += 25; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 13; - item.useStyle = 5; - item.useTime = 13; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.shoot = mod.ProjectileType("AstralPike"); - item.shootSpeed = 9f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 8); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - } -} +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.Astral +{ + public class AstralPike : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Pike"); + Tooltip.SetDefault("Summons astral star swarms on critical hits"); + } + + public override void SetDefaults() + { + item.width = 44; + item.damage = 128; + item.crit += 25; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 13; + item.useStyle = 5; + item.useTime = 13; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.shoot = mod.ProjectileType("AstralPike"); + item.shootSpeed = 9f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 8); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + } +} diff --git a/Items/Weapons/Astral/AstralRepeater.cs b/Items/Weapons/Astral/AstralRepeater.cs index 88607e9743..75470c3c4f 100644 --- a/Items/Weapons/Astral/AstralRepeater.cs +++ b/Items/Weapons/Astral/AstralRepeater.cs @@ -1,51 +1,51 @@ -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.Astral -{ - public class AstralRepeater : 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.Weapons.Astral +{ + public class AstralRepeater : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Bow"); Tooltip.SetDefault("Fires a burst of three arrows"); - } - - public override void SetDefaults() - { - item.damage = 110; - item.crit += 25; - item.ranged = true; - item.width = 38; - item.height = 78; - item.useTime = 4; - item.reuseDelay = 15; - item.useAnimation = 12; - 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 = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AstralBar", 7); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 110; + item.crit += 25; + item.ranged = true; + item.width = 38; + item.height = 78; + item.useTime = 4; + item.reuseDelay = 15; + item.useAnimation = 12; + 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 = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AstralBar", 7); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Astral/AstralScythe.cs b/Items/Weapons/Astral/AstralScythe.cs index d17b810ccf..7139a2728e 100644 --- a/Items/Weapons/Astral/AstralScythe.cs +++ b/Items/Weapons/Astral/AstralScythe.cs @@ -1,39 +1,39 @@ -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.Astral -{ - public class AstralScythe : 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.Weapons.Astral +{ + public class AstralScythe : ModItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Astral Scythe"); + DisplayName.SetDefault("Astral Scythe"); Tooltip.SetDefault("Shoots a scythe ring that accelerates over time"); } - public override void SetDefaults() - { - item.width = 56; - item.height = 60; - item.damage = 95; - item.melee = true; - item.useTurn = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.knockBack = 6f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; + public override void SetDefaults() + { + item.width = 56; + item.height = 60; + item.damage = 95; + item.melee = true; + item.useTurn = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 6f; + item.UseSound = SoundID.Item71; + item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("AstralScytheProjectile"); - item.shootSpeed = 5f; - } - } -} + item.rare = 7; + item.shoot = mod.ProjectileType("AstralScytheProjectile"); + item.shootSpeed = 5f; + } + } +} diff --git a/Items/Weapons/Astral/AstralStaff.cs b/Items/Weapons/Astral/AstralStaff.cs index e039158ac1..3b7c1c0189 100644 --- a/Items/Weapons/Astral/AstralStaff.cs +++ b/Items/Weapons/Astral/AstralStaff.cs @@ -29,8 +29,8 @@ namespace CalamityMod.Items.Weapons.Astral item.useAnimation = 35; item.useStyle = 5; item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 95, 0, 0); + item.knockBack = 5f; + item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; item.UseSound = SoundID.Item105; item.autoReuse = true; @@ -61,4 +61,4 @@ namespace CalamityMod.Items.Weapons.Astral return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/Astral/AstralachneaStaff.cs b/Items/Weapons/Astral/AstralachneaStaff.cs index 30da655aa0..d9256dde64 100644 --- a/Items/Weapons/Astral/AstralachneaStaff.cs +++ b/Items/Weapons/Astral/AstralachneaStaff.cs @@ -1,82 +1,82 @@ -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.Astral -{ - public class AstralachneaStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astralachnea Staff"); - Tooltip.SetDefault("Fires a spread of homing astral spider fangs"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 60; - item.magic = true; - item.mana = 19; - item.width = 52; - item.height = 52; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; +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.Astral +{ + public class AstralachneaStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astralachnea Staff"); + Tooltip.SetDefault("Fires a spread of homing astral spider fangs"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 60; + item.magic = true; + item.mana = 19; + item.width = 52; + item.height = 52; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item46; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AstralachneaFang"); - item.shootSpeed = 13f; - } - - 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) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - int spikeAmount = 4; - if (Main.rand.Next(3) == 0) - { - spikeAmount++; - } - if (Main.rand.Next(4) == 0) - { - spikeAmount++; - } - if (Main.rand.Next(5) == 0) - { - spikeAmount += 2; - } - for (int num131 = 0; num131 < spikeAmount; num131++) - { - float num132 = num78; - float num133 = num79; - float num134 = 0.05f * (float)num131; - num132 += (float)Main.rand.Next(-400, 400) * num134; - num133 += (float)Main.rand.Next(-400, 400) * num134; - num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); - num80 = num72 / num80; - num132 *= num80; - num133 *= num80; - float x2 = vector2.X; - float y2 = vector2.Y; - Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("AstralachneaFang"), num73, num74, i, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file + item.rare = 7; + item.UseSound = SoundID.Item46; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AstralachneaFang"); + item.shootSpeed = 13f; + } + + 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) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + int i = Main.myPlayer; + float num72 = item.shootSpeed; + int num73 = damage; + float num74 = knockBack; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + int spikeAmount = 4; + if (Main.rand.Next(3) == 0) + { + spikeAmount++; + } + if (Main.rand.Next(4) == 0) + { + spikeAmount++; + } + if (Main.rand.Next(5) == 0) + { + spikeAmount += 2; + } + for (int num131 = 0; num131 < spikeAmount; num131++) + { + float num132 = num78; + float num133 = num79; + float num134 = 0.05f * (float)num131; + num132 += (float)Main.rand.Next(-400, 400) * num134; + num133 += (float)Main.rand.Next(-400, 400) * num134; + num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); + num80 = num72 / num80; + num132 *= num80; + num133 *= num80; + float x2 = vector2.X; + float y2 = vector2.Y; + Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("AstralachneaFang"), num73, num74, i, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Astral/HivePod.cs b/Items/Weapons/Astral/HivePod.cs index 216e9478af..9f0dea68bc 100644 --- a/Items/Weapons/Astral/HivePod.cs +++ b/Items/Weapons/Astral/HivePod.cs @@ -1,63 +1,63 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Astral -{ - public class HivePod : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Pod"); - Tooltip.SetDefault("Summons an astral hive to protect you"); - } - - public override void SetDefaults() - { - item.damage = 90; - item.mana = 10; - item.summon = true; - item.sentry = true; - item.width = 46; - item.height = 50; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 4f; +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Astral +{ + public class HivePod : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Pod"); + Tooltip.SetDefault("Summons an astral hive to protect you"); + } + + public override void SetDefaults() + { + item.damage = 90; + item.mana = 10; + item.summon = true; + item.sentry = true; + item.width = 46; + item.height = 50; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 4f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item78; - item.shoot = mod.ProjectileType("Hive"); - } - - 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); - } - } -} + item.rare = 7; + item.UseSound = SoundID.Item78; + item.shoot = mod.ProjectileType("Hive"); + } + + 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); + } + } +} diff --git a/Items/Weapons/Astral/StellarCannon.cs b/Items/Weapons/Astral/StellarCannon.cs index e5f03a623b..5215f2fb32 100644 --- a/Items/Weapons/Astral/StellarCannon.cs +++ b/Items/Weapons/Astral/StellarCannon.cs @@ -1,44 +1,44 @@ -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.Astral -{ - public class StellarCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stellar Cannon"); - Tooltip.SetDefault("Launches an explosive astral crystal"); - } - - public override void SetDefaults() - { - item.damage = 250; - item.ranged = true; - item.width = 50; - item.height = 30; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; +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.Astral +{ + public class StellarCannon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stellar Cannon"); + Tooltip.SetDefault("Launches an explosive astral crystal"); + } + + public override void SetDefaults() + { + item.damage = 250; + item.ranged = true; + item.width = 50; + item.height = 30; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AstralCannonProjectile"); - item.shootSpeed = 2f; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - } -} \ No newline at end of file + item.rare = 7; + item.UseSound = SoundID.Item92; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AstralCannonProjectile"); + item.shootSpeed = 2f; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + } +} diff --git a/Items/Weapons/Astral/TitanArm.cs b/Items/Weapons/Astral/TitanArm.cs index a525c1466e..3447329eac 100644 --- a/Items/Weapons/Astral/TitanArm.cs +++ b/Items/Weapons/Astral/TitanArm.cs @@ -1,38 +1,38 @@ -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.Astral -{ - public class TitanArm : 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.Weapons.Astral +{ + public class TitanArm : ModItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Titan Arm"); + DisplayName.SetDefault("Titan Arm"); Tooltip.SetDefault("Slap Hand but better"); } - public override void SetDefaults() - { - item.width = 46; - item.height = 58; - item.damage = 60; - item.crit += 96; //more knockback huehue - item.melee = true; - item.useTurn = true; - item.useAnimation = 12; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 9001f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; + public override void SetDefaults() + { + item.width = 46; + item.height = 58; + item.damage = 60; + item.crit += 96; //more knockback huehue + item.melee = true; + item.useTurn = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 9001f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - } - } -} + item.rare = 7; + } + } +} diff --git a/Items/Weapons/AstrealDefeat.cs b/Items/Weapons/AstrealDefeat.cs index 436109adb7..6d373dbfff 100644 --- a/Items/Weapons/AstrealDefeat.cs +++ b/Items/Weapons/AstrealDefeat.cs @@ -1,16 +1,16 @@ -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 AstrealDefeat : 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.Weapons +{ + public class AstrealDefeat : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Astreal Defeat"); @@ -20,56 +20,56 @@ namespace CalamityMod.Items.Weapons "Though she kept this bow close to protect her family in times of great disaster"); } - public override void SetDefaults() - { - item.damage = 109; - item.ranged = true; - item.width = 44; - item.height = 54; - item.useTime = 3; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AstrealArrow"); - item.shootSpeed = 1f; - item.useAmmo = 40; - } - - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 200); - } - } - } - - 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, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpiritFlame); - recipe.AddIngredient(ItemID.ShadowFlameBow); - recipe.AddIngredient(null, "GreatbowofTurmoil"); - recipe.AddIngredient(null, "BladedgeGreatbow"); - recipe.AddIngredient(null, "DarkechoGreatbow"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 109; + item.ranged = true; + item.width = 44; + item.height = 54; + item.useTime = 3; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item102; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AstrealArrow"); + item.shootSpeed = 1f; + item.useAmmo = 40; + } + + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "ItemName") + { + line2.overrideColor = new Color(0, 255, 200); + } + } + } + + 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, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SpiritFlame); + recipe.AddIngredient(ItemID.ShadowFlameBow); + recipe.AddIngredient(null, "GreatbowofTurmoil"); + recipe.AddIngredient(null, "BladedgeGreatbow"); + recipe.AddIngredient(null, "DarkechoGreatbow"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/AstrumDeus/Starfall.cs b/Items/Weapons/AstrumDeus/Starfall.cs index 88ad25e5b0..828242b619 100644 --- a/Items/Weapons/AstrumDeus/Starfall.cs +++ b/Items/Weapons/AstrumDeus/Starfall.cs @@ -1,70 +1,70 @@ -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.AstrumDeus -{ - public class Starfall : 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.Weapons.AstrumDeus +{ + public class Starfall : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Starfall"); Tooltip.SetDefault("Casts a spread of astral stars at the mouse cursor"); } - public override void SetDefaults() - { - item.damage = 59; - item.crit += 25; - item.magic = true; - item.mana = 15; - item.rare = 9; - item.width = 28; - item.height = 30; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AstralStarMagic"); - item.shootSpeed = 12f; - } - - 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; - } - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - } - float num208 = num78; - float num209 = num79; - num208 += (float)Main.rand.Next(-1, 2) * 0.5f; - num209 += (float)Main.rand.Next(-1, 2) * 0.5f; - vector2 += new Vector2(num208, num209); - for (int num108 = 0; num108 < 5; num108++) - { - 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, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 59; + item.crit += 25; + item.magic = true; + item.mana = 15; + item.rare = 9; + item.width = 28; + item.height = 30; + item.useTime = 14; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.UseSound = SoundID.Item105; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AstralStarMagic"); + item.shootSpeed = 12f; + } + + 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; + } + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + } + float num208 = num78; + float num209 = num79; + num208 += (float)Main.rand.Next(-1, 2) * 0.5f; + num209 += (float)Main.rand.Next(-1, 2) * 0.5f; + vector2 += new Vector2(num208, num209); + for (int num108 = 0; num108 < 5; num108++) + { + 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, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/AuguroftheElements.cs b/Items/Weapons/AuguroftheElements.cs index cf814460a7..5cebdbd2b0 100644 --- a/Items/Weapons/AuguroftheElements.cs +++ b/Items/Weapons/AuguroftheElements.cs @@ -1,82 +1,82 @@ -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 AuguroftheElements : 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.Weapons +{ + public class AuguroftheElements : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Augur of the Elements"); Tooltip.SetDefault("Casts a burst of elemental tentacles to spear your enemies"); } - public override void SetDefaults() - { - item.damage = 74; - item.magic = true; - item.mana = 6; - item.width = 28; - item.crit = 3; - item.height = 30; - item.useTime = 1; - item.reuseDelay = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item103; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementTentacle"); - item.shootSpeed = 30f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EldritchTome"); - recipe.AddIngredient(null, "TomeofFates"); - recipe.AddIngredient(ItemID.ShadowFlameHexDoll); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - Vector2 value2 = new Vector2(num78, num79); - value2.Normalize(); - Vector2 value3 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value3.Normalize(); - value2 = value2 * 6f + value3; - value2.Normalize(); - value2 *= item.shootSpeed; - float num91 = (float)Main.rand.Next(10, 50) * 0.001f; - if (Main.rand.Next(2) == 0) - { - num91 *= -1f; - } - float num92 = (float)Main.rand.Next(10, 50) * 0.001f; - if (Main.rand.Next(2) == 0) - { - num92 *= -1f; - } - Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, type, damage, knockBack, player.whoAmI, num92, num91); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 74; + item.magic = true; + item.mana = 6; + item.width = 28; + item.crit = 3; + item.height = 30; + item.useTime = 1; + item.reuseDelay = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item103; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementTentacle"); + item.shootSpeed = 30f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EldritchTome"); + recipe.AddIngredient(null, "TomeofFates"); + recipe.AddIngredient(ItemID.ShadowFlameHexDoll); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + Vector2 value2 = new Vector2(num78, num79); + value2.Normalize(); + Vector2 value3 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value3.Normalize(); + value2 = value2 * 6f + value3; + value2.Normalize(); + value2 *= item.shootSpeed; + float num91 = (float)Main.rand.Next(10, 50) * 0.001f; + if (Main.rand.Next(2) == 0) + { + num91 *= -1f; + } + float num92 = (float)Main.rand.Next(10, 50) * 0.001f; + if (Main.rand.Next(2) == 0) + { + num92 *= -1f; + } + Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, type, damage, knockBack, player.whoAmI, num92, num91); + return false; + } + } +} diff --git a/Items/Weapons/Azathoth.cs b/Items/Weapons/Azathoth.cs index ac473fcf6a..3332b536b7 100644 --- a/Items/Weapons/Azathoth.cs +++ b/Items/Weapons/Azathoth.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 Azathoth : 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.Weapons +{ + public class Azathoth : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Azathoth"); - Tooltip.SetDefault("Destroy the universe in the blink of an eye\n" + + Tooltip.SetDefault("Destroy the universe in the blink of an eye\n" + "Fires cosmic orbs that blast nearby enemies with lasers"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Kraken); - item.damage = 200; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AzathothProjectile"); - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Terrarian); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(null, "CoreofCalamity", 3); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Kraken); + item.damage = 200; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AzathothProjectile"); + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Terrarian); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(null, "CoreofCalamity", 3); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/BalefulHarvester.cs b/Items/Weapons/BalefulHarvester.cs index db324d1ae0..43a112b8dd 100644 --- a/Items/Weapons/BalefulHarvester.cs +++ b/Items/Weapons/BalefulHarvester.cs @@ -1,56 +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 -{ - public class BalefulHarvester : 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.Weapons +{ + public class BalefulHarvester : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Baleful Harvester"); Tooltip.SetDefault("Fires skulls that split into homing fire orbs on death"); } - public override void SetDefaults() - { - item.damage = 110; - item.width = 66; - item.height = 66; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("BalefulHarvesterProjectile"); - item.shootSpeed = 6f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pumpkin, 30); - recipe.AddIngredient(ItemID.BookofSkulls); - recipe.AddIngredient(ItemID.SpookyWood, 200); - recipe.AddIngredient(ItemID.TheHorsemansBlade); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - } -} + public override void SetDefaults() + { + item.damage = 110; + item.width = 66; + item.height = 66; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("BalefulHarvesterProjectile"); + item.shootSpeed = 6f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Pumpkin, 30); + recipe.AddIngredient(ItemID.BookofSkulls); + recipe.AddIngredient(ItemID.SpookyWood, 200); + recipe.AddIngredient(ItemID.TheHorsemansBlade); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Items/Weapons/BarracudaGun.cs b/Items/Weapons/BarracudaGun.cs index 913838d98c..f653356240 100644 --- a/Items/Weapons/BarracudaGun.cs +++ b/Items/Weapons/BarracudaGun.cs @@ -1,73 +1,73 @@ -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 BarracudaGun : 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.Weapons +{ + public class BarracudaGun : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Barracuda Gun"); Tooltip.SetDefault("Fires two barracudas that latch onto enemies"); } - public override void SetDefaults() - { - item.damage = 76; - item.channel = true; - item.ranged = true; - item.width = 54; - item.height = 28; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 15f; - item.shoot = mod.ProjectileType("MechanicalBarracuda"); - } - - 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) - { - float SpeedA = speedX; - float SpeedB = speedY; - int num6 = Main.rand.Next(2, 3); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - 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, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PiranhaGun); - recipe.AddIngredient(null, "CoreofCalamity", 2); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 76; + item.channel = true; + item.ranged = true; + item.width = 54; + item.height = 28; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item10; + item.autoReuse = true; + item.shootSpeed = 15f; + item.shoot = mod.ProjectileType("MechanicalBarracuda"); + } + + 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) + { + float SpeedA = speedX; + float SpeedB = speedY; + int num6 = Main.rand.Next(2, 3); + for (int index = 0; index < num6; ++index) + { + float num7 = speedX; + 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, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PiranhaGun); + recipe.AddIngredient(null, "CoreofCalamity", 2); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddIngredient(ItemID.SharkFin, 2); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/BiomeBlade.cs b/Items/Weapons/BiomeBlade.cs index a36ce9c077..3e9ae96d1a 100644 --- a/Items/Weapons/BiomeBlade.cs +++ b/Items/Weapons/BiomeBlade.cs @@ -1,80 +1,80 @@ -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 -{ - public class BiomeBlade : ModItem - { +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 +{ + public class BiomeBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Biome Blade"); Tooltip.SetDefault("Fires different projectiles based on what biome you're in"); } - public override void SetDefaults() - { - item.width = 36; - item.damage = 48; - item.melee = true; - item.useAnimation = 24; - item.useTime = 24; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 36; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.shoot = mod.ProjectileType("BiomeOrb"); - item.shootSpeed = 12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WoodenSword); - recipe.AddIngredient(ItemID.DirtBlock, 10); - recipe.AddIngredient(ItemID.SandBlock, 10); - recipe.AddIngredient(ItemID.IceBlock, 10); - recipe.AddIngredient(ItemID.EbonstoneBlock, 10); - recipe.AddIngredient(ItemID.GlowingMushroom, 10); - recipe.AddIngredient(ItemID.Marble, 10); - recipe.AddIngredient(ItemID.Granite, 10); - recipe.AddIngredient(ItemID.Hellstone, 10); - recipe.AddIngredient(ItemID.Coral, 5); - recipe.AddIngredient(ItemID.PearlstoneBlock, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WoodenSword); - recipe.AddIngredient(ItemID.DirtBlock, 10); - recipe.AddIngredient(ItemID.SandBlock, 10); - recipe.AddIngredient(ItemID.IceBlock, 10); - recipe.AddIngredient(ItemID.CrimstoneBlock, 10); - recipe.AddIngredient(ItemID.GlowingMushroom, 10); - recipe.AddIngredient(ItemID.Marble, 10); - recipe.AddIngredient(ItemID.Granite, 10); - recipe.AddIngredient(ItemID.Hellstone, 10); - recipe.AddIngredient(ItemID.Coral, 5); - recipe.AddIngredient(ItemID.PearlstoneBlock, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 0); - } - } - } -} + public override void SetDefaults() + { + item.width = 36; + item.damage = 48; + item.melee = true; + item.useAnimation = 24; + item.useTime = 24; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 36; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.shoot = mod.ProjectileType("BiomeOrb"); + item.shootSpeed = 12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WoodenSword); + recipe.AddIngredient(ItemID.DirtBlock, 10); + recipe.AddIngredient(ItemID.SandBlock, 10); + recipe.AddIngredient(ItemID.IceBlock, 10); + recipe.AddIngredient(ItemID.EbonstoneBlock, 10); + recipe.AddIngredient(ItemID.GlowingMushroom, 10); + recipe.AddIngredient(ItemID.Marble, 10); + recipe.AddIngredient(ItemID.Granite, 10); + recipe.AddIngredient(ItemID.Hellstone, 10); + recipe.AddIngredient(ItemID.Coral, 5); + recipe.AddIngredient(ItemID.PearlstoneBlock, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WoodenSword); + recipe.AddIngredient(ItemID.DirtBlock, 10); + recipe.AddIngredient(ItemID.SandBlock, 10); + recipe.AddIngredient(ItemID.IceBlock, 10); + recipe.AddIngredient(ItemID.CrimstoneBlock, 10); + recipe.AddIngredient(ItemID.GlowingMushroom, 10); + recipe.AddIngredient(ItemID.Marble, 10); + recipe.AddIngredient(ItemID.Granite, 10); + recipe.AddIngredient(ItemID.Hellstone, 10); + recipe.AddIngredient(ItemID.Coral, 5); + recipe.AddIngredient(ItemID.PearlstoneBlock, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 0); + } + } + } +} diff --git a/Items/Weapons/BladecrestOathsword.cs b/Items/Weapons/BladecrestOathsword.cs index aeb3e9e735..9a3bbf53be 100644 --- a/Items/Weapons/BladecrestOathsword.cs +++ b/Items/Weapons/BladecrestOathsword.cs @@ -1,44 +1,44 @@ -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 BladecrestOathsword : 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.Weapons +{ + public class BladecrestOathsword : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Bladecrest Oathsword"); - Tooltip.SetDefault("Sword of an ancient demon lord\n" + + Tooltip.SetDefault("Sword of an ancient demon lord\n" + "Fires a blood scythe"); } - public override void SetDefaults() - { - item.width = 58; - item.damage = 25; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 58; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.shoot = mod.ProjectileType("BloodScythe"); - item.shootSpeed = 6f; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 240); - } - } -} + public override void SetDefaults() + { + item.width = 58; + item.damage = 25; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 58; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.shoot = mod.ProjectileType("BloodScythe"); + item.shootSpeed = 6f; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 240); + } + } +} diff --git a/Items/Weapons/BladedgeGreatbow.cs b/Items/Weapons/BladedgeGreatbow.cs index 944e632876..91711aede4 100644 --- a/Items/Weapons/BladedgeGreatbow.cs +++ b/Items/Weapons/BladedgeGreatbow.cs @@ -1,86 +1,86 @@ -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 -{ - public class BladedgeGreatbow : 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; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class BladedgeGreatbow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Bladedge Railbow"); - Tooltip.SetDefault("Fires 4 arrows at once\n" + + Tooltip.SetDefault("Fires 4 arrows at once\n" + "Fires 2 additional leafs"); } - public override void SetDefaults() - { - item.damage = 26; - item.ranged = true; - item.width = 74; - item.height = 22; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 14f; - item.useAmmo = 40; - } - - 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) - { - for (int i = 0; i < 4; i++) - { - float SpeedX = speedX + (float) Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-60, 61) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[index].noDropItem = true; - } - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 2; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 10f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ProjectileID.Leaf, damage, 0f, player.whoAmI, 0f, 0f); - Main.projectile[projectile].GetGlobalProjectile(mod).forceRanged = true; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 26; + item.ranged = true; + item.width = 74; + item.height = 22; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 14f; + item.useAmmo = 40; + } + + 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) + { + for (int i = 0; i < 4; i++) + { + float SpeedX = speedX + (float) Main.rand.Next(-60, 61) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-60, 61) * 0.05f; + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[index].noDropItem = true; + } + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 2; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 10f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ProjectileID.Leaf, damage, 0f, player.whoAmI, 0f, 0f); + Main.projectile[projectile].GetGlobalProjectile(mod).forceRanged = true; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/BladeofEnmity.cs b/Items/Weapons/BladeofEnmity.cs index 6cb41d06f5..db17293587 100644 --- a/Items/Weapons/BladeofEnmity.cs +++ b/Items/Weapons/BladeofEnmity.cs @@ -1,51 +1,51 @@ -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 BladeofEnmity : 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.Weapons +{ + public class BladeofEnmity : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Blade of Enmity"); } - public override void SetDefaults() - { - item.width = 60; - item.damage = 158; - item.melee = true; - item.useAnimation = 10; - item.useStyle = 1; - item.useTime = 10; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 68; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(null, "CoreofCalamity", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } -} + public override void SetDefaults() + { + item.width = 60; + item.damage = 158; + item.melee = true; + item.useAnimation = 10; + item.useStyle = 1; + item.useTime = 10; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 68; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(null, "CoreofCalamity", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } +} diff --git a/Items/Weapons/BloodfireArrow.cs b/Items/Weapons/BloodfireArrow.cs index b9b24637e4..7eda8749dc 100644 --- a/Items/Weapons/BloodfireArrow.cs +++ b/Items/Weapons/BloodfireArrow.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class BloodfireArrow : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class BloodfireArrow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodfire Arrow"); Tooltip.SetDefault("Heals you a small amount on enemy hits"); } - public override void SetDefaults() - { - item.damage = 40; - item.ranged = true; - item.width = 14; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3.5f; - item.value = 2000; - item.shoot = mod.ProjectileType("BloodfireArrow"); - item.shootSpeed = 10f; - item.ammo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.width = 14; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 3.5f; + item.value = 2000; + item.shoot = mod.ProjectileType("BloodfireArrow"); + item.shootSpeed = 10f; + item.ammo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/BloodyEdge.cs b/Items/Weapons/BloodyEdge.cs index 2947996b36..4020f7428b 100644 --- a/Items/Weapons/BloodyEdge.cs +++ b/Items/Weapons/BloodyEdge.cs @@ -1,78 +1,78 @@ -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 -{ - public class BloodyEdge : ModItem - { +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 +{ + public class BloodyEdge : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Bloody Edge"); Tooltip.SetDefault("Chance to heal the player on enemy hits"); } - public override void SetDefaults() - { - item.width = 46; - item.damage = 47; - item.melee = true; - item.useAnimation = 23; - item.useStyle = 1; - item.useTime = 23; - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LightsBane); - recipe.AddIngredient(ItemID.BladeofGrass); - recipe.AddIngredient(ItemID.Muramasa); - recipe.AddIngredient(ItemID.FieryGreatsword); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BloodButcherer); - recipe.AddIngredient(ItemID.BladeofGrass); - recipe.AddIngredient(ItemID.Muramasa); - recipe.AddIngredient(ItemID.FieryGreatsword); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - int healAmount = (Main.rand.Next(3) + 1); - if (Main.rand.Next(2) == 0) - { - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - } -} + public override void SetDefaults() + { + item.width = 46; + item.damage = 47; + item.melee = true; + item.useAnimation = 23; + item.useStyle = 1; + item.useTime = 23; + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LightsBane); + recipe.AddIngredient(ItemID.BladeofGrass); + recipe.AddIngredient(ItemID.Muramasa); + recipe.AddIngredient(ItemID.FieryGreatsword); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BloodButcherer); + recipe.AddIngredient(ItemID.BladeofGrass); + recipe.AddIngredient(ItemID.Muramasa); + recipe.AddIngredient(ItemID.FieryGreatsword); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + int healAmount = (Main.rand.Next(3) + 1); + if (Main.rand.Next(2) == 0) + { + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + } +} diff --git a/Items/Weapons/BlossomFlux.cs b/Items/Weapons/BlossomFlux.cs index 28f9b6f65e..01d3e60c68 100644 --- a/Items/Weapons/BlossomFlux.cs +++ b/Items/Weapons/BlossomFlux.cs @@ -1,80 +1,80 @@ -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 BlossomFlux : 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.Weapons +{ + public class BlossomFlux : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Blossom Flux"); Tooltip.SetDefault("Legendary Drop\n" + "Fires a stream of leaves\n" + - "Right click to fire a spore orb that explodes into a cloud of spore gas\n" + + "Right click to fire a spore orb that explodes into a cloud of spore gas\n" + "Revengeance drop"); } - public override void SetDefaults() - { - item.damage = 22; - item.ranged = true; - item.width = 40; - item.height = 62; - item.useTime = 4; - item.useAnimation = 16; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 0.15f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LeafArrow"); - item.shootSpeed = 10f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 17; - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 25; - item.useAnimation = 25; - item.UseSound = SoundID.Item77; - } - else - { - item.useTime = 2; - item.useAnimation = 16; - item.UseSound = SoundID.Item5; - } - 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("SporeBomb"), (int)((double)damage * 6f), (knockBack * 60f), player.whoAmI, 0.0f, 0.0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LeafArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 22; + item.ranged = true; + item.width = 40; + item.height = 62; + item.useTime = 4; + item.useAnimation = 16; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 0.15f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LeafArrow"); + item.shootSpeed = 10f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 17; + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 25; + item.useAnimation = 25; + item.UseSound = SoundID.Item77; + } + else + { + item.useTime = 2; + item.useAnimation = 16; + item.UseSound = SoundID.Item5; + } + 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("SporeBomb"), (int)((double)damage * 6f), (knockBack * 60f), player.whoAmI, 0.0f, 0.0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LeafArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } + } +} diff --git a/Items/Weapons/BlushieStaff.cs b/Items/Weapons/BlushieStaff.cs index 56fe5467aa..79cd0f8da0 100644 --- a/Items/Weapons/BlushieStaff.cs +++ b/Items/Weapons/BlushieStaff.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons -{ - public class BlushieStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Staff of Blushie"); - Tooltip.SetDefault("Hold your mouse, wait, wait, wait, and put your trust in the power of blue magic"); - } - - public override void SetDefaults() - { - item.width = 38; - item.height = 38; - item.useStyle = 4; - item.useAnimation = 30; - item.useTime = 30; - item.channel = true; - item.noMelee = true; - item.damage = 1; - item.knockBack = 1f; - item.autoReuse = false; - item.useTurn = false; - item.magic = true; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item1; - item.shoot = mod.ProjectileType("BlushieStaffProj"); - item.mana = 200; - item.shootSpeed = 0f; - item.GetGlobalItem(mod).postMoonLordRarity = 19; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Phantoplasm", 100); - recipe.AddIngredient(null, "ShadowspecBar", 50); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons +{ + public class BlushieStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Staff of Blushie"); + Tooltip.SetDefault("Hold your mouse, wait, wait, wait, and put your trust in the power of blue magic"); + } + + public override void SetDefaults() + { + item.width = 38; + item.height = 38; + item.useStyle = 4; + item.useAnimation = 30; + item.useTime = 30; + item.channel = true; + item.noMelee = true; + item.damage = 1; + item.knockBack = 1f; + item.autoReuse = false; + item.useTurn = false; + item.magic = true; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item1; + item.shoot = mod.ProjectileType("BlushieStaffProj"); + item.mana = 200; + item.shootSpeed = 0f; + item.GetGlobalItem(mod).postMoonLordRarity = 19; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Phantoplasm", 100); + recipe.AddIngredient(null, "ShadowspecBar", 50); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Brimlash.cs b/Items/Weapons/Brimlash.cs index 6f25f2e9dd..1404990ab7 100644 --- a/Items/Weapons/Brimlash.cs +++ b/Items/Weapons/Brimlash.cs @@ -1,62 +1,62 @@ -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 -{ - public class Brimlash : ModItem - { +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 +{ + public class Brimlash : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Brimlash"); Tooltip.SetDefault("Fires a brimstone bolt that explodes into more bolts on death"); } - public override void SetDefaults() - { - item.width = 50; - item.damage = 64; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("Brimlash"); - item.shootSpeed = 15f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 4); - recipe.AddIngredient(null, "EssenceofChaos", 3); - recipe.AddIngredient(null, "LivingShard", 5); - 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, 235); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } -} + public override void SetDefaults() + { + item.width = 50; + item.damage = 64; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("Brimlash"); + item.shootSpeed = 15f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 4); + recipe.AddIngredient(null, "EssenceofChaos", 3); + recipe.AddIngredient(null, "LivingShard", 5); + 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, 235); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } +} diff --git a/Items/Weapons/BrimlashBuster.cs b/Items/Weapons/BrimlashBuster.cs index fe0724a9d3..b7a32fb027 100644 --- a/Items/Weapons/BrimlashBuster.cs +++ b/Items/Weapons/BrimlashBuster.cs @@ -1,71 +1,71 @@ -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 -{ - public class BrimlashBuster : ModItem - { +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 +{ + public class BrimlashBuster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Brimlash Buster"); - Tooltip.SetDefault("50% chance to do triple damage on enemy hits\n" + + Tooltip.SetDefault("50% chance to do triple damage on enemy hits\n" + "Fires a brimstone bolt that explodes into more bolts on death"); } - public override void SetDefaults() - { - item.width = 68; - item.damage = 100; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 8; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 68; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.shoot = mod.ProjectileType("Brimlash"); - item.shootSpeed = 18f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Brimlash"); - recipe.AddIngredient(null, "CoreofChaos", 3); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - 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, 235); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - if (Main.rand.Next(3) == 0) - { - item.damage = 378; - } - else - { - item.damage = 126; - } - } - } -} + public override void SetDefaults() + { + item.width = 68; + item.damage = 100; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 8; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 68; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.shoot = mod.ProjectileType("Brimlash"); + item.shootSpeed = 18f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Brimlash"); + recipe.AddIngredient(null, "CoreofChaos", 3); + recipe.AddIngredient(ItemID.FragmentSolar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + 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, 235); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + if (Main.rand.Next(3) == 0) + { + item.damage = 378; + } + else + { + item.damage = 126; + } + } + } +} diff --git a/Items/Weapons/BrimroseStaff.cs b/Items/Weapons/BrimroseStaff.cs index d71b3a0dab..7e8d110068 100644 --- a/Items/Weapons/BrimroseStaff.cs +++ b/Items/Weapons/BrimroseStaff.cs @@ -1,16 +1,16 @@ -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 BrimroseStaff : 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.Weapons +{ + public class BrimroseStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Brimrose Staff"); @@ -18,33 +18,33 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 20; - item.magic = true; - item.mana = 14; - item.width = 36; - item.height = 34; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneBeam"); - item.shootSpeed = 6f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 20; + item.magic = true; + item.mana = 14; + item.width = 36; + item.height = 34; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneBeam"); + item.shootSpeed = 6f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/BrimstoneFury.cs b/Items/Weapons/BrimstoneFury.cs index ece46b79d4..2cdbb533c2 100644 --- a/Items/Weapons/BrimstoneFury.cs +++ b/Items/Weapons/BrimstoneFury.cs @@ -1,61 +1,61 @@ -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 BrimstoneFury : 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.Weapons +{ + public class BrimstoneFury : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Fury"); Tooltip.SetDefault("Fires a spread of brimstone bolts"); - } - - 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(); - } - } -} \ No newline at end of file + } + + 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(); + } + } +} diff --git a/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs index ef41c7b505..5b2c598775 100644 --- a/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs +++ b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs @@ -1,54 +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; - -namespace CalamityMod.Items.Weapons.BrimstoneWaifu -{ - public class SeethingDischarge : 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.Weapons.BrimstoneWaifu +{ + public class SeethingDischarge : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Seething Discharge"); Tooltip.SetDefault("Fires a barrage of brimstone blasts"); } - - public override void SetDefaults() - { - item.damage = 58; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 32; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.75f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SeethingDischargeBrimstoneBarrage"); - item.shootSpeed = 6f; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedX = speedX + 10f * 0.05f; - float SpeedY = speedY + 10f * 0.05f; - float SpeedX2 = speedX - 10f * 0.05f; - 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, 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; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 58; + item.magic = true; + item.mana = 15; + item.width = 28; + item.height = 32; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.75f; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SeethingDischargeBrimstoneBarrage"); + item.shootSpeed = 6f; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + 10f * 0.05f; + float SpeedY = speedY + 10f * 0.05f; + float SpeedX2 = speedX - 10f * 0.05f; + 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, 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/BrinyBaron.cs b/Items/Weapons/BrinyBaron.cs index 626250d2ee..c73ae2de67 100644 --- a/Items/Weapons/BrinyBaron.cs +++ b/Items/Weapons/BrinyBaron.cs @@ -1,95 +1,95 @@ -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 -{ - public class BrinyBaron : ModItem - { +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 +{ + public class BrinyBaron : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Briny Baron"); - Tooltip.SetDefault("Legendary Drop\n" + + Tooltip.SetDefault("Legendary Drop\n" + "Striking an enemy with the blade causes a briny typhoon to appear\n" + - "Right click to fire a razorwind aqua blade\n" + + "Right click to fire a razorwind aqua blade\n" + "Revengeance drop"); } - public override void SetDefaults() - { - item.width = 62; - item.damage = 66; - item.melee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shootSpeed = 4f; - item.shoot = mod.ProjectileType("NobodyKnows"); - item.GetGlobalItem(mod).postMoonLordRarity = 17; - } - - 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.useTime = 15; - item.useAnimation = 15; - item.UseSound = SoundID.Item84; - } - else - { - item.noMelee = false; - item.noUseGraphic = false; - item.useTime = 20; - item.useAnimation = 20; - item.UseSound = SoundID.Item1; - } - 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("Razorwind"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NobodyKnows"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } - - 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, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255)); - } - } - - 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("BrinyTyphoonBubble"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI); - } - } -} + public override void SetDefaults() + { + item.width = 62; + item.damage = 66; + item.melee = true; + item.useAnimation = 20; + item.useTime = 20; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shootSpeed = 4f; + item.shoot = mod.ProjectileType("NobodyKnows"); + item.GetGlobalItem(mod).postMoonLordRarity = 17; + } + + 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.useTime = 15; + item.useAnimation = 15; + item.UseSound = SoundID.Item84; + } + else + { + item.noMelee = false; + item.noUseGraphic = false; + item.useTime = 20; + item.useAnimation = 20; + item.UseSound = SoundID.Item1; + } + 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("Razorwind"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NobodyKnows"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } + + 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, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255)); + } + } + + 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("BrinyTyphoonBubble"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI); + } + } +} diff --git a/Items/Weapons/Bumblebirb/GildedProboscis.cs b/Items/Weapons/Bumblebirb/GildedProboscis.cs index 9d887a17af..c783471903 100644 --- a/Items/Weapons/Bumblebirb/GildedProboscis.cs +++ b/Items/Weapons/Bumblebirb/GildedProboscis.cs @@ -1,55 +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.Weapons.Bumblebirb -{ - public class GildedProboscis : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gilded Proboscis"); - Tooltip.SetDefault("Ignores immunity frames\n" + - "Heals the player on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 66; - item.damage = 160; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = 5; - item.useTime = 19; - item.knockBack = 8.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("GildedProboscis"); - item.shootSpeed = 13f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - } -} +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.Bumblebirb +{ + public class GildedProboscis : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gilded Proboscis"); + Tooltip.SetDefault("Ignores immunity frames\n" + + "Heals the player on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 66; + item.damage = 160; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 19; + item.useStyle = 5; + item.useTime = 19; + item.knockBack = 8.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 66; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("GildedProboscis"); + item.shootSpeed = 13f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + } +} diff --git a/Items/Weapons/Bumblebirb/GoldenEagle.cs b/Items/Weapons/Bumblebirb/GoldenEagle.cs index 427a641af8..ac457b547d 100644 --- a/Items/Weapons/Bumblebirb/GoldenEagle.cs +++ b/Items/Weapons/Bumblebirb/GoldenEagle.cs @@ -1,61 +1,61 @@ -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.Bumblebirb -{ - public class GoldenEagle : 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.Weapons.Bumblebirb +{ + public class GoldenEagle : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Golden Eagle"); Tooltip.SetDefault("Fires 5 bullets at once"); } - - public override void SetDefaults() - { - item.damage = 40; - item.ranged = true; - item.noMelee = true; - item.width = 46; - item.height = 30; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = 5; - item.knockBack = 3f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 20f; - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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 + 5f * 0.05f; - float SpeedY = speedY + 5f * 0.05f; - float SpeedX2 = speedX - 5f * 0.05f; - float SpeedY2 = speedY - 5f * 0.05f; - float SpeedX3 = speedX + 0f * 0.05f; - float SpeedY3 = speedY + 0f * 0.05f; - float SpeedX4 = speedX - 10f * 0.05f; - float SpeedY4 = speedY - 10f * 0.05f; - float SpeedX5 = speedX + 10f * 0.05f; - float SpeedY5 = speedY + 10f * 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, type, 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, SpeedX4, SpeedY4, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX5, SpeedY5, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.noMelee = true; + item.width = 46; + item.height = 30; + item.useTime = 7; + item.useAnimation = 7; + item.useStyle = 5; + item.knockBack = 3f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 20f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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 + 5f * 0.05f; + float SpeedY = speedY + 5f * 0.05f; + float SpeedX2 = speedX - 5f * 0.05f; + float SpeedY2 = speedY - 5f * 0.05f; + float SpeedX3 = speedX + 0f * 0.05f; + float SpeedY3 = speedY + 0f * 0.05f; + float SpeedX4 = speedX - 10f * 0.05f; + float SpeedY4 = speedY - 10f * 0.05f; + float SpeedX5 = speedX + 10f * 0.05f; + float SpeedY5 = speedY + 10f * 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, type, 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, SpeedX4, SpeedY4, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX5, SpeedY5, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/Bumblebirb/RougeSlash.cs b/Items/Weapons/Bumblebirb/RougeSlash.cs index 11a0489813..937e833b7f 100644 --- a/Items/Weapons/Bumblebirb/RougeSlash.cs +++ b/Items/Weapons/Bumblebirb/RougeSlash.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.Bumblebirb -{ - public class RougeSlash : 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.Weapons.Bumblebirb +{ + public class RougeSlash : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Rouge Slash"); Tooltip.SetDefault("Fires a wave of 3 rouge air slashes"); } - - public override void SetDefaults() - { - item.damage = 90; - item.magic = true; - item.mana = 30; - item.width = 28; - item.height = 32; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item91; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("RougeSlashLarge"); - item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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("RougeSlashLarge"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, speedX * 0.8f, speedY * 0.8f, mod.ProjectileType("RougeSlashMedium"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, speedX * 0.6f, speedY * 0.6f, mod.ProjectileType("RougeSlashSmall"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 90; + item.magic = true; + item.mana = 30; + item.width = 28; + item.height = 32; + item.useTime = 19; + item.useAnimation = 19; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item91; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("RougeSlashLarge"); + item.shootSpeed = 24f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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("RougeSlashLarge"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX * 0.8f, speedY * 0.8f, mod.ProjectileType("RougeSlashMedium"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX * 0.6f, speedY * 0.6f, mod.ProjectileType("RougeSlashSmall"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/BurningSea.cs b/Items/Weapons/BurningSea.cs index e5b3004fb9..02f0f0dc40 100644 --- a/Items/Weapons/BurningSea.cs +++ b/Items/Weapons/BurningSea.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 BurningSea : 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.Weapons +{ + public class BurningSea : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Burning Sea"); Tooltip.SetDefault("Fires a bouncing brimstone fireball that splits into homing fireballs upon collision with water"); } - public override void SetDefaults() - { - item.damage = 79; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.5f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneFireball"); - item.shootSpeed = 15f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 79; + item.magic = true; + item.mana = 15; + item.width = 28; + item.height = 30; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.5f; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneFireball"); + item.shootSpeed = 15f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/BurntSienna.cs b/Items/Weapons/BurntSienna.cs index d215897ee3..0c5ee262fa 100644 --- a/Items/Weapons/BurntSienna.cs +++ b/Items/Weapons/BurntSienna.cs @@ -1,72 +1,72 @@ -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 -{ - public class BurntSienna : ModItem - { +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 +{ + public class BurntSienna : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Burnt Sienna"); Tooltip.SetDefault("Causes enemies to erupt into healing projectiles on death"); } - public override void SetDefaults() - { - item.width = 42; - item.damage = 30; - item.melee = true; - item.useAnimation = 21; - item.useTime = 21; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.shootSpeed = 5f; - } - - 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("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 SetDefaults() + { + item.width = 42; + item.damage = 30; + item.melee = true; + item.useAnimation = 21; + item.useTime = 21; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 54; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.shootSpeed = 5f; + } + + 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("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); + } + } + } +} diff --git a/Items/Weapons/Butcher.cs b/Items/Weapons/Butcher.cs index 9280645dd1..e75a56c4d0 100644 --- a/Items/Weapons/Butcher.cs +++ b/Items/Weapons/Butcher.cs @@ -1,60 +1,60 @@ -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 Butcher : 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.Weapons +{ + public class Butcher : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Butcher"); Tooltip.SetDefault("Fires faster and more accurately the longer you hold the trigger"); } - public override void SetDefaults() - { - item.damage = 17; - item.width = 20; - item.height = 12; - item.useTime = 40; - item.useAnimation = 40; - item.useStyle = 5; - item.rare = 5; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = SoundID.Item38; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Butcher"); - item.shootSpeed = 12f; - item.useAmmo = 97; - } - - 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("Butcher"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Shotgun); - recipe.AddIngredient(null, "EssenceofChaos", 4); - recipe.AddIngredient(null, "EssenceofEleum", 4); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 17; + item.width = 20; + item.height = 12; + item.useTime = 40; + item.useAnimation = 40; + item.useStyle = 5; + item.rare = 5; + item.knockBack = 1f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.UseSound = SoundID.Item38; + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Butcher"); + item.shootSpeed = 12f; + item.useAmmo = 97; + } + + 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("Butcher"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Shotgun); + recipe.AddIngredient(null, "EssenceofChaos", 4); + recipe.AddIngredient(null, "EssenceofEleum", 4); + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Calamitas/BlightedEyeStaff.cs b/Items/Weapons/Calamitas/BlightedEyeStaff.cs index 2c34b259a9..a8fd91eb33 100644 --- a/Items/Weapons/Calamitas/BlightedEyeStaff.cs +++ b/Items/Weapons/Calamitas/BlightedEyeStaff.cs @@ -1,86 +1,86 @@ -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.Weapons.Calamitas -{ - public class BlightedEyeStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Entropy's Vigil"); - Tooltip.SetDefault("Summons Calamitas and her brothers to protect you"); - } - - public override void SetDefaults() - { - item.damage = 32; - item.mana = 10; - item.width = 62; - item.height = 62; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item82; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Calamitamini"); - 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) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - 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 *= num80; - num79 *= num80; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Vector2 spinningpoint = new Vector2(num78, num79); - spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default(Vector2)); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, mod.ProjectileType("Calamitamini"), damage, num74, i, 0f, 0f); - spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default(Vector2)); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, mod.ProjectileType("Catastromini"), damage, num74, i, 0f, 0f); - spinningpoint = spinningpoint.RotatedBy(-5.1415927410125732, default(Vector2)); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, mod.ProjectileType("Cataclymini"), damage, num74, i, 0f, 0f); - return false; - } - } -} \ No newline at end of file +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.Weapons.Calamitas +{ + public class BlightedEyeStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Entropy's Vigil"); + Tooltip.SetDefault("Summons Calamitas and her brothers to protect you"); + } + + public override void SetDefaults() + { + item.damage = 32; + item.mana = 10; + item.width = 62; + item.height = 62; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item82; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Calamitamini"); + 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) + { + int i = Main.myPlayer; + float num72 = item.shootSpeed; + 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 *= num80; + num79 *= num80; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Vector2 spinningpoint = new Vector2(num78, num79); + spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default(Vector2)); + Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, mod.ProjectileType("Calamitamini"), damage, num74, i, 0f, 0f); + spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default(Vector2)); + Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, mod.ProjectileType("Catastromini"), damage, num74, i, 0f, 0f); + spinningpoint = spinningpoint.RotatedBy(-5.1415927410125732, default(Vector2)); + Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, mod.ProjectileType("Cataclymini"), damage, num74, i, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs b/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs index 1bd7eeeac6..21fc48105f 100644 --- a/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs +++ b/Items/Weapons/Calamitas/BrimstoneFlameblaster.cs @@ -1,40 +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.Weapons.Calamitas -{ - public class BrimstoneFlameblaster : 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.Weapons.Calamitas +{ + public class BrimstoneFlameblaster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Flameblaster"); Tooltip.SetDefault("Fires bouncing brimstone fireballs"); } - - public override void SetDefaults() - { - item.damage = 64; - item.ranged = true; - item.width = 50; - item.height = 18; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneBallFriendly"); - item.shootSpeed = 8.5f; - item.useAmmo = 23; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 64; + item.ranged = true; + item.width = 50; + item.height = 18; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneBallFriendly"); + item.shootSpeed = 8.5f; + item.useAmmo = 23; + } + } +} diff --git a/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs index 82e2b159d7..fc45711969 100644 --- a/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs +++ b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.cs @@ -1,39 +1,39 @@ -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.Calamitas -{ - public class BrimstoneFlamesprayer : 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.Weapons.Calamitas +{ + public class BrimstoneFlamesprayer : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Havoc's Breath"); } - - public override void SetDefaults() - { - item.damage = 59; - item.ranged = true; - item.width = 50; - item.height = 18; - item.useTime = 9; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneFireFriendly"); - item.shootSpeed = 8.5f; - item.useAmmo = 23; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 59; + item.ranged = true; + item.width = 50; + item.height = 18; + item.useTime = 9; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneFireFriendly"); + item.shootSpeed = 8.5f; + item.useAmmo = 23; + } + } +} diff --git a/Items/Weapons/Calamitas/CalamitasInferno.cs b/Items/Weapons/Calamitas/CalamitasInferno.cs index 3811101071..d2dc31fc9d 100644 --- a/Items/Weapons/Calamitas/CalamitasInferno.cs +++ b/Items/Weapons/Calamitas/CalamitasInferno.cs @@ -1,39 +1,39 @@ -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.Calamitas -{ - public class CalamitasInferno : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lashes of Chaos"); - Tooltip.SetDefault("Watch the world burn..."); - } - - public override void SetDefaults() - { - item.damage = 98; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneHellfireballFriendly"); - item.shootSpeed = 16f; - } - } -} \ No newline at end of file +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.Calamitas +{ + public class CalamitasInferno : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lashes of Chaos"); + Tooltip.SetDefault("Watch the world burn..."); + } + + public override void SetDefaults() + { + item.damage = 98; + item.magic = true; + item.mana = 20; + item.width = 28; + item.height = 30; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneHellfireballFriendly"); + item.shootSpeed = 16f; + } + } +} diff --git a/Items/Weapons/Calamitas/TheEyeofCalamitas.cs b/Items/Weapons/Calamitas/TheEyeofCalamitas.cs index 3fe0acbb9d..2f62309d28 100644 --- a/Items/Weapons/Calamitas/TheEyeofCalamitas.cs +++ b/Items/Weapons/Calamitas/TheEyeofCalamitas.cs @@ -1,36 +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.Weapons.Calamitas -{ - public class TheEyeofCalamitas : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oblivion"); - Tooltip.SetDefault("Fires brimstone lasers when enemies are near"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 41; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TheEyeofCalamitasProjectile"); - } - } -} \ No newline at end of file +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.Calamitas +{ + public class TheEyeofCalamitas : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oblivion"); + Tooltip.SetDefault("Fires brimstone lasers when enemies are near"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.damage = 41; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TheEyeofCalamitasProjectile"); + } + } +} diff --git a/Items/Weapons/CarnageRay.cs b/Items/Weapons/CarnageRay.cs index 8a30a87d1d..8c3701f22d 100644 --- a/Items/Weapons/CarnageRay.cs +++ b/Items/Weapons/CarnageRay.cs @@ -1,16 +1,16 @@ -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 CarnageRay : 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.Weapons +{ + public class CarnageRay : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Carnage Ray"); @@ -18,38 +18,38 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 35; - item.magic = true; - item.mana = 10; - item.width = 46; - item.height = 46; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodRay"); - item.shootSpeed = 6f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WandofSparking); - recipe.AddIngredient(ItemID.CrimsonRod); - recipe.AddIngredient(ItemID.AmberStaff); - recipe.AddIngredient(ItemID.MagicMissile); - recipe.AddIngredient(null, "BloodSample", 15); - recipe.AddIngredient(null, "PurifiedGel", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 35; + item.magic = true; + item.mana = 10; + item.width = 46; + item.height = 46; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item72; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodRay"); + item.shootSpeed = 6f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WandofSparking); + recipe.AddIngredient(ItemID.CrimsonRod); + recipe.AddIngredient(ItemID.AmberStaff); + recipe.AddIngredient(ItemID.MagicMissile); + recipe.AddIngredient(null, "BloodSample", 15); + recipe.AddIngredient(null, "PurifiedGel", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/CatastropheClaymore.cs b/Items/Weapons/CatastropheClaymore.cs index bdfd742d04..95958e8370 100644 --- a/Items/Weapons/CatastropheClaymore.cs +++ b/Items/Weapons/CatastropheClaymore.cs @@ -1,95 +1,95 @@ -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 -{ - public class CatastropheClaymore : ModItem - { +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 +{ + public class CatastropheClaymore : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Catastrophe Claymore"); Tooltip.SetDefault("Fires explosive energy bolts"); } - public override void SetDefaults() - { - item.width = 56; - item.damage = 67; - item.melee = true; - item.useAnimation = 23; - item.useTime = 23; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 56; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = mod.ProjectileType("CalamityAura"); - item.shootSpeed = 11f; - } - - 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(3)) - { - case 0: type = mod.ProjectileType("CalamityAura"); break; - case 1: type = mod.ProjectileType("CalamityAuraType2"); break; - case 2: type = mod.ProjectileType("CalamityAuraType3"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HallowedBar, 10); - recipe.AddIngredient(ItemID.CrystalShard, 15); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ItemID.CursedFlame, 5); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HallowedBar, 10); - recipe.AddIngredient(ItemID.CrystalShard, 15); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ItemID.Ichor, 5); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - 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, 73); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(3) == 0) - { - target.AddBuff(BuffID.Ichor, 120); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 180); - } - } - } -} + public override void SetDefaults() + { + item.width = 56; + item.damage = 67; + item.melee = true; + item.useAnimation = 23; + item.useTime = 23; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 56; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.shoot = mod.ProjectileType("CalamityAura"); + item.shootSpeed = 11f; + } + + 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(3)) + { + case 0: type = mod.ProjectileType("CalamityAura"); break; + case 1: type = mod.ProjectileType("CalamityAuraType2"); break; + case 2: type = mod.ProjectileType("CalamityAuraType3"); break; + default: break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HallowedBar, 10); + recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddIngredient(ItemID.CursedFlame, 5); + recipe.AddIngredient(ItemID.SoulofMight, 3); + recipe.AddIngredient(ItemID.SoulofSight, 3); + recipe.AddIngredient(ItemID.SoulofFright, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HallowedBar, 10); + recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddIngredient(ItemID.Ichor, 5); + recipe.AddIngredient(ItemID.SoulofMight, 3); + recipe.AddIngredient(ItemID.SoulofSight, 3); + recipe.AddIngredient(ItemID.SoulofFright, 3); + 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, 73); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(3) == 0) + { + target.AddBuff(BuffID.Ichor, 120); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Frostburn, 180); + } + } + } +} diff --git a/Items/Weapons/CausticEdge.cs b/Items/Weapons/CausticEdge.cs index 7af241c6c4..1da08e5338 100644 --- a/Items/Weapons/CausticEdge.cs +++ b/Items/Weapons/CausticEdge.cs @@ -1,61 +1,61 @@ -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 -{ - public class CausticEdge : ModItem - { +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 +{ + public class CausticEdge : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Caustic Edge"); Tooltip.SetDefault("Inflicts poison and venom on enemy hits"); } - public override void SetDefaults() - { - item.width = 46; - item.damage = 44; - item.melee = true; - item.useTurn = true; - item.useAnimation = 27; - item.useStyle = 1; - item.useTime = 27; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BladeofGrass); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.AddIngredient(ItemID.Deathweed, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 74); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 480); - target.AddBuff(BuffID.Venom, 240); - } - } -} + public override void SetDefaults() + { + item.width = 46; + item.damage = 44; + item.melee = true; + item.useTurn = true; + item.useAnimation = 27; + item.useStyle = 1; + item.useTime = 27; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 48; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BladeofGrass); + recipe.AddIngredient(ItemID.LavaBucket); + recipe.AddIngredient(ItemID.Deathweed, 5); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 74); + } + } + + 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/CelestialClaymore.cs b/Items/Weapons/CelestialClaymore.cs index 72919264bb..f5bf6e8cda 100644 --- a/Items/Weapons/CelestialClaymore.cs +++ b/Items/Weapons/CelestialClaymore.cs @@ -1,116 +1,116 @@ -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 -{ - public class CelestialClaymore : ModItem - { +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 +{ + public class CelestialClaymore : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Celestial Claymore"); Tooltip.SetDefault("Spawns cosmic energy flames near the player that generate large explosions"); } - public override void SetDefaults() - { - item.width = 50; - item.damage = 63; - item.melee = true; - item.useAnimation = 23; - item.useTime = 23; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("CosmicSpiritBomb1"); - item.shootSpeed = 0.1f; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - 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 = 3; - 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); - 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; - switch (Main.rand.Next(3)) - { - case 0: type = mod.ProjectileType("CosmicSpiritBomb1"); break; - case 1: type = mod.ProjectileType("CosmicSpiritBomb2"); break; - case 2: type = mod.ProjectileType("CosmicSpiritBomb3"); break; - default: break; - } - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - } - return false; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(4) == 0) - { - int num249 = Main.rand.Next(2); - if (num249 == 0) - { - num249 = 15; - } - else if (num249 == 1) - { - num249 = 73; - } - else - { - num249 = 244; - } - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, num249, (float)(player.direction * 2), 0f, 150, default(Color), 1.3f); - Main.dust[num250].velocity *= 0.2f; - } - } - } -} + public override void SetDefaults() + { + item.width = 50; + item.damage = 63; + item.melee = true; + item.useAnimation = 23; + item.useTime = 23; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("CosmicSpiritBomb1"); + item.shootSpeed = 0.1f; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + 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 = 3; + 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); + 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; + switch (Main.rand.Next(3)) + { + case 0: type = mod.ProjectileType("CosmicSpiritBomb1"); break; + case 1: type = mod.ProjectileType("CosmicSpiritBomb2"); break; + case 2: type = mod.ProjectileType("CosmicSpiritBomb3"); break; + default: break; + } + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + } + return false; + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(4) == 0) + { + int num249 = Main.rand.Next(2); + if (num249 == 0) + { + num249 = 15; + } + else if (num249 == 1) + { + num249 = 73; + } + else + { + num249 = 244; + } + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, num249, (float)(player.direction * 2), 0f, 150, default(Color), 1.3f); + Main.dust[num250].velocity *= 0.2f; + } + } + } +} diff --git a/Items/Weapons/Chaotrix.cs b/Items/Weapons/Chaotrix.cs index 3ee859d483..eb406abc1e 100644 --- a/Items/Weapons/Chaotrix.cs +++ b/Items/Weapons/Chaotrix.cs @@ -1,45 +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.Weapons -{ - public class Chaotrix : 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.Weapons +{ + public class Chaotrix : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Chaotrix"); Tooltip.SetDefault("Explodes on enemy hits"); } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Yelets); - item.damage = 110; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ChaotrixProjectile"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Yelets); + item.damage = 110; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ChaotrixProjectile"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ChargedDartRifle.cs b/Items/Weapons/ChargedDartRifle.cs index 873001665a..154beae637 100644 --- a/Items/Weapons/ChargedDartRifle.cs +++ b/Items/Weapons/ChargedDartRifle.cs @@ -1,84 +1,84 @@ -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 ChargedDartRifle : 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.Weapons +{ + public class ChargedDartRifle : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Charged Dart Blaster"); Tooltip.SetDefault("Right click to fire an exploding energy blast that bounces"); } - public override void SetDefaults() - { - item.damage = 126; - item.ranged = true; - item.width = 60; - item.height = 24; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.autoReuse = true; - item.shootSpeed = 22f; - item.shoot = mod.ProjectileType("ChargedBlast"); - item.useAmmo = 283; - } - - 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) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ChargedBlast3"), (int)((double)damage * 0.85), knockBack, player.whoAmI, 0f, 0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DartRifle); - recipe.AddIngredient(ItemID.MartianConduitPlating, 25); - recipe.AddIngredient(null, "CoreofEleum", 3); - recipe.AddIngredient(ItemID.FragmentVortex, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DartPistol); - recipe.AddIngredient(ItemID.MartianConduitPlating, 25); - recipe.AddIngredient(null, "CoreofEleum", 3); - recipe.AddIngredient(ItemID.FragmentVortex, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 126; + item.ranged = true; + item.width = 60; + item.height = 24; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.autoReuse = true; + item.shootSpeed = 22f; + item.shoot = mod.ProjectileType("ChargedBlast"); + item.useAmmo = 283; + } + + 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) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ChargedBlast3"), (int)((double)damage * 0.85), knockBack, player.whoAmI, 0f, 0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DartRifle); + recipe.AddIngredient(ItemID.MartianConduitPlating, 25); + recipe.AddIngredient(null, "CoreofEleum", 3); + recipe.AddIngredient(ItemID.FragmentVortex, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DartPistol); + recipe.AddIngredient(ItemID.MartianConduitPlating, 25); + recipe.AddIngredient(null, "CoreofEleum", 3); + recipe.AddIngredient(ItemID.FragmentVortex, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ClaretCannon.cs b/Items/Weapons/ClaretCannon.cs index 7a6a84a014..fe7e00ea52 100644 --- a/Items/Weapons/ClaretCannon.cs +++ b/Items/Weapons/ClaretCannon.cs @@ -1,62 +1,62 @@ -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 ClaretCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Claret Cannon"); - Tooltip.SetDefault("Fires a string of bloodfire bullets that drain enemy health"); - } - - public override void SetDefaults() - { - item.damage = 215; - item.ranged = true; - item.width = 48; - item.height = 30; - item.useTime = 3; - item.reuseDelay = 10; - item.useAnimation = 9; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("BloodfireBullet"); - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(0, -5); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 4); - recipe.AddTile(TileID.LunarCraftingStation); - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodfireBullet"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file +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 ClaretCannon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Claret Cannon"); + Tooltip.SetDefault("Fires a string of bloodfire bullets that drain enemy health"); + } + + public override void SetDefaults() + { + item.damage = 215; + item.ranged = true; + item.width = 48; + item.height = 30; + item.useTime = 3; + item.reuseDelay = 10; + item.useAnimation = 9; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item40; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("BloodfireBullet"); + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(0, -5); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 4); + recipe.AddTile(TileID.LunarCraftingStation); + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BloodfireBullet"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/CleansingBlaze.cs b/Items/Weapons/CleansingBlaze.cs index 224ca18dc4..8eee372b5d 100644 --- a/Items/Weapons/CleansingBlaze.cs +++ b/Items/Weapons/CleansingBlaze.cs @@ -1,74 +1,74 @@ -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 CleansingBlaze : 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.Weapons +{ + public class CleansingBlaze : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cleansing Blaze"); Tooltip.SetDefault("90% chance to not consume gel"); - } - - public override void SetDefaults() - { - item.damage = 250; - item.ranged = true; - item.width = 60; - item.height = 34; - item.useTime = 3; - item.useAnimation = 12; - item.useStyle = 5; - 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.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) - { - 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() - { - 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(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 250; + item.ranged = true; + item.width = 60; + item.height = 34; + item.useTime = 3; + item.useAnimation = 12; + item.useStyle = 5; + 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.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) + { + 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() + { + 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(); + } + } +} diff --git a/Items/Weapons/Climax.cs b/Items/Weapons/Climax.cs index e98745e637..d484067e3a 100644 --- a/Items/Weapons/Climax.cs +++ b/Items/Weapons/Climax.cs @@ -1,89 +1,89 @@ -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 Climax : 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.Weapons +{ + public class Climax : ModItem + { public override void SetStaticDefaults() { 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; - 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(); - } - } -} \ No newline at end of file + } + + 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(); + } + } +} diff --git a/Items/Weapons/ClockGatlignum.cs b/Items/Weapons/ClockGatlignum.cs index 59eff99eb7..f86a3e64fa 100644 --- a/Items/Weapons/ClockGatlignum.cs +++ b/Items/Weapons/ClockGatlignum.cs @@ -1,74 +1,74 @@ -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 ClockGatlignum : 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.Weapons +{ + public class ClockGatlignum : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Clock Gatlignum"); - Tooltip.SetDefault("33% chance to not consume ammo\n" + + Tooltip.SetDefault("33% chance to not consume ammo\n" + "Fires a string of high velocity bullets"); } - public override void SetDefaults() - { - item.damage = 45; - 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 = 3.75f; - 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; - } - - 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; - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Gatligator); - recipe.AddIngredient(ItemID.VenusMagnum); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 45; + 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 = 3.75f; + 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; + } + + 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; + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Gatligator); + recipe.AddIngredient(ItemID.VenusMagnum); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ClockworkBow.cs b/Items/Weapons/ClockworkBow.cs index 1d61879706..6a12d64cf6 100644 --- a/Items/Weapons/ClockworkBow.cs +++ b/Items/Weapons/ClockworkBow.cs @@ -1,124 +1,124 @@ -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 ClockworkBow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Clockwork Bow"); - Tooltip.SetDefault("Fires a storm of arrows in random directions\n" + - "All arrows fired will go through blocks"); - } - - public override void SetDefaults() - { - item.damage = 100; - item.ranged = true; - item.width = 34; - item.height = 100; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.25f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 30f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Cog, 50); - recipe.AddIngredient(ItemID.LunarBar, 15); - recipe.AddTile(TileID.LunarCraftingStation); - 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) - { - 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); - 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 *= num80; - num79 *= num80; - int num130 = 15; - if (Main.rand.Next(3) == 0) - { - num130++; - } - if (Main.rand.Next(4) == 0) - { - num130++; - } - if (Main.rand.Next(5) == 0) - { - num130++; - } - for (int num131 = 0; num131 < num130; num131++) - { - 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); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num131); - 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(-600, 601) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-600, 601) * 0.02f; - int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, num73, num74, i, 0f, 0f); - Main.projectile[projectile].tileCollide = false; - Main.projectile[projectile].timeLeft = 240; - Main.projectile[projectile].noDropItem = true; - } - return false; - } - } -} \ No newline at end of file +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 ClockworkBow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clockwork Bow"); + Tooltip.SetDefault("Fires a storm of arrows in random directions\n" + + "All arrows fired will go through blocks"); + } + + public override void SetDefaults() + { + item.damage = 100; + item.ranged = true; + item.width = 34; + item.height = 100; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.25f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 30f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Cog, 50); + recipe.AddIngredient(ItemID.LunarBar, 15); + recipe.AddTile(TileID.LunarCraftingStation); + 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) + { + 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); + 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 *= num80; + num79 *= num80; + int num130 = 15; + if (Main.rand.Next(3) == 0) + { + num130++; + } + if (Main.rand.Next(4) == 0) + { + num130++; + } + if (Main.rand.Next(5) == 0) + { + num130++; + } + for (int num131 = 0; num131 < num130; num131++) + { + 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); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num131); + 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(-600, 601) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-600, 601) * 0.02f; + int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, num73, num74, i, 0f, 0f); + Main.projectile[projectile].tileCollide = false; + Main.projectile[projectile].timeLeft = 240; + Main.projectile[projectile].noDropItem = true; + } + return false; + } + } +} diff --git a/Items/Weapons/Cnidarian.cs b/Items/Weapons/Cnidarian.cs index bcd578e5cc..4431eb45e8 100644 --- a/Items/Weapons/Cnidarian.cs +++ b/Items/Weapons/Cnidarian.cs @@ -1,45 +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.Weapons -{ - public class Cnidarian : 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.Weapons +{ + public class Cnidarian : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cnidarian"); Tooltip.SetDefault("Fires a seashell when enemies are near"); } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.CorruptYoyo); - item.damage = 13; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CnidarianProjectile"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.CloneDefaults(ItemID.CorruptYoyo); + item.damage = 13; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.autoReuse = true; + item.shoot = mod.ProjectileType("CnidarianProjectile"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/CometQuasher.cs b/Items/Weapons/CometQuasher.cs index 5bad863211..f654cea7d0 100644 --- a/Items/Weapons/CometQuasher.cs +++ b/Items/Weapons/CometQuasher.cs @@ -1,112 +1,112 @@ -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 -{ - public class CometQuasher : 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; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class CometQuasher : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Comet Quasher"); Tooltip.SetDefault("Summons a swarm of meteors from the sky on enemy hits"); } - public override void SetDefaults() - { - item.width = 54; - item.damage = 120; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shootSpeed = 9f; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - 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 num112 = 3; - for (int num113 = 0; num113 < num112; num113++) - { - 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 * num113); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; - 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 num114 = num78; - float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, 424 + Main.rand.Next(3), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; - } - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 25); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 54; + item.damage = 120; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 7.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 54; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shootSpeed = 9f; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + 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 num112 = 3; + for (int num113 = 0; num113 < num112; num113++) + { + 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 * num113); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; + 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 num114 = num78; + float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, 424 + Main.rand.Next(3), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 25); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ConferenceCall.cs b/Items/Weapons/ConferenceCall.cs index 9743d17f2e..58f8573029 100644 --- a/Items/Weapons/ConferenceCall.cs +++ b/Items/Weapons/ConferenceCall.cs @@ -1,120 +1,120 @@ -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 ConferenceCall : 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.Weapons +{ + public class ConferenceCall : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Conclave Crossfire"); - Tooltip.SetDefault("50% chance to not consume ammo\n" + + Tooltip.SetDefault("50% chance to not consume ammo\n" + "Fires two spreads of bullets, one from the gun and one from the sky"); } - public override void SetDefaults() - { - item.damage = 30; - item.ranged = true; - item.width = 66; - item.height = 26; - item.useTime = 26; - item.useAnimation = 26; - 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 = 13f; - item.shoot = 10; - item.useAmmo = 97; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - 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 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, 0f, 0f); - } - 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 < 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); - 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(-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, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TacticalShotgun); - recipe.AddIngredient(null, "CoreofChaos", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 66; + item.height = 26; + item.useTime = 26; + item.useAnimation = 26; + 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 = 13f; + item.shoot = 10; + item.useAmmo = 97; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + 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 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, 0f, 0f); + } + 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 < 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); + 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(-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, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TacticalShotgun); + recipe.AddIngredient(null, "CoreofChaos", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Contagion.cs b/Items/Weapons/Contagion.cs index 7617f4b20f..54550725bc 100644 --- a/Items/Weapons/Contagion.cs +++ b/Items/Weapons/Contagion.cs @@ -1,58 +1,58 @@ -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 Contagion : 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.Weapons +{ + public class Contagion : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Contagion"); Tooltip.SetDefault("Fires contagion arrows that leave exploding orbs behind as they travel"); } - public override void SetDefaults() - { - item.damage = 4000; - item.ranged = true; - item.width = 22; - item.height = 50; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 5f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Contagion"); - item.shootSpeed = 20f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(ItemID.Phantasm); - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Contagion"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 4000; + item.ranged = true; + item.width = 22; + item.height = 50; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 5f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Contagion"); + item.shootSpeed = 20f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(ItemID.Phantasm); + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Contagion"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/CoralSpout.cs b/Items/Weapons/CoralSpout.cs index 490f1ff3a3..247397552c 100644 --- a/Items/Weapons/CoralSpout.cs +++ b/Items/Weapons/CoralSpout.cs @@ -1,50 +1,50 @@ -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 CoralSpout : 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.Weapons +{ + public class CoralSpout : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Coral Spout"); Tooltip.SetDefault("Casts coral water spouts that lay on the ground and damage enemies"); } - public override void SetDefaults() - { - item.damage = 13; - item.magic = true; - item.mana = 4; - item.width = 28; - item.height = 30; - item.useTime = 26; - item.useAnimation = 26; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item17; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CoralSpike"); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddIngredient(ItemID.Coral, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 13; + item.magic = true; + item.mana = 4; + item.width = 28; + item.height = 30; + item.useTime = 26; + item.useAnimation = 26; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item17; + item.autoReuse = true; + item.shoot = mod.ProjectileType("CoralSpike"); + item.shootSpeed = 16f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddIngredient(ItemID.Coral, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/CosmicBolter.cs b/Items/Weapons/CosmicBolter.cs index 701cb8b63a..ff52335cc4 100644 --- a/Items/Weapons/CosmicBolter.cs +++ b/Items/Weapons/CosmicBolter.cs @@ -1,75 +1,75 @@ -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 CosmicBolter : 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.Weapons +{ + public class CosmicBolter : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Bolter"); Tooltip.SetDefault("Fires three bouncing energy bolts"); - } - - 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, 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 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 30f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("LunarBolt2"), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; - } - 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(); - } - } -} \ No newline at end of file + } + + 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, 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 = 3; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 30f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("LunarBolt2"), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + } + 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(); + } + } +} diff --git a/Items/Weapons/CosmicDischarge.cs b/Items/Weapons/CosmicDischarge.cs index f48033c8d0..4a17af91ea 100644 --- a/Items/Weapons/CosmicDischarge.cs +++ b/Items/Weapons/CosmicDischarge.cs @@ -1,51 +1,51 @@ -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 -{ - public class CosmicDischarge : ModItem - { +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 +{ + public class CosmicDischarge : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Discharge"); Tooltip.SetDefault("Legendary Drop\n" + "Striking an enemy with the whip causes glacial explosions and grants the player the cosmic freeze buff\n" + - "This buff gives the player increased life regen while standing still and freezes enemies near the player\n" + + "This buff gives the player increased life regen while standing still and freezes enemies near the player\n" + "Revengeance drop"); } - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.damage = 1000; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = 15; - item.useTime = 15; - item.useStyle = 5; - item.knockBack = 0.5f; - item.UseSound = SoundID.Item122; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("CosmicDischarge"); - item.GetGlobalItem(mod).postMoonLordRarity = 17; - } - - 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 ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3); - return false; - } - } -} + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.damage = 1000; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.autoReuse = true; + item.melee = true; + item.useAnimation = 15; + item.useTime = 15; + item.useStyle = 5; + item.knockBack = 0.5f; + item.UseSound = SoundID.Item122; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("CosmicDischarge"); + item.GetGlobalItem(mod).postMoonLordRarity = 17; + } + + 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 ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3); + return false; + } + } +} diff --git a/Items/Weapons/CosmicImmaterializer.cs b/Items/Weapons/CosmicImmaterializer.cs index edb85ef2e9..f3e4a0c622 100644 --- a/Items/Weapons/CosmicImmaterializer.cs +++ b/Items/Weapons/CosmicImmaterializer.cs @@ -1,115 +1,115 @@ -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.Weapons -{ - public class CosmicImmaterializer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Immaterializer"); - Tooltip.SetDefault("Summons a cosmic energy spiral to fight for you\n" + - "The orb will fire swarms of homing energy bolts when enemies are detected by it\n" + - "Requires 10 minion slots to use\n" + - "There can only be one\n" + - "Without a summoner armor set bonus this minion will deal less damage"); - } - - public override void SetDefaults() - { - item.mana = 100; - item.damage = 3000; - item.useStyle = 1; - item.width = 74; - item.height = 72; - item.useTime = 36; - item.useAnimation = 36; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CosmicEnergy"); - item.shootSpeed = 10f; - item.summon = true; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == mod.ProjectileType("CosmicEnergy") && p.owner == player.whoAmI) - { - return false; - } - } - 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) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - bool hasSummonerSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon; - 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 = item.shootSpeed; - } - else - { - num80 = item.shootSpeed / 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, (int)((double)damage * (hasSummonerSet ? 1.0 : 0.66)), knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SunGodStaff"); - recipe.AddIngredient(null, "AncientIceChunk"); - recipe.AddIngredient(null, "ElementalAxe"); - recipe.AddIngredient(null, "EnergyStaff"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "HellcasterFragment", 3); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "AuricOre", 25); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.Weapons +{ + public class CosmicImmaterializer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Immaterializer"); + Tooltip.SetDefault("Summons a cosmic energy spiral to fight for you\n" + + "The orb will fire swarms of homing energy bolts when enemies are detected by it\n" + + "Requires 10 minion slots to use\n" + + "There can only be one\n" + + "Without a summoner armor set bonus this minion will deal less damage"); + } + + public override void SetDefaults() + { + item.mana = 100; + item.damage = 3000; + item.useStyle = 1; + item.width = 74; + item.height = 72; + item.useTime = 36; + item.useAnimation = 36; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.shoot = mod.ProjectileType("CosmicEnergy"); + item.shootSpeed = 10f; + item.summon = true; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.type == mod.ProjectileType("CosmicEnergy") && p.owner == player.whoAmI) + { + return false; + } + } + 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) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + bool hasSummonerSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon; + 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 = item.shootSpeed; + } + else + { + num80 = item.shootSpeed / 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, (int)((double)damage * (hasSummonerSet ? 1.0 : 0.66)), knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SunGodStaff"); + recipe.AddIngredient(null, "AncientIceChunk"); + recipe.AddIngredient(null, "ElementalAxe"); + recipe.AddIngredient(null, "EnergyStaff"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "HellcasterFragment", 3); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/CosmicRainbow.cs b/Items/Weapons/CosmicRainbow.cs index af474be38d..91f762cbf9 100644 --- a/Items/Weapons/CosmicRainbow.cs +++ b/Items/Weapons/CosmicRainbow.cs @@ -1,119 +1,119 @@ -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 CosmicRainbow : 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.Weapons +{ + public class CosmicRainbow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Rainbow"); Tooltip.SetDefault("Launches a barrage of rainbows"); - } - - public override void SetDefaults() - { - item.damage = 105; - item.magic = true; - item.mana = 30; - item.width = 38; - item.height = 66; - item.useTime = 35; - item.useAnimation = 35; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item67; - item.autoReuse = true; - item.shoot = 250; - item.shootSpeed = 18f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RainbowGun); - recipe.AddIngredient(null, "MeldiateBar", 5); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddTile(TileID.LunarCraftingStation); - 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) - { - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 60f; - bool flag11 = Collision.CanHit(vector, 0, 0, vector + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - Projectile.NewProjectile(vector.X + value9.X, vector.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - 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 < 2; 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); - } - return false; - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 105; + item.magic = true; + item.mana = 30; + item.width = 38; + item.height = 66; + item.useTime = 35; + item.useAnimation = 35; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item67; + item.autoReuse = true; + item.shoot = 250; + item.shootSpeed = 18f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RainbowGun); + recipe.AddIngredient(null, "MeldiateBar", 5); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddTile(TileID.LunarCraftingStation); + 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) + { + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 3; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 60f; + bool flag11 = Collision.CanHit(vector, 0, 0, vector + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + Projectile.NewProjectile(vector.X + value9.X, vector.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + 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 < 2; 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); + } + return false; + } + } +} diff --git a/Items/Weapons/Cosmilamp.cs b/Items/Weapons/Cosmilamp.cs index 54dbe81f0c..d37548481e 100644 --- a/Items/Weapons/Cosmilamp.cs +++ b/Items/Weapons/Cosmilamp.cs @@ -1,78 +1,78 @@ -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.Weapons -{ - public class Cosmilamp : ModItem - { +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.Weapons +{ + public class Cosmilamp : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmilamp"); - Tooltip.SetDefault("Summons a cosmic lantern to fight for you\n" + + Tooltip.SetDefault("Summons a cosmic lantern to fight for you\n" + "Takes up 2 minion slots"); } - public override void SetDefaults() - { - item.damage = 180; - item.mana = 10; - item.width = 42; - item.height = 60; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Cosmilamp"); - item.shootSpeed = 10f; - item.summon = true; - 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; - 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("Cosmilamp"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 180; + item.mana = 10; + item.width = 42; + item.height = 60; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Cosmilamp"); + item.shootSpeed = 10f; + item.summon = true; + 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; + 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("Cosmilamp"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Crabulon/Fungicide.cs b/Items/Weapons/Crabulon/Fungicide.cs index b801039bfa..bc1d3e7c02 100644 --- a/Items/Weapons/Crabulon/Fungicide.cs +++ b/Items/Weapons/Crabulon/Fungicide.cs @@ -1,46 +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.Crabulon -{ - public class Fungicide : 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.Weapons.Crabulon +{ + public class Fungicide : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Fungicide"); Tooltip.SetDefault("Shoots fungal rounds that split on death"); } - - public override void SetDefaults() - { - item.damage = 11; - item.ranged = true; - item.width = 40; - item.height = 26; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FungiOrb"); - item.shootSpeed = 14f; - item.useAmmo = 97; - } - - 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("FungiOrb"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 11; + item.ranged = true; + item.width = 40; + item.height = 26; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item61; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FungiOrb"); + item.shootSpeed = 14f; + item.useAmmo = 97; + } + + 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("FungiOrb"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Crabulon/HyphaeRod.cs b/Items/Weapons/Crabulon/HyphaeRod.cs index f727f95c3f..1e406752ca 100644 --- a/Items/Weapons/Crabulon/HyphaeRod.cs +++ b/Items/Weapons/Crabulon/HyphaeRod.cs @@ -1,97 +1,97 @@ -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.Crabulon -{ - public class HyphaeRod : 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; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons.Crabulon +{ + public class HyphaeRod : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Hyphae Rod"); Tooltip.SetDefault("Creates mushroom spores near the player"); Item.staff[item.type] = true; } - - public override void SetDefaults() - { - item.damage = 20; - item.magic = true; - item.mana = 7; - item.width = 34; - item.height = 34; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = 590; - item.shootSpeed = 1f; - } - - 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; - 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 *= num80; - num79 *= num80; - int num107 = 3; - 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); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-100, 101); - vector2.Y -= (float)(50 * 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(-180, 181) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - 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; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 20; + item.magic = true; + item.mana = 7; + item.width = 34; + item.height = 34; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = 590; + item.shootSpeed = 1f; + } + + 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; + 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 *= num80; + num79 *= num80; + int num107 = 3; + 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); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-100, 101); + vector2.Y -= (float)(50 * 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(-180, 181) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; + 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/Crabulon/MycelialClaws.cs b/Items/Weapons/Crabulon/MycelialClaws.cs index cb910bbee5..8b811dc353 100644 --- a/Items/Weapons/Crabulon/MycelialClaws.cs +++ b/Items/Weapons/Crabulon/MycelialClaws.cs @@ -1,44 +1,44 @@ -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.Crabulon -{ - public class MycelialClaws : 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.Weapons.Crabulon +{ + public class MycelialClaws : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mycelial Claws"); } - - public override void SetDefaults() - { - item.width = 22; - item.damage = 14; - item.melee = true; - item.useAnimation = 6; - item.useStyle = 1; - item.useTime = 6; - item.useTurn = true; - item.knockBack = 3.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 24; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - } - - 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, 56); - } - } - } -} + + public override void SetDefaults() + { + item.width = 22; + item.damage = 14; + item.melee = true; + item.useAnimation = 6; + item.useStyle = 1; + item.useTime = 6; + item.useTurn = true; + item.knockBack = 3.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 24; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + } + + 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, 56); + } + } + } +} diff --git a/Items/Weapons/Cryogen/Avalanche.cs b/Items/Weapons/Cryogen/Avalanche.cs index af0d60cb9d..fd86bc6406 100644 --- a/Items/Weapons/Cryogen/Avalanche.cs +++ b/Items/Weapons/Cryogen/Avalanche.cs @@ -1,105 +1,105 @@ -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.Cryogen -{ - public class Avalanche : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Avalanche"); - Tooltip.SetDefault("Spawns ice bombs that explode after 2 seconds into ice shards on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 64; - item.damage = 60; - item.melee = true; - item.useAnimation = 30; - item.useTime = 30; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - int i = Main.myPlayer; - float num72 = 6f; - float num74 = 5f; - 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 *= num80; - num79 *= num80; - 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); - 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; - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, mod.ProjectileType("IceBombFriendly"), (int)((float)item.damage * player.meleeDamage), num74, i, 0f, (float)Main.rand.Next(3)); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 12); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(3) == 0) - { - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 67, (float)(player.direction * 2), 0f, 150, default(Color), 1.5f); - Main.dust[num250].velocity *= 0.2f; - } - } - } -} +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.Cryogen +{ + public class Avalanche : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Avalanche"); + Tooltip.SetDefault("Spawns ice bombs that explode after 2 seconds into ice shards on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 64; + item.damage = 60; + item.melee = true; + item.useAnimation = 30; + item.useTime = 30; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 64; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + int i = Main.myPlayer; + float num72 = 6f; + float num74 = 5f; + 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 *= num80; + num79 *= num80; + 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); + 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; + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, mod.ProjectileType("IceBombFriendly"), (int)((float)item.damage * player.meleeDamage), num74, i, 0f, (float)Main.rand.Next(3)); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 12); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(3) == 0) + { + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 67, (float)(player.direction * 2), 0f, 150, default(Color), 1.5f); + Main.dust[num250].velocity *= 0.2f; + } + } + } +} diff --git a/Items/Weapons/Cryogen/BittercoldStaff.cs b/Items/Weapons/Cryogen/BittercoldStaff.cs index e7fbf7da27..41694ae452 100644 --- a/Items/Weapons/Cryogen/BittercoldStaff.cs +++ b/Items/Weapons/Cryogen/BittercoldStaff.cs @@ -1,91 +1,91 @@ -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 BittercoldStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bittercold Staff"); - Tooltip.SetDefault("Fires a spread of homing ice spikes"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 40; - item.magic = true; - item.mana = 17; - item.width = 52; - item.height = 52; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item46; - item.autoReuse = true; - item.shoot = mod.ProjectileType("IceSpike"); - item.shootSpeed = 10f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 8); - recipe.AddTile(TileID.IceMachine); - 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) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - int num130 = 2; - if (Main.rand.Next(3) == 0) - { - num130++; - } - if (Main.rand.Next(4) == 0) - { - num130++; - } - if (Main.rand.Next(5) == 0) - { - num130++; - } - for (int num131 = 0; num131 < num130; num131++) - { - float num132 = num78; - float num133 = num79; - float num134 = 0.05f * (float)num131; - num132 += (float)Main.rand.Next(-100, 100) * num134; - num133 += (float)Main.rand.Next(-100, 100) * num134; - num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); - num80 = num72 / num80; - num132 *= num80; - num133 *= num80; - float x2 = vector2.X; - float y2 = vector2.Y; - Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("IceSpike"), num73, num74, i, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file +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 BittercoldStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bittercold Staff"); + Tooltip.SetDefault("Fires a spread of homing ice spikes"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 40; + item.magic = true; + item.mana = 17; + item.width = 52; + item.height = 52; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item46; + item.autoReuse = true; + item.shoot = mod.ProjectileType("IceSpike"); + item.shootSpeed = 10f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 8); + recipe.AddTile(TileID.IceMachine); + 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) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + int i = Main.myPlayer; + float num72 = item.shootSpeed; + int num73 = damage; + float num74 = knockBack; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + int num130 = 2; + if (Main.rand.Next(3) == 0) + { + num130++; + } + if (Main.rand.Next(4) == 0) + { + num130++; + } + if (Main.rand.Next(5) == 0) + { + num130++; + } + for (int num131 = 0; num131 < num130; num131++) + { + float num132 = num78; + float num133 = num79; + float num134 = 0.05f * (float)num131; + num132 += (float)Main.rand.Next(-100, 100) * num134; + num133 += (float)Main.rand.Next(-100, 100) * num134; + num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); + num80 = num72 / num80; + num132 *= num80; + num133 *= num80; + float x2 = vector2.X; + float y2 = vector2.Y; + Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("IceSpike"), num73, num74, i, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Cryogen/EffluviumBow.cs b/Items/Weapons/Cryogen/EffluviumBow.cs index 47bc499989..f9df61f070 100644 --- a/Items/Weapons/Cryogen/EffluviumBow.cs +++ b/Items/Weapons/Cryogen/EffluviumBow.cs @@ -1,64 +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.Cryogen -{ - public class EffluviumBow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Effluvium Bow"); - Tooltip.SetDefault("Fires two mist arrows at once"); - } - - public override void SetDefaults() - { - item.damage = 51; - item.ranged = true; - item.width = 26; - item.height = 70; - item.useTime = 25; - item.useAnimation = 25; - 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 = mod.ProjectileType("MistArrow"); - item.shootSpeed = 12f; - item.useAmmo = 40; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 7); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedA = speedX; - float SpeedB = speedY; - for (int index = 0; index < 2; ++index) - { - float num7 = speedX; - 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; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("MistArrow"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file +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 EffluviumBow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Effluvium Bow"); + Tooltip.SetDefault("Fires two mist arrows at once"); + } + + public override void SetDefaults() + { + item.damage = 51; + item.ranged = true; + item.width = 26; + item.height = 70; + item.useTime = 25; + item.useAnimation = 25; + 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 = mod.ProjectileType("MistArrow"); + item.shootSpeed = 12f; + item.useAmmo = 40; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 7); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedA = speedX; + float SpeedB = speedY; + for (int index = 0; index < 2; ++index) + { + float num7 = speedX; + 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; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("MistArrow"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Cryogen/GlacialCrusher.cs b/Items/Weapons/Cryogen/GlacialCrusher.cs index 7c375b6a5b..01254fa5d6 100644 --- a/Items/Weapons/Cryogen/GlacialCrusher.cs +++ b/Items/Weapons/Cryogen/GlacialCrusher.cs @@ -1,73 +1,73 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items.Weapons.Cryogen -{ - public class GlacialCrusher : ModItem - { - 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() - { - item.width = 60; - item.damage = 59; - item.melee = true; - item.useAnimation = 27; - item.useTime = 27; - item.useTurn = true; - item.useStyle = 1; - 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 = 3f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 10); - recipe.AddTile(TileID.IceMachine); - 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, 67); - } - } - - 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; - } - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.Weapons.Cryogen +{ + public class GlacialCrusher : ModItem + { + 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() + { + item.width = 60; + item.damage = 59; + item.melee = true; + item.useAnimation = 27; + item.useTime = 27; + item.useTurn = true; + item.useStyle = 1; + 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 = 3f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 10); + recipe.AddTile(TileID.IceMachine); + 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, 67); + } + } + + 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/Cryogen/SnowstormStaff.cs b/Items/Weapons/Cryogen/SnowstormStaff.cs index 4a77279453..718e8d4101 100644 --- a/Items/Weapons/Cryogen/SnowstormStaff.cs +++ b/Items/Weapons/Cryogen/SnowstormStaff.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.Cryogen -{ - public class SnowstormStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Snowstorm Staff"); - Tooltip.SetDefault("Fires a snowflake that follows the mouse cursor"); - } - - public override void SetDefaults() - { - item.damage = 53; - item.magic = true; - item.channel = true; - item.mana = 13; - item.width = 66; - item.height = 66; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item46; - item.shoot = mod.ProjectileType("Snowflake"); - item.shootSpeed = 7f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 6); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 SnowstormStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snowstorm Staff"); + Tooltip.SetDefault("Fires a snowflake that follows the mouse cursor"); + } + + public override void SetDefaults() + { + item.damage = 53; + item.magic = true; + item.channel = true; + item.mana = 13; + item.width = 66; + item.height = 66; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 5; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item46; + item.shoot = mod.ProjectileType("Snowflake"); + item.shootSpeed = 7f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 6); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/CrystalBlade.cs b/Items/Weapons/CrystalBlade.cs index fe247766ec..5768d9be7a 100644 --- a/Items/Weapons/CrystalBlade.cs +++ b/Items/Weapons/CrystalBlade.cs @@ -1,57 +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 -{ - public class CrystalBlade : 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.Weapons +{ + public class CrystalBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal Blade"); Tooltip.SetDefault("Fires slow-moving clouds of crystal dust"); } - public override void SetDefaults() - { - item.width = 66; - item.damage = 45; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("CrystalDust"); - item.shootSpeed = 3f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 15); - recipe.AddIngredient(ItemID.CobaltSword); - recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 15); - recipe.AddIngredient(ItemID.PalladiumSword); - recipe.AddIngredient(ItemID.PixieDust, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 66; + item.damage = 45; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 4.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 66; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("CrystalDust"); + item.shootSpeed = 3f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.CobaltSword); + recipe.AddIngredient(ItemID.PixieDust, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.PalladiumSword); + recipe.AddIngredient(ItemID.PixieDust, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/CrystalFlareStaff.cs b/Items/Weapons/CrystalFlareStaff.cs index 7911779618..7e88c9cf56 100644 --- a/Items/Weapons/CrystalFlareStaff.cs +++ b/Items/Weapons/CrystalFlareStaff.cs @@ -1,16 +1,16 @@ -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 CrystalFlareStaff : 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.Weapons +{ + public class CrystalFlareStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal Flare Staff"); @@ -18,35 +18,35 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 49; - item.magic = true; - item.mana = 15; - item.width = 44; - item.height = 46; - item.useTime = 12; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.25f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SpiritFlameCurse"); - item.shootSpeed = 14f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofEleum", 3); - recipe.AddIngredient(ItemID.CrystalShard, 15); - recipe.AddIngredient(ItemID.FrostStaff); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 49; + item.magic = true; + item.mana = 15; + item.width = 44; + item.height = 46; + item.useTime = 12; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.25f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SpiritFlameCurse"); + item.shootSpeed = 14f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofEleum", 3); + recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.FrostStaff); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/CursedCapper.cs b/Items/Weapons/CursedCapper.cs index b77db730dd..98aed761f7 100644 --- a/Items/Weapons/CursedCapper.cs +++ b/Items/Weapons/CursedCapper.cs @@ -1,56 +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 -{ - public class CursedCapper : 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.Weapons +{ + public class CursedCapper : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cursed Capper"); Tooltip.SetDefault("Fires cursed bullets"); } - public override void SetDefaults() - { - item.damage = 24; - item.ranged = true; - item.width = 44; - item.height = 32; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 14f; - item.shoot = ProjectileID.CursedBullet; - item.useAmmo = 97; - } - - 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, ProjectileID.CursedBullet, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PhoenixBlaster); - recipe.AddIngredient(ItemID.CursedFlame, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 24; + item.ranged = true; + item.width = 44; + item.height = 32; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shootSpeed = 14f; + item.shoot = ProjectileID.CursedBullet; + item.useAmmo = 97; + } + + 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, ProjectileID.CursedBullet, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PhoenixBlaster); + recipe.AddIngredient(ItemID.CursedFlame, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DarkechoGreatbow.cs b/Items/Weapons/DarkechoGreatbow.cs index fa54807bd5..b387ec1067 100644 --- a/Items/Weapons/DarkechoGreatbow.cs +++ b/Items/Weapons/DarkechoGreatbow.cs @@ -1,64 +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 -{ - public class DarkechoGreatbow : 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.Weapons +{ + public class DarkechoGreatbow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Darkecho Greatbow"); - Tooltip.SetDefault("Fires two arrows at once\n" + + Tooltip.SetDefault("Fires two arrows at once\n" + "Fires an additional crystal dart"); - } - - public override void SetDefaults() - { - item.damage = 34; - item.ranged = true; - item.width = 34; - item.height = 62; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - 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) - { - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[index].noDropItem = true; - } - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CrystalDart, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[projectile].penetrate = 3; - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 34; + item.ranged = true; + item.width = 34; + item.height = 62; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + 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) + { + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[index].noDropItem = true; + } + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CrystalDart, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[projectile].penetrate = 3; + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DarklightGreatsword.cs b/Items/Weapons/DarklightGreatsword.cs index a1c6f73b39..d8a74b7b1c 100644 --- a/Items/Weapons/DarklightGreatsword.cs +++ b/Items/Weapons/DarklightGreatsword.cs @@ -1,70 +1,70 @@ -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 DarklightGreatsword : 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.Weapons +{ + public class DarklightGreatsword : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Darklight Greatsword"); Tooltip.SetDefault("Fires a darklight orb that splits on death"); } - public override void SetDefaults() - { - item.width = 56; - item.damage = 55; - item.melee = true; - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("StarCrystal"); - item.shootSpeed = 16f; - } - - 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, (int)((double)damage * 0.6), knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 12); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddIngredient(ItemID.SoulofNight); - recipe.AddIngredient(ItemID.SoulofLight); - 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, 29); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 180); - } - } -} + public override void SetDefaults() + { + item.width = 56; + item.damage = 55; + item.melee = true; + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.useTurn = true; + item.knockBack = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("StarCrystal"); + item.shootSpeed = 16f; + } + + 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, (int)((double)damage * 0.6), knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 12); + recipe.AddIngredient(ItemID.FallenStar, 5); + recipe.AddIngredient(ItemID.SoulofNight); + recipe.AddIngredient(ItemID.SoulofLight); + 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, 29); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 180); + } + } +} diff --git a/Items/Weapons/DeathValley.cs b/Items/Weapons/DeathValley.cs index 14434bc6fa..1cc72075a9 100644 --- a/Items/Weapons/DeathValley.cs +++ b/Items/Weapons/DeathValley.cs @@ -1,52 +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.Weapons -{ - public class DeathValley : 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.Weapons +{ + public class DeathValley : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Death Valley Duster"); Tooltip.SetDefault("Casts a large blast of dust"); } - public override void SetDefaults() - { - item.damage = 97; - item.magic = true; - item.mana = 9; - item.width = 28; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DustProjectile"); - item.shootSpeed = 5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Tradewinds"); - recipe.AddIngredient(ItemID.FossilOre, 25); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(null, "DesertFeather", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 97; + item.magic = true; + item.mana = 9; + item.width = 28; + item.height = 30; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DustProjectile"); + item.shootSpeed = 5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Tradewinds"); + recipe.AddIngredient(ItemID.FossilOre, 25); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); + recipe.AddIngredient(null, "DesertFeather", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DemonicPitchfork.cs b/Items/Weapons/DemonicPitchfork.cs index b3131f6e0f..70792beca8 100644 --- a/Items/Weapons/DemonicPitchfork.cs +++ b/Items/Weapons/DemonicPitchfork.cs @@ -1,16 +1,16 @@ -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 DemonicPitchfork : 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.Weapons +{ + public class DemonicPitchfork : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Demonic Pitchfork"); @@ -18,35 +18,35 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 67; - item.magic = true; - item.mana = 22; - item.width = 56; - item.height = 56; - item.useTime = 24; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DemonicPitchfork"); - item.shootSpeed = 13f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueShadowScale", 15); - recipe.AddIngredient(ItemID.DarkLance); - recipe.AddIngredient(ItemID.Obsidian, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 67; + item.magic = true; + item.mana = 22; + item.width = 56; + item.height = 56; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DemonicPitchfork"); + item.shootSpeed = 13f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueShadowScale", 15); + recipe.AddIngredient(ItemID.DarkLance); + recipe.AddIngredient(ItemID.Obsidian, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DepthBlade.cs b/Items/Weapons/DepthBlade.cs index 4a96f3b38d..bee092d5ea 100644 --- a/Items/Weapons/DepthBlade.cs +++ b/Items/Weapons/DepthBlade.cs @@ -1,50 +1,50 @@ -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 -{ - public class DepthBlade : ModItem - { +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 +{ + public class DepthBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Depth Blade"); - Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\n" + + Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\n" + "The lower the enemies' defense the more damage they take from this debuff"); } - public override void SetDefaults() - { - item.width = 40; - item.damage = 22; - item.melee = true; - item.useAnimation = 22; - item.useTime = 22; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 40; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - } - - 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, 33); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 180); - } - } -} + public override void SetDefaults() + { + item.width = 40; + item.damage = 22; + item.melee = true; + item.useAnimation = 22; + item.useTime = 22; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 40; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + } + + 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, 33); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 180); + } + } +} diff --git a/Items/Weapons/DesertScourge/AquaticDischarge.cs b/Items/Weapons/DesertScourge/AquaticDischarge.cs index 7e23336e92..199291d9bc 100644 --- a/Items/Weapons/DesertScourge/AquaticDischarge.cs +++ b/Items/Weapons/DesertScourge/AquaticDischarge.cs @@ -1,53 +1,53 @@ -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.DesertScourge -{ - public class AquaticDischarge : ModItem - { +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.DesertScourge +{ + public class AquaticDischarge : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Aquatic Discharge"); Tooltip.SetDefault("Enemies release electric sparks on death"); } - - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 32; - item.height = 32; - item.damage = 23; - item.melee = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - } - - 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, 226); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Spark"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } -} + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 12; + item.useTime = 12; + item.width = 32; + item.height = 32; + item.damage = 23; + item.melee = true; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + } + + 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, 226); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Spark"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } +} diff --git a/Items/Weapons/DesertScourge/Barinade.cs b/Items/Weapons/DesertScourge/Barinade.cs index da03d63fcd..d6fb4cb2c5 100644 --- a/Items/Weapons/DesertScourge/Barinade.cs +++ b/Items/Weapons/DesertScourge/Barinade.cs @@ -1,52 +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; -//using TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons.DesertScourge -{ - public class Barinade : 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons.DesertScourge +{ + public class Barinade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Barinade"); Tooltip.SetDefault("Shoots electric bolt arrows that explode"); } - - public override void SetDefaults() - { - item.damage = 8; - item.ranged = true; - item.width = 30; - item.height = 44; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 14f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - 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("BoltArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 8; + item.ranged = true; + item.width = 30; + item.height = 44; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 14f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + 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("BoltArrow"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/DesertScourge/SeaboundStaff.cs b/Items/Weapons/DesertScourge/SeaboundStaff.cs index d886cd5de3..0031f34aa7 100644 --- a/Items/Weapons/DesertScourge/SeaboundStaff.cs +++ b/Items/Weapons/DesertScourge/SeaboundStaff.cs @@ -1,73 +1,73 @@ -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.Weapons.DesertScourge -{ - public class SeaboundStaff : ModItem - { +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.Weapons.DesertScourge +{ + public class SeaboundStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Seabound Staff"); Tooltip.SetDefault("Summons a brittle star to fight for you"); } - - public override void SetDefaults() - { - item.damage = 11; - item.mana = 10; - item.width = 32; - item.height = 32; - item.useTime = 36; - item.useAnimation = 36; - item.scale = 0.75f; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrittleStar"); - item.shootSpeed = 10f; - item.summon = true; - } - - 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 + + public override void SetDefaults() + { + item.damage = 11; + item.mana = 10; + item.width = 32; + item.height = 32; + item.useTime = 36; + item.useAnimation = 36; + item.scale = 0.75f; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrittleStar"); + item.shootSpeed = 10f; + item.summon = true; + } + + 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); + } + } +} diff --git a/Items/Weapons/DesertScourge/StormSpray.cs b/Items/Weapons/DesertScourge/StormSpray.cs index abbbfbcc17..5fb23a1649 100644 --- a/Items/Weapons/DesertScourge/StormSpray.cs +++ b/Items/Weapons/DesertScourge/StormSpray.cs @@ -1,47 +1,47 @@ -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.DesertScourge -{ - public class StormSpray : 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.Weapons.DesertScourge +{ + public class StormSpray : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Spray"); Tooltip.SetDefault("Fires a spray of water that drips extra trails of water"); Item.staff[item.type] = true; } - - public override void SetDefaults() - { - item.damage = 18; - item.magic = true; - item.mana = 8; - item.width = 42; - item.height = 42; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item13; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WaterStream"); - item.shootSpeed = 10f; - } - - 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, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 18; + item.magic = true; + item.mana = 8; + item.width = 42; + item.height = 42; + item.useTime = 23; + item.useAnimation = 23; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item13; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WaterStream"); + item.shootSpeed = 10f; + } + + 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, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/Devastation.cs b/Items/Weapons/Devastation.cs index 2649bd45e8..30ce160294 100644 --- a/Items/Weapons/Devastation.cs +++ b/Items/Weapons/Devastation.cs @@ -1,127 +1,127 @@ -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 -{ - public class Devastation : ModItem - { +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 +{ + public class Devastation : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Devastation"); Tooltip.SetDefault("Fires galaxy blasts that explode"); } - public override void SetDefaults() - { - item.width = 72; - item.damage = 114; - item.melee = true; - item.useAnimation = 24; - item.useTime = 24; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("GalaxyBlast"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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(6)) - { - case 1: type = mod.ProjectileType("GalaxyBlast"); break; - case 2: type = mod.ProjectileType("GalaxyBlastType2"); break; - case 3: type = mod.ProjectileType("GalaxyBlastType3"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - 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)Main.rand.Next(-40, 41) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlast"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlastType2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlastType3"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(1)); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CatastropheClaymore"); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "AstralBar", 10); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - 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, 73); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 180); - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 300); - } - } -} + public override void SetDefaults() + { + item.width = 72; + item.damage = 114; + item.melee = true; + item.useAnimation = 24; + item.useTime = 24; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 4.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 72; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("GalaxyBlast"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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(6)) + { + case 1: type = mod.ProjectileType("GalaxyBlast"); break; + case 2: type = mod.ProjectileType("GalaxyBlastType2"); break; + case 3: type = mod.ProjectileType("GalaxyBlastType3"); break; + default: break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + 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)Main.rand.Next(-40, 41) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlast"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlastType2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalaxyBlastType3"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(1)); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CatastropheClaymore"); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "AstralBar", 10); + recipe.AddIngredient(ItemID.MeteoriteBar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + 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, 73); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 180); + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 300); + } + } +} diff --git a/Items/Weapons/DevilsDevastation.cs b/Items/Weapons/DevilsDevastation.cs index 88d0432322..abeb8d870f 100644 --- a/Items/Weapons/DevilsDevastation.cs +++ b/Items/Weapons/DevilsDevastation.cs @@ -1,174 +1,174 @@ -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 -{ - public class DevilsDevastation : ModItem - { +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 +{ + public class DevilsDevastation : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Devil's Devastation"); - Tooltip.SetDefault("Fires a spread of demonic blades and blasts\n" + + Tooltip.SetDefault("Fires a spread of demonic blades and blasts\n" + "Critical hits cause shadowflame explosions"); } - public override void SetDefaults() - { - item.width = 74; - item.damage = 450; - item.melee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 74; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("Oathblade"); - item.shootSpeed = 28f; - 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) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(4); - for (int j = 0; j < numProj + 1; j++) - { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (numProj - 1))); - int demon = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[demon].penetrate = 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; - int num107 = 3; - 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)Main.rand.Next(-40, 41) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlast"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlastType2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlastType3"), damage, knockBack, player.whoAmI, 0f, 1f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Devastation"); - recipe.AddIngredient(null, "TrueForbiddenOathblade"); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - 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, 173); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 300); - target.AddBuff(BuffID.OnFire, 300); - if (crit) - { - target.AddBuff(BuffID.ShadowFlame, 900); - target.AddBuff(BuffID.OnFire, 900); - player.ApplyDamageToNPC(target, damage * 4, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default(Color), num50); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity.Y -= 4.5f; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default(Color), num51); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust = Main.dust[num54]; - dust.velocity.Y -= 3f; - 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(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default(Color), num52); - Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default(Vector2)) * (float)target.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity.Y -= 1.5f; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } - } -} + public override void SetDefaults() + { + item.width = 74; + item.damage = 450; + item.melee = true; + item.useAnimation = 20; + item.useTime = 20; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 74; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Oathblade"); + item.shootSpeed = 28f; + 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) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(4); + for (int j = 0; j < numProj + 1; j++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (numProj - 1))); + int demon = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[demon].penetrate = 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; + int num107 = 3; + 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)Main.rand.Next(-40, 41) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlast"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlastType2"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("DemonBlastType3"), damage, knockBack, player.whoAmI, 0f, 1f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Devastation"); + recipe.AddIngredient(null, "TrueForbiddenOathblade"); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + 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, 173); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 300); + target.AddBuff(BuffID.OnFire, 300); + if (crit) + { + target.AddBuff(BuffID.ShadowFlame, 900); + target.AddBuff(BuffID.OnFire, 900); + player.ApplyDamageToNPC(target, damage * 4, 0f, 0, false); + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * target.velocity.Length(); + Main.PlaySound(SoundID.Item14, target.position); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default(Color), num50); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity.Y -= 4.5f; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default(Color), num51); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust = Main.dust[num54]; + dust.velocity.Y -= 3f; + 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(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default(Color), num52); + Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default(Vector2)) * (float)target.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity.Y -= 1.5f; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } + } +} diff --git a/Items/Weapons/DevourerofGods/DeathhailStaff.cs b/Items/Weapons/DevourerofGods/DeathhailStaff.cs index eac3ac9db8..c18d818cc4 100644 --- a/Items/Weapons/DevourerofGods/DeathhailStaff.cs +++ b/Items/Weapons/DevourerofGods/DeathhailStaff.cs @@ -1,108 +1,108 @@ -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.DevourerofGods -{ - public class DeathhailStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deathhail Staff"); - Tooltip.SetDefault("Rain death upon your foes!\n" + - "Casts a storm of nebula shots from the sky"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 180; - item.magic = true; - item.mana = 12; - item.width = 80; - item.height = 84; - item.useTime = 6; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item12; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MagicNebulaShot"); - item.shootSpeed = 18f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(40f, 42f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/DeathhailStaffGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - - 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); - 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 *= num80; - num79 *= num80; - 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); - 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(-50, 51) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-50, 51) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, num73, num74, i, 0f, (float)Main.rand.Next(10)); - } - return false; - } - } -} \ No newline at end of file +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.DevourerofGods +{ + public class DeathhailStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deathhail Staff"); + Tooltip.SetDefault("Rain death upon your foes!\n" + + "Casts a storm of nebula shots from the sky"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 180; + item.magic = true; + item.mana = 12; + item.width = 80; + item.height = 84; + item.useTime = 6; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item12; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MagicNebulaShot"); + item.shootSpeed = 18f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(40f, 42f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/DeathhailStaffGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + 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); + 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 *= num80; + num79 *= num80; + 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); + 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(-50, 51) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-50, 51) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, num73, num74, i, 0f, (float)Main.rand.Next(10)); + } + return false; + } + } +} diff --git a/Items/Weapons/DevourerofGods/Deathwind.cs b/Items/Weapons/DevourerofGods/Deathwind.cs index 6eda8c4f60..b68cb77099 100644 --- a/Items/Weapons/DevourerofGods/Deathwind.cs +++ b/Items/Weapons/DevourerofGods/Deathwind.cs @@ -1,73 +1,73 @@ -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.DevourerofGods -{ - public class Deathwind : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Deathwind"); - Tooltip.SetDefault("Fires a spread of arrows\n" + - "Wooden arrows are converted to nebula shots"); - } - - public override void SetDefaults() - { - item.damage = 265; - item.ranged = true; - item.width = 40; - item.height = 82; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("NebulaShot"); - item.shootSpeed = 20f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(20f, 41f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/DeathwindGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float 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(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - if (type == ProjectileID.WoodenArrowFriendly) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), damage, knockBack, player.whoAmI, 0f, 0f); - } - else - { - int num121 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; - } - } - return false; - } - } -} \ No newline at end of file +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.DevourerofGods +{ + public class Deathwind : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deathwind"); + Tooltip.SetDefault("Fires a spread of arrows\n" + + "Wooden arrows are converted to nebula shots"); + } + + public override void SetDefaults() + { + item.damage = 265; + item.ranged = true; + item.width = 40; + item.height = 82; + item.useTime = 14; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("NebulaShot"); + item.shootSpeed = 20f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(20f, 41f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/DeathwindGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float 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(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + if (type == ProjectileID.WoodenArrowFriendly) + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), damage, knockBack, player.whoAmI, 0f, 0f); + } + else + { + int num121 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + } + } + return false; + } + } +} diff --git a/Items/Weapons/DevourerofGods/EradicatorMelee.cs b/Items/Weapons/DevourerofGods/EradicatorMelee.cs index 67d4f9f8e5..fcc304e920 100644 --- a/Items/Weapons/DevourerofGods/EradicatorMelee.cs +++ b/Items/Weapons/DevourerofGods/EradicatorMelee.cs @@ -1,48 +1,48 @@ -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.DevourerofGods -{ - public class EradicatorMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); - } - - public override void SetDefaults() - { - item.width = 38; - item.damage = 300; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 54; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("EradicatorMeleeProjectile"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/EradicatorMeleeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - } -} +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.DevourerofGods +{ + public class EradicatorMelee : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); + } + + public override void SetDefaults() + { + item.width = 38; + item.damage = 300; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 54; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EradicatorMeleeProjectile"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(31f, 29f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/EradicatorMeleeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + } +} diff --git a/Items/Weapons/DevourerofGods/Excelsus.cs b/Items/Weapons/DevourerofGods/Excelsus.cs index 098cd1b882..702ea733b2 100644 --- a/Items/Weapons/DevourerofGods/Excelsus.cs +++ b/Items/Weapons/DevourerofGods/Excelsus.cs @@ -1,76 +1,76 @@ -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.DevourerofGods -{ - public class Excelsus : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Excelsus"); - Tooltip.SetDefault("Fires a spread of spinning blades\n" + - "Summons laser fountains on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 78; - item.damage = 235; - item.melee = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 94; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("Excelsus"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(39f, 47f); - spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/ExcelsusGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - - 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 SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - switch (index) - { - case 0: - type = mod.ProjectileType("Excelsus"); - break; - case 1: - type = mod.ProjectileType("ExcelsusBlue"); - break; - case 2: - type = mod.ProjectileType("ExcelsusPink"); - break; - } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - 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("LaserFountain"), 0, 0, Main.myPlayer); - } - } -} +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.DevourerofGods +{ + public class Excelsus : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Excelsus"); + Tooltip.SetDefault("Fires a spread of spinning blades\n" + + "Summons laser fountains on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 78; + item.damage = 235; + item.melee = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 94; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Excelsus"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(39f, 47f); + spriteBatch.Draw(mod.GetTexture("Items/Weapons/DevourerofGods/ExcelsusGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + 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 SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + switch (index) + { + case 0: + type = mod.ProjectileType("Excelsus"); + break; + case 1: + type = mod.ProjectileType("ExcelsusBlue"); + break; + case 2: + type = mod.ProjectileType("ExcelsusPink"); + break; + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + 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("LaserFountain"), 0, 0, Main.myPlayer); + } + } +} diff --git a/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs index 6010a75192..45e0881359 100644 --- a/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs +++ b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs @@ -1,173 +1,173 @@ -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.Weapons.DevourerofGods -{ - public class StaffoftheMechworm : ModItem - { +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.Weapons.DevourerofGods +{ + public class StaffoftheMechworm : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Staff of the Mechworm"); - Tooltip.SetDefault("Summons an aerial mechworm to fight for you\n" + - "Damage scales with the amount of minion slots you have\n" + + Tooltip.SetDefault("Summons an aerial mechworm to fight for you\n" + + "Damage scales with the amount of minion slots you have\n" + "The damage scaling stops growing after 10 minion slots"); } - - public override void SetDefaults() - { - item.damage = 30; - item.mana = 15; - item.width = 58; - item.height = 58; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item113; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MechwormHead"); - item.shootSpeed = 10f; - item.summon = true; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool CanUseItem(Player player) - { - float neededSlots = 1; - float foundSlotsCount = 0; - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.minion && p.owner == player.whoAmI) - { - foundSlotsCount += p.minionSlots; - if (foundSlotsCount + neededSlots > player.maxMinions) - { - return false; - } - } - } - 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 maxMinionScale = player.maxMinions; - if (maxMinionScale > 10) - { - maxMinionScale = 10; - } - damage = (int)(damage * ((player.minionDamage * 5 / 3) + ((player.minionDamage * 0.46f) * (maxMinionScale - 1)))); - int owner = player.whoAmI; - float num72 = item.shootSpeed; - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; - float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) - { - velX = (float)player.direction; - velY = 0f; - dist = num72; - } - else - { - dist = num72 / dist; - } - velX *= dist; - velY *= dist; - int head = -1; - int tail = -1; - int typeHead = mod.ProjectileType("MechwormHead"); - int typeTail = mod.ProjectileType("MechwormTail"); - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) - { - if (head == -1 && Main.projectile[i].type == typeHead) - { - head = i; - } - else if (tail == -1 && Main.projectile[i].type == typeTail) - { - tail = i; - } - if (head != -1 && tail != -1) - { - break; - } - } - } - if (head == -1 && tail == -1) - { - float num77 = Vector2.Dot(value, vector3); - if (num77 > 0f) - { - player.ChangeDir(1); - } - else - { - player.ChangeDir(-1); - } - velX = 0f; - velY = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormHead"), damage, knockBack, owner); - - int prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, knockBack, owner, (float)prev); - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, knockBack, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormTail"), damage, knockBack, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - } - else if (head != -1 && tail != -1) - { - int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, knockBack, owner, Main.projectile[tail].ai[0]); - int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, knockBack, owner, (float)body); - - Main.projectile[body].localAI[1] = (float)back; - Main.projectile[body].ai[1] = 1f; - Main.projectile[body].netUpdate = true; - - Main.projectile[back].localAI[1] = (float)tail; - Main.projectile[back].netUpdate = true; - Main.projectile[back].ai[1] = 1f; - - Main.projectile[tail].ai[0] = (float)back; - Main.projectile[tail].netUpdate = true; - Main.projectile[tail].ai[1] = 1f; - } - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 30; + item.mana = 15; + item.width = 58; + item.height = 58; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item113; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MechwormHead"); + item.shootSpeed = 10f; + item.summon = true; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + float neededSlots = 1; + float foundSlotsCount = 0; + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile p = Main.projectile[i]; + if (p.active && p.minion && p.owner == player.whoAmI) + { + foundSlotsCount += p.minionSlots; + if (foundSlotsCount + neededSlots > player.maxMinions) + { + return false; + } + } + } + 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 maxMinionScale = player.maxMinions; + if (maxMinionScale > 10) + { + maxMinionScale = 10; + } + damage = (int)(damage * ((player.minionDamage * 5 / 3) + ((player.minionDamage * 0.46f) * (maxMinionScale - 1)))); + int owner = player.whoAmI; + float num72 = item.shootSpeed; + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); + Vector2 vector3 = Main.MouseWorld - vector2; + float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) + { + velX = (float)player.direction; + velY = 0f; + dist = num72; + } + else + { + dist = num72 / dist; + } + velX *= dist; + velY *= dist; + int head = -1; + int tail = -1; + int typeHead = mod.ProjectileType("MechwormHead"); + int typeTail = mod.ProjectileType("MechwormTail"); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == owner) + { + if (head == -1 && Main.projectile[i].type == typeHead) + { + head = i; + } + else if (tail == -1 && Main.projectile[i].type == typeTail) + { + tail = i; + } + if (head != -1 && tail != -1) + { + break; + } + } + } + if (head == -1 && tail == -1) + { + float num77 = Vector2.Dot(value, vector3); + if (num77 > 0f) + { + player.ChangeDir(1); + } + else + { + player.ChangeDir(-1); + } + velX = 0f; + velY = 0f; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormHead"), damage, knockBack, owner); + + int prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, knockBack, owner, (float)prev); + + prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, knockBack, owner, (float)prev); + Main.projectile[prev].localAI[1] = (float)curr; + Main.projectile[prev].netUpdate = true; + + prev = curr; + curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormTail"), damage, knockBack, owner, (float)prev); + Main.projectile[prev].localAI[1] = (float)curr; + Main.projectile[prev].netUpdate = true; + } + else if (head != -1 && tail != -1) + { + int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody"), damage, knockBack, owner, Main.projectile[tail].ai[0]); + int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, mod.ProjectileType("MechwormBody2"), damage, knockBack, owner, (float)body); + + Main.projectile[body].localAI[1] = (float)back; + Main.projectile[body].ai[1] = 1f; + Main.projectile[body].netUpdate = true; + + Main.projectile[back].localAI[1] = (float)tail; + Main.projectile[back].netUpdate = true; + Main.projectile[back].ai[1] = 1f; + + Main.projectile[tail].ai[0] = (float)back; + Main.projectile[tail].netUpdate = true; + Main.projectile[tail].ai[1] = 1f; + } + return false; + } + } +} diff --git a/Items/Weapons/DevourerofGods/TheObliterator.cs b/Items/Weapons/DevourerofGods/TheObliterator.cs index bad349b513..f566b50932 100644 --- a/Items/Weapons/DevourerofGods/TheObliterator.cs +++ b/Items/Weapons/DevourerofGods/TheObliterator.cs @@ -1,37 +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.Weapons.DevourerofGods -{ - public class TheObliterator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Obliterator"); - Tooltip.SetDefault("Fires death lasers when enemies are near"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 240; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TheObliterator"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - } -} \ No newline at end of file +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.DevourerofGods +{ + public class TheObliterator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Obliterator"); + Tooltip.SetDefault("Fires death lasers when enemies are near"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.damage = 240; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TheObliterator"); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + } +} diff --git a/Items/Weapons/DraconicDestruction.cs b/Items/Weapons/DraconicDestruction.cs index 1a5da02910..6e55877b40 100644 --- a/Items/Weapons/DraconicDestruction.cs +++ b/Items/Weapons/DraconicDestruction.cs @@ -1,65 +1,65 @@ -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 -{ - public class DraconicDestruction : ModItem - { +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 +{ + public class DraconicDestruction : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Draconic Destruction"); - Tooltip.SetDefault("Fires a draconic sword beam that explodes into additional beams\n" + + Tooltip.SetDefault("Fires a draconic sword beam that explodes into additional beams\n" + "Additional beams fly up and down to shred enemies"); } - public override void SetDefaults() - { - item.width = 94; - item.damage = 210; - item.melee = true; - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 7.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 94; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("DracoBeam"); - item.shootSpeed = 14f; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(null, "CoreofCinder", 3); - recipe.AddIngredient(null, "CoreofEleum", 3); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 35); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 600); - } - } -} + public override void SetDefaults() + { + item.width = 94; + item.damage = 210; + item.melee = true; + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.useTurn = true; + item.knockBack = 7.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 94; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("DracoBeam"); + item.shootSpeed = 14f; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(null, "CoreofCinder", 3); + recipe.AddIngredient(null, "CoreofEleum", 3); + recipe.AddIngredient(ItemID.FragmentSolar, 10); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 35); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 600); + } + } +} diff --git a/Items/Weapons/DraedonsExoblade.cs b/Items/Weapons/DraedonsExoblade.cs index 9203e8eec3..394b7ee5bd 100644 --- a/Items/Weapons/DraedonsExoblade.cs +++ b/Items/Weapons/DraedonsExoblade.cs @@ -1,138 +1,138 @@ -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 -{ - public class DraedonsExoblade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Exoblade"); - Tooltip.SetDefault("Ancient blade of Yharim's weapons and armors expert, Draedon\n" + - "Fires an exo beam that homes in on the player and explodes\n" + - "Striking an enemy with the blade causes several comets to fire\n" + - "All attacks freeze any enemy in place for several seconds at a 10% chance\n" + - "Enemies hit at very low HP explode into frost energy and freeze nearby enemies\n" + - "The lower your HP the more damage this blade does and heals the player on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 80; - item.damage = 6700; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.useTurn = true; - item.melee = true; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 114; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("Exobeam"); - item.shootSpeed = 19f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override void GetWeaponDamage(Player player, ref int damage) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - float damageAdd = ((float)lifeAmount + (float)item.damage); - damage = (int)(damageAdd * player.meleeDamage); - } - - 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, 107, 0f, 0f, 100, new Color(0, 255, 255)); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= (target.lifeMax * 0.05f)) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Exoboom"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); - float xPos = (Main.rand.Next(2) == 0) ? player.position.X + 800 : player.position.X - 800; - Vector2 vector2 = new Vector2(xPos, player.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (player.ownedProjectileCounts[mod.ProjectileType("Exocomet")] < 8) - { - for (int comet = 0; comet < 2; comet++) - { - float ai1 = (Main.rand.NextFloat() + 0.5f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("Exocomet"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, ai1); - } - } - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - int healAmount = (Main.rand.Next(5) + 5); - player.statLife += healAmount; - player.HealEffect(healAmount); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Terratomere"); - recipe.AddIngredient(null, "AnarchyBlade"); - recipe.AddIngredient(null, "BalefulHarvester"); - recipe.AddIngredient(null, "FlarefrostBlade"); - recipe.AddIngredient(null, "PhoenixBlade"); - recipe.AddIngredient(null, "StellarStriker"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "HellcasterFragment", 3); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "AuricOre", 25); - recipe.AddTile(null, "DraedonsForge"); - 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; + +namespace CalamityMod.Items.Weapons +{ + public class DraedonsExoblade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exoblade"); + Tooltip.SetDefault("Ancient blade of Yharim's weapons and armors expert, Draedon\n" + + "Fires an exo beam that homes in on the player and explodes\n" + + "Striking an enemy with the blade causes several comets to fire\n" + + "All attacks freeze any enemy in place for several seconds at a 10% chance\n" + + "Enemies hit at very low HP explode into frost energy and freeze nearby enemies\n" + + "The lower your HP the more damage this blade does and heals the player on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 80; + item.damage = 6700; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.useTurn = true; + item.melee = true; + item.knockBack = 9f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 114; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Exobeam"); + item.shootSpeed = 19f; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override void GetWeaponDamage(Player player, ref int damage) + { + int lifeAmount = player.statLifeMax2 - player.statLife; + float damageAdd = ((float)lifeAmount + (float)item.damage); + damage = (int)(damageAdd * player.meleeDamage); + } + + 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, 107, 0f, 0f, 100, new Color(0, 255, 255)); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= (target.lifeMax * 0.05f)) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Exoboom"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); + float xPos = (Main.rand.Next(2) == 0) ? player.position.X + 800 : player.position.X - 800; + Vector2 vector2 = new Vector2(xPos, player.position.Y + Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (player.ownedProjectileCounts[mod.ProjectileType("Exocomet")] < 8) + { + for (int comet = 0; comet < 2; comet++) + { + float ai1 = (Main.rand.NextFloat() + 0.5f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("Exocomet"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, ai1); + } + } + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + int healAmount = (Main.rand.Next(5) + 5); + player.statLife += healAmount; + player.HealEffect(healAmount); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Terratomere"); + recipe.AddIngredient(null, "AnarchyBlade"); + recipe.AddIngredient(null, "BalefulHarvester"); + recipe.AddIngredient(null, "FlarefrostBlade"); + recipe.AddIngredient(null, "PhoenixBlade"); + recipe.AddIngredient(null, "StellarStriker"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "HellcasterFragment", 3); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Drataliornus.cs b/Items/Weapons/Drataliornus.cs index 460cb377bd..b6154635f7 100644 --- a/Items/Weapons/Drataliornus.cs +++ b/Items/Weapons/Drataliornus.cs @@ -1,121 +1,121 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons -{ - public class Drataliornus : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Drataliornus"); - Tooltip.SetDefault(@"Fires an escalating stream of fireballs. -Fireballs rain meteors, leave dragon dust trails, and launch additional bolts at max speed. -Taking damage while firing the stream will interrupt it and heavily debuff your stats. -Right click to fire two devastating barrages of five empowered fireballs. -'Just don't get hit'"); - } - - public override void SetDefaults() - { - item.damage = 410; - item.knockBack = 1f; - item.shootSpeed = 18f; - item.useStyle = 5; - item.useAnimation = 10; - item.useTime = 10; - item.reuseDelay = 0; - item.width = 64; - item.height = 84; - item.UseSound = SoundID.Item5; - item.shoot = mod.ProjectileType("Drataliornus"); - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.useTurn = false; - item.useAmmo = AmmoID.Arrow; - item.autoReuse = true; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useAnimation = 36; - item.useTime = 18; - item.reuseDelay = 72; - item.noUseGraphic = false; - } - else - { - item.useAnimation = 9; - item.useTime = 9; - item.reuseDelay = 0; - item.noUseGraphic = true; - } - return base.CanUseItem(player); - } - - 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) //tsunami - { - const float num3 = 0.471238898f; - const int num4 = 5; - Vector2 spinningpoint = new Vector2(speedX, speedY); - spinningpoint.Normalize(); - spinningpoint *= 36f; - for (int index1 = 0; index1 < num4; ++index1) - { - float num8 = index1 - (num4 - 1) / 2; - Vector2 vector2_5 = spinningpoint.RotatedBy(num3 * num8, new Vector2()); - Projectile.NewProjectile(position.X + vector2_5.X, position.Y + vector2_5.Y, speedX, speedY, mod.ProjectileType("DrataliornusFlame"), damage, knockBack, player.whoAmI, 1f, 0f); - } - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Drataliornus"), 0, 0f, player.whoAmI); - } - - return false; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(4f, 0f); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BlossomFlux"); - recipe.AddIngredient(null, "DaemonsFlame"); - recipe.AddIngredient(null, "Deathwind"); - recipe.AddIngredient(null, "HeavenlyGale"); - recipe.AddIngredient(null, "DragonsBreath", 2); - recipe.AddIngredient(null, "ChickenCannon", 2); - recipe.AddIngredient(null, "AngryChickenStaff", 2); - recipe.AddIngredient(null, "YharimsGift", 8); - recipe.AddIngredient(null, "AuricOre", 80); - recipe.AddIngredient(null, "EffulgentFeather", 160); - recipe.AddIngredient(null, "DarksunFragment", 80); - recipe.AddIngredient(null, "NightmareFuel", 80); - recipe.AddIngredient(null, "EndothermicEnergy", 80); - 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; + +namespace CalamityMod.Items.Weapons +{ + public class Drataliornus : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Drataliornus"); + Tooltip.SetDefault(@"Fires an escalating stream of fireballs. +Fireballs rain meteors, leave dragon dust trails, and launch additional bolts at max speed. +Taking damage while firing the stream will interrupt it and heavily debuff your stats. +Right click to fire two devastating barrages of five empowered fireballs. +'Just don't get hit'"); + } + + public override void SetDefaults() + { + item.damage = 410; + item.knockBack = 1f; + item.shootSpeed = 18f; + item.useStyle = 5; + item.useAnimation = 10; + item.useTime = 10; + item.reuseDelay = 0; + item.width = 64; + item.height = 84; + item.UseSound = SoundID.Item5; + item.shoot = mod.ProjectileType("Drataliornus"); + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.useTurn = false; + item.useAmmo = AmmoID.Arrow; + item.autoReuse = true; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useAnimation = 36; + item.useTime = 18; + item.reuseDelay = 72; + item.noUseGraphic = false; + } + else + { + item.useAnimation = 9; + item.useTime = 9; + item.reuseDelay = 0; + item.noUseGraphic = true; + } + return base.CanUseItem(player); + } + + 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) //tsunami + { + const float num3 = 0.471238898f; + const int num4 = 5; + Vector2 spinningpoint = new Vector2(speedX, speedY); + spinningpoint.Normalize(); + spinningpoint *= 36f; + for (int index1 = 0; index1 < num4; ++index1) + { + float num8 = index1 - (num4 - 1) / 2; + Vector2 vector2_5 = spinningpoint.RotatedBy(num3 * num8, new Vector2()); + Projectile.NewProjectile(position.X + vector2_5.X, position.Y + vector2_5.Y, speedX, speedY, mod.ProjectileType("DrataliornusFlame"), damage, knockBack, player.whoAmI, 1f, 0f); + } + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Drataliornus"), 0, 0f, player.whoAmI); + } + + return false; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(4f, 0f); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BlossomFlux"); + recipe.AddIngredient(null, "DaemonsFlame"); + recipe.AddIngredient(null, "Deathwind"); + recipe.AddIngredient(null, "HeavenlyGale"); + recipe.AddIngredient(null, "DragonsBreath", 2); + recipe.AddIngredient(null, "ChickenCannon", 2); + recipe.AddIngredient(null, "AngryChickenStaff", 2); + recipe.AddIngredient(null, "YharimsGift", 8); + recipe.AddIngredient(null, "AuricOre", 80); + recipe.AddIngredient(null, "EffulgentFeather", 160); + recipe.AddIngredient(null, "DarksunFragment", 80); + recipe.AddIngredient(null, "NightmareFuel", 80); + recipe.AddIngredient(null, "EndothermicEnergy", 80); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Dualpoon.cs b/Items/Weapons/Dualpoon.cs index c3cfc69852..5a565188c3 100644 --- a/Items/Weapons/Dualpoon.cs +++ b/Items/Weapons/Dualpoon.cs @@ -1,78 +1,78 @@ -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 Dualpoon : 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.Weapons +{ + public class Dualpoon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Dualpoon"); Tooltip.SetDefault("Launches two harpoons"); } - public override void SetDefaults() - { - item.damage = 53; - item.ranged = true; - item.width = 56; - item.height = 28; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("Triploon"); - } - - 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) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 2; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - int harpoon = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[harpoon].timeLeft = 300; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Harpoon, 2); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddIngredient(ItemID.SoulofMight, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 53; + item.ranged = true; + item.width = 56; + item.height = 28; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item10; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("Triploon"); + } + + 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) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 2; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 40f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + int harpoon = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[harpoon].timeLeft = 300; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Harpoon, 2); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddIngredient(ItemID.SoulofMight, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Earth.cs b/Items/Weapons/Earth.cs index 905156011b..dea1dab9a8 100644 --- a/Items/Weapons/Earth.cs +++ b/Items/Weapons/Earth.cs @@ -1,16 +1,16 @@ -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 Earth : 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.Weapons +{ + public class Earth : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Earth"); @@ -22,94 +22,94 @@ namespace CalamityMod.Items.Weapons "Green meteors spawn healing orbs"); } - public override void SetDefaults() - { - item.width = 92; - item.damage = 840; - item.melee = true; - item.useAnimation = 16; - item.useStyle = 1; - item.useTime = 16; - item.useTurn = true; - item.knockBack = 9.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 104; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - float num72 = 25f; - 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 = 3; - 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, mod.ProjectileType("Earth"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - if (Main.rand.Next(2) == 0) - { - target.defense -= 50; - } - int heal = Main.rand.Next(1, 69); - player.statLife += heal; - player.HealEffect(heal); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GrandGuardian"); - recipe.AddIngredient(null, "GalacticaBlade"); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 92; + item.damage = 840; + item.melee = true; + item.useAnimation = 16; + item.useStyle = 1; + item.useTime = 16; + item.useTurn = true; + item.knockBack = 9.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 104; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + float num72 = 25f; + 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 = 3; + 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, mod.ProjectileType("Earth"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); + } + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + if (Main.rand.Next(2) == 0) + { + target.defense -= 50; + } + int heal = Main.rand.Next(1, 69); + player.statLife += heal; + player.HealEffect(heal); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GrandGuardian"); + recipe.AddIngredient(null, "GalacticaBlade"); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/EarthenPike.cs b/Items/Weapons/EarthenPike.cs index cb5034ccec..c8c3b2ac11 100644 --- a/Items/Weapons/EarthenPike.cs +++ b/Items/Weapons/EarthenPike.cs @@ -1,42 +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.Weapons -{ - public class EarthenPike : 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.Weapons +{ + public class EarthenPike : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Earthen Pike"); - Tooltip.SetDefault("Crushes enemy defenses\n" + + Tooltip.SetDefault("Crushes enemy defenses\n" + "Sprays fossil shards on use"); } - public override void SetDefaults() - { - item.width = 60; - item.damage = 50; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = 5; - item.useTime = 25; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 60; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("EarthenPike"); - item.shootSpeed = 6f; - } - } -} + public override void SetDefaults() + { + item.width = 60; + item.damage = 50; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 25; + item.useStyle = 5; + item.useTime = 25; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 60; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("EarthenPike"); + item.shootSpeed = 6f; + } + } +} diff --git a/Items/Weapons/Effervescence.cs b/Items/Weapons/Effervescence.cs index 46599ee153..4c21579d8e 100644 --- a/Items/Weapons/Effervescence.cs +++ b/Items/Weapons/Effervescence.cs @@ -1,63 +1,63 @@ -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 Effervescence : 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.Weapons +{ + public class Effervescence : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Effervescence"); Tooltip.SetDefault("Shoots a massive spread of bubbles"); - } - - public override void SetDefaults() - { - item.damage = 24; - item.magic = true; - item.mana = 17; - item.width = 56; - item.height = 26; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.75f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item95; - item.autoReuse = true; - item.shootSpeed = 13f; - item.shoot = mod.ProjectileType("UberBubble"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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 randomBullets = 0; randomBullets <= 4; randomBullets++) - { - float SpeedX = speedX + (float) Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BubbleGun); - recipe.AddIngredient(ItemID.Xenopopper); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 24; + item.magic = true; + item.mana = 17; + item.width = 56; + item.height = 26; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.75f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item95; + item.autoReuse = true; + item.shootSpeed = 13f; + item.shoot = mod.ProjectileType("UberBubble"); + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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 randomBullets = 0; randomBullets <= 4; randomBullets++) + { + float SpeedX = speedX + (float) Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BubbleGun); + recipe.AddIngredient(ItemID.Xenopopper); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ElementalAxe.cs b/Items/Weapons/ElementalAxe.cs index bcfb5266f2..1cdac49340 100644 --- a/Items/Weapons/ElementalAxe.cs +++ b/Items/Weapons/ElementalAxe.cs @@ -1,91 +1,91 @@ -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.Weapons -{ - public class ElementalAxe : ModItem - { +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.Weapons +{ + public class ElementalAxe : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Axe"); Tooltip.SetDefault("Summons an elemental axe to fight for you"); } - public override void SetDefaults() - { - item.damage = 140; - item.summon = true; - item.mana = 10; - item.width = 36; - item.height = 36; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 5f; - item.buffType = mod.BuffType("ElementalAxe"); - item.buffTime = 3600; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementalAxe"); - item.shootSpeed = 10f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "InfernaCutter"); - recipe.AddTile(TileID.LunarCraftingStation); - 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; - } - 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; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 140; + item.summon = true; + item.mana = 10; + item.width = 36; + item.height = 36; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 5f; + item.buffType = mod.BuffType("ElementalAxe"); + item.buffTime = 3600; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementalAxe"); + item.shootSpeed = 10f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "InfernaCutter"); + recipe.AddTile(TileID.LunarCraftingStation); + 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; + } + 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; + } + } +} diff --git a/Items/Weapons/ElementalBlaster.cs b/Items/Weapons/ElementalBlaster.cs index 974a17e534..97b1c7e76f 100644 --- a/Items/Weapons/ElementalBlaster.cs +++ b/Items/Weapons/ElementalBlaster.cs @@ -1,59 +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 -{ - public class ElementalBlaster : 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.Weapons +{ + public class ElementalBlaster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Blaster"); - Tooltip.SetDefault("Does not consume ammo\n" + + Tooltip.SetDefault("Does not consume ammo\n" + "Fires a storm of rainbow blasts"); } - public override void SetDefaults() - { - item.damage = 77; - item.ranged = true; - item.width = 104; - item.height = 42; - item.useTime = 2; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.75f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - item.autoReuse = true; - item.shoot = mod.ProjectileType("RainbowBlast"); - item.shootSpeed = 18f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SpectralstormCannon"); - recipe.AddIngredient(null, "ClockGatlignum"); - recipe.AddIngredient(null, "PaintballBlaster"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 77; + item.ranged = true; + item.width = 104; + item.height = 42; + item.useTime = 2; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.75f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + item.autoReuse = true; + item.shoot = mod.ProjectileType("RainbowBlast"); + item.shootSpeed = 18f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SpectralstormCannon"); + recipe.AddIngredient(null, "ClockGatlignum"); + recipe.AddIngredient(null, "PaintballBlaster"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ElementalEruption.cs b/Items/Weapons/ElementalEruption.cs index 8821756670..9c454768c9 100644 --- a/Items/Weapons/ElementalEruption.cs +++ b/Items/Weapons/ElementalEruption.cs @@ -1,82 +1,82 @@ -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 ElementalEruption : 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.Weapons +{ + public class ElementalEruption : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Eruption"); - Tooltip.SetDefault("90% chance to not consume gel\n" + + Tooltip.SetDefault("90% chance to not consume gel\n" + "Fires a spread of rainbow flames"); } - public override void SetDefaults() - { - item.damage = 28; - item.ranged = true; - item.width = 64; - item.height = 34; - item.useTime = 2; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TerraFireGreen2"); - item.shootSpeed = 10f; - item.useAmmo = 23; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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(3, 6); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; - switch (Main.rand.Next(3)) - { - case 0: type = mod.ProjectileType("TerraFireGreen2"); break; - case 1: type = mod.ProjectileType("TerraFireRed"); break; - case 2: type = mod.ProjectileType("TerraFireBlue"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - 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, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "TerraFlameburster"); - recipe.AddIngredient(null, "Meowthrower"); - recipe.AddIngredient(null, "MepheticSprayer"); - recipe.AddIngredient(null, "BrimstoneFlamesprayer"); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 28; + item.ranged = true; + item.width = 64; + item.height = 34; + item.useTime = 2; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TerraFireGreen2"); + item.shootSpeed = 10f; + item.useAmmo = 23; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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(3, 6); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float) Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; + switch (Main.rand.Next(3)) + { + case 0: type = mod.ProjectileType("TerraFireGreen2"); break; + case 1: type = mod.ProjectileType("TerraFireRed"); break; + case 2: type = mod.ProjectileType("TerraFireBlue"); break; + default: break; + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + 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, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "TerraFlameburster"); + recipe.AddIngredient(null, "Meowthrower"); + recipe.AddIngredient(null, "MepheticSprayer"); + recipe.AddIngredient(null, "BrimstoneFlamesprayer"); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ElementalRay.cs b/Items/Weapons/ElementalRay.cs index 8d85563b13..94fd5d026c 100644 --- a/Items/Weapons/ElementalRay.cs +++ b/Items/Weapons/ElementalRay.cs @@ -1,16 +1,16 @@ -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 ElementalRay : 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.Weapons +{ + public class ElementalRay : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Ray"); @@ -18,36 +18,36 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 150; - item.magic = true; - item.mana = 18; - item.width = 62; - item.height = 62; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementRay"); - item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "TerraRay"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 150; + item.magic = true; + item.mana = 18; + item.width = 62; + item.height = 62; + item.useTime = 16; + item.useAnimation = 16; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementRay"); + item.shootSpeed = 6f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "TerraRay"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ElementalShortsword.cs b/Items/Weapons/ElementalShortsword.cs index 9eda96e465..70a11c43db 100644 --- a/Items/Weapons/ElementalShortsword.cs +++ b/Items/Weapons/ElementalShortsword.cs @@ -1,76 +1,76 @@ -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 -{ - public class ElementalShortsword : ModItem - { +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 +{ + public class ElementalShortsword : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Shiv"); - Tooltip.SetDefault("Don't underestimate the power of shivs\n" + + Tooltip.SetDefault("Don't underestimate the power of shivs\n" + "Shoots a rainbow orb that spawns shivs at multiple locations"); } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 44; - item.height = 44; - item.damage = 140; - item.melee = true; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ElementBallShiv"); - item.shootSpeed = 14f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TerraShiv"); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - } - } -} + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 10; + item.useTime = 10; + item.width = 44; + item.height = 44; + item.damage = 140; + item.melee = true; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ElementBallShiv"); + item.shootSpeed = 14f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TerraShiv"); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + } + } +} diff --git a/Items/Weapons/ElysianArrow.cs b/Items/Weapons/ElysianArrow.cs index 2bcaa662b8..280c21bc4e 100644 --- a/Items/Weapons/ElysianArrow.cs +++ b/Items/Weapons/ElysianArrow.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class ElysianArrow : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class ElysianArrow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Elysian Arrow"); Tooltip.SetDefault("Summons meteors from the sky on death"); } - public override void SetDefaults() - { - item.damage = 20; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3f; - item.value = 2000; - item.shoot = mod.ProjectileType("ElysianArrow"); - item.shootSpeed = 10f; - item.ammo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddIngredient(ItemID.HolyArrow, 150); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 150); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 20; + item.ranged = true; + item.width = 22; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 3f; + item.value = 2000; + item.shoot = mod.ProjectileType("ElysianArrow"); + item.shootSpeed = 10f; + item.ammo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddIngredient(ItemID.HolyArrow, 150); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/EmpyreanKnives.cs b/Items/Weapons/EmpyreanKnives.cs index a82cb32d03..a02c2a935b 100644 --- a/Items/Weapons/EmpyreanKnives.cs +++ b/Items/Weapons/EmpyreanKnives.cs @@ -1,114 +1,114 @@ -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 EmpyreanKnives : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Empyrean Knives"); - Tooltip.SetDefault("Throws a flurry of bouncing knives that can heal the user"); - } - - public override void SetDefaults() - { - item.width = 18; - item.damage = 650; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 3f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("EmpyreanKnives"); - item.shootSpeed = 15f; - 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); - 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 *= num80; - num79 *= num80; - int num146 = 4; - if (Main.rand.Next(2) == 0) - { - num146++; - } - if (Main.rand.Next(4) == 0) - { - num146++; - } - if (Main.rand.Next(8) == 0) - { - num146++; - } - if (Main.rand.Next(16) == 0) - { - num146++; - } - for (int num147 = 0; num147 < num146; num147++) - { - float num148 = num78; - float num149 = num79; - float num150 = 0.05f * (float)num147; - num148 += (float)Main.rand.Next(-25, 26) * num150; - num149 += (float)Main.rand.Next(-25, 26) * num150; - num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); - num80 = num72 / num80; - num148 *= num80; - num149 *= num80; - float x4 = vector2.X; - float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.VampireKnives); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddIngredient(null, "TheEmpyrean"); - recipe.AddTile(null, "DraedonsForge"); - 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.Weapons +{ + public class EmpyreanKnives : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Empyrean Knives"); + Tooltip.SetDefault("Throws a flurry of bouncing knives that can heal the user"); + } + + public override void SetDefaults() + { + item.width = 18; + item.damage = 650; + item.melee = true; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 3f; + item.UseSound = SoundID.Item39; + item.autoReuse = true; + item.height = 20; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EmpyreanKnives"); + item.shootSpeed = 15f; + 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); + 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 *= num80; + num79 *= num80; + int num146 = 4; + if (Main.rand.Next(2) == 0) + { + num146++; + } + if (Main.rand.Next(4) == 0) + { + num146++; + } + if (Main.rand.Next(8) == 0) + { + num146++; + } + if (Main.rand.Next(16) == 0) + { + num146++; + } + for (int num147 = 0; num147 < num146; num147++) + { + float num148 = num78; + float num149 = num79; + float num150 = 0.05f * (float)num147; + num148 += (float)Main.rand.Next(-25, 26) * num150; + num149 += (float)Main.rand.Next(-25, 26) * num150; + num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); + num80 = num72 / num80; + num148 *= num80; + num149 *= num80; + float x4 = vector2.X; + float y4 = vector2.Y; + Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.VampireKnives); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddIngredient(null, "TheEmpyrean"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/EnergyStaff.cs b/Items/Weapons/EnergyStaff.cs index 53760dad4f..959602162d 100644 --- a/Items/Weapons/EnergyStaff.cs +++ b/Items/Weapons/EnergyStaff.cs @@ -1,16 +1,16 @@ -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 EnergyStaff : 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.Weapons +{ + public class EnergyStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Energy Staff"); @@ -18,34 +18,34 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 170; - item.summon = true; - item.sentry = true; - item.mana = 25; - item.width = 66; - item.height = 68; - item.useTime = 38; - item.useAnimation = 38; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ProfanedEnergy"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - player.UpdateMaxTurrets(); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 170; + item.summon = true; + item.sentry = true; + item.mana = 25; + item.width = 66; + item.height = 68; + item.useTime = 38; + item.useAnimation = 38; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ProfanedEnergy"); + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + player.UpdateMaxTurrets(); + return false; + } + } +} diff --git a/Items/Weapons/EnhancedNanoRound.cs b/Items/Weapons/EnhancedNanoRound.cs index 2db84e5ed9..6ff52baca4 100644 --- a/Items/Weapons/EnhancedNanoRound.cs +++ b/Items/Weapons/EnhancedNanoRound.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class EnhancedNanoRound : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class EnhancedNanoRound : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Enhanced Nano Round"); Tooltip.SetDefault("Confuses enemies and releases a cloud of nanites when enemies die"); } - public override void SetDefaults() - { - item.damage = 12; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 5.5f; - item.value = 500; - item.rare = 3; - item.shoot = mod.ProjectileType("EnhancedNanoRound"); - item.shootSpeed = 8f; - item.ammo = 97; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NanoBullet, 250); - recipe.AddIngredient(null, "EssenceofEleum"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 12; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 5.5f; + item.value = 500; + item.rare = 3; + item.shoot = mod.ProjectileType("EnhancedNanoRound"); + item.shootSpeed = 8f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.NanoBullet, 250); + recipe.AddIngredient(null, "EssenceofEleum"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/EssenceFlayer.cs b/Items/Weapons/EssenceFlayer.cs index 145bb130cc..82886d2fbb 100644 --- a/Items/Weapons/EssenceFlayer.cs +++ b/Items/Weapons/EssenceFlayer.cs @@ -1,62 +1,62 @@ -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 EssenceFlayer : 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.Weapons +{ + public class EssenceFlayer : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Essence Flayer"); Tooltip.SetDefault("Shoots an essence scythe that generates healing spirits on enemy kills"); } - public override void SetDefaults() - { - item.width = 60; - item.damage = 450; - item.melee = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.height = 56; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("EssenceScythe"); - item.shootSpeed = 21f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 11); - recipe.AddTile(null, "DraedonsForge"); - 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, 173); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } - } -} + public override void SetDefaults() + { + item.width = 60; + item.damage = 450; + item.melee = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item71; + item.autoReuse = true; + item.height = 56; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EssenceScythe"); + item.shootSpeed = 21f; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 11); + recipe.AddTile(null, "DraedonsForge"); + 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, 173); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } + } +} diff --git a/Items/Weapons/EvergladeSpray.cs b/Items/Weapons/EvergladeSpray.cs index f747faed56..631f17148f 100644 --- a/Items/Weapons/EvergladeSpray.cs +++ b/Items/Weapons/EvergladeSpray.cs @@ -1,50 +1,50 @@ -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 EvergladeSpray : 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.Weapons +{ + public class EvergladeSpray : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Everglade Spray"); Tooltip.SetDefault("Fires a stream of burning green ichor"); } - public override void SetDefaults() - { - item.damage = 28; - item.magic = true; - item.mana = 8; - item.width = 30; - item.height = 30; - item.useTime = 6; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item13; - item.autoReuse = true; - item.shoot = mod.ProjectileType("EvergladeSprayProjectile"); - item.shootSpeed = 10f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ichor, 20); - recipe.AddIngredient(null, "DraedonBar", 3); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 28; + item.magic = true; + item.mana = 8; + item.width = 30; + item.height = 30; + item.useTime = 6; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item13; + item.autoReuse = true; + item.shoot = mod.ProjectileType("EvergladeSprayProjectile"); + item.shootSpeed = 10f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Ichor, 20); + recipe.AddIngredient(null, "DraedonBar", 3); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ExcaliburShortsword.cs b/Items/Weapons/ExcaliburShortsword.cs index fccb5f12ed..be581eb938 100644 --- a/Items/Weapons/ExcaliburShortsword.cs +++ b/Items/Weapons/ExcaliburShortsword.cs @@ -1,54 +1,54 @@ -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 -{ - public class ExcaliburShortsword : ModItem - { +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 +{ + public class ExcaliburShortsword : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Excalibur Shortsword"); Tooltip.SetDefault("Don't underestimate the power of shortswords"); } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 40; - item.height = 40; - item.damage = 55; - item.melee = true; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HallowedBar, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 57); - } - } - } -} + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 10; + item.useTime = 10; + item.width = 40; + item.height = 40; + item.damage = 55; + item.melee = true; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HallowedBar, 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 57); + } + } + } +} diff --git a/Items/Weapons/ExsanguinationLance.cs b/Items/Weapons/ExsanguinationLance.cs index 8e26bd7fe8..98d2733124 100644 --- a/Items/Weapons/ExsanguinationLance.cs +++ b/Items/Weapons/ExsanguinationLance.cs @@ -1,62 +1,62 @@ -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 ExsanguinationLance : 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.Weapons +{ + public class ExsanguinationLance : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Exsanguination Lance"); Tooltip.SetDefault("Explodes on enemy hits and summons homing flares on critical hits"); } - public override void SetDefaults() - { - item.width = 44; - item.damage = 77; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 22; - item.useStyle = 5; - item.useTime = 22; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("ExsanguinationLanceProjectile"); - item.shootSpeed = 8f; - } - - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 44; + item.damage = 77; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useStyle = 5; + item.useTime = 22; + item.knockBack = 6.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("ExsanguinationLanceProjectile"); + item.shootSpeed = 8f; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Fabstaff.cs b/Items/Weapons/Fabstaff.cs index 9252b0f662..6b2450b2ca 100644 --- a/Items/Weapons/Fabstaff.cs +++ b/Items/Weapons/Fabstaff.cs @@ -1,53 +1,53 @@ -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 Fabstaff : 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.Weapons +{ + public class Fabstaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Fabstaff"); - Tooltip.SetDefault("Casts a bouncing beam that splits when enemies are near it\n" + + Tooltip.SetDefault("Casts a bouncing beam that splits when enemies are near it\n" + "The splitting can trigger long after the beam has vanished"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 800; - item.magic = true; - item.mana = 50; - item.width = 84; - item.height = 84; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FabRay"); - item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 18; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Phantoplasm", 100); - recipe.AddIngredient(null, "ShadowspecBar", 50); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 800; + item.magic = true; + item.mana = 50; + item.width = 84; + item.height = 84; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FabRay"); + item.shootSpeed = 6f; + item.GetGlobalItem(mod).postMoonLordRarity = 18; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Phantoplasm", 100); + recipe.AddIngredient(null, "ShadowspecBar", 50); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FellerofEvergreens.cs b/Items/Weapons/FellerofEvergreens.cs index 8f0ea145cc..21e21026d7 100644 --- a/Items/Weapons/FellerofEvergreens.cs +++ b/Items/Weapons/FellerofEvergreens.cs @@ -1,57 +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 -{ - public class FellerofEvergreens : 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.Weapons +{ + public class FellerofEvergreens : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Feller of Evergreens"); } - public override void SetDefaults() - { - item.damage = 15; - item.melee = true; - item.width = 36; - item.height = 36; - item.useTime = 25; - item.useAnimation = 25; - item.useTurn = true; - item.axe = 15; - item.useStyle = 1; - item.knockBack = 5; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Wood, 15); - recipe.anyWood = true; - recipe.AddIngredient(ItemID.TungstenBar, 10); - recipe.AddIngredient(ItemID.TungstenAxe); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Wood, 15); - recipe.anyWood = true; - recipe.AddIngredient(ItemID.SilverBar, 10); - recipe.AddIngredient(ItemID.SilverAxe); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 15; + item.melee = true; + item.width = 36; + item.height = 36; + item.useTime = 25; + item.useAnimation = 25; + item.useTurn = true; + item.axe = 15; + item.useStyle = 1; + item.knockBack = 5; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Wood, 15); + recipe.anyWood = true; + recipe.AddIngredient(ItemID.TungstenBar, 10); + recipe.AddIngredient(ItemID.TungstenAxe); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Wood, 15); + recipe.anyWood = true; + recipe.AddIngredient(ItemID.SilverBar, 10); + recipe.AddIngredient(ItemID.SilverAxe); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FeralthornClaymore.cs b/Items/Weapons/FeralthornClaymore.cs index 1738d9dd08..1da71a29b9 100644 --- a/Items/Weapons/FeralthornClaymore.cs +++ b/Items/Weapons/FeralthornClaymore.cs @@ -1,67 +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 -{ - public class FeralthornClaymore : 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.Weapons +{ + public class FeralthornClaymore : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Feralthorn Claymore"); Tooltip.SetDefault("Summons thorns on enemy hits"); } - public override void SetDefaults() - { - item.width = 66; - item.damage = 63; - item.melee = true; - item.useAnimation = 13; - item.useStyle = 1; - item.useTime = 13; - item.useTurn = true; - item.knockBack = 7.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 12); - 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, 44); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X + 40f + (float)Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ProjectileID.VilethornBase, (int)((float)item.damage * player.meleeDamage * 0.2), 0f, Main.myPlayer, 0f, 0f); - } - for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X - 40f + (float)Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ProjectileID.VilethornBase, (int)((float)item.damage * player.meleeDamage * 0.2), 0f, Main.myPlayer, 0f, 0f); - } - } - } -} + public override void SetDefaults() + { + item.width = 66; + item.damage = 63; + item.melee = true; + item.useAnimation = 13; + item.useStyle = 1; + item.useTime = 13; + item.useTurn = true; + item.knockBack = 7.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 66; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 12); + 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, 44); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + for (int x = 0; x < 2; x++) + { + Projectile.NewProjectile(player.position.X + 40f + (float)Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ProjectileID.VilethornBase, (int)((float)item.damage * player.meleeDamage * 0.2), 0f, Main.myPlayer, 0f, 0f); + } + for (int x = 0; x < 2; x++) + { + Projectile.NewProjectile(player.position.X - 40f + (float)Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ProjectileID.VilethornBase, (int)((float)item.damage * player.meleeDamage * 0.2), 0f, Main.myPlayer, 0f, 0f); + } + } + } +} diff --git a/Items/Weapons/FiniteUse/Bazooka.cs b/Items/Weapons/FiniteUse/Bazooka.cs index 36cb98c9e6..ffdb2ff54e 100644 --- a/Items/Weapons/FiniteUse/Bazooka.cs +++ b/Items/Weapons/FiniteUse/Bazooka.cs @@ -1,107 +1,107 @@ -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.FiniteUse -{ - public class Bazooka : 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.Weapons.FiniteUse +{ + public class Bazooka : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Bazooka"); - Tooltip.SetDefault("Uses Grenade Shells\n" + - "Does more damage to inorganic enemies\n" + + Tooltip.SetDefault("Uses Grenade Shells\n" + + "Does more damage to inorganic enemies\n" + "Can be used twice per boss battle"); } - public override void SetDefaults() - { - item.damage = 500; - item.width = 66; - item.height = 26; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 10f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/BazookaFull"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("GrenadeRound"); - item.useAmmo = mod.ItemType("GrenadeRounds"); - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 2; - } - } - - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 2; - } - return true; - } - - public override bool CanUseItem(Player player) - { - return item.GetGlobalItem(mod).timesUsed < 2; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 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) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - for (int i = 0; i < 58; i++) - { - if (player.inventory[i].type == item.type) - { - player.inventory[i].GetGlobalItem(mod).timesUsed++; - } - } - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 20); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ItemID.AdamantiteBar, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 20); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ItemID.TitaniumBar, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 500; + item.width = 66; + item.height = 26; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 10f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/BazookaFull"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("GrenadeRound"); + item.useAmmo = mod.ItemType("GrenadeRounds"); + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 2; + } + } + + public override bool OnPickup(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 2; + } + return true; + } + + public override bool CanUseItem(Player player) + { + return item.GetGlobalItem(mod).timesUsed < 2; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override void UpdateInventory(Player player) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 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) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + for (int i = 0; i < 58; i++) + { + if (player.inventory[i].type == item.type) + { + player.inventory[i].GetGlobalItem(mod).timesUsed++; + } + } + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 20); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddIngredient(ItemID.AdamantiteBar, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 20); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddIngredient(ItemID.TitaniumBar, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FiniteUse/ElephantKiller.cs b/Items/Weapons/FiniteUse/ElephantKiller.cs index ad2173f616..80df6368d5 100644 --- a/Items/Weapons/FiniteUse/ElephantKiller.cs +++ b/Items/Weapons/FiniteUse/ElephantKiller.cs @@ -1,100 +1,100 @@ -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.FiniteUse -{ - public class ElephantKiller : 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.Weapons.FiniteUse +{ + public class ElephantKiller : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Elephant Killer"); - Tooltip.SetDefault("Uses Magnum Rounds\n" + - "Does more damage to organic enemies\n" + + Tooltip.SetDefault("Uses Magnum Rounds\n" + + "Does more damage to organic enemies\n" + "Can be used thrice per boss battle"); } - public override void SetDefaults() - { - item.damage = 2000; - item.crit += 66; - item.width = 46; - item.height = 26; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("MagnumRound"); - item.useAmmo = mod.ItemType("MagnumRounds"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 3; - } - } - - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 3; - } - return true; - } - - public override bool CanUseItem(Player player) - { - return item.GetGlobalItem(mod).timesUsed < 3; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 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) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - for (int i = 0; i < 58; i++) - { - if (player.inventory[i].type == item.type) - { - player.inventory[i].GetGlobalItem(mod).timesUsed++; - } - } - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "LightningHawk"); - recipe.AddIngredient(ItemID.LunarBar, 30); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 2000; + item.crit += 66; + item.width = 46; + item.height = 26; + item.useTime = 19; + item.useAnimation = 19; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("MagnumRound"); + item.useAmmo = mod.ItemType("MagnumRounds"); + item.GetGlobalItem(mod).postMoonLordRarity = 12; + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 3; + } + } + + public override bool OnPickup(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 3; + } + return true; + } + + public override bool CanUseItem(Player player) + { + return item.GetGlobalItem(mod).timesUsed < 3; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override void UpdateInventory(Player player) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 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) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + for (int i = 0; i < 58; i++) + { + if (player.inventory[i].type == item.type) + { + player.inventory[i].GetGlobalItem(mod).timesUsed++; + } + } + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "LightningHawk"); + recipe.AddIngredient(ItemID.LunarBar, 30); + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FiniteUse/ExplosiveShells.cs b/Items/Weapons/FiniteUse/ExplosiveShells.cs index 3ebe0c076d..856078b486 100644 --- a/Items/Weapons/FiniteUse/ExplosiveShells.cs +++ b/Items/Weapons/FiniteUse/ExplosiveShells.cs @@ -1,33 +1,33 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons.FiniteUse -{ - public class ExplosiveShells : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.FiniteUse +{ + public class ExplosiveShells : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Explosive Shotgun Shell"); } - public override void SetDefaults() - { - item.damage = 30; - item.width = 18; - item.height = 18; - item.maxStack = 6; - item.consumable = true; - item.knockBack = 10f; - item.value = 15000; - item.rare = 8; - item.shoot = mod.ProjectileType("ExplosiveShellBullet"); - item.shootSpeed = 12f; - item.ammo = mod.ItemType("ExplosiveShells"); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 30; + item.width = 18; + item.height = 18; + item.maxStack = 6; + item.consumable = true; + item.knockBack = 10f; + item.value = 15000; + item.rare = 8; + item.shoot = mod.ProjectileType("ExplosiveShellBullet"); + item.shootSpeed = 12f; + item.ammo = mod.ItemType("ExplosiveShells"); + } + } +} diff --git a/Items/Weapons/FiniteUse/GrenadeRounds.cs b/Items/Weapons/FiniteUse/GrenadeRounds.cs index 7d09eba57d..60a7aee513 100644 --- a/Items/Weapons/FiniteUse/GrenadeRounds.cs +++ b/Items/Weapons/FiniteUse/GrenadeRounds.cs @@ -1,33 +1,33 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons.FiniteUse -{ - public class GrenadeRounds : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.FiniteUse +{ + public class GrenadeRounds : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Grenade Shells"); } - public override void SetDefaults() - { - item.damage = 200; - item.width = 18; - item.height = 18; - item.maxStack = 9; - item.consumable = true; - item.knockBack = 10f; - item.value = 15000; - item.rare = 8; - item.shoot = mod.ProjectileType("GrenadeRound"); - item.shootSpeed = 12f; - item.ammo = mod.ItemType("GrenadeRounds"); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 200; + item.width = 18; + item.height = 18; + item.maxStack = 9; + item.consumable = true; + item.knockBack = 10f; + item.value = 15000; + item.rare = 8; + item.shoot = mod.ProjectileType("GrenadeRound"); + item.shootSpeed = 12f; + item.ammo = mod.ItemType("GrenadeRounds"); + } + } +} diff --git a/Items/Weapons/FiniteUse/Hydra.cs b/Items/Weapons/FiniteUse/Hydra.cs index 127ffee934..b164226879 100644 --- a/Items/Weapons/FiniteUse/Hydra.cs +++ b/Items/Weapons/FiniteUse/Hydra.cs @@ -1,106 +1,106 @@ -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.FiniteUse -{ - public class Hydra : 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.Weapons.FiniteUse +{ + public class Hydra : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Hydra"); - Tooltip.SetDefault("Uses Explosive Shotgun Shells\n" + - "Does more damage to everything\n" + + Tooltip.SetDefault("Uses Explosive Shotgun Shells\n" + + "Does more damage to everything\n" + "Can be used once per boss battle"); } - public override void SetDefaults() - { - item.damage = 120; - item.width = 66; - item.height = 30; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 10f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Hydra"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("ExplosiveShellBullet"); - item.useAmmo = mod.ItemType("ExplosiveShells"); - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 1; - } - } - - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 1; - } - return true; - } - - public override bool CanUseItem(Player player) - { - return item.GetGlobalItem(mod).timesUsed < 1; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 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 < 15; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-65, 66) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-65, 66) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - if (CalamityPlayer.areThereAnyDamnBosses) - { - for (int i = 0; i < 58; i++) - { - if (player.inventory[i].type == item.type) - { - player.inventory[i].GetGlobalItem(mod).timesUsed++; - } - } - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Shotgun); - recipe.AddIngredient(ItemID.IronBar, 20); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ItemID.Ectoplasm, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 120; + item.width = 66; + item.height = 30; + item.useTime = 33; + item.useAnimation = 33; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 10f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Hydra"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("ExplosiveShellBullet"); + item.useAmmo = mod.ItemType("ExplosiveShells"); + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 1; + } + } + + public override bool OnPickup(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 1; + } + return true; + } + + public override bool CanUseItem(Player player) + { + return item.GetGlobalItem(mod).timesUsed < 1; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override void UpdateInventory(Player player) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 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 < 15; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-65, 66) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-65, 66) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + if (CalamityPlayer.areThereAnyDamnBosses) + { + for (int i = 0; i < 58; i++) + { + if (player.inventory[i].type == item.type) + { + player.inventory[i].GetGlobalItem(mod).timesUsed++; + } + } + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Shotgun); + recipe.AddIngredient(ItemID.IronBar, 20); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddIngredient(ItemID.Ectoplasm, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FiniteUse/LightningHawk.cs b/Items/Weapons/FiniteUse/LightningHawk.cs index acf5b5b875..49c99ed534 100644 --- a/Items/Weapons/FiniteUse/LightningHawk.cs +++ b/Items/Weapons/FiniteUse/LightningHawk.cs @@ -1,102 +1,102 @@ -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.FiniteUse -{ - public class LightningHawk : 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.Weapons.FiniteUse +{ + public class LightningHawk : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Lightning Hawk"); - Tooltip.SetDefault("Uses Magnum Rounds\n" + - "Does more damage to organic enemies\n" + + Tooltip.SetDefault("Uses Magnum Rounds\n" + + "Does more damage to organic enemies\n" + "Can be used thrice per boss battle"); } - public override void SetDefaults() - { - item.damage = 400; - item.crit += 56; - item.width = 50; - item.height = 28; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("MagnumRound"); - item.useAmmo = mod.ItemType("MagnumRounds"); - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 3; - } - } - - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 3; - } - return true; - } - - public override bool CanUseItem(Player player) - { - return item.GetGlobalItem(mod).timesUsed < 3; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 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) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - for (int i = 0; i < 58; i++) - { - if (player.inventory[i].type == item.type) - { - player.inventory[i].GetGlobalItem(mod).timesUsed++; - } - } - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Magnum"); - recipe.AddIngredient(ItemID.SoulofMight, 20); - recipe.AddIngredient(ItemID.SoulofSight, 20); - recipe.AddIngredient(ItemID.SoulofFright, 20); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddIngredient(ItemID.HallowedBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 400; + item.crit += 56; + item.width = 50; + item.height = 28; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("MagnumRound"); + item.useAmmo = mod.ItemType("MagnumRounds"); + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 3; + } + } + + public override bool OnPickup(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 3; + } + return true; + } + + public override bool CanUseItem(Player player) + { + return item.GetGlobalItem(mod).timesUsed < 3; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override void UpdateInventory(Player player) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 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) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + for (int i = 0; i < 58; i++) + { + if (player.inventory[i].type == item.type) + { + player.inventory[i].GetGlobalItem(mod).timesUsed++; + } + } + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Magnum"); + recipe.AddIngredient(ItemID.SoulofMight, 20); + recipe.AddIngredient(ItemID.SoulofSight, 20); + recipe.AddIngredient(ItemID.SoulofFright, 20); + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddIngredient(ItemID.HallowedBar, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FiniteUse/Magnum.cs b/Items/Weapons/FiniteUse/Magnum.cs index cbe68c1b58..53e5bf2d62 100644 --- a/Items/Weapons/FiniteUse/Magnum.cs +++ b/Items/Weapons/FiniteUse/Magnum.cs @@ -1,100 +1,100 @@ -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.FiniteUse -{ - public class Magnum : 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.Weapons.FiniteUse +{ + public class Magnum : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Magnum"); - Tooltip.SetDefault("Uses Magnum Rounds\n" + - "Does more damage to organic enemies\n" + + Tooltip.SetDefault("Uses Magnum Rounds\n" + + "Does more damage to organic enemies\n" + "Can be used thrice per boss battle"); } - public override void SetDefaults() - { - item.damage = 80; - item.crit += 46; - item.width = 46; - item.height = 24; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("MagnumRound"); - item.useAmmo = mod.ItemType("MagnumRounds"); - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 3; - } - } - - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 3; - } - return true; - } - - public override bool CanUseItem(Player player) - { - return item.GetGlobalItem(mod).timesUsed < 3; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - item.GetGlobalItem(mod).timesUsed = 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) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - for (int i = 0; i < 58; i++) - { - if (player.inventory[i].type == item.type) - { - player.inventory[i].GetGlobalItem(mod).timesUsed++; - } - } - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FlintlockPistol); - recipe.AddIngredient(ItemID.IronBar, 10); - recipe.anyIronBar = true; - recipe.AddIngredient(ItemID.Diamond, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 80; + item.crit += 46; + item.width = 46; + item.height = 24; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("MagnumRound"); + item.useAmmo = mod.ItemType("MagnumRounds"); + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 3; + } + } + + public override bool OnPickup(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 3; + } + return true; + } + + public override bool CanUseItem(Player player) + { + return item.GetGlobalItem(mod).timesUsed < 3; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override void UpdateInventory(Player player) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + item.GetGlobalItem(mod).timesUsed = 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) + { + if (CalamityPlayer.areThereAnyDamnBosses) + { + for (int i = 0; i < 58; i++) + { + if (player.inventory[i].type == item.type) + { + player.inventory[i].GetGlobalItem(mod).timesUsed++; + } + } + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FlintlockPistol); + recipe.AddIngredient(ItemID.IronBar, 10); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.Diamond, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FiniteUse/MagnumRounds.cs b/Items/Weapons/FiniteUse/MagnumRounds.cs index 56dca32674..4e1ea8cf24 100644 --- a/Items/Weapons/FiniteUse/MagnumRounds.cs +++ b/Items/Weapons/FiniteUse/MagnumRounds.cs @@ -1,34 +1,34 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons.FiniteUse -{ - public class MagnumRounds : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.FiniteUse +{ + public class MagnumRounds : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Magnum Rounds"); } - public override void SetDefaults() - { - item.damage = 80; - item.crit += 4; - item.width = 18; - item.height = 18; - item.maxStack = 12; - item.consumable = true; - item.knockBack = 8f; - item.value = 10000; - item.rare = 8; - item.shoot = mod.ProjectileType("MagnumRound"); - item.shootSpeed = 12f; - item.ammo = mod.ItemType("MagnumRounds"); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 80; + item.crit += 4; + item.width = 18; + item.height = 18; + item.maxStack = 12; + item.consumable = true; + item.knockBack = 8f; + item.value = 10000; + item.rare = 8; + item.shoot = mod.ProjectileType("MagnumRound"); + item.shootSpeed = 12f; + item.ammo = mod.ItemType("MagnumRounds"); + } + } +} diff --git a/Items/Weapons/FirestormCannon.cs b/Items/Weapons/FirestormCannon.cs index 2fcd1fa486..fc1e5ac148 100644 --- a/Items/Weapons/FirestormCannon.cs +++ b/Items/Weapons/FirestormCannon.cs @@ -1,119 +1,119 @@ -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 FirestormCannon : 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.Weapons +{ + public class FirestormCannon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Firestorm Cannon"); - Tooltip.SetDefault("70% chance to not consume flares\n" + + Tooltip.SetDefault("70% chance to not consume flares\n" + "Right click to fire a spread of flares"); } - public override void SetDefaults() - { - item.damage = 11; - item.ranged = true; - item.width = 56; - item.height = 28; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 163; - item.shootSpeed = 5.5f; - item.useAmmo = 931; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 70) - return false; - return true; - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 27; - item.useAnimation = 27; - } - else - { - item.useTime = 9; - item.useAnimation = 9; - } - 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) - { - int num6 = Main.rand.Next(4, 6); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; - int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[flare].penetrate = 1; - Main.projectile[flare].timeLeft = 600; - } - return false; - } - else - { - int num6 = Main.rand.Next(1, 3); - 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; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.85), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 200; - } - return false; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FlareGun); - recipe.AddIngredient(ItemID.Boomstick); - recipe.AddIngredient(ItemID.GoldBar, 10); - recipe.AddIngredient(null, "VictoryShard", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FlareGun); - recipe.AddIngredient(ItemID.Boomstick); - recipe.AddIngredient(ItemID.PlatinumBar, 10); - recipe.AddIngredient(null, "VictoryShard", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 11; + item.ranged = true; + item.width = 56; + item.height = 28; + item.useTime = 9; + item.useAnimation = 9; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 163; + item.shootSpeed = 5.5f; + item.useAmmo = 931; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 70) + return false; + return true; + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 27; + item.useAnimation = 27; + } + else + { + item.useTime = 9; + item.useAnimation = 9; + } + 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) + { + int num6 = Main.rand.Next(4, 6); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; + int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[flare].penetrate = 1; + Main.projectile[flare].timeLeft = 600; + } + return false; + } + else + { + int num6 = Main.rand.Next(1, 3); + 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; + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.85), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].timeLeft = 200; + } + return false; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FlareGun); + recipe.AddIngredient(ItemID.Boomstick); + recipe.AddIngredient(ItemID.GoldBar, 10); + recipe.AddIngredient(null, "VictoryShard", 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FlareGun); + recipe.AddIngredient(ItemID.Boomstick); + recipe.AddIngredient(ItemID.PlatinumBar, 10); + recipe.AddIngredient(null, "VictoryShard", 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FlameScytheMelee.cs b/Items/Weapons/FlameScytheMelee.cs index 585fa632a3..648d7b85a9 100644 --- a/Items/Weapons/FlameScytheMelee.cs +++ b/Items/Weapons/FlameScytheMelee.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 FlameScytheMelee : 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.Weapons +{ + public class FlameScytheMelee : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Flame Scythe"); Tooltip.SetDefault("Throws a scythe that explodes on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 50; - item.damage = 145; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 48; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("FlameScytheProjectileMelee"); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + } + + public override void SetDefaults() + { + item.width = 50; + item.damage = 145; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 48; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("FlameScytheProjectileMelee"); + item.shootSpeed = 16f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 9); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FlameburstShortsword.cs b/Items/Weapons/FlameburstShortsword.cs index 842f65c8f4..51e013f85d 100644 --- a/Items/Weapons/FlameburstShortsword.cs +++ b/Items/Weapons/FlameburstShortsword.cs @@ -1,62 +1,62 @@ -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 -{ - public class FlameburstShortsword : ModItem - { +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 +{ + public class FlameburstShortsword : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Flameburst Shortsword"); Tooltip.SetDefault("Enemies explode on hit when below half life"); } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 30; - item.height = 30; - item.damage = 35; - item.melee = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 7); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 6); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= (target.lifeMax * 0.5f)) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } -} + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 15; + item.useTime = 15; + item.width = 30; + item.height = 30; + item.damage = 35; + item.melee = true; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HellstoneBar, 7); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 6); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= (target.lifeMax * 0.5f)) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } +} diff --git a/Items/Weapons/FlareBolt.cs b/Items/Weapons/FlareBolt.cs index e76827fb7f..5a6336791a 100644 --- a/Items/Weapons/FlareBolt.cs +++ b/Items/Weapons/FlareBolt.cs @@ -1,52 +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.Weapons -{ - public class FlareBolt : 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.Weapons +{ + public class FlareBolt : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Flare Bolt"); Tooltip.SetDefault("Casts a slow-moving ball of flame"); } - public override void SetDefaults() - { - item.damage = 27; - item.magic = true; - item.mana = 12; - item.width = 28; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FlareBoltProjectile"); - item.shootSpeed = 7.5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 6); - recipe.AddIngredient(ItemID.Obsidian, 9); - recipe.AddIngredient(ItemID.Fireblossom, 2); - recipe.AddIngredient(ItemID.LavaBucket); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 27; + item.magic = true; + item.mana = 12; + item.width = 28; + item.height = 30; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FlareBoltProjectile"); + item.shootSpeed = 7.5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HellstoneBar, 6); + recipe.AddIngredient(ItemID.Obsidian, 9); + recipe.AddIngredient(ItemID.Fireblossom, 2); + recipe.AddIngredient(ItemID.LavaBucket); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FlarefrostBlade.cs b/Items/Weapons/FlarefrostBlade.cs index decc4a865b..d84f14f630 100644 --- a/Items/Weapons/FlarefrostBlade.cs +++ b/Items/Weapons/FlarefrostBlade.cs @@ -1,72 +1,72 @@ -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 -{ - public class FlarefrostBlade : ModItem - { +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 +{ + public class FlarefrostBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Flarefrost Blade"); Tooltip.SetDefault("Fires a homing flarefrost orb"); } - public override void SetDefaults() - { - item.width = 66; - item.damage = 58; - item.melee = true; - item.useAnimation = 24; - item.useTime = 24; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("Flarefrost"); - item.shootSpeed = 11f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 8); - recipe.AddIngredient(ItemID.HellstoneBar, 8); - recipe.AddIngredient(ItemID.HallowedBar, 4); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - int dustChoice = Main.rand.Next(2); - if (dustChoice == 0) - { - dustChoice = 67; - } - else - { - dustChoice = 6; - } - if (Main.rand.Next(3) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustChoice); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 300); - } - } -} + public override void SetDefaults() + { + item.width = 66; + item.damage = 58; + item.melee = true; + item.useAnimation = 24; + item.useTime = 24; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 66; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("Flarefrost"); + item.shootSpeed = 11f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 8); + recipe.AddIngredient(ItemID.HellstoneBar, 8); + recipe.AddIngredient(ItemID.HallowedBar, 4); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + int dustChoice = Main.rand.Next(2); + if (dustChoice == 0) + { + dustChoice = 67; + } + else + { + dustChoice = 6; + } + if (Main.rand.Next(3) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustChoice); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Frostburn, 300); + } + } +} diff --git a/Items/Weapons/FlarewingBow.cs b/Items/Weapons/FlarewingBow.cs index 47f619c847..1d25554c03 100644 --- a/Items/Weapons/FlarewingBow.cs +++ b/Items/Weapons/FlarewingBow.cs @@ -1,84 +1,84 @@ -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 FlarewingBow : 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.Weapons +{ + public class FlarewingBow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Flarewing Bow"); - Tooltip.SetDefault("Shoots a spread of arrows\n" + + Tooltip.SetDefault("Shoots a spread of arrows\n" + "Wooden arrows are converted to bouncing obsidian bats"); - } - - public override void SetDefaults() - { - item.damage = 25; - item.ranged = true; - item.width = 20; - item.height = 62; - item.useTime = 28; - item.useAnimation = 28; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 16f; - 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(); - vector7 *= 50f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - if (type == ProjectileID.WoodenArrowFriendly) - { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("FlareBat"), (int)((double)damage * 1.5), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num123].noDropItem = true; - } - else - { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage * 0.66), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num123].noDropItem = true; - } - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellwingBow); - recipe.AddIngredient(null, "EssenceofCinder", 5); - recipe.AddIngredient(ItemID.LivingFireBlock, 50); - recipe.AddIngredient(ItemID.Obsidian, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.width = 20; + item.height = 62; + item.useTime = 28; + item.useAnimation = 28; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 16f; + 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(); + vector7 *= 50f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + if (type == ProjectileID.WoodenArrowFriendly) + { + int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("FlareBat"), (int)((double)damage * 1.5), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[num123].noDropItem = true; + } + else + { + int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage * 0.66), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[num123].noDropItem = true; + } + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HellwingBow); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddIngredient(ItemID.LivingFireBlock, 50); + recipe.AddIngredient(ItemID.Obsidian, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FlashBullet.cs b/Items/Weapons/FlashBullet.cs index e746ced27d..298bbc35a8 100644 --- a/Items/Weapons/FlashBullet.cs +++ b/Items/Weapons/FlashBullet.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class FlashBullet : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class FlashBullet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Flash Round"); Tooltip.SetDefault("Gives off a concussive blast that confuses enemies in a large area for a short time"); } - public override void SetDefaults() - { - item.damage = 7; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.15f; - item.value = 250; - item.rare = 1; - item.shoot = mod.ProjectileType("FlashBullet"); - item.shootSpeed = 12f; - item.ammo = 97; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Glass, 3); - recipe.AddIngredient(ItemID.Grenade); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 10); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 7; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.15f; + item.value = 250; + item.rare = 1; + item.shoot = mod.ProjectileType("FlashBullet"); + item.shootSpeed = 12f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Glass, 3); + recipe.AddIngredient(ItemID.Grenade); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 10); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Floodtide.cs b/Items/Weapons/Floodtide.cs index dc34dd079d..5ef5e8f941 100644 --- a/Items/Weapons/Floodtide.cs +++ b/Items/Weapons/Floodtide.cs @@ -1,79 +1,79 @@ -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 -{ - public class Floodtide : 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; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class Floodtide : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Floodtide"); Tooltip.SetDefault("Launches sharks, because sharks are awesome!"); } - public override void SetDefaults() - { - item.damage = 89; - item.melee = true; - item.width = 60; - item.height = 64; - item.useTime = 23; - item.useAnimation = 23; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = 408; - item.shootSpeed = 11f; - } - - 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 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) - { - if (Main.rand.Next(5) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 217); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 5); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddIngredient(ItemID.AdamantiteBar, 5); - 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 = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 5); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddIngredient(ItemID.TitaniumBar, 5); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 89; + item.melee = true; + item.width = 60; + item.height = 64; + item.useTime = 23; + item.useAnimation = 23; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.shoot = 408; + item.shootSpeed = 11f; + } + + 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 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) + { + if (Main.rand.Next(5) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 217); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 5); + recipe.AddIngredient(ItemID.SharkFin, 2); + recipe.AddIngredient(ItemID.AdamantiteBar, 5); + 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 = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 5); + recipe.AddIngredient(ItemID.SharkFin, 2); + recipe.AddIngredient(ItemID.TitaniumBar, 5); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ForbiddenOathblade.cs b/Items/Weapons/ForbiddenOathblade.cs index 448cad36c9..ac0545ad1c 100644 --- a/Items/Weapons/ForbiddenOathblade.cs +++ b/Items/Weapons/ForbiddenOathblade.cs @@ -1,110 +1,110 @@ -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 -{ - public class ForbiddenOathblade : ModItem - { +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 +{ + public class ForbiddenOathblade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Forbidden Oathblade"); Tooltip.SetDefault("Fires a demonic scythe and critical hits cause shadowflame explosions"); } - public override void SetDefaults() - { - item.width = 76; - item.damage = 61; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 76; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("Oathblade"); - item.shootSpeed = 3f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BladecrestOathsword"); - recipe.AddIngredient(null, "OldLordOathsword"); - recipe.AddIngredient(ItemID.SoulofFright, 5); - 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, 173); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 240); - target.AddBuff(BuffID.OnFire, 240); - if (crit) - { - target.AddBuff(BuffID.ShadowFlame, 720); - target.AddBuff(BuffID.OnFire, 720); - player.ApplyDamageToNPC(target, damage * 2, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default(Color), num50); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity.Y -= 4.5f; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default(Color), num51); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust = Main.dust[num54]; - dust.velocity.Y -= 3f; - 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(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default(Color), num52); - Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default(Vector2)) * (float)target.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity.Y -= 1.5f; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } - } -} + public override void SetDefaults() + { + item.width = 76; + item.damage = 61; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 76; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("Oathblade"); + item.shootSpeed = 3f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BladecrestOathsword"); + recipe.AddIngredient(null, "OldLordOathsword"); + recipe.AddIngredient(ItemID.SoulofFright, 5); + 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, 173); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 240); + target.AddBuff(BuffID.OnFire, 240); + if (crit) + { + target.AddBuff(BuffID.ShadowFlame, 720); + target.AddBuff(BuffID.OnFire, 720); + player.ApplyDamageToNPC(target, damage * 2, 0f, 0, false); + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * target.velocity.Length(); + Main.PlaySound(SoundID.Item14, target.position); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default(Color), num50); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity.Y -= 4.5f; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default(Color), num51); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust = Main.dust[num54]; + dust.velocity.Y -= 3f; + 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(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default(Color), num52); + Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default(Vector2)) * (float)target.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity.Y -= 1.5f; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } + } +} diff --git a/Items/Weapons/ForbiddenSun.cs b/Items/Weapons/ForbiddenSun.cs index 88064adb9c..05057ddb08 100644 --- a/Items/Weapons/ForbiddenSun.cs +++ b/Items/Weapons/ForbiddenSun.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 ForbiddenSun : 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.Weapons +{ + public class ForbiddenSun : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Forbidden Sun"); Tooltip.SetDefault("Casts a fire orb that emits a gigantic explosion on death"); } - public override void SetDefaults() - { - item.damage = 80; - item.magic = true; - item.mana = 33; - item.width = 28; - item.height = 30; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ForbiddenSunProjectile"); - item.shootSpeed = 9f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 6); - recipe.AddIngredient(ItemID.LivingFireBlock, 50); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 80; + item.magic = true; + item.mana = 33; + item.width = 28; + item.height = 30; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ForbiddenSunProjectile"); + item.shootSpeed = 9f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 6); + recipe.AddIngredient(ItemID.LivingFireBlock, 50); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ForsakenSaber.cs b/Items/Weapons/ForsakenSaber.cs index 443e5c3a0e..9286be547c 100644 --- a/Items/Weapons/ForsakenSaber.cs +++ b/Items/Weapons/ForsakenSaber.cs @@ -1,63 +1,63 @@ -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 ForsakenSaber : 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.Weapons +{ + public class ForsakenSaber : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Forsaken Saber"); Tooltip.SetDefault("Shoots a sand blade that alters its velocity as it travels"); } - public override void SetDefaults() - { - item.width = 54; - item.damage = 65; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 6; - 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("SandBlade"); - item.shootSpeed = 5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.AdamantiteBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.TitaniumBar, 5); - recipe.AddTile(TileID.Anvils); - 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, 159); - } - } - } -} + public override void SetDefaults() + { + item.width = 54; + item.damage = 65; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 6; + 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("SandBlade"); + item.shootSpeed = 5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.AdamantiteBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.TitaniumBar, 5); + recipe.AddTile(TileID.Anvils); + 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, 159); + } + } + } +} diff --git a/Items/Weapons/FourSeasonsGalaxia.cs b/Items/Weapons/FourSeasonsGalaxia.cs index 15be830013..e2dc98df15 100644 --- a/Items/Weapons/FourSeasonsGalaxia.cs +++ b/Items/Weapons/FourSeasonsGalaxia.cs @@ -1,153 +1,153 @@ -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 -{ - public class FourSeasonsGalaxia : ModItem - { +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 +{ + public class FourSeasonsGalaxia : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Galaxia"); - Tooltip.SetDefault("Fires homing projectiles that inflict different debuffs depending on what biome you're in\n" + - "Upon hitting an enemy you are granted a buff based on what biome you're in\n" + + Tooltip.SetDefault("Fires homing projectiles that inflict different debuffs depending on what biome you're in\n" + + "Upon hitting an enemy you are granted a buff based on what biome you're in\n" + "Projectiles also change based on moon events"); } - public override void SetDefaults() - { - item.width = 70; - item.damage = 425; - item.melee = true; - item.useAnimation = 17; - item.useTime = 17; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 9; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 70; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("Galaxia"); - item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "OmegaBiomeBlade"); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 0); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - bool nebula = player.ZoneTowerNebula; - bool stardust = player.ZoneTowerStardust; - bool solar = player.ZoneTowerSolar; - bool vortex = player.ZoneTowerVortex; - bool bloodMoon = Main.bloodMoon; - bool snowMoon = Main.snowMoon; - bool pumpkinMoon = Main.pumpkinMoon; - if (bloodMoon) - { - player.AddBuff(BuffID.Battle, 600); - } - if (snowMoon) - { - player.AddBuff(BuffID.RapidHealing, 600); - } - if (pumpkinMoon) - { - player.AddBuff(BuffID.WellFed, 600); - } - if (jungle) - { - player.AddBuff(BuffID.Thorns, 600); - } - else if (snow) - { - player.AddBuff(BuffID.Warmth, 600); - } - else if (beach) - { - player.AddBuff(BuffID.Wet, 600); - } - else if (corrupt) - { - player.AddBuff(BuffID.Wrath, 600); - } - else if (crimson) - { - player.AddBuff(BuffID.Rage, 600); - } - else if (dungeon) - { - player.AddBuff(BuffID.Dangersense, 600); - } - else if (desert) - { - player.AddBuff(BuffID.Endurance, 600); - } - else if (glow) - { - player.AddBuff(BuffID.Spelunker, 600); - } - else if (hell) - { - player.AddBuff(BuffID.Inferno, 600); - } - else if (holy) - { - player.AddBuff(BuffID.Heartreach, 600); - } - else if (nebula) - { - player.AddBuff(BuffID.MagicPower, 600); - } - else if (stardust) - { - player.AddBuff(BuffID.Summoning, 600); - } - else if (solar) - { - player.AddBuff(BuffID.Titan, 600); - } - else if (vortex) - { - player.AddBuff(BuffID.AmmoReservation, 600); - } - else - { - player.AddBuff(BuffID.DryadsWard, 600); - } - } - } -} + public override void SetDefaults() + { + item.width = 70; + item.damage = 425; + item.melee = true; + item.useAnimation = 17; + item.useTime = 17; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 9; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 70; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Galaxia"); + item.shootSpeed = 24f; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "OmegaBiomeBlade"); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 0); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + bool nebula = player.ZoneTowerNebula; + bool stardust = player.ZoneTowerStardust; + bool solar = player.ZoneTowerSolar; + bool vortex = player.ZoneTowerVortex; + bool bloodMoon = Main.bloodMoon; + bool snowMoon = Main.snowMoon; + bool pumpkinMoon = Main.pumpkinMoon; + if (bloodMoon) + { + player.AddBuff(BuffID.Battle, 600); + } + if (snowMoon) + { + player.AddBuff(BuffID.RapidHealing, 600); + } + if (pumpkinMoon) + { + player.AddBuff(BuffID.WellFed, 600); + } + if (jungle) + { + player.AddBuff(BuffID.Thorns, 600); + } + else if (snow) + { + player.AddBuff(BuffID.Warmth, 600); + } + else if (beach) + { + player.AddBuff(BuffID.Wet, 600); + } + else if (corrupt) + { + player.AddBuff(BuffID.Wrath, 600); + } + else if (crimson) + { + player.AddBuff(BuffID.Rage, 600); + } + else if (dungeon) + { + player.AddBuff(BuffID.Dangersense, 600); + } + else if (desert) + { + player.AddBuff(BuffID.Endurance, 600); + } + else if (glow) + { + player.AddBuff(BuffID.Spelunker, 600); + } + else if (hell) + { + player.AddBuff(BuffID.Inferno, 600); + } + else if (holy) + { + player.AddBuff(BuffID.Heartreach, 600); + } + else if (nebula) + { + player.AddBuff(BuffID.MagicPower, 600); + } + else if (stardust) + { + player.AddBuff(BuffID.Summoning, 600); + } + else if (solar) + { + player.AddBuff(BuffID.Titan, 600); + } + else if (vortex) + { + player.AddBuff(BuffID.AmmoReservation, 600); + } + else + { + player.AddBuff(BuffID.DryadsWard, 600); + } + } + } +} diff --git a/Items/Weapons/FrigidflashBolt.cs b/Items/Weapons/FrigidflashBolt.cs index b8090e3cff..0099e05f16 100644 --- a/Items/Weapons/FrigidflashBolt.cs +++ b/Items/Weapons/FrigidflashBolt.cs @@ -1,52 +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.Weapons -{ - public class FrigidflashBolt : 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.Weapons +{ + public class FrigidflashBolt : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Frigidflash Bolt"); Tooltip.SetDefault("Casts a slow-moving ball of flash-freezing magma"); } - public override void SetDefaults() - { - item.damage = 45; - item.magic = true; - item.mana = 13; - item.width = 28; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FrigidflashBoltProjectile"); - item.shootSpeed = 6.5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FrostBolt"); - recipe.AddIngredient(null, "FlareBolt"); - recipe.AddIngredient(null, "EssenceofEleum", 2); - recipe.AddIngredient(null, "EssenceofChaos", 2); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 45; + item.magic = true; + item.mana = 13; + item.width = 28; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item21; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FrigidflashBoltProjectile"); + item.shootSpeed = 6.5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FrostBolt"); + recipe.AddIngredient(null, "FlareBolt"); + recipe.AddIngredient(null, "EssenceofEleum", 2); + recipe.AddIngredient(null, "EssenceofChaos", 2); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FrostBolt.cs b/Items/Weapons/FrostBolt.cs index 80f230f89d..d793256a4f 100644 --- a/Items/Weapons/FrostBolt.cs +++ b/Items/Weapons/FrostBolt.cs @@ -1,52 +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.Weapons -{ - public class FrostBolt : 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.Weapons +{ + public class FrostBolt : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Frost Bolt"); Tooltip.SetDefault("Casts a slow-moving ball of frost"); } - public override void SetDefaults() - { - item.damage = 12; - item.magic = true; - item.mana = 6; - item.width = 28; - item.height = 30; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FrostBoltProjectile"); - item.shootSpeed = 6f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IceBlock, 20); - recipe.AddIngredient(ItemID.Shiverthorn, 2); - recipe.AddIngredient(ItemID.SnowBlock, 10); - recipe.AddIngredient(ItemID.WaterBucket); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 12; + item.magic = true; + item.mana = 6; + item.width = 28; + item.height = 30; + item.useTime = 16; + item.useAnimation = 16; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FrostBoltProjectile"); + item.shootSpeed = 6f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IceBlock, 20); + recipe.AddIngredient(ItemID.Shiverthorn, 2); + recipe.AddIngredient(ItemID.SnowBlock, 10); + recipe.AddIngredient(ItemID.WaterBucket); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FrostsparkBullet.cs b/Items/Weapons/FrostsparkBullet.cs index fdc0036702..4c1b8c258c 100644 --- a/Items/Weapons/FrostsparkBullet.cs +++ b/Items/Weapons/FrostsparkBullet.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class FrostsparkBullet : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class FrostsparkBullet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Frostspark Bullet"); - Tooltip.SetDefault("Has a chance to freeze enemies and explode into electricity\n" + + Tooltip.SetDefault("Has a chance to freeze enemies and explode into electricity\n" + "Enemies that are immune to being frozen take more damage from these bullets"); } - public override void SetDefaults() - { - item.damage = 11; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = 600; - item.rare = 3; - item.shoot = mod.ProjectileType("FrostsparkBullet"); - item.shootSpeed = 14f; - item.ammo = 97; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 150); - recipe.AddIngredient(null, "CryoBar"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 150); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 11; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.25f; + item.value = 600; + item.rare = 3; + item.shoot = mod.ProjectileType("FrostsparkBullet"); + item.shootSpeed = 14f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MusketBall, 150); + recipe.AddIngredient(null, "CryoBar"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/FulgurationHalberd.cs b/Items/Weapons/FulgurationHalberd.cs index eb357dd3b4..4e8612349c 100644 --- a/Items/Weapons/FulgurationHalberd.cs +++ b/Items/Weapons/FulgurationHalberd.cs @@ -1,96 +1,96 @@ -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 FulgurationHalberd : 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.Weapons +{ + public class FulgurationHalberd : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Fulguration Halberd"); - Tooltip.SetDefault("Inflicts burning blood on enemy hits\n" + + Tooltip.SetDefault("Inflicts burning blood on enemy hits\n" + "Right click to use as a spear"); } - public override void SetDefaults() - { - item.width = 60; - item.damage = 53; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - 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); - recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(ItemID.OrichalcumHalberd); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(ItemID.MythrilHalberd); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 60; + item.damage = 53; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + 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); + recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(ItemID.OrichalcumHalberd); + recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(ItemID.MythrilHalberd); + recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GalacticaBlade.cs b/Items/Weapons/GalacticaBlade.cs index 012feec8cf..c070c7886b 100644 --- a/Items/Weapons/GalacticaBlade.cs +++ b/Items/Weapons/GalacticaBlade.cs @@ -1,121 +1,121 @@ -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 GalacticaBlade : 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.Weapons +{ + public class GalacticaBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Galactus Blade"); - Tooltip.SetDefault("Forged with the fury of nuclear chaos\n" + + Tooltip.SetDefault("Forged with the fury of nuclear chaos\n" + "Launches a barrage of comets from the sky"); } - public override void SetDefaults() - { - item.width = 76; - item.damage = 95; - item.melee = true; - item.useAnimation = 17; - item.useStyle = 1; - item.useTime = 17; - item.useTurn = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item105; - item.autoReuse = true; - item.height = 68; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("GalacticaComet"); - item.shootSpeed = 23f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.StarWrath); - recipe.AddIngredient(ItemID.Ectoplasm, 10); - recipe.AddIngredient(ItemID.SoulofMight, 20); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ItemID.DarkShard); - recipe.AddIngredient(ItemID.LightShard); - recipe.AddTile(TileID.LunarCraftingStation); - 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; - } - num78 *= num80; - num79 *= num80; - int num107 = 5; - 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)Main.rand.Next(-100, 101) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-100, 101) * 0.02f; - int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalacticaComet"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - return false; - } - - 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, (Main.rand.Next(2) == 0 ? 164 : 229)); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } -} + public override void SetDefaults() + { + item.width = 76; + item.damage = 95; + item.melee = true; + item.useAnimation = 17; + item.useStyle = 1; + item.useTime = 17; + item.useTurn = true; + item.knockBack = 6f; + item.UseSound = SoundID.Item105; + item.autoReuse = true; + item.height = 68; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("GalacticaComet"); + item.shootSpeed = 23f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.StarWrath); + recipe.AddIngredient(ItemID.Ectoplasm, 10); + recipe.AddIngredient(ItemID.SoulofMight, 20); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(ItemID.DarkShard); + recipe.AddIngredient(ItemID.LightShard); + recipe.AddTile(TileID.LunarCraftingStation); + 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; + } + num78 *= num80; + num79 *= num80; + int num107 = 5; + 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)Main.rand.Next(-100, 101) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-100, 101) * 0.02f; + int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("GalacticaComet"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); + } + return false; + } + + 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, (Main.rand.Next(2) == 0 ? 164 : 229)); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } +} diff --git a/Items/Weapons/Galeforce.cs b/Items/Weapons/Galeforce.cs index a0497bd2a0..42cb887b6d 100644 --- a/Items/Weapons/Galeforce.cs +++ b/Items/Weapons/Galeforce.cs @@ -1,62 +1,62 @@ -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 Galeforce : 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.Weapons +{ + public class Galeforce : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Galeforce"); Tooltip.SetDefault("Fires a spread of low-damage feathers"); - } - - public override void SetDefaults() - { - item.damage = 18; - item.ranged = true; - item.width = 32; - item.height = 52; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 20f; - 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(4); - 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 * 0.75f, perturbedSpeed.Y * 0.75f, mod.ProjectileType("FeatherLarge"), (int)((double)damage * 0.25), 0f, player.whoAmI, 0f, 0f); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 8); - recipe.AddIngredient(ItemID.SunplateBlock, 3); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 18; + item.ranged = true; + item.width = 32; + item.height = 52; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 20f; + 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(4); + 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 * 0.75f, perturbedSpeed.Y * 0.75f, mod.ProjectileType("FeatherLarge"), (int)((double)damage * 0.25), 0f, player.whoAmI, 0f, 0f); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 8); + recipe.AddIngredient(ItemID.SunplateBlock, 3); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GammaFusillade.cs b/Items/Weapons/GammaFusillade.cs index 921fcdda07..d41b905d44 100644 --- a/Items/Weapons/GammaFusillade.cs +++ b/Items/Weapons/GammaFusillade.cs @@ -1,51 +1,51 @@ -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 GammaFusillade : 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.Weapons +{ + public class GammaFusillade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Biofusillade"); Tooltip.SetDefault("Unleashes a concentrated beam of life energy"); } - public override void SetDefaults() - { - item.damage = 110; - item.magic = true; - item.mana = 4; - item.width = 28; - item.height = 30; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shoot = mod.ProjectileType("GammaLaser"); - item.shootSpeed = 20f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 8); - recipe.AddIngredient(ItemID.SpellTome); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 110; + item.magic = true; + item.mana = 4; + item.width = 28; + item.height = 30; + item.useTime = 3; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shoot = mod.ProjectileType("GammaLaser"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 8); + recipe.AddIngredient(ItemID.SpellTome); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Genisis.cs b/Items/Weapons/Genisis.cs index 1f256be41c..3063813002 100644 --- a/Items/Weapons/Genisis.cs +++ b/Items/Weapons/Genisis.cs @@ -1,71 +1,71 @@ -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 Genisis : 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.Weapons +{ + public class Genisis : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Genisis"); Tooltip.SetDefault("Fires a Y-shaped beam of destructive energy and a spread of lasers"); } - public override void SetDefaults() - { - item.damage = 48; - item.magic = true; - item.mana = 4; - item.width = 74; - item.height = 28; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = mod.ProjectileType("BigBeamofDeath"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - int num6 = 3; - float SpeedX = speedX + (float) Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-20, 21) * 0.05f; - for (int index = 0; index < num6; ++index) - { - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, 440, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 120; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LaserMachinegun); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 48; + item.magic = true; + item.mana = 4; + item.width = 74; + item.height = 28; + item.useTime = 3; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shootSpeed = 6f; + item.shoot = mod.ProjectileType("BigBeamofDeath"); + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + int num6 = 3; + float SpeedX = speedX + (float) Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-20, 21) * 0.05f; + for (int index = 0; index < num6; ++index) + { + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, 440, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].timeLeft = 120; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LaserMachinegun); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GleamingMagnolia.cs b/Items/Weapons/GleamingMagnolia.cs index 6ad649a4c6..b71afc2428 100644 --- a/Items/Weapons/GleamingMagnolia.cs +++ b/Items/Weapons/GleamingMagnolia.cs @@ -1,16 +1,16 @@ -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 GleamingMagnolia : 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.Weapons +{ + public class GleamingMagnolia : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Gleaming Magnolia"); @@ -18,34 +18,34 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 32; - item.magic = true; - item.mana = 11; - item.width = 52; - item.height = 54; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = mod.ProjectileType("GleamingBolt"); - item.shootSpeed = 14f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ManaRose"); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 32; + item.magic = true; + item.mana = 11; + item.width = 52; + item.height = 54; + item.useTime = 27; + item.useAnimation = 27; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.shoot = mod.ProjectileType("GleamingBolt"); + item.shootSpeed = 14f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ManaRose"); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GoldenGun.cs b/Items/Weapons/GoldenGun.cs index 8def3626a1..1a030d0b5e 100644 --- a/Items/Weapons/GoldenGun.cs +++ b/Items/Weapons/GoldenGun.cs @@ -1,59 +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 -{ - public class GoldenGun : 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.Weapons +{ + public class GoldenGun : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Golden Gun"); Tooltip.SetDefault("Shoots a straight line of ichor"); } - public override void SetDefaults() - { - item.damage = 5; - item.width = 78; - item.height = 36; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = mod.ProjectileType("GoldenGun"); - item.shootSpeed = 12f; - } - - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ichor, 15); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 5; + item.width = 78; + item.height = 36; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = mod.ProjectileType("GoldenGun"); + item.shootSpeed = 12f; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Ichor, 15); + recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GoldplumeSpear.cs b/Items/Weapons/GoldplumeSpear.cs index 99b8f77a4d..085a9f3257 100644 --- a/Items/Weapons/GoldplumeSpear.cs +++ b/Items/Weapons/GoldplumeSpear.cs @@ -1,51 +1,51 @@ -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 GoldplumeSpear : 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.Weapons +{ + public class GoldplumeSpear : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Goldplume Spear"); Tooltip.SetDefault("Shoots falling feathers"); } - public override void SetDefaults() - { - item.width = 54; - item.damage = 23; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 23; - item.useStyle = 5; - item.useTime = 23; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 54; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.shoot = mod.ProjectileType("GoldplumeSpearProjectile"); - item.shootSpeed = 5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 10); - recipe.AddIngredient(ItemID.SunplateBlock, 4); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 54; + item.damage = 23; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 23; + item.useStyle = 5; + item.useTime = 23; + item.knockBack = 5.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 54; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.shoot = mod.ProjectileType("GoldplumeSpearProjectile"); + item.shootSpeed = 5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 10); + recipe.AddIngredient(ItemID.SunplateBlock, 4); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GrandGuardian.cs b/Items/Weapons/GrandGuardian.cs index 6f6abefbb6..a8f9d7bfc7 100644 --- a/Items/Weapons/GrandGuardian.cs +++ b/Items/Weapons/GrandGuardian.cs @@ -1,92 +1,92 @@ -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 GrandGuardian : 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.Weapons +{ + public class GrandGuardian : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Grand Guardian"); - Tooltip.SetDefault("Has a chance to lower enemy defense by 15 when striking them\n" + - "If enemy defense is 0 or below your attacks will heal you\n" + - "Striking enemies causes a large explosion\n" + - "Striking enemies that have under half life will make you release rainbow bolts\n" + + Tooltip.SetDefault("Has a chance to lower enemy defense by 15 when striking them\n" + + "If enemy defense is 0 or below your attacks will heal you\n" + + "Striking enemies causes a large explosion\n" + + "Striking enemies that have under half life will make you release rainbow bolts\n" + "Enemies spawn healing orbs on death"); } - public override void SetDefaults() - { - item.width = 124; - item.damage = 150; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 124; - item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = 10; - item.shootSpeed = 12f; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(5) == 0) - { - target.defense -= 15; - } - if (target.defense <= 0 && target.canGhostHeal) - { - player.statLife += 4; - player.HealEffect(4); - } - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("RainbowBoom"), (int)((float)item.damage * player.meleeDamage * 0.5f), 0f, Main.myPlayer); - if (target.life <= (target.lifeMax * 0.5f)) - { - float randomSpeedX = (float)Main.rand.Next(9); - float randomSpeedY = (float)Main.rand.Next(6, 15); - Projectile.NewProjectile(player.Center.X, player.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, Main.myPlayer); - Projectile.NewProjectile(player.Center.X, player.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, Main.myPlayer); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, Main.myPlayer); - } - if (target.life <= 0) - { - float randomSpeedX = (float)Main.rand.Next(9); - float randomSpeedY = (float)Main.rand.Next(6, 15); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, Main.myPlayer); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, Main.myPlayer); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, Main.myPlayer); - } - } - - 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[dust].noGravity = true; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MajesticGuard"); - recipe.AddIngredient(null, "BarofLife", 10); - recipe.AddIngredient(null, "GalacticaSingularity", 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 124; + item.damage = 150; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 124; + item.value = Item.buyPrice(1, 0, 0, 0); + item.rare = 10; + item.shootSpeed = 12f; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(5) == 0) + { + target.defense -= 15; + } + if (target.defense <= 0 && target.canGhostHeal) + { + player.statLife += 4; + player.HealEffect(4); + } + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("RainbowBoom"), (int)((float)item.damage * player.meleeDamage * 0.5f), 0f, Main.myPlayer); + if (target.life <= (target.lifeMax * 0.5f)) + { + float randomSpeedX = (float)Main.rand.Next(9); + float randomSpeedY = (float)Main.rand.Next(6, 15); + Projectile.NewProjectile(player.Center.X, player.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, Main.myPlayer); + Projectile.NewProjectile(player.Center.X, player.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, Main.myPlayer); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("RainBolt"), (int)((float)item.damage * player.meleeDamage * 0.75f), knockback, Main.myPlayer); + } + if (target.life <= 0) + { + float randomSpeedX = (float)Main.rand.Next(9); + float randomSpeedY = (float)Main.rand.Next(6, 15); + Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, mod.ProjectileType("RainHeal"), 0, 0f, Main.myPlayer); + } + } + + 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[dust].noGravity = true; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MajesticGuard"); + recipe.AddIngredient(null, "BarofLife", 10); + recipe.AddIngredient(null, "GalacticaSingularity", 3); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Grax.cs b/Items/Weapons/Grax.cs index 805167c940..50626b04d2 100644 --- a/Items/Weapons/Grax.cs +++ b/Items/Weapons/Grax.cs @@ -1,56 +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 -{ - public class Grax : 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.Weapons +{ + public class Grax : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Grax"); Tooltip.SetDefault("Hitting an enemy will greatly boost your defense and melee stats for a short time"); } - public override void SetDefaults() - { - item.width = 60; - item.damage = 450; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 5; - item.useTurn = true; - item.axe = 50; - item.hammer = 200; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FellerofEvergreens"); - recipe.AddIngredient(null, "DraedonBar", 5); - recipe.AddRecipeGroup("LunarHamaxe"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - player.AddBuff(mod.BuffType("GraxDefense"), 480); - } - } -} + public override void SetDefaults() + { + item.width = 60; + item.damage = 450; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 5; + item.useTurn = true; + item.axe = 50; + item.hammer = 200; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FellerofEvergreens"); + recipe.AddIngredient(null, "DraedonBar", 5); + recipe.AddRecipeGroup("LunarHamaxe"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + player.AddBuff(mod.BuffType("GraxDefense"), 480); + } + } +} diff --git a/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs b/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs index 236f60f623..789e7ec3e0 100644 --- a/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs +++ b/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs @@ -1,84 +1,84 @@ -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.Weapons.GreatSandShark -{ - public class SandSharknadoStaff : ModItem - { +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.Weapons.GreatSandShark +{ + public class SandSharknadoStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Sand Sharknado Staff"); Tooltip.SetDefault("Summons a sandnado to fight for you"); } - - public override void SetDefaults() - { - item.damage = 98; - item.mana = 10; - item.width = 48; - item.height = 56; - item.useTime = 35; - item.useAnimation = 35; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Sandnado"); - item.shootSpeed = 10f; - item.summon = true; - } - - 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); - recipe.AddIngredient(null, "GrandScale"); - recipe.AddIngredient(ItemID.HallowedBar, 10); - recipe.AddIngredient(ItemID.AncientCloth, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 98; + item.mana = 10; + item.width = 48; + item.height = 56; + item.useTime = 35; + item.useAnimation = 35; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Sandnado"); + item.shootSpeed = 10f; + item.summon = true; + } + + 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); + recipe.AddIngredient(null, "GrandScale"); + recipe.AddIngredient(ItemID.HallowedBar, 10); + recipe.AddIngredient(ItemID.AncientCloth, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GreatSandShark/Sandstorm.cs b/Items/Weapons/GreatSandShark/Sandstorm.cs index f92382c9a6..2025913f1c 100644 --- a/Items/Weapons/GreatSandShark/Sandstorm.cs +++ b/Items/Weapons/GreatSandShark/Sandstorm.cs @@ -1,63 +1,63 @@ -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.GreatSandShark -{ - public class Sandstorm : 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.Weapons.GreatSandShark +{ + public class Sandstorm : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Sandstorm"); Tooltip.SetDefault("Fires sand bullets that explode"); } - public override void SetDefaults() - { - item.damage = 73; - item.ranged = true; - item.width = 62; - item.height = 26; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("SandstormBullet"); - item.useAmmo = AmmoID.Sand; - } - - 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("SandstormBullet"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Sandgun); - recipe.AddIngredient(null, "GrandScale"); - recipe.AddIngredient(ItemID.Amber, 5); - recipe.AddIngredient(ItemID.SandBlock, 50); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 73; + item.ranged = true; + item.width = 62; + item.height = 26; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("SandstormBullet"); + item.useAmmo = AmmoID.Sand; + } + + 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("SandstormBullet"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Sandgun); + recipe.AddIngredient(null, "GrandScale"); + recipe.AddIngredient(ItemID.Amber, 5); + recipe.AddIngredient(ItemID.SandBlock, 50); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GreatSandShark/ShiftingSands.cs b/Items/Weapons/GreatSandShark/ShiftingSands.cs index bc5b73d0b3..913af53776 100644 --- a/Items/Weapons/GreatSandShark/ShiftingSands.cs +++ b/Items/Weapons/GreatSandShark/ShiftingSands.cs @@ -1,52 +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.Weapons.GreatSandShark -{ - public class ShiftingSands : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shifting Sands"); - Tooltip.SetDefault("Casts a sand shard that follows the mouse cursor"); - } - - public override void SetDefaults() - { - item.damage = 95; - item.magic = true; - item.channel = true; - item.mana = 20; - item.width = 58; - item.height = 58; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item20; - item.shoot = mod.ProjectileType("ShiftingSands"); - item.shootSpeed = 7f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MagicMissile); - recipe.AddIngredient(null, "GrandScale"); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.SpectreBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.GreatSandShark +{ + public class ShiftingSands : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shifting Sands"); + Tooltip.SetDefault("Casts a sand shard that follows the mouse cursor"); + } + + public override void SetDefaults() + { + item.damage = 95; + item.magic = true; + item.channel = true; + item.mana = 20; + item.width = 58; + item.height = 58; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item20; + item.shoot = mod.ProjectileType("ShiftingSands"); + item.shootSpeed = 7f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MagicMissile); + recipe.AddIngredient(null, "GrandScale"); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.SpectreBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GreatSandShark/Tumbleweed.cs b/Items/Weapons/GreatSandShark/Tumbleweed.cs index e01c4ed86c..05e3f85661 100644 --- a/Items/Weapons/GreatSandShark/Tumbleweed.cs +++ b/Items/Weapons/GreatSandShark/Tumbleweed.cs @@ -1,52 +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.Weapons.GreatSandShark -{ - public class Tumbleweed : 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.Weapons.GreatSandShark +{ + public class Tumbleweed : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Tumbleweed"); - Tooltip.SetDefault("Releases a rolling tumbleweed on enemy hits"); + Tooltip.SetDefault("Releases a rolling tumbleweed on enemy hits"); } - public override void SetDefaults() - { - item.damage = 110; - item.melee = true; - item.width = 30; - item.height = 10; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = mod.ProjectileType("Tumbleweed"); - item.shootSpeed = 12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Sunfury); - recipe.AddIngredient(null, "GrandScale"); - recipe.AddIngredient(ItemID.SoulofMight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 110; + item.melee = true; + item.width = 30; + item.height = 10; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.knockBack = 8f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.channel = true; + item.shoot = mod.ProjectileType("Tumbleweed"); + item.shootSpeed = 12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Sunfury); + recipe.AddIngredient(null, "GrandScale"); + recipe.AddIngredient(ItemID.SoulofMight, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GreatbowofTurmoil.cs b/Items/Weapons/GreatbowofTurmoil.cs index 53fb9ca6f9..7b41acf7fc 100644 --- a/Items/Weapons/GreatbowofTurmoil.cs +++ b/Items/Weapons/GreatbowofTurmoil.cs @@ -1,87 +1,87 @@ -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 GreatbowofTurmoil : 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.Weapons +{ + public class GreatbowofTurmoil : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Greatbow of Turmoil"); - Tooltip.SetDefault("Fires 3 arrows at once\n" + + Tooltip.SetDefault("Fires 3 arrows at once\n" + "Fires 2 additional cursed, hellfire, or ichor arrows"); - } - - public override void SetDefaults() - { - item.damage = 46; - item.ranged = true; - item.width = 18; - item.height = 36; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 17f; - 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 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - 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; - } - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - switch (Main.rand.Next(3)) - { - case 0: type = ProjectileID.CursedArrow; break; - case 1: type = ProjectileID.HellfireArrow; break; - case 2: type = ProjectileID.IchorArrow; break; - default: break; - } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[index].noDropItem = true; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 46; + item.ranged = true; + item.width = 18; + item.height = 36; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 17f; + 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 = 3; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 40f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + 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; + } + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + switch (Main.rand.Next(3)) + { + case 0: type = ProjectileID.CursedArrow; break; + case 1: type = ProjectileID.HellfireArrow; break; + case 2: type = ProjectileID.IchorArrow; break; + default: break; + } + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[index].noDropItem = true; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GreatswordofBlah.cs b/Items/Weapons/GreatswordofBlah.cs index ddf6bf9a50..ee55c4a9ea 100644 --- a/Items/Weapons/GreatswordofBlah.cs +++ b/Items/Weapons/GreatswordofBlah.cs @@ -1,56 +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 -{ - public class GreatswordofBlah : 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.Weapons +{ + public class GreatswordofBlah : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Greatsword of Blah"); - Tooltip.SetDefault("A pale white sword from a forgotten land\n" + + Tooltip.SetDefault("A pale white sword from a forgotten land\n" + "Fires a rainbow orb that emits rainbow rain on death for a time\n" + "You can hear faint yet comforting whispers emanating from the blade\n" + "'No matter where you may be you are never alone\n" + "I shall always be at your side, my lord'"); } - public override void SetDefaults() - { - item.width = 110; - item.damage = 280; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 110; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("JudgementBlah"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GreatswordofJudgement"); - recipe.AddIngredient(null, "NightmareFuel", 10); - recipe.AddIngredient(null, "EndothermicEnergy", 10); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 110; + item.damage = 280; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 110; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("JudgementBlah"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GreatswordofJudgement"); + recipe.AddIngredient(null, "NightmareFuel", 10); + recipe.AddIngredient(null, "EndothermicEnergy", 10); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/GreatswordofJudgement.cs b/Items/Weapons/GreatswordofJudgement.cs index 4f0de1d878..ebf1e28c8f 100644 --- a/Items/Weapons/GreatswordofJudgement.cs +++ b/Items/Weapons/GreatswordofJudgement.cs @@ -1,53 +1,53 @@ -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 GreatswordofJudgement : 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.Weapons +{ + public class GreatswordofJudgement : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Greatsword of Judgement"); - Tooltip.SetDefault("A pale white sword from a forgotten land\n" + + Tooltip.SetDefault("A pale white sword from a forgotten land\n" + "Fires a white orb that emits white rain on death for a time\n" + "You can hear faint yet comforting whispers emanating from the blade\n" + "'No matter where you may be you are never alone\n" + "I shall always be at your side, my lord'"); } - public override void SetDefaults() - { - item.width = 70; - item.damage = 58; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("Judgement"); - item.shootSpeed = 10f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarBar, 11); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 70; + item.damage = 58; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 72; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Judgement"); + item.shootSpeed = 10f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarBar, 11); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/HarvestStaff.cs b/Items/Weapons/HarvestStaff.cs index 358f5ffd89..87624a2bae 100644 --- a/Items/Weapons/HarvestStaff.cs +++ b/Items/Weapons/HarvestStaff.cs @@ -1,16 +1,16 @@ -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 HarvestStaff : 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.Weapons +{ + public class HarvestStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Harvest Staff"); @@ -18,35 +18,35 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 15; - item.magic = true; - item.mana = 5; - item.width = 28; - item.height = 30; - item.useTime = 23; - item.useAnimation = 23; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FlamingPumpkin"); - item.shootSpeed = 10f; - item.scale = 0.9f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pumpkin, 20); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 15; + item.magic = true; + item.mana = 5; + item.width = 28; + item.height = 30; + item.useTime = 23; + item.useAnimation = 23; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FlamingPumpkin"); + item.shootSpeed = 10f; + item.scale = 0.9f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Pumpkin, 20); + recipe.AddIngredient(ItemID.FallenStar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/HeartRapier.cs b/Items/Weapons/HeartRapier.cs index e473afeed8..d536066691 100644 --- a/Items/Weapons/HeartRapier.cs +++ b/Items/Weapons/HeartRapier.cs @@ -1,50 +1,50 @@ -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 HeartRapier : 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.Weapons +{ + public class HeartRapier : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Heart Rapier"); Tooltip.SetDefault("Heals the player on enemy hits"); } - public override void SetDefaults() - { - item.width = 44; - item.damage = 38; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 44; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("HeartRapierProjectile"); - item.shootSpeed = 5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LifeCrystal, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 44; + item.damage = 38; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 44; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("HeartRapierProjectile"); + item.shootSpeed = 5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LifeCrystal, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/HeavenlyGale.cs b/Items/Weapons/HeavenlyGale.cs index 6a31fcd5e7..4778412c6a 100644 --- a/Items/Weapons/HeavenlyGale.cs +++ b/Items/Weapons/HeavenlyGale.cs @@ -1,102 +1,102 @@ -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 HeavenlyGale : 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.Weapons +{ + public class HeavenlyGale : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Heavenly Gale"); - Tooltip.SetDefault("Fires a barrage of 5 random exo arrows\n" + - "Green exo arrows explode into a tornado on death\n" + - "Blue exo arrows cause a second group of arrows to fire on enemy hits\n" + - "Orange exo arrows cause explosions on death\n" + + Tooltip.SetDefault("Fires a barrage of 5 random exo arrows\n" + + "Green exo arrows explode into a tornado on death\n" + + "Blue exo arrows cause a second group of arrows to fire on enemy hits\n" + + "Orange exo arrows cause explosions on death\n" + "Teal exo arrows ignore enemy immunity frames"); } - public override void SetDefaults() - { - item.damage = 700; - item.ranged = true; - item.width = 44; - item.height = 58; - item.useTime = 9; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 17f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - 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(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - switch (Main.rand.Next(10)) - { - case 0: - case 1: - case 2: - case 3: type = mod.ProjectileType("TealExoArrow"); break; - case 4: - case 5: - case 6: type = mod.ProjectileType("OrangeExoArrow"); break; - case 7: - case 8: type = mod.ProjectileType("BlueExoArrow"); break; - case 9: type = mod.ProjectileType("GreenExoArrow"); break; - } - Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Alluvion"); - recipe.AddIngredient(null, "AstrealDefeat"); - recipe.AddIngredient(null, "ClockworkBow"); - recipe.AddIngredient(null, "FlarewingBow"); - recipe.AddIngredient(null, "Phangasm"); - recipe.AddIngredient(null, "PlanetaryAnnihilation"); - recipe.AddIngredient(null, "TheBallista"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "HellcasterFragment", 3); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "AuricOre", 25); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 700; + item.ranged = true; + item.width = 44; + item.height = 58; + item.useTime = 9; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 17f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + 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(); + vector7 *= 40f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + switch (Main.rand.Next(10)) + { + case 0: + case 1: + case 2: + case 3: type = mod.ProjectileType("TealExoArrow"); break; + case 4: + case 5: + case 6: type = mod.ProjectileType("OrangeExoArrow"); break; + case 7: + case 8: type = mod.ProjectileType("BlueExoArrow"); break; + case 9: type = mod.ProjectileType("GreenExoArrow"); break; + } + Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Alluvion"); + recipe.AddIngredient(null, "AstrealDefeat"); + recipe.AddIngredient(null, "ClockworkBow"); + recipe.AddIngredient(null, "FlarewingBow"); + recipe.AddIngredient(null, "Phangasm"); + recipe.AddIngredient(null, "PlanetaryAnnihilation"); + recipe.AddIngredient(null, "TheBallista"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "HellcasterFragment", 3); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/HellBurst.cs b/Items/Weapons/HellBurst.cs index 2faafe4a60..12603632a9 100644 --- a/Items/Weapons/HellBurst.cs +++ b/Items/Weapons/HellBurst.cs @@ -1,52 +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.Weapons -{ - public class HellBurst : 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.Weapons +{ + public class HellBurst : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Hell Burst"); Tooltip.SetDefault("Casts a beam of flame"); } - public override void SetDefaults() - { - item.damage = 40; - item.magic = true; - item.mana = 14; - item.width = 52; - item.height = 52; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item34; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FlameBeamTip"); - item.shootSpeed = 32f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Flamelash); - recipe.AddIngredient(ItemID.CrystalVileShard); - recipe.AddIngredient(ItemID.DarkShard, 2); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 40; + item.magic = true; + item.mana = 14; + item.width = 52; + item.height = 52; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item34; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FlameBeamTip"); + item.shootSpeed = 32f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Flamelash); + recipe.AddIngredient(ItemID.CrystalVileShard); + recipe.AddIngredient(ItemID.DarkShard, 2); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/HellfireFlamberge.cs b/Items/Weapons/HellfireFlamberge.cs index 6081961920..6eae4f183b 100644 --- a/Items/Weapons/HellfireFlamberge.cs +++ b/Items/Weapons/HellfireFlamberge.cs @@ -1,84 +1,84 @@ -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 HellfireFlamberge : 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.Weapons +{ + public class HellfireFlamberge : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Hellfire Flamberge"); Tooltip.SetDefault("Fires a spread of fireballs"); } - public override void SetDefaults() - { - item.width = 60; - item.damage = 102; - item.melee = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("ChaosFlameSmall"); - item.shootSpeed = 20f; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float SpeedA = speedX; - float SpeedB = speedY; - int num6 = Main.rand.Next(3, 5); - 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; - switch (Main.rand.Next(3)) - { - case 0: type = mod.ProjectileType("ChaosFlameSmall"); break; - case 1: type = mod.ProjectileType("ChaosFlameMedium"); break; - case 2: type = mod.ProjectileType("ChaosFlameLarge"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 15); - 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, 174); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - } -} + public override void SetDefaults() + { + item.width = 60; + item.damage = 102; + item.melee = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.useTurn = true; + item.knockBack = 7.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("ChaosFlameSmall"); + item.shootSpeed = 20f; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedA = speedX; + float SpeedB = speedY; + int num6 = Main.rand.Next(3, 5); + 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; + switch (Main.rand.Next(3)) + { + case 0: type = mod.ProjectileType("ChaosFlameSmall"); break; + case 1: type = mod.ProjectileType("ChaosFlameMedium"); break; + case 2: type = mod.ProjectileType("ChaosFlameLarge"); break; + default: break; + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 15); + 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, 174); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Items/Weapons/HellionFlowerSpear.cs b/Items/Weapons/HellionFlowerSpear.cs index 0b96b5683a..71152fd101 100644 --- a/Items/Weapons/HellionFlowerSpear.cs +++ b/Items/Weapons/HellionFlowerSpear.cs @@ -1,51 +1,51 @@ -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 HellionFlowerSpear : 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.Weapons +{ + public class HellionFlowerSpear : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Hellion Flower Spear"); - Tooltip.SetDefault("Shoots a flower spear tip\n" + + Tooltip.SetDefault("Shoots a flower spear tip\n" + "Summons petals from the sky on critical hits"); } - public override void SetDefaults() - { - item.width = 74; - item.damage = 67; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 74; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("HellionFlowerSpearProjectile"); - item.shootSpeed = 8f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 12); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 74; + item.damage = 67; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 74; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("HellionFlowerSpearProjectile"); + item.shootSpeed = 8f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Hellkite.cs b/Items/Weapons/Hellkite.cs index 3a2497e8e0..b93609d1ee 100644 --- a/Items/Weapons/Hellkite.cs +++ b/Items/Weapons/Hellkite.cs @@ -1,103 +1,103 @@ -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 Hellkite : 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.Weapons +{ + public class Hellkite : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Hellkite"); - Tooltip.SetDefault("Contains the power of an ancient drake\n" + + Tooltip.SetDefault("Contains the power of an ancient drake\n" + "Summons flame geyser explosions on enemy hits"); } - public override void SetDefaults() - { - item.width = 84; - item.damage = 100; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 84; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 8); - recipe.AddIngredient(ItemID.FieryGreatsword); - 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, 174); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - player.ApplyDamageToNPC(target, damage, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 200, default(Color), num50); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity.Y -= 6f; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 100, default(Color), num51); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust = Main.dust[num54]; - dust.velocity.Y -= 6f; - 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(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 0, default(Color), num52); - Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default(Vector2)) * (float)target.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity.Y -= 6f; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } -} + public override void SetDefaults() + { + item.width = 84; + item.damage = 100; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 84; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 8); + recipe.AddIngredient(ItemID.FieryGreatsword); + 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, 174); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + player.ApplyDamageToNPC(target, damage, 0f, 0, false); + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * target.velocity.Length(); + Main.PlaySound(SoundID.Item14, target.position); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 200, default(Color), num50); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity.Y -= 6f; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 100, default(Color), num51); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust = Main.dust[num54]; + dust.velocity.Y -= 6f; + 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(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 0, default(Color), num52); + Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default(Vector2)) * (float)target.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity.Y -= 6f; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } +} diff --git a/Items/Weapons/HellwingStaff.cs b/Items/Weapons/HellwingStaff.cs index 687245ec01..40b6a3667e 100644 --- a/Items/Weapons/HellwingStaff.cs +++ b/Items/Weapons/HellwingStaff.cs @@ -1,16 +1,16 @@ -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 HellwingStaff : 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.Weapons +{ + public class HellwingStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Hellwing Staff"); @@ -18,97 +18,97 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 20; - item.magic = true; - item.mana = 18; - item.width = 54; - item.height = 52; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FlamePillar"); - item.shootSpeed = 9f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LavaBucket, 2); - recipe.AddIngredient(ItemID.HellstoneBar, 7); - recipe.AddTile(TileID.Anvils); - 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; - } - num78 *= num80; - num79 *= num80; - int num130 = 7; - if (Main.rand.Next(6) == 0) - { - num130++; - } - if (Main.rand.Next(7) == 0) - { - num130++; - } - if (Main.rand.Next(8) == 0) - { - num130++; - } - for (int num131 = 0; num131 < num130; num131++) - { - 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); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num131); - 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(-40, 41) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("FlamePillar"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 20; + item.magic = true; + item.mana = 18; + item.width = 54; + item.height = 52; + item.useTime = 33; + item.useAnimation = 33; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FlamePillar"); + item.shootSpeed = 9f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LavaBucket, 2); + recipe.AddIngredient(ItemID.HellstoneBar, 7); + recipe.AddTile(TileID.Anvils); + 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; + } + num78 *= num80; + num79 *= num80; + int num130 = 7; + if (Main.rand.Next(6) == 0) + { + num130++; + } + if (Main.rand.Next(7) == 0) + { + num130++; + } + if (Main.rand.Next(8) == 0) + { + num130++; + } + for (int num131 = 0; num131 < num130; num131++) + { + 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); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num131); + 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(-40, 41) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("FlamePillar"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Helstorm.cs b/Items/Weapons/Helstorm.cs index 636c1ad0e5..4a0c416336 100644 --- a/Items/Weapons/Helstorm.cs +++ b/Items/Weapons/Helstorm.cs @@ -1,67 +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 -{ - public class Helstorm : 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.Weapons +{ + public class Helstorm : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Helstorm"); - Tooltip.SetDefault("Fires two bullets at once\n" + + Tooltip.SetDefault("Fires two bullets at once\n" + "The gun also deals damage to enemies that touch it"); } - public override void SetDefaults() - { - item.damage = 21; - item.ranged = true; - item.width = 50; - item.height = 24; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = 5; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 11.5f; - item.useAmmo = 97; - } - - 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 num7 = speedX; - 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, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CruptixBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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 + public override void SetDefaults() + { + item.damage = 21; + item.ranged = true; + item.width = 50; + item.height = 24; + item.useTime = 7; + item.useAnimation = 7; + item.useStyle = 5; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 11.5f; + item.useAmmo = 97; + } + + 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 num7 = speedX; + 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, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CruptixBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 400); + } + } +} diff --git a/Items/Weapons/HiveMind/DankStaff.cs b/Items/Weapons/HiveMind/DankStaff.cs index 667856633b..4a1c94b23b 100644 --- a/Items/Weapons/HiveMind/DankStaff.cs +++ b/Items/Weapons/HiveMind/DankStaff.cs @@ -1,84 +1,84 @@ -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.Weapons.HiveMind -{ - public class DankStaff : ModItem - { +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.Weapons.HiveMind +{ + public class DankStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Dank Staff"); Tooltip.SetDefault("Summons a dank creeper to fight for you"); } - - public override void SetDefaults() - { - item.damage = 7; - item.mana = 10; - item.width = 58; - item.height = 58; - item.useTime = 36; - item.useAnimation = 36; - item.scale = 0.85f; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DankCreeper"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 3); - recipe.AddIngredient(ItemID.DemoniteBar, 8); - recipe.AddIngredient(null, "TrueShadowScale", 7); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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 + + public override void SetDefaults() + { + item.damage = 7; + item.mana = 10; + item.width = 58; + item.height = 58; + item.useTime = 36; + item.useAnimation = 36; + item.scale = 0.85f; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DankCreeper"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 3); + recipe.AddIngredient(ItemID.DemoniteBar, 8); + recipe.AddIngredient(null, "TrueShadowScale", 7); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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); + } + } +} diff --git a/Items/Weapons/HiveMind/LeechingDagger.cs b/Items/Weapons/HiveMind/LeechingDagger.cs index e3240a44c4..b585524b15 100644 --- a/Items/Weapons/HiveMind/LeechingDagger.cs +++ b/Items/Weapons/HiveMind/LeechingDagger.cs @@ -1,64 +1,64 @@ -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.HiveMind -{ - public class LeechingDagger : ModItem - { +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.HiveMind +{ + public class LeechingDagger : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Leeching Dagger"); Tooltip.SetDefault("Enemies release homing leech orbs on death"); } - - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 26; - item.height = 26; - item.damage = 26; - item.melee = true; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 2); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(null, "TrueShadowScale", 4); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 14); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Leech"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } -} + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 15; + item.useTime = 15; + item.width = 26; + item.height = 26; + item.damage = 26; + item.melee = true; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 2); + recipe.AddIngredient(ItemID.DemoniteBar, 5); + recipe.AddIngredient(null, "TrueShadowScale", 4); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 14); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Leech"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } +} diff --git a/Items/Weapons/HiveMind/PerfectDark.cs b/Items/Weapons/HiveMind/PerfectDark.cs index b87da894d8..4a60c17ba7 100644 --- a/Items/Weapons/HiveMind/PerfectDark.cs +++ b/Items/Weapons/HiveMind/PerfectDark.cs @@ -1,50 +1,50 @@ -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.HiveMind -{ - public class PerfectDark : 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.Weapons.HiveMind +{ + public class PerfectDark : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Perfect Dark"); Tooltip.SetDefault("Fires a vile ball that sticks to tiles and explodes"); - } - - public override void SetDefaults() - { - item.width = 50; - item.damage = 22; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.shoot = mod.ProjectileType("DarkBall"); - item.shootSpeed = 5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 5); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(null, "TrueShadowScale", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + } + + public override void SetDefaults() + { + item.width = 50; + item.damage = 22; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 4.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.shoot = mod.ProjectileType("DarkBall"); + item.shootSpeed = 5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 5); + recipe.AddIngredient(ItemID.DemoniteBar, 5); + recipe.AddIngredient(null, "TrueShadowScale", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/HiveMind/ShaderainStaff.cs b/Items/Weapons/HiveMind/ShaderainStaff.cs index 8be36aef64..76a096b983 100644 --- a/Items/Weapons/HiveMind/ShaderainStaff.cs +++ b/Items/Weapons/HiveMind/ShaderainStaff.cs @@ -1,80 +1,80 @@ -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.HiveMind -{ - public class ShaderainStaff : 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.Weapons.HiveMind +{ + public class ShaderainStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Shaderain Staff"); Tooltip.SetDefault("Fires a shade storm cloud"); } - - public override void SetDefaults() - { - item.damage = 17; - item.magic = true; - item.mana = 10; - item.width = 34; - item.height = 34; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item66; - item.shoot = mod.ProjectileType("ShadeNimbus"); - item.shootSpeed = 16f; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float 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 num154 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("ShadeNimbusCloud"), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num154].ai[0] = (float)Main.mouseX + Main.screenPosition.X; - Main.projectile[num154].ai[1] = (float)Main.mouseY + Main.screenPosition.Y; - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 2); - recipe.AddIngredient(ItemID.DemoniteBar, 3); - recipe.AddIngredient(null, "TrueShadowScale", 12); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 17; + item.magic = true; + item.mana = 10; + item.width = 34; + item.height = 34; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item66; + item.shoot = mod.ProjectileType("ShadeNimbus"); + item.shootSpeed = 16f; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float 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 num154 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("ShadeNimbusCloud"), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num154].ai[0] = (float)Main.mouseX + Main.screenPosition.X; + Main.projectile[num154].ai[1] = (float)Main.mouseY + Main.screenPosition.Y; + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 2); + recipe.AddIngredient(ItemID.DemoniteBar, 3); + recipe.AddIngredient(null, "TrueShadowScale", 12); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/HiveMind/Shadethrower.cs b/Items/Weapons/HiveMind/Shadethrower.cs index b3a478cb59..704eec24be 100644 --- a/Items/Weapons/HiveMind/Shadethrower.cs +++ b/Items/Weapons/HiveMind/Shadethrower.cs @@ -1,63 +1,63 @@ -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.HiveMind -{ - public class Shadethrower : 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.Weapons.HiveMind +{ + public class Shadethrower : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Shadethrower"); Tooltip.SetDefault("33% chance to not consume gel"); } - - public override void SetDefaults() - { - item.damage = 16; - item.ranged = true; - item.width = 54; - item.height = 14; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ShadeFire"); - item.shootSpeed = 5.5f; - item.useAmmo = 23; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 33) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 3); - recipe.AddIngredient(ItemID.DemoniteBar, 7); - recipe.AddIngredient(null, "TrueShadowScale", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 16; + item.ranged = true; + item.width = 54; + item.height = 14; + item.useTime = 10; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ShadeFire"); + item.shootSpeed = 5.5f; + item.useAmmo = 23; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 33) + return false; + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 3); + recipe.AddIngredient(ItemID.DemoniteBar, 7); + recipe.AddIngredient(null, "TrueShadowScale", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/HiveMind/ShadowdropStaff.cs b/Items/Weapons/HiveMind/ShadowdropStaff.cs index b2e431f133..50365deeea 100644 --- a/Items/Weapons/HiveMind/ShadowdropStaff.cs +++ b/Items/Weapons/HiveMind/ShadowdropStaff.cs @@ -1,103 +1,103 @@ -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.HiveMind -{ - public class ShadowdropStaff : 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.Weapons.HiveMind +{ + public class ShadowdropStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Shadowdrop Staff"); Tooltip.SetDefault("Summons dark aura rain from the sky"); Item.staff[item.type] = true; } - - public override void SetDefaults() - { - item.damage = 19; - item.magic = true; - item.mana = 13; - item.width = 48; - item.height = 48; - item.useTime = 9; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item66; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AuraRain"); - item.shootSpeed = 8f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RottenChunk, 5); - recipe.AddIngredient(ItemID.DemoniteBar, 5); - recipe.AddIngredient(null, "TrueShadowScale", 15); - recipe.AddTile(TileID.DemonAltar); - 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; - } - num78 *= num80; - num79 *= num80; - int num107 = 10; - 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)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, mod.ProjectileType("AuraRain"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 19; + item.magic = true; + item.mana = 13; + item.width = 48; + item.height = 48; + item.useTime = 9; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item66; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AuraRain"); + item.shootSpeed = 8f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RottenChunk, 5); + recipe.AddIngredient(ItemID.DemoniteBar, 5); + recipe.AddIngredient(null, "TrueShadowScale", 15); + recipe.AddTile(TileID.DemonAltar); + 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; + } + num78 *= num80; + num79 *= num80; + int num107 = 10; + 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)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, mod.ProjectileType("AuraRain"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); + } + return false; + } + } +} diff --git a/Items/Weapons/HolidayHalberd.cs b/Items/Weapons/HolidayHalberd.cs index f2084cb9fa..be3384d6f8 100644 --- a/Items/Weapons/HolidayHalberd.cs +++ b/Items/Weapons/HolidayHalberd.cs @@ -1,65 +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 -{ - public class HolidayHalberd : 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.Weapons +{ + public class HolidayHalberd : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Holiday Halberd"); - Tooltip.SetDefault("idk I'm miserable with names\n" + - "- The General\n" + + Tooltip.SetDefault("idk I'm miserable with names\n" + + "- The General\n" + "Fires red and green bouncing balls that emit clouds as they travel"); } - public override void SetDefaults() - { - item.width = 70; - item.damage = 94; - item.melee = true; - item.useAnimation = 17; - item.useStyle = 1; - item.useTime = 17; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("RedBall"); - item.shootSpeed = 12f; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - int dustType = 0; - switch (Main.rand.Next(4)) - { - case 1: dustType = 107; break; - case 2: dustType = 90; break; - } - if (Main.rand.Next(5) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType); - } - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (Main.rand.Next(3) == 0) - { - type = mod.ProjectileType("GreenBall"); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - return false; - } - } -} + public override void SetDefaults() + { + item.width = 70; + item.damage = 94; + item.melee = true; + item.useAnimation = 17; + item.useStyle = 1; + item.useTime = 17; + item.useTurn = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 72; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("RedBall"); + item.shootSpeed = 12f; + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + int dustType = 0; + switch (Main.rand.Next(4)) + { + case 1: dustType = 107; break; + case 2: dustType = 90; break; + } + if (Main.rand.Next(5) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType); + } + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (Main.rand.Next(3) == 0) + { + type = mod.ProjectileType("GreenBall"); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + return false; + } + } +} diff --git a/Items/Weapons/HolyFireBullet.cs b/Items/Weapons/HolyFireBullet.cs index 84172b70a3..7e40af1118 100644 --- a/Items/Weapons/HolyFireBullet.cs +++ b/Items/Weapons/HolyFireBullet.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class HolyFireBullet : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class HolyFireBullet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Fire Bullet"); Tooltip.SetDefault("Explosive holy bullets"); } - public override void SetDefaults() - { - item.damage = 27; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 2f; - item.value = 2000; - item.rare = 10; - item.shoot = mod.ProjectileType("HolyFireBullet"); - item.shootSpeed = 12f; - item.ammo = 97; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ExplodingBullet, 100); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 27; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 2f; + item.value = 2000; + item.rare = 10; + item.shoot = mod.ProjectileType("HolyFireBullet"); + item.shootSpeed = 12f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ExplodingBullet, 100); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/HyperiusBullet.cs b/Items/Weapons/HyperiusBullet.cs index ae1defdda7..e345d9fb48 100644 --- a/Items/Weapons/HyperiusBullet.cs +++ b/Items/Weapons/HyperiusBullet.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class HyperiusBullet : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class HyperiusBullet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Hyperius Bullet"); - Tooltip.SetDefault("Your enemies might have a bad time\n" + + Tooltip.SetDefault("Your enemies might have a bad time\n" + "Spawns additional bullets on enemy hits"); } - public override void SetDefaults() - { - item.damage = 21; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 2000; - item.rare = 9; - item.shoot = mod.ProjectileType("HyperiusBullet"); - item.shootSpeed = 16f; - item.ammo = 97; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 100); - recipe.AddIngredient(null, "BarofLife"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 21; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 2000; + item.rare = 9; + item.shoot = mod.ProjectileType("HyperiusBullet"); + item.shootSpeed = 16f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MusketBall, 100); + recipe.AddIngredient(null, "BarofLife"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/IcicleStaff.cs b/Items/Weapons/IcicleStaff.cs index 3d0c6419f3..5b027b2738 100644 --- a/Items/Weapons/IcicleStaff.cs +++ b/Items/Weapons/IcicleStaff.cs @@ -1,107 +1,107 @@ -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 IcicleStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icicle Staff"); - Tooltip.SetDefault("Casts icicles from the sky"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 10; - item.magic = true; - item.mana = 6; - item.width = 44; - item.height = 44; - item.useTime = 15; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WintersFury"); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IceBlock, 25); - recipe.AddIngredient(ItemID.Shiverthorn, 3); - recipe.AddTile(TileID.Anvils); - 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) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = item.damage; - float num74 = item.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 *= num80; - num79 *= num80; - int num107 = 1; - 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(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("WintersFury"), num73, num74, i, 0f, (float)Main.rand.Next(10)); - } - return false; - } - } -} \ No newline at end of file +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 IcicleStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icicle Staff"); + Tooltip.SetDefault("Casts icicles from the sky"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 10; + item.magic = true; + item.mana = 6; + item.width = 44; + item.height = 44; + item.useTime = 15; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WintersFury"); + item.shootSpeed = 16f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IceBlock, 25); + recipe.AddIngredient(ItemID.Shiverthorn, 3); + recipe.AddTile(TileID.Anvils); + 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) + { + int i = Main.myPlayer; + float num72 = item.shootSpeed; + int num73 = item.damage; + float num74 = item.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 *= num80; + num79 *= num80; + int num107 = 1; + 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(-40, 41) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("WintersFury"), num73, num74, i, 0f, (float)Main.rand.Next(10)); + } + return false; + } + } +} diff --git a/Items/Weapons/Impaler.cs b/Items/Weapons/Impaler.cs index d7f9e1b53c..2f69647b8f 100644 --- a/Items/Weapons/Impaler.cs +++ b/Items/Weapons/Impaler.cs @@ -1,73 +1,73 @@ -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 Impaler : 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.Weapons +{ + public class Impaler : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Impaler"); Tooltip.SetDefault("Fires explosive and flaming stakes"); } - public override void SetDefaults() - { - item.damage = 120; - item.ranged = true; - item.crit += 14; - item.width = 40; - item.height = 26; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FlamingStake"); - item.shootSpeed = 10f; - item.useAmmo = 1836; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(0, -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) - { - float SpeedX = speedX + (float) Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-5, 6) * 0.05f; - if (Main.rand.Next(3) == 0) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("ExplodingStake"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("FlamingStake"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddIngredient(ItemID.StakeLauncher); - recipe.AddIngredient(ItemID.ExplosivePowder, 100); - recipe.AddIngredient(ItemID.LivingFireBlock, 75); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 120; + item.ranged = true; + item.crit += 14; + item.width = 40; + item.height = 26; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FlamingStake"); + item.shootSpeed = 10f; + item.useAmmo = 1836; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(0, -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) + { + float SpeedX = speedX + (float) Main.rand.Next(-5, 6) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-5, 6) * 0.05f; + if (Main.rand.Next(3) == 0) + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("ExplodingStake"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("FlamingStake"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddIngredient(ItemID.StakeLauncher); + recipe.AddIngredient(ItemID.ExplosivePowder, 100); + recipe.AddIngredient(ItemID.LivingFireBlock, 75); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/InfernaCutter.cs b/Items/Weapons/InfernaCutter.cs index c59fd8e8e6..9f95dc50bc 100644 --- a/Items/Weapons/InfernaCutter.cs +++ b/Items/Weapons/InfernaCutter.cs @@ -1,134 +1,134 @@ -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 InfernaCutter : 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.Weapons +{ + public class InfernaCutter : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Inferna Cutter"); - Tooltip.SetDefault("Critical hits with the blade cause small explosions\n" + + Tooltip.SetDefault("Critical hits with the blade cause small explosions\n" + "Generates a number of small sparks when swung"); - } - - 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 = 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 + } + + 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 = 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); + } + } +} diff --git a/Items/Weapons/InfernalRift.cs b/Items/Weapons/InfernalRift.cs index 6e9e4655b8..b1edb64591 100644 --- a/Items/Weapons/InfernalRift.cs +++ b/Items/Weapons/InfernalRift.cs @@ -1,16 +1,16 @@ -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 InfernalRift : 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.Weapons +{ + public class InfernalRift : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Infernal Rift"); @@ -18,65 +18,65 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 40; - item.magic = true; - item.mana = 15; - item.width = 16; - item.height = 16; - item.useAnimation = 16; - item.useTime = 4; - item.reuseDelay = item.useAnimation + 6; - item.crit = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("InfernalBlade"); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SkyFracture); - recipe.AddIngredient(null, "EssenceofChaos", 3); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddTile(TileID.MythrilAnvil); - 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) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float f = Main.rand.NextFloat() * 6.28318548f; - float value12 = 20f; - float value13 = 60f; - Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - for (int num202 = 0; num202 < 50; num202++) - { - vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) - { - break; - } - f = Main.rand.NextFloat() * 6.28318548f; - } - Vector2 mouseWorld = Main.MouseWorld; - Vector2 vector14 = mouseWorld - vector13; - Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; - vector14 = vector14.SafeNormalize(vector15) * num72; - vector14 = Vector2.Lerp(vector14, vector15, 0.25f); - Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 40; + item.magic = true; + item.mana = 15; + item.width = 16; + item.height = 16; + item.useAnimation = 16; + item.useTime = 4; + item.reuseDelay = item.useAnimation + 6; + item.crit = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shoot = mod.ProjectileType("InfernalBlade"); + item.shootSpeed = 16f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SkyFracture); + recipe.AddIngredient(null, "EssenceofChaos", 3); + recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddTile(TileID.MythrilAnvil); + 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) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num72 = item.shootSpeed; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + float f = Main.rand.NextFloat() * 6.28318548f; + float value12 = 20f; + float value13 = 60f; + Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + for (int num202 = 0; num202 < 50; num202++) + { + vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) + { + break; + } + f = Main.rand.NextFloat() * 6.28318548f; + } + Vector2 mouseWorld = Main.MouseWorld; + Vector2 vector14 = mouseWorld - vector13; + Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; + vector14 = vector14.SafeNormalize(vector15) * num72; + vector14 = Vector2.Lerp(vector14, vector15, 0.25f); + Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Interfacer.cs b/Items/Weapons/Interfacer.cs index 36a0769249..68cf757000 100644 --- a/Items/Weapons/Interfacer.cs +++ b/Items/Weapons/Interfacer.cs @@ -1,145 +1,145 @@ -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 Interfacer : 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.Weapons +{ + public class Interfacer : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Disseminator"); - Tooltip.SetDefault("50% chance to not consume ammo\n" + + Tooltip.SetDefault("50% chance to not consume ammo\n" + "Fires a spread of bullets from the gun, above, and below"); } - public override void SetDefaults() - { - item.damage = 55; - item.ranged = true; - item.width = 66; - item.height = 24; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item38; - item.autoReuse = true; - item.shootSpeed = 13f; - item.shoot = 10; - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - 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 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; - int bullet = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[bullet].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)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - int num107 = Main.rand.Next(4, 6); - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); - 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(-30, 31) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - int bullet = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[bullet].extraUpdates += 1; - Main.projectile[bullet].tileCollide = false; - - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); //200 - 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 speedX6 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; - float speedY7 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - int bullet2 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, -speedY7, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[bullet2].extraUpdates += 1; - Main.projectile[bullet2].tileCollide = false; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ConferenceCall"); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 55; + item.ranged = true; + item.width = 66; + item.height = 24; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item38; + item.autoReuse = true; + item.shootSpeed = 13f; + item.shoot = 10; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + 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 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; + int bullet = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[bullet].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)); + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + int num107 = Main.rand.Next(4, 6); + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); + 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(-30, 31) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; + int bullet = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[bullet].extraUpdates += 1; + Main.projectile[bullet].tileCollide = false; + + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); //200 + 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 speedX6 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; + float speedY7 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; + int bullet2 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, -speedY7, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[bullet2].extraUpdates += 1; + Main.projectile[bullet2].tileCollide = false; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ConferenceCall"); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/IonBlaster.cs b/Items/Weapons/IonBlaster.cs index 3fbadff507..f893386e38 100644 --- a/Items/Weapons/IonBlaster.cs +++ b/Items/Weapons/IonBlaster.cs @@ -1,70 +1,70 @@ -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 -{ - public class IonBlaster : ModItem - { +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 +{ + public class IonBlaster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ion Blaster"); - Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + + Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + "The higher your mana the more damage they will do"); } - public override void SetDefaults() - { - item.width = 44; - item.damage = 20; - item.magic = true; - item.mana = 8; - item.useAnimation = 10; - item.useTime = 10; - item.useStyle = 5; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item91; - item.autoReuse = true; - item.noMelee = true; - item.height = 28; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("IonBlast"); - item.shootSpeed = 3f; - } - - 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 manaAmount = ((float)player.statMana * 0.01f); - float damageMult = manaAmount * 0.75f; - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].scale = manaAmount; - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddIngredient(ItemID.AdamantiteBar, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddIngredient(ItemID.TitaniumBar, 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 44; + item.damage = 20; + item.magic = true; + item.mana = 8; + item.useAnimation = 10; + item.useTime = 10; + item.useStyle = 5; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item91; + item.autoReuse = true; + item.noMelee = true; + item.height = 28; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("IonBlast"); + item.shootSpeed = 3f; + } + + 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 manaAmount = ((float)player.statMana * 0.01f); + float damageMult = manaAmount * 0.75f; + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].scale = manaAmount; + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddIngredient(ItemID.AdamantiteBar, 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddIngredient(ItemID.TitaniumBar, 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Judgement.cs b/Items/Weapons/Judgement.cs index 2520febd8a..0c67ce3f34 100644 --- a/Items/Weapons/Judgement.cs +++ b/Items/Weapons/Judgement.cs @@ -1,103 +1,103 @@ -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 Judgement : 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.Weapons +{ + public class Judgement : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("The Dance of Light"); Tooltip.SetDefault("Casts a swarm of white flames from the sky"); } - public override void SetDefaults() - { - item.damage = 500; - item.magic = true; - item.mana = 9; - item.width = 28; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WhiteFlame"); - item.shootSpeed = 30f; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarFlareBook); - recipe.AddIngredient(null, "WrathoftheAncients"); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - 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 = 3; - 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)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, 0f, (float)Main.rand.Next(15)); - } - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 500; + item.magic = true; + item.mana = 9; + item.width = 28; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item88; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WhiteFlame"); + item.shootSpeed = 30f; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarFlareBook); + recipe.AddIngredient(null, "WrathoftheAncients"); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + 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 = 3; + 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)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, 0f, (float)Main.rand.Next(15)); + } + return false; + } + } +} diff --git a/Items/Weapons/Lacerator.cs b/Items/Weapons/Lacerator.cs index 43cb95fc19..e7d9874299 100644 --- a/Items/Weapons/Lacerator.cs +++ b/Items/Weapons/Lacerator.cs @@ -1,47 +1,47 @@ -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 Lacerator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lacerator"); - Tooltip.SetDefault("Enemies that are hit by the yoyo will have their life drained\n" + - "Someone thought this was a viable weapon against DoG at one point lol"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 150; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LaceratorProjectile"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Lacerator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lacerator"); + Tooltip.SetDefault("Enemies that are hit by the yoyo will have their life drained\n" + + "Someone thought this was a viable weapon against DoG at one point lol"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.damage = 150; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LaceratorProjectile"); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 4); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Lazhar.cs b/Items/Weapons/Lazhar.cs index 61c5c53950..2f4f793956 100644 --- a/Items/Weapons/Lazhar.cs +++ b/Items/Weapons/Lazhar.cs @@ -1,59 +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 -{ - public class Lazhar : 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.Weapons +{ + public class Lazhar : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Lazhar"); Tooltip.SetDefault("Fires a bouncing laser that explodes on enemy hits"); } - public override void SetDefaults() - { - item.damage = 75; - item.magic = true; - item.mana = 4; - item.width = 42; - item.height = 20; - item.useTime = 7; - item.useAnimation = 7; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item12; - item.autoReuse = true; - item.shootSpeed = 15f; - item.shoot = mod.ProjectileType("SolarBeam2"); - } - - 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; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HeatRay); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddIngredient(ItemID.ChlorophyteBar, 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 75; + item.magic = true; + item.mana = 4; + item.width = 42; + item.height = 20; + item.useTime = 7; + item.useAnimation = 7; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item12; + item.autoReuse = true; + item.shootSpeed = 15f; + item.shoot = mod.ProjectileType("SolarBeam2"); + } + + 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; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HeatRay); + recipe.AddIngredient(ItemID.FragmentSolar, 10); + recipe.AddIngredient(ItemID.ChlorophyteBar, 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Leviathan/Atlantis.cs b/Items/Weapons/Leviathan/Atlantis.cs index 0d82920e20..44e2ec2cb2 100644 --- a/Items/Weapons/Leviathan/Atlantis.cs +++ b/Items/Weapons/Leviathan/Atlantis.cs @@ -1,51 +1,51 @@ -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.Leviathan -{ - public class Atlantis : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Atlantis"); +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.Leviathan +{ + public class Atlantis : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Atlantis"); Tooltip.SetDefault("Casts aquatic spears that split as they travel"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 70; - item.magic = true; - item.mana = 12; - item.width = 28; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item34; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AtlantisSpear"); - item.shootSpeed = 32f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IOU"); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 70; + item.magic = true; + item.mana = 12; + item.width = 28; + item.height = 30; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item34; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AtlantisSpear"); + item.shootSpeed = 32f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IOU"); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Leviathan/Greentide.cs b/Items/Weapons/Leviathan/Greentide.cs index 902687090b..7dbdbced52 100644 --- a/Items/Weapons/Leviathan/Greentide.cs +++ b/Items/Weapons/Leviathan/Greentide.cs @@ -1,119 +1,119 @@ -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.Leviathan -{ - public class Greentide : 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.Weapons.Leviathan +{ + public class Greentide : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Greentide"); Tooltip.SetDefault("Summons green blasts of water from the sky on enemy hits"); } - - public override void SetDefaults() - { - item.damage = 84; - item.melee = true; - item.width = 60; - item.height = 60; - item.useTime = 24; - item.useAnimation = 24; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = 18f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IOU"); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - 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 *= 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, mod.ProjectileType("GreenWater"), (int)((float)item.damage * player.meleeDamage), num74, i, 0f, (float)Main.rand.Next(10)); - } - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - if (Main.rand.Next(4) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, randomDust); - } - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 84; + item.melee = true; + item.width = 60; + item.height = 60; + item.useTime = 24; + item.useAnimation = 24; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.shootSpeed = 18f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IOU"); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + int i = Main.myPlayer; + float num72 = item.shootSpeed; + 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 *= 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, mod.ProjectileType("GreenWater"), (int)((float)item.damage * player.meleeDamage), num74, i, 0f, (float)Main.rand.Next(10)); + } + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + if (Main.rand.Next(4) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, randomDust); + } + } + } +} diff --git a/Items/Weapons/Leviathan/Leviatitan.cs b/Items/Weapons/Leviathan/Leviatitan.cs index 5cd8a7ef2a..52ab86fbc8 100644 --- a/Items/Weapons/Leviathan/Leviatitan.cs +++ b/Items/Weapons/Leviathan/Leviatitan.cs @@ -1,69 +1,69 @@ -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.Leviathan -{ - public class Leviatitan : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leviatitan"); - Tooltip.SetDefault("Fires green and normal water blasts"); - } - - public override void SetDefaults() - { - item.damage = 80; - item.ranged = true; - item.width = 82; - item.height = 28; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AquaBlast"); - item.shootSpeed = 18f; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IOU"); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - 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 SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - if (Main.rand.Next(3) == 0) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AquaBlastToxic"), (int)((double)damage * 1.5), knockBack, player.whoAmI, 0f, 0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AquaBlast"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file +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.Leviathan +{ + public class Leviatitan : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviatitan"); + Tooltip.SetDefault("Fires green and normal water blasts"); + } + + public override void SetDefaults() + { + item.damage = 80; + item.ranged = true; + item.width = 82; + item.height = 28; + item.useTime = 9; + item.useAnimation = 9; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item92; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AquaBlast"); + item.shootSpeed = 18f; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IOU"); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + 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 SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + if (Main.rand.Next(3) == 0) + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AquaBlastToxic"), (int)((double)damage * 1.5), knockBack, player.whoAmI, 0f, 0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AquaBlast"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Leviathan/LureofEnthrallment.cs b/Items/Weapons/Leviathan/LureofEnthrallment.cs index 67c94b61ef..b7f61a6c06 100644 --- a/Items/Weapons/Leviathan/LureofEnthrallment.cs +++ b/Items/Weapons/Leviathan/LureofEnthrallment.cs @@ -1,73 +1,73 @@ -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.Weapons.Leviathan -{ - public class LureofEnthrallment : ModItem - { +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.Weapons.Leviathan +{ + public class LureofEnthrallment : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Pearl of Enthrallment"); - Tooltip.SetDefault("Summons a siren to fight for you\n" + + Tooltip.SetDefault("Summons a siren to fight for you\n" + "The siren stays above you, shooting water spears, ice mist, and treble clefs at nearby enemies"); } - - public override void SetDefaults() - { - item.width = 56; - item.height = 56; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; - item.accessory = true; - } - - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.elementalHeart) - { - return false; - } - return true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.sirenWaifu = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("SirenLure")) == -1) - { - player.AddBuff(mod.BuffType("SirenLure"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SirenLure"), (int)(65f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IOU"); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.width = 56; + item.height = 56; + item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 7; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.elementalHeart) + { + return false; + } + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.sirenWaifu = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("SirenLure")) == -1) + { + player.AddBuff(mod.BuffType("SirenLure"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("SirenLure")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("SirenLure"), (int)(65f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IOU"); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Leviathan/SirensSong.cs b/Items/Weapons/Leviathan/SirensSong.cs index d40fc81790..6ccfad761c 100644 --- a/Items/Weapons/Leviathan/SirensSong.cs +++ b/Items/Weapons/Leviathan/SirensSong.cs @@ -1,63 +1,63 @@ -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.Leviathan -{ - public class SirensSong : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren's Song"); - Tooltip.SetDefault("Casts slow-moving treble clefs that confuse enemies"); - } - - public override void SetDefaults() - { - item.damage = 77; - item.magic = true; - item.mana = 7; - item.width = 56; - item.height = 50; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SirensSong"); - item.shootSpeed = 13f; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "IOU"); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - 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 SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, soundPitch, 0f); - return false; - } - } -} \ No newline at end of file +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.Leviathan +{ + public class SirensSong : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Siren's Song"); + Tooltip.SetDefault("Casts slow-moving treble clefs that confuse enemies"); + } + + public override void SetDefaults() + { + item.damage = 77; + item.magic = true; + item.mana = 7; + item.width = 56; + item.height = 50; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SirensSong"); + item.shootSpeed = 13f; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "IOU"); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + 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 SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, soundPitch, 0f); + return false; + } + } +} diff --git a/Items/Weapons/LifefruitScythe.cs b/Items/Weapons/LifefruitScythe.cs index 5a67408a8a..fbb5303610 100644 --- a/Items/Weapons/LifefruitScythe.cs +++ b/Items/Weapons/LifefruitScythe.cs @@ -1,67 +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 -{ - public class LifefruitScythe : 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.Weapons +{ + public class LifefruitScythe : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Lifehunt Scythe"); Tooltip.SetDefault("Heals the player on enemy hits and shoots an energy scythe"); } - public override void SetDefaults() - { - item.width = 60; - item.damage = 250; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.height = 72; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("LifeScythe"); - item.shootSpeed = 9f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 15); - recipe.AddTile(TileID.LunarCraftingStation); - 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, 75); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - player.statLife += 2; - player.HealEffect(2); - } - } -} + public override void SetDefaults() + { + item.width = 60; + item.damage = 250; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item71; + item.autoReuse = true; + item.height = 72; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("LifeScythe"); + item.shootSpeed = 9f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 15); + recipe.AddTile(TileID.LunarCraftingStation); + 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, 75); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + player.statLife += 2; + player.HealEffect(2); + } + } +} diff --git a/Items/Weapons/Lucrecia.cs b/Items/Weapons/Lucrecia.cs index 3e4b041a96..1983be8b48 100644 --- a/Items/Weapons/Lucrecia.cs +++ b/Items/Weapons/Lucrecia.cs @@ -1,91 +1,91 @@ -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 -{ - public class Lucrecia : ModItem - { +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 +{ + public class Lucrecia : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Lucrecia"); - Tooltip.SetDefault("Finesse\n" + - "Striking an enemy makes you immune for a short time\n" + - "Using this weapon drains your life\n" + + Tooltip.SetDefault("Finesse\n" + + "Striking an enemy makes you immune for a short time\n" + + "Using this weapon drains your life\n" + "Fires a DNA chain"); } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 25; - item.useTime = 25; - item.width = 58; - item.height = 58; - item.damage = 75; - item.melee = true; - item.knockBack = 8.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DNA"); - item.shootSpeed = 32f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - } - - 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 -= 3; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(-3, true); - } - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(ItemID.SoulofLight, 5); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 234); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (!player.immune) - { - player.immune = true; - player.immuneTime = 10; - } - } - } -} + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 25; + item.useTime = 25; + item.width = 58; + item.height = 58; + item.damage = 75; + item.melee = true; + item.knockBack = 8.25f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DNA"); + item.shootSpeed = 32f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + } + + 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 -= 3; + if (player.lifeRegen > 0) + { + player.lifeRegen = 0; + } + player.lifeRegenTime = 0; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(-3, true); + } + if (player.statLife <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(ItemID.SoulofLight, 5); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 234); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (!player.immune) + { + player.immune = true; + player.immuneTime = 10; + } + } + } +} diff --git a/Items/Weapons/LunarianBow.cs b/Items/Weapons/LunarianBow.cs index b9e8eacfa7..0730929edf 100644 --- a/Items/Weapons/LunarianBow.cs +++ b/Items/Weapons/LunarianBow.cs @@ -1,83 +1,83 @@ -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 LunarianBow : 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.Weapons +{ + public class LunarianBow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Lunarian Bow"); Tooltip.SetDefault("Fires two bouncing energy bolts"); - } - - public override void SetDefaults() - { - item.damage = 21; - item.ranged = true; - item.width = 22; - item.height = 58; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LunarBolt"); - item.shootSpeed = 8f; - 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(); - vector7 *= 15f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("LunarBolt"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num121].noDropItem = true; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DemonBow); - recipe.AddIngredient(ItemID.MoltenFury); - recipe.AddIngredient(ItemID.BeesKnees); - recipe.AddIngredient(null, "PurifiedGel", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TendonBow); - recipe.AddIngredient(ItemID.MoltenFury); - recipe.AddIngredient(ItemID.BeesKnees); - recipe.AddIngredient(null, "PurifiedGel", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 21; + item.ranged = true; + item.width = 22; + item.height = 58; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item75; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LunarBolt"); + item.shootSpeed = 8f; + 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(); + vector7 *= 15f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, mod.ProjectileType("LunarBolt"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[num121].noDropItem = true; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DemonBow); + recipe.AddIngredient(ItemID.MoltenFury); + recipe.AddIngredient(ItemID.BeesKnees); + recipe.AddIngredient(null, "PurifiedGel", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TendonBow); + recipe.AddIngredient(ItemID.MoltenFury); + recipe.AddIngredient(ItemID.BeesKnees); + recipe.AddIngredient(null, "PurifiedGel", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/LunicEye.cs b/Items/Weapons/LunicEye.cs index d12081b2d6..12b85b2e1c 100644 --- a/Items/Weapons/LunicEye.cs +++ b/Items/Weapons/LunicEye.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Weapons -{ - public class LunicEye : 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.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Weapons +{ + public class LunicEye : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Lunic Eye"); - Tooltip.SetDefault("Fires lunic beams that reduce enemy protection\n" + + Tooltip.SetDefault("Fires lunic beams that reduce enemy protection\n" + "Projectile damage is multiplied by all of your damage bonuses"); } - public override void SetDefaults() - { - item.width = 80; - item.damage = 7; - item.rare = 5; - item.useAnimation = 15; - item.useTime = 15; - item.useStyle = 5; - item.knockBack = 4.5f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.autoReuse = true; - item.noMelee = true; - item.height = 50; - item.value = Item.buyPrice(0, 36, 0, 0); - item.shoot = mod.ProjectileType("LunicBeam"); - item.shootSpeed = 13f; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 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 damageMult = player.meleeDamage + player.rangedDamage + player.magicDamage + - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage + player.minionDamage; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Stardust", 20); - recipe.AddIngredient(null, "AerialiteBar", 15); - recipe.AddIngredient(ItemID.SunplateBlock, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 80; + item.damage = 7; + item.rare = 5; + item.useAnimation = 15; + item.useTime = 15; + item.useStyle = 5; + item.knockBack = 4.5f; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.autoReuse = true; + item.noMelee = true; + item.height = 50; + item.value = Item.buyPrice(0, 36, 0, 0); + item.shoot = mod.ProjectileType("LunicBeam"); + item.shootSpeed = 13f; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 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 damageMult = player.meleeDamage + player.rangedDamage + player.magicDamage + + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage + player.minionDamage; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Stardust", 20); + recipe.AddIngredient(null, "AerialiteBar", 15); + recipe.AddIngredient(ItemID.SunplateBlock, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MagnaCannon.cs b/Items/Weapons/MagnaCannon.cs index babace29c3..8e25a5fb32 100644 --- a/Items/Weapons/MagnaCannon.cs +++ b/Items/Weapons/MagnaCannon.cs @@ -1,66 +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 -{ - public class MagnaCannon : 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.Weapons +{ + public class MagnaCannon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Magna Cannon"); Tooltip.SetDefault("Fires a concentrated blast of energy"); } - public override void SetDefaults() - { - item.damage = 19; - item.magic = true; - item.mana = 12; - item.width = 56; - item.height = 34; - item.useTime = 32; - item.useAnimation = 32; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.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("MagnaBlast"); - } - - 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 < 3; ++index) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Granite, 25); - recipe.AddIngredient(ItemID.Obsidian, 15); - recipe.AddIngredient(ItemID.Amber, 5); - recipe.AddIngredient(ItemID.SpaceGun); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 19; + item.magic = true; + item.mana = 12; + item.width = 56; + item.height = 34; + item.useTime = 32; + item.useAnimation = 32; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.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("MagnaBlast"); + } + + 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 < 3; ++index) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Granite, 25); + recipe.AddIngredient(ItemID.Obsidian, 15); + recipe.AddIngredient(ItemID.Amber, 5); + recipe.AddIngredient(ItemID.SpaceGun); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MagnaStriker.cs b/Items/Weapons/MagnaStriker.cs index 3d8052a4f7..1b98dc790a 100644 --- a/Items/Weapons/MagnaStriker.cs +++ b/Items/Weapons/MagnaStriker.cs @@ -1,80 +1,80 @@ -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 MagnaStriker : 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.Weapons +{ + public class MagnaStriker : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Magna Striker"); Tooltip.SetDefault("Fires a string of opal and magna strikes"); } - public override void SetDefaults() - { - item.damage = 42; - item.ranged = true; - item.width = 60; - item.height = 22; - item.useTime = 5; - item.reuseDelay = 6; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); - item.autoReuse = true; - item.shoot = mod.ProjectileType("OpalStrike"); - item.shootSpeed = 15f; - item.useAmmo = 97; - } - - 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) - { - int randomProj = Main.rand.Next(2); - if (randomProj == 0) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OpalStrike"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MagnaStrike"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "OpalStriker"); - recipe.AddIngredient(null, "MagnaCannon"); - recipe.AddIngredient(ItemID.AdamantiteBar, 6); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "OpalStriker"); - recipe.AddIngredient(null, "MagnaCannon"); - recipe.AddIngredient(ItemID.TitaniumBar, 6); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 42; + item.ranged = true; + item.width = 60; + item.height = 22; + item.useTime = 5; + item.reuseDelay = 6; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); + item.autoReuse = true; + item.shoot = mod.ProjectileType("OpalStrike"); + item.shootSpeed = 15f; + item.useAmmo = 97; + } + + 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) + { + int randomProj = Main.rand.Next(2); + if (randomProj == 0) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OpalStrike"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MagnaStrike"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "OpalStriker"); + recipe.AddIngredient(null, "MagnaCannon"); + recipe.AddIngredient(ItemID.AdamantiteBar, 6); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "OpalStriker"); + recipe.AddIngredient(null, "MagnaCannon"); + recipe.AddIngredient(ItemID.TitaniumBar, 6); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MagneticMeltdown.cs b/Items/Weapons/MagneticMeltdown.cs index 97cdef9d20..7aafeb9d10 100644 --- a/Items/Weapons/MagneticMeltdown.cs +++ b/Items/Weapons/MagneticMeltdown.cs @@ -1,16 +1,16 @@ -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 MagneticMeltdown : 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.Weapons +{ + public class MagneticMeltdown : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Magnetic Meltdown"); @@ -18,47 +18,47 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 135; - item.magic = true; - item.mana = 25; - item.width = 78; - item.height = 78; - item.useTime = 27; - item.useAnimation = 27; - 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("MagneticOrb"); - 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) - { - for (int index = 0; index < 4; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 1.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(ItemID.SpectreStaff); - recipe.AddIngredient(ItemID.MagnetSphere); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 135; + item.magic = true; + item.mana = 25; + item.width = 78; + item.height = 78; + item.useTime = 27; + item.useAnimation = 27; + 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("MagneticOrb"); + 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) + { + for (int index = 0; index < 4; ++index) + { + float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 1.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(ItemID.SpectreStaff); + recipe.AddIngredient(ItemID.MagnetSphere); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MajesticGuard.cs b/Items/Weapons/MajesticGuard.cs index cb1989651e..8d3cf838cf 100644 --- a/Items/Weapons/MajesticGuard.cs +++ b/Items/Weapons/MajesticGuard.cs @@ -1,67 +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 -{ - public class MajesticGuard : 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.Weapons +{ + public class MajesticGuard : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Majestic Guard"); - Tooltip.SetDefault("Has a chance to lower enemy defense by 10 when striking them\n" + + Tooltip.SetDefault("Has a chance to lower enemy defense by 10 when striking them\n" + "If enemy defense is 0 or below your attacks will heal you"); } - public override void SetDefaults() - { - item.width = 98; - item.damage = 60; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 98; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(5) == 0) - { - target.defense -= 10; - } - if (target.defense <= 0 && target.canGhostHeal) - { - player.statLife += 3; - player.HealEffect(3); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AdamantiteSword); - recipe.AddIngredient(ItemID.SoulofMight, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumSword); - recipe.AddIngredient(ItemID.SoulofMight, 15); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 98; + item.damage = 60; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 98; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(5) == 0) + { + target.defense -= 10; + } + if (target.defense <= 0 && target.canGhostHeal) + { + player.statLife += 3; + player.HealEffect(3); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AdamantiteSword); + recipe.AddIngredient(ItemID.SoulofMight, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitaniumSword); + recipe.AddIngredient(ItemID.SoulofMight, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ManaRose.cs b/Items/Weapons/ManaRose.cs index 195960d24a..3a660dbf9b 100644 --- a/Items/Weapons/ManaRose.cs +++ b/Items/Weapons/ManaRose.cs @@ -1,16 +1,16 @@ -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 ManaRose : 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.Weapons +{ + public class ManaRose : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mana Rose"); @@ -18,35 +18,35 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 9; - item.magic = true; - item.mana = 8; - item.width = 38; - item.height = 38; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ManaBolt"); - item.shootSpeed = 10f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.NaturesGift); - recipe.AddIngredient(ItemID.JungleRose); - recipe.AddIngredient(ItemID.Moonglow, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 9; + item.magic = true; + item.mana = 8; + item.width = 38; + item.height = 38; + item.useTime = 27; + item.useAnimation = 27; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ManaBolt"); + item.shootSpeed = 10f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.NaturesGift); + recipe.AddIngredient(ItemID.JungleRose); + recipe.AddIngredient(ItemID.Moonglow, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MandibleBow.cs b/Items/Weapons/MandibleBow.cs index c825bc5a26..3632848f67 100644 --- a/Items/Weapons/MandibleBow.cs +++ b/Items/Weapons/MandibleBow.cs @@ -1,45 +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; -//using TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons -{ - public class MandibleBow : 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; +//using TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class MandibleBow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mandible Bow"); } - public override void SetDefaults() - { - item.damage = 13; - item.ranged = true; - item.width = 22; - item.height = 40; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item5; - item.autoReuse = false; - item.shoot = 10; - item.shootSpeed = 30f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 13; + item.ranged = true; + item.width = 22; + item.height = 40; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item5; + item.autoReuse = false; + item.shoot = 10; + item.shootSpeed = 30f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + } +} diff --git a/Items/Weapons/MandibleClaws.cs b/Items/Weapons/MandibleClaws.cs index 0fe8ed6f51..f7b7e7a859 100644 --- a/Items/Weapons/MandibleClaws.cs +++ b/Items/Weapons/MandibleClaws.cs @@ -1,36 +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.Weapons -{ - public class MandibleClaws : 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.Weapons +{ + public class MandibleClaws : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mandible Claws"); } - public override void SetDefaults() - { - item.width = 22; - item.damage = 14; - item.melee = true; - item.useAnimation = 6; - item.useStyle = 1; - item.useTime = 6; - item.useTurn = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 18; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - } - } -} + public override void SetDefaults() + { + item.width = 22; + item.damage = 14; + item.melee = true; + item.useAnimation = 6; + item.useStyle = 1; + item.useTime = 6; + item.useTurn = true; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 18; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + } + } +} diff --git a/Items/Weapons/MangroveChakramMelee.cs b/Items/Weapons/MangroveChakramMelee.cs index c8dd734679..4ecb63280c 100644 --- a/Items/Weapons/MangroveChakramMelee.cs +++ b/Items/Weapons/MangroveChakramMelee.cs @@ -1,47 +1,47 @@ -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 MangroveChakramMelee : 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.Weapons +{ + public class MangroveChakramMelee : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mangrove Chakram"); } - - public override void SetDefaults() - { - item.width = 38; - item.damage = 84; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 38; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("MangroveChakramProjectileMelee"); - item.shootSpeed = 15.5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + + public override void SetDefaults() + { + item.width = 38; + item.damage = 84; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 38; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("MangroveChakramProjectileMelee"); + item.shootSpeed = 15.5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MantisClaws.cs b/Items/Weapons/MantisClaws.cs index 1c0436bc88..eaddc1de02 100644 --- a/Items/Weapons/MantisClaws.cs +++ b/Items/Weapons/MantisClaws.cs @@ -1,50 +1,50 @@ -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 MantisClaws : 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.Weapons +{ + public class MantisClaws : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mantis Claws"); Tooltip.SetDefault("Explodes on enemy hits"); } - - public override void SetDefaults() - { - item.width = 26; - item.damage = 120; - item.melee = true; - item.useAnimation = 6; - item.useStyle = 1; - item.useTime = 6; - item.useTurn = true; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - } - - 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, 33); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, 0, knockback, Main.myPlayer); - } - } -} + + public override void SetDefaults() + { + item.width = 26; + item.damage = 120; + item.melee = true; + item.useAnimation = 6; + item.useStyle = 1; + item.useTime = 6; + item.useTurn = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 20; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + } + + 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, 33); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, 0, knockback, Main.myPlayer); + } + } +} diff --git a/Items/Weapons/Mariana.cs b/Items/Weapons/Mariana.cs index 13fdbc5ccc..939183b45c 100644 --- a/Items/Weapons/Mariana.cs +++ b/Items/Weapons/Mariana.cs @@ -1,98 +1,98 @@ -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 Mariana : 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.Weapons +{ + public class Mariana : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mariana"); - Tooltip.SetDefault("Tropical and deadly\n" + + Tooltip.SetDefault("Tropical and deadly\n" + "Enemies explode into water orbs on death"); } - public override void SetDefaults() - { - item.damage = 90; - item.width = 54; - item.height = 62; - item.melee = true; - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - } - - 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(); - } - - 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); - } - } - } -} + public override void SetDefaults() + { + item.damage = 90; + item.width = 54; + item.height = 62; + item.melee = true; + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.useTurn = true; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + } + + 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(); + } + + 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); + } + } + } +} diff --git a/Items/Weapons/MarkedMagnum.cs b/Items/Weapons/MarkedMagnum.cs index fa8624b9e8..9982b4845e 100644 --- a/Items/Weapons/MarkedMagnum.cs +++ b/Items/Weapons/MarkedMagnum.cs @@ -1,64 +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; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Weapons -{ - public class MarkedMagnum : 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; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Weapons +{ + public class MarkedMagnum : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Marked Magnum"); - Tooltip.SetDefault("Shots reduce enemy protection\n" + + Tooltip.SetDefault("Shots reduce enemy protection\n" + "Projectile damage is multiplied by all of your damage bonuses"); } - public override void SetDefaults() - { - item.damage = 3; - item.width = 54; - item.height = 20; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item33; - item.autoReuse = false; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("MarkRound"); - } - - 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 damageMult = player.meleeDamage + player.rangedDamage + player.magicDamage + - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage + player.minionDamage; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HellstoneBar, 7); - recipe.AddIngredient(ItemID.Obsidian, 15); - recipe.AddIngredient(ItemID.GlowingMushroom, 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 3; + item.width = 54; + item.height = 20; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item33; + item.autoReuse = false; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("MarkRound"); + } + + 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 damageMult = player.meleeDamage + player.rangedDamage + player.magicDamage + + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage + player.minionDamage; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HellstoneBar, 7); + recipe.AddIngredient(ItemID.Obsidian, 15); + recipe.AddIngredient(ItemID.GlowingMushroom, 15); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MarniteRifleSpear.cs b/Items/Weapons/MarniteRifleSpear.cs index e9d2617fb4..eeb8add238 100644 --- a/Items/Weapons/MarniteRifleSpear.cs +++ b/Items/Weapons/MarniteRifleSpear.cs @@ -1,57 +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 -{ - public class MarniteRifleSpear : 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.Weapons +{ + public class MarniteRifleSpear : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Marnite Rifle Spear"); Tooltip.SetDefault("The gun damages enemies that touch it"); } - public override void SetDefaults() - { - item.damage = 15; - item.ranged = true; - item.width = 72; - item.height = 20; - item.useTime = 28; - item.useAnimation = 28; - item.useStyle = 5; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 22f; - item.useAmmo = 97; - item.shoot = 10; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumBar, 7); - recipe.AddIngredient(ItemID.Granite, 5); - recipe.AddIngredient(ItemID.Marble, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldBar, 7); - recipe.AddIngredient(ItemID.Granite, 5); - recipe.AddIngredient(ItemID.Marble, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 15; + item.ranged = true; + item.width = 72; + item.height = 20; + item.useTime = 28; + item.useAnimation = 28; + item.useStyle = 5; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shootSpeed = 22f; + item.useAmmo = 97; + item.shoot = 10; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PlatinumBar, 7); + recipe.AddIngredient(ItemID.Granite, 5); + recipe.AddIngredient(ItemID.Marble, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldBar, 7); + recipe.AddIngredient(ItemID.Granite, 5); + recipe.AddIngredient(ItemID.Marble, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MarniteSpear.cs b/Items/Weapons/MarniteSpear.cs index a18c46bbdd..202c50b5e0 100644 --- a/Items/Weapons/MarniteSpear.cs +++ b/Items/Weapons/MarniteSpear.cs @@ -1,58 +1,58 @@ -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 MarniteSpear : 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.Weapons +{ + public class MarniteSpear : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Marnite Spear"); } - public override void SetDefaults() - { - item.width = 50; - item.damage = 15; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 21; - item.useStyle = 5; - item.useTime = 21; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 50; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("MarniteSpearProjectile"); - item.shootSpeed = 5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PlatinumBar, 5); - recipe.AddIngredient(ItemID.Granite, 9); - recipe.AddIngredient(ItemID.Marble, 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.GoldBar, 5); - recipe.AddIngredient(ItemID.Granite, 9); - recipe.AddIngredient(ItemID.Marble, 9); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 50; + item.damage = 15; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 21; + item.useStyle = 5; + item.useTime = 21; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 50; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("MarniteSpearProjectile"); + item.shootSpeed = 5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PlatinumBar, 5); + recipe.AddIngredient(ItemID.Granite, 9); + recipe.AddIngredient(ItemID.Marble, 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldBar, 5); + recipe.AddIngredient(ItemID.Granite, 9); + recipe.AddIngredient(ItemID.Marble, 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Megafleet.cs b/Items/Weapons/Megafleet.cs index ec01132f7e..e53bc02905 100644 --- a/Items/Weapons/Megafleet.cs +++ b/Items/Weapons/Megafleet.cs @@ -1,73 +1,73 @@ -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 Megafleet : 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.Weapons +{ + public class Megafleet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Voidragon"); Tooltip.SetDefault("Fires void blasts that explode"); } - public override void SetDefaults() - { - item.damage = 1000; - item.ranged = true; - item.width = 96; - item.height = 38; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 18f; - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 95) - return false; - 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) - { - float SpeedX = speedX + (float) Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-5, 6) * 0.05f; - type = (Main.rand.Next(2) == 0 ? mod.ProjectileType("Voidragon") : type); - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Seadragon"); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(ItemID.SoulofMight, 30); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 1000; + item.ranged = true; + item.width = 96; + item.height = 38; + item.useTime = 5; + item.useAnimation = 5; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 18f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 95) + return false; + 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) + { + float SpeedX = speedX + (float) Main.rand.Next(-5, 6) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-5, 6) * 0.05f; + type = (Main.rand.Next(2) == 0 ? mod.ProjectileType("Voidragon") : type); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Seadragon"); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(ItemID.SoulofMight, 30); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Megalodon.cs b/Items/Weapons/Megalodon.cs index 7895e38b23..96f7733242 100644 --- a/Items/Weapons/Megalodon.cs +++ b/Items/Weapons/Megalodon.cs @@ -1,72 +1,72 @@ -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 Megalodon : 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.Weapons +{ + public class Megalodon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Megalodon"); Tooltip.SetDefault("50% chance to not consume ammo"); } - public override void SetDefaults() - { - item.damage = 32; - item.ranged = true; - item.width = 72; - item.height = 32; - item.useTime = 6; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 97; - } - - 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(-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); - return false; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Megashark); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 32; + item.ranged = true; + item.width = 72; + item.height = 32; + item.useTime = 6; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 97; + } + + 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(-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); + return false; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Megashark); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Meowthrower.cs b/Items/Weapons/Meowthrower.cs index 14b0110c78..22ed82bb6c 100644 --- a/Items/Weapons/Meowthrower.cs +++ b/Items/Weapons/Meowthrower.cs @@ -1,70 +1,70 @@ -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 Meowthrower : 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.Weapons +{ + public class Meowthrower : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Meowthrower"); - Tooltip.SetDefault("Consumes gel at a 50% chance\n" + + Tooltip.SetDefault("Consumes gel at a 50% chance\n" + "Fires blue and pink flames that emit meows on enemy hits"); } - public override void SetDefaults() - { - item.damage = 28; - item.ranged = true; - item.width = 74; - item.height = 24; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.25f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.autoReuse = true; - item.shoot = mod.ProjectileType("MeowFire"); - item.shootSpeed = 5.5f; - item.useAmmo = 23; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - 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) - { - float SpeedA = speedX; - float SpeedB = speedY; - int num6 = Main.rand.Next(1, 3); - for (int index = 0; index < num6; ++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; - switch (Main.rand.Next(3)) - { - case 1: type = mod.ProjectileType("MeowFire"); break; - case 2: type = mod.ProjectileType("MeowFire2"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 28; + item.ranged = true; + item.width = 74; + item.height = 24; + item.useTime = 10; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.25f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.autoReuse = true; + item.shoot = mod.ProjectileType("MeowFire"); + item.shootSpeed = 5.5f; + item.useAmmo = 23; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + 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) + { + float SpeedA = speedX; + float SpeedB = speedY; + int num6 = Main.rand.Next(1, 3); + for (int index = 0; index < num6; ++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; + switch (Main.rand.Next(3)) + { + case 1: type = mod.ProjectileType("MeowFire"); break; + case 2: type = mod.ProjectileType("MeowFire2"); break; + default: break; + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } +} diff --git a/Items/Weapons/MineralMortar.cs b/Items/Weapons/MineralMortar.cs index 9557731c82..70057bf5f8 100644 --- a/Items/Weapons/MineralMortar.cs +++ b/Items/Weapons/MineralMortar.cs @@ -1,62 +1,62 @@ -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 MineralMortar : 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.Weapons +{ + public class MineralMortar : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mineral Mortar"); Tooltip.SetDefault("Shoots an onyx bomb that explodes into sand sharks on death"); } - public override void SetDefaults() - { - item.damage = 30; - item.ranged = true; - item.width = 58; - item.height = 26; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 14f; - item.shoot = mod.ProjectileType("OnyxSharkBomb"); - item.useAmmo = 771; - } - - 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("OnyxSharkBomb"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.AdamantiteBar, 13); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.TitaniumBar, 13); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 58; + item.height = 26; + item.useTime = 33; + item.useAnimation = 33; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 14f; + item.shoot = mod.ProjectileType("OnyxSharkBomb"); + item.useAmmo = 771; + } + + 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("OnyxSharkBomb"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.AdamantiteBar, 13); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.TitaniumBar, 13); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Minigun.cs b/Items/Weapons/Minigun.cs index 0734cc8359..21ef69e3c7 100644 --- a/Items/Weapons/Minigun.cs +++ b/Items/Weapons/Minigun.cs @@ -1,72 +1,72 @@ -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 Minigun : 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.Weapons +{ + public class Minigun : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Minigun"); Tooltip.SetDefault("80% chance to not consume ammo"); } - public override void SetDefaults() - { - item.damage = 390; - item.ranged = true; - item.width = 72; - item.height = 34; - item.useTime = 3; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 22f; - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - 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) - { - 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; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 80) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ChainGun); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 390; + item.ranged = true; + item.width = 72; + item.height = 34; + item.useTime = 3; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 22f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + 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) + { + 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; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 80) + return false; + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ChainGun); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MirrorBlade.cs b/Items/Weapons/MirrorBlade.cs index 52064a0c65..3537c7d615 100644 --- a/Items/Weapons/MirrorBlade.cs +++ b/Items/Weapons/MirrorBlade.cs @@ -1,62 +1,62 @@ -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 -{ - public class MirrorBlade : ModItem - { +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 +{ + public class MirrorBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mirror Blade"); - Tooltip.SetDefault("The amount of contact damage an enemy does is added to this weapons' damage\n" + - "You must hit an enemy with the blade to trigger this effect\n" + + Tooltip.SetDefault("The amount of contact damage an enemy does is added to this weapons' damage\n" + + "You must hit an enemy with the blade to trigger this effect\n" + "Consumes mana to fire mirror blasts"); } - public override void SetDefaults() - { - item.width = 52; - item.damage = 236; - item.melee = true; - item.mana = 4; - item.useAnimation = 9; - item.useTime = 9; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shootSpeed = 16f; - item.shoot = mod.ProjectileType("MirrorBlast"); - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - int conDamage = target.damage + 236; - if (conDamage < 236) - { - conDamage = 236; - } - if (conDamage > 600) - { - conDamage = 600; - } - item.damage = conDamage; - } - } -} + public override void SetDefaults() + { + item.width = 52; + item.damage = 236; + item.melee = true; + item.mana = 4; + item.useAnimation = 9; + item.useTime = 9; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shootSpeed = 16f; + item.shoot = mod.ProjectileType("MirrorBlast"); + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + int conDamage = target.damage + 236; + if (conDamage < 236) + { + conDamage = 236; + } + if (conDamage > 600) + { + conDamage = 600; + } + item.damage = conDamage; + } + } +} diff --git a/Items/Weapons/Mistlestorm.cs b/Items/Weapons/Mistlestorm.cs index 39d05f9cc5..d3083880bc 100644 --- a/Items/Weapons/Mistlestorm.cs +++ b/Items/Weapons/Mistlestorm.cs @@ -1,16 +1,16 @@ -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 Mistlestorm : 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.Weapons +{ + public class Mistlestorm : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mistlestorm"); @@ -18,55 +18,55 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 60; - item.magic = true; - item.mana = 5; - item.width = 48; - item.height = 48; - item.useTime = 6; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.shoot = 336; - item.shootSpeed = 24f; - 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) - { - int num106 = 2 + Main.rand.Next(3); - for (int num107 = 0; num107 < num106; num107++) - { - float num110 = 0.025f * (float)num107; - speedX += (float)Main.rand.Next(-35, 36) * num110; - speedY += (float)Main.rand.Next(-35, 36) * num110; - float num84 = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - num84 = item.shootSpeed / num84; - speedX *= num84; - speedY *= num84; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, (float)Main.rand.Next(0, 10 * (num107 + 1)), 0f); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 206, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Razorpine); - recipe.AddIngredient(ItemID.LeafBlower); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(null, "DarkPlasma"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 60; + item.magic = true; + item.mana = 5; + item.width = 48; + item.height = 48; + item.useTime = 6; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item39; + item.autoReuse = true; + item.shoot = 336; + item.shootSpeed = 24f; + 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) + { + int num106 = 2 + Main.rand.Next(3); + for (int num107 = 0; num107 < num106; num107++) + { + float num110 = 0.025f * (float)num107; + speedX += (float)Main.rand.Next(-35, 36) * num110; + speedY += (float)Main.rand.Next(-35, 36) * num110; + float num84 = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + num84 = item.shootSpeed / num84; + speedX *= num84; + speedY *= num84; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, (float)Main.rand.Next(0, 10 * (num107 + 1)), 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 206, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Razorpine); + recipe.AddIngredient(ItemID.LeafBlower); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(null, "DarkPlasma"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MolecularManipulator.cs b/Items/Weapons/MolecularManipulator.cs index 4d92403ad8..631de5dcb1 100644 --- a/Items/Weapons/MolecularManipulator.cs +++ b/Items/Weapons/MolecularManipulator.cs @@ -1,69 +1,69 @@ -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 MolecularManipulator : 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.Weapons +{ + public class MolecularManipulator : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Molecular Manipulator"); - Tooltip.SetDefault("Is it nullable or not? Let's find out!\n" + - "Fires a fast null bullet that distorts NPC stats\n" + + Tooltip.SetDefault("Is it nullable or not? Let's find out!\n" + + "Fires a fast null bullet that distorts NPC stats\n" + "Uses your life as ammo"); } - public override void SetDefaults() - { - item.damage = 700; - item.ranged = true; - item.width = 60; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 25f; - item.shoot = mod.ProjectileType("NullShot2"); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - 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) - { - player.statLife -= 5; - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NullShot2"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "NullificationRifle"); - recipe.AddIngredient(null, "DarkPlasma", 2); - recipe.AddIngredient(null, "CoreofCalamity", 3); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 700; + item.ranged = true; + item.width = 60; + item.height = 30; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shootSpeed = 25f; + item.shoot = mod.ProjectileType("NullShot2"); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + 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) + { + player.statLife -= 5; + if (player.statLife <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NullShot2"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "NullificationRifle"); + recipe.AddIngredient(null, "DarkPlasma", 2); + recipe.AddIngredient(null, "CoreofCalamity", 3); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Monsoon.cs b/Items/Weapons/Monsoon.cs index fa474ce82d..6544d14352 100644 --- a/Items/Weapons/Monsoon.cs +++ b/Items/Weapons/Monsoon.cs @@ -1,96 +1,96 @@ -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 -{ - public class Monsoon : 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; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class Monsoon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Monsoon"); - Tooltip.SetDefault("Fires a spread of 5 arrows\n" + + Tooltip.SetDefault("Fires a spread of 5 arrows\n" + "Wooden arrows have a chance to be converted to typhoon arrows or sharks"); - } - - public override void SetDefaults() - { - item.damage = 63; - item.ranged = true; - item.width = 46; - item.height = 78; - 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(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - 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, 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(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 63; + item.ranged = true; + item.width = 46; + item.height = 78; + 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(); + vector7 *= 40f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + 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, 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(); + } + } +} diff --git a/Items/Weapons/MortarRound.cs b/Items/Weapons/MortarRound.cs index 970464cc98..11225e27ae 100644 --- a/Items/Weapons/MortarRound.cs +++ b/Items/Weapons/MortarRound.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class MortarRound : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class MortarRound : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mortar Round"); - Tooltip.SetDefault("Large blast radius. Will destroy tiles\n" + + Tooltip.SetDefault("Large blast radius. Will destroy tiles\n" + "Used by normal guns"); } - public override void SetDefaults() - { - item.damage = 20; - item.ranged = true; - item.width = 20; - item.height = 14; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 7.5f; - item.value = 500; - item.rare = 3; - item.ammo = 97; - item.shoot = mod.ProjectileType("MortarRound"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RocketIV, 100); - recipe.AddIngredient(null, "UeliaceBar"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 20; + item.ranged = true; + item.width = 20; + item.height = 14; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 7.5f; + item.value = 500; + item.rare = 3; + item.ammo = 97; + item.shoot = mod.ProjectileType("MortarRound"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RocketIV, 100); + recipe.AddIngredient(null, "UeliaceBar"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Mourningstar.cs b/Items/Weapons/Mourningstar.cs index fdbfd2e151..c179aa96ff 100644 --- a/Items/Weapons/Mourningstar.cs +++ b/Items/Weapons/Mourningstar.cs @@ -1,61 +1,61 @@ -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 -{ - public class Mourningstar : ModItem - { +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 +{ + public class Mourningstar : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Mourningstar"); Tooltip.SetDefault("Launches a solar whip sword and a solar particle trail that explodes on enemy hits"); } - public override void SetDefaults() - { - item.width = 16; - item.height = 16; - item.damage = 650; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.autoReuse = true; - item.melee = true; - item.useAnimation = 13; - item.useTime = 13; - item.useStyle = 5; - item.knockBack = 2.5f; - item.UseSound = SoundID.Item116; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shootSpeed = 24f; - item.shoot = 611; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(ItemID.SolarEruption); - 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 ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 - float ai3X = (Main.rand.NextFloat() - 0.25f) * 0.7853982f; //0.5 - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Mourningstar"), damage, knockBack, player.whoAmI, 0.0f, ai3); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Mourningstar"), damage, knockBack, player.whoAmI, 0.0f, ai3X); - return false; - } - } -} + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.damage = 650; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.autoReuse = true; + item.melee = true; + item.useAnimation = 13; + item.useTime = 13; + item.useStyle = 5; + item.knockBack = 2.5f; + item.UseSound = SoundID.Item116; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shootSpeed = 24f; + item.shoot = 611; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(ItemID.SolarEruption); + 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 ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 + float ai3X = (Main.rand.NextFloat() - 0.25f) * 0.7853982f; //0.5 + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Mourningstar"), damage, knockBack, player.whoAmI, 0.0f, ai3); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Mourningstar"), damage, knockBack, player.whoAmI, 0.0f, ai3X); + return false; + } + } +} diff --git a/Items/Weapons/Murasama.cs b/Items/Weapons/Murasama.cs index fc5d2bf848..302998bddc 100644 --- a/Items/Weapons/Murasama.cs +++ b/Items/Weapons/Murasama.cs @@ -1,60 +1,60 @@ -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.World; - -namespace CalamityMod.Items.Weapons -{ - public class Murasama : 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; +using CalamityMod.World; + +namespace CalamityMod.Items.Weapons +{ + public class Murasama : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Murasama"); - Tooltip.SetDefault("There will be blood!\n" + - "ID and power-level locked\n" + + Tooltip.SetDefault("There will be blood!\n" + + "ID and power-level locked\n" + "Prove your strength or have the correct user ID to wield this sword"); } - public override void SetDefaults() - { - item.width = 72; - item.damage = 999; - item.crit += 30; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.useAnimation = 25; - item.useStyle = 5; - item.useTime = 5; - item.knockBack = 6.5f; - item.autoReuse = false; - item.height = 78; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("Murasama"); - item.shootSpeed = 15f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - 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) - { - bool yharon = CalamityWorld.downedYharon; - if (player.name == "Sam" || player.name == "Samuel Rodrigues" || yharon) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, 0f, 0f, 504, 6, 0f, player.whoAmI, 0.0f, 0.0f); - return false; - } - } - } -} + public override void SetDefaults() + { + item.width = 72; + item.damage = 999; + item.crit += 30; + item.melee = true; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.useAnimation = 25; + item.useStyle = 5; + item.useTime = 5; + item.knockBack = 6.5f; + item.autoReuse = false; + item.height = 78; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Murasama"); + item.shootSpeed = 15f; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + 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) + { + bool yharon = CalamityWorld.downedYharon; + if (player.name == "Sam" || player.name == "Samuel Rodrigues" || yharon) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, 0f, 0f, 504, 6, 0f, player.whoAmI, 0.0f, 0.0f); + return false; + } + } + } +} diff --git a/Items/Weapons/NapalmArrow.cs b/Items/Weapons/NapalmArrow.cs index 5cb138a26a..ea97c3be0d 100644 --- a/Items/Weapons/NapalmArrow.cs +++ b/Items/Weapons/NapalmArrow.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class NapalmArrow : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class NapalmArrow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Napalm Arrow"); Tooltip.SetDefault("Explodes into fire shards"); } - public override void SetDefaults() - { - item.damage = 13; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 1000; - item.rare = 3; - item.shoot = mod.ProjectileType("NapalmArrow"); - item.shootSpeed = 13f; - item.ammo = 40; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofChaos"); - recipe.AddIngredient(ItemID.Torch); - recipe.AddIngredient(ItemID.WoodenArrow, 250); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 13; + item.ranged = true; + item.width = 22; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 1000; + item.rare = 3; + item.shoot = mod.ProjectileType("NapalmArrow"); + item.shootSpeed = 13f; + item.ammo = 40; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofChaos"); + recipe.AddIngredient(ItemID.Torch); + recipe.AddIngredient(ItemID.WoodenArrow, 250); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Needler.cs b/Items/Weapons/Needler.cs index 4ad6472f0b..bd80ddeeec 100644 --- a/Items/Weapons/Needler.cs +++ b/Items/Weapons/Needler.cs @@ -1,51 +1,51 @@ -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 Needler : 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.Weapons +{ + public class Needler : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Needler"); Tooltip.SetDefault("Fires needles that stick to enemies and explode"); } - public override void SetDefaults() - { - item.damage = 38; - item.ranged = true; - item.width = 44; - item.height = 26; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item108; - item.autoReuse = true; - item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("Needler"); - item.useAmmo = 97; - } - - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Needler"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 38; + item.ranged = true; + item.width = 44; + item.height = 26; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item108; + item.autoReuse = true; + item.shootSpeed = 9f; + item.shoot = mod.ProjectileType("Needler"); + item.useAmmo = 97; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Needler"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/NeptunesBounty.cs b/Items/Weapons/NeptunesBounty.cs index 2a515490ac..daeea9cc08 100644 --- a/Items/Weapons/NeptunesBounty.cs +++ b/Items/Weapons/NeptunesBounty.cs @@ -1,67 +1,67 @@ -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 -{ - public class NeptunesBounty : ModItem - { +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 +{ + public class NeptunesBounty : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Neptune's Bounty"); - Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\n" + - "The 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"); } - public override void SetDefaults() - { - item.width = 80; - item.damage = 540; - item.melee = true; - item.useAnimation = 17; - item.useTime = 17; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 80; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("NeptuneOrb"); - item.shootSpeed = 25f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AbyssBlade"); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "DepthCells", 15); - recipe.AddIngredient(null, "Lumenite", 15); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(null, "DraedonsForge"); - 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, 33); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - } - } -} + public override void SetDefaults() + { + item.width = 80; + item.damage = 540; + item.melee = true; + item.useAnimation = 17; + item.useTime = 17; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 9f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 80; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("NeptuneOrb"); + item.shootSpeed = 25f; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AbyssBlade"); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "DepthCells", 15); + recipe.AddIngredient(null, "Lumenite", 15); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(null, "DraedonsForge"); + 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, 33); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + } +} diff --git a/Items/Weapons/NettlelineGreatbow.cs b/Items/Weapons/NettlelineGreatbow.cs index d61746c4a7..435c9c4d98 100644 --- a/Items/Weapons/NettlelineGreatbow.cs +++ b/Items/Weapons/NettlelineGreatbow.cs @@ -1,87 +1,87 @@ -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 NettlelineGreatbow : 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.Weapons +{ + public class NettlelineGreatbow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Nettlevine Greatbow"); - Tooltip.SetDefault("Shoots 4 arrows at once\n" + + Tooltip.SetDefault("Shoots 4 arrows at once\n" + "Fires 2 additional venom or chlorophyte arrows"); - } - - public override void SetDefaults() - { - item.damage = 120; - item.ranged = true; - item.width = 36; - item.height = 64; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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 = 4; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - 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; - } - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - switch (Main.rand.Next(2)) - { - case 0: type = ProjectileID.VenomArrow; break; - case 1: type = ProjectileID.ChlorophyteArrow; break; - default: break; - } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[index].noDropItem = true; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 120; + item.ranged = true; + item.width = 36; + item.height = 64; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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 = 4; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 40f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + 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; + } + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + switch (Main.rand.Next(2)) + { + case 0: type = ProjectileID.VenomArrow; break; + case 1: type = ProjectileID.ChlorophyteArrow; break; + default: break; + } + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[index].noDropItem = true; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/NightsRay.cs b/Items/Weapons/NightsRay.cs index 6bdc08bd07..fd40667f03 100644 --- a/Items/Weapons/NightsRay.cs +++ b/Items/Weapons/NightsRay.cs @@ -1,16 +1,16 @@ -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 NightsRay : 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.Weapons +{ + public class NightsRay : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Night's Ray"); @@ -18,38 +18,38 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 35; - item.magic = true; - item.mana = 10; - item.width = 50; - item.height = 50; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shoot = mod.ProjectileType("NightRay"); - item.shootSpeed = 6f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WandofSparking); - recipe.AddIngredient(ItemID.Vilethorn); - recipe.AddIngredient(ItemID.AmberStaff); - recipe.AddIngredient(ItemID.MagicMissile); - recipe.AddIngredient(null, "TrueShadowScale", 15); - recipe.AddIngredient(null, "PurifiedGel", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 35; + item.magic = true; + item.mana = 10; + item.width = 50; + item.height = 50; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item72; + item.autoReuse = true; + item.shoot = mod.ProjectileType("NightRay"); + item.shootSpeed = 6f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WandofSparking); + recipe.AddIngredient(ItemID.Vilethorn); + recipe.AddIngredient(ItemID.AmberStaff); + recipe.AddIngredient(ItemID.MagicMissile); + recipe.AddIngredient(null, "TrueShadowScale", 15); + recipe.AddIngredient(null, "PurifiedGel", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/NightsStabber.cs b/Items/Weapons/NightsStabber.cs index 6aba55b8dc..47469cd6e3 100644 --- a/Items/Weapons/NightsStabber.cs +++ b/Items/Weapons/NightsStabber.cs @@ -1,77 +1,77 @@ -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 -{ - public class NightsStabber : ModItem - { +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 +{ + public class NightsStabber : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Night's Stabber"); - Tooltip.SetDefault("Don't underestimate the power of stabby knives\n" + + Tooltip.SetDefault("Don't underestimate the power of stabby knives\n" + "Enemies release homing dark energy on death"); } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 30; - item.height = 30; - item.damage = 52; - item.melee = true; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientShiv"); - recipe.AddIngredient(null, "SporeKnife"); - recipe.AddIngredient(null, "FlameburstShortsword"); - recipe.AddIngredient(null, "LeechingDagger"); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AncientShiv"); - recipe.AddIngredient(null, "SporeKnife"); - recipe.AddIngredient(null, "FlameburstShortsword"); - recipe.AddIngredient(null, "BloodyRupture"); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 14); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - for (int i = 0; i <= 2; i++) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("NightStabber"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } - } -} + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 15; + item.useTime = 15; + item.width = 30; + item.height = 30; + item.damage = 52; + item.melee = true; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientShiv"); + recipe.AddIngredient(null, "SporeKnife"); + recipe.AddIngredient(null, "FlameburstShortsword"); + recipe.AddIngredient(null, "LeechingDagger"); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AncientShiv"); + recipe.AddIngredient(null, "SporeKnife"); + recipe.AddIngredient(null, "FlameburstShortsword"); + recipe.AddIngredient(null, "BloodyRupture"); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 14); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + for (int i = 0; i <= 2; i++) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("NightStabber"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } + } +} diff --git a/Items/Weapons/NuclearFury.cs b/Items/Weapons/NuclearFury.cs index e9f506f701..1ce367e2b7 100644 --- a/Items/Weapons/NuclearFury.cs +++ b/Items/Weapons/NuclearFury.cs @@ -1,69 +1,69 @@ -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 NuclearFury : 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.Weapons +{ + public class NuclearFury : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Nuclear Fury"); Tooltip.SetDefault("Casts a torrent of cosmic typhoons"); } - public override void SetDefaults() - { - item.damage = 95; - item.magic = true; - item.mana = 13; - item.width = 28; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item84; - item.autoReuse = true; - item.shoot = mod.ProjectileType("NuclearFuryProjectile"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float 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(position.X, position.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), type, damage, knockBack, Main.myPlayer); - Projectile.NewProjectile(position.X, position.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), type, damage, knockBack, Main.myPlayer); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ItemID.SoulofSight, 10); - recipe.AddIngredient(ItemID.UnicornHorn, 5); - recipe.AddIngredient(ItemID.RazorbladeTyphoon); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 95; + item.magic = true; + item.mana = 13; + item.width = 28; + item.height = 30; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item84; + item.autoReuse = true; + item.shoot = mod.ProjectileType("NuclearFuryProjectile"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float 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(position.X, position.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), type, damage, knockBack, Main.myPlayer); + Projectile.NewProjectile(position.X, position.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), type, damage, knockBack, Main.myPlayer); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(ItemID.SoulofSight, 10); + recipe.AddIngredient(ItemID.UnicornHorn, 5); + recipe.AddIngredient(ItemID.RazorbladeTyphoon); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/NullificationRifle.cs b/Items/Weapons/NullificationRifle.cs index 1874d13b8f..fb0002bacc 100644 --- a/Items/Weapons/NullificationRifle.cs +++ b/Items/Weapons/NullificationRifle.cs @@ -1,61 +1,61 @@ -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 NullificationRifle : 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.Weapons +{ + public class NullificationRifle : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Nullification Pistol"); - Tooltip.SetDefault("Is it nullable or not? Let's find out!\n" + - "Fires a fast null bullet that distorts NPC stats\n" + + Tooltip.SetDefault("Is it nullable or not? Let's find out!\n" + + "Fires a fast null bullet that distorts NPC stats\n" + "Uses your life as ammo"); } - public override void SetDefaults() - { - item.damage = 135; - item.ranged = true; - item.width = 64; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 25f; - item.shoot = mod.ProjectileType("NullShot"); - } - - 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) - { - 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); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NullShot"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 135; + item.ranged = true; + item.width = 64; + item.height = 30; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shootSpeed = 25f; + item.shoot = mod.ProjectileType("NullShot"); + } + + 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) + { + 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); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("NullShot"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/OldLordOathsword.cs b/Items/Weapons/OldLordOathsword.cs index 353d57f2b1..31111e3ac3 100644 --- a/Items/Weapons/OldLordOathsword.cs +++ b/Items/Weapons/OldLordOathsword.cs @@ -1,85 +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 -{ - public class OldLordOathsword : 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.Weapons +{ + public class OldLordOathsword : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Old Lord Oathsword"); - Tooltip.SetDefault("A relic of the ancient underworld\n" + + Tooltip.SetDefault("A relic of the ancient underworld\n" + "Critical hits cause lava explosions"); } - public override void SetDefaults() - { - item.damage = 31; - item.width = 78; - item.height = 78; - item.melee = true; - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (crit) - { - target.AddBuff(BuffID.OnFire, 600, false); - player.ApplyDamageToNPC(target, damage, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 200, default(Color), num50); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.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(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 100, default(Color), num51); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.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(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 0, default(Color), num52); - Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default(Vector2)) * (float)target.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; - } - } - } - } -} + public override void SetDefaults() + { + item.damage = 31; + item.width = 78; + item.height = 78; + item.melee = true; + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.useTurn = true; + item.knockBack = 4.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + target.AddBuff(BuffID.OnFire, 600, false); + player.ApplyDamageToNPC(target, damage, 0f, 0, false); + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * target.velocity.Length(); + Main.PlaySound(SoundID.Item14, target.position); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 200, default(Color), num50); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.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(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 100, default(Color), num51); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.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(target.position.X, target.position.Y), target.width, target.height, 127, 0f, 0f, 0, default(Color), num52); + Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default(Vector2)) * (float)target.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; + } + } + } + } +} diff --git a/Items/Weapons/OmegaBiomeBlade.cs b/Items/Weapons/OmegaBiomeBlade.cs index 2bea62159e..c2929e5b6d 100644 --- a/Items/Weapons/OmegaBiomeBlade.cs +++ b/Items/Weapons/OmegaBiomeBlade.cs @@ -1,70 +1,70 @@ -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 -{ - public class OmegaBiomeBlade : ModItem - { +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 +{ + public class OmegaBiomeBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Omega Biome Blade"); - Tooltip.SetDefault("Fires different homing projectiles based on what biome you're in\n" + + Tooltip.SetDefault("Fires different homing projectiles based on what biome you're in\n" + "Projectiles also change based on moon events"); } - public override void SetDefaults() - { - item.width = 62; - item.damage = 220; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 8; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("OmegaBiomeOrb"); - item.shootSpeed = 15f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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 projectiles = 0; projectiles <= 2; projectiles++) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OmegaBiomeOrb"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueBiomeBlade"); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(null, "BarofLife", 3); - recipe.AddIngredient(null, "GalacticaSingularity", 3); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 0); - } - } - } -} + public override void SetDefaults() + { + item.width = 62; + item.damage = 220; + item.melee = true; + item.useAnimation = 18; + item.useTime = 18; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 8; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("OmegaBiomeOrb"); + item.shootSpeed = 15f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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 projectiles = 0; projectiles <= 2; projectiles++) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("OmegaBiomeOrb"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueBiomeBlade"); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(null, "BarofLife", 3); + recipe.AddIngredient(null, "GalacticaSingularity", 3); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 0); + } + } + } +} diff --git a/Items/Weapons/Omniblade.cs b/Items/Weapons/Omniblade.cs index 70ce1af910..b0e4c25fb3 100644 --- a/Items/Weapons/Omniblade.cs +++ b/Items/Weapons/Omniblade.cs @@ -1,16 +1,16 @@ -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 Omniblade : 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.Weapons +{ + public class Omniblade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Omniblade"); @@ -19,41 +19,41 @@ namespace CalamityMod.Items.Weapons "This debuff cuts enemy defense by 50"); } - public override void SetDefaults() - { - item.width = 64; - item.damage = 63; - item.crit += 45; - item.melee = true; - item.useAnimation = 10; - item.useStyle = 1; - item.useTime = 10; - item.useTurn = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 146; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(5) == 0) - { - target.AddBuff(mod.BuffType("WhisperingDeath"), 360); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Katana); - recipe.AddIngredient(null, "BarofLife", 20); - recipe.AddIngredient(null, "CoreofCalamity", 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 64; + item.damage = 63; + item.crit += 45; + item.melee = true; + item.useAnimation = 10; + item.useStyle = 1; + item.useTime = 10; + item.useTurn = true; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 146; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(5) == 0) + { + target.AddBuff(mod.BuffType("WhisperingDeath"), 360); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Katana); + recipe.AddIngredient(null, "BarofLife", 20); + recipe.AddIngredient(null, "CoreofCalamity", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/OnyxChainBlaster.cs b/Items/Weapons/OnyxChainBlaster.cs index 50ce8074bd..c34c4dcf34 100644 --- a/Items/Weapons/OnyxChainBlaster.cs +++ b/Items/Weapons/OnyxChainBlaster.cs @@ -1,79 +1,79 @@ -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 OnyxChainBlaster : 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.Weapons +{ + public class OnyxChainBlaster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Onyx Chain Blaster"); - Tooltip.SetDefault("50% chance to not consume ammo\n" + + Tooltip.SetDefault("50% chance to not consume ammo\n" + "Fires a spread of bullets and an onyx shard"); } - public override void SetDefaults() - { - item.damage = 58; - item.ranged = true; - item.width = 64; - item.height = 32; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 24f; - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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(-25, 26) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.9f, SpeedY * 0.9f, 661, damage, knockBack, player.whoAmI, 0f, 0f); - for (int i = 0; i <= 3; i++) - { - float SpeedNewX = speedX + (float) Main.rand.Next(-45, 46) * 0.05f; - float SpeedNewY = speedY + (float) Main.rand.Next(-45, 46) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedNewX, SpeedNewY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.OnyxBlaster); - recipe.AddIngredient(ItemID.ChainGun); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 58; + item.ranged = true; + item.width = 64; + item.height = 32; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item36; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 24f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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(-25, 26) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.9f, SpeedY * 0.9f, 661, damage, knockBack, player.whoAmI, 0f, 0f); + for (int i = 0; i <= 3; i++) + { + float SpeedNewX = speedX + (float) Main.rand.Next(-45, 46) * 0.05f; + float SpeedNewY = speedY + (float) Main.rand.Next(-45, 46) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedNewX, SpeedNewY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.OnyxBlaster); + recipe.AddIngredient(ItemID.ChainGun); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Onyxia.cs b/Items/Weapons/Onyxia.cs index 1139a66e5b..e242e0e416 100644 --- a/Items/Weapons/Onyxia.cs +++ b/Items/Weapons/Onyxia.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Onyxia"); - Tooltip.SetDefault(NotConsumeAmmo.ToString() + "% chance to not consume ammo\n" + + Tooltip.SetDefault(NotConsumeAmmo.ToString() + "% chance to not consume ammo\n" + "Fires a storm of bullets and onyx shards"); } @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons item.shoot = 10; item.shootSpeed = 28f; item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.GetGlobalItem(mod).postMoonLordRarity = 14; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/OpalStriker.cs b/Items/Weapons/OpalStriker.cs index dc119ddb1f..ab84306274 100644 --- a/Items/Weapons/OpalStriker.cs +++ b/Items/Weapons/OpalStriker.cs @@ -1,59 +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 -{ - public class OpalStriker : 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.Weapons +{ + public class OpalStriker : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Opal Striker"); Tooltip.SetDefault("Fires a string of opal strikes"); } - public override void SetDefaults() - { - item.damage = 9; - item.ranged = true; - item.width = 64; - item.height = 16; - item.useTime = 5; - item.reuseDelay = 25; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); - item.autoReuse = true; - item.shoot = mod.ProjectileType("OpalStrike"); - item.shootSpeed = 6f; - item.useAmmo = 97; - } - - 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("OpalStrike"), damage, 0f, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Marble, 20); - recipe.AddIngredient(ItemID.Amber, 5); - recipe.AddIngredient(ItemID.Diamond, 3); - recipe.AddIngredient(ItemID.FlintlockPistol); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 9; + item.ranged = true; + item.width = 64; + item.height = 16; + item.useTime = 5; + item.reuseDelay = 25; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); + item.autoReuse = true; + item.shoot = mod.ProjectileType("OpalStrike"); + item.shootSpeed = 6f; + item.useAmmo = 97; + } + + 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("OpalStrike"), damage, 0f, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Marble, 20); + recipe.AddIngredient(ItemID.Amber, 5); + recipe.AddIngredient(ItemID.Diamond, 3); + recipe.AddIngredient(ItemID.FlintlockPistol); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/P90.cs b/Items/Weapons/P90.cs index cec8e446d1..7976d893ea 100644 --- a/Items/Weapons/P90.cs +++ b/Items/Weapons/P90.cs @@ -1,67 +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 -{ - public class P90 : 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.Weapons +{ + public class P90 : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("P90"); - Tooltip.SetDefault("33% chance to not consume ammo\n" + + Tooltip.SetDefault("33% chance to not consume ammo\n" + "It's a bullet hose"); } - public override void SetDefaults() - { - item.damage = 3; - item.ranged = true; - item.width = 60; - item.height = 28; - item.useTime = 1; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 18f; - item.useAmmo = 97; - } - - 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; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 10); - recipe.anyIronBar = true; - recipe.AddIngredient(null, "CoreofEleum", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 3; + item.ranged = true; + item.width = 60; + item.height = 28; + item.useTime = 1; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 18f; + item.useAmmo = 97; + } + + 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; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 10); + recipe.anyIronBar = true; + recipe.AddIngredient(null, "CoreofEleum", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/PaintballBlaster.cs b/Items/Weapons/PaintballBlaster.cs index f932afcab0..162acc564f 100644 --- a/Items/Weapons/PaintballBlaster.cs +++ b/Items/Weapons/PaintballBlaster.cs @@ -1,85 +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 -{ - public class PaintballBlaster : 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.Weapons +{ + public class PaintballBlaster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Speed Blaster"); Tooltip.SetDefault("Shoots a string of paint blasts"); } - public override void SetDefaults() - { - item.damage = 26; - item.ranged = true; - item.width = 54; - item.height = 26; - item.useAnimation = 24; - item.reuseDelay = 9; - item.useTime = 4; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = null; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = 587; - } - - 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; - } - float num208 = num78; - float num209 = num79; - num208 += (float)Main.rand.Next(-1, 2) * 0.5f; - num209 += (float)Main.rand.Next(-1, 2) * 0.5f; - if (Collision.CanHitLine(player.Center, 0, 0, vector2 + new Vector2(num208, num209) * 2f, 0, 0)) - { - vector2 += new Vector2(num208, num209); - } - Projectile.NewProjectile(position.X, position.Y - player.gravDir * 4f, num208, num209, 587, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(12) / 6f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PainterPaintballGun); - recipe.AddIngredient(ItemID.SoulofSight, 5); - recipe.AddIngredient(ItemID.HallowedBar, 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 26; + item.ranged = true; + item.width = 54; + item.height = 26; + item.useAnimation = 24; + item.reuseDelay = 9; + item.useTime = 4; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = null; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = 587; + } + + 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; + } + float num208 = num78; + float num209 = num79; + num208 += (float)Main.rand.Next(-1, 2) * 0.5f; + num209 += (float)Main.rand.Next(-1, 2) * 0.5f; + if (Collision.CanHitLine(player.Center, 0, 0, vector2 + new Vector2(num208, num209) * 2f, 0, 0)) + { + vector2 += new Vector2(num208, num209); + } + Projectile.NewProjectile(position.X, position.Y - player.gravDir * 4f, num208, num209, 587, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(12) / 6f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PainterPaintballGun); + recipe.AddIngredient(ItemID.SoulofSight, 5); + recipe.AddIngredient(ItemID.HallowedBar, 9); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Perforators/Aorta.cs b/Items/Weapons/Perforators/Aorta.cs index 2954374e97..0770ea7cfe 100644 --- a/Items/Weapons/Perforators/Aorta.cs +++ b/Items/Weapons/Perforators/Aorta.cs @@ -1,46 +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.Perforators -{ - public class Aorta : 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.Weapons.Perforators +{ + public class Aorta : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Aorta"); } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Valor); - item.damage = 25; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4.25f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.autoReuse = false; - item.shoot = mod.ProjectileType("AortaProjectile"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample", 6); - recipe.AddIngredient(ItemID.Vertebrae, 3); - recipe.AddIngredient(ItemID.CrimtaneBar, 3); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Valor); + item.damage = 25; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 4.25f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.autoReuse = false; + item.shoot = mod.ProjectileType("AortaProjectile"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample", 6); + recipe.AddIngredient(ItemID.Vertebrae, 3); + recipe.AddIngredient(ItemID.CrimtaneBar, 3); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Perforators/BloodBath.cs b/Items/Weapons/Perforators/BloodBath.cs index a4fff64b34..2e992fe7cc 100644 --- a/Items/Weapons/Perforators/BloodBath.cs +++ b/Items/Weapons/Perforators/BloodBath.cs @@ -1,111 +1,111 @@ -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.Perforators -{ - public class BloodBath : 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.Weapons.Perforators +{ + public class BloodBath : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Bath"); Tooltip.SetDefault("Drenches your foes in blood"); Item.staff[item.type] = true; } - - public override void SetDefaults() - { - item.damage = 25; - item.magic = true; - item.mana = 10; - item.width = 52; - item.height = 50; - item.useTime = 15; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.75f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodBeam"); - item.shootSpeed = 9f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample", 8); - recipe.AddIngredient(ItemID.Vertebrae, 3); - recipe.AddIngredient(ItemID.CrimtaneBar, 2); - recipe.AddTile(TileID.DemonAltar); - 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; - } - num78 *= num80; - num79 *= num80; - int num107 = 2; - if (Main.rand.Next(3) == 0) - { - num107++; - } - if (Main.rand.Next(3) == 0) - { - num107++; - } - 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)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, 0f, (float)Main.rand.Next(15)); - } - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 25; + item.magic = true; + item.mana = 10; + item.width = 52; + item.height = 50; + item.useTime = 15; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.75f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item21; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodBeam"); + item.shootSpeed = 9f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample", 8); + recipe.AddIngredient(ItemID.Vertebrae, 3); + recipe.AddIngredient(ItemID.CrimtaneBar, 2); + recipe.AddTile(TileID.DemonAltar); + 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; + } + num78 *= num80; + num79 *= num80; + int num107 = 2; + if (Main.rand.Next(3) == 0) + { + num107++; + } + if (Main.rand.Next(3) == 0) + { + num107++; + } + 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)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, 0f, (float)Main.rand.Next(15)); + } + return false; + } + } +} diff --git a/Items/Weapons/Perforators/BloodClotStaff.cs b/Items/Weapons/Perforators/BloodClotStaff.cs index 50463681d7..02b3973adb 100644 --- a/Items/Weapons/Perforators/BloodClotStaff.cs +++ b/Items/Weapons/Perforators/BloodClotStaff.cs @@ -1,83 +1,83 @@ -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.Weapons.Perforators -{ - public class BloodClotStaff : ModItem - { +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.Weapons.Perforators +{ + public class BloodClotStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Clot Staff"); Tooltip.SetDefault("Summons a blood clot to fight for you"); } - - public override void SetDefaults() - { - item.damage = 7; - item.mana = 10; - item.width = 58; - item.height = 64; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodClotMinion"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vertebrae, 4); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddIngredient(null, "BloodSample", 10); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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 + + public override void SetDefaults() + { + item.damage = 7; + item.mana = 10; + item.width = 58; + item.height = 64; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodClotMinion"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Vertebrae, 4); + recipe.AddIngredient(ItemID.CrimtaneBar, 5); + recipe.AddIngredient(null, "BloodSample", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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); + } + } +} diff --git a/Items/Weapons/Perforators/BloodyRupture.cs b/Items/Weapons/Perforators/BloodyRupture.cs index 547e4fc68b..c79e59f038 100644 --- a/Items/Weapons/Perforators/BloodyRupture.cs +++ b/Items/Weapons/Perforators/BloodyRupture.cs @@ -1,64 +1,64 @@ -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.Perforators -{ - public class BloodyRupture : ModItem - { +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.Perforators +{ + public class BloodyRupture : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Bloody Rupture"); Tooltip.SetDefault("Enemies release homing blood orbs on death"); } - - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 15; - item.useTime = 15; - item.width = 24; - item.height = 24; - item.damage = 26; - item.melee = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample", 4); - recipe.AddIngredient(ItemID.Vertebrae, 2); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Blood"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - } - } -} + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 15; + item.useTime = 15; + item.width = 24; + item.height = 24; + item.damage = 26; + item.melee = true; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample", 4); + recipe.AddIngredient(ItemID.Vertebrae, 2); + recipe.AddIngredient(ItemID.CrimtaneBar, 5); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Blood"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + } + } +} diff --git a/Items/Weapons/Perforators/Eviscerator.cs b/Items/Weapons/Perforators/Eviscerator.cs index 10667bb722..24789cddfb 100644 --- a/Items/Weapons/Perforators/Eviscerator.cs +++ b/Items/Weapons/Perforators/Eviscerator.cs @@ -1,58 +1,58 @@ -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.Perforators -{ - public class Eviscerator : 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.Weapons.Perforators +{ + public class Eviscerator : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Eviscerator"); Tooltip.SetDefault("Fires a slow-moving blood clot"); } - - public override void SetDefaults() - { - item.damage = 65; - item.ranged = true; - item.width = 58; - item.height = 22; - item.crit += 25; - item.useTime = 60; - item.useAnimation = 60; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodClotFriendly"); - item.shootSpeed = 22f; - item.useAmmo = 97; - } - - 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("BloodClotFriendly"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample", 8); - recipe.AddIngredient(ItemID.Vertebrae, 4); - recipe.AddIngredient(ItemID.CrimtaneBar, 4); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 65; + item.ranged = true; + item.width = 58; + item.height = 22; + item.crit += 25; + item.useTime = 60; + item.useAnimation = 60; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item40; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodClotFriendly"); + item.shootSpeed = 22f; + item.useAmmo = 97; + } + + 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("BloodClotFriendly"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample", 8); + recipe.AddIngredient(ItemID.Vertebrae, 4); + recipe.AddIngredient(ItemID.CrimtaneBar, 4); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Perforators/SausageMaker.cs b/Items/Weapons/Perforators/SausageMaker.cs index 53c1c702ab..c80e626b2f 100644 --- a/Items/Weapons/Perforators/SausageMaker.cs +++ b/Items/Weapons/Perforators/SausageMaker.cs @@ -1,52 +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.Weapons.Perforators -{ - public class SausageMaker : 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.Weapons.Perforators +{ + public class SausageMaker : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Sausage Maker"); Tooltip.SetDefault("Sprays homing blood on enemy hits"); } - - public override void SetDefaults() - { - item.width = 44; - item.damage = 29; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 42; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.shoot = mod.ProjectileType("SausageMaker"); - item.shootSpeed = 6f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodSample", 8); - recipe.AddIngredient(ItemID.Vertebrae, 4); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + + public override void SetDefaults() + { + item.width = 44; + item.damage = 29; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 42; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.shoot = mod.ProjectileType("SausageMaker"); + item.shootSpeed = 6f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodSample", 8); + recipe.AddIngredient(ItemID.Vertebrae, 4); + recipe.AddIngredient(ItemID.CrimtaneBar, 5); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Perforators/VeinBurster.cs b/Items/Weapons/Perforators/VeinBurster.cs index bce29d760e..5d9ebb2fb2 100644 --- a/Items/Weapons/Perforators/VeinBurster.cs +++ b/Items/Weapons/Perforators/VeinBurster.cs @@ -1,50 +1,50 @@ -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.Perforators -{ - public class VeinBurster : 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.Weapons.Perforators +{ + public class VeinBurster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Vein Burster"); Tooltip.SetDefault("Fires a blood ball that sticks to tiles and explodes"); } - - public override void SetDefaults() - { - item.width = 52; - item.damage = 22; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 4.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 50; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.shoot = mod.ProjectileType("BloodBall"); - item.shootSpeed = 5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Vertebrae, 5); - recipe.AddIngredient(ItemID.CrimtaneBar, 5); - recipe.AddIngredient(null, "BloodSample", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + + public override void SetDefaults() + { + item.width = 52; + item.damage = 22; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 4.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 50; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.shoot = mod.ProjectileType("BloodBall"); + item.shootSpeed = 5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Vertebrae, 5); + recipe.AddIngredient(ItemID.CrimtaneBar, 5); + recipe.AddIngredient(null, "BloodSample", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Phangasm.cs b/Items/Weapons/Phangasm.cs index f55293ec4a..831583b60a 100644 --- a/Items/Weapons/Phangasm.cs +++ b/Items/Weapons/Phangasm.cs @@ -1,60 +1,60 @@ -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 Phangasm : 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.Weapons +{ + public class Phangasm : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Phangasm"); Tooltip.SetDefault("Fires a spread of arrows and emits phantom arrows on enemy hits"); } - public override void SetDefaults() - { - item.damage = 112; - item.width = 20; - item.height = 12; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.knockBack = 3f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Phangasm"); - item.shootSpeed = 20f; - item.useAmmo = 40; - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Phangasm"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Phantasm); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 112; + item.width = 20; + item.height = 12; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.knockBack = 3f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Phangasm"); + item.shootSpeed = 20f; + item.useAmmo = 40; + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Phangasm"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Phantasm); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/PhantasmalFury.cs b/Items/Weapons/PhantasmalFury.cs index f837d8ad1f..80847f20b1 100644 --- a/Items/Weapons/PhantasmalFury.cs +++ b/Items/Weapons/PhantasmalFury.cs @@ -1,16 +1,16 @@ -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 PhantasmalFury : 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.Weapons +{ + public class PhantasmalFury : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Phantasmal Fury"); @@ -18,36 +18,36 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 320; - item.magic = true; - item.mana = 20; - item.width = 62; - item.height = 60; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PhantasmalFury"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreStaff); - recipe.AddIngredient(null, "RuinousSoul", 2); - recipe.AddIngredient(null, "DarkPlasma"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 320; + item.magic = true; + item.mana = 20; + item.width = 62; + item.height = 60; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PhantasmalFury"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SpectreStaff); + recipe.AddIngredient(null, "RuinousSoul", 2); + recipe.AddIngredient(null, "DarkPlasma"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/PhoenixBlade.cs b/Items/Weapons/PhoenixBlade.cs index 37f7b09d3a..8ca1c62b77 100644 --- a/Items/Weapons/PhoenixBlade.cs +++ b/Items/Weapons/PhoenixBlade.cs @@ -1,85 +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 -{ - public class PhoenixBlade : 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.Weapons +{ + public class PhoenixBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Phoenix Blade"); Tooltip.SetDefault("Enemies explode and emit healing flames on death"); } - public override void SetDefaults() - { - item.width = 106; - item.damage = 95; - item.melee = true; - item.useAnimation = 29; - item.useStyle = 1; - item.useTime = 29; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 106; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shootSpeed = 12f; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, damage, knockback, Main.myPlayer); - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 1; i++ ) - { - float randomSpeedX = (float)Main.rand.Next(5); - float randomSpeedY = (float)Main.rand.Next(3, 7); - 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("PhoenixHeal"), 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("PhoenixHeal"), 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; - } - } - } - - 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, 244); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BreakerBlade); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddIngredient(null, "EssenceofCinder"); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 106; + item.damage = 95; + item.melee = true; + item.useAnimation = 29; + item.useStyle = 1; + item.useTime = 29; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 106; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.shootSpeed = 12f; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, damage, knockback, Main.myPlayer); + float spread = 180f * 0.0174f; + double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 1; i++ ) + { + float randomSpeedX = (float)Main.rand.Next(5); + float randomSpeedY = (float)Main.rand.Next(3, 7); + 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("PhoenixHeal"), 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("PhoenixHeal"), 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; + } + } + } + + 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, 244); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BreakerBlade); + recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddIngredient(ItemID.SoulofMight, 3); + recipe.AddIngredient(ItemID.SoulofSight, 3); + recipe.AddIngredient(ItemID.SoulofFright, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Photoviscerator.cs b/Items/Weapons/Photoviscerator.cs index 7c338978ff..4520a4fd9b 100644 --- a/Items/Weapons/Photoviscerator.cs +++ b/Items/Weapons/Photoviscerator.cs @@ -1,79 +1,79 @@ -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 Photoviscerator : 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.Weapons +{ + public class Photoviscerator : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Photoviscerator"); - Tooltip.SetDefault("90% chance to not consume gel\n" + + Tooltip.SetDefault("90% chance to not consume gel\n" + "Fires a stream of exo flames that literally melts everything"); } - public override void SetDefaults() - { - item.damage = 165; - item.ranged = true; - item.width = 84; - item.height = 30; - item.useTime = 1; - item.useAnimation = 5; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ExoFire"); - item.shootSpeed = 6f; - item.useAmmo = 23; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 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) - { - float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - 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, "ElementalEruption"); - recipe.AddIngredient(null, "CleansingBlaze"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "HellcasterFragment", 3); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "AuricOre", 25); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 165; + item.ranged = true; + item.width = 84; + item.height = 30; + item.useTime = 1; + item.useAnimation = 5; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ExoFire"); + item.shootSpeed = 6f; + item.useAmmo = 23; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 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) + { + float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + 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, "ElementalEruption"); + recipe.AddIngredient(null, "CleansingBlaze"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "HellcasterFragment", 3); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/PlagueKeeper.cs b/Items/Weapons/PlagueKeeper.cs index 6c5cabd1de..766b6185b7 100644 --- a/Items/Weapons/PlagueKeeper.cs +++ b/Items/Weapons/PlagueKeeper.cs @@ -1,65 +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; -using CalamityMod.Projectiles; - -namespace CalamityMod.Items.Weapons -{ - public class PlagueKeeper : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Keeper"); - Tooltip.SetDefault("Fires a plague and bee cloud"); - } - - public override void SetDefaults() - { - item.width = 74; - item.damage = 110; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 92; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("PlagueBeeDust"); - item.shootSpeed = 9f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VirulentKatana"); - recipe.AddIngredient(ItemID.BeeKeeper); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 300); - for (int i = 0; i < 3; i++) - { - 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; - } - } - } -} +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 +{ + public class PlagueKeeper : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Keeper"); + Tooltip.SetDefault("Fires a plague and bee cloud"); + } + + public override void SetDefaults() + { + item.width = 74; + item.damage = 110; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 92; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("PlagueBeeDust"); + item.shootSpeed = 9f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VirulentKatana"); + recipe.AddIngredient(ItemID.BeeKeeper); + recipe.AddIngredient(ItemID.FragmentSolar, 10); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + for (int i = 0; i < 3; i++) + { + 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/Plaguebringer/DiseasedPike.cs b/Items/Weapons/Plaguebringer/DiseasedPike.cs index 2da3f78cca..3661ce42cc 100644 --- a/Items/Weapons/Plaguebringer/DiseasedPike.cs +++ b/Items/Weapons/Plaguebringer/DiseasedPike.cs @@ -1,53 +1,53 @@ -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.Plaguebringer -{ - public class DiseasedPike : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Diseased Pike"); - Tooltip.SetDefault("Fires plague seekers on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 62; - item.damage = 75; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 58; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("DiseasedPike"); - item.shootSpeed = 9f; - } - - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - } -} +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.Plaguebringer +{ + public class DiseasedPike : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Diseased Pike"); + Tooltip.SetDefault("Fires plague seekers on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 62; + item.damage = 75; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 58; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("DiseasedPike"); + item.shootSpeed = 9f; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + } +} diff --git a/Items/Weapons/Plaguebringer/Malevolence.cs b/Items/Weapons/Plaguebringer/Malevolence.cs index 69c77bef67..8410e6ec77 100644 --- a/Items/Weapons/Plaguebringer/Malevolence.cs +++ b/Items/Weapons/Plaguebringer/Malevolence.cs @@ -1,51 +1,51 @@ -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.Plaguebringer -{ - public class Malevolence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malevolence"); - Tooltip.SetDefault("Fires two plague arrows that explode into bees on death"); - } - - public override void SetDefaults() - { - item.damage = 51; - item.ranged = true; - item.width = 36; - item.height = 58; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item97; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = mod.ProjectileType("PlagueArrow"); - 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) - { - for (int i = 0; i < 2; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("PlagueArrow"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file +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.Plaguebringer +{ + public class Malevolence : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malevolence"); + Tooltip.SetDefault("Fires two plague arrows that explode into bees on death"); + } + + public override void SetDefaults() + { + item.damage = 51; + item.ranged = true; + item.width = 36; + item.height = 58; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item97; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("PlagueArrow"); + 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) + { + for (int i = 0; i < 2; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("PlagueArrow"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Plaguebringer/MepheticSprayer.cs b/Items/Weapons/Plaguebringer/MepheticSprayer.cs index b49c4e7222..703b18473d 100644 --- a/Items/Weapons/Plaguebringer/MepheticSprayer.cs +++ b/Items/Weapons/Plaguebringer/MepheticSprayer.cs @@ -1,39 +1,39 @@ -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.Plaguebringer -{ - public class MepheticSprayer : 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.Weapons.Plaguebringer +{ + public class MepheticSprayer : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Blight Spewer"); } - - public override void SetDefaults() - { - item.damage = 99; - item.ranged = true; - item.width = 76; - item.height = 36; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CorossiveFlames"); - item.shootSpeed = 7.5f; - item.useAmmo = 23; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 99; + item.ranged = true; + item.width = 76; + item.height = 36; + item.useTime = 10; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("CorossiveFlames"); + item.shootSpeed = 7.5f; + item.useAmmo = 23; + } + } +} diff --git a/Items/Weapons/Plaguebringer/PestilentDefiler.cs b/Items/Weapons/Plaguebringer/PestilentDefiler.cs index 7e524c45e3..c95d81cc27 100644 --- a/Items/Weapons/Plaguebringer/PestilentDefiler.cs +++ b/Items/Weapons/Plaguebringer/PestilentDefiler.cs @@ -1,51 +1,51 @@ -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.Plaguebringer -{ - public class PestilentDefiler : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pestilent Defiler"); - Tooltip.SetDefault("Fires a plague round that explodes and splits on death"); - } - - public override void SetDefaults() - { - item.damage = 135; - item.ranged = true; - item.width = 46; - item.height = 20; - item.useTime = 37; - item.useAnimation = 37; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 9.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item40; - item.autoReuse = false; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("SicknessRound"); - item.useAmmo = 97; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(0, -5); - } - - 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("SicknessRound"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file +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.Plaguebringer +{ + public class PestilentDefiler : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pestilent Defiler"); + Tooltip.SetDefault("Fires a plague round that explodes and splits on death"); + } + + public override void SetDefaults() + { + item.damage = 135; + item.ranged = true; + item.width = 46; + item.height = 20; + item.useTime = 37; + item.useAnimation = 37; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 9.5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item40; + item.autoReuse = false; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("SicknessRound"); + item.useAmmo = 97; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(0, -5); + } + + 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("SicknessRound"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Plaguebringer/PlagueStaff.cs b/Items/Weapons/Plaguebringer/PlagueStaff.cs index 2494b5096f..68beb58415 100644 --- a/Items/Weapons/Plaguebringer/PlagueStaff.cs +++ b/Items/Weapons/Plaguebringer/PlagueStaff.cs @@ -1,79 +1,79 @@ -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.Plaguebringer -{ - public class PlagueStaff : 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.Weapons.Plaguebringer +{ + public class PlagueStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Staff"); Tooltip.SetDefault("Fires a spread of plague fangs"); Item.staff[item.type] = true; } - - public override void SetDefaults() - { - item.damage = 78; - item.magic = true; - item.mana = 22; - item.width = 46; - item.height = 46; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PlagueFang"); - item.shootSpeed = 16f; - } - - 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) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - int num130 = 6; - if (Main.rand.Next(3) == 0) - { - num130++; - } - if (Main.rand.Next(4) == 0) - { - num130++; - } - if (Main.rand.Next(5) == 0) - { - num130++; - } - for (int num131 = 0; num131 < num130; num131++) - { - float num132 = num78; - float num133 = num79; - float num134 = 0.05f * (float)num131; - num132 += (float)Main.rand.Next(-120, 121) * num134; - num133 += (float)Main.rand.Next(-120, 121) * num134; - num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); - num80 = num72 / num80; - num132 *= num80; - num133 *= num80; - float x2 = vector2.X; - float y2 = vector2.Y; - Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("PlagueFang"), damage, knockBack, Main.myPlayer, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 78; + item.magic = true; + item.mana = 22; + item.width = 46; + item.height = 46; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PlagueFang"); + item.shootSpeed = 16f; + } + + 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) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num72 = item.shootSpeed; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + int num130 = 6; + if (Main.rand.Next(3) == 0) + { + num130++; + } + if (Main.rand.Next(4) == 0) + { + num130++; + } + if (Main.rand.Next(5) == 0) + { + num130++; + } + for (int num131 = 0; num131 < num130; num131++) + { + float num132 = num78; + float num133 = num79; + float num134 = 0.05f * (float)num131; + num132 += (float)Main.rand.Next(-120, 121) * num134; + num133 += (float)Main.rand.Next(-120, 121) * num134; + num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); + num80 = num72 / num80; + num132 *= num80; + num133 *= num80; + float x2 = vector2.X; + float y2 = vector2.Y; + Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("PlagueFang"), damage, knockBack, Main.myPlayer, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Plaguebringer/TheHive.cs b/Items/Weapons/Plaguebringer/TheHive.cs index 7c8c7283a1..4a30699d94 100644 --- a/Items/Weapons/Plaguebringer/TheHive.cs +++ b/Items/Weapons/Plaguebringer/TheHive.cs @@ -1,54 +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; - -namespace CalamityMod.Items.Weapons.Plaguebringer -{ - public class TheHive : 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.Weapons.Plaguebringer +{ + public class TheHive : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("The Hive"); Tooltip.SetDefault("Launches a variety of rockets that explode into bees on death"); } - - public override void SetDefaults() - { - item.damage = 70; - item.ranged = true; - item.width = 62; - item.height = 30; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BeeRPG"); - item.shootSpeed = 13f; - item.useAmmo = 771; - } - - 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("GoliathRocket"); break; - case 1: type = mod.ProjectileType("HiveMissile"); break; - case 2: type = mod.ProjectileType("HiveBomb"); break; - case 3: type = mod.ProjectileType("BeeRPG"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 70; + item.ranged = true; + item.width = 62; + item.height = 30; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item61; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BeeRPG"); + item.shootSpeed = 13f; + item.useAmmo = 771; + } + + 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("GoliathRocket"); break; + case 1: type = mod.ProjectileType("HiveMissile"); break; + case 2: type = mod.ProjectileType("HiveBomb"); break; + case 3: type = mod.ProjectileType("BeeRPG"); break; + default: break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Plaguebringer/ThePlaguebringer.cs b/Items/Weapons/Plaguebringer/ThePlaguebringer.cs index b435b1949e..0b4150657f 100644 --- a/Items/Weapons/Plaguebringer/ThePlaguebringer.cs +++ b/Items/Weapons/Plaguebringer/ThePlaguebringer.cs @@ -1,36 +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.Weapons.Plaguebringer -{ - public class ThePlaguebringer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pandemic"); - Tooltip.SetDefault("Fires plague seekers when enemies are near"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 100; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ThePlaguebringer"); - } - } -} \ No newline at end of file +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.Plaguebringer +{ + public class ThePlaguebringer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pandemic"); + Tooltip.SetDefault("Fires plague seekers when enemies are near"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.damage = 100; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ThePlaguebringer"); + } + } +} diff --git a/Items/Weapons/Plaguebringer/VirulentKatana.cs b/Items/Weapons/Plaguebringer/VirulentKatana.cs index 149a5a9f39..be49a49d92 100644 --- a/Items/Weapons/Plaguebringer/VirulentKatana.cs +++ b/Items/Weapons/Plaguebringer/VirulentKatana.cs @@ -1,44 +1,44 @@ -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.Plaguebringer -{ - public class VirulentKatana : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Virulence"); - Tooltip.SetDefault("Fires a plague cloud"); - } - - public override void SetDefaults() - { - item.width = 50; - item.damage = 96; - item.melee = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.useTurn = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 56; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("PlagueDust"); - item.shootSpeed = 9f; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 240); - } - } -} +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.Plaguebringer +{ + public class VirulentKatana : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Virulence"); + Tooltip.SetDefault("Fires a plague cloud"); + } + + public override void SetDefaults() + { + item.width = 50; + item.damage = 96; + item.melee = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.useTurn = true; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 56; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("PlagueDust"); + item.shootSpeed = 9f; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 240); + } + } +} diff --git a/Items/Weapons/PlanetaryAnnihilation.cs b/Items/Weapons/PlanetaryAnnihilation.cs index 5c2923e57f..c9d9f966b0 100644 --- a/Items/Weapons/PlanetaryAnnihilation.cs +++ b/Items/Weapons/PlanetaryAnnihilation.cs @@ -1,132 +1,132 @@ -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 PlanetaryAnnihilation : 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.Weapons +{ + public class PlanetaryAnnihilation : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Planetary Annihilation"); - Tooltip.SetDefault("Fires a storm of arrows from the sky\n" + + Tooltip.SetDefault("Fires a storm of arrows from the sky\n" + "Wooden arrows are converted to homing energy bolts"); - } - - public override void SetDefaults() - { - item.damage = 75; - item.ranged = true; - item.width = 58; - item.height = 102; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TerraBall"); - item.shootSpeed = 16f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 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) - { - float num72 = Main.rand.Next(19, 35); - 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; - 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 -= 100f; - 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(-240, 241) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-240, 241) * 0.02f; - if (type == ProjectileID.WoodenArrowFriendly) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.3f), mod.ProjectileType("TerraBallR"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(2)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.2f), mod.ProjectileType("TerraBallO"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.1f), mod.ProjectileType("TerraBallY"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(4)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1f), mod.ProjectileType("TerraBallG"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.9f), mod.ProjectileType("TerraBallB"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(6)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.8f), mod.ProjectileType("TerraBallI"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(7)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.7f), mod.ProjectileType("TerraBallV"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(8)); - } - else - { - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.3f), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; - int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.2f), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num122].noDropItem = true; - int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.1f), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num123].noDropItem = true; - int num124 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1f), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num124].noDropItem = true; - int num125 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.9f), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num125].noDropItem = true; - int num126 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.8f), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num126].noDropItem = true; - int num127 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.7f), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num127].noDropItem = true; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(null, "CosmicBolter"); - recipe.AddIngredient(ItemID.DaedalusStormbow); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 75; + item.ranged = true; + item.width = 58; + item.height = 102; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item75; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TerraBall"); + item.shootSpeed = 16f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 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) + { + float num72 = Main.rand.Next(19, 35); + 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; + 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 -= 100f; + 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(-240, 241) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-240, 241) * 0.02f; + if (type == ProjectileID.WoodenArrowFriendly) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.3f), mod.ProjectileType("TerraBallR"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(2)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.2f), mod.ProjectileType("TerraBallO"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.1f), mod.ProjectileType("TerraBallY"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(4)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1f), mod.ProjectileType("TerraBallG"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.9f), mod.ProjectileType("TerraBallB"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(6)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.8f), mod.ProjectileType("TerraBallI"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(7)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.7f), mod.ProjectileType("TerraBallV"), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(8)); + } + else + { + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.3f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.2f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num122].noDropItem = true; + int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1.1f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num123].noDropItem = true; + int num124 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 1f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num124].noDropItem = true; + int num125 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.9f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num125].noDropItem = true; + int num126 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.8f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num126].noDropItem = true; + int num127 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, (speedY5 * 0.7f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num127].noDropItem = true; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(null, "CosmicBolter"); + recipe.AddIngredient(ItemID.DaedalusStormbow); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/PlasmaRifle.cs b/Items/Weapons/PlasmaRifle.cs index 129e89e219..fb3717c79a 100644 --- a/Items/Weapons/PlasmaRifle.cs +++ b/Items/Weapons/PlasmaRifle.cs @@ -1,102 +1,102 @@ -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 PlasmaRifle : 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.Weapons +{ + public class PlasmaRifle : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Plasma Rifle"); - Tooltip.SetDefault("Fires a plasma blast that explodes\n" + + Tooltip.SetDefault("Fires a plasma blast that explodes\n" + "Right click to fire plasma bolts"); } - public override void SetDefaults() - { - item.damage = 460; - item.mana = 40; - item.magic = true; - item.width = 48; - item.height = 22; - item.useTime = 40; - item.useAnimation = 40; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - 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 = 12f; - item.shoot = mod.ProjectileType("PlasmaShot"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.mana = 5; - item.useTime = 8; - item.useAnimation = 8; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - } - else - { - item.mana = 40; - item.useTime = 40; - item.useAnimation = 40; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); - } - return base.CanUseItem(player); - } - - public override 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("PlasmaBolt"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("PlasmaShot"), (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(ItemID.Musket); - recipe.AddIngredient(ItemID.ToxicFlask); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 7); - recipe.AddIngredient(ItemID.TheUndertaker); - recipe.AddIngredient(ItemID.ToxicFlask); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 460; + item.mana = 40; + item.magic = true; + item.width = 48; + item.height = 22; + item.useTime = 40; + item.useAnimation = 40; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + 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 = 12f; + item.shoot = mod.ProjectileType("PlasmaShot"); + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.mana = 5; + item.useTime = 8; + item.useAnimation = 8; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + } + else + { + item.mana = 40; + item.useTime = 40; + item.useAnimation = 40; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + } + return base.CanUseItem(player); + } + + public override 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("PlasmaBolt"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("PlasmaShot"), (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(ItemID.Musket); + recipe.AddIngredient(ItemID.ToxicFlask); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 7); + recipe.AddIngredient(ItemID.TheUndertaker); + recipe.AddIngredient(ItemID.ToxicFlask); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/PlasmaRod.cs b/Items/Weapons/PlasmaRod.cs index 5d511c03c3..a6c87ee557 100644 --- a/Items/Weapons/PlasmaRod.cs +++ b/Items/Weapons/PlasmaRod.cs @@ -1,43 +1,43 @@ -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 PlasmaRod : 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.Weapons +{ + public class PlasmaRod : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Plasma Rod"); - Tooltip.SetDefault("Casts a low-damage plasma bolt\n" + - "Shooting a tile will cause several bolts with increased damage to fire\n" + + Tooltip.SetDefault("Casts a low-damage plasma bolt\n" + + "Shooting a tile will cause several bolts with increased damage to fire\n" + "Shooting an enemy will cause several debuffs for a short time"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 8; - item.magic = true; - item.mana = 10; - item.width = 40; - item.height = 40; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PlasmaRay"); - item.shootSpeed = 6f; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 8; + item.magic = true; + item.mana = 10; + item.width = 40; + item.height = 40; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PlasmaRay"); + item.shootSpeed = 6f; + } + } +} diff --git a/Items/Weapons/Polterghast/BansheeHook.cs b/Items/Weapons/Polterghast/BansheeHook.cs index f95de1cfa6..8dd8ecaaed 100644 --- a/Items/Weapons/Polterghast/BansheeHook.cs +++ b/Items/Weapons/Polterghast/BansheeHook.cs @@ -1,82 +1,82 @@ -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.Polterghast -{ - public class BansheeHook : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Banshee Hook"); - Tooltip.SetDefault("Swings a banshee hook that fires blades and explodes on contact"); - } - - public override void SetDefaults() - { - item.width = 16; - item.damage = 155; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.melee = true; - item.useAnimation = 21; - item.useStyle = 5; - item.useTime = 21; - item.knockBack = 8.5f; - item.UseSound = SoundID.DD2_GhastlyGlaivePierce; - item.autoReuse = true; - item.height = 16; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("BansheeHook"); - item.shootSpeed = 42f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - 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) - { - float num82 = (float)Main.mouseX + Main.screenPosition.X - position.X; - float num83 = (float)Main.mouseY + Main.screenPosition.Y - position.Y; - if (player.gravDir == -1f) - { - num83 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - position.Y; - } - float num84 = (float)Math.Sqrt((double)(num82 * num82 + num83 * num83)); - float num85 = num84; - if ((float.IsNaN(num82) && float.IsNaN(num83)) || (num82 == 0f && num83 == 0f)) - { - num82 = (float)player.direction; - num83 = 0f; - num84 = item.shootSpeed; - } - else - { - num84 = item.shootSpeed / num84; - } - num82 *= num84; - num83 *= num84; - float ai4 = Main.rand.NextFloat() * item.shootSpeed * 0.75f * (float)player.direction; - Vector2 velocity = new Vector2(num82, num83); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BansheeHook"), damage, knockBack, player.whoAmI, ai4, 0.0f); - return false; - } - } -} +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.Polterghast +{ + public class BansheeHook : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Banshee Hook"); + Tooltip.SetDefault("Swings a banshee hook that fires blades and explodes on contact"); + } + + public override void SetDefaults() + { + item.width = 16; + item.damage = 155; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.melee = true; + item.useAnimation = 21; + item.useStyle = 5; + item.useTime = 21; + item.knockBack = 8.5f; + item.UseSound = SoundID.DD2_GhastlyGlaivePierce; + item.autoReuse = true; + item.height = 16; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("BansheeHook"); + item.shootSpeed = 42f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + 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) + { + float num82 = (float)Main.mouseX + Main.screenPosition.X - position.X; + float num83 = (float)Main.mouseY + Main.screenPosition.Y - position.Y; + if (player.gravDir == -1f) + { + num83 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - position.Y; + } + float num84 = (float)Math.Sqrt((double)(num82 * num82 + num83 * num83)); + float num85 = num84; + if ((float.IsNaN(num82) && float.IsNaN(num83)) || (num82 == 0f && num83 == 0f)) + { + num82 = (float)player.direction; + num83 = 0f; + num84 = item.shootSpeed; + } + else + { + num84 = item.shootSpeed / num84; + } + num82 *= num84; + num83 *= num84; + float ai4 = Main.rand.NextFloat() * item.shootSpeed * 0.75f * (float)player.direction; + Vector2 velocity = new Vector2(num82, num83); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BansheeHook"), damage, knockBack, player.whoAmI, ai4, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/Polterghast/DaemonsFlame.cs b/Items/Weapons/Polterghast/DaemonsFlame.cs index 79963bc6c3..5c9283fc71 100644 --- a/Items/Weapons/Polterghast/DaemonsFlame.cs +++ b/Items/Weapons/Polterghast/DaemonsFlame.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.Polterghast -{ - public class DaemonsFlame : 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.Weapons.Polterghast +{ + public class DaemonsFlame : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Daemon's Flame"); Tooltip.SetDefault("Shoots daemon flame arrows as well as regular arrows"); } - public override void SetDefaults() - { - item.damage = 160; - item.width = 20; - item.height = 12; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.knockBack = 4f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("DaemonsFlame"); - item.shootSpeed = 20f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - 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("DaemonsFlame"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 160; + item.width = 20; + item.height = 12; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.knockBack = 4f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("DaemonsFlame"); + item.shootSpeed = 20f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + 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("DaemonsFlame"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Polterghast/EtherealSubjugator.cs b/Items/Weapons/Polterghast/EtherealSubjugator.cs index fdf7fdbad3..737c3bbfe3 100644 --- a/Items/Weapons/Polterghast/EtherealSubjugator.cs +++ b/Items/Weapons/Polterghast/EtherealSubjugator.cs @@ -1,83 +1,83 @@ -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.Weapons.Polterghast -{ - public class EtherealSubjugator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ethereal Subjugator"); - Tooltip.SetDefault("Summons a phantom to protect you"); - } - - public override void SetDefaults() - { - item.damage = 75; - item.mana = 10; - item.width = 60; - item.height = 60; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item82; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PhantomGuy"); - item.shootSpeed = 10f; - item.summon = true; - 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) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - 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 *= num80; - num79 *= num80; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Vector2 spinningpoint = new Vector2(num78, num79); - spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default(Vector2)); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, num74, i, 0f, 0f); - return false; - } - } -} \ No newline at end of file +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.Weapons.Polterghast +{ + public class EtherealSubjugator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ethereal Subjugator"); + Tooltip.SetDefault("Summons a phantom to protect you"); + } + + public override void SetDefaults() + { + item.damage = 75; + item.mana = 10; + item.width = 60; + item.height = 60; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 1f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item82; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PhantomGuy"); + item.shootSpeed = 10f; + item.summon = true; + 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) + { + int i = Main.myPlayer; + float num72 = item.shootSpeed; + 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 *= num80; + num79 *= num80; + vector2.X = (float)Main.mouseX + Main.screenPosition.X; + vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + Vector2 spinningpoint = new Vector2(num78, num79); + spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default(Vector2)); + Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, num74, i, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Polterghast/FatesReveal.cs b/Items/Weapons/Polterghast/FatesReveal.cs index b7f78d6df6..4eb58aa044 100644 --- a/Items/Weapons/Polterghast/FatesReveal.cs +++ b/Items/Weapons/Polterghast/FatesReveal.cs @@ -1,76 +1,76 @@ -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.Polterghast -{ - public class FatesReveal : 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.Weapons.Polterghast +{ + public class FatesReveal : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Fate's Reveal"); Tooltip.SetDefault("Spawns ghostly fireballs that follow the player"); Item.staff[item.type] = true; } - - public override void SetDefaults() - { - item.damage = 60; - item.magic = true; - item.mana = 20; - item.width = 68; - item.height = 72; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("FatesReveal"); - item.shootSpeed = 1f; - 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) - { - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector.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 = item.shootSpeed; - } - else - { - num80 = item.shootSpeed / num80; - } - vector += new Vector2(num78, num79); - int num107 = 5; - for (int num108 = 0; num108 < num107; num108++) - { - vector.X = vector.X + (float)Main.rand.Next(-100, 101); - vector.Y += (float)(Main.rand.Next(-25, 26) * num108); - float spawnX = vector.X; - float spawnY = vector.Y; - Projectile.NewProjectile(spawnX, spawnY, 0f, 0f, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - } - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 60; + item.magic = true; + item.mana = 20; + item.width = 68; + item.height = 72; + item.useTime = 16; + item.useAnimation = 16; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("FatesReveal"); + item.shootSpeed = 1f; + 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) + { + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector.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 = item.shootSpeed; + } + else + { + num80 = item.shootSpeed / num80; + } + vector += new Vector2(num78, num79); + int num107 = 5; + for (int num108 = 0; num108 < num107; num108++) + { + vector.X = vector.X + (float)Main.rand.Next(-100, 101); + vector.Y += (float)(Main.rand.Next(-25, 26) * num108); + float spawnX = vector.X; + float spawnY = vector.Y; + Projectile.NewProjectile(spawnX, spawnY, 0f, 0f, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); + } + return false; + } + } +} diff --git a/Items/Weapons/Polterghast/GhastlyVisage.cs b/Items/Weapons/Polterghast/GhastlyVisage.cs index 88d0ee0517..17bcec8856 100644 --- a/Items/Weapons/Polterghast/GhastlyVisage.cs +++ b/Items/Weapons/Polterghast/GhastlyVisage.cs @@ -1,47 +1,47 @@ -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.Polterghast -{ - public class GhastlyVisage : 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.Weapons.Polterghast +{ + public class GhastlyVisage : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ghastly Visage"); Tooltip.SetDefault("Fires homing ghast energy that explodes"); } - public override void SetDefaults() - { - item.damage = 92; - item.magic = true; - item.noUseGraphic = true; - item.channel = true; - item.mana = 20; - item.width = 78; - item.height = 70; - item.useTime = 27; - item.useAnimation = 27; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("GhastlyVisage"); - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhastlyVisage"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 92; + item.magic = true; + item.noUseGraphic = true; + item.channel = true; + item.mana = 20; + item.width = 78; + item.height = 70; + item.useTime = 27; + item.useAnimation = 27; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shootSpeed = 9f; + item.shoot = mod.ProjectileType("GhastlyVisage"); + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("GhastlyVisage"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Polterghast/TerrorBlade.cs b/Items/Weapons/Polterghast/TerrorBlade.cs index 0e4084fe04..6416dea412 100644 --- a/Items/Weapons/Polterghast/TerrorBlade.cs +++ b/Items/Weapons/Polterghast/TerrorBlade.cs @@ -1,48 +1,48 @@ -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.Polterghast -{ - public class TerrorBlade : ModItem - { +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.Polterghast +{ + public class TerrorBlade : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Terror Blade"); - Tooltip.SetDefault("Fires a terror beam that bounces off tiles\n" + + Tooltip.SetDefault("Fires a terror beam that bounces off tiles\n" + "On every bounce it emits an explosion"); } - public override void SetDefaults() - { - item.width = 88; - item.damage = 250; - item.melee = true; - item.useAnimation = 18; - item.useTime = 18; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 80; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("TerrorBeam"); - item.shootSpeed = 20f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - 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, 60); - } - } - } -} + public override void SetDefaults() + { + item.width = 88; + item.damage = 250; + item.melee = true; + item.useAnimation = 18; + item.useTime = 18; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 80; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("TerrorBeam"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + 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, 60); + } + } + } +} diff --git a/Items/Weapons/PrimordialAncient.cs b/Items/Weapons/PrimordialAncient.cs index dd24abd480..100423e87e 100644 --- a/Items/Weapons/PrimordialAncient.cs +++ b/Items/Weapons/PrimordialAncient.cs @@ -1,54 +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; - -namespace CalamityMod.Items.Weapons -{ - public class PrimordialAncient : 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.Weapons +{ + public class PrimordialAncient : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Primordial Ancient"); - Tooltip.SetDefault("An ancient relic from an ancient land\n" + + Tooltip.SetDefault("An ancient relic from an ancient land\n" + "Casts a gigantic blast of dust"); } - public override void SetDefaults() - { - item.damage = 385; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 30; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Ancient"); - item.shootSpeed = 8f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PrimordialEarth"); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 10); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 385; + item.magic = true; + item.mana = 20; + item.width = 28; + item.height = 30; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Ancient"); + item.shootSpeed = 8f; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PrimordialEarth"); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 10); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/PrimordialEarth.cs b/Items/Weapons/PrimordialEarth.cs index c5f449420b..15de7de74e 100644 --- a/Items/Weapons/PrimordialEarth.cs +++ b/Items/Weapons/PrimordialEarth.cs @@ -1,52 +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.Weapons -{ - public class PrimordialEarth : 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.Weapons +{ + public class PrimordialEarth : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Primordial Earth"); Tooltip.SetDefault("Casts a large blast of dust"); } - public override void SetDefaults() - { - item.damage = 85; - item.magic = true; - item.mana = 19; - item.width = 28; - item.height = 30; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SupremeDustProjectile"); - item.shootSpeed = 4f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DeathValley"); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 3); - recipe.AddIngredient(ItemID.MeteoriteBar, 5); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 85; + item.magic = true; + item.mana = 19; + item.width = 28; + item.height = 30; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SupremeDustProjectile"); + item.shootSpeed = 4f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DeathValley"); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 3); + recipe.AddIngredient(ItemID.MeteoriteBar, 5); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ProfanedSword.cs b/Items/Weapons/ProfanedSword.cs index 14a2ee8a3a..ac9a9b28d2 100644 --- a/Items/Weapons/ProfanedSword.cs +++ b/Items/Weapons/ProfanedSword.cs @@ -1,92 +1,92 @@ -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 ProfanedSword : 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.Weapons +{ + public class ProfanedSword : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Sword"); - Tooltip.SetDefault("Summons brimstone geysers on enemy hits\n" + + Tooltip.SetDefault("Summons brimstone geysers on enemy hits\n" + "Right click to throw like a javelin"); } - public override void SetDefaults() - { - item.damage = 61; - item.melee = true; - item.width = 42; - item.height = 50; - item.useTime = 23; - item.useAnimation = 23; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shoot = mod.ProjectileType("NobodyKnows"); - item.shootSpeed = 20f; - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.noMelee = true; - item.noUseGraphic = true; - } - else - { - item.noMelee = false; - item.noUseGraphic = false; - } - 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("ProfanedSword"), 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("BrimstoneFlames"), 120); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Brimblast"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 235); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UnholyCore", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 61; + item.melee = true; + item.width = 42; + item.height = 50; + item.useTime = 23; + item.useAnimation = 23; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7.5f; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.shoot = mod.ProjectileType("NobodyKnows"); + item.shootSpeed = 20f; + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.noMelee = true; + item.noUseGraphic = true; + } + else + { + item.noMelee = false; + item.noUseGraphic = false; + } + 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("ProfanedSword"), 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("BrimstoneFlames"), 120); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Brimblast"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 235); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UnholyCore", 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ProporsePistol.cs b/Items/Weapons/ProporsePistol.cs index 00ba463d07..b8c590d89d 100644 --- a/Items/Weapons/ProporsePistol.cs +++ b/Items/Weapons/ProporsePistol.cs @@ -1,46 +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 -{ - public class ProporsePistol : 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.Weapons +{ + public class ProporsePistol : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Proporse Pistol"); Tooltip.SetDefault("Fires a blue energy blast that bounces"); } - public override void SetDefaults() - { - item.damage = 65; - item.ranged = true; - item.width = 36; - item.height = 20; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item33; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("ProBolt"); - item.useAmmo = 97; - } - - 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("ProBolt"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 65; + item.ranged = true; + item.width = 36; + item.height = 20; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("ProBolt"); + item.useAmmo = 97; + } + + 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("ProBolt"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Providence/BlissfulBombardier.cs b/Items/Weapons/Providence/BlissfulBombardier.cs index cb04b4a668..60537e7a01 100644 --- a/Items/Weapons/Providence/BlissfulBombardier.cs +++ b/Items/Weapons/Providence/BlissfulBombardier.cs @@ -1,52 +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.Weapons.Providence -{ - public class BlissfulBombardier : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blissful Bombardier"); - Tooltip.SetDefault("Fires flare rockets"); - } - - public override void SetDefaults() - { - item.damage = 62; - item.ranged = true; - item.width = 76; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("Nuke"); - item.useAmmo = 771; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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("Nuke"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file +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.Providence +{ + public class BlissfulBombardier : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blissful Bombardier"); + Tooltip.SetDefault("Fires flare rockets"); + } + + public override void SetDefaults() + { + item.damage = 62; + item.ranged = true; + item.width = 76; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("Nuke"); + item.useAmmo = 771; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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("Nuke"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Providence/HolyCollider.cs b/Items/Weapons/Providence/HolyCollider.cs index 556a26cd7f..e8a4ac26bd 100644 --- a/Items/Weapons/Providence/HolyCollider.cs +++ b/Items/Weapons/Providence/HolyCollider.cs @@ -1,54 +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; - -namespace CalamityMod.Items.Weapons.Providence -{ - public class HolyCollider : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Collider"); - Tooltip.SetDefault("Striking enemies will cause them to explode into holy fire"); - } - - public override void SetDefaults() - { - item.width = 94; - item.damage = 400; - item.melee = true; - item.useAnimation = 22; - item.useStyle = 1; - item.useTime = 22; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 80; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shootSpeed = 10f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - 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(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyColliderHolyFire"), (int)((double)((float)item.damage * player.meleeDamage) * 0.3), knockback, Main.myPlayer); - Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyColliderHolyFire"), (int)((double)((float)item.damage * player.meleeDamage) * 0.3), knockback, Main.myPlayer); - } - } - } -} +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.Providence +{ + public class HolyCollider : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Collider"); + Tooltip.SetDefault("Striking enemies will cause them to explode into holy fire"); + } + + public override void SetDefaults() + { + item.width = 94; + item.damage = 400; + item.melee = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.useTurn = true; + item.knockBack = 7.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 80; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shootSpeed = 10f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - 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(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyColliderHolyFire"), (int)((double)((float)item.damage * player.meleeDamage) * 0.3), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyColliderHolyFire"), (int)((double)((float)item.damage * player.meleeDamage) * 0.3), knockback, Main.myPlayer); + } + } + } +} diff --git a/Items/Weapons/Providence/PurgeGuzzler.cs b/Items/Weapons/Providence/PurgeGuzzler.cs index 4b4ea89786..3c9cec2d82 100644 --- a/Items/Weapons/Providence/PurgeGuzzler.cs +++ b/Items/Weapons/Providence/PurgeGuzzler.cs @@ -1,53 +1,53 @@ -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.Providence -{ - public class PurgeGuzzler : 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.Weapons.Providence +{ + public class PurgeGuzzler : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Purge Guzzler"); Tooltip.SetDefault("Fires three beams of holy energy"); } - - public override void SetDefaults() - { - item.damage = 80; - item.magic = true; - item.mana = 12; - item.width = 58; - item.height = 44; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.5f; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("HolyLaser"); - item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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(4); - 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, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 80; + item.magic = true; + item.mana = 12; + item.width = 58; + item.height = 44; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("HolyLaser"); + item.shootSpeed = 6f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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(4); + 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, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Providence/SolarFlare.cs b/Items/Weapons/Providence/SolarFlare.cs index 50c8cbc0a5..18715611c8 100644 --- a/Items/Weapons/Providence/SolarFlare.cs +++ b/Items/Weapons/Providence/SolarFlare.cs @@ -1,37 +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.Weapons.Providence -{ - public class SolarFlare : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Solar Flare"); - Tooltip.SetDefault("Emits large holy explosions on enemy hits"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 60; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SolarFlareYoyo"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - } -} \ No newline at end of file +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.Providence +{ + public class SolarFlare : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Solar Flare"); + Tooltip.SetDefault("Emits large holy explosions on enemy hits"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.damage = 60; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SolarFlareYoyo"); + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + } +} diff --git a/Items/Weapons/Providence/TelluricGlare.cs b/Items/Weapons/Providence/TelluricGlare.cs index 58a34fc770..486b1c8560 100644 --- a/Items/Weapons/Providence/TelluricGlare.cs +++ b/Items/Weapons/Providence/TelluricGlare.cs @@ -1,47 +1,47 @@ -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.Providence -{ - public class TelluricGlare : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Telluric Glare"); - Tooltip.SetDefault("Shoots an extremely fast energy arrow"); - } - - public override void SetDefaults() - { - item.damage = 70; - item.ranged = true; - item.width = 54; - item.height = 92; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TelluricGlare"); - item.shootSpeed = 12f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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, 0f, 0f); - return false; - } - } -} \ No newline at end of file +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.Providence +{ + public class TelluricGlare : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Telluric Glare"); + Tooltip.SetDefault("Shoots an extremely fast energy arrow"); + } + + public override void SetDefaults() + { + item.damage = 70; + item.ranged = true; + item.width = 54; + item.height = 92; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TelluricGlare"); + item.shootSpeed = 12f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Pumpler.cs b/Items/Weapons/Pumpler.cs index 720bc8f037..046a67b407 100644 --- a/Items/Weapons/Pumpler.cs +++ b/Items/Weapons/Pumpler.cs @@ -1,103 +1,103 @@ -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 Pumpler : 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.Weapons +{ + public class Pumpler : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Pumpler"); - Tooltip.SetDefault("33% chance to not consume ammo\n" + + Tooltip.SetDefault("33% chance to not consume ammo\n" + "Right click to fire an explosive pumpkin"); } - public override void SetDefaults() - { - item.damage = 9; - item.ranged = true; - item.width = 50; - item.height = 28; - item.useTime = 9; - item.useAnimation = 9; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.25f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 11f; - item.useAmmo = 97; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 36; - item.useAnimation = 36; - item.shootSpeed = 4f; - } - else - { - item.useTime = 9; - item.useAnimation = 9; - item.shootSpeed = 11f; - } - 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) - { - 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, ProjectileID.JackOLantern, (int)((double)damage * 1.65), knockBack * 4f, player.whoAmI, 0f, 0f); - } - else - { - 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, 0f, 0f); - } - return false; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 33) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pumpkin, 30); - recipe.AddIngredient(ItemID.PumpkinSeed, 5); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 9; + item.ranged = true; + item.width = 50; + item.height = 28; + item.useTime = 9; + item.useAnimation = 9; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.25f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 11f; + item.useAmmo = 97; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 36; + item.useAnimation = 36; + item.shootSpeed = 4f; + } + else + { + item.useTime = 9; + item.useAnimation = 9; + item.shootSpeed = 11f; + } + 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) + { + 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, ProjectileID.JackOLantern, (int)((double)damage * 1.65), knockBack * 4f, player.whoAmI, 0f, 0f); + } + else + { + 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, 0f, 0f); + } + return false; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 33) + return false; + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Pumpkin, 30); + recipe.AddIngredient(ItemID.PumpkinSeed, 5); + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Purge.cs b/Items/Weapons/Purge.cs index 59b9f66bcd..dcc511a4da 100644 --- a/Items/Weapons/Purge.cs +++ b/Items/Weapons/Purge.cs @@ -1,58 +1,58 @@ -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 Purge : 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.Weapons +{ + public class Purge : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Nano Purge"); Tooltip.SetDefault("Fires a barrage of nano lasers"); } - public override void SetDefaults() - { - item.damage = 70; - item.magic = true; - item.mana = 6; - item.width = 20; - item.height = 12; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Purge"); - item.shootSpeed = 24f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddIngredient(ItemID.LaserMachinegun); - recipe.AddIngredient(ItemID.Nanites, 100); - recipe.AddTile(TileID.LunarCraftingStation); - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Purge"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 70; + item.magic = true; + item.mana = 6; + item.width = 20; + item.height = 12; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Purge"); + item.shootSpeed = 24f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FragmentVortex, 20); + recipe.AddIngredient(ItemID.LaserMachinegun); + recipe.AddIngredient(ItemID.Nanites, 100); + recipe.AddTile(TileID.LunarCraftingStation); + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Purge"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/PwnagehammerMelee.cs b/Items/Weapons/PwnagehammerMelee.cs index 10cf495639..1adb52d880 100644 --- a/Items/Weapons/PwnagehammerMelee.cs +++ b/Items/Weapons/PwnagehammerMelee.cs @@ -1,53 +1,53 @@ -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 PwnagehammerMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pwnagehammer"); - Tooltip.SetDefault("Throws an extremely fast hammer"); - } - - public override void SetDefaults() - { - item.width = 68; - item.damage = 90; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 10f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 68; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = mod.ProjectileType("PwnagehammerMelee"); - item.shootSpeed = 12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pwnhammer); - recipe.AddIngredient(ItemID.HallowedBar, 7); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - 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.Weapons +{ + public class PwnagehammerMelee : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pwnagehammer"); + Tooltip.SetDefault("Throws an extremely fast hammer"); + } + + public override void SetDefaults() + { + item.width = 68; + item.damage = 90; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 10f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 68; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.shoot = mod.ProjectileType("PwnagehammerMelee"); + item.shootSpeed = 12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Pwnhammer); + recipe.AddIngredient(ItemID.HallowedBar, 7); + recipe.AddIngredient(ItemID.SoulofMight, 3); + recipe.AddIngredient(ItemID.SoulofSight, 3); + recipe.AddIngredient(ItemID.SoulofFright, 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Quagmire.cs b/Items/Weapons/Quagmire.cs index 9e900c78b6..e8c039da80 100644 --- a/Items/Weapons/Quagmire.cs +++ b/Items/Weapons/Quagmire.cs @@ -1,45 +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.Weapons -{ - public class Quagmire : 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.Weapons +{ + public class Quagmire : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Quagmire"); Tooltip.SetDefault("Fires spore clouds"); } - public override void SetDefaults() - { - item.CloneDefaults(ItemID.HelFire); - item.damage = 52; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.autoReuse = true; - item.shoot = mod.ProjectileType("QuagmireProjectile"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "DraedonBar", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.CloneDefaults(ItemID.HelFire); + item.damage = 52; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.autoReuse = true; + item.shoot = mod.ProjectileType("QuagmireProjectile"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "DraedonBar", 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/RaidersGlory.cs b/Items/Weapons/RaidersGlory.cs index 088eb96d51..238eebea07 100644 --- a/Items/Weapons/RaidersGlory.cs +++ b/Items/Weapons/RaidersGlory.cs @@ -1,48 +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 -{ - public class RaidersGlory : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Raider's Glory"); - Tooltip.SetDefault("Fires ichor arrows"); - } - - public override void SetDefaults() - { - item.damage = 40; - item.ranged = true; - item.crit += 10; - item.width = 58; - item.height = 22; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 15f; - item.useAmmo = 40; - } - - 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 projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.IchorArrow, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[projectile].extraUpdates++; - return false; - } - } -} \ No newline at end of file +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 RaidersGlory : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Raider's Glory"); + Tooltip.SetDefault("Fires ichor arrows"); + } + + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.crit += 10; + item.width = 58; + item.height = 22; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 15f; + item.useAmmo = 40; + } + + 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 projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.IchorArrow, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[projectile].extraUpdates++; + return false; + } + } +} diff --git a/Items/Weapons/RareVariants/Arbalest.cs b/Items/Weapons/RareVariants/Arbalest.cs index 46c404471e..b2ec51d4c4 100644 --- a/Items/Weapons/RareVariants/Arbalest.cs +++ b/Items/Weapons/RareVariants/Arbalest.cs @@ -54,4 +54,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/ClothiersWrath.cs b/Items/Weapons/RareVariants/ClothiersWrath.cs index 4cf8f477ab..d5d97ebaf2 100644 --- a/Items/Weapons/RareVariants/ClothiersWrath.cs +++ b/Items/Weapons/RareVariants/ClothiersWrath.cs @@ -51,4 +51,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/Cryophobia.cs b/Items/Weapons/RareVariants/Cryophobia.cs index 69af187671..c2d7f5749f 100644 --- a/Items/Weapons/RareVariants/Cryophobia.cs +++ b/Items/Weapons/RareVariants/Cryophobia.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return new Vector2(-10, 0); } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/Hellborn.cs b/Items/Weapons/RareVariants/Hellborn.cs index c661d1178b..15829005cf 100644 --- a/Items/Weapons/RareVariants/Hellborn.cs +++ b/Items/Weapons/RareVariants/Hellborn.cs @@ -61,4 +61,4 @@ namespace CalamityMod.Items.Weapons.RareVariants target.AddBuff(BuffID.OnFire, 400); } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/Infinity.cs b/Items/Weapons/RareVariants/Infinity.cs index 4a961637ce..c108957758 100644 --- a/Items/Weapons/RareVariants/Infinity.cs +++ b/Items/Weapons/RareVariants/Infinity.cs @@ -82,4 +82,4 @@ namespace CalamityMod.Items.Weapons.RareVariants } } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/LeadWizard.cs b/Items/Weapons/RareVariants/LeadWizard.cs index 85bbf10e3e..0954ba0cc2 100644 --- a/Items/Weapons/RareVariants/LeadWizard.cs +++ b/Items/Weapons/RareVariants/LeadWizard.cs @@ -62,4 +62,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return true; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/Norfleet.cs b/Items/Weapons/RareVariants/Norfleet.cs index 66d84d95bb..d7d8e23735 100644 --- a/Items/Weapons/RareVariants/Norfleet.cs +++ b/Items/Weapons/RareVariants/Norfleet.cs @@ -53,4 +53,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/PearlGod.cs b/Items/Weapons/RareVariants/PearlGod.cs index 0ce9e6f38f..ca07678beb 100644 --- a/Items/Weapons/RareVariants/PearlGod.cs +++ b/Items/Weapons/RareVariants/PearlGod.cs @@ -54,4 +54,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/Skullmasher.cs b/Items/Weapons/RareVariants/Skullmasher.cs index 0c6e41f6e4..2d52c20771 100644 --- a/Items/Weapons/RareVariants/Skullmasher.cs +++ b/Items/Weapons/RareVariants/Skullmasher.cs @@ -56,4 +56,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/ThornBlossom.cs b/Items/Weapons/RareVariants/ThornBlossom.cs index bb968093c4..c0e1d81384 100644 --- a/Items/Weapons/RareVariants/ThornBlossom.cs +++ b/Items/Weapons/RareVariants/ThornBlossom.cs @@ -56,4 +56,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/Thunderstorm.cs b/Items/Weapons/RareVariants/Thunderstorm.cs index 7e508ecd0b..ec3f69270e 100644 --- a/Items/Weapons/RareVariants/Thunderstorm.cs +++ b/Items/Weapons/RareVariants/Thunderstorm.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return new Vector2(-10, 0); } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/TrueConferenceCall.cs b/Items/Weapons/RareVariants/TrueConferenceCall.cs index ec7eccf04e..6205617381 100644 --- a/Items/Weapons/RareVariants/TrueConferenceCall.cs +++ b/Items/Weapons/RareVariants/TrueConferenceCall.cs @@ -102,4 +102,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RareVariants/VoidVortex.cs b/Items/Weapons/RareVariants/VoidVortex.cs index c2d6ae03d1..94134079ce 100644 --- a/Items/Weapons/RareVariants/VoidVortex.cs +++ b/Items/Weapons/RareVariants/VoidVortex.cs @@ -78,4 +78,4 @@ namespace CalamityMod.Items.Weapons.RareVariants return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/Ravager/Hematemesis.cs b/Items/Weapons/Ravager/Hematemesis.cs index 699bf25d14..2090ccaa75 100644 --- a/Items/Weapons/Ravager/Hematemesis.cs +++ b/Items/Weapons/Ravager/Hematemesis.cs @@ -1,16 +1,16 @@ -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 Hematemesis : 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.Weapons.Ravager +{ + public class Hematemesis : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Hematemesis"); @@ -18,33 +18,33 @@ namespace CalamityMod.Items.Weapons.Ravager Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 125; - item.magic = true; - item.mana = 14; - item.rare = 8; - item.width = 48; - item.height = 54; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.75f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.UseSound = SoundID.Item21; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BloodBlast"); - item.shootSpeed = 10f; - } - - 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 x = 0; x < 10; x++) - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-150, 150), player.position.Y + 600f, 0f, -10f, type, damage, knockBack, Main.myPlayer, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 125; + item.magic = true; + item.mana = 14; + item.rare = 8; + item.width = 48; + item.height = 54; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.75f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.UseSound = SoundID.Item21; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BloodBlast"); + item.shootSpeed = 10f; + } + + 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 x = 0; x < 10; x++) + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-150, 150), player.position.Y + 600f, 0f, -10f, type, damage, knockBack, Main.myPlayer, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Ravager/RealmRavager.cs b/Items/Weapons/Ravager/RealmRavager.cs index 8846c7bd50..72ae85bf02 100644 --- a/Items/Weapons/Ravager/RealmRavager.cs +++ b/Items/Weapons/Ravager/RealmRavager.cs @@ -53,4 +53,4 @@ namespace CalamityMod.Items.Weapons.Ravager return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/Ravager/SpikecragStaff.cs b/Items/Weapons/Ravager/SpikecragStaff.cs index 145f97c205..c7b1002f58 100644 --- a/Items/Weapons/Ravager/SpikecragStaff.cs +++ b/Items/Weapons/Ravager/SpikecragStaff.cs @@ -63,4 +63,4 @@ namespace CalamityMod.Items.Weapons.Ravager return base.UseItem(player); } } -} \ No newline at end of file +} diff --git a/Items/Weapons/Ravager/UltimusCleaver.cs b/Items/Weapons/Ravager/UltimusCleaver.cs index c1f0b84c9d..286b8feb7f 100644 --- a/Items/Weapons/Ravager/UltimusCleaver.cs +++ b/Items/Weapons/Ravager/UltimusCleaver.cs @@ -64,4 +64,4 @@ namespace CalamityMod.Items.Weapons.Ravager return false; } } -} \ No newline at end of file +} diff --git a/Items/Weapons/RedSun.cs b/Items/Weapons/RedSun.cs index 2c4bea2ac0..8a3cb4fc76 100644 --- a/Items/Weapons/RedSun.cs +++ b/Items/Weapons/RedSun.cs @@ -1,120 +1,120 @@ -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 RedSun : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Sun"); - Tooltip.SetDefault("Over paradise\n" + - "Drops a barrage of solar flares from the sky"); - } - - public override void SetDefaults() - { - item.width = 72; - item.damage = 2000; - item.melee = true; - item.useTime = 5; - item.reuseDelay = 20; - item.useAnimation = 30; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 4; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("SolarFlare"); - item.shootSpeed = 15f; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AntlionClaw); - recipe.AddIngredient(null, "ForsakenSaber"); - recipe.AddIngredient(null, "CoreofCinder", 5); - recipe.AddIngredient(null, "ShadowspecBar", 5); - 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); - 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 *= num80; - num79 *= num80; - int num107 = 3; - 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)Main.rand.Next(-1000, 1001) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-1000, 1001) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("SolarFlare"), (int)((double)damage * 0.7), knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - return false; - } - - 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, 64); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - } - } -} +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 RedSun : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Sun"); + Tooltip.SetDefault("Over paradise\n" + + "Drops a barrage of solar flares from the sky"); + } + + public override void SetDefaults() + { + item.width = 72; + item.damage = 2000; + item.melee = true; + item.useTime = 5; + item.reuseDelay = 20; + item.useAnimation = 30; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 4; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 72; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("SolarFlare"); + item.shootSpeed = 15f; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AntlionClaw); + recipe.AddIngredient(null, "ForsakenSaber"); + recipe.AddIngredient(null, "CoreofCinder", 5); + recipe.AddIngredient(null, "ShadowspecBar", 5); + 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); + 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 *= num80; + num79 *= num80; + int num107 = 3; + 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)Main.rand.Next(-1000, 1001) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-1000, 1001) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("SolarFlare"), (int)((double)damage * 0.7), knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); + } + return false; + } + + 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, 64); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + } + } +} diff --git a/Items/Weapons/RedtideSword.cs b/Items/Weapons/RedtideSword.cs index 95b488243a..f1f16660eb 100644 --- a/Items/Weapons/RedtideSword.cs +++ b/Items/Weapons/RedtideSword.cs @@ -1,54 +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; - -namespace CalamityMod.Items.Weapons -{ - public class RedtideSword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Redtide Sword"); - Tooltip.SetDefault("Throws short-range whirlpools"); - } - - public override void SetDefaults() - { - item.width = 42; - item.damage = 20; - item.melee = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.useTurn = true; - item.knockBack = 4; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 42; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("Whirlpool"); - item.shootSpeed = 6f; - } - - 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); - recipe.AddTile(TileID.Anvils); - 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.Weapons +{ + public class RedtideSword : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Redtide Sword"); + Tooltip.SetDefault("Throws short-range whirlpools"); + } + + public override void SetDefaults() + { + item.width = 42; + item.damage = 20; + item.melee = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.useTurn = true; + item.knockBack = 4; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 42; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("Whirlpool"); + item.shootSpeed = 6f; + } + + 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); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/RelicofRuin.cs b/Items/Weapons/RelicofRuin.cs index f376a6cb9f..a40f6b9151 100644 --- a/Items/Weapons/RelicofRuin.cs +++ b/Items/Weapons/RelicofRuin.cs @@ -1,66 +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 -{ - public class RelicofRuin : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Relic of Ruin"); - Tooltip.SetDefault("Casts a spread of sand blades"); - } - - public override void SetDefaults() - { - item.damage = 36; - item.magic = true; - item.mana = 16; - item.width = 28; - item.height = 32; - item.useTime = 35; - item.useAnimation = 35; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4.25f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item84; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ForbiddenAxeBlade"); - item.shootSpeed = 30f; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float spread = 22.5f * 0.0174f; - double startAngle = Math.Atan2(speedX, speedY) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 8; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(position.X, position.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, Main.myPlayer); - Projectile.NewProjectile(position.X, position.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, Main.myPlayer); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.SpellTome); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 RelicofRuin : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Relic of Ruin"); + Tooltip.SetDefault("Casts a spread of sand blades"); + } + + public override void SetDefaults() + { + item.damage = 36; + item.magic = true; + item.mana = 16; + item.width = 28; + item.height = 32; + item.useTime = 35; + item.useAnimation = 35; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.25f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item84; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ForbiddenAxeBlade"); + item.shootSpeed = 30f; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float spread = 22.5f * 0.0174f; + double startAngle = Math.Atan2(speedX, speedY) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(position.X, position.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, Main.myPlayer); + Projectile.NewProjectile(position.X, position.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, Main.myPlayer); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.SpellTome); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/RoyalKnivesMelee.cs b/Items/Weapons/RoyalKnivesMelee.cs index 04ac7f8e50..73619f9f6b 100644 --- a/Items/Weapons/RoyalKnivesMelee.cs +++ b/Items/Weapons/RoyalKnivesMelee.cs @@ -1,113 +1,113 @@ -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 RoyalKnivesMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Illustrious Knives"); - Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user"); - } - - public override void SetDefaults() - { - item.width = 18; - item.damage = 1600; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = 1; - item.useTime = 12; - item.knockBack = 3f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("RoyalKnifeMelee"); - item.shootSpeed = 9f; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - 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 *= num80; - num79 *= num80; - int num146 = 4; - if (Main.rand.Next(2) == 0) - { - num146++; - } - if (Main.rand.Next(4) == 0) - { - num146++; - } - if (Main.rand.Next(8) == 0) - { - num146++; - } - if (Main.rand.Next(16) == 0) - { - num146++; - } - for (int num147 = 0; num147 < num146; num147++) - { - float num148 = num78; - float num149 = num79; - float num150 = 0.05f * (float)num147; - num148 += (float)Main.rand.Next(-35, 36) * num150; - num149 += (float)Main.rand.Next(-35, 36) * num150; - num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); - num80 = num72 / num80; - num148 *= num80; - num149 *= num80; - float x4 = vector2.X; - float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, mod.ProjectileType("RoyalKnifeMelee"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(null, "CoreofCalamity", 3); - recipe.AddIngredient(null, "EmpyreanKnives"); - recipe.AddTile(null, "DraedonsForge"); - 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.Weapons +{ + public class RoyalKnivesMelee : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Illustrious Knives"); + Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user"); + } + + public override void SetDefaults() + { + item.width = 18; + item.damage = 1600; + item.melee = true; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 3f; + item.UseSound = SoundID.Item39; + item.autoReuse = true; + item.height = 20; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("RoyalKnifeMelee"); + item.shootSpeed = 9f; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + 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 *= num80; + num79 *= num80; + int num146 = 4; + if (Main.rand.Next(2) == 0) + { + num146++; + } + if (Main.rand.Next(4) == 0) + { + num146++; + } + if (Main.rand.Next(8) == 0) + { + num146++; + } + if (Main.rand.Next(16) == 0) + { + num146++; + } + for (int num147 = 0; num147 < num146; num147++) + { + float num148 = num78; + float num149 = num79; + float num150 = 0.05f * (float)num147; + num148 += (float)Main.rand.Next(-35, 36) * num150; + num149 += (float)Main.rand.Next(-35, 36) * num150; + num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); + num80 = num72 / num80; + num148 *= num80; + num149 *= num80; + float x4 = vector2.X; + float y4 = vector2.Y; + Projectile.NewProjectile(x4, y4, num148, num149, mod.ProjectileType("RoyalKnifeMelee"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(null, "CoreofCalamity", 3); + recipe.AddIngredient(null, "EmpyreanKnives"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/RubberMortarRound.cs b/Items/Weapons/RubberMortarRound.cs index 6f3bed2c71..50e4333c9a 100644 --- a/Items/Weapons/RubberMortarRound.cs +++ b/Items/Weapons/RubberMortarRound.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class RubberMortarRound : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class RubberMortarRound : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Rubber Mortar Round"); - Tooltip.SetDefault("Large blast radius\n" + - "Will destroy tiles on each bounce\n" + + Tooltip.SetDefault("Large blast radius\n" + + "Will destroy tiles on each bounce\n" + "Used by normal guns"); } - public override void SetDefaults() - { - item.damage = 25; - item.ranged = true; - item.width = 20; - item.height = 14; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 7.5f; - item.value = 1000; - item.rare = 5; - item.ammo = 97; - item.shoot = mod.ProjectileType("RubberMortarRound"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MortarRound", 100); - recipe.AddIngredient(ItemID.PinkGel, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.width = 20; + item.height = 14; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 7.5f; + item.value = 1000; + item.rare = 5; + item.ammo = 97; + item.shoot = mod.ProjectileType("RubberMortarRound"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MortarRound", 100); + recipe.AddIngredient(ItemID.PinkGel, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SDFMG.cs b/Items/Weapons/SDFMG.cs index fb8767c777..38db7a09df 100644 --- a/Items/Weapons/SDFMG.cs +++ b/Items/Weapons/SDFMG.cs @@ -1,77 +1,77 @@ -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 SDFMG : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("SDFMG"); - Tooltip.SetDefault("It came from the edge of Terraria\n" + - "50% chance to not consume ammo"); - } - - public override void SetDefaults() - { - item.damage = 250; - item.ranged = true; - item.width = 74; - item.height = 34; - item.crit += 16; - item.useTime = 2; - item.useAnimation = 4; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 97; - 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 SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; - if (Main.rand.Next(5) == 0) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("FishronRPG"), damage, knockBack, player.whoAmI, 0f, 0f); - } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SDMG); - recipe.AddIngredient(ItemID.ShrimpyTruffle); - recipe.AddIngredient(null, "CosmiliteBar", 4); - recipe.AddIngredient(null, "Phantoplasm", 4); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 SDFMG : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("SDFMG"); + Tooltip.SetDefault("It came from the edge of Terraria\n" + + "50% chance to not consume ammo"); + } + + public override void SetDefaults() + { + item.damage = 250; + item.ranged = true; + item.width = 74; + item.height = 34; + item.crit += 16; + item.useTime = 2; + item.useAnimation = 4; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.75f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 97; + 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 SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; + if (Main.rand.Next(5) == 0) + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("FishronRPG"), damage, knockBack, player.whoAmI, 0f, 0f); + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SDMG); + recipe.AddIngredient(ItemID.ShrimpyTruffle); + recipe.AddIngredient(null, "CosmiliteBar", 4); + recipe.AddIngredient(null, "Phantoplasm", 4); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SHPC.cs b/Items/Weapons/SHPC.cs index 5fc21bf347..1c06cf60ca 100644 --- a/Items/Weapons/SHPC.cs +++ b/Items/Weapons/SHPC.cs @@ -1,97 +1,97 @@ -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 SHPC : 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.Weapons +{ + public class SHPC : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("SHPC"); Tooltip.SetDefault("Legendary Drop\n" + "Fires plasma orbs that linger and emit massive explosions\n" + - "Right click to fire powerful energy beams\n" + + "Right click to fire powerful energy beams\n" + "Revengeance drop"); } - public override void SetDefaults() - { - item.damage = 18; - item.magic = true; - item.mana = 20; - item.width = 96; - item.height = 34; - item.useTime = 50; - item.useAnimation = 50; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; - item.rare = 5; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SHPB"); - item.shootSpeed = 20f; - item.GetGlobalItem(mod).postMoonLordRarity = 17; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 7; - item.useAnimation = 7; - item.mana = 6; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - } - else - { - item.useTime = 50; - item.useAnimation = 50; - item.mana = 20; - item.UseSound = SoundID.Item92; - } - return base.CanUseItem(player); - } - - public override 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) - { - for (int shootAmt = 0; shootAmt < 3; shootAmt++) - { - float SpeedX = speedX + (float) Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SHPL"), damage, (knockBack * 0.5f), player.whoAmI, 0.0f, 0.0f); - } - return false; - } - else - { - for (int shootAmt = 0; shootAmt < 3; shootAmt++) - { - 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, mod.ProjectileType("SHPB"), (int)((double)damage * 1.1), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 18; + item.magic = true; + item.mana = 20; + item.width = 96; + item.height = 34; + item.useTime = 50; + item.useAnimation = 50; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; + item.rare = 5; + item.value = Item.buyPrice(0, 36, 0, 0); + item.UseSound = SoundID.Item92; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SHPB"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).postMoonLordRarity = 17; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-25, 0); + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 7; + item.useAnimation = 7; + item.mana = 6; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + } + else + { + item.useTime = 50; + item.useAnimation = 50; + item.mana = 20; + item.UseSound = SoundID.Item92; + } + return base.CanUseItem(player); + } + + public override 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) + { + for (int shootAmt = 0; shootAmt < 3; shootAmt++) + { + float SpeedX = speedX + (float) Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SHPL"), damage, (knockBack * 0.5f), player.whoAmI, 0.0f, 0.0f); + } + return false; + } + else + { + for (int shootAmt = 0; shootAmt < 3; shootAmt++) + { + 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, mod.ProjectileType("SHPB"), (int)((double)damage * 1.1), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } + } +} diff --git a/Items/Weapons/SanguineFlare.cs b/Items/Weapons/SanguineFlare.cs index 04f45a4d0a..9c8a7cbfb2 100644 --- a/Items/Weapons/SanguineFlare.cs +++ b/Items/Weapons/SanguineFlare.cs @@ -1,16 +1,16 @@ -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 SanguineFlare : 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.Weapons +{ + public class SanguineFlare : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Sanguine Flare"); @@ -18,46 +18,46 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 220; - item.magic = true; - item.mana = 22; - item.width = 56; - item.height = 60; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SanguineFlare"); - item.shootSpeed = 14f; - 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) - { - int num6 = Main.rand.Next(6, 9); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 220; + item.magic = true; + item.mana = 22; + item.width = 56; + item.height = 60; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SanguineFlare"); + item.shootSpeed = 14f; + 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) + { + int num6 = Main.rand.Next(6, 9); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float) Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Scorpion.cs b/Items/Weapons/Scorpion.cs index bf5bd1c6fb..e830581282 100644 --- a/Items/Weapons/Scorpion.cs +++ b/Items/Weapons/Scorpion.cs @@ -1,87 +1,87 @@ -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 Scorpion : 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.Weapons +{ + public class Scorpion : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Scorpio"); - Tooltip.SetDefault("BOOM\n" + + Tooltip.SetDefault("BOOM\n" + "Right click to fire a nuke"); } - public override void SetDefaults() - { - item.damage = 95; - item.ranged = true; - item.width = 58; - item.height = 26; - item.useTime = 13; - item.useAnimation = 13; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.5f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("MiniRocket"); - item.useAmmo = 771; - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 39; - item.useAnimation = 39; - } - else - { - item.useTime = 13; - item.useAnimation = 13; - } - 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("BigNuke"), (int)((double)damage * 3.0), knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MiniRocket"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SnowmanCannon); - recipe.AddIngredient(ItemID.GrenadeLauncher); - recipe.AddIngredient(ItemID.RocketLauncher); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 95; + item.ranged = true; + item.width = 58; + item.height = 26; + item.useTime = 13; + item.useAnimation = 13; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.5f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("MiniRocket"); + item.useAmmo = 771; + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.useTime = 39; + item.useAnimation = 39; + } + else + { + item.useTime = 13; + item.useAnimation = 13; + } + 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("BigNuke"), (int)((double)damage * 3.0), knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("MiniRocket"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SnowmanCannon); + recipe.AddIngredient(ItemID.GrenadeLauncher); + recipe.AddIngredient(ItemID.RocketLauncher); + recipe.AddIngredient(ItemID.FragmentVortex, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ScourgeoftheCosmos.cs b/Items/Weapons/ScourgeoftheCosmos.cs index 96fae66beb..16505a9aca 100644 --- a/Items/Weapons/ScourgeoftheCosmos.cs +++ b/Items/Weapons/ScourgeoftheCosmos.cs @@ -1,53 +1,53 @@ -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 ScourgeoftheCosmos : 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.Weapons +{ + public class ScourgeoftheCosmos : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Scourge of the Cosmos"); Tooltip.SetDefault("Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on death and tile hits"); } - public override void SetDefaults() - { - item.width = 18; - item.damage = 1500; - item.melee = true; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = 5; - item.useTime = 20; - item.knockBack = 5f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); - item.shootSpeed = 15f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ScourgeoftheCorruptor); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "DarksunFragment", 10); - recipe.AddIngredient(null, "XerocPitchfork", 200); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SetDefaults() + { + item.width = 18; + item.damage = 1500; + item.melee = true; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 5; + item.useTime = 20; + item.knockBack = 5f; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.height = 20; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("ScourgeoftheCosmos"); + item.shootSpeed = 15f; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ScourgeoftheCorruptor); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "DarksunFragment", 10); + recipe.AddIngredient(null, "XerocPitchfork", 200); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Seabow.cs b/Items/Weapons/Seabow.cs index 093a140b95..9efaa5ac78 100644 --- a/Items/Weapons/Seabow.cs +++ b/Items/Weapons/Seabow.cs @@ -1,57 +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 -{ - public class Seabow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seabow"); - Tooltip.SetDefault("Fires slow-moving water blasts"); - } - - public override void SetDefaults() - { - item.damage = 14; - item.ranged = true; - item.width = 22; - item.height = 46; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 40; - } - - 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(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, mod.ProjectileType("SandWater"), (int)((double)damage * 0.5), 0f, player.whoAmI, 0f, 0f); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Seabow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seabow"); + Tooltip.SetDefault("Fires slow-moving water blasts"); + } + + public override void SetDefaults() + { + item.damage = 14; + item.ranged = true; + item.width = 22; + item.height = 46; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 40; + } + + 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(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, mod.ProjectileType("SandWater"), (int)((double)damage * 0.5), 0f, player.whoAmI, 0f, 0f); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Seadragon.cs b/Items/Weapons/Seadragon.cs index 75a661fd08..d9ff0221c2 100644 --- a/Items/Weapons/Seadragon.cs +++ b/Items/Weapons/Seadragon.cs @@ -1,80 +1,80 @@ -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 Seadragon : 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.Weapons +{ + public class Seadragon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Seadragon"); - Tooltip.SetDefault("50% chance to not consume ammo\n" + + Tooltip.SetDefault("50% chance to not consume ammo\n" + "Has a chance to fire homing rockets that explode into fire shards on death"); } - public override void SetDefaults() - { - item.damage = 110; - item.ranged = true; - item.width = 78; - item.height = 26; - item.useTime = 5; - item.useAnimation = 5; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 16f; - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - 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) - { - 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, 0f, 0f); - if (Main.rand.Next(10) == 0) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SeaDragonRocket"), damage * 2, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Megalodon"); - recipe.AddIngredient(null, "Phantoplasm", 9); - recipe.AddIngredient(null, "ArmoredShell", 3); - recipe.AddIngredient(null, "DepthCells", 15); - recipe.AddIngredient(null, "Lumenite", 15); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 110; + item.ranged = true; + item.width = 78; + item.height = 26; + item.useTime = 5; + item.useAnimation = 5; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 16f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + 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) + { + 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, 0f, 0f); + if (Main.rand.Next(10) == 0) + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("SeaDragonRocket"), damage * 2, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Megalodon"); + recipe.AddIngredient(null, "Phantoplasm", 9); + recipe.AddIngredient(null, "ArmoredShell", 3); + recipe.AddIngredient(null, "DepthCells", 15); + recipe.AddIngredient(null, "Lumenite", 15); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SeashellBoomerangMelee.cs b/Items/Weapons/SeashellBoomerangMelee.cs index 5d22d123f6..3aa3c90b45 100644 --- a/Items/Weapons/SeashellBoomerangMelee.cs +++ b/Items/Weapons/SeashellBoomerangMelee.cs @@ -1,47 +1,47 @@ -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 SeashellBoomerangMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seashell Boomerang"); - } - - public override void SetDefaults() - { - item.width = 18; - item.damage = 15; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 34; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("SeashellBoomerangProjectileMelee"); - item.shootSpeed = 11.5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddTile(TileID.Anvils); - 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.Weapons +{ + public class SeashellBoomerangMelee : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seashell Boomerang"); + } + + public override void SetDefaults() + { + item.width = 18; + item.damage = 15; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 34; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("SeashellBoomerangProjectileMelee"); + item.shootSpeed = 11.5f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ShadecrystalTome.cs b/Items/Weapons/ShadecrystalTome.cs index 853c5052a3..a55394fc30 100644 --- a/Items/Weapons/ShadecrystalTome.cs +++ b/Items/Weapons/ShadecrystalTome.cs @@ -1,66 +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 -{ - public class ShadecrystalTome : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shadecrystal Barrage"); - Tooltip.SetDefault("Summons rapid fire shadecrystals, can shoot two crystals at once"); - } - - public override void SetDefaults() - { - item.damage = 23; - item.magic = true; - item.mana = 4; - item.width = 28; - item.height = 30; - item.useTime = 6; - item.useAnimation = 6; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ShadecrystalProjectile"); - item.shootSpeed = 16f; - } - - 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(1, 3); - 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), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalStorm); - recipe.AddIngredient(null, "VerstaltiteBar", 6); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 ShadecrystalTome : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shadecrystal Barrage"); + Tooltip.SetDefault("Summons rapid fire shadecrystals, can shoot two crystals at once"); + } + + public override void SetDefaults() + { + item.damage = 23; + item.magic = true; + item.mana = 4; + item.width = 28; + item.height = 30; + item.useTime = 6; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ShadecrystalProjectile"); + item.shootSpeed = 16f; + } + + 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(1, 3); + 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), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalStorm); + recipe.AddIngredient(null, "VerstaltiteBar", 6); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/ShadowboltStaff.cs b/Items/Weapons/ShadowboltStaff.cs index 4733e9313f..34736709c3 100644 --- a/Items/Weapons/ShadowboltStaff.cs +++ b/Items/Weapons/ShadowboltStaff.cs @@ -1,53 +1,53 @@ -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 ShadowboltStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shadowbolt Staff"); - Tooltip.SetDefault("The more tiles and enemies the beam bounces off of or travels through the more damage the beam does"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 170; - item.magic = true; - item.mana = 20; - item.width = 58; - item.height = 56; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Shadowbolt"); - item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ArmoredShell", 3); - recipe.AddIngredient(null, "RuinousSoul", 2); - recipe.AddIngredient(ItemID.ShadowbeamStaff); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 ShadowboltStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shadowbolt Staff"); + Tooltip.SetDefault("The more tiles and enemies the beam bounces off of or travels through the more damage the beam does"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 170; + item.magic = true; + item.mana = 20; + item.width = 58; + item.height = 56; + item.useTime = 14; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item72; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Shadowbolt"); + item.shootSpeed = 6f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ArmoredShell", 3); + recipe.AddIngredient(null, "RuinousSoul", 2); + recipe.AddIngredient(ItemID.ShadowbeamStaff); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Shimmerspark.cs b/Items/Weapons/Shimmerspark.cs index 927257ede1..fc520c4012 100644 --- a/Items/Weapons/Shimmerspark.cs +++ b/Items/Weapons/Shimmerspark.cs @@ -1,45 +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.Weapons -{ - public class Shimmerspark : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shimmerspark"); - Tooltip.SetDefault("Fires stars when enemies are near"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Chik); - item.damage = 36; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ShimmersparkProjectile"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Shimmerspark : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shimmerspark"); + Tooltip.SetDefault("Fires stars when enemies are near"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Chik); + item.damage = 36; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ShimmersparkProjectile"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Shredder.cs b/Items/Weapons/Shredder.cs index 63c8ee829c..e8ee884fc5 100644 --- a/Items/Weapons/Shredder.cs +++ b/Items/Weapons/Shredder.cs @@ -1,16 +1,16 @@ -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 Shredder : 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.Weapons +{ + public class Shredder : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Shredder"); @@ -19,81 +19,81 @@ namespace CalamityMod.Items.Weapons "Right click to fire a barrage of normal bullets"); } - public override void SetDefaults() - { - item.damage = 25; - item.ranged = true; - item.width = 56; - item.height = 24; - item.useTime = 3; - item.reuseDelay = 10; - item.useAnimation = 24; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - 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 = 12; - } - - 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 = 4; - if (player.altFunctionUse == 2) - { - for (int index = 0; index < bulletAmt; ++index) - { - float num7 = speedX; - 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, 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(-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, 0f, 0f); - Main.projectile[shot].timeLeft = 180; - } - return false; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(null, "BarofLife", 5); - recipe.AddIngredient(null, "ChargedDartRifle"); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddIngredient(ItemID.ClockworkAssaultRifle); - recipe.AddIngredient(ItemID.Shotgun); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.width = 56; + item.height = 24; + item.useTime = 3; + item.reuseDelay = 10; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + 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 = 12; + } + + 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 = 4; + if (player.altFunctionUse == 2) + { + for (int index = 0; index < bulletAmt; ++index) + { + float num7 = speedX; + 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, 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(-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, 0f, 0f); + Main.projectile[shot].timeLeft = 180; + } + return false; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(null, "BarofLife", 5); + recipe.AddIngredient(null, "ChargedDartRifle"); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(ItemID.ClockworkAssaultRifle); + recipe.AddIngredient(ItemID.Shotgun); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Shroomer.cs b/Items/Weapons/Shroomer.cs index 0fcfc6650b..562e7f6d82 100644 --- a/Items/Weapons/Shroomer.cs +++ b/Items/Weapons/Shroomer.cs @@ -1,67 +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 -{ - public class Shroomer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shroomer"); - Tooltip.SetDefault("Has a chance to fire an extremely powerful homing mushroom"); - } - - public override void SetDefaults() - { - item.damage = 200; - item.ranged = true; - item.width = 96; - item.height = 40; - item.crit += 35; - item.useTime = 26; - item.useAnimation = 26; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 9.75f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 10f; - item.useAmmo = 97; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 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, type, damage, knockBack, player.whoAmI, 0f, 0f); - if (Main.rand.Next(5) == 0) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Shroom"), (int)((double)damage * 1.5), knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SniperRifle); - recipe.AddIngredient(ItemID.ShroomiteBar, 11); - recipe.AddIngredient(ItemID.FragmentVortex, 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Shroomer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shroomer"); + Tooltip.SetDefault("Has a chance to fire an extremely powerful homing mushroom"); + } + + public override void SetDefaults() + { + item.damage = 200; + item.ranged = true; + item.width = 96; + item.height = 40; + item.crit += 35; + item.useTime = 26; + item.useAnimation = 26; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 9.75f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item40; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 10f; + item.useAmmo = 97; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-25, 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, type, damage, knockBack, player.whoAmI, 0f, 0f); + if (Main.rand.Next(5) == 0) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Shroom"), (int)((double)damage * 1.5), knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SniperRifle); + recipe.AddIngredient(ItemID.ShroomiteBar, 11); + recipe.AddIngredient(ItemID.FragmentVortex, 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SkyGlaze.cs b/Items/Weapons/SkyGlaze.cs index b8b388849f..46c350446d 100644 --- a/Items/Weapons/SkyGlaze.cs +++ b/Items/Weapons/SkyGlaze.cs @@ -1,92 +1,92 @@ -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 SkyGlaze : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sky Glaze"); - Tooltip.SetDefault("Fires feathers from the sky that stick to enemies and tiles and explode"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 10; - item.magic = true; - item.mana = 8; - item.width = 52; - item.height = 74; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.shoot = mod.ProjectileType("StickyFeather"); - item.shootSpeed = 15f; - } - - 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; - } - num78 *= num80; - num79 *= num80; - int num107 = 5; - 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)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, 0f, (float)Main.rand.Next(15)); - } - return false; - } - } -} \ No newline at end of file +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 SkyGlaze : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sky Glaze"); + Tooltip.SetDefault("Fires feathers from the sky that stick to enemies and tiles and explode"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 10; + item.magic = true; + item.mana = 8; + item.width = 52; + item.height = 74; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item102; + item.autoReuse = true; + item.shoot = mod.ProjectileType("StickyFeather"); + item.shootSpeed = 15f; + } + + 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; + } + num78 *= num80; + num79 *= num80; + int num107 = 5; + 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)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, 0f, (float)Main.rand.Next(15)); + } + return false; + } + } +} diff --git a/Items/Weapons/SlagMagnum.cs b/Items/Weapons/SlagMagnum.cs index 1bf48ff9b9..811b92261c 100644 --- a/Items/Weapons/SlagMagnum.cs +++ b/Items/Weapons/SlagMagnum.cs @@ -1,46 +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 -{ - public class SlagMagnum : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slag Magnum"); - Tooltip.SetDefault("Shoots fossil shards that split into additional shards on death"); - } - - public override void SetDefaults() - { - item.damage = 24; - item.ranged = true; - item.width = 58; - item.height = 24; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item41; - item.autoReuse = true; - item.shootSpeed = 22f; - item.shoot = mod.ProjectileType("SlagRound"); - item.useAmmo = 97; - } - - 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("SlagRound"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file +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 SlagMagnum : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slag Magnum"); + Tooltip.SetDefault("Shoots fossil shards that split into additional shards on death"); + } + + public override void SetDefaults() + { + item.damage = 24; + item.ranged = true; + item.width = 58; + item.height = 24; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shootSpeed = 22f; + item.shoot = mod.ProjectileType("SlagRound"); + item.useAmmo = 97; + } + + 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("SlagRound"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/SlimeGod/AbyssalTome.cs b/Items/Weapons/SlimeGod/AbyssalTome.cs index 6a7669da5a..f56fbf0070 100644 --- a/Items/Weapons/SlimeGod/AbyssalTome.cs +++ b/Items/Weapons/SlimeGod/AbyssalTome.cs @@ -1,40 +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.Weapons.SlimeGod -{ - public class AbyssalTome : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyssal Tome"); - Tooltip.SetDefault("Casts a slow-moving ball of dark energy"); - } - - public override void SetDefaults() - { - item.damage = 40; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 30; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AbyssBall"); - item.shootSpeed = 9f; - } - } -} \ No newline at end of file +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.SlimeGod +{ + public class AbyssalTome : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Tome"); + Tooltip.SetDefault("Casts a slow-moving ball of dark energy"); + } + + public override void SetDefaults() + { + item.damage = 40; + item.magic = true; + item.mana = 15; + item.width = 28; + item.height = 30; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AbyssBall"); + item.shootSpeed = 9f; + } + } +} diff --git a/Items/Weapons/SlimeGod/CorroslimeStaff.cs b/Items/Weapons/SlimeGod/CorroslimeStaff.cs index ed50d5773a..30b458e9ab 100644 --- a/Items/Weapons/SlimeGod/CorroslimeStaff.cs +++ b/Items/Weapons/SlimeGod/CorroslimeStaff.cs @@ -1,83 +1,83 @@ -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.Weapons.SlimeGod -{ - public class CorroslimeStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corroslime Staff"); - Tooltip.SetDefault("Summons a corro slime to fight for you"); - } - - public override void SetDefaults() - { - item.damage = 30; - item.mana = 10; - item.width = 50; - item.height = 50; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Corroslime"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EbonianGel", 25); - recipe.AddIngredient(null, "PurifiedGel", 10); - recipe.AddIngredient(ItemID.Ebonwood, 100); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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 +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.Weapons.SlimeGod +{ + public class CorroslimeStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corroslime Staff"); + Tooltip.SetDefault("Summons a corro slime to fight for you"); + } + + public override void SetDefaults() + { + item.damage = 30; + item.mana = 10; + item.width = 50; + item.height = 50; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Corroslime"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EbonianGel", 25); + recipe.AddIngredient(null, "PurifiedGel", 10); + recipe.AddIngredient(ItemID.Ebonwood, 100); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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); + } + } +} diff --git a/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs b/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs index 54ed2f2dd9..a7f6c8ce62 100644 --- a/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs +++ b/Items/Weapons/SlimeGod/CorruptedCrusherBlade.cs @@ -1,67 +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.SlimeGod -{ - public class CorruptedCrusherBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corrupted Crusher Blade"); - Tooltip.SetDefault("Inflicts cursed inferno and critical hits lower enemy defense"); - } - - public override void SetDefaults() - { - item.damage = 39; - item.melee = true; - item.width = 64; - item.height = 80; - item.useTime = 26; - item.useAnimation = 26; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.75f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(7) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 27); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 180); - if (target.defense > 0 && crit) - { - target.defense -= 5; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EbonianGel", 15); - recipe.AddIngredient(ItemID.EbonstoneBlock, 50); - recipe.AddIngredient(ItemID.ShadowScale, 5); - recipe.AddIngredient(ItemID.IronBar, 4); - recipe.anyIronBar = true; - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.SlimeGod +{ + public class CorruptedCrusherBlade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrupted Crusher Blade"); + Tooltip.SetDefault("Inflicts cursed inferno and critical hits lower enemy defense"); + } + + public override void SetDefaults() + { + item.damage = 39; + item.melee = true; + item.width = 64; + item.height = 80; + item.useTime = 26; + item.useAnimation = 26; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.75f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(7) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 27); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 180); + if (target.defense > 0 && crit) + { + target.defense -= 5; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EbonianGel", 15); + recipe.AddIngredient(ItemID.EbonstoneBlock, 50); + recipe.AddIngredient(ItemID.ShadowScale, 5); + recipe.AddIngredient(ItemID.IronBar, 4); + recipe.anyIronBar = true; + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SlimeGod/CrimslimeStaff.cs b/Items/Weapons/SlimeGod/CrimslimeStaff.cs index 0f71855fc0..141aa13234 100644 --- a/Items/Weapons/SlimeGod/CrimslimeStaff.cs +++ b/Items/Weapons/SlimeGod/CrimslimeStaff.cs @@ -1,83 +1,83 @@ -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.Weapons.SlimeGod -{ - public class CrimslimeStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimslime Staff"); - Tooltip.SetDefault("Summons a crim slime to fight for you"); - } - - public override void SetDefaults() - { - item.damage = 30; - item.mana = 10; - item.width = 50; - item.height = 50; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Crimslime"); - item.shootSpeed = 10f; - item.summon = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EbonianGel", 25); - recipe.AddIngredient(null, "PurifiedGel", 10); - recipe.AddIngredient(ItemID.Shadewood, 100); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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 +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.Weapons.SlimeGod +{ + public class CrimslimeStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimslime Staff"); + Tooltip.SetDefault("Summons a crim slime to fight for you"); + } + + public override void SetDefaults() + { + item.damage = 30; + item.mana = 10; + item.width = 50; + item.height = 50; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Crimslime"); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EbonianGel", 25); + recipe.AddIngredient(null, "PurifiedGel", 10); + recipe.AddIngredient(ItemID.Shadewood, 100); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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); + } + } +} diff --git a/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs b/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs index 05b67973a6..ede8a7f913 100644 --- a/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs +++ b/Items/Weapons/SlimeGod/CrimsonCrusherBlade.cs @@ -1,67 +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.SlimeGod -{ - public class CrimsonCrusherBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimson Crusher Blade"); - Tooltip.SetDefault("Inflicts ichor and critical hits lower enemy contact damage"); - } - - public override void SetDefaults() - { - item.damage = 41; - item.melee = true; - item.width = 68; - item.height = 76; - item.useTime = 28; - item.useAnimation = 28; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(7) == 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) - { - target.AddBuff(BuffID.Ichor, 180); - if (target.damage > 0 && crit) - { - target.damage -= 10; - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EbonianGel", 15); - recipe.AddIngredient(ItemID.CrimstoneBlock, 50); - recipe.AddIngredient(ItemID.TissueSample, 5); - recipe.AddIngredient(ItemID.IronBar, 4); - recipe.anyIronBar = true; - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.SlimeGod +{ + public class CrimsonCrusherBlade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimson Crusher Blade"); + Tooltip.SetDefault("Inflicts ichor and critical hits lower enemy contact damage"); + } + + public override void SetDefaults() + { + item.damage = 41; + item.melee = true; + item.width = 68; + item.height = 76; + item.useTime = 28; + item.useAnimation = 28; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(7) == 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) + { + target.AddBuff(BuffID.Ichor, 180); + if (target.damage > 0 && crit) + { + target.damage -= 10; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EbonianGel", 15); + recipe.AddIngredient(ItemID.CrimstoneBlock, 50); + recipe.AddIngredient(ItemID.TissueSample, 5); + recipe.AddIngredient(ItemID.IronBar, 4); + recipe.anyIronBar = true; + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SlimeGod/EldritchTome.cs b/Items/Weapons/SlimeGod/EldritchTome.cs index f3ff591813..bd4f55286b 100644 --- a/Items/Weapons/SlimeGod/EldritchTome.cs +++ b/Items/Weapons/SlimeGod/EldritchTome.cs @@ -1,72 +1,72 @@ -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.SlimeGod -{ - public class EldritchTome : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eldritch Tome"); - Tooltip.SetDefault("Casts eldritch tentacles to spear your enemies"); - } - - public override void SetDefaults() - { - item.damage = 32; - item.magic = true; - item.mana = 7; - item.width = 28; - item.crit = 3; - item.height = 30; - item.useTime = 7; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item103; - item.autoReuse = true; - item.shoot = mod.ProjectileType("EldritchTentacle"); - item.shootSpeed = 12f; - } - - 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 i = Main.myPlayer; - 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; - Vector2 value2 = new Vector2(num78, num79); - value2.Normalize(); - Vector2 value3 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value3.Normalize(); - value2 = value2 * 4f + value3; - value2.Normalize(); - value2 *= item.shootSpeed; - float num91 = (float)Main.rand.Next(10, 80) * 0.001f; - if (Main.rand.Next(2) == 0) - { - num91 *= -1f; - } - float num92 = (float)Main.rand.Next(10, 80) * 0.001f; - if (Main.rand.Next(2) == 0) - { - num92 *= -1f; - } - Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, mod.ProjectileType("EldritchTentacle"), num73, num74, i, num92, num91); - return false; - } - } -} \ No newline at end of file +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.SlimeGod +{ + public class EldritchTome : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eldritch Tome"); + Tooltip.SetDefault("Casts eldritch tentacles to spear your enemies"); + } + + public override void SetDefaults() + { + item.damage = 32; + item.magic = true; + item.mana = 7; + item.width = 28; + item.crit = 3; + item.height = 30; + item.useTime = 7; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item103; + item.autoReuse = true; + item.shoot = mod.ProjectileType("EldritchTentacle"); + item.shootSpeed = 12f; + } + + 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 i = Main.myPlayer; + 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; + Vector2 value2 = new Vector2(num78, num79); + value2.Normalize(); + Vector2 value3 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value3.Normalize(); + value2 = value2 * 4f + value3; + value2.Normalize(); + value2 *= item.shootSpeed; + float num91 = (float)Main.rand.Next(10, 80) * 0.001f; + if (Main.rand.Next(2) == 0) + { + num91 *= -1f; + } + float num92 = (float)Main.rand.Next(10, 80) * 0.001f; + if (Main.rand.Next(2) == 0) + { + num92 *= -1f; + } + Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, mod.ProjectileType("EldritchTentacle"), num73, num74, i, num92, num91); + return false; + } + } +} diff --git a/Items/Weapons/SlimeGod/GeliticBlade.cs b/Items/Weapons/SlimeGod/GeliticBlade.cs index 1718bd6aae..0ab4523fc7 100644 --- a/Items/Weapons/SlimeGod/GeliticBlade.cs +++ b/Items/Weapons/SlimeGod/GeliticBlade.cs @@ -1,62 +1,62 @@ -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.SlimeGod -{ - public class GeliticBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gelitic Blade"); - Tooltip.SetDefault("Fires a gel wave that slows down on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 60; - item.damage = 36; - item.melee = true; - item.useAnimation = 30; - item.useTime = 30; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.shoot = mod.ProjectileType("GelWave"); - item.shootSpeed = 9f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 30); - recipe.AddIngredient(ItemID.Gel, 35); - recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddTile(TileID.Anvils); - 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, 20); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Slimed, 300); - } - } -} +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.SlimeGod +{ + public class GeliticBlade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gelitic Blade"); + Tooltip.SetDefault("Fires a gel wave that slows down on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 60; + item.damage = 36; + item.melee = true; + item.useAnimation = 30; + item.useTime = 30; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.shoot = mod.ProjectileType("GelWave"); + item.shootSpeed = 9f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 30); + recipe.AddIngredient(ItemID.Gel, 35); + recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddTile(TileID.Anvils); + 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, 20); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Slimed, 300); + } + } +} diff --git a/Items/Weapons/SlimeGod/Goobow.cs b/Items/Weapons/SlimeGod/Goobow.cs index 8ce4d79d73..b417205767 100644 --- a/Items/Weapons/SlimeGod/Goobow.cs +++ b/Items/Weapons/SlimeGod/Goobow.cs @@ -1,75 +1,75 @@ -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.SlimeGod -{ - public class Goobow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Goobow"); - Tooltip.SetDefault("Fires two streams of slime"); - } - - public override void SetDefaults() - { - item.damage = 40; - item.ranged = true; - item.width = 30; - item.height = 48; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - 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(); - vector7 *= 20f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 0.6f, speedY * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI, 0f, 0f); - Main.projectile[projectile].GetGlobalProjectile(mod).forceRanged = true; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 18); - recipe.AddIngredient(ItemID.Gel, 30); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.SlimeGod +{ + public class Goobow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Goobow"); + Tooltip.SetDefault("Fires two streams of slime"); + } + + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.width = 30; + item.height = 48; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + 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(); + vector7 *= 20f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 0.6f, speedY * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI, 0f, 0f); + Main.projectile[projectile].GetGlobalProjectile(mod).forceRanged = true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 18); + recipe.AddIngredient(ItemID.Gel, 30); + recipe.AddIngredient(ItemID.HellstoneBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SlimeGod/GunkShot.cs b/Items/Weapons/SlimeGod/GunkShot.cs index 423ac656bd..b84e6effe7 100644 --- a/Items/Weapons/SlimeGod/GunkShot.cs +++ b/Items/Weapons/SlimeGod/GunkShot.cs @@ -1,63 +1,63 @@ -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.SlimeGod -{ - public class GunkShot : 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.Weapons.SlimeGod +{ + public class GunkShot : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Gunk Shot"); Tooltip.SetDefault("Shoots a spread of bullets"); } - - public override void SetDefaults() - { - item.damage = 30; - item.ranged = true; - item.width = 42; - item.height = 18; - item.useTime = 32; - item.useAnimation = 32; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 3.5f; - item.useAmmo = 97; - } - - 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 = Main.rand.Next(3, 5); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 18); - recipe.AddIngredient(ItemID.Gel, 15); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 42; + item.height = 18; + item.useTime = 32; + item.useAnimation = 32; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item36; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 3.5f; + item.useAmmo = 97; + } + + 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 = Main.rand.Next(3, 5); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float) Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 18); + recipe.AddIngredient(ItemID.Gel, 15); + recipe.AddIngredient(ItemID.HellstoneBar, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SlimeGod/OverloadedBlaster.cs b/Items/Weapons/SlimeGod/OverloadedBlaster.cs index 1827ed806f..66023b28ef 100644 --- a/Items/Weapons/SlimeGod/OverloadedBlaster.cs +++ b/Items/Weapons/SlimeGod/OverloadedBlaster.cs @@ -1,61 +1,61 @@ -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.SlimeGod -{ - public class OverloadedBlaster : 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.Weapons.SlimeGod +{ + public class OverloadedBlaster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Overloaded Blaster"); - Tooltip.SetDefault("33% chance to not consume gel\n" + + Tooltip.SetDefault("33% chance to not consume gel\n" + "Fires a large spread of bouncing slime"); } - - public override void SetDefaults() - { - item.damage = 16; - item.ranged = true; - item.width = 42; - item.height = 20; - item.useTime = 17; - item.useAnimation = 17; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shootSpeed = 6.5f; - item.shoot = mod.ProjectileType("SlimeBolt"); - item.useAmmo = 23; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 33) - return false; - 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) - { - for (int index = 0; index < 5; ++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, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 16; + item.ranged = true; + item.width = 42; + item.height = 20; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shootSpeed = 6.5f; + item.shoot = mod.ProjectileType("SlimeBolt"); + item.useAmmo = 23; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 33) + return false; + 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) + { + for (int index = 0; index < 5; ++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, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/SlimeGod/TheGodsGambit.cs b/Items/Weapons/SlimeGod/TheGodsGambit.cs index 7a80a71ef0..f614bd4213 100644 --- a/Items/Weapons/SlimeGod/TheGodsGambit.cs +++ b/Items/Weapons/SlimeGod/TheGodsGambit.cs @@ -1,45 +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.Weapons.SlimeGod -{ - public class TheGodsGambit : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The God's Gambit"); - Tooltip.SetDefault("Fires a stream of slime when enemies are near"); - } - - public override void SetDefaults() - { - item.CloneDefaults(3291); - item.damage = 28; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TheGodsGambitProjectile"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel", 30); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.SlimeGod +{ + public class TheGodsGambit : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The God's Gambit"); + Tooltip.SetDefault("Fires a stream of slime when enemies are near"); + } + + public override void SetDefaults() + { + item.CloneDefaults(3291); + item.damage = 28; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 4; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TheGodsGambitProjectile"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurifiedGel", 30); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SolsticeClaymore.cs b/Items/Weapons/SolsticeClaymore.cs index 658c87fa91..0292ee5ce4 100644 --- a/Items/Weapons/SolsticeClaymore.cs +++ b/Items/Weapons/SolsticeClaymore.cs @@ -1,89 +1,89 @@ -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 -{ - public class SolsticeClaymore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Solstice Claymore"); - Tooltip.SetDefault("Changes projectile color based on the time of year\n" + - "Inflicts daybroken during the day and nightwither during the night"); - } - - public override void SetDefaults() - { - item.width = 86; - item.damage = 470; - item.melee = true; - item.useAnimation = 16; - item.useStyle = 1; - item.useTime = 16; - item.useTurn = true; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 86; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("SolsticeBeam"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BeamSword); - recipe.AddIngredient(null, "AstralBar", 20); - recipe.AddIngredient(ItemID.FragmentSolar, 5); - recipe.AddIngredient(ItemID.FragmentVortex, 5); - recipe.AddIngredient(ItemID.FragmentStardust, 5); - recipe.AddIngredient(ItemID.FragmentNebula, 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - int dustType = Main.dayTime ? - Utils.SelectRandom(Main.rand, new int[] - { - 6, - 259, - 158 - }) : - Utils.SelectRandom(Main.rand, new int[] - { - 173, - 27, - 234 - }); - if (Main.rand.Next(4) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType); - Main.dust[dust].noGravity = true; - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.dayTime) - { - target.AddBuff(BuffID.Daybreak, 300); - } - else - { - target.AddBuff(mod.BuffType("Nightwither"), 300); - } - } - } -} +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 +{ + public class SolsticeClaymore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Solstice Claymore"); + Tooltip.SetDefault("Changes projectile color based on the time of year\n" + + "Inflicts daybroken during the day and nightwither during the night"); + } + + public override void SetDefaults() + { + item.width = 86; + item.damage = 470; + item.melee = true; + item.useAnimation = 16; + item.useStyle = 1; + item.useTime = 16; + item.useTurn = true; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 86; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("SolsticeBeam"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BeamSword); + recipe.AddIngredient(null, "AstralBar", 20); + recipe.AddIngredient(ItemID.FragmentSolar, 5); + recipe.AddIngredient(ItemID.FragmentVortex, 5); + recipe.AddIngredient(ItemID.FragmentStardust, 5); + recipe.AddIngredient(ItemID.FragmentNebula, 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + int dustType = Main.dayTime ? + Utils.SelectRandom(Main.rand, new int[] + { + 6, + 259, + 158 + }) : + Utils.SelectRandom(Main.rand, new int[] + { + 173, + 27, + 234 + }); + if (Main.rand.Next(4) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType); + Main.dust[dust].noGravity = true; + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.dayTime) + { + target.AddBuff(BuffID.Daybreak, 300); + } + else + { + target.AddBuff(mod.BuffType("Nightwither"), 300); + } + } + } +} diff --git a/Items/Weapons/SomaPrime.cs b/Items/Weapons/SomaPrime.cs index 9e17fd4448..ef6aa2b894 100644 --- a/Items/Weapons/SomaPrime.cs +++ b/Items/Weapons/SomaPrime.cs @@ -1,73 +1,73 @@ -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 SomaPrime : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soma Prime"); - Tooltip.SetDefault("Shoots extremely powerful high velocity rounds that inflict a powerful bleed debuff"); - } - - public override void SetDefaults() - { - item.damage = 600; - item.ranged = true; - item.width = 94; - item.height = 34; - item.crit += 40; - item.useTime = 1; - item.useAnimation = 3; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item40; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SlashRound"); - item.shootSpeed = 30f; - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(null, "P90"); - recipe.AddIngredient(null, "Minigun"); - 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 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, mod.ProjectileType("SlashRound"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } - } -} \ No newline at end of file +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 SomaPrime : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soma Prime"); + Tooltip.SetDefault("Shoots extremely powerful high velocity rounds that inflict a powerful bleed debuff"); + } + + public override void SetDefaults() + { + item.damage = 600; + item.ranged = true; + item.width = 94; + item.height = 34; + item.crit += 40; + item.useTime = 1; + item.useAnimation = 3; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item40; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SlashRound"); + item.shootSpeed = 30f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-25, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(null, "P90"); + recipe.AddIngredient(null, "Minigun"); + 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 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, mod.ProjectileType("SlashRound"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return true; + } + } +} diff --git a/Items/Weapons/SoulHarvester.cs b/Items/Weapons/SoulHarvester.cs index b746400643..6f445b7fbb 100644 --- a/Items/Weapons/SoulHarvester.cs +++ b/Items/Weapons/SoulHarvester.cs @@ -1,88 +1,88 @@ -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 SoulHarvester : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Harvester"); - Tooltip.SetDefault("Shoots a soul scythe\n" + - "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 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 OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 300); - target.AddBuff(BuffID.CursedInferno, 300); - 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; - } - } - } - } -} +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 SoulHarvester : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Harvester"); + Tooltip.SetDefault("Shoots a soul scythe\n" + + "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 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 OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + target.AddBuff(BuffID.CursedInferno, 300); + 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/SoulPiercer.cs b/Items/Weapons/SoulPiercer.cs index dbf73b8fca..6ba8cda7f4 100644 --- a/Items/Weapons/SoulPiercer.cs +++ b/Items/Weapons/SoulPiercer.cs @@ -1,51 +1,51 @@ -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 SoulPiercer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Piercer"); - Tooltip.SetDefault("Casts a powerful ray that summons extra rays on enemy hits"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 185; - item.magic = true; - item.mana = 19; - item.width = 60; - item.height = 60; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SoulPiercer"); - item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - 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 +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 SoulPiercer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Piercer"); + Tooltip.SetDefault("Casts a powerful ray that summons extra rays on enemy hits"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 185; + item.magic = true; + item.mana = 19; + item.width = 60; + item.height = 60; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item73; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SoulPiercer"); + item.shootSpeed = 6f; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 12); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SpatialLance.cs b/Items/Weapons/SpatialLance.cs index 5c349455e9..e1816d3d26 100644 --- a/Items/Weapons/SpatialLance.cs +++ b/Items/Weapons/SpatialLance.cs @@ -1,67 +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 -{ - public class SpatialLance : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Lance"); - Tooltip.SetDefault("Rend the cosmos asunder!\n" + - "Fires a lance beam that splits multiple times as it travels"); - } - - public override void SetDefaults() - { - item.width = 88; - item.damage = 200; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 36; - item.useStyle = 5; - item.useTime = 36; - item.knockBack = 9.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 88; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("SpatialLanceProjectile"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TerraLance"); - recipe.AddIngredient(ItemID.NorthPole); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - 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.Weapons +{ + public class SpatialLance : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Lance"); + Tooltip.SetDefault("Rend the cosmos asunder!\n" + + "Fires a lance beam that splits multiple times as it travels"); + } + + public override void SetDefaults() + { + item.width = 88; + item.damage = 200; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 36; + item.useStyle = 5; + item.useTime = 36; + item.knockBack = 9.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 88; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("SpatialLanceProjectile"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TerraLance"); + recipe.AddIngredient(ItemID.NorthPole); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SpectralstormCannon.cs b/Items/Weapons/SpectralstormCannon.cs index ea9f4f0e58..c2d61ce13a 100644 --- a/Items/Weapons/SpectralstormCannon.cs +++ b/Items/Weapons/SpectralstormCannon.cs @@ -1,77 +1,77 @@ -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 -{ - public class SpectralstormCannon : 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; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class SpectralstormCannon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Spectralstorm Cannon"); - Tooltip.SetDefault("70% chance to not consume flares\n" + + Tooltip.SetDefault("70% chance to not consume flares\n" + "Fires a storm of ectoplasm and flares"); } - public override void SetDefaults() - { - item.damage = 44; - item.ranged = true; - item.width = 66; - item.height = 26; - item.useTime = 3; - item.useAnimation = 9; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 163; - item.shootSpeed = 9.5f; - item.useAmmo = 931; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 70) - return false; - 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 num6 = Main.rand.Next(1, 2); - 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; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 200; - } - 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() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FirestormCannon"); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddIngredient(ItemID.Ectoplasm, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 44; + item.ranged = true; + item.width = 66; + item.height = 26; + item.useTime = 3; + item.useAnimation = 9; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 163; + item.shootSpeed = 9.5f; + item.useAmmo = 931; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 70) + return false; + 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 num6 = Main.rand.Next(1, 2); + 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; + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].timeLeft = 200; + } + 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() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FirestormCannon"); + recipe.AddIngredient(ItemID.FragmentVortex, 20); + recipe.AddIngredient(ItemID.Ectoplasm, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SpectreRifle.cs b/Items/Weapons/SpectreRifle.cs index 4014982dda..883b0cb104 100644 --- a/Items/Weapons/SpectreRifle.cs +++ b/Items/Weapons/SpectreRifle.cs @@ -1,64 +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; -using CalamityMod.Projectiles; - -namespace CalamityMod.Items.Weapons -{ - public class SpectreRifle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spectre Rifle"); - Tooltip.SetDefault("Fires a powerful homing soul"); - } - - public override void SetDefaults() - { - item.damage = 150; - item.ranged = true; - item.width = 88; - item.height = 30; - item.crit += 22; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item40; - item.autoReuse = false; - item.shoot = 297; - item.shootSpeed = 24f; - 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) - { - 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() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SpectreBar, 7); - recipe.AddIngredient(null, "CoreofEleum", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class SpectreRifle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spectre Rifle"); + Tooltip.SetDefault("Fires a powerful homing soul"); + } + + public override void SetDefaults() + { + item.damage = 150; + item.ranged = true; + item.width = 88; + item.height = 30; + item.crit += 22; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item40; + item.autoReuse = false; + item.shoot = 297; + item.shootSpeed = 24f; + 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) + { + 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() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SpectreBar, 7); + recipe.AddIngredient(null, "CoreofEleum", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SporeKnife.cs b/Items/Weapons/SporeKnife.cs index fa8532972b..b17349f5e7 100644 --- a/Items/Weapons/SporeKnife.cs +++ b/Items/Weapons/SporeKnife.cs @@ -1,65 +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.Projectiles; - -namespace CalamityMod.Items.Weapons -{ - public class SporeKnife : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spore Knife"); - Tooltip.SetDefault("Enemies release spore clouds on death"); - } - - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 28; - item.height = 28; - item.damage = 33; - item.melee = true; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.JungleSpores, 10); - recipe.AddIngredient(ItemID.Stinger, 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 2); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - 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; - } - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class SporeKnife : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spore Knife"); + Tooltip.SetDefault("Enemies release spore clouds on death"); + } + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 12; + item.useTime = 12; + item.width = 28; + item.height = 28; + item.damage = 33; + item.melee = true; + item.knockBack = 5.75f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.JungleSpores, 10); + recipe.AddIngredient(ItemID.Stinger, 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 2); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + 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/Spyker.cs b/Items/Weapons/Spyker.cs index b270cb2e5d..a7e766e3b9 100644 --- a/Items/Weapons/Spyker.cs +++ b/Items/Weapons/Spyker.cs @@ -1,63 +1,63 @@ -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 Spyker : 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.Weapons +{ + public class Spyker : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Spyker"); Tooltip.SetDefault("Fires spikes that stick to enemies, tiles, and explode into shrapnel"); } - public override void SetDefaults() - { - item.damage = 170; - item.ranged = true; - item.width = 44; - item.height = 26; - item.useTime = 13; - item.useAnimation = 13; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item108; - item.autoReuse = true; - item.shootSpeed = 9f; - item.shoot = mod.ProjectileType("Spyker"); - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Spyker"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Needler"); - recipe.AddIngredient(ItemID.Stynger); - recipe.AddIngredient(null, "UeliaceBar", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 170; + item.ranged = true; + item.width = 44; + item.height = 26; + item.useTime = 13; + item.useAnimation = 13; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item108; + item.autoReuse = true; + item.shootSpeed = 9f; + item.shoot = mod.ProjectileType("Spyker"); + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Spyker"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Needler"); + recipe.AddIngredient(ItemID.Stynger); + recipe.AddIngredient(null, "UeliaceBar", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/StarCannonEX.cs b/Items/Weapons/StarCannonEX.cs index 772eb770f3..02d90473cc 100644 --- a/Items/Weapons/StarCannonEX.cs +++ b/Items/Weapons/StarCannonEX.cs @@ -1,78 +1,78 @@ -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 -{ - public class StarCannonEX : 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; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class StarCannonEX : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Star Cannon EX"); Tooltip.SetDefault("Fires a mix of normal, starfury, and astral stars"); } - - public override void SetDefaults() - { - item.damage = 88; - item.ranged = true; - item.width = 66; - item.height = 22; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.rare = 7; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = 12; - item.shootSpeed = 15f; - item.useAmmo = AmmoID.FallenStar; - } - - 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) - { - int num6 = Main.rand.Next(1, 3); - for (int index = 0; index < num6; ++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; - switch (Main.rand.Next(3)) - { - case 0: break; - 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, 0f, 0f); - Main.projectile[star].GetGlobalProjectile(mod).forceRanged = true; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.StarCannon); - recipe.AddIngredient(null, "AstralJelly", 10); - recipe.AddIngredient(null, "Stardust", 25); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 88; + item.ranged = true; + item.width = 66; + item.height = 22; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.rare = 7; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shoot = 12; + item.shootSpeed = 15f; + item.useAmmo = AmmoID.FallenStar; + } + + 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) + { + int num6 = Main.rand.Next(1, 3); + for (int index = 0; index < num6; ++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; + switch (Main.rand.Next(3)) + { + case 0: break; + 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, 0f, 0f); + Main.projectile[star].GetGlobalProjectile(mod).forceRanged = true; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.StarCannon); + recipe.AddIngredient(null, "AstralJelly", 10); + recipe.AddIngredient(null, "Stardust", 25); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/StardustStaff.cs b/Items/Weapons/StardustStaff.cs index 8a0658c2f2..de1f2afe5f 100644 --- a/Items/Weapons/StardustStaff.cs +++ b/Items/Weapons/StardustStaff.cs @@ -1,98 +1,98 @@ -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 StardustStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Staff"); - Tooltip.SetDefault("The power of an ancient cultist resonates within this staff\n" + - "Fires a spread of ancient light and has a chance to fire a spinning ice cluster"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 90; - item.magic = true; - item.mana = 20; - item.width = 56; - item.height = 56; - item.useTime = 18; - item.useAnimation = 18; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Starblast"); - item.shootSpeed = 12f; - } - - 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) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = item.damage; - float num74 = item.knockBack; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - int num130 = 6; - if (Main.rand.Next(3) == 0) - { - num130++; - } - if (Main.rand.Next(4) == 0) - { - num130++; - } - if (Main.rand.Next(5) == 0) - { - num130++; - } - if (Main.rand.Next(3) == 0) - { - float num132 = num78; - float num133 = num79; - num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); - num80 = num72 / num80; - num132 *= num80; - num133 *= num80; - float x2 = vector2.X; - float y2 = vector2.Y; - Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("IceCluster"), num73, num74, i, 0f, 0f); - } - else - { - for (int num131 = 0; num131 < num130; num131++) - { - float num132 = num78; - float num133 = num79; - float num134 = 0.05f * (float)num131; - num132 += (float)Main.rand.Next(-155, 156) * num134; - num133 += (float)Main.rand.Next(-155, 156) * num134; - num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); - num80 = num72 / num80; - num132 *= num80; - num133 *= num80; - float x2 = vector2.X; - float y2 = vector2.Y; - Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("Starblast"), num73, num74, i, 0f, 0f); - } - } - return false; - } - } -} \ No newline at end of file +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 StardustStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Staff"); + Tooltip.SetDefault("The power of an ancient cultist resonates within this staff\n" + + "Fires a spread of ancient light and has a chance to fire a spinning ice cluster"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 90; + item.magic = true; + item.mana = 20; + item.width = 56; + item.height = 56; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Starblast"); + item.shootSpeed = 12f; + } + + 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) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + int i = Main.myPlayer; + float num72 = item.shootSpeed; + int num73 = item.damage; + float num74 = item.knockBack; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + int num130 = 6; + if (Main.rand.Next(3) == 0) + { + num130++; + } + if (Main.rand.Next(4) == 0) + { + num130++; + } + if (Main.rand.Next(5) == 0) + { + num130++; + } + if (Main.rand.Next(3) == 0) + { + float num132 = num78; + float num133 = num79; + num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); + num80 = num72 / num80; + num132 *= num80; + num133 *= num80; + float x2 = vector2.X; + float y2 = vector2.Y; + Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("IceCluster"), num73, num74, i, 0f, 0f); + } + else + { + for (int num131 = 0; num131 < num130; num131++) + { + float num132 = num78; + float num133 = num79; + float num134 = 0.05f * (float)num131; + num132 += (float)Main.rand.Next(-155, 156) * num134; + num133 += (float)Main.rand.Next(-155, 156) * num134; + num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); + num80 = num72 / num80; + num132 *= num80; + num133 *= num80; + float x2 = vector2.X; + float y2 = vector2.Y; + Projectile.NewProjectile(x2, y2, num132, num133, mod.ProjectileType("Starblast"), num73, num74, i, 0f, 0f); + } + } + return false; + } + } +} diff --git a/Items/Weapons/Starfleet.cs b/Items/Weapons/Starfleet.cs index dc6154b8f7..79b364ff81 100644 --- a/Items/Weapons/Starfleet.cs +++ b/Items/Weapons/Starfleet.cs @@ -1,70 +1,70 @@ -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 Starfleet : 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.Weapons +{ + public class Starfleet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Starfleet"); Tooltip.SetDefault("Fires a spread of plasma blasts"); } - - public override void SetDefaults() - { - item.damage = 70; - item.ranged = true; - item.width = 80; - item.height = 26; - item.useTime = 55; - item.useAnimation = 55; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 15f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item92; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PlasmaBlast"); - item.shootSpeed = 12f; - item.useAmmo = 75; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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 < 5; ++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, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StarCannonEX"); - recipe.AddIngredient(ItemID.ElectrosphereLauncher); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 70; + item.ranged = true; + item.width = 80; + item.height = 26; + item.useTime = 55; + item.useAnimation = 55; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 15f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item92; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PlasmaBlast"); + item.shootSpeed = 12f; + item.useAmmo = 75; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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 < 5; ++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, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StarCannonEX"); + recipe.AddIngredient(ItemID.ElectrosphereLauncher); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/StarfleetMK2.cs b/Items/Weapons/StarfleetMK2.cs index 132092e60a..85fee51418 100644 --- a/Items/Weapons/StarfleetMK2.cs +++ b/Items/Weapons/StarfleetMK2.cs @@ -1,68 +1,68 @@ -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 -{ - public class StarfleetMK2 : ModItem - { +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 +{ + public class StarfleetMK2 : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Starmada"); Tooltip.SetDefault("Fires a barrage of stars and plasma blasts"); } - - public override void SetDefaults() - { - item.damage = 308; - item.knockBack = 15f; - item.shootSpeed = 16f; - item.useStyle = 5; - item.useAnimation = 27; - item.useTime = 27; - item.reuseDelay = 0; - item.width = 122; - item.height = 50; - item.UseSound = SoundID.Item92; - item.shoot = mod.ProjectileType("StarfleetMK2"); - 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 = 14; - } - - 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("StarfleetMK2"), 0, 0f, player.whoAmI); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Starfleet"); - recipe.AddIngredient(null, "CosmiliteBar", 10); - recipe.AddIngredient(null, "ExodiumClusterOre", 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 308; + item.knockBack = 15f; + item.shootSpeed = 16f; + item.useStyle = 5; + item.useAnimation = 27; + item.useTime = 27; + item.reuseDelay = 0; + item.width = 122; + item.height = 50; + item.UseSound = SoundID.Item92; + item.shoot = mod.ProjectileType("StarfleetMK2"); + 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 = 14; + } + + 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("StarfleetMK2"), 0, 0f, player.whoAmI); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Starfleet"); + recipe.AddIngredient(null, "CosmiliteBar", 10); + recipe.AddIngredient(null, "ExodiumClusterOre", 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/StarnightLance.cs b/Items/Weapons/StarnightLance.cs index 2cc252e123..370bc5acd9 100644 --- a/Items/Weapons/StarnightLance.cs +++ b/Items/Weapons/StarnightLance.cs @@ -1,50 +1,50 @@ -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 StarnightLance : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starnight Lance"); - Tooltip.SetDefault("Shoots a starnight beam"); - } - - public override void SetDefaults() - { - item.width = 72; - item.damage = 68; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 23; - item.useStyle = 5; - item.useTime = 23; - item.knockBack = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 72; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("StarnightLanceProjectile"); - item.shootSpeed = 6f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 12); - recipe.AddTile(TileID.MythrilAnvil); - 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.Weapons +{ + public class StarnightLance : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starnight Lance"); + Tooltip.SetDefault("Shoots a starnight beam"); + } + + public override void SetDefaults() + { + item.width = 72; + item.damage = 68; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 23; + item.useStyle = 5; + item.useTime = 23; + item.knockBack = 6; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 72; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("StarnightLanceProjectile"); + item.shootSpeed = 6f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/StellarStriker.cs b/Items/Weapons/StellarStriker.cs index 503f6fda21..728d6fddf1 100644 --- a/Items/Weapons/StellarStriker.cs +++ b/Items/Weapons/StellarStriker.cs @@ -1,115 +1,115 @@ -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 -{ - public class StellarStriker : 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; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class StellarStriker : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Stellar Striker"); Tooltip.SetDefault("Summons a swarm of lunar flares from the sky on enemy hits"); } - - public override void SetDefaults() - { - item.width = 86; - item.damage = 640; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 7.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 86; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); - int i = Main.myPlayer; - 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 num112 = 2; - for (int num113 = 0; num113 < num112; num113++) - { - 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 * num113); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; - 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 num114 = num78; - float num115 = num79 + (float)Main.rand.Next(-80, 81) * 0.02f; - 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; - } - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 229); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CometQuasher"); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + + public override void SetDefaults() + { + item.width = 86; + item.damage = 640; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 7.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 86; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shootSpeed = 12f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); + int i = Main.myPlayer; + 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 num112 = 2; + for (int num113 = 0; num113 < num112; num113++) + { + 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 * num113); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; + 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 num114 = num78; + float num115 = num79 + (float)Main.rand.Next(-80, 81) * 0.02f; + 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; + } + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 229); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CometQuasher"); + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/StormDragoon.cs b/Items/Weapons/StormDragoon.cs index 6267beddf8..946cf579d4 100644 --- a/Items/Weapons/StormDragoon.cs +++ b/Items/Weapons/StormDragoon.cs @@ -1,62 +1,62 @@ -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 StormDragoon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Dragoon"); - Tooltip.SetDefault("Fires a spray of bullets"); - } - - public override void SetDefaults() - { - item.damage = 90; - item.ranged = true; - item.width = 74; - item.height = 34; - item.useTime = 2; - item.reuseDelay = 10; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 18f; - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 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(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 90) - return false; - return true; - } - } -} \ No newline at end of file +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 StormDragoon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Dragoon"); + Tooltip.SetDefault("Fires a spray of bullets"); + } + + public override void SetDefaults() + { + item.damage = 90; + item.ranged = true; + item.width = 74; + item.height = 34; + item.useTime = 2; + item.reuseDelay = 10; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 18f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-25, 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(-40, 41) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 90) + return false; + return true; + } + } +} diff --git a/Items/Weapons/StormRuler.cs b/Items/Weapons/StormRuler.cs index cecab382af..8c24a77cc7 100644 --- a/Items/Weapons/StormRuler.cs +++ b/Items/Weapons/StormRuler.cs @@ -1,61 +1,61 @@ -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 -{ - public class StormRuler : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Ruler"); - Tooltip.SetDefault("Only a storm can fell a greatwood\n" + - "Fires beams that generate tornadoes on death\n" + - "Tornadoes suck enemies in"); - } - - public override void SetDefaults() - { - item.width = 74; - item.damage = 65; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 82; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.shoot = mod.ProjectileType("StormRuler"); - item.shootSpeed = 20f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CoreofCinder", 3); - recipe.AddIngredient(null, "WindBlade"); - recipe.AddIngredient(null, "StormSaber"); - recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 187, (float)(player.direction * 2), 0f, 150, default(Color), 1.3f); - Main.dust[num250].velocity *= 0.2f; - } - } - } -} +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 +{ + public class StormRuler : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Ruler"); + Tooltip.SetDefault("Only a storm can fell a greatwood\n" + + "Fires beams that generate tornadoes on death\n" + + "Tornadoes suck enemies in"); + } + + public override void SetDefaults() + { + item.width = 74; + item.damage = 65; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 82; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.shoot = mod.ProjectileType("StormRuler"); + item.shootSpeed = 20f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CoreofCinder", 3); + recipe.AddIngredient(null, "WindBlade"); + recipe.AddIngredient(null, "StormSaber"); + recipe.AddIngredient(ItemID.FragmentSolar, 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 187, (float)(player.direction * 2), 0f, 150, default(Color), 1.3f); + Main.dust[num250].velocity *= 0.2f; + } + } + } +} diff --git a/Items/Weapons/StormSaber.cs b/Items/Weapons/StormSaber.cs index 11dfd6b0eb..edf1e2a823 100644 --- a/Items/Weapons/StormSaber.cs +++ b/Items/Weapons/StormSaber.cs @@ -1,47 +1,47 @@ -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 -{ - public class StormSaber : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Saber"); - Tooltip.SetDefault("Fires a storm beam"); - } - - public override void SetDefaults() - { - item.width = 58; - item.damage = 42; - item.melee = true; - item.useAnimation = 23; - item.useTime = 23; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 68; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("StormBeam"); - item.shootSpeed = 12f; - } - - 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, 187, (float)(player.direction * 2), 0f, 150, default(Color), 1.3f); - Main.dust[num250].velocity *= 0.2f; - } - } - } -} +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 +{ + public class StormSaber : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Saber"); + Tooltip.SetDefault("Fires a storm beam"); + } + + public override void SetDefaults() + { + item.width = 58; + item.damage = 42; + item.melee = true; + item.useAnimation = 23; + item.useTime = 23; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 68; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("StormBeam"); + item.shootSpeed = 12f; + } + + 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, 187, (float)(player.direction * 2), 0f, 150, default(Color), 1.3f); + Main.dust[num250].velocity *= 0.2f; + } + } + } +} diff --git a/Items/Weapons/StormSurge.cs b/Items/Weapons/StormSurge.cs index efd7bbbe0d..07618425e0 100644 --- a/Items/Weapons/StormSurge.cs +++ b/Items/Weapons/StormSurge.cs @@ -1,51 +1,51 @@ -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 StormSurge : 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.Weapons +{ + public class StormSurge : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Surge"); - Tooltip.SetDefault("Fear the storm\n" + + Tooltip.SetDefault("Fear the storm\n" + "Does not consume ammo"); } - - public override void SetDefaults() - { - item.damage = 22; - item.ranged = true; - item.width = 58; - item.height = 22; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item122; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.autoReuse = false; - item.shoot = mod.ProjectileType("StormSurge"); - item.shootSpeed = 10f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "StormlionMandible"); - recipe.AddIngredient(null, "VictideBar", 2); - recipe.AddIngredient(null, "AerialiteBar", 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 22; + item.ranged = true; + item.width = 58; + item.height = 22; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.UseSound = SoundID.Item122; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.autoReuse = false; + item.shoot = mod.ProjectileType("StormSurge"); + item.shootSpeed = 10f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "StormlionMandible"); + recipe.AddIngredient(null, "VictideBar", 2); + recipe.AddIngredient(null, "AerialiteBar", 2); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/StreamGouge.cs b/Items/Weapons/StreamGouge.cs index f5e2968f35..08bedfdf9c 100644 --- a/Items/Weapons/StreamGouge.cs +++ b/Items/Weapons/StreamGouge.cs @@ -1,64 +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 -{ - public class StreamGouge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stream Gouge"); - Tooltip.SetDefault("Fires an essence flame beam\n" + - "Ignores immunity frames"); - } - - public override void SetDefaults() - { - item.width = 86; - item.damage = 350; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = 5; - item.useTime = 19; - item.knockBack = 9.75f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.height = 86; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("StreamGouge"); - item.shootSpeed = 15f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 14); - recipe.AddTile(null, "DraedonsForge"); - 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.Weapons +{ + public class StreamGouge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stream Gouge"); + Tooltip.SetDefault("Fires an essence flame beam\n" + + "Ignores immunity frames"); + } + + public override void SetDefaults() + { + item.width = 86; + item.damage = 350; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 19; + item.useStyle = 5; + item.useTime = 19; + item.knockBack = 9.75f; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.height = 86; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("StreamGouge"); + item.shootSpeed = 15f; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 14); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SubsumingVortex.cs b/Items/Weapons/SubsumingVortex.cs index d5d4fdb196..793f8e54ff 100644 --- a/Items/Weapons/SubsumingVortex.cs +++ b/Items/Weapons/SubsumingVortex.cs @@ -1,73 +1,73 @@ -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 SubsumingVortex : 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.Weapons +{ + public class SubsumingVortex : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Subsuming Vortex"); Tooltip.SetDefault("Fires 3 vortexes of elemental energy"); } - public override void SetDefaults() - { - item.damage = 520; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 30; - item.UseSound = SoundID.Item84; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Vortex"); - item.shootSpeed = 9f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - 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) - { - float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; - float ai = (Main.rand.NextFloat() + 0.5f); - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, ai); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AuguroftheElements"); - recipe.AddIngredient(null, "NuclearFury"); - recipe.AddIngredient(null, "RelicofRuin"); - recipe.AddIngredient(null, "TearsofHeaven"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "HellcasterFragment", 3); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "AuricOre", 25); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 520; + item.magic = true; + item.mana = 20; + item.width = 28; + item.height = 30; + item.UseSound = SoundID.Item84; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Vortex"); + item.shootSpeed = 9f; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + 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) + { + float SpeedX = speedX + (float) Main.rand.Next(-50, 51) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-50, 51) * 0.05f; + float ai = (Main.rand.NextFloat() + 0.5f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, ai); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AuguroftheElements"); + recipe.AddIngredient(null, "NuclearFury"); + recipe.AddIngredient(null, "RelicofRuin"); + recipe.AddIngredient(null, "TearsofHeaven"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "HellcasterFragment", 3); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SunGodStaff.cs b/Items/Weapons/SunGodStaff.cs index 8f12333e4d..6b04c647a4 100644 --- a/Items/Weapons/SunGodStaff.cs +++ b/Items/Weapons/SunGodStaff.cs @@ -1,75 +1,75 @@ -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.Weapons -{ - public class SunGodStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sun God Staff"); - Tooltip.SetDefault("Summons a solar god spirit to protect you"); - } - - public override void SetDefaults() - { - item.damage = 60; - item.mana = 10; - item.width = 50; - item.height = 50; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 1.25f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SolarGod"); - item.summon = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SunSpiritStaff"); - recipe.AddIngredient(null, "EssenceofCinder", 5); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - 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) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - for (int x = 0; x < 1000; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.owner == player.whoAmI && projectile.type == mod.ProjectileType("SolarGod")) - { - projectile.Kill(); - } - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - return false; - } - } -} \ No newline at end of file +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.Weapons +{ + public class SunGodStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sun God Staff"); + Tooltip.SetDefault("Summons a solar god spirit to protect you"); + } + + public override void SetDefaults() + { + item.damage = 60; + item.mana = 10; + item.width = 50; + item.height = 50; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 1.25f; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SolarGod"); + item.summon = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SunSpiritStaff"); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddIngredient(ItemID.SoulofMight, 3); + recipe.AddIngredient(ItemID.SoulofSight, 3); + recipe.AddIngredient(ItemID.SoulofFright, 3); + recipe.AddTile(TileID.MythrilAnvil); + 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) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + for (int x = 0; x < 1000; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.owner == player.whoAmI && projectile.type == mod.ProjectileType("SolarGod")) + { + projectile.Kill(); + } + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/SunSpiritStaff.cs b/Items/Weapons/SunSpiritStaff.cs index 90beef401b..9f7a43cbc8 100644 --- a/Items/Weapons/SunSpiritStaff.cs +++ b/Items/Weapons/SunSpiritStaff.cs @@ -1,72 +1,72 @@ -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.Weapons -{ - public class SunSpiritStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sun Spirit Staff"); - Tooltip.SetDefault("Summons a solar spirit to protect you"); - } - - public override void SetDefaults() - { - item.damage = 12; - item.mana = 10; - item.width = 44; - item.height = 42; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 1.15f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SolarPixie"); - item.summon = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SandstoneBrick, 20); - recipe.AddIngredient(null, "DesertFeather", 2); - recipe.AddTile(TileID.Anvils); - 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) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - for (int x = 0; x < 1000; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.owner == player.whoAmI && projectile.type == mod.ProjectileType("SolarPixie")) - { - projectile.Kill(); - } - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - return false; - } - } -} \ No newline at end of file +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.Weapons +{ + public class SunSpiritStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sun Spirit Staff"); + Tooltip.SetDefault("Summons a solar spirit to protect you"); + } + + public override void SetDefaults() + { + item.damage = 12; + item.mana = 10; + item.width = 44; + item.height = 42; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 1.15f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SolarPixie"); + item.summon = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SandstoneBrick, 20); + recipe.AddIngredient(null, "DesertFeather", 2); + recipe.AddTile(TileID.Anvils); + 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) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + for (int x = 0; x < 1000; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.owner == player.whoAmI && projectile.type == mod.ProjectileType("SolarPixie")) + { + projectile.Kill(); + } + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/SunkenSea/AquamarineStaff.cs b/Items/Weapons/SunkenSea/AquamarineStaff.cs index ff5902e3b1..e890fee988 100644 --- a/Items/Weapons/SunkenSea/AquamarineStaff.cs +++ b/Items/Weapons/SunkenSea/AquamarineStaff.cs @@ -1,72 +1,72 @@ -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.SunkenSea -{ - public class AquamarineStaff : 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.Weapons.SunkenSea +{ + public class AquamarineStaff : ModItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Aquamarine Staff"); + DisplayName.SetDefault("Aquamarine Staff"); Tooltip.SetDefault("Shoots two blue bolts"); Item.staff[item.type] = true; } - - public override void SetDefaults() - { - item.damage = 10; - item.magic = true; - item.mana = 3; - item.width = 38; - item.height = 38; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("AquamarineBolt"); - item.shootSpeed = 9f; - } - - 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 = Main.rand.Next(2, 3); - 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; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 180; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.RubyStaff); - recipe.AddIngredient(null, "SeaPrism", 5); - recipe.AddIngredient(null, "Navystone", 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DiamondStaff); - recipe.AddIngredient(null, "SeaPrism", 5); - recipe.AddIngredient(null, "Navystone", 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 10; + item.magic = true; + item.mana = 3; + item.width = 38; + item.height = 38; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("AquamarineBolt"); + item.shootSpeed = 9f; + } + + 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 = Main.rand.Next(2, 3); + 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; + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].timeLeft = 180; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RubyStaff); + recipe.AddIngredient(null, "SeaPrism", 5); + recipe.AddIngredient(null, "Navystone", 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DiamondStaff); + recipe.AddIngredient(null, "SeaPrism", 5); + recipe.AddIngredient(null, "Navystone", 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SunkenSea/AquashardShotgun.cs b/Items/Weapons/SunkenSea/AquashardShotgun.cs index bf00cc4a5b..d4dd41fa90 100644 --- a/Items/Weapons/SunkenSea/AquashardShotgun.cs +++ b/Items/Weapons/SunkenSea/AquashardShotgun.cs @@ -1,70 +1,70 @@ -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.SunkenSea -{ - public class AquashardShotgun : 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.Weapons.SunkenSea +{ + public class AquashardShotgun : ModItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Aquashard Shotgun"); + DisplayName.SetDefault("Aquashard Shotgun"); Tooltip.SetDefault("Shoots aquashards which split upon hitting an enemy"); } - - public override void SetDefaults() - { - item.damage = 12; - item.ranged = true; - item.width = 62; - item.height = 26; - item.crit += 6; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item61; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Aquashard"); - item.shootSpeed = 22f; - } - - 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 = Main.rand.Next(2, 4); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 200; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Boomstick); - recipe.AddIngredient(null, "SeaPrism", 5); - recipe.AddIngredient(null, "PrismShard", 5); - recipe.AddIngredient(null, "Navystone", 25); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 12; + item.ranged = true; + item.width = 62; + item.height = 26; + item.crit += 6; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item61; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Aquashard"); + item.shootSpeed = 22f; + } + + 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 = Main.rand.Next(2, 4); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].timeLeft = 200; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Boomstick); + recipe.AddIngredient(null, "SeaPrism", 5); + recipe.AddIngredient(null, "PrismShard", 5); + recipe.AddIngredient(null, "Navystone", 25); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SunkenSea/ClamCrusher.cs b/Items/Weapons/SunkenSea/ClamCrusher.cs index 4179fbc59c..6ac932caec 100644 --- a/Items/Weapons/SunkenSea/ClamCrusher.cs +++ b/Items/Weapons/SunkenSea/ClamCrusher.cs @@ -1,42 +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.Weapons.SunkenSea -{ - public class ClamCrusher : 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.Weapons.SunkenSea +{ + public class ClamCrusher : ModItem + { public override void SetStaticDefaults() { - DisplayName.SetDefault("Clam Crusher"); - Tooltip.SetDefault("Launches a huge clam that stuns enemies for a short amount of time\n" + + DisplayName.SetDefault("Clam Crusher"); + Tooltip.SetDefault("Launches a huge clam that stuns enemies for a short amount of time\n" + "Starts being affected by gravity and does much more damage after being airborne for a while"); } - public override void SetDefaults() - { - item.damage = 140; - item.melee = true; - item.width = 40; - item.height = 60; - item.useTime = 50; - item.useAnimation = 50; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.knockBack = 10f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.channel = true; - item.shoot = mod.ProjectileType("ClamCrusherFlail"); - item.shootSpeed = 18f; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 140; + item.melee = true; + item.width = 40; + item.height = 60; + item.useTime = 50; + item.useAnimation = 50; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.knockBack = 10f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.channel = true; + item.shoot = mod.ProjectileType("ClamCrusherFlail"); + item.shootSpeed = 18f; + } + } +} diff --git a/Items/Weapons/SunkenSea/ClamorRifle.cs b/Items/Weapons/SunkenSea/ClamorRifle.cs index 3d150ba3ac..80e657c6d0 100644 --- a/Items/Weapons/SunkenSea/ClamorRifle.cs +++ b/Items/Weapons/SunkenSea/ClamorRifle.cs @@ -1,51 +1,51 @@ -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.SunkenSea -{ - public class ClamorRifle : 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.Weapons.SunkenSea +{ + public class ClamorRifle : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Clamor Rifle"); Tooltip.SetDefault("Shoots homing energy bolts"); } - public override void SetDefaults() - { - item.damage = 32; - item.ranged = true; - item.width = 64; - item.height = 30; - item.useTime = 13; - item.useAnimation = 13; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - item.autoReuse = true; - item.rare = 5; - item.shoot = mod.ProjectileType("ClamorRifleProj"); - item.shootSpeed = 15f; - item.useAmmo = 97; - } - - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ClamorRifleProj"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 32; + item.ranged = true; + item.width = 64; + item.height = 30; + item.useTime = 13; + item.useAnimation = 13; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + item.autoReuse = true; + item.rare = 5; + item.shoot = mod.ProjectileType("ClamorRifleProj"); + item.shootSpeed = 15f; + item.useAmmo = 97; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ClamorRifleProj"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/SunkenSea/EutrophicScimitar.cs b/Items/Weapons/SunkenSea/EutrophicScimitar.cs index ea075c80f8..1f77376fe4 100644 --- a/Items/Weapons/SunkenSea/EutrophicScimitar.cs +++ b/Items/Weapons/SunkenSea/EutrophicScimitar.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; - + namespace CalamityMod.Items.Weapons.SunkenSea -{ +{ public class EutrophicScimitar : ModItem { public override void SetStaticDefaults() @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.SunkenSea item.useStyle = 1; item.knockBack = 2; item.shoot = mod.ProjectileType("EutrophicScimitarProj"); - item.shootSpeed = 17; + item.shootSpeed = 17; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; item.UseSound = SoundID.Item1; @@ -32,16 +32,16 @@ namespace CalamityMod.Items.Weapons.SunkenSea item.useTurn = 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) - { - for (int i = 0; i <= 21; i++) - { - Dust dust; - dust = Main.dust[Terraria.Dust.NewDust(new Vector2(position.X - 58 / 2, position.Y - 58 / 2), 58, 58, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; - dust.noGravity = true; - dust.fadeIn = 0.9473684f; - } - 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) + { + for (int i = 0; i <= 21; i++) + { + Dust dust; + dust = Main.dust[Terraria.Dust.NewDust(new Vector2(position.X - 58 / 2, position.Y - 58 / 2), 58, 58, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; + dust.noGravity = true; + dust.fadeIn = 0.9473684f; + } + return true; + } } } diff --git a/Items/Weapons/SunkenSea/EutrophicShank.cs b/Items/Weapons/SunkenSea/EutrophicShank.cs index ece14e02d0..e9ffd0e000 100644 --- a/Items/Weapons/SunkenSea/EutrophicShank.cs +++ b/Items/Weapons/SunkenSea/EutrophicShank.cs @@ -1,59 +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.Items.Weapons.SunkenSea -{ - public class EutrophicShank : ModItem - { +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.SunkenSea +{ + public class EutrophicShank : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Eutrophic Shank"); Tooltip.SetDefault("Shoots electric sparks"); } - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 14; - item.useTime = 14; - item.width = 42; - item.height = 38; - item.damage = 24; - item.melee = true; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("EutrophicSpark"); - item.shootSpeed = 3f; - } - - 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, 206, 0f, 0f, 100, default(Color), 1f); - } - } - - 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 = Main.rand.Next(1, 2); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-60, 61) * 0.05f; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - } -} + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 14; + item.useTime = 14; + item.width = 42; + item.height = 38; + item.damage = 24; + item.melee = true; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("EutrophicSpark"); + item.shootSpeed = 3f; + } + + 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, 206, 0f, 0f, 100, default(Color), 1f); + } + } + + 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 = Main.rand.Next(1, 2); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float) Main.rand.Next(-60, 61) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-60, 61) * 0.05f; + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } +} diff --git a/Items/Weapons/SunkenSea/Poseidon.cs b/Items/Weapons/SunkenSea/Poseidon.cs index f4d73a9d61..33e9e05f6a 100644 --- a/Items/Weapons/SunkenSea/Poseidon.cs +++ b/Items/Weapons/SunkenSea/Poseidon.cs @@ -1,40 +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.Weapons.SunkenSea -{ - public class Poseidon : 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.Weapons.SunkenSea +{ + public class Poseidon : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Poseidon"); Tooltip.SetDefault("Casts a poseidon typhoon"); } - public override void SetDefaults() - { - item.damage = 58; - item.magic = true; - item.mana = 15; - item.width = 28; - item.height = 32; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = SoundID.Item84; - item.rare = 5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("PoseidonTyphoon"); - item.shootSpeed = 10f; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 58; + item.magic = true; + item.mana = 15; + item.width = 28; + item.height = 32; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.UseSound = SoundID.Item84; + item.rare = 5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("PoseidonTyphoon"); + item.shootSpeed = 10f; + } + } +} diff --git a/Items/Weapons/SunkenSea/SeashineSword.cs b/Items/Weapons/SunkenSea/SeashineSword.cs index 6e10706522..fe87bf5d66 100644 --- a/Items/Weapons/SunkenSea/SeashineSword.cs +++ b/Items/Weapons/SunkenSea/SeashineSword.cs @@ -1,10 +1,10 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; - + namespace CalamityMod.Items.Weapons.SunkenSea -{ +{ public class SeashineSword : ModItem { public override void SetStaticDefaults() @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Weapons.SunkenSea } public override void SetDefaults() - { + { item.CloneDefaults(ItemID.EnchantedSword); item.damage = 26; - item.melee = true; + item.melee = true; item.value = Item.buyPrice(0, 2, 0, 0); item.width = 38; item.height = 38; @@ -25,22 +25,22 @@ namespace CalamityMod.Items.Weapons.SunkenSea item.shootSpeed = 11; item.rare = 2; item.UseSound = SoundID.Item1; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - type = mod.ProjectileType("SeashineSwordProj"); - return base.Shoot(player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SeaPrism", 7); - recipe.AddIngredient(null, "Navystone", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + type = mod.ProjectileType("SeashineSwordProj"); + return base.Shoot(player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SeaPrism", 7); + recipe.AddIngredient(null, "Navystone", 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/SunkenSea/Serpentine.cs b/Items/Weapons/SunkenSea/Serpentine.cs index 5cf3505a64..623fbf1f21 100644 --- a/Items/Weapons/SunkenSea/Serpentine.cs +++ b/Items/Weapons/SunkenSea/Serpentine.cs @@ -1,98 +1,98 @@ -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.SunkenSea -{ - public class Serpentine : 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.Weapons.SunkenSea +{ + public class Serpentine : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Serpentine"); Tooltip.SetDefault("Casts a serpent that follows the mouse cursor"); } - public override void SetDefaults() - { - item.damage = 10; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 32; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = SoundID.Item20; - item.rare = 5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("SerpentineHead"); - item.shootSpeed = 10f; - } - - 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 owner = player.whoAmI; - float num72 = item.shootSpeed; - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; - float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) - { - velX = (float)player.direction; - velY = 0f; - dist = num72; - } - else - { - dist = num72 / dist; - } - velX *= dist; - velY *= dist; - float num77 = Vector2.Dot(value, vector3); - if (num77 > 0f) - { - player.ChangeDir(1); - } - else - { - player.ChangeDir(-1); - } - //velX = 0f; - //velY = 0f; - //vector2.X = (float)Main.mouseX + Main.screenPosition.X; - //vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - int curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineHead"), damage, knockBack, owner); - - int prev = curr; - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); - - prev = curr; - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); - - prev = curr; - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); - - prev = curr; - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineTail"), damage, knockBack, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 10; + item.magic = true; + item.mana = 20; + item.width = 28; + item.height = 32; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.UseSound = SoundID.Item20; + item.rare = 5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("SerpentineHead"); + item.shootSpeed = 10f; + } + + 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 owner = player.whoAmI; + float num72 = item.shootSpeed; + player.itemTime = item.useTime; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); + Vector2 vector3 = Main.MouseWorld - vector2; + float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) + { + velX = (float)player.direction; + velY = 0f; + dist = num72; + } + else + { + dist = num72 / dist; + } + velX *= dist; + velY *= dist; + float num77 = Vector2.Dot(value, vector3); + if (num77 > 0f) + { + player.ChangeDir(1); + } + else + { + player.ChangeDir(-1); + } + //velX = 0f; + //velY = 0f; + //vector2.X = (float)Main.mouseX + Main.screenPosition.X; + //vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; + int curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineHead"), damage, knockBack, owner); + + int prev = curr; + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); + + prev = curr; + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); + + prev = curr; + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineBody"), damage, knockBack, owner, (float)prev); + + prev = curr; + curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("SerpentineTail"), damage, knockBack, owner, (float)prev); + Main.projectile[prev].localAI[1] = (float)curr; + Main.projectile[prev].netUpdate = true; + return false; + } + } +} diff --git a/Items/Weapons/SunkenSea/ShellfishStaff.cs b/Items/Weapons/SunkenSea/ShellfishStaff.cs index 4010f8b7dc..4e7f87ca2e 100644 --- a/Items/Weapons/SunkenSea/ShellfishStaff.cs +++ b/Items/Weapons/SunkenSea/ShellfishStaff.cs @@ -1,73 +1,73 @@ -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.Weapons.SunkenSea -{ - public class ShellfishStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shellfish Staff"); - Tooltip.SetDefault("Summons a shellfish to fight for you\n" + - "Takes up 2 minion slots"); - } - - public override void SetDefaults() - { - item.damage = 70; - item.mana = 10; - item.width = 50; - item.height = 50; - item.useTime = 36; - item.useAnimation = 36; - item.useStyle = 1; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item44; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Shellfish"); - item.shootSpeed = 10f; - item.summon = true; - } - - 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 +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.Weapons.SunkenSea +{ + public class ShellfishStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shellfish Staff"); + Tooltip.SetDefault("Summons a shellfish to fight for you\n" + + "Takes up 2 minion slots"); + } + + public override void SetDefaults() + { + item.damage = 70; + item.mana = 10; + item.width = 50; + item.height = 50; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Shellfish"); + item.shootSpeed = 10f; + item.summon = true; + } + + 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); + } + } +} diff --git a/Items/Weapons/SunkenSea/Whirlpool.cs b/Items/Weapons/SunkenSea/Whirlpool.cs index 60f4afa815..61d63ac583 100644 --- a/Items/Weapons/SunkenSea/Whirlpool.cs +++ b/Items/Weapons/SunkenSea/Whirlpool.cs @@ -1,50 +1,50 @@ -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; - -namespace CalamityMod.Items.Weapons.SunkenSea -{ - public class Whirlpool : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Riptide"); - Tooltip.SetDefault("Sprays a spiral of aqua streams in random directions"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 18; - item.width = 30; - item.height = 44; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.knockBack = 1f; - item.channel = true; - item.melee = true; - item.useStyle = 8; - item.useAnimation = 8; - item.useTime = 8; - item.shoot = mod.ProjectileType("WhirlpoolProjectile"); - item.shootSpeed = 18f; - item.UseSound = SoundID.Item1; - ItemID.Sets.Yoyo[item.type] = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SeaPrism", 7); - recipe.AddIngredient(null, "Navystone", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +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; + +namespace CalamityMod.Items.Weapons.SunkenSea +{ + public class Whirlpool : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Riptide"); + Tooltip.SetDefault("Sprays a spiral of aqua streams in random directions"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.damage = 18; + item.width = 30; + item.height = 44; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.knockBack = 1f; + item.channel = true; + item.melee = true; + item.useStyle = 8; + item.useAnimation = 8; + item.useTime = 8; + item.shoot = mod.ProjectileType("WhirlpoolProjectile"); + item.shootSpeed = 18f; + item.UseSound = SoundID.Item1; + ItemID.Sets.Yoyo[item.type] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SeaPrism", 7); + recipe.AddIngredient(null, "Navystone", 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/SuperballBullet.cs b/Items/Weapons/SuperballBullet.cs index 28db59ec15..7c05f779a0 100644 --- a/Items/Weapons/SuperballBullet.cs +++ b/Items/Weapons/SuperballBullet.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class SuperballBullet : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class SuperballBullet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Superball Bullet"); Tooltip.SetDefault("Bounces at extreme speeds"); } - - public override void SetDefaults() - { - item.damage = 6; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 250; - item.rare = 1; - item.shoot = mod.ProjectileType("SuperballBullet"); - item.shootSpeed = 1f; - item.ammo = 97; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteorShot, 150); - recipe.AddIngredient(null, "VictoryShard"); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 150); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 6; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 250; + item.rare = 1; + item.shoot = mod.ProjectileType("SuperballBullet"); + item.shootSpeed = 1f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteorShot, 150); + recipe.AddIngredient(null, "VictoryShard"); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 150); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Svantechnical.cs b/Items/Weapons/Svantechnical.cs index 6f14e320bf..611340df3b 100644 --- a/Items/Weapons/Svantechnical.cs +++ b/Items/Weapons/Svantechnical.cs @@ -1,113 +1,113 @@ -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 Svantechnical : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Svantechnical"); - Tooltip.SetDefault("Fires several barrages of bullets"); - } - - public override void SetDefaults() - { - item.damage = 625; - item.ranged = true; - item.width = 60; - item.height = 26; - item.useAnimation = 24; - item.reuseDelay = 10; - item.useTime = 2; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item31; - item.autoReuse = true; - item.shootSpeed = 12f; - item.shoot = 10; - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 16; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 70) - return false; - 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 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; - } - float num208 = num78; - float num209 = num79; - num208 += (float)Main.rand.Next(-1, 2) * 0.5f; - num209 += (float)Main.rand.Next(-1, 2) * 0.5f; - if (Collision.CanHitLine(player.Center, 0, 0, vector2 + new Vector2(num208, num209) * 2f, 0, 0)) - { - vector2 += new Vector2(num208, num209); - } - Projectile.NewProjectile(position.X, position.Y - player.gravDir * 4f, num208, num209, type, num73, num74, i, 0f, (float)Main.rand.Next(12) / 6f); - int num6 = Main.rand.Next(2, 4); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-60, 61) * 0.05f; - Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SDMG); - recipe.AddIngredient(null, "ShadowspecBar", 5); - recipe.AddIngredient(ItemID.SoulofMight, 10); - recipe.AddIngredient(ItemID.SoulofSight, 10); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Svantechnical : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Svantechnical"); + Tooltip.SetDefault("Fires several barrages of bullets"); + } + + public override void SetDefaults() + { + item.damage = 625; + item.ranged = true; + item.width = 60; + item.height = 26; + item.useAnimation = 24; + item.reuseDelay = 10; + item.useTime = 2; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = 10; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 70) + return false; + 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 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; + } + float num208 = num78; + float num209 = num79; + num208 += (float)Main.rand.Next(-1, 2) * 0.5f; + num209 += (float)Main.rand.Next(-1, 2) * 0.5f; + if (Collision.CanHitLine(player.Center, 0, 0, vector2 + new Vector2(num208, num209) * 2f, 0, 0)) + { + vector2 += new Vector2(num208, num209); + } + Projectile.NewProjectile(position.X, position.Y - player.gravDir * 4f, num208, num209, type, num73, num74, i, 0f, (float)Main.rand.Next(12) / 6f); + int num6 = Main.rand.Next(2, 4); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-60, 61) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-60, 61) * 0.05f; + Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SDMG); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddIngredient(ItemID.SoulofMight, 10); + recipe.AddIngredient(ItemID.SoulofSight, 10); + recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/T1000.cs b/Items/Weapons/T1000.cs index 3f74124be0..8f9030ae72 100644 --- a/Items/Weapons/T1000.cs +++ b/Items/Weapons/T1000.cs @@ -1,59 +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 -{ - public class T1000 : 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.Weapons +{ + public class T1000 : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("T1000"); Tooltip.SetDefault("Fires a spread of rainbow lasers"); } - public override void SetDefaults() - { - item.damage = 370; - item.magic = true; - item.mana = 10; - item.width = 20; - item.height = 12; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 4f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("T1000"); - item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Purge"); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("T1000"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 370; + item.magic = true; + item.mana = 10; + item.width = 20; + item.height = 12; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 4f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("T1000"); + item.shootSpeed = 24f; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Purge"); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("T1000"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/TeardropCleaver.cs b/Items/Weapons/TeardropCleaver.cs index 4a8a68e912..c08aa7c525 100644 --- a/Items/Weapons/TeardropCleaver.cs +++ b/Items/Weapons/TeardropCleaver.cs @@ -1,42 +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.Weapons -{ - public class TeardropCleaver : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Teardrop Cleaver"); - Tooltip.SetDefault("Makes your enemies cry"); - } - - public override void SetDefaults() - { - item.width = 52; - item.damage = 18; - item.melee = true; - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.useTurn = true; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 56; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 120); - } - } -} +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 TeardropCleaver : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Teardrop Cleaver"); + Tooltip.SetDefault("Makes your enemies cry"); + } + + public override void SetDefaults() + { + item.width = 52; + item.damage = 18; + item.melee = true; + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.useTurn = true; + item.knockBack = 4.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 56; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 120); + } + } +} diff --git a/Items/Weapons/TearsofHeaven.cs b/Items/Weapons/TearsofHeaven.cs index 3a718d82f8..f1f6ff61bc 100644 --- a/Items/Weapons/TearsofHeaven.cs +++ b/Items/Weapons/TearsofHeaven.cs @@ -1,67 +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 -{ - public class TearsofHeaven : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tears of Heaven"); - Tooltip.SetDefault("Casts slow-moving homing balls of heavenly light"); - } - - public override void SetDefaults() - { - item.damage = 72; - item.magic = true; - item.mana = 18; - item.width = 28; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TearsofHeavenProjectile"); - item.shootSpeed = 5.5f; - } - - 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(2, 3); - 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), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "FrigidflashBolt"); - recipe.AddIngredient(ItemID.WaterBolt); - recipe.AddIngredient(null, "CoreofCinder", 5); - recipe.AddTile(TileID.Bookcases); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 TearsofHeaven : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tears of Heaven"); + Tooltip.SetDefault("Casts slow-moving homing balls of heavenly light"); + } + + public override void SetDefaults() + { + item.damage = 72; + item.magic = true; + item.mana = 18; + item.width = 28; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TearsofHeavenProjectile"); + item.shootSpeed = 5.5f; + } + + 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(2, 3); + 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), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "FrigidflashBolt"); + recipe.AddIngredient(ItemID.WaterBolt); + recipe.AddIngredient(null, "CoreofCinder", 5); + recipe.AddTile(TileID.Bookcases); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TemporalFloeSword.cs b/Items/Weapons/TemporalFloeSword.cs index 63c580abd1..5a864534a8 100644 --- a/Items/Weapons/TemporalFloeSword.cs +++ b/Items/Weapons/TemporalFloeSword.cs @@ -1,66 +1,66 @@ -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 -{ - public class TemporalFloeSword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Temporal Floe Sword"); - Tooltip.SetDefault("The iceman cometh...\n" + - "Fires a frozen sword beam"); - } - - public override void SetDefaults() - { - item.width = 50; - item.damage = 85; - item.melee = true; - item.useAnimation = 16; - item.useStyle = 1; - item.useTime = 16; - item.useTurn = true; - item.knockBack = 6; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 58; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("TemporalFloeSwordProjectile"); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 15); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - recipe.AddTile(TileID.IceMachine); - 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, 34); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(3) == 0) - { - target.AddBuff(mod.BuffType("GlacialState"), 120); - } - target.AddBuff(BuffID.Frostburn, 600); - } - } -} +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 +{ + public class TemporalFloeSword : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Temporal Floe Sword"); + Tooltip.SetDefault("The iceman cometh...\n" + + "Fires a frozen sword beam"); + } + + public override void SetDefaults() + { + item.width = 50; + item.damage = 85; + item.melee = true; + item.useAnimation = 16; + item.useStyle = 1; + item.useTime = 16; + item.useTurn = true; + item.knockBack = 6; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 58; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("TemporalFloeSwordProjectile"); + item.shootSpeed = 16f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 15); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + recipe.AddTile(TileID.IceMachine); + 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, 34); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(3) == 0) + { + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + target.AddBuff(BuffID.Frostburn, 600); + } + } +} diff --git a/Items/Weapons/TerraArrow.cs b/Items/Weapons/TerraArrow.cs index c15f6c4734..0e912766f7 100644 --- a/Items/Weapons/TerraArrow.cs +++ b/Items/Weapons/TerraArrow.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class TerraArrow : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class TerraArrow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Arrow"); Tooltip.SetDefault("Travels incredibly quickly and explodes into more arrows when it hits a certain velocity"); } - - public override void SetDefaults() - { - item.damage = 9; - item.ranged = true; - item.width = 22; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.5f; - item.value = 2000; - item.rare = 7; - item.shoot = mod.ProjectileType("TerraArrow"); - item.shootSpeed = 15f; - item.ammo = 40; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddIngredient(ItemID.WoodenArrow, 250); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 9; + item.ranged = true; + item.width = 22; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.5f; + item.value = 2000; + item.rare = 7; + item.shoot = mod.ProjectileType("TerraArrow"); + item.shootSpeed = 15f; + item.ammo = 40; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddIngredient(ItemID.WoodenArrow, 250); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TerraBullet.cs b/Items/Weapons/TerraBullet.cs index d4d698ee77..e844471d66 100644 --- a/Items/Weapons/TerraBullet.cs +++ b/Items/Weapons/TerraBullet.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class TerraBullet : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class TerraBullet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Bullet"); Tooltip.SetDefault("Explodes and splits into homing terra shards on death"); } - - public override void SetDefaults() - { - item.damage = 9; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = 2000; - item.rare = 7; - item.shoot = mod.ProjectileType("TerraBullet"); - item.shootSpeed = 10f; - item.ammo = 97; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalBullet, 100); - recipe.AddIngredient(null, "LivingShard"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 9; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.25f; + item.value = 2000; + item.rare = 7; + item.shoot = mod.ProjectileType("TerraBullet"); + item.shootSpeed = 10f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalBullet, 100); + recipe.AddIngredient(null, "LivingShard"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TerraEdge.cs b/Items/Weapons/TerraEdge.cs index 4be48a8813..a36630fa7b 100644 --- a/Items/Weapons/TerraEdge.cs +++ b/Items/Weapons/TerraEdge.cs @@ -1,76 +1,76 @@ -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 -{ - public class TerraEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Edge"); - Tooltip.SetDefault("Heals the player on enemy hits\n" + - "Fires a beam that inflicts ichor for a short time"); - } - - public override void SetDefaults() - { - item.width = 58; - item.damage = 112; - item.melee = true; - item.useAnimation = 17; - item.useStyle = 1; - item.useTime = 17; - item.useTurn = true; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.height = 58; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("TerraEdgeBeam"); - item.shootSpeed = 12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueBloodyEdge"); - recipe.AddIngredient(ItemID.TrueExcalibur); - recipe.AddIngredient(null, "LivingShard", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TrueNightsEdge); - recipe.AddIngredient(ItemID.TrueExcalibur); - recipe.AddIngredient(null, "LivingShard", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 107); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - int healAmount = (Main.rand.Next(2) + 2); - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } -} +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 +{ + public class TerraEdge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Edge"); + Tooltip.SetDefault("Heals the player on enemy hits\n" + + "Fires a beam that inflicts ichor for a short time"); + } + + public override void SetDefaults() + { + item.width = 58; + item.damage = 112; + item.melee = true; + item.useAnimation = 17; + item.useStyle = 1; + item.useTime = 17; + item.useTurn = true; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.height = 58; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("TerraEdgeBeam"); + item.shootSpeed = 12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueBloodyEdge"); + recipe.AddIngredient(ItemID.TrueExcalibur); + recipe.AddIngredient(null, "LivingShard", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TrueNightsEdge); + recipe.AddIngredient(ItemID.TrueExcalibur); + recipe.AddIngredient(null, "LivingShard", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 107); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + int healAmount = (Main.rand.Next(2) + 2); + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } +} diff --git a/Items/Weapons/TerraFlameburster.cs b/Items/Weapons/TerraFlameburster.cs index 73dec9b37b..9994e899db 100644 --- a/Items/Weapons/TerraFlameburster.cs +++ b/Items/Weapons/TerraFlameburster.cs @@ -1,58 +1,58 @@ -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 TerraFlameburster : 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.Weapons +{ + public class TerraFlameburster : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Flameburster"); Tooltip.SetDefault("80% chance to not consume gel"); } - - public override void SetDefaults() - { - item.damage = 56; - item.ranged = true; - item.width = 68; - item.height = 22; - item.useTime = 3; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TerraFireGreen"); - item.shootSpeed = 7.5f; - item.useAmmo = 23; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 80) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Flamethrower); - recipe.AddIngredient(null, "LivingShard", 7); - recipe.AddIngredient(null, "EssenceofCinder", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 56; + item.ranged = true; + item.width = 68; + item.height = 22; + item.useTime = 3; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TerraFireGreen"); + item.shootSpeed = 7.5f; + item.useAmmo = 23; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 80) + return false; + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Flamethrower); + recipe.AddIngredient(null, "LivingShard", 7); + recipe.AddIngredient(null, "EssenceofCinder", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TerraLance.cs b/Items/Weapons/TerraLance.cs index 182a6dfa5d..0155cdf1e9 100644 --- a/Items/Weapons/TerraLance.cs +++ b/Items/Weapons/TerraLance.cs @@ -1,63 +1,63 @@ -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 TerraLance : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Lance"); - Tooltip.SetDefault("Fires a lance beam"); - } - - public override void SetDefaults() - { - item.width = 44; - item.damage = 88; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 17; - item.useStyle = 5; - item.useTime = 17; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 44; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("TerraLanceProjectile"); - item.shootSpeed = 11f; - } - - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ChlorophytePartisan); - recipe.AddIngredient(null, "LivingShard", 7); - recipe.AddTile(TileID.MythrilAnvil); - 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.Weapons +{ + public class TerraLance : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Lance"); + Tooltip.SetDefault("Fires a lance beam"); + } + + public override void SetDefaults() + { + item.width = 44; + item.damage = 88; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 17; + item.useStyle = 5; + item.useTime = 17; + item.knockBack = 8.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("TerraLanceProjectile"); + item.shootSpeed = 11f; + } + + public override bool CanUseItem(Player player) + { + for (int i = 0; i < 1000; ++i) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) + { + return false; + } + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ChlorophytePartisan); + recipe.AddIngredient(null, "LivingShard", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TerraRay.cs b/Items/Weapons/TerraRay.cs index 979c181605..239687ca71 100644 --- a/Items/Weapons/TerraRay.cs +++ b/Items/Weapons/TerraRay.cs @@ -1,57 +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 -{ - public class TerraRay : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Ray"); - Tooltip.SetDefault("Casts an energy ray that splits if enemies are near it"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 75; - item.magic = true; - item.mana = 10; - item.width = 54; - item.height = 54; - 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.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TerraRay"); - item.shootSpeed = 6f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "NightsRay"); - recipe.AddIngredient(null, "LivingShard", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CarnageRay"); - recipe.AddIngredient(null, "LivingShard", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 TerraRay : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Ray"); + Tooltip.SetDefault("Casts an energy ray that splits if enemies are near it"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 75; + item.magic = true; + item.mana = 10; + item.width = 54; + item.height = 54; + 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.Item60; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TerraRay"); + item.shootSpeed = 6f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "NightsRay"); + recipe.AddIngredient(null, "LivingShard", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CarnageRay"); + recipe.AddIngredient(null, "LivingShard", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TerraShiv.cs b/Items/Weapons/TerraShiv.cs index e749e16cb2..609c372a9d 100644 --- a/Items/Weapons/TerraShiv.cs +++ b/Items/Weapons/TerraShiv.cs @@ -1,64 +1,64 @@ -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 -{ - public class TerraShiv : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Shiv"); - Tooltip.SetDefault("Don't underestimate the power of shivs"); - } - - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 13; - item.useTime = 13; - item.width = 42; - item.height = 42; - item.damage = 125; - item.melee = true; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ShortTerraBeam"); - item.shootSpeed = 12f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - } - - 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, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueNightsStabber"); - recipe.AddIngredient(null, "TrueExcaliburShortsword"); - recipe.AddIngredient(null, "LivingShard", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 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 +{ + public class TerraShiv : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Shiv"); + Tooltip.SetDefault("Don't underestimate the power of shivs"); + } + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 13; + item.useTime = 13; + item.width = 42; + item.height = 42; + item.damage = 125; + item.melee = true; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ShortTerraBeam"); + item.shootSpeed = 12f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + } + + 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, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueNightsStabber"); + recipe.AddIngredient(null, "TrueExcaliburShortsword"); + recipe.AddIngredient(null, "LivingShard", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 107); + } + } + } +} diff --git a/Items/Weapons/Terracotta.cs b/Items/Weapons/Terracotta.cs index 9e5427a72d..3e433861cb 100644 --- a/Items/Weapons/Terracotta.cs +++ b/Items/Weapons/Terracotta.cs @@ -1,74 +1,74 @@ -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 -{ - 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 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 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); - } - } - } -} +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 +{ + 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 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 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/TheBallista.cs b/Items/Weapons/TheBallista.cs index 2e67ed7503..3a690212bd 100644 --- a/Items/Weapons/TheBallista.cs +++ b/Items/Weapons/TheBallista.cs @@ -1,57 +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 -{ - public class TheBallista : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Ballista"); - Tooltip.SetDefault("Shoots greatarrows that crush enemy armor and break into shards on death"); - } - - public override void SetDefaults() - { - item.damage = 145; - item.ranged = true; - item.width = 40; - item.height = 70; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BallistaGreatArrow"); - item.shootSpeed = 20f; - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BallistaGreatArrow"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Marrow); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); - recipe.AddIngredient(ItemID.Ectoplasm, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 TheBallista : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Ballista"); + Tooltip.SetDefault("Shoots greatarrows that crush enemy armor and break into shards on death"); + } + + public override void SetDefaults() + { + item.damage = 145; + item.ranged = true; + item.width = 40; + item.height = 70; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BallistaGreatArrow"); + item.shootSpeed = 20f; + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("BallistaGreatArrow"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Marrow); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); + recipe.AddIngredient(ItemID.Ectoplasm, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TheEmpyrean.cs b/Items/Weapons/TheEmpyrean.cs index 7cb5732d84..eaca6a1ad6 100644 --- a/Items/Weapons/TheEmpyrean.cs +++ b/Items/Weapons/TheEmpyrean.cs @@ -1,56 +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 -{ - public class TheEmpyrean : 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.Weapons +{ + public class TheEmpyrean : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("The Empyrean"); Tooltip.SetDefault("70% chance to not consume gel"); } - - public override void SetDefaults() - { - item.damage = 82; - item.ranged = true; - item.width = 70; - item.height = 24; - item.useTime = 5; - item.useAnimation = 15; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CosmicFire"); - item.shootSpeed = 7.5f; - item.useAmmo = 23; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 70) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar", 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 82; + item.ranged = true; + item.width = 70; + item.height = 24; + item.useTime = 5; + item.useAnimation = 15; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.autoReuse = true; + item.shoot = mod.ProjectileType("CosmicFire"); + item.shootSpeed = 7.5f; + item.useAmmo = 23; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 70) + return false; + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar", 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TheEnforcer.cs b/Items/Weapons/TheEnforcer.cs index 19dcda9094..65c624df22 100644 --- a/Items/Weapons/TheEnforcer.cs +++ b/Items/Weapons/TheEnforcer.cs @@ -1,109 +1,109 @@ -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 TheEnforcer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Enforcer"); - Tooltip.SetDefault("Fires an essence flame burst and spawns essence flames on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 64; - item.damage = 2200; - item.melee = true; - item.useAnimation = 17; - item.useStyle = 1; - item.useTime = 17; - item.useTurn = true; - item.knockBack = 9f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("EssenceBurst"); - item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 73); - int i = Main.myPlayer; - float num72 = 6f; - float num74 = 7f; - 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 *= num80; - num79 *= num80; - 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); - 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; - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, mod.ProjectileType("EssenceFlame2"), (int)((float)item.damage * player.meleeDamage * 0.25f), num74, i, 0f, (float)Main.rand.Next(3)); - } - } - - 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, 173); - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 15); - recipe.AddTile(null, "DraedonsForge"); - 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.Weapons +{ + public class TheEnforcer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Enforcer"); + Tooltip.SetDefault("Fires an essence flame burst and spawns essence flames on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 64; + item.damage = 2200; + item.melee = true; + item.useAnimation = 17; + item.useStyle = 1; + item.useTime = 17; + item.useTurn = true; + item.knockBack = 9f; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.height = 64; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EssenceBurst"); + item.shootSpeed = 24f; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 73); + int i = Main.myPlayer; + float num72 = 6f; + float num74 = 7f; + 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 *= num80; + num79 *= num80; + 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); + 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; + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, mod.ProjectileType("EssenceFlame2"), (int)((float)item.damage * player.meleeDamage * 0.25f), num74, i, 0f, (float)Main.rand.Next(3)); + } + } + + 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, 173); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 15); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TheMutilator.cs b/Items/Weapons/TheMutilator.cs index be8d779944..3e29a64f16 100644 --- a/Items/Weapons/TheMutilator.cs +++ b/Items/Weapons/TheMutilator.cs @@ -1,84 +1,84 @@ -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 TheMutilator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Mutilator"); - Tooltip.SetDefault("Striking an enemy below 20% life will trigger a bloodsplosion\n" + - "Bloodsplosions cause hearts to drop that can be picked up to heal you"); - } - - public override void SetDefaults() - { - item.width = 80; - item.damage = 950; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 80; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shootSpeed = 10f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= (target.lifeMax * 0.2f) && target.canGhostHeal) - { - int heartDrop = Main.rand.Next(1, 3); - for (int i = 0; i < heartDrop; i++) - { - Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 58, 1, false, 0, false, false); - } - Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 14); - 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 < 30; 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 < 50; 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; - } - } - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 5); - recipe.AddTile(TileID.LunarCraftingStation); - 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.Weapons +{ + public class TheMutilator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Mutilator"); + Tooltip.SetDefault("Striking an enemy below 20% life will trigger a bloodsplosion\n" + + "Bloodsplosions cause hearts to drop that can be picked up to heal you"); + } + + public override void SetDefaults() + { + item.width = 80; + item.damage = 950; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 80; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shootSpeed = 10f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= (target.lifeMax * 0.2f) && target.canGhostHeal) + { + int heartDrop = Main.rand.Next(1, 3); + for (int i = 0; i < heartDrop; i++) + { + Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 58, 1, false, 0, false, false); + } + Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 14); + 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 < 30; 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 < 50; 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; + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TheStorm.cs b/Items/Weapons/TheStorm.cs index dc1b82e796..6709522ee6 100644 --- a/Items/Weapons/TheStorm.cs +++ b/Items/Weapons/TheStorm.cs @@ -1,112 +1,112 @@ -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 TheStorm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Storm"); - Tooltip.SetDefault("Fires a spread of arrows from the sky\n" + - "Wooden arrows are converted to lightning bolts"); - } - - public override void SetDefaults() - { - item.damage = 44; - item.ranged = true; - item.width = 34; - item.height = 50; - item.useTime = 7; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item122; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Bolt"); - item.shootSpeed = 28f; - item.useAmmo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - 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 i = Main.myPlayer; - float num72 = Main.rand.Next(25, 30); - int num73 = damage; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - 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 = 3; - 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)Main.rand.Next(-120, 121) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; - if (type == ProjectileID.WoodenArrowFriendly) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, mod.ProjectileType("Bolt"), num73, num74, i, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, mod.ProjectileType("Bolt"), num73, num74, i, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, mod.ProjectileType("Bolt"), num73, num74, i, 0f, 0f); - } - else - { - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, num73, num74, i, 0f, 0f); - Main.projectile[num121].noDropItem = true; - int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, num73, num74, i, 0f, 0f); - Main.projectile[num122].noDropItem = true; - int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, num73, num74, i, 0f, 0f); - Main.projectile[num123].noDropItem = true; - } - } - return false; - } - } -} \ No newline at end of file +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 TheStorm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Storm"); + Tooltip.SetDefault("Fires a spread of arrows from the sky\n" + + "Wooden arrows are converted to lightning bolts"); + } + + public override void SetDefaults() + { + item.damage = 44; + item.ranged = true; + item.width = 34; + item.height = 50; + item.useTime = 7; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item122; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Bolt"); + item.shootSpeed = 28f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + 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 i = Main.myPlayer; + float num72 = Main.rand.Next(25, 30); + int num73 = damage; + float num74 = knockBack; + num74 = player.GetWeaponKnockback(item, num74); + player.itemTime = item.useTime; + 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 = 3; + 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)Main.rand.Next(-120, 121) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; + if (type == ProjectileID.WoodenArrowFriendly) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, mod.ProjectileType("Bolt"), num73, num74, i, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, mod.ProjectileType("Bolt"), num73, num74, i, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, mod.ProjectileType("Bolt"), num73, num74, i, 0f, 0f); + } + else + { + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, num73, num74, i, 0f, 0f); + Main.projectile[num121].noDropItem = true; + int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, num73, num74, i, 0f, 0f); + Main.projectile[num122].noDropItem = true; + int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, num73, num74, i, 0f, 0f); + Main.projectile[num123].noDropItem = true; + } + } + return false; + } + } +} diff --git a/Items/Weapons/TheSwarmer.cs b/Items/Weapons/TheSwarmer.cs index cd232161e9..e4ab7bb7bc 100644 --- a/Items/Weapons/TheSwarmer.cs +++ b/Items/Weapons/TheSwarmer.cs @@ -1,77 +1,77 @@ -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 -{ - public class TheSwarmer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Swarmer"); - Tooltip.SetDefault("Fires a swarm of bees and wasps"); - } - - public override void SetDefaults() - { - item.damage = 30; - item.magic = true; - item.mana = 7; - item.width = 74; - item.height = 36; - item.useTime = 8; - item.useAnimation = 8; - item.useStyle = 5; - item.noMelee = true; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shoot = 189; - item.shootSpeed = 12f; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, -5); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddIngredient(ItemID.BeeGun); - recipe.AddIngredient(ItemID.WaspGun); - recipe.AddTile(TileID.LunarCraftingStation); - 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) - { - for (int i = 0; i <= 3; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-35, 36) * 0.05f; - 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, 0f, 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, 0f, 0f); - Main.projectile[bees].penetrate = 1; - Main.projectile[bees].GetGlobalProjectile(mod).forceMagic = true; - } - return false; - } - } -} \ No newline at end of file +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 +{ + public class TheSwarmer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Swarmer"); + Tooltip.SetDefault("Fires a swarm of bees and wasps"); + } + + public override void SetDefaults() + { + item.damage = 30; + item.magic = true; + item.mana = 7; + item.width = 74; + item.height = 36; + item.useTime = 8; + item.useAnimation = 8; + item.useStyle = 5; + item.noMelee = true; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 189; + item.shootSpeed = 12f; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, -5); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FragmentVortex, 20); + recipe.AddIngredient(ItemID.BeeGun); + recipe.AddIngredient(ItemID.WaspGun); + recipe.AddTile(TileID.LunarCraftingStation); + 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) + { + for (int i = 0; i <= 3; i++) + { + float SpeedX = speedX + (float)Main.rand.Next(-35, 36) * 0.05f; + 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, 0f, 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, 0f, 0f); + Main.projectile[bees].penetrate = 1; + Main.projectile[bees].GetGlobalProjectile(mod).forceMagic = true; + } + return false; + } + } +} diff --git a/Items/Weapons/TheWand.cs b/Items/Weapons/TheWand.cs index a1d9b6dd41..2e5e51d855 100644 --- a/Items/Weapons/TheWand.cs +++ b/Items/Weapons/TheWand.cs @@ -1,59 +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.Items.Weapons -{ - public class TheWand : ModItem - { +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 +{ + public class TheWand : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("The Wand"); Tooltip.SetDefault("The ultimate wand"); } - - public override void SetDefaults() - { - item.width = 40; - item.damage = 1; - item.mana = 500; - item.magic = true; - item.noMelee = true; - item.useAnimation = 20; - item.useTime = 20; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 0f; - item.UseSound = SoundID.Item102; - item.autoReuse = true; - item.height = 36; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("SparkInfernal"); - item.shootSpeed = 24f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.WandofSparking); - recipe.AddIngredient(null, "HellcasterFragment", 5); - recipe.AddTile(null, "DraedonsForge"); - 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, 6); - } - } - } -} + + public override void SetDefaults() + { + item.width = 40; + item.damage = 1; + item.mana = 500; + item.magic = true; + item.noMelee = true; + item.useAnimation = 20; + item.useTime = 20; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 0f; + item.UseSound = SoundID.Item102; + item.autoReuse = true; + item.height = 36; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("SparkInfernal"); + item.shootSpeed = 24f; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WandofSparking); + recipe.AddIngredient(null, "HellcasterFragment", 5); + recipe.AddTile(null, "DraedonsForge"); + 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, 6); + } + } + } +} diff --git a/Items/Weapons/TitaniumRailgun.cs b/Items/Weapons/TitaniumRailgun.cs index c95a5eeb82..d08547007b 100644 --- a/Items/Weapons/TitaniumRailgun.cs +++ b/Items/Weapons/TitaniumRailgun.cs @@ -1,60 +1,60 @@ -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 TitaniumRailgun : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Titanium Railgun"); - Tooltip.SetDefault("Fires a laser"); - } - - public override void SetDefaults() - { - item.damage = 70; - item.ranged = true; - item.width = 62; - item.height = 26; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item72; - item.autoReuse = true; - item.shootSpeed = 6f; - item.shoot = mod.ProjectileType("TitRail"); - item.useAmmo = 97; - } - - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("TitRail"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitaniumBar, 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 TitaniumRailgun : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titanium Railgun"); + Tooltip.SetDefault("Fires a laser"); + } + + public override void SetDefaults() + { + item.damage = 70; + item.ranged = true; + item.width = 62; + item.height = 26; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item72; + item.autoReuse = true; + item.shootSpeed = 6f; + item.shoot = mod.ProjectileType("TitRail"); + item.useAmmo = 97; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("TitRail"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitaniumBar, 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TomeofFates.cs b/Items/Weapons/TomeofFates.cs index ba1f75f7e5..bf85158031 100644 --- a/Items/Weapons/TomeofFates.cs +++ b/Items/Weapons/TomeofFates.cs @@ -1,91 +1,91 @@ -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 TomeofFates : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tome of Fates"); - Tooltip.SetDefault("Casts cosmic tentacles to spear your enemies\n" + - "Can randomly fire a brimstone tentacle for immense damage"); - } - - public override void SetDefaults() - { - item.damage = 79; - item.magic = true; - item.mana = 8; - item.width = 28; - item.crit = 3; - item.height = 30; - item.useTime = 5; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item103; - item.autoReuse = true; - item.shoot = mod.ProjectileType("CosmicTentacle"); - item.shootSpeed = 17f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar", 9); - recipe.AddIngredient(ItemID.SpellTome); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int i = Main.myPlayer; - 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; - Vector2 value2 = new Vector2(num78, num79); - value2.Normalize(); - Vector2 value3 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value3.Normalize(); - value2 = value2 * 4f + value3; - value2.Normalize(); - value2 *= item.shootSpeed; - int projChoice = Main.rand.Next(7); - float num91 = (float)Main.rand.Next(10, 160) * 0.001f; - if (Main.rand.Next(2) == 0) - { - num91 *= -1f; - } - float num92 = (float)Main.rand.Next(10, 160) * 0.001f; - if (Main.rand.Next(2) == 0) - { - num92 *= -1f; - } - if (projChoice == 0) - { - Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, mod.ProjectileType("BrimstoneTentacle"), (int)((double)num73 * 1.5f), num74, i, num92, num91); - } - else - { - Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, mod.ProjectileType("CosmicTentacle"), num73, num74, i, num92, num91); - } - return false; - } - } -} \ No newline at end of file +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 TomeofFates : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tome of Fates"); + Tooltip.SetDefault("Casts cosmic tentacles to spear your enemies\n" + + "Can randomly fire a brimstone tentacle for immense damage"); + } + + public override void SetDefaults() + { + item.damage = 79; + item.magic = true; + item.mana = 8; + item.width = 28; + item.crit = 3; + item.height = 30; + item.useTime = 5; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item103; + item.autoReuse = true; + item.shoot = mod.ProjectileType("CosmicTentacle"); + item.shootSpeed = 17f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar", 9); + recipe.AddIngredient(ItemID.SpellTome); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int i = Main.myPlayer; + 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; + Vector2 value2 = new Vector2(num78, num79); + value2.Normalize(); + Vector2 value3 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value3.Normalize(); + value2 = value2 * 4f + value3; + value2.Normalize(); + value2 *= item.shootSpeed; + int projChoice = Main.rand.Next(7); + float num91 = (float)Main.rand.Next(10, 160) * 0.001f; + if (Main.rand.Next(2) == 0) + { + num91 *= -1f; + } + float num92 = (float)Main.rand.Next(10, 160) * 0.001f; + if (Main.rand.Next(2) == 0) + { + num92 *= -1f; + } + if (projChoice == 0) + { + Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, mod.ProjectileType("BrimstoneTentacle"), (int)((double)num73 * 1.5f), num74, i, num92, num91); + } + else + { + Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, mod.ProjectileType("CosmicTentacle"), num73, num74, i, num92, num91); + } + return false; + } + } +} diff --git a/Items/Weapons/Tradewinds.cs b/Items/Weapons/Tradewinds.cs index 414468d044..2cb7ecdee2 100644 --- a/Items/Weapons/Tradewinds.cs +++ b/Items/Weapons/Tradewinds.cs @@ -1,51 +1,51 @@ -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 Tradewinds : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tradewinds"); - Tooltip.SetDefault("Casts fast moving sunlight feathers"); - } - - public override void SetDefaults() - { - item.damage = 17; - item.magic = true; - item.mana = 7; - item.width = 28; - item.height = 30; - item.useTime = 13; - item.useAnimation = 13; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.UseSound = SoundID.Item7; - item.autoReuse = true; - item.shoot = mod.ProjectileType("TradewindsProjectile"); - item.shootSpeed = 20f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "AerialiteBar", 6); - recipe.AddIngredient(ItemID.SunplateBlock, 5); - recipe.AddIngredient(ItemID.Feather, 3); - recipe.AddTile(TileID.SkyMill); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Tradewinds : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tradewinds"); + Tooltip.SetDefault("Casts fast moving sunlight feathers"); + } + + public override void SetDefaults() + { + item.damage = 17; + item.magic = true; + item.mana = 7; + item.width = 28; + item.height = 30; + item.useTime = 13; + item.useAnimation = 13; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item7; + item.autoReuse = true; + item.shoot = mod.ProjectileType("TradewindsProjectile"); + item.shootSpeed = 20f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "AerialiteBar", 6); + recipe.AddIngredient(ItemID.SunplateBlock, 5); + recipe.AddIngredient(ItemID.Feather, 3); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Trinity.cs b/Items/Weapons/Trinity.cs index eba1c0f358..477f84462b 100644 --- a/Items/Weapons/Trinity.cs +++ b/Items/Weapons/Trinity.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.Items.Weapons -{ - public class Trinity : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trinity"); - Tooltip.SetDefault("Fires a spread of energy bolts"); - } - - public override void SetDefaults() - { - item.width = 44; - item.damage = 50; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 4.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 46; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = 125; - item.shootSpeed = 11f; - } - - 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(3)) - { - case 0: type = 125; break; - case 1: type = 123; break; - case 2: type = 121; break; - default: break; - } - for (int projectiles = 0; projectiles <= 3; projectiles++) - { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VerstaltiteBar", 9); - 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, 73); - } - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class Trinity : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trinity"); + Tooltip.SetDefault("Fires a spread of energy bolts"); + } + + public override void SetDefaults() + { + item.width = 44; + item.damage = 50; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 4.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 46; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = 125; + item.shootSpeed = 11f; + } + + 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(3)) + { + case 0: type = 125; break; + case 1: type = 123; break; + case 2: type = 121; break; + default: break; + } + for (int projectiles = 0; projectiles <= 3; projectiles++) + { + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VerstaltiteBar", 9); + 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, 73); + } + } + } +} diff --git a/Items/Weapons/Triploon.cs b/Items/Weapons/Triploon.cs index 6a561e381f..8564bf4123 100644 --- a/Items/Weapons/Triploon.cs +++ b/Items/Weapons/Triploon.cs @@ -1,80 +1,80 @@ -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 Triploon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triploon"); - Tooltip.SetDefault("Launches three harpoons"); - } - - public override void SetDefaults() - { - item.damage = 80; - item.ranged = true; - item.width = 46; - item.height = 24; - item.useTime = 12; - item.useAnimation = 12; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item10; - item.autoReuse = true; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("Triploon"); - } - - 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) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 30f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); - if (!flag11) - { - value9 -= vector7; - } - int harpoon = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[harpoon].timeLeft = 300; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Dualpoon"); - recipe.AddIngredient(ItemID.Harpoon); - recipe.AddIngredient(null, "DepthCells", 15); - recipe.AddIngredient(null, "Lumenite", 5); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Triploon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Triploon"); + Tooltip.SetDefault("Launches three harpoons"); + } + + public override void SetDefaults() + { + item.damage = 80; + item.ranged = true; + item.width = 46; + item.height = 24; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item10; + item.autoReuse = true; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("Triploon"); + } + + 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) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; + int num118 = 3; + Vector2 vector7 = new Vector2(speedX, speedY); + vector7.Normalize(); + vector7 *= 30f; + bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); + for (int num119 = 0; num119 < num118; num119++) + { + float num120 = (float)num119 - ((float)num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); + if (!flag11) + { + value9 -= vector7; + } + int harpoon = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[harpoon].timeLeft = 300; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Dualpoon"); + recipe.AddIngredient(ItemID.Harpoon); + recipe.AddIngredient(null, "DepthCells", 15); + recipe.AddIngredient(null, "Lumenite", 5); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TrueArkoftheAncients.cs b/Items/Weapons/TrueArkoftheAncients.cs index 003429ec2c..39616287a5 100644 --- a/Items/Weapons/TrueArkoftheAncients.cs +++ b/Items/Weapons/TrueArkoftheAncients.cs @@ -1,146 +1,146 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.Items.Weapons -{ - public class TrueArkoftheAncients : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Ark of the Ancients"); - Tooltip.SetDefault("A heavenly blade forged to vanquish all evil"); - } - - public override void SetDefaults() - { - item.width = 60; - item.damage = 60; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 6.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("EonBeam"); - item.shootSpeed = 12f; - } - - 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(2)) - { - case 0: type = mod.ProjectileType("EonBeam"); break; - case 1: type = mod.ProjectileType("EonBeamV2"); break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - int i = Main.myPlayer; - float num72 = Main.rand.Next(18, 27); - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - 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 *= num80; - num79 *= num80; - 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); - 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(-160, 161) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-160, 161) * 0.02f; - 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; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ArkoftheAncients"); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(null, "LivingShard", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(5) == 0) - { - int num249 = Main.rand.Next(3); - if (num249 == 0) - { - num249 = 15; - } - else if (num249 == 1) - { - num249 = 57; - } - else - { - num249 = 58; - } - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, num249, (float)(player.direction * 2), 0f, 150, default(Color), 1.3f); - Main.dust[num250].velocity *= 0.2f; - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons +{ + public class TrueArkoftheAncients : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Ark of the Ancients"); + Tooltip.SetDefault("A heavenly blade forged to vanquish all evil"); + } + + public override void SetDefaults() + { + item.width = 60; + item.damage = 60; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 6.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 12f; + } + + 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(2)) + { + case 0: type = mod.ProjectileType("EonBeam"); break; + case 1: type = mod.ProjectileType("EonBeamV2"); break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + int i = Main.myPlayer; + float num72 = Main.rand.Next(18, 27); + float num74 = knockBack; + num74 = player.GetWeaponKnockback(item, num74); + player.itemTime = item.useTime; + 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 *= num80; + num79 *= num80; + 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); + 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(-160, 161) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-160, 161) * 0.02f; + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ArkoftheAncients"); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddIngredient(null, "LivingShard", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(5) == 0) + { + int num249 = Main.rand.Next(3); + if (num249 == 0) + { + num249 = 15; + } + else if (num249 == 1) + { + num249 = 57; + } + else + { + num249 = 58; + } + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, num249, (float)(player.direction * 2), 0f, 150, default(Color), 1.3f); + Main.dust[num250].velocity *= 0.2f; + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } + } +} diff --git a/Items/Weapons/TrueBiomeBlade.cs b/Items/Weapons/TrueBiomeBlade.cs index 0bc8a9406b..02fd2875ba 100644 --- a/Items/Weapons/TrueBiomeBlade.cs +++ b/Items/Weapons/TrueBiomeBlade.cs @@ -1,60 +1,60 @@ -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 -{ - public class TrueBiomeBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Biome Blade"); - Tooltip.SetDefault("Fires different projectiles based on what biome you're in"); - } - - public override void SetDefaults() - { - item.width = 54; - item.damage = 160; - item.melee = true; - item.useAnimation = 21; - item.useTime = 21; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("TrueBiomeOrb"); - item.shootSpeed = 12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BiomeBlade"); - recipe.AddIngredient(null, "LivingShard", 5); - recipe.AddIngredient(ItemID.Ectoplasm, 5); - 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 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, 0); - } - } - } -} +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 +{ + public class TrueBiomeBlade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Biome Blade"); + Tooltip.SetDefault("Fires different projectiles based on what biome you're in"); + } + + public override void SetDefaults() + { + item.width = 54; + item.damage = 160; + item.melee = true; + item.useAnimation = 21; + item.useTime = 21; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 54; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("TrueBiomeOrb"); + item.shootSpeed = 12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BiomeBlade"); + recipe.AddIngredient(null, "LivingShard", 5); + recipe.AddIngredient(ItemID.Ectoplasm, 5); + 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 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, 0); + } + } + } +} diff --git a/Items/Weapons/TrueBloodyEdge.cs b/Items/Weapons/TrueBloodyEdge.cs index d96cbbf152..3d1fda5312 100644 --- a/Items/Weapons/TrueBloodyEdge.cs +++ b/Items/Weapons/TrueBloodyEdge.cs @@ -1,70 +1,70 @@ -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 -{ - public class TrueBloodyEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Bloody Edge"); - Tooltip.SetDefault("Chance to heal the player on enemy hits\n" + - "Fires a bloody blade"); - } - - public override void SetDefaults() - { - item.width = 48; - item.damage = 70; - item.melee = true; - item.useAnimation = 24; - item.useStyle = 1; - item.useTime = 24; - item.knockBack = 6f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("BloodyBlade"); - item.shootSpeed = 11f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodyEdge"); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - int healAmount = (Main.rand.Next(6) + 1); - if (Main.rand.Next(2) == 0) - { - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - } -} +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 +{ + public class TrueBloodyEdge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Bloody Edge"); + Tooltip.SetDefault("Chance to heal the player on enemy hits\n" + + "Fires a bloody blade"); + } + + public override void SetDefaults() + { + item.width = 48; + item.damage = 70; + item.melee = true; + item.useAnimation = 24; + item.useStyle = 1; + item.useTime = 24; + item.knockBack = 6f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 64; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("BloodyBlade"); + item.shootSpeed = 11f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodyEdge"); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + int healAmount = (Main.rand.Next(6) + 1); + if (Main.rand.Next(2) == 0) + { + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + } +} diff --git a/Items/Weapons/TrueCausticEdge.cs b/Items/Weapons/TrueCausticEdge.cs index 9cc5cc0d75..35cf8f9bc7 100644 --- a/Items/Weapons/TrueCausticEdge.cs +++ b/Items/Weapons/TrueCausticEdge.cs @@ -1,74 +1,74 @@ -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 -{ - public class TrueCausticEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Caustic Edge"); - Tooltip.SetDefault("Fires a bouncing caustic beam\n" + - "Inflicts on fire, poison, and venom"); - } - - public override void SetDefaults() - { - item.width = 64; - item.damage = 42; - item.melee = true; - item.useAnimation = 28; - item.useStyle = 1; - item.useTime = 28; - item.useTurn = true; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 74; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("TrueCausticEdgeProjectile"); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CausticEdge"); - recipe.AddIngredient(ItemID.FlaskofCursedFlames, 5); - recipe.AddIngredient(ItemID.FlaskofPoison, 5); - recipe.AddIngredient(ItemID.Deathweed, 3); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CausticEdge"); - recipe.AddIngredient(ItemID.FlaskofIchor, 5); - recipe.AddIngredient(ItemID.FlaskofPoison, 5); - recipe.AddIngredient(ItemID.Deathweed, 3); - recipe.AddTile(TileID.DemonAltar); - 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, 74); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 600); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Venom, 300); - } - } -} +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 +{ + public class TrueCausticEdge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Caustic Edge"); + Tooltip.SetDefault("Fires a bouncing caustic beam\n" + + "Inflicts on fire, poison, and venom"); + } + + public override void SetDefaults() + { + item.width = 64; + item.damage = 42; + item.melee = true; + item.useAnimation = 28; + item.useStyle = 1; + item.useTime = 28; + item.useTurn = true; + item.knockBack = 5.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 74; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("TrueCausticEdgeProjectile"); + item.shootSpeed = 16f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CausticEdge"); + recipe.AddIngredient(ItemID.FlaskofCursedFlames, 5); + recipe.AddIngredient(ItemID.FlaskofPoison, 5); + recipe.AddIngredient(ItemID.Deathweed, 3); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CausticEdge"); + recipe.AddIngredient(ItemID.FlaskofIchor, 5); + recipe.AddIngredient(ItemID.FlaskofPoison, 5); + recipe.AddIngredient(ItemID.Deathweed, 3); + recipe.AddTile(TileID.DemonAltar); + 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, 74); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 600); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Venom, 300); + } + } +} diff --git a/Items/Weapons/TrueExcaliburShortsword.cs b/Items/Weapons/TrueExcaliburShortsword.cs index aaf5dde54a..a8584798ca 100644 --- a/Items/Weapons/TrueExcaliburShortsword.cs +++ b/Items/Weapons/TrueExcaliburShortsword.cs @@ -1,63 +1,63 @@ -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 -{ - public class TrueExcaliburShortsword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Excalibur Shortsword"); - Tooltip.SetDefault("Don't underestimate the power of shortswords"); - } - - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 12; - item.useTime = 12; - item.width = 42; - item.height = 42; - item.damage = 70; - item.melee = true; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ShortBeam"); - item.shootSpeed = 12f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - } - - 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, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ExcaliburShortsword"); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 57); - } - } - } -} +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 +{ + public class TrueExcaliburShortsword : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Excalibur Shortsword"); + Tooltip.SetDefault("Don't underestimate the power of shortswords"); + } + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 12; + item.useTime = 12; + item.width = 42; + item.height = 42; + item.damage = 70; + item.melee = true; + item.knockBack = 5.75f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ShortBeam"); + item.shootSpeed = 12f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + } + + 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, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ExcaliburShortsword"); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 57); + } + } + } +} diff --git a/Items/Weapons/TrueForbiddenOathblade.cs b/Items/Weapons/TrueForbiddenOathblade.cs index 84fb159b0e..501b87399e 100644 --- a/Items/Weapons/TrueForbiddenOathblade.cs +++ b/Items/Weapons/TrueForbiddenOathblade.cs @@ -1,123 +1,123 @@ -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 -{ - public class TrueForbiddenOathblade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Forbidden Oathblade"); - Tooltip.SetDefault("Fires a spread of demonic scythes and critical hits cause shadowflame explosions"); - } - - public override void SetDefaults() - { - item.width = 78; - item.damage = 80; - item.melee = true; - item.useAnimation = 23; - item.useTime = 23; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 78; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("Oathblade"); - item.shootSpeed = 3f; - } - - 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(8); - 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, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ForbiddenOathblade"); - recipe.AddIngredient(null, "CalamityDust", 3); - recipe.AddIngredient(null, "LivingShard", 3); - recipe.AddIngredient(ItemID.BrokenHeroSword); - 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, 173); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 300); - target.AddBuff(BuffID.OnFire, 300); - if (crit) - { - target.AddBuff(BuffID.ShadowFlame, 900); - target.AddBuff(BuffID.OnFire, 900); - player.ApplyDamageToNPC(target, damage * 3, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default(Color), num50); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity.Y -= 4.5f; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default(Color), num51); - Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust = Main.dust[num54]; - dust.velocity.Y -= 3f; - 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(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default(Color), num52); - Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default(Vector2)) * (float)target.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity.Y -= 1.5f; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } - } -} +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 +{ + public class TrueForbiddenOathblade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Forbidden Oathblade"); + Tooltip.SetDefault("Fires a spread of demonic scythes and critical hits cause shadowflame explosions"); + } + + public override void SetDefaults() + { + item.width = 78; + item.damage = 80; + item.melee = true; + item.useAnimation = 23; + item.useTime = 23; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 78; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("Oathblade"); + item.shootSpeed = 3f; + } + + 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(8); + 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, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ForbiddenOathblade"); + recipe.AddIngredient(null, "CalamityDust", 3); + recipe.AddIngredient(null, "LivingShard", 3); + recipe.AddIngredient(ItemID.BrokenHeroSword); + 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, 173); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 300); + target.AddBuff(BuffID.OnFire, 300); + if (crit) + { + target.AddBuff(BuffID.ShadowFlame, 900); + target.AddBuff(BuffID.OnFire, 900); + player.ApplyDamageToNPC(target, damage * 3, 0f, 0, false); + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * target.velocity.Length(); + Main.PlaySound(SoundID.Item14, target.position); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default(Color), num50); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity.Y -= 4.5f; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default(Color), num51); + Main.dust[num54].position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust = Main.dust[num54]; + dust.velocity.Y -= 3f; + 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(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default(Color), num52); + Main.dust[num56].position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default(Vector2)) * (float)target.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity.Y -= 1.5f; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } + } +} diff --git a/Items/Weapons/TrueNightsStabber.cs b/Items/Weapons/TrueNightsStabber.cs index a84dd74415..0ea293b839 100644 --- a/Items/Weapons/TrueNightsStabber.cs +++ b/Items/Weapons/TrueNightsStabber.cs @@ -1,63 +1,63 @@ -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 -{ - public class TrueNightsStabber : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Night's Stabber"); - Tooltip.SetDefault("Don't underestimate the power of stabby knives"); - } - - public override void SetDefaults() - { - item.useStyle = 3; - item.useTurn = false; - item.useAnimation = 16; - item.useTime = 16; - item.width = 40; - item.height = 40; - item.damage = 75; - item.melee = true; - item.knockBack = 6.25f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = mod.ProjectileType("ShortNightBeam"); - item.shootSpeed = 8f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - } - - 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, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "NightsStabber"); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 21); - } - } - } -} +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 +{ + public class TrueNightsStabber : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Night's Stabber"); + Tooltip.SetDefault("Don't underestimate the power of stabby knives"); + } + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 16; + item.useTime = 16; + item.width = 40; + item.height = 40; + item.damage = 75; + item.melee = true; + item.knockBack = 6.25f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.shoot = mod.ProjectileType("ShortNightBeam"); + item.shootSpeed = 8f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + } + + 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, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "NightsStabber"); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 21); + } + } + } +} diff --git a/Items/Weapons/TruePaladinsHammerMelee.cs b/Items/Weapons/TruePaladinsHammerMelee.cs index e4292e7ea3..55414a44de 100644 --- a/Items/Weapons/TruePaladinsHammerMelee.cs +++ b/Items/Weapons/TruePaladinsHammerMelee.cs @@ -1,52 +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.Weapons -{ - public class TruePaladinsHammerMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Paladin's Hammer"); - Tooltip.SetDefault("Explodes on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 14; - item.damage = 180; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 13; - item.useStyle = 1; - item.useTime = 13; - item.knockBack = 20f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 28; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("OPHammerMelee"); - item.shootSpeed = 14f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PaladinsHammer); - recipe.AddIngredient(null, "CalamityDust", 5); - recipe.AddIngredient(null, "CoreofChaos", 5); - recipe.AddIngredient(null, "CruptixBar", 5); - recipe.AddTile(TileID.MythrilAnvil); - 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.Weapons +{ + public class TruePaladinsHammerMelee : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Paladin's Hammer"); + Tooltip.SetDefault("Explodes on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 14; + item.damage = 180; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 13; + item.useStyle = 1; + item.useTime = 13; + item.knockBack = 20f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 28; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("OPHammerMelee"); + item.shootSpeed = 14f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PaladinsHammer); + recipe.AddIngredient(null, "CalamityDust", 5); + recipe.AddIngredient(null, "CoreofChaos", 5); + recipe.AddIngredient(null, "CruptixBar", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/TrueTyrantYharimsUltisword.cs b/Items/Weapons/TrueTyrantYharimsUltisword.cs index 9f2ba526f9..d837d44050 100644 --- a/Items/Weapons/TrueTyrantYharimsUltisword.cs +++ b/Items/Weapons/TrueTyrantYharimsUltisword.cs @@ -1,83 +1,83 @@ -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 -{ - public class TrueTyrantYharimsUltisword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Tyrant's Ultisword"); - Tooltip.SetDefault("Fires blazing, hyper, and sunlight blades\n" + - "Gives the player the tyrant's fury buff on enemy hits\n" + - "This buff increases melee damage by 30% and melee crit chance by 10%"); - } - - public override void SetDefaults() - { - item.width = 102; - item.damage = 185; - item.melee = true; - item.useAnimation = 18; - item.useStyle = 1; - item.useTime = 18; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 102; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("BlazingPhantomBlade"); - item.shootSpeed = 12f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - 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(3)) - { - case 0: type = mod.ProjectileType("BlazingPhantomBlade"); break; - case 1: type = mod.ProjectileType("HyperBlade"); break; - case 2: type = mod.ProjectileType("SunlightBlade"); break; - default: break; - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TyrantYharimsUltisword"); - recipe.AddIngredient(null, "CoreofCalamity"); - recipe.AddIngredient(null, "UeliaceBar", 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 106); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - player.AddBuff(mod.BuffType("TyrantsFury"), 300); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.CursedInferno, 300); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } -} +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 +{ + public class TrueTyrantYharimsUltisword : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("True Tyrant's Ultisword"); + Tooltip.SetDefault("Fires blazing, hyper, and sunlight blades\n" + + "Gives the player the tyrant's fury buff on enemy hits\n" + + "This buff increases melee damage by 30% and melee crit chance by 10%"); + } + + public override void SetDefaults() + { + item.width = 102; + item.damage = 185; + item.melee = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.useTurn = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 102; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("BlazingPhantomBlade"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + 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(3)) + { + case 0: type = mod.ProjectileType("BlazingPhantomBlade"); break; + case 1: type = mod.ProjectileType("HyperBlade"); break; + case 2: type = mod.ProjectileType("SunlightBlade"); break; + default: break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TyrantYharimsUltisword"); + recipe.AddIngredient(null, "CoreofCalamity"); + recipe.AddIngredient(null, "UeliaceBar", 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 106); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + player.AddBuff(mod.BuffType("TyrantsFury"), 300); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } +} diff --git a/Items/Weapons/TyrantYharimsUltisword.cs b/Items/Weapons/TyrantYharimsUltisword.cs index d2edec021e..f9186ed9cb 100644 --- a/Items/Weapons/TyrantYharimsUltisword.cs +++ b/Items/Weapons/TyrantYharimsUltisword.cs @@ -1,78 +1,78 @@ -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 -{ - public class TyrantYharimsUltisword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tyrant Yharim's Ultisword"); - Tooltip.SetDefault("Fires homing blazing blades\n" + - "Gives the player the tyrant's fury buff on enemy hits\n" + - "This buff increases melee damage by 30% and melee crit chance by 10%"); - } - - public override void SetDefaults() - { - item.width = 88; - item.damage = 64; - item.melee = true; - item.useAnimation = 26; - item.useStyle = 1; - item.useTime = 26; - item.useTurn = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 88; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("BlazingPhantomBlade"); - item.shootSpeed = 12f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueCausticEdge"); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(ItemID.FlaskofVenom, 5); - recipe.AddIngredient(ItemID.FlaskofCursedFlames, 5); - recipe.AddIngredient(ItemID.ChlorophyteBar, 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "TrueCausticEdge"); - recipe.AddIngredient(ItemID.BrokenHeroSword); - recipe.AddIngredient(ItemID.FlaskofVenom, 5); - recipe.AddIngredient(ItemID.FlaskofIchor, 5); - recipe.AddIngredient(ItemID.ChlorophyteBar, 15); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - 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, 106); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - player.AddBuff(mod.BuffType("TyrantsFury"), 180); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.CursedInferno, 300); - } - } -} +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 +{ + public class TyrantYharimsUltisword : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tyrant Yharim's Ultisword"); + Tooltip.SetDefault("Fires homing blazing blades\n" + + "Gives the player the tyrant's fury buff on enemy hits\n" + + "This buff increases melee damage by 30% and melee crit chance by 10%"); + } + + public override void SetDefaults() + { + item.width = 88; + item.damage = 64; + item.melee = true; + item.useAnimation = 26; + item.useStyle = 1; + item.useTime = 26; + item.useTurn = true; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 88; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("BlazingPhantomBlade"); + item.shootSpeed = 12f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueCausticEdge"); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddIngredient(ItemID.FlaskofVenom, 5); + recipe.AddIngredient(ItemID.FlaskofCursedFlames, 5); + recipe.AddIngredient(ItemID.ChlorophyteBar, 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "TrueCausticEdge"); + recipe.AddIngredient(ItemID.BrokenHeroSword); + recipe.AddIngredient(ItemID.FlaskofVenom, 5); + recipe.AddIngredient(ItemID.FlaskofIchor, 5); + recipe.AddIngredient(ItemID.ChlorophyteBar, 15); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + 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, 106); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + player.AddBuff(mod.BuffType("TyrantsFury"), 180); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.CursedInferno, 300); + } + } +} diff --git a/Items/Weapons/UltraLiquidator.cs b/Items/Weapons/UltraLiquidator.cs index 406542de5e..25ea18db77 100644 --- a/Items/Weapons/UltraLiquidator.cs +++ b/Items/Weapons/UltraLiquidator.cs @@ -1,16 +1,16 @@ -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 UltraLiquidator : 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.Weapons +{ + public class UltraLiquidator : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Ultra Liquidator"); @@ -19,69 +19,69 @@ namespace CalamityMod.Items.Weapons Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 96; - item.magic = true; - item.mana = 25; - item.width = 16; - item.height = 16; - item.useAnimation = 15; - item.useTime = 3; - item.reuseDelay = item.useAnimation; - item.crit = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LiquidBlade"); - item.shootSpeed = 16f; - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "InfernalRift"); - recipe.AddIngredient(ItemID.GoldenShower); - recipe.AddIngredient(ItemID.AquaScepter); - recipe.AddIngredient(ItemID.CursedFlames); - recipe.AddIngredient(null, "GalacticaSingularity", 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - 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) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float f = Main.rand.NextFloat() * 6.28318548f; - float value12 = 20f; - float value13 = 60f; - Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - for (int num202 = 0; num202 < 50; num202++) - { - vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) - { - break; - } - f = Main.rand.NextFloat() * 6.28318548f; - } - Vector2 mouseWorld = Main.MouseWorld; - Vector2 vector14 = mouseWorld - vector13; - Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; - vector14 = vector14.SafeNormalize(vector15) * num72; - vector14 = Vector2.Lerp(vector14, vector15, 0.25f); - Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 96; + item.magic = true; + item.mana = 25; + item.width = 16; + item.height = 16; + item.useAnimation = 15; + item.useTime = 3; + item.reuseDelay = item.useAnimation; + item.crit = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LiquidBlade"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "InfernalRift"); + recipe.AddIngredient(ItemID.GoldenShower); + recipe.AddIngredient(ItemID.AquaScepter); + recipe.AddIngredient(ItemID.CursedFlames); + recipe.AddIngredient(null, "GalacticaSingularity", 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + 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) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num72 = item.shootSpeed; + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + float f = Main.rand.NextFloat() * 6.28318548f; + float value12 = 20f; + float value13 = 60f; + Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + for (int num202 = 0; num202 < 50; num202++) + { + vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) + { + break; + } + f = Main.rand.NextFloat() * 6.28318548f; + } + Vector2 mouseWorld = Main.MouseWorld; + Vector2 vector14 = mouseWorld - vector13; + Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; + vector14 = vector14.SafeNormalize(vector15) * num72; + vector14 = Vector2.Lerp(vector14, vector15, 0.25f); + Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/UrchinSpear.cs b/Items/Weapons/UrchinSpear.cs index e8b308ca4d..fc345f4dcc 100644 --- a/Items/Weapons/UrchinSpear.cs +++ b/Items/Weapons/UrchinSpear.cs @@ -1,50 +1,50 @@ -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 UrchinSpear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Urchin Spear"); - Tooltip.SetDefault("Poisons enemies and fires short-range stingers"); - } - - public override void SetDefaults() - { - item.width = 56; - item.damage = 17; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = 5; - item.useTime = 25; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = false; - item.height = 56; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("UrchinSpearProjectile"); - item.shootSpeed = 4f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "VictideBar", 4); - recipe.AddTile(TileID.Anvils); - 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.Weapons +{ + public class UrchinSpear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Urchin Spear"); + Tooltip.SetDefault("Poisons enemies and fires short-range stingers"); + } + + public override void SetDefaults() + { + item.width = 56; + item.damage = 17; + item.melee = true; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 25; + item.useStyle = 5; + item.useTime = 25; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = false; + item.height = 56; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("UrchinSpearProjectile"); + item.shootSpeed = 4f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "VictideBar", 4); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/VanquisherArrow.cs b/Items/Weapons/VanquisherArrow.cs index 94426b3bd0..602dce5c30 100644 --- a/Items/Weapons/VanquisherArrow.cs +++ b/Items/Weapons/VanquisherArrow.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class VanquisherArrow : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class VanquisherArrow : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Vanquisher Arrow"); - Tooltip.SetDefault("Pierces through tiles\n" + + Tooltip.SetDefault("Pierces through tiles\n" + "Spawns extra homing arrows as it travels"); } - - public override void SetDefaults() - { - item.damage = 33; - item.ranged = true; - item.width = 14; - item.height = 36; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 3.5f; - item.value = 2250; - item.shoot = mod.ProjectileType("VanquisherArrow"); - item.shootSpeed = 10f; - item.ammo = 40; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar"); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this, 250); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 33; + item.ranged = true; + item.width = 14; + item.height = 36; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 3.5f; + item.value = 2250; + item.shoot = mod.ProjectileType("VanquisherArrow"); + item.shootSpeed = 10f; + item.ammo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar"); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this, 250); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Vehemenc.cs b/Items/Weapons/Vehemenc.cs index 90744b29eb..c0a83cb8fe 100644 --- a/Items/Weapons/Vehemenc.cs +++ b/Items/Weapons/Vehemenc.cs @@ -1,52 +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.Weapons -{ - public class Vehemenc : ModItem - { - public override void SetStaticDefaults() - { - 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 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; - } - - public override void SetDefaults() - { - item.damage = 7; - item.magic = true; - item.mana = 590; - item.width = 44; - item.height = 44; - item.useTime = 50; - item.useAnimation = 50; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5.75f; - item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item73; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Vehemence"); - item.shootSpeed = 16f; - } - - 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("Vehemence"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - player.AddBuff(BuffID.ManaSickness, 600, true); - return false; - } - } -} \ No newline at end of file +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 Vehemenc : ModItem + { + public override void SetStaticDefaults() + { + 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 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; + } + + public override void SetDefaults() + { + item.damage = 7; + item.magic = true; + item.mana = 590; + item.width = 44; + item.height = 44; + item.useTime = 50; + item.useAnimation = 50; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5.75f; + item.value = Item.buyPrice(1, 0, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item73; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Vehemence"); + item.shootSpeed = 16f; + } + + 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("Vehemence"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + player.AddBuff(BuffID.ManaSickness, 600, true); + return false; + } + } +} diff --git a/Items/Weapons/VenusianTrident.cs b/Items/Weapons/VenusianTrident.cs index 6e33099e49..5621c63f9b 100644 --- a/Items/Weapons/VenusianTrident.cs +++ b/Items/Weapons/VenusianTrident.cs @@ -1,53 +1,53 @@ -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 VenusianTrident : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Venusian Trident"); - Tooltip.SetDefault("Casts an inferno bolt that erupts into a gigantic explosion of fire and magma shards"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 225; - item.magic = true; - item.mana = 20; - item.width = 48; - item.height = 48; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 9f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item45; - item.autoReuse = true; - item.shoot = mod.ProjectileType("VenusianBolt"); - item.shootSpeed = 19f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.InfernoFork); - recipe.AddIngredient(null, "RuinousSoul", 2); - recipe.AddIngredient(null, "TwistingNether"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 VenusianTrident : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Venusian Trident"); + Tooltip.SetDefault("Casts an inferno bolt that erupts into a gigantic explosion of fire and magma shards"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 225; + item.magic = true; + item.mana = 20; + item.width = 48; + item.height = 48; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 9f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item45; + item.autoReuse = true; + item.shoot = mod.ProjectileType("VenusianBolt"); + item.shootSpeed = 19f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.InfernoFork); + recipe.AddIngredient(null, "RuinousSoul", 2); + recipe.AddIngredient(null, "TwistingNether"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Verdant.cs b/Items/Weapons/Verdant.cs index 678da95688..0fda3660a7 100644 --- a/Items/Weapons/Verdant.cs +++ b/Items/Weapons/Verdant.cs @@ -1,46 +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 -{ - public class Verdant : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Verdant"); - Tooltip.SetDefault("Fires crystal leafs when enemies are near"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Kraken); - item.damage = 247; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.autoReuse = true; - item.shoot = mod.ProjectileType("VerdantProjectile"); - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "UeliaceBar", 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Verdant : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Verdant"); + Tooltip.SetDefault("Fires crystal leafs when enemies are near"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Kraken); + item.damage = 247; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.autoReuse = true; + item.shoot = mod.ProjectileType("VerdantProjectile"); + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "UeliaceBar", 6); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/VeriumBullet.cs b/Items/Weapons/VeriumBullet.cs index cf887a8ee8..09890241a0 100644 --- a/Items/Weapons/VeriumBullet.cs +++ b/Items/Weapons/VeriumBullet.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class VeriumBullet : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons +{ + public class VeriumBullet : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Verium Bullet"); Tooltip.SetDefault("There is no escape!"); } - - public override void SetDefaults() - { - item.damage = 8; - item.ranged = true; - item.width = 8; - item.height = 8; - item.maxStack = 999; - item.consumable = true; - item.knockBack = 1.25f; - item.value = 500; - item.rare = 3; - item.shoot = mod.ProjectileType("VeriumBullet"); - item.shootSpeed = 16f; - item.ammo = 97; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MusketBall, 100); - recipe.AddIngredient(null, "VerstaltiteBar"); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 100); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 8; + item.ranged = true; + item.width = 8; + item.height = 8; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 1.25f; + item.value = 500; + item.rare = 3; + item.shoot = mod.ProjectileType("VeriumBullet"); + item.shootSpeed = 16f; + item.ammo = 97; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MusketBall, 100); + recipe.AddIngredient(null, "VerstaltiteBar"); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 100); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Vesuvius.cs b/Items/Weapons/Vesuvius.cs index c747b77f9d..9d74198a39 100644 --- a/Items/Weapons/Vesuvius.cs +++ b/Items/Weapons/Vesuvius.cs @@ -1,131 +1,131 @@ -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 -{ - public class Vesuvius : ModItem - { +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 +{ + public class Vesuvius : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Vesuvius"); Tooltip.SetDefault("Legendary drop\n" + "Asteroids give the Molten buff on enemy hits\n" + "Calls down a swarm of molten asteroids\n" + - "Right click to fire a spread of molten asteroids from the staff\n" + + "Right click to fire a spread of molten asteroids from the staff\n" + "Revengeance drop"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.width = 62; - item.damage = 70; - item.mana = 6; - item.magic = true; - item.useAnimation = 20; - item.useTime = 20; - item.noMelee = true; - item.useStyle = 5; - item.knockBack = 3f; - item.UseSound = SoundID.Item88; - item.autoReuse = true; - item.height = 62; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shootSpeed = 20f; - item.shoot = mod.ProjectileType("AsteroidMolten"); - item.GetGlobalItem(mod).postMoonLordRarity = 17; - } - - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.mana = 9; - item.useTime = 20; - item.useAnimation = 20; - } - else - { - item.mana = 6; - item.useTime = 15; - item.useAnimation = 15; - } - return base.CanUseItem(player); - } - - public override 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) - { - 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.5f + (float)Main.rand.NextDouble() * 0.9f); - } - return false; - } - else - { - 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 num113 = 0; num113 < 4; num113++) - { - 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 * num113); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; - 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 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, type, damage, knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.9f); //0.3 - } - return false; - } - } - } -} + public override void SetDefaults() + { + item.width = 62; + item.damage = 70; + item.mana = 6; + item.magic = true; + item.useAnimation = 20; + item.useTime = 20; + item.noMelee = true; + item.useStyle = 5; + item.knockBack = 3f; + item.UseSound = SoundID.Item88; + item.autoReuse = true; + item.height = 62; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shootSpeed = 20f; + item.shoot = mod.ProjectileType("AsteroidMolten"); + item.GetGlobalItem(mod).postMoonLordRarity = 17; + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.mana = 9; + item.useTime = 20; + item.useAnimation = 20; + } + else + { + item.mana = 6; + item.useTime = 15; + item.useAnimation = 15; + } + return base.CanUseItem(player); + } + + public override 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) + { + 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.5f + (float)Main.rand.NextDouble() * 0.9f); + } + return false; + } + else + { + 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 num113 = 0; num113 < 4; num113++) + { + 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 * num113); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; + 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 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, type, damage, knockBack, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.9f); //0.3 + } + return false; + } + } + } +} diff --git a/Items/Weapons/Viscera.cs b/Items/Weapons/Viscera.cs index 5421c97c45..1f74de03e6 100644 --- a/Items/Weapons/Viscera.cs +++ b/Items/Weapons/Viscera.cs @@ -1,52 +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.Weapons -{ - public class Viscera : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Viscera"); - Tooltip.SetDefault("Fires a blood beam that heals you on enemy hits\n" + - "The more tiles and enemies the beam bounces off of or travels through the more healing the beam does"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 153; - item.magic = true; - item.mana = 15; - item.width = 50; - item.height = 52; - item.useTime = 14; - item.useAnimation = 14; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Viscera"); - item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodstoneCore", 4); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Viscera : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Viscera"); + Tooltip.SetDefault("Fires a blood beam that heals you on enemy hits\n" + + "The more tiles and enemies the beam bounces off of or travels through the more healing the beam does"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 153; + item.magic = true; + item.mana = 15; + item.width = 50; + item.height = 52; + item.useTime = 14; + item.useAnimation = 14; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Viscera"); + item.shootSpeed = 6f; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodstoneCore", 4); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/VividClarity.cs b/Items/Weapons/VividClarity.cs index 32a2d00e79..7815a9bfd6 100644 --- a/Items/Weapons/VividClarity.cs +++ b/Items/Weapons/VividClarity.cs @@ -1,118 +1,118 @@ -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 VividClarity : 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.Weapons +{ + public class VividClarity : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Vivid Clarity"); Tooltip.SetDefault("Fires 3 beams of elemental energy near the mouse cursor that bounce\n" + "The beams split when enemies are near\n" + - "The more enemies and tiles the beams hit the more damage they do\n" + + "The more enemies and tiles the beams hit the more damage they do\n" + "High IQ required"); Item.staff[item.type] = true; } - public override void SetDefaults() - { - item.damage = 500; - item.magic = true; - item.mana = 150; - item.width = 90; - item.height = 112; - item.useTime = 33; - item.useAnimation = 33; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item60; - item.autoReuse = true; - item.shoot = mod.ProjectileType("VividClarity"); - item.shootSpeed = 6f; - item.GetGlobalItem(mod).postMoonLordRarity = 15; - } - - 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; - } - num78 *= num80; - num79 *= num80; - int num130 = 3; - for (int num131 = 0; num131 < num130; num131++) - { - 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); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num131); - 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(-40, 41) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("VividClarity"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "ElementalRay"); - recipe.AddIngredient(null, "ArchAmaryllis"); - recipe.AddIngredient(null, "AsteroidStaff"); - recipe.AddIngredient(null, "HellwingStaff"); - recipe.AddIngredient(null, "PhantasmalFury"); - recipe.AddIngredient(null, "ShadowboltStaff"); - recipe.AddIngredient(null, "VenusianTrident"); - recipe.AddIngredient(null, "NightmareFuel", 5); - recipe.AddIngredient(null, "EndothermicEnergy", 5); - recipe.AddIngredient(null, "CosmiliteBar", 5); - recipe.AddIngredient(null, "DarksunFragment", 5); - recipe.AddIngredient(null, "HellcasterFragment", 3); - recipe.AddIngredient(null, "Phantoplasm", 5); - recipe.AddIngredient(null, "AuricOre", 25); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + public override void SetDefaults() + { + item.damage = 500; + item.magic = true; + item.mana = 150; + item.width = 90; + item.height = 112; + item.useTime = 33; + item.useAnimation = 33; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 7.5f; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.shoot = mod.ProjectileType("VividClarity"); + item.shootSpeed = 6f; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + 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; + } + num78 *= num80; + num79 *= num80; + int num130 = 3; + for (int num131 = 0; num131 < num130; num131++) + { + 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); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num131); + 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(-40, 41) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("VividClarity"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ElementalRay"); + recipe.AddIngredient(null, "ArchAmaryllis"); + recipe.AddIngredient(null, "AsteroidStaff"); + recipe.AddIngredient(null, "HellwingStaff"); + recipe.AddIngredient(null, "PhantasmalFury"); + recipe.AddIngredient(null, "ShadowboltStaff"); + recipe.AddIngredient(null, "VenusianTrident"); + recipe.AddIngredient(null, "NightmareFuel", 5); + recipe.AddIngredient(null, "EndothermicEnergy", 5); + recipe.AddIngredient(null, "CosmiliteBar", 5); + recipe.AddIngredient(null, "DarksunFragment", 5); + recipe.AddIngredient(null, "HellcasterFragment", 3); + recipe.AddIngredient(null, "Phantoplasm", 5); + recipe.AddIngredient(null, "AuricOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Vortexpopper.cs b/Items/Weapons/Vortexpopper.cs index c02931423f..59637fb137 100644 --- a/Items/Weapons/Vortexpopper.cs +++ b/Items/Weapons/Vortexpopper.cs @@ -1,128 +1,128 @@ -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 Vortexpopper : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vortexpopper"); - Tooltip.SetDefault("Fires bubbles everywhere that pop into bullets"); - } - - public override void SetDefaults() - { - item.damage = 20; - item.ranged = true; - item.width = 46; - item.height = 22; - item.useTime = 16; - item.useAnimation = 16; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.25f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item95; - item.autoReuse = true; - item.shootSpeed = 50f; - item.shoot = 444; - item.useAmmo = 97; - } - - 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 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; - Vector2 value6 = Vector2.Normalize(new Vector2(num78, num79)) * 40f * item.scale; - if (Collision.CanHit(vector2, 0, 0, vector2 + value6, 0, 0)) - { - vector2 += value6; - } - float ai = new Vector2(num78, num79).ToRotation(); - float num96 = 2.09439516f; - int num97 = Main.rand.Next(6, 10); - if (Main.rand.Next(4) == 0) - { - num97++; - } - for (int num98 = 0; num98 < num97; num98++) - { - float scaleFactor2 = (float)Main.rand.NextDouble() * 0.2f + 0.05f; - Vector2 vector6 = new Vector2(num78, num79).RotatedBy((double)(num96 * (float)Main.rand.NextDouble() - num96 / 2f), default(Vector2)) * scaleFactor2; - int num99 = Projectile.NewProjectile(position.X, position.Y, vector6.X, vector6.Y, 444, damage, knockBack, player.whoAmI, ai, 0f); - Main.projectile[num99].localAI[0] = (float)type; - Main.projectile[num99].localAI[1] = 12f; - } - int num107 = Main.rand.Next(5, 10); - 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(-800, 801); - 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(-1000, 1001) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-1000, 1001) * 0.02f; - int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 444, damage, knockBack, player.whoAmI, ai, 0f); - Main.projectile[projectile].localAI[0] = (float)type; - Main.projectile[projectile].localAI[1] = 12f; - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Xenopopper); - recipe.AddIngredient(ItemID.FragmentVortex, 20); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Vortexpopper : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vortexpopper"); + Tooltip.SetDefault("Fires bubbles everywhere that pop into bullets"); + } + + public override void SetDefaults() + { + item.damage = 20; + item.ranged = true; + item.width = 46; + item.height = 22; + item.useTime = 16; + item.useAnimation = 16; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.25f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item95; + item.autoReuse = true; + item.shootSpeed = 50f; + item.shoot = 444; + item.useAmmo = 97; + } + + 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 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; + Vector2 value6 = Vector2.Normalize(new Vector2(num78, num79)) * 40f * item.scale; + if (Collision.CanHit(vector2, 0, 0, vector2 + value6, 0, 0)) + { + vector2 += value6; + } + float ai = new Vector2(num78, num79).ToRotation(); + float num96 = 2.09439516f; + int num97 = Main.rand.Next(6, 10); + if (Main.rand.Next(4) == 0) + { + num97++; + } + for (int num98 = 0; num98 < num97; num98++) + { + float scaleFactor2 = (float)Main.rand.NextDouble() * 0.2f + 0.05f; + Vector2 vector6 = new Vector2(num78, num79).RotatedBy((double)(num96 * (float)Main.rand.NextDouble() - num96 / 2f), default(Vector2)) * scaleFactor2; + int num99 = Projectile.NewProjectile(position.X, position.Y, vector6.X, vector6.Y, 444, damage, knockBack, player.whoAmI, ai, 0f); + Main.projectile[num99].localAI[0] = (float)type; + Main.projectile[num99].localAI[1] = 12f; + } + int num107 = Main.rand.Next(5, 10); + 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(-800, 801); + 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(-1000, 1001) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-1000, 1001) * 0.02f; + int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 444, damage, knockBack, player.whoAmI, ai, 0f); + Main.projectile[projectile].localAI[0] = (float)type; + Main.projectile[projectile].localAI[1] = 12f; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Xenopopper); + recipe.AddIngredient(ItemID.FragmentVortex, 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Waraxe.cs b/Items/Weapons/Waraxe.cs index c78525d7fb..d832a26a35 100644 --- a/Items/Weapons/Waraxe.cs +++ b/Items/Weapons/Waraxe.cs @@ -1,45 +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.Weapons -{ - public class Waraxe : ModItem - { - 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() - { - item.damage = 22; - item.melee = true; - item.width = 32; - item.height = 30; - item.useTime = 22; - item.useAnimation = 22; - item.useTurn = true; - item.axe = 10; - item.useStyle = 1; - item.knockBack = 5.25f; - 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 +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 Waraxe : ModItem + { + 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() + { + item.damage = 22; + item.melee = true; + item.width = 32; + item.height = 30; + item.useTime = 22; + item.useAnimation = 22; + item.useTurn = true; + item.axe = 10; + item.useStyle = 1; + item.knockBack = 5.25f; + 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); + } + } + } +} diff --git a/Items/Weapons/Warblade.cs b/Items/Weapons/Warblade.cs index 9fb6695294..897b166fc3 100644 --- a/Items/Weapons/Warblade.cs +++ b/Items/Weapons/Warblade.cs @@ -1,45 +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.Weapons -{ - public class Warblade : ModItem - { - 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() - { - item.damage = 27; - item.melee = true; - item.width = 32; - item.height = 48; - item.useTime = 19; - item.useAnimation = 19; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 4.25f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - 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 +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 Warblade : ModItem + { + 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() + { + item.damage = 27; + item.melee = true; + item.width = 32; + item.height = 48; + item.useTime = 19; + item.useAnimation = 19; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 4.25f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + 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); + } + } + } +} diff --git a/Items/Weapons/WindBlade.cs b/Items/Weapons/WindBlade.cs index 1bc42a28d3..97e46b3c01 100644 --- a/Items/Weapons/WindBlade.cs +++ b/Items/Weapons/WindBlade.cs @@ -1,63 +1,63 @@ -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 WindBlade : ModItem - { - 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 = 27; - item.melee = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 58; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.shoot = mod.ProjectileType("Cyclone"); - item.shootSpeed = 3f; - } - - 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); - recipe.AddIngredient(ItemID.SunplateBlock, 3); - recipe.AddTile(TileID.SkyMill); - 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, 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 +{ + public class WindBlade : ModItem + { + 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 = 27; + item.melee = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.useTurn = true; + item.knockBack = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 58; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.shoot = mod.ProjectileType("Cyclone"); + item.shootSpeed = 3f; + } + + 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); + recipe.AddIngredient(ItemID.SunplateBlock, 3); + recipe.AddTile(TileID.SkyMill); + 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, 59); + } + } + } +} diff --git a/Items/Weapons/Wingman.cs b/Items/Weapons/Wingman.cs index 99b2759653..e1a36d2b60 100644 --- a/Items/Weapons/Wingman.cs +++ b/Items/Weapons/Wingman.cs @@ -1,50 +1,50 @@ -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 Wingman : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wingman"); - Tooltip.SetDefault("Fires a concentrated laser beam"); - } - - public override void SetDefaults() - { - item.damage = 54; - item.magic = true; - item.mana = 12; - item.width = 42; - item.height = 22; - 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.Item33; - item.autoReuse = true; - item.shootSpeed = 25f; - item.shoot = 440; - } - - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 440, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } -} \ No newline at end of file +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 Wingman : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wingman"); + Tooltip.SetDefault("Fires a concentrated laser beam"); + } + + public override void SetDefaults() + { + item.damage = 54; + item.magic = true; + item.mana = 12; + item.width = 42; + item.height = 22; + 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.Item33; + item.autoReuse = true; + item.shootSpeed = 25f; + item.shoot = 440; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 440, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/WrathoftheAncients.cs b/Items/Weapons/WrathoftheAncients.cs index 751e3eab3c..1f1af4b940 100644 --- a/Items/Weapons/WrathoftheAncients.cs +++ b/Items/Weapons/WrathoftheAncients.cs @@ -1,74 +1,74 @@ -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 WrathoftheAncients : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wrath of the Ancients"); - Tooltip.SetDefault("Casts a granite energy pulse"); - } - - public override void SetDefaults() - { - item.damage = 47; - item.magic = true; - item.mana = 20; - item.width = 28; - item.height = 30; - item.useTime = 38; - item.useAnimation = 38; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.autoReuse = true; - item.shoot = mod.ProjectileType("GranitePulse"); - item.shootSpeed = 9f; - } - - 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("GranitePulse"), num73, num74, i, 0f, 0f); - return false; - } - } -} \ No newline at end of file +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 WrathoftheAncients : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wrath of the Ancients"); + Tooltip.SetDefault("Casts a granite energy pulse"); + } + + public override void SetDefaults() + { + item.damage = 47; + item.magic = true; + item.mana = 20; + item.width = 28; + item.height = 30; + item.useTime = 38; + item.useAnimation = 38; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.autoReuse = true; + item.shoot = mod.ProjectileType("GranitePulse"); + item.shootSpeed = 9f; + } + + 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("GranitePulse"), num73, num74, i, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/WulfrumBlade.cs b/Items/Weapons/WulfrumBlade.cs index 18103ce00b..45a4509f38 100644 --- a/Items/Weapons/WulfrumBlade.cs +++ b/Items/Weapons/WulfrumBlade.cs @@ -1,45 +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.Weapons -{ - public class WulfrumBlade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Blade"); - } - - public override void SetDefaults() - { - item.width = 46; - item.damage = 12; - item.melee = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 3.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 54; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 12); - recipe.AddTile(TileID.Anvils); - 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.Weapons +{ + public class WulfrumBlade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Blade"); + } + + public override void SetDefaults() + { + item.width = 46; + item.damage = 12; + item.melee = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.useTurn = true; + item.knockBack = 3.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 54; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/WulfrumBow.cs b/Items/Weapons/WulfrumBow.cs index dc67cfbbe7..c3fafbe7b6 100644 --- a/Items/Weapons/WulfrumBow.cs +++ b/Items/Weapons/WulfrumBow.cs @@ -1,54 +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 TerrariaOverhaul; - -namespace CalamityMod.Items.Weapons -{ - public class WulfrumBow : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Bow"); - } - - public override void SetDefaults() - { - item.damage = 10; - item.ranged = true; - item.width = 34; - item.height = 56; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.25f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 TerrariaOverhaul; + +namespace CalamityMod.Items.Weapons +{ + public class WulfrumBow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Bow"); + } + + public override void SetDefaults() + { + item.damage = 10; + item.ranged = true; + item.width = 34; + item.height = 56; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 40; + } + + /*public void OverhaulInit() + { + this.SetTag("bow"); + }*/ + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/WulfrumStaff.cs b/Items/Weapons/WulfrumStaff.cs index 7c92773290..5fce9a5d13 100644 --- a/Items/Weapons/WulfrumStaff.cs +++ b/Items/Weapons/WulfrumStaff.cs @@ -1,50 +1,50 @@ -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 WulfrumStaff : 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.Weapons +{ + public class WulfrumStaff : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Staff"); Tooltip.SetDefault("Casts a wulfrum bolt"); Item.staff[item.type] = true; } - - public override void SetDefaults() - { - item.damage = 10; - item.magic = true; - item.mana = 4; - item.width = 44; - item.height = 46; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = mod.ProjectileType("WulfrumBolt"); - item.shootSpeed = 9f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file + + public override void SetDefaults() + { + item.damage = 10; + item.magic = true; + item.mana = 4; + item.width = 44; + item.height = 46; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = mod.ProjectileType("WulfrumBolt"); + item.shootSpeed = 9f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/XerocsGreatsword.cs b/Items/Weapons/XerocsGreatsword.cs index 58fd8e992d..98ec73c8f9 100644 --- a/Items/Weapons/XerocsGreatsword.cs +++ b/Items/Weapons/XerocsGreatsword.cs @@ -1,77 +1,77 @@ -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 XerocsGreatsword : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Greatsword"); - Tooltip.SetDefault("Fires a spread of homing plasma balls"); - } - - public override void SetDefaults() - { - item.width = 66; - item.damage = 95; - item.melee = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.useTurn = true; - item.knockBack = 5.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 66; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.shoot = mod.ProjectileType("PlasmaBall"); - item.shootSpeed = 12f; - } - - 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(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MeldiateBar", 15); - recipe.AddTile(TileID.LunarCraftingStation); - 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, 27); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 300); - } - } -} +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 XerocsGreatsword : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Greatsword"); + Tooltip.SetDefault("Fires a spread of homing plasma balls"); + } + + public override void SetDefaults() + { + item.width = 66; + item.damage = 95; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 66; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.shoot = mod.ProjectileType("PlasmaBall"); + item.shootSpeed = 12f; + } + + 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(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MeldiateBar", 15); + recipe.AddTile(TileID.LunarCraftingStation); + 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, 27); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 300); + } + } +} diff --git a/Items/Weapons/YharimsCrystal.cs b/Items/Weapons/YharimsCrystal.cs index 584402cd2a..7ac80d0e38 100644 --- a/Items/Weapons/YharimsCrystal.cs +++ b/Items/Weapons/YharimsCrystal.cs @@ -1,78 +1,78 @@ -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.World; - -namespace CalamityMod.Items.Weapons -{ - public class YharimsCrystal : 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; +using CalamityMod.World; + +namespace CalamityMod.Items.Weapons +{ + public class YharimsCrystal : ModItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Yharim's Crystal"); - Tooltip.SetDefault("Fires a beam of complete destruction\n" + + Tooltip.SetDefault("Fires a beam of complete destruction\n" + "Only those that are worthy can use this item before Yharon is defeated"); - } - - public override void SetDefaults() - { - item.damage = 240; - item.magic = true; - item.mana = 100; - item.width = 16; - item.height = 16; - item.useTime = 10; - item.useAnimation = 10; - item.reuseDelay = 5; - item.useStyle = 5; - item.UseSound = SoundID.Item13; - item.noMelee = true; - item.noUseGraphic = true; - item.channel = true; - item.knockBack = 0f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("YharimsCrystal"); - item.shootSpeed = 30f; - item.GetGlobalItem(mod).postMoonLordRarity = 17; - } - - 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) - { - bool playerName = - player.name == "Fabsol" || - player.name == "Ziggums" || - player.name == "Poly" || - player.name == "Zach" || - player.name == "Grox the Great" || - player.name == "Jenosis" || - player.name == "DM DOKURO" || - player.name == "Uncle Danny" || - player.name == "Phoenix" || - player.name == "MineCat" || - player.name == "Khaelis" || - player.name == "Purple Necromancer" || - player.name == "gamagamer64" || - player.name == "Svante" || - player.name == "Puff" || - player.name == "Leviathan" || - player.name == "Testdude"; - bool yharon = CalamityWorld.downedYharon; - if (playerName || yharon) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("YharimsCrystal"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - else - { - Projectile.NewProjectile(position.X, position.Y, 0f, 0f, 29, 0, 0f, player.whoAmI, 0f, 0f); - return false; - } - } - } -} \ No newline at end of file + } + + public override void SetDefaults() + { + item.damage = 240; + item.magic = true; + item.mana = 100; + item.width = 16; + item.height = 16; + item.useTime = 10; + item.useAnimation = 10; + item.reuseDelay = 5; + item.useStyle = 5; + item.UseSound = SoundID.Item13; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.knockBack = 0f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("YharimsCrystal"); + item.shootSpeed = 30f; + item.GetGlobalItem(mod).postMoonLordRarity = 17; + } + + 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) + { + bool playerName = + player.name == "Fabsol" || + player.name == "Ziggums" || + player.name == "Poly" || + player.name == "Zach" || + player.name == "Grox the Great" || + player.name == "Jenosis" || + player.name == "DM DOKURO" || + player.name == "Uncle Danny" || + player.name == "Phoenix" || + player.name == "MineCat" || + player.name == "Khaelis" || + player.name == "Purple Necromancer" || + player.name == "gamagamer64" || + player.name == "Svante" || + player.name == "Puff" || + player.name == "Leviathan" || + player.name == "Testdude"; + bool yharon = CalamityWorld.downedYharon; + if (playerName || yharon) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("YharimsCrystal"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + else + { + Projectile.NewProjectile(position.X, position.Y, 0f, 0f, 29, 0, 0f, player.whoAmI, 0f, 0f); + return false; + } + } + } +} diff --git a/Items/Weapons/Yharon/AngryChickenStaff.cs b/Items/Weapons/Yharon/AngryChickenStaff.cs index f21acc7e84..53fd1f8667 100644 --- a/Items/Weapons/Yharon/AngryChickenStaff.cs +++ b/Items/Weapons/Yharon/AngryChickenStaff.cs @@ -1,75 +1,75 @@ -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.Weapons.Yharon -{ - public class AngryChickenStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharon's Kindle Staff"); - Tooltip.SetDefault("Summons the Son of Yharon to fight for you\n" + - "The dragon increases your life regen, defense, and movement speed while summoned\n" + - "Requires 4 minion slots to use"); - } - - public override void SetDefaults() - { - item.mana = 50; - item.damage = 160; - item.useStyle = 1; - item.width = 32; - item.height = 32; - item.useTime = 36; - item.useAnimation = 36; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); - item.autoReuse = true; - item.shoot = mod.ProjectileType("AngryChicken"); - item.shootSpeed = 10f; - item.summon = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - 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 +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.Weapons.Yharon +{ + public class AngryChickenStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharon's Kindle Staff"); + Tooltip.SetDefault("Summons the Son of Yharon to fight for you\n" + + "The dragon increases your life regen, defense, and movement speed while summoned\n" + + "Requires 4 minion slots to use"); + } + + public override void SetDefaults() + { + item.mana = 50; + item.damage = 160; + item.useStyle = 1; + item.width = 32; + item.height = 32; + item.useTime = 36; + item.useAnimation = 36; + item.noMelee = true; + item.knockBack = 7f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); + item.autoReuse = true; + item.shoot = mod.ProjectileType("AngryChicken"); + item.shootSpeed = 10f; + item.summon = true; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + 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); + } + } +} diff --git a/Items/Weapons/Yharon/ChickenCannon.cs b/Items/Weapons/Yharon/ChickenCannon.cs index 98d3ab99b1..c330b13b67 100644 --- a/Items/Weapons/Yharon/ChickenCannon.cs +++ b/Items/Weapons/Yharon/ChickenCannon.cs @@ -1,47 +1,47 @@ -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.Yharon -{ - public class ChickenCannon : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chicken Cannon"); - Tooltip.SetDefault("Fires chicken rockets"); - } - - public override void SetDefaults() - { - item.damage = 12; - item.ranged = true; - item.width = 76; - item.height = 24; - item.useTime = 13; - item.useAnimation = 13; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 8.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item11; - item.autoReuse = true; - item.shootSpeed = 24f; - item.shoot = mod.ProjectileType("Chicken"); - item.useAmmo = 771; - 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Chicken"), damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} \ No newline at end of file +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.Yharon +{ + public class ChickenCannon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chicken Cannon"); + Tooltip.SetDefault("Fires chicken rockets"); + } + + public override void SetDefaults() + { + item.damage = 12; + item.ranged = true; + item.width = 76; + item.height = 24; + item.useTime = 13; + item.useAnimation = 13; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 8.5f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("Chicken"); + item.useAmmo = 771; + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Chicken"), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Yharon/DragonRage.cs b/Items/Weapons/Yharon/DragonRage.cs index 610bda8537..a86da68488 100644 --- a/Items/Weapons/Yharon/DragonRage.cs +++ b/Items/Weapons/Yharon/DragonRage.cs @@ -1,65 +1,65 @@ -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.Yharon -{ - public class DragonRage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dragon Rage"); - Tooltip.SetDefault("Fires a spread of five fire waves"); - } - - public override void SetDefaults() - { - item.width = 68; - item.damage = 800; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 80; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("DragonRage"); - item.shootSpeed = 14f; - 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) - { - for (int index = 0; index < 5; ++index) - { - float num7 = speedX; - float num8 = speedY; - float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - 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, 244); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 360); - } - } -} +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.Yharon +{ + public class DragonRage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragon Rage"); + Tooltip.SetDefault("Fires a spread of five fire waves"); + } + + public override void SetDefaults() + { + item.width = 68; + item.damage = 800; + item.melee = true; + item.useAnimation = 25; + item.useTime = 25; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 80; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("DragonRage"); + item.shootSpeed = 14f; + 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) + { + for (int index = 0; index < 5; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + 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, 244); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 360); + } + } +} diff --git a/Items/Weapons/Yharon/DragonsBreath.cs b/Items/Weapons/Yharon/DragonsBreath.cs index 4d0ced8df1..cf7e447d24 100644 --- a/Items/Weapons/Yharon/DragonsBreath.cs +++ b/Items/Weapons/Yharon/DragonsBreath.cs @@ -1,65 +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.Yharon -{ - public class DragonsBreath : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dragon's Breath"); - Tooltip.SetDefault("80% chance to not consume ammo\n" + - "Shoots a spread of exploding fire bullets"); - } - - public override void SetDefaults() - { - item.damage = 220; - item.ranged = true; - item.width = 64; - item.height = 28; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 6.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = 10; - item.shootSpeed = 12f; - item.useAmmo = 97; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - 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 i = 0; i <= 12; i++) - { - 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, mod.ProjectileType("DragonBurst"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 80) - return false; - return true; - } - } -} \ No newline at end of file +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.Yharon +{ + public class DragonsBreath : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragon's Breath"); + Tooltip.SetDefault("80% chance to not consume ammo\n" + + "Shoots a spread of exploding fire bullets"); + } + + public override void SetDefaults() + { + item.damage = 220; + item.ranged = true; + item.width = 64; + item.height = 28; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6.5f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item36; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + 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 i = 0; i <= 12; i++) + { + 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, mod.ProjectileType("DragonBurst"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 80) + return false; + return true; + } + } +} diff --git a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs index 6ff1b987a3..d9484fc8a8 100644 --- a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs @@ -1,103 +1,103 @@ -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.Yharon -{ - public class PhoenixFlameBarrage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phoenix Flame Barrage"); - Tooltip.SetDefault("Baptism by holy fire\n" + - "Casts a barrage of fire from the sky"); - Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 290; - item.magic = true; - item.mana = 20; - item.width = 72; - item.height = 70; - item.useTime = 15; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("HolyFlame"); - item.shootSpeed = 30f; - 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; - 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 *= num80; - num79 *= num80; - int num107 = 30; - if (Main.rand.Next(3) == 0) - { - num107++; - } - if (Main.rand.Next(3) == 0) - { - num107++; - } - 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)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, 0f, (float)Main.rand.Next(15)); - } - return false; - } - } -} \ No newline at end of file +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.Yharon +{ + public class PhoenixFlameBarrage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phoenix Flame Barrage"); + Tooltip.SetDefault("Baptism by holy fire\n" + + "Casts a barrage of fire from the sky"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 290; + item.magic = true; + item.mana = 20; + item.width = 72; + item.height = 70; + item.useTime = 15; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("HolyFlame"); + item.shootSpeed = 30f; + 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; + 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 *= num80; + num79 *= num80; + int num107 = 30; + if (Main.rand.Next(3) == 0) + { + num107++; + } + if (Main.rand.Next(3) == 0) + { + num107++; + } + 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)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, 0f, (float)Main.rand.Next(15)); + } + return false; + } + } +} diff --git a/Items/Weapons/Yharon/TheBurningSky.cs b/Items/Weapons/Yharon/TheBurningSky.cs index 594a4ec2c6..3f20038c9f 100644 --- a/Items/Weapons/Yharon/TheBurningSky.cs +++ b/Items/Weapons/Yharon/TheBurningSky.cs @@ -1,106 +1,106 @@ -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.Yharon -{ - public class TheBurningSky : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Burning Sky"); - Tooltip.SetDefault("Summons a massive barrage of burning meteors from the sky"); - } - - public override void SetDefaults() - { - item.width = 56; - item.damage = 200; - item.melee = true; - item.useTime = 5; - item.useAnimation = 15; - item.useStyle = 1; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 68; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = mod.ProjectileType("BurningMeteor"); - item.shootSpeed = 35f; - 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; - 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 *= num80; - num79 *= num80; - int num107 = 10; - 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)Main.rand.Next(-1000, 1001) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-1000, 1001) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("BurningMeteor"), damage, knockBack, i, 0f, (float)Main.rand.Next(10)); - } - return false; - } - - 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, 244); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 600); - } - } -} +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.Yharon +{ + public class TheBurningSky : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Burning Sky"); + Tooltip.SetDefault("Summons a massive barrage of burning meteors from the sky"); + } + + public override void SetDefaults() + { + item.width = 56; + item.damage = 200; + item.melee = true; + item.useTime = 5; + item.useAnimation = 15; + item.useStyle = 1; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 68; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("BurningMeteor"); + item.shootSpeed = 35f; + 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; + 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 *= num80; + num79 *= num80; + int num107 = 10; + 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)Main.rand.Next(-1000, 1001) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-1000, 1001) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("BurningMeteor"), damage, knockBack, i, 0f, (float)Main.rand.Next(10)); + } + return false; + } + + 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, 244); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 600); + } + } +} diff --git a/Items/Weapons/YinYo.cs b/Items/Weapons/YinYo.cs index 8ece837816..10d166b952 100644 --- a/Items/Weapons/YinYo.cs +++ b/Items/Weapons/YinYo.cs @@ -1,47 +1,47 @@ -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 YinYo : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("YinYo"); - Tooltip.SetDefault("Fires light or dark shards when enemies are near\n" + - "Light shards fly up and down while dark shards fly left and right"); - } - - public override void SetDefaults() - { - item.CloneDefaults(ItemID.Chik); - item.damage = 34; - item.useTime = 25; - item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("YinYo"); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.DarkShard); - recipe.AddIngredient(ItemID.LightShard); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 YinYo : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("YinYo"); + Tooltip.SetDefault("Fires light or dark shards when enemies are near\n" + + "Light shards fly up and down while dark shards fly left and right"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Chik); + item.damage = 34; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 3.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("YinYo"); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DarkShard); + recipe.AddIngredient(ItemID.LightShard); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Zapper.cs b/Items/Weapons/Zapper.cs index 39512b8b67..6f9e75c15b 100644 --- a/Items/Weapons/Zapper.cs +++ b/Items/Weapons/Zapper.cs @@ -1,55 +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.Weapons -{ - public class Zapper : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lazinator"); - Tooltip.SetDefault("Zap"); - } - - public override void SetDefaults() - { - item.damage = 40; - item.magic = true; - item.mana = 4; - item.width = 46; - item.height = 22; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item12; - item.autoReuse = true; - item.shoot = 88; - item.shootSpeed = 20f; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LaserRifle); - recipe.AddIngredient(null, "VictoryShard", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 Zapper : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lazinator"); + Tooltip.SetDefault("Zap"); + } + + public override void SetDefaults() + { + item.damage = 40; + item.magic = true; + item.mana = 4; + item.width = 46; + item.height = 22; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item12; + item.autoReuse = true; + item.shoot = 88; + item.shootSpeed = 20f; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LaserRifle); + recipe.AddIngredient(null, "VictoryShard", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/WulfrumAxe.cs b/Items/WulfrumAxe.cs index da9e4d18e4..7c120157a5 100644 --- a/Items/WulfrumAxe.cs +++ b/Items/WulfrumAxe.cs @@ -1,46 +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 -{ - public class WulfrumAxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Axe"); - } - - public override void SetDefaults() - { - item.damage = 5; - item.melee = true; - item.width = 62; - item.height = 58; - item.useTime = 26; - item.useAnimation = 26; - item.useTurn = true; - item.axe = 7; - item.useStyle = 1; - item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 14); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class WulfrumAxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Axe"); + } + + public override void SetDefaults() + { + item.damage = 5; + item.melee = true; + item.width = 62; + item.height = 58; + item.useTime = 26; + item.useAnimation = 26; + item.useTurn = true; + item.axe = 7; + item.useStyle = 1; + item.knockBack = 4.5f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 14); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/WulfrumHammer.cs b/Items/WulfrumHammer.cs index 03c77ccc24..263c23c0fd 100644 --- a/Items/WulfrumHammer.cs +++ b/Items/WulfrumHammer.cs @@ -1,46 +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 -{ - public class WulfrumHammer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Hammer"); - } - - public override void SetDefaults() - { - item.damage = 7; - item.melee = true; - item.width = 56; - item.height = 56; - item.useTime = 29; - item.useAnimation = 29; - item.useTurn = true; - item.hammer = 35; - item.useStyle = 1; - item.knockBack = 5.5f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 16); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class WulfrumHammer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Hammer"); + } + + public override void SetDefaults() + { + item.damage = 7; + item.melee = true; + item.width = 56; + item.height = 56; + item.useTime = 29; + item.useAnimation = 29; + item.useTurn = true; + item.hammer = 35; + item.useStyle = 1; + item.knockBack = 5.5f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 16); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/WulfrumPickaxe.cs b/Items/WulfrumPickaxe.cs index b8a632dcd2..b1d15e76b4 100644 --- a/Items/WulfrumPickaxe.cs +++ b/Items/WulfrumPickaxe.cs @@ -1,46 +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 -{ - public class WulfrumPickaxe : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Pickaxe"); - } - - public override void SetDefaults() - { - item.damage = 5; - item.melee = true; - item.width = 48; - item.height = 48; - item.useTime = 16; - item.useAnimation = 16; - item.useTurn = true; - item.pick = 35; - item.useStyle = 1; - item.knockBack = 2f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "WulfrumShard", 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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 +{ + public class WulfrumPickaxe : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Pickaxe"); + } + + public override void SetDefaults() + { + item.damage = 5; + item.melee = true; + item.width = 48; + item.height = 48; + item.useTime = 16; + item.useAnimation = 16; + item.useTurn = true; + item.pick = 35; + item.useStyle = 1; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "WulfrumShard", 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/WulfrumShard.cs b/Items/WulfrumShard.cs index 33a1706891..36ba412aa6 100644 --- a/Items/WulfrumShard.cs +++ b/Items/WulfrumShard.cs @@ -1,28 +1,28 @@ -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 -{ - public class WulfrumShard : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Shard"); - } - - public override void SetDefaults() - { - item.width = 13; - item.height = 10; - item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 10, 0); - item.rare = 1; - } - } -} \ No newline at end of file +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 +{ + public class WulfrumShard : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Shard"); + } + + public override void SetDefaults() + { + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 10, 0); + item.rare = 1; + } + } +} diff --git a/Items/YharimsStimulants.cs b/Items/YharimsStimulants.cs index 76d7c28a5c..63fa090002 100644 --- a/Items/YharimsStimulants.cs +++ b/Items/YharimsStimulants.cs @@ -1,52 +1,52 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class YharimsStimulants : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharim's Stimulants"); - Tooltip.SetDefault("Gives decent buffs to ALL offensive and defensive stats"); - } - - 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("YharimPower"); - item.buffTime = 108000; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.EndurancePotion); - recipe.AddIngredient(ItemID.IronskinPotion); - recipe.AddIngredient(ItemID.SwiftnessPotion); - recipe.AddIngredient(ItemID.ArcheryPotion); - recipe.AddIngredient(ItemID.MagicPowerPotion); - recipe.AddIngredient(ItemID.TitanPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 50); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class YharimsStimulants : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharim's Stimulants"); + Tooltip.SetDefault("Gives decent buffs to ALL offensive and defensive stats"); + } + + 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("YharimPower"); + item.buffTime = 108000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.EndurancePotion); + recipe.AddIngredient(ItemID.IronskinPotion); + recipe.AddIngredient(ItemID.SwiftnessPotion); + recipe.AddIngredient(ItemID.ArcheryPotion); + recipe.AddIngredient(ItemID.MagicPowerPotion); + recipe.AddIngredient(ItemID.TitanPotion); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "BloodOrb", 50); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Yharon/ChickenEgg.cs b/Items/Yharon/ChickenEgg.cs index 35f32c8b01..2465907ee7 100644 --- a/Items/Yharon/ChickenEgg.cs +++ b/Items/Yharon/ChickenEgg.cs @@ -1,56 +1,56 @@ -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.World; - -namespace CalamityMod.Items.Yharon -{ - public class ChickenEgg : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dragon Egg"); - Tooltip.SetDefault("Summons the loyal guardian of the tyrant king\n" + - "It yearns for the jungle\n" + - "Not consumable"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = 4; - item.consumable = false; - item.GetGlobalItem(mod).postMoonLordRarity = 14; - } - - public override bool CanUseItem(Player player) - { - return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Yharon")) && CalamityWorld.downedBossAny; - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Yharon")); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EffulgentFeather", 15); - recipe.AddIngredient(null, "BarofLife", 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file +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.World; + +namespace CalamityMod.Items.Yharon +{ + public class ChickenEgg : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragon Egg"); + Tooltip.SetDefault("Summons the loyal guardian of the tyrant king\n" + + "It yearns for the jungle\n" + + "Not consumable"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Yharon")) && CalamityWorld.downedBossAny; + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Yharon")); + Main.PlaySound(SoundID.Roar, player.position, 0); + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EffulgentFeather", 15); + recipe.AddIngredient(null, "BarofLife", 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Yharon/HellcasterFragment.cs b/Items/Yharon/HellcasterFragment.cs index 82950f4c3e..8dd83a57fc 100644 --- a/Items/Yharon/HellcasterFragment.cs +++ b/Items/Yharon/HellcasterFragment.cs @@ -1,37 +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; -using CalamityMod.NPCs; - -namespace CalamityMod.Items.Yharon -{ - public class HellcasterFragment : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharon Soul Fragment"); - Tooltip.SetDefault("A shard of a godly soul"); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); - } - - public override void SetDefaults() - { - item.width = 10; - item.height = 14; - item.maxStack = 999; - item.value = Item.buyPrice(0, 10, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 20; - } - } -} \ No newline at end of file +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.NPCs; + +namespace CalamityMod.Items.Yharon +{ + public class HellcasterFragment : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharon Soul Fragment"); + Tooltip.SetDefault("A shard of a godly soul"); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num); + } + + public override void SetDefaults() + { + item.width = 10; + item.height = 14; + item.maxStack = 999; + item.value = Item.buyPrice(0, 10, 0, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 20; + } + } +} diff --git a/Items/Yharon/YharimsGift.cs b/Items/Yharon/YharimsGift.cs index bf405f7d59..b1d5b38d5a 100644 --- a/Items/Yharon/YharimsGift.cs +++ b/Items/Yharon/YharimsGift.cs @@ -1,90 +1,90 @@ -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.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Items.Yharon -{ - public class YharimsGift : ModItem - { - public int dragonTimer = 60; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharim's Gift"); - Tooltip.SetDefault("The power of a god pulses from within this artifact\n" + - "Flaming meteors rain down while invincibility is active\n" + - "Exploding dragon dust is left behind as you move\n" + - "Defense increased by 30 and damage increased by 15%"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 22; - item.value = Item.buyPrice(1, 0, 0, 0); - item.accessory = true; - item.expert = true; - item.rare = 9; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.meleeDamage += 0.15f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; - player.rangedDamage += 0.15f; - player.magicDamage += 0.15f; - player.minionDamage += 0.15f; - player.statDefense += 30; - if (((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1)) - { - dragonTimer--; - if (dragonTimer <= 0) - { - if (player.whoAmI == Main.myPlayer) - { - int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("DragonDust"), 350, 5f, player.whoAmI, 0f, 0f); - Main.projectile[projectile1].timeLeft = 60; - } - dragonTimer = 60; - } - } - else - { - dragonTimer = 60; - } - if (player.immune) - { - if (Main.rand.Next(8) == 0) - { - if (player.whoAmI == Main.myPlayer) - { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("SkyFlareFriendly"), 750, 9f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].hostile = false; - Main.projectile[num19].friendly = true; - } - } - } - } - } - } -} \ No newline at end of file +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.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Yharon +{ + public class YharimsGift : ModItem + { + public int dragonTimer = 60; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yharim's Gift"); + Tooltip.SetDefault("The power of a god pulses from within this artifact\n" + + "Flaming meteors rain down while invincibility is active\n" + + "Exploding dragon dust is left behind as you move\n" + + "Defense increased by 30 and damage increased by 15%"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 22; + item.value = Item.buyPrice(1, 0, 0, 0); + item.accessory = true; + item.expert = true; + item.rare = 9; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.meleeDamage += 0.15f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.15f; + player.rangedDamage += 0.15f; + player.magicDamage += 0.15f; + player.minionDamage += 0.15f; + player.statDefense += 30; + if (((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1)) + { + dragonTimer--; + if (dragonTimer <= 0) + { + if (player.whoAmI == Main.myPlayer) + { + int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("DragonDust"), 350, 5f, player.whoAmI, 0f, 0f); + Main.projectile[projectile1].timeLeft = 60; + } + dragonTimer = 60; + } + } + else + { + dragonTimer = 60; + } + if (player.immune) + { + if (Main.rand.Next(8) == 0) + { + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 1; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("SkyFlareFriendly"), 750, 9f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + Main.projectile[num19].hostile = false; + Main.projectile[num19].friendly = true; + } + } + } + } + } + } +} diff --git a/Items/Yharon/YharonBag.cs b/Items/Yharon/YharonBag.cs index fc56cc9304..5105fd2fff 100644 --- a/Items/Yharon/YharonBag.cs +++ b/Items/Yharon/YharonBag.cs @@ -1,94 +1,94 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.World; - -namespace CalamityMod.Items.Yharon -{ - public class YharonBag : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Treasure Bag"); - Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - } - - public override void SetDefaults() - { - item.maxStack = 999; - item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; - item.expert = true; - bossBagNPC = mod.NPCType("Yharon"); - } - - public override bool CanRightClick() - { - return true; - } - - public override void OpenBossBag(Player player) - { - if (CalamityWorld.revenge) - { - player.QuickSpawnItem(mod.ItemType("DrewsWings")); - player.QuickSpawnItem(mod.ItemType("FoxDrive")); - if (Main.rand.Next(20) == 0) - { - switch (Main.rand.Next(3)) - { - case 0: - player.QuickSpawnItem(mod.ItemType("StressPills")); - break; - case 1: - player.QuickSpawnItem(mod.ItemType("Laudanum")); - break; - case 2: - player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); - break; - } - } - } - player.TryGettingDevArmor(); - if (Main.rand.Next(10) == 0) - { - player.QuickSpawnItem(mod.ItemType("ForgottenDragonEgg")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("AngryChickenStaff")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("DragonsBreath")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("PhoenixFlameBarrage")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("DragonRage")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("ProfanedTrident")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("TheBurningSky")); - } - if (Main.rand.Next(3) == 0) - { - player.QuickSpawnItem(mod.ItemType("ChickenCannon")); - } - if (Main.rand.Next(7) == 0) - { - player.QuickSpawnItem(mod.ItemType("YharonMask")); - } - player.QuickSpawnItem(mod.ItemType("YharimsGift")); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.World; + +namespace CalamityMod.Items.Yharon +{ + public class YharonBag : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = 9; + item.expert = true; + bossBagNPC = mod.NPCType("Yharon"); + } + + public override bool CanRightClick() + { + return true; + } + + public override void OpenBossBag(Player player) + { + if (CalamityWorld.revenge) + { + player.QuickSpawnItem(mod.ItemType("DrewsWings")); + player.QuickSpawnItem(mod.ItemType("FoxDrive")); + if (Main.rand.Next(20) == 0) + { + switch (Main.rand.Next(3)) + { + case 0: + player.QuickSpawnItem(mod.ItemType("StressPills")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("Laudanum")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("HeartofDarkness")); + break; + } + } + } + player.TryGettingDevArmor(); + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(mod.ItemType("ForgottenDragonEgg")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("AngryChickenStaff")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("DragonsBreath")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("PhoenixFlameBarrage")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("DragonRage")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("ProfanedTrident")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("TheBurningSky")); + } + if (Main.rand.Next(3) == 0) + { + player.QuickSpawnItem(mod.ItemType("ChickenCannon")); + } + if (Main.rand.Next(7) == 0) + { + player.QuickSpawnItem(mod.ItemType("YharonMask")); + } + player.QuickSpawnItem(mod.ItemType("YharimsGift")); + } + } +} diff --git a/Items/ZenPotion.cs b/Items/ZenPotion.cs index 4cbe04e228..895412b2f5 100644 --- a/Items/ZenPotion.cs +++ b/Items/ZenPotion.cs @@ -1,50 +1,50 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class ZenPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Zen Potion"); - Tooltip.SetDefault("Reduces spawn rates...a lot..."); - } - - 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("Zen"); - item.buffTime = 36000; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofEleum", 3); - recipe.AddIngredient(null, "EbonianGel", 2); - recipe.AddIngredient(ItemID.PinkGel); - recipe.AddIngredient(ItemID.BottledWater); - 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(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class ZenPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Zen Potion"); + Tooltip.SetDefault("Reduces spawn rates...a lot..."); + } + + 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("Zen"); + item.buffTime = 36000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofEleum", 3); + recipe.AddIngredient(null, "EbonianGel", 2); + recipe.AddIngredient(ItemID.PinkGel); + recipe.AddIngredient(ItemID.BottledWater); + 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(); + } + } +} diff --git a/Items/ZergPotion.cs b/Items/ZergPotion.cs index 4cf7939869..15347c8fd0 100644 --- a/Items/ZergPotion.cs +++ b/Items/ZergPotion.cs @@ -1,50 +1,50 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class ZergPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Zerg Potion"); - Tooltip.SetDefault("Boosts spawn rates...a lot..."); - } - - 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("Zerg"); - item.buffTime = 36000; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "EssenceofChaos", 3); - recipe.AddIngredient(null, "MurkySludge", 2); - recipe.AddIngredient(null, "DemonicBoneAsh"); - recipe.AddIngredient(ItemID.BottledWater); - 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(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class ZergPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Zerg Potion"); + Tooltip.SetDefault("Boosts spawn rates...a lot..."); + } + + 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("Zerg"); + item.buffTime = 36000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "EssenceofChaos", 3); + recipe.AddIngredient(null, "MurkySludge", 2); + recipe.AddIngredient(null, "DemonicBoneAsh"); + recipe.AddIngredient(ItemID.BottledWater); + 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(); + } + } +} diff --git a/MiscImplementation/BezierCurve.cs b/MiscImplementation/BezierCurve.cs index 33b1f73bb6..313d2a817e 100644 --- a/MiscImplementation/BezierCurve.cs +++ b/MiscImplementation/BezierCurve.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Microsoft.Xna.Framework; - -namespace CalamityMod.MiscImplementation -{ - public class BezierCurve - { - public Vector2[] ControlPoints; - - public BezierCurve(params Vector2[] controls) - { - ControlPoints = controls; - } - - public Vector2 Evaluate(float T) - { - if (T < 0f) T = 0f; - if (T > 1f) T = 1f; - - return PrivateEvaluate(ControlPoints, T); - } - - public List GetPoints(int amount) - { - float perStep = 1f / amount; - - List points = new List(); - - for (float step = 0f; step <= 1f; step += perStep) - { - points.Add(Evaluate(step)); - } - - return points; - } - - private Vector2 PrivateEvaluate(Vector2[] points, float T) - { - if (points.Length > 2) - { - Vector2[] nextPoints = new Vector2[points.Length - 1]; - for (int k = 0; k < points.Length - 1; k++) - { - nextPoints[k] = Vector2.Lerp(points[k], points[k + 1], T); - } - return PrivateEvaluate(nextPoints, T); - } - else - { - return Vector2.Lerp(points[0], points[1], T); - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.Xna.Framework; + +namespace CalamityMod.MiscImplementation +{ + public class BezierCurve + { + public Vector2[] ControlPoints; + + public BezierCurve(params Vector2[] controls) + { + ControlPoints = controls; + } + + public Vector2 Evaluate(float T) + { + if (T < 0f) T = 0f; + if (T > 1f) T = 1f; + + return PrivateEvaluate(ControlPoints, T); + } + + public List GetPoints(int amount) + { + float perStep = 1f / amount; + + List points = new List(); + + for (float step = 0f; step <= 1f; step += perStep) + { + points.Add(Evaluate(step)); + } + + return points; + } + + private Vector2 PrivateEvaluate(Vector2[] points, float T) + { + if (points.Length > 2) + { + Vector2[] nextPoints = new Vector2[points.Length - 1]; + for (int k = 0; k < points.Length - 1; k++) + { + nextPoints[k] = Vector2.Lerp(points[k], points[k + 1], T); + } + return PrivateEvaluate(nextPoints, T); + } + else + { + return Vector2.Lerp(points[0], points[1], T); + } + } + } +} diff --git a/MiscImplementation/Circle.cs b/MiscImplementation/Circle.cs index 3133d8102b..a029ffa93a 100644 --- a/MiscImplementation/Circle.cs +++ b/MiscImplementation/Circle.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Terraria; -using Microsoft.Xna.Framework; - -namespace CalamityMod.MiscImplementation -{ - public class Circle - { - public float Radius; - public Vector2 Center; - - public Circle(Vector2 center, float radius) - { - this.Center = center; - this.Radius = radius; - } - - private Vector2 RandomPointUnitCircle() - { - double r = Math.Sqrt(Main.rand.NextDouble()); - double t = Main.rand.NextDouble() * MathHelper.TwoPi; - return new Vector2((float)(r * Math.Cos(t)), (float)(r * Math.Sin(t))); - } - - public Vector2 RandomPointInCircle() - { - return Center + RandomPointUnitCircle() * Radius; - } - - public Vector2 RandomPointOnCircleEdge() - { - Vector2 v = RandomPointUnitCircle(); - //Normalise so point is on edge of unit circle - v.Normalize(); - return Center + v * Radius; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Terraria; +using Microsoft.Xna.Framework; + +namespace CalamityMod.MiscImplementation +{ + public class Circle + { + public float Radius; + public Vector2 Center; + + public Circle(Vector2 center, float radius) + { + this.Center = center; + this.Radius = radius; + } + + private Vector2 RandomPointUnitCircle() + { + double r = Math.Sqrt(Main.rand.NextDouble()); + double t = Main.rand.NextDouble() * MathHelper.TwoPi; + return new Vector2((float)(r * Math.Cos(t)), (float)(r * Math.Sin(t))); + } + + public Vector2 RandomPointInCircle() + { + return Center + RandomPointUnitCircle() * Radius; + } + + public Vector2 RandomPointOnCircleEdge() + { + Vector2 v = RandomPointUnitCircle(); + //Normalise so point is on edge of unit circle + v.Normalize(); + return Center + v * Radius; + } + } +} diff --git a/ModSupport.cs b/ModSupport.cs index ed2de15316..6d1a4ef628 100644 --- a/ModSupport.cs +++ b/ModSupport.cs @@ -1,91 +1,91 @@ -using System; -using System.Reflection; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Input; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; - -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -using CalamityMod.World; - -namespace CalamityMod -{ - public class ModSupport - { - public static object Call(params object[] args) - { - if (args.Length <= 0 || !(args[0] is string)) return new Exception("CalamityMod Error: NO METHOD NAME! First param MUST be a method name!"); - string methodName = (string)args[0]; - if (methodName.Equals("Downed")) //returns a Func which will return a downed value based on name. - { - Func downed = (name) => - { - name = name.ToLower(); - switch (name) - { - default: return false; - case "desertscourge": return CalamityWorld.downedDesertScourge; - case "crabulon": return CalamityWorld.downedCrabulon; - case "hivemind": return CalamityWorld.downedHiveMind; - case "perforator": - case "perforators": return CalamityWorld.downedPerforator; - case "slimegod": return CalamityWorld.downedSlimeGod; - case "cryogen": return CalamityWorld.downedCryogen; - case "brimstoneelemental": return CalamityWorld.downedBrimstoneElemental; - case "calamitas": return CalamityWorld.downedCalamitas; - case "leviathan": return CalamityWorld.downedLeviathan; - case "astrumdeus": return CalamityWorld.downedStarGod; - case "plaguebringer": return CalamityWorld.downedPlaguebringer; - case "ravager": return CalamityWorld.downedScavenger; - case "guardians": return CalamityWorld.downedGuardians; - case "providence": return CalamityWorld.downedProvidence; - case "polterghast": return CalamityWorld.downedPolterghast; - case "sentinelany": return (CalamityWorld.downedSentinel1 || CalamityWorld.downedSentinel2 || CalamityWorld.downedSentinel3); - case "sentinelall": return (CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3); - case "sentinel1": return CalamityWorld.downedSentinel1; - case "sentinel2": return CalamityWorld.downedSentinel2; - case "sentinel3": return CalamityWorld.downedSentinel3; - case "devourerofgods": return CalamityWorld.downedDoG; - case "bumblebirb": return CalamityWorld.downedBumble; - case "yharon": return CalamityWorld.downedYharon; - case "supremecalamitas": return CalamityWorld.downedSCal; - } - }; - return downed; - } - else if (methodName.Equals("InZone")) //returns a Func which will return a zone value based on player and name. - { - Func inZone = (p, name) => { return ModSupport.InZone(p, name); }; - return inZone; - } - /*else if (methodName.StartsWith("Set") || methodName.StartsWith("Get")) - { - CalamityPlayer player = Main.player[(int)args[1]].GetModPlayer(mod); - if (methodName.Equals("SetRogueBoost")) { player.rogueBoost = (float)args[2]; } - else if (methodName.Equals("GetrogueBoost")) { return player.rogueBoost; } - else if (methodName.Equals("SetrogueCrit")) { player.rogueCrit = (int)args[2]; } - else if (methodName.Equals("GetrogueCrit")) { return player.rogueCrit; } - return null; - }*/ - return new Exception("CalamityMod Error: NO METHOD FOUND: " + methodName); - } - - public static bool InZone(Player p, string zoneName) - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - zoneName = zoneName.ToLower(); - switch (zoneName) - { - case "calamity": return p.GetModPlayer(calamity).ZoneCalamity; - case "astral": return p.GetModPlayer(calamity).ZoneAstral; - } - return false; - } - } -} \ No newline at end of file +using System; +using System.Reflection; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +using CalamityMod.World; + +namespace CalamityMod +{ + public class ModSupport + { + public static object Call(params object[] args) + { + if (args.Length <= 0 || !(args[0] is string)) return new Exception("CalamityMod Error: NO METHOD NAME! First param MUST be a method name!"); + string methodName = (string)args[0]; + if (methodName.Equals("Downed")) //returns a Func which will return a downed value based on name. + { + Func downed = (name) => + { + name = name.ToLower(); + switch (name) + { + default: return false; + case "desertscourge": return CalamityWorld.downedDesertScourge; + case "crabulon": return CalamityWorld.downedCrabulon; + case "hivemind": return CalamityWorld.downedHiveMind; + case "perforator": + case "perforators": return CalamityWorld.downedPerforator; + case "slimegod": return CalamityWorld.downedSlimeGod; + case "cryogen": return CalamityWorld.downedCryogen; + case "brimstoneelemental": return CalamityWorld.downedBrimstoneElemental; + case "calamitas": return CalamityWorld.downedCalamitas; + case "leviathan": return CalamityWorld.downedLeviathan; + case "astrumdeus": return CalamityWorld.downedStarGod; + case "plaguebringer": return CalamityWorld.downedPlaguebringer; + case "ravager": return CalamityWorld.downedScavenger; + case "guardians": return CalamityWorld.downedGuardians; + case "providence": return CalamityWorld.downedProvidence; + case "polterghast": return CalamityWorld.downedPolterghast; + case "sentinelany": return (CalamityWorld.downedSentinel1 || CalamityWorld.downedSentinel2 || CalamityWorld.downedSentinel3); + case "sentinelall": return (CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3); + case "sentinel1": return CalamityWorld.downedSentinel1; + case "sentinel2": return CalamityWorld.downedSentinel2; + case "sentinel3": return CalamityWorld.downedSentinel3; + case "devourerofgods": return CalamityWorld.downedDoG; + case "bumblebirb": return CalamityWorld.downedBumble; + case "yharon": return CalamityWorld.downedYharon; + case "supremecalamitas": return CalamityWorld.downedSCal; + } + }; + return downed; + } + else if (methodName.Equals("InZone")) //returns a Func which will return a zone value based on player and name. + { + Func inZone = (p, name) => { return ModSupport.InZone(p, name); }; + return inZone; + } + /*else if (methodName.StartsWith("Set") || methodName.StartsWith("Get")) + { + CalamityPlayer player = Main.player[(int)args[1]].GetModPlayer(mod); + if (methodName.Equals("SetRogueBoost")) { player.rogueBoost = (float)args[2]; } + else if (methodName.Equals("GetrogueBoost")) { return player.rogueBoost; } + else if (methodName.Equals("SetrogueCrit")) { player.rogueCrit = (int)args[2]; } + else if (methodName.Equals("GetrogueCrit")) { return player.rogueCrit; } + return null; + }*/ + return new Exception("CalamityMod Error: NO METHOD FOUND: " + methodName); + } + + public static bool InZone(Player p, string zoneName) + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + zoneName = zoneName.ToLower(); + switch (zoneName) + { + case "calamity": return p.GetModPlayer(calamity).ZoneCalamity; + case "astral": return p.GetModPlayer(calamity).ZoneAstral; + } + return false; + } + } +} diff --git a/NPCs/AbyssNPCs/AquaticParasite.cs b/NPCs/AbyssNPCs/AquaticParasite.cs index a4aba1be04..f6f933ff62 100644 --- a/NPCs/AbyssNPCs/AquaticParasite.cs +++ b/NPCs/AbyssNPCs/AquaticParasite.cs @@ -1,245 +1,245 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class AquaticParasite : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Parasite"); - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 15; - npc.width = 28; - npc.height = 28; - npc.defense = 5; - npc.lifeMax = 30; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 30000; - } - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 0, 60); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("AquaticParasiteBanner"); - } - - public override void AI() - { - bool flag15 = false; - if (npc.wet && npc.ai[1] == 1f) - { - flag15 = true; - } - else - { - npc.dontTakeDamage = false; - } - float num262 = 1f; - if (flag15) - { - num262 += 0.5f; - } - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (flag15) - { - return; - } - if (!npc.wet) - { - npc.rotation += npc.velocity.X * 0.1f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - return; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - } - if (npc.collideY) - { - 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; - } - } - bool flag16 = false; - if (!npc.friendly) - { - npc.TargetClosest(false); - if (!Main.player[npc.target].dead) - { - flag16 = true; - } - } - if (flag16) - { - npc.localAI[2] = 1f; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - npc.velocity *= 0.975f; - float num263 = 3.2f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) - { - npc.TargetClosest(true); - float num264 = 15f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; - float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); - num267 = num264 / num267; - num265 *= num267; - num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; - return; - } - } - else - { - npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.4f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) - { - npc.ai[0] = -1f; - } - } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num268, num269 - 1] == null) - { - Main.tile[num268, num269 - 1] = new Tile(); - } - if (Main.tile[num268, num269 + 1] == null) - { - Main.tile[num268, num269 + 1] = new Tile(); - } - if (Main.tile[num268, num269 + 2] == null) - { - Main.tile[num268, num269 + 2] = new Tile(); - } - if (Main.tile[num268, num269 - 1].liquid > 128) - { - if (Main.tile[num268, num269 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num268, num269 + 2].active()) - { - npc.ai[0] = -1f; - } - } - else - { - npc.ai[0] = 1f; - } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) - { - npc.velocity.Y = npc.velocity.Y * 0.99f; - return; - } - } - } - - 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 float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water) - { - return 0.2f; - } - return 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 120, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite2"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class AquaticParasite : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Parasite"); + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 15; + npc.width = 28; + npc.height = 28; + npc.defense = 5; + npc.lifeMax = 30; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 30000; + } + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 0, 60); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("AquaticParasiteBanner"); + } + + public override void AI() + { + bool flag15 = false; + if (npc.wet && npc.ai[1] == 1f) + { + flag15 = true; + } + else + { + npc.dontTakeDamage = false; + } + float num262 = 1f; + if (flag15) + { + num262 += 0.5f; + } + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (flag15) + { + return; + } + if (!npc.wet) + { + npc.rotation += npc.velocity.X * 0.1f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + return; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + } + if (npc.collideY) + { + 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; + } + } + bool flag16 = false; + if (!npc.friendly) + { + npc.TargetClosest(false); + if (!Main.player[npc.target].dead) + { + flag16 = true; + } + } + if (flag16) + { + npc.localAI[2] = 1f; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.velocity *= 0.975f; + float num263 = 3.2f; + if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + { + npc.TargetClosest(true); + float num264 = 15f; + Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; + float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); + num267 = num264 / num267; + num265 *= num267; + num266 *= num267; + npc.velocity.X = num265; + npc.velocity.Y = num266; + return; + } + } + else + { + npc.localAI[2] = 0f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; + npc.rotation = npc.velocity.X * 0.4f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if (npc.velocity.Y < -1f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if (npc.velocity.Y > 1f) + { + npc.ai[0] = -1f; + } + } + int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num268, num269 - 1] == null) + { + Main.tile[num268, num269 - 1] = new Tile(); + } + if (Main.tile[num268, num269 + 1] == null) + { + Main.tile[num268, num269 + 1] = new Tile(); + } + if (Main.tile[num268, num269 + 2] == null) + { + Main.tile[num268, num269 + 2] = new Tile(); + } + if (Main.tile[num268, num269 - 1].liquid > 128) + { + if (Main.tile[num268, num269 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num268, num269 + 2].active()) + { + npc.ai[0] = -1f; + } + } + else + { + npc.ai[0] = 1f; + } + if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + { + npc.velocity.Y = npc.velocity.Y * 0.99f; + return; + } + } + } + + 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 float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water) + { + return 0.2f; + } + return 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 120, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite2"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/AquaticScourgeBody.cs b/NPCs/AbyssNPCs/AquaticScourgeBody.cs index 87d53fc712..7c96b4f105 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBody.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBody.cs @@ -1,399 +1,399 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class AquaticScourgeBody : ModNPC - { - public bool detectsPlayer = false; - public float speed = 5f; //10 - public float turnSpeed = 0.08f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 32; //36 - npc.height = 32; - npc.defense = 60; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; - if (CalamityWorld.death) - { - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - 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; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - npc.canGhostHeal = false; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if ((double)npc.life <= (double)npc.lifeMax * 0.99) - { - detectsPlayer = true; - npc.damage = Main.expertMode ? 104 : 65; - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - else - music = MusicID.Boss2; - } - else - { - npc.damage = 0; - } - 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("AquaticScourgeHead"))) - { - npc.active = false; - } - if (Main.netMode != 1 && detectsPlayer) - { - int num = (Main.expertMode || CalamityWorld.bossRushActive) ? 4 : 3; - npc.localAI[0] += (float)Main.rand.Next(num); - if (npc.localAI[0] >= (float)Main.rand.Next(700, 10000)) - { - npc.localAI[0] = 0f; - 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)) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 17); - 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)); - int projectileType = mod.ProjectileType("SandTooth"); - int damage = (Main.expertMode || CalamityWorld.bossRushActive) ? 26 : 37; - float num941 = 5f; - 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 (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) - { - damage /= 2; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return detectsPlayer; - } - return null; - } - - 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 HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody4"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class AquaticScourgeBody : ModNPC + { + public bool detectsPlayer = false; + public float speed = 5f; //10 + public float turnSpeed = 0.08f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 32; //36 + npc.height = 32; + npc.defense = 60; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; + if (CalamityWorld.death) + { + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + 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; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + npc.canGhostHeal = false; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if ((double)npc.life <= (double)npc.lifeMax * 0.99) + { + detectsPlayer = true; + npc.damage = Main.expertMode ? 104 : 65; + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); + else + music = MusicID.Boss2; + } + else + { + npc.damage = 0; + } + 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("AquaticScourgeHead"))) + { + npc.active = false; + } + if (Main.netMode != 1 && detectsPlayer) + { + int num = (Main.expertMode || CalamityWorld.bossRushActive) ? 4 : 3; + npc.localAI[0] += (float)Main.rand.Next(num); + if (npc.localAI[0] >= (float)Main.rand.Next(700, 10000)) + { + npc.localAI[0] = 0f; + 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)) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 17); + 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)); + int projectileType = mod.ProjectileType("SandTooth"); + int damage = (Main.expertMode || CalamityWorld.bossRushActive) ? 26 : 37; + float num941 = 5f; + 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 (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) + { + damage /= 2; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return detectsPlayer; + } + return null; + } + + 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 HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody4"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(BuffID.Venom, 180, true); + } + } +} diff --git a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs index 4597fb4483..433b7aa31c 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs @@ -1,396 +1,396 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class AquaticScourgeBodyAlt : ModNPC - { - public bool detectsPlayer = false; - public float speed = 5f; //10 - public float turnSpeed = 0.08f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 32; //36 - npc.height = 32; - npc.defense = 60; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; - if (CalamityWorld.death) - { - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - 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; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - npc.canGhostHeal = false; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if ((double)npc.life <= (double)npc.lifeMax * 0.99) - { - detectsPlayer = true; - npc.damage = Main.expertMode ? 104 : 65; - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - else - music = MusicID.Boss2; - } - else - { - npc.damage = 0; - } - 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("AquaticScourgeHead"))) - { - npc.active = false; - } - if (Main.netMode != 1 && detectsPlayer) - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.localAI[0] >= (float)Main.rand.Next(700, 10000)) - { - npc.localAI[0] = 0f; - 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)) - { - 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)); - int projectileType = mod.ProjectileType("SandBlast"); - int damage = (Main.expertMode || CalamityWorld.bossRushActive) ? 30 : 40; - float num941 = 8f; - 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 (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) - { - damage /= 2; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return detectsPlayer; - } - return null; - } - - 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 HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt3"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class AquaticScourgeBodyAlt : ModNPC + { + public bool detectsPlayer = false; + public float speed = 5f; //10 + public float turnSpeed = 0.08f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 32; //36 + npc.height = 32; + npc.defense = 60; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; + if (CalamityWorld.death) + { + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + 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; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + npc.canGhostHeal = false; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if ((double)npc.life <= (double)npc.lifeMax * 0.99) + { + detectsPlayer = true; + npc.damage = Main.expertMode ? 104 : 65; + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); + else + music = MusicID.Boss2; + } + else + { + npc.damage = 0; + } + 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("AquaticScourgeHead"))) + { + npc.active = false; + } + if (Main.netMode != 1 && detectsPlayer) + { + npc.localAI[0] += (float)Main.rand.Next(4); + if (npc.localAI[0] >= (float)Main.rand.Next(700, 10000)) + { + npc.localAI[0] = 0f; + 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)) + { + 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)); + int projectileType = mod.ProjectileType("SandBlast"); + int damage = (Main.expertMode || CalamityWorld.bossRushActive) ? 30 : 40; + float num941 = 8f; + 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 (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) + { + damage /= 2; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return detectsPlayer; + } + return null; + } + + 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 HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt3"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(BuffID.Venom, 180, true); + } + } +} diff --git a/NPCs/AbyssNPCs/AquaticScourgeHead.cs b/NPCs/AbyssNPCs/AquaticScourgeHead.cs index 0647b077f7..d6f77be383 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeHead.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeHead.cs @@ -1,650 +1,650 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - [AutoloadBossHead] - public class AquaticScourgeHead : ModNPC - { - private bool detectsPlayer = false; - private bool flies = true; - private const int minLength = 30; - private const int maxLength = 31; - private float speed = 5f; //10 - private float turnSpeed = 0.08f; //0.15 - private bool TailSpawned = false; - private bool despawning = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - } - - public override void SetDefaults() - { - npc.npcSlots = 16f; - npc.damage = 100; - npc.width = 100; //36 - npc.height = 90; //20 - npc.defense = 40; - npc.aiStyle = -1; - aiType = -1; - npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; - if (CalamityWorld.death) - { - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - 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; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 12, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - bossBag = mod.ItemType("AquaticScourgeBag"); - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(despawning); - writer.Write(detectsPlayer); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - despawning = reader.ReadBoolean(); - detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.99 || CalamityWorld.bossRushActive) - { - detectsPlayer = true; - npc.damage = Main.expertMode ? 250 : 80; - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - else - music = MusicID.Boss2; - } - else - { - npc.damage = 0; - } - npc.chaseable = detectsPlayer; - 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 (Main.netMode != 1) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - if (num36 % 2 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeBodyAlt"), npc.whoAmI); - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeTail"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - if (detectsPlayer) - { - npc.localAI[0] += 1f; - 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; - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 300f && - !Main.tile[npcPoxX, npcPoxY].active()) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - int random = Main.rand.Next(3); - Main.PlaySound(3, (int)npc.Center.X, (int)npc.Center.Y, 8); - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - if (random == 0 && NPC.CountNPCS(mod.NPCType("AquaticSeekerHead")) < 1) - { - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticSeekerHead")); - } - else if (random == 1 && NPC.CountNPCS(mod.NPCType("AquaticUrchin")) < 3) - { - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticUrchin")); - } - else if (NPC.CountNPCS(mod.NPCType("AquaticParasite")) < 8) - { - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticParasite")); - } - } - } - npc.localAI[1] += 1f; - 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; - if (!Main.tile[npcPoxX, npcPoxY].active() && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 300f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - BarfShitUp(); - } - } - } - } - bool notOcean = Main.player[npc.target].position.Y < 800f || - (double)Main.player[npc.target].position.Y > Main.worldSurface * 16.0 || - (Main.player[npc.target].position.X > 6400f && Main.player[npc.target].position.X < (float)(Main.maxTilesX * 16 - 6400)); - if (Main.player[npc.target].dead || (notOcean && !CalamityWorld.bossRushActive)) - { - despawning = true; - npc.TargetClosest(false); - 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; - } - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].aiStyle == npc.aiStyle) - { - Main.npc[a].active = false; - } - } - } - } - else - { - despawning = 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; - 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 (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool canFly = flies; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeTail"))) - { - npc.active = 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 + (notOcean ? 800 : 400)); //800 - if (!detectsPlayer) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < (notOcean ? 500f : 400f)) //500 - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + (notOcean ? 600f : 480f); //600 - } - else - { - num191 = Main.player[npc.target].Center.X - (notOcean ? 600f : 480f); //600 - } - } - } - } - if (detectsPlayer) - { - num188 = 8f; - num189 = 0.12f; - if (!Main.player[npc.target].wet) - { - num188 = 13f; - num189 = 0.16f; - } - if (notOcean) - { - num188 = 15f; - num189 = 0.18f; - } - if (Main.player[npc.target].gravDir == -1f) - { - num188 = 20f; - num189 = 0.2f; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (!detectsPlayer) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) //400 - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; //- - num192 -= vector3.Y; //- - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) //60 - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - public void BarfShitUp() - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 13); - if (Main.netMode != 1) - { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; - int damageBoom = (Main.expertMode || CalamityWorld.bossRushActive) ? 28 : 33; - for (iBoom = 0; iBoom < 15; iBoom++) - { - int projectileType = (Main.rand.Next(2) == 0 ? mod.ProjectileType("SandTooth") : mod.ProjectileType("SandBlast")); - if (projectileType == mod.ProjectileType("SandTooth")) - { - damageBoom = Main.expertMode ? 24 : 30; - } - offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6.5f), (float)(Math.Cos(offsetAngleBoom) * 6.5f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6.5f), (float)(-Math.Cos(offsetAngleBoom) * 6.5f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - } - damageBoom = Main.expertMode ? 31 : 36; - int num320 = Main.rand.Next(5, 9); - int num3; - for (int num321 = 0; num321 < num320; num321 = num3 + 1) - { - Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("SandPoisonCloud"), damageBoom, 0f, Main.myPlayer, 0f, (float)Main.rand.Next(-45, 1)); - num3 = num321; - } - } - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) - { - damage /= 2; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return detectsPlayer; - } - return null; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water) - { - if (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) - return 0.01f; - } - return 0f; - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = mod.ItemType("SulphurousSand"); - } - - 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 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); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASHead"), 1f); - } - } - - public override bool CheckActive() - { - if (detectsPlayer && !Main.player[npc.target].dead && !despawning) - { - return false; - } - if (npc.timeLeft <= 0 && Main.netMode != 1) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == 2) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 360, true); - player.AddBuff(BuffID.Venom, 360, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + [AutoloadBossHead] + public class AquaticScourgeHead : ModNPC + { + private bool detectsPlayer = false; + private bool flies = true; + private const int minLength = 30; + private const int maxLength = 31; + private float speed = 5f; //10 + private float turnSpeed = 0.08f; //0.15 + private bool TailSpawned = false; + private bool despawning = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Scourge"); + } + + public override void SetDefaults() + { + npc.npcSlots = 16f; + npc.damage = 100; + npc.width = 100; //36 + npc.height = 90; //20 + npc.defense = 40; + npc.aiStyle = -1; + aiType = -1; + npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; + if (CalamityWorld.death) + { + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + 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; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 12, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + bossBag = mod.ItemType("AquaticScourgeBag"); + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(despawning); + writer.Write(detectsPlayer); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + despawning = reader.ReadBoolean(); + detectsPlayer = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.99 || CalamityWorld.bossRushActive) + { + detectsPlayer = true; + npc.damage = Main.expertMode ? 250 : 80; + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); + else + music = MusicID.Boss2; + } + else + { + npc.damage = 0; + } + npc.chaseable = detectsPlayer; + 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 (Main.netMode != 1) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + if (num36 % 2 == 0) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeBodyAlt"), npc.whoAmI); + } + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticScourgeTail"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + if (detectsPlayer) + { + npc.localAI[0] += 1f; + 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; + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 300f && + !Main.tile[npcPoxX, npcPoxY].active()) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + int random = Main.rand.Next(3); + Main.PlaySound(3, (int)npc.Center.X, (int)npc.Center.Y, 8); + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + if (random == 0 && NPC.CountNPCS(mod.NPCType("AquaticSeekerHead")) < 1) + { + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticSeekerHead")); + } + else if (random == 1 && NPC.CountNPCS(mod.NPCType("AquaticUrchin")) < 3) + { + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticUrchin")); + } + else if (NPC.CountNPCS(mod.NPCType("AquaticParasite")) < 8) + { + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("AquaticParasite")); + } + } + } + npc.localAI[1] += 1f; + 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; + if (!Main.tile[npcPoxX, npcPoxY].active() && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 300f) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + BarfShitUp(); + } + } + } + } + bool notOcean = Main.player[npc.target].position.Y < 800f || + (double)Main.player[npc.target].position.Y > Main.worldSurface * 16.0 || + (Main.player[npc.target].position.X > 6400f && Main.player[npc.target].position.X < (float)(Main.maxTilesX * 16 - 6400)); + if (Main.player[npc.target].dead || (notOcean && !CalamityWorld.bossRushActive)) + { + despawning = true; + npc.TargetClosest(false); + 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; + } + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].aiStyle == npc.aiStyle) + { + Main.npc[a].active = false; + } + } + } + } + else + { + despawning = 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; + 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 (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool canFly = flies; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeTail"))) + { + npc.active = 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 + (notOcean ? 800 : 400)); //800 + if (!detectsPlayer) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < (notOcean ? 500f : 400f)) //500 + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + (notOcean ? 600f : 480f); //600 + } + else + { + num191 = Main.player[npc.target].Center.X - (notOcean ? 600f : 480f); //600 + } + } + } + } + if (detectsPlayer) + { + num188 = 8f; + num189 = 0.12f; + if (!Main.player[npc.target].wet) + { + num188 = 13f; + num189 = 0.16f; + } + if (notOcean) + { + num188 = 15f; + num189 = 0.18f; + } + if (Main.player[npc.target].gravDir == -1f) + { + num188 = 20f; + num189 = 0.2f; + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (!detectsPlayer) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) //400 + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; //- + num192 -= vector3.Y; //- + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) //60 + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + public void BarfShitUp() + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 13); + if (Main.netMode != 1) + { + Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + int damageBoom = (Main.expertMode || CalamityWorld.bossRushActive) ? 28 : 33; + for (iBoom = 0; iBoom < 15; iBoom++) + { + int projectileType = (Main.rand.Next(2) == 0 ? mod.ProjectileType("SandTooth") : mod.ProjectileType("SandBlast")); + if (projectileType == mod.ProjectileType("SandTooth")) + { + damageBoom = Main.expertMode ? 24 : 30; + } + offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; + int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6.5f), (float)(Math.Cos(offsetAngleBoom) * 6.5f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6.5f), (float)(-Math.Cos(offsetAngleBoom) * 6.5f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + damageBoom = Main.expertMode ? 31 : 36; + int num320 = Main.rand.Next(5, 9); + int num3; + for (int num321 = 0; num321 < num320; num321 = num3 + 1) + { + Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector15.Normalize(); + vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("SandPoisonCloud"), damageBoom, 0f, Main.myPlayer, 0f, (float)Main.rand.Next(-45, 1)); + num3 = num321; + } + } + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) + { + damage /= 2; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return detectsPlayer; + } + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water) + { + if (!NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) + return 0.01f; + } + return 0f; + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = mod.ItemType("SulphurousSand"); + } + + 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 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); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASHead"), 1f); + } + } + + public override bool CheckActive() + { + if (detectsPlayer && !Main.player[npc.target].dead && !despawning) + { + return false; + } + if (npc.timeLeft <= 0 && Main.netMode != 1) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == 2) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 360, true); + player.AddBuff(BuffID.Venom, 360, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + } + } +} diff --git a/NPCs/AbyssNPCs/AquaticScourgeTail.cs b/NPCs/AbyssNPCs/AquaticScourgeTail.cs index 2c34798c6f..c30ae5bf40 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeTail.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeTail.cs @@ -1,367 +1,367 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class AquaticScourgeTail : ModNPC - { - public bool detectsPlayer = false; - public float speed = 5f; //10 - public float turnSpeed = 0.08f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 30; //28 - npc.height = 50; //28 - npc.defense = 90; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; - if (CalamityWorld.death) - { - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - 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; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - npc.canGhostHeal = false; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if ((double)npc.life <= (double)npc.lifeMax * 0.99) - { - detectsPlayer = true; - npc.damage = Main.expertMode ? 80 : 50; - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - else - music = MusicID.Boss2; - } - else - { - npc.damage = 0; - } - 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("AquaticScourgeHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if ((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) - { - damage /= 2; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return detectsPlayer; - } - return null; - } - - 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 HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail2"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class AquaticScourgeTail : ModNPC + { + public bool detectsPlayer = false; + public float speed = 5f; //10 + public float turnSpeed = 0.08f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 30; //28 + npc.height = 50; //28 + npc.defense = 90; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; + if (CalamityWorld.death) + { + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + 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; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + npc.canGhostHeal = false; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if ((double)npc.life <= (double)npc.lifeMax * 0.99) + { + detectsPlayer = true; + npc.damage = Main.expertMode ? 80 : 50; + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); + else + music = MusicID.Boss2; + } + else + { + npc.damage = 0; + } + 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("AquaticScourgeHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.type == ProjectileID.HallowStar || projectile.type == ProjectileID.CrystalShard) && projectile.ranged) + { + damage /= 2; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return detectsPlayer; + } + return null; + } + + 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 HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail2"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 120, true); + player.AddBuff(BuffID.Venom, 120, true); + } + } +} diff --git a/NPCs/AbyssNPCs/AquaticSeekerBody.cs b/NPCs/AbyssNPCs/AquaticSeekerBody.cs index 2c45a140c0..6e652ffde1 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerBody.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerBody.cs @@ -1,301 +1,301 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class AquaticSeekerBody : ModNPC - { - public float speed = 6f; //10 - public float turnSpeed = 0.1f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Seeker"); - } - - public override void SetDefaults() - { - npc.damage = 15; //70 - npc.width = 16; //28 - npc.height = 16; //28 - npc.defense = 10; - npc.lifeMax = 60; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 60000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - banner = mod.NPCType("AquaticSeekerHead"); - bannerItem = mod.ItemType("AquaticSeekerBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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("AquaticSeekerHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerBody"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class AquaticSeekerBody : ModNPC + { + public float speed = 6f; //10 + public float turnSpeed = 0.1f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Seeker"); + } + + public override void SetDefaults() + { + npc.damage = 15; //70 + npc.width = 16; //28 + npc.height = 16; //28 + npc.defense = 10; + npc.lifeMax = 60; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 60000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + banner = mod.NPCType("AquaticSeekerHead"); + bannerItem = mod.ItemType("AquaticSeekerBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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("AquaticSeekerHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerBody"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/AquaticSeekerHead.cs b/NPCs/AbyssNPCs/AquaticSeekerHead.cs index 0df5599b46..19ea6d0c71 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerHead.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerHead.cs @@ -1,436 +1,436 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class AquaticSeekerHead : ModNPC - { - public bool flies = true; - public const int minLength = 3; - public const int maxLength = 4; - public float speed = 6f; //10 - public float turnSpeed = 0.1f; //0.15 - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Seeker"); - } - - public override void SetDefaults() - { - npc.damage = 20; - npc.width = 22; //36 - npc.height = 28; //20 - npc.defense = 5; - npc.lifeMax = 60; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 60000; - } - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - banner = npc.type; - bannerItem = mod.ItemType("AquaticSeekerBanner"); - } - - public override void AI() - { - 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 (Main.netMode != 1) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticSeekerBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticSeekerTail"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - } - 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 (npc.velocity.X < 0f) - { - npc.spriteDirection = 1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = -1; - } - npc.localAI[1] = 0f; - bool canFly = flies; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(mod.NPCType("AquaticSeekerTail"))) - { - npc.active = 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 200); //800 - if ((Main.player[npc.target].Center - npc.Center).Length() > 200f) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 300f; - } - else - { - num191 = Main.player[npc.target].Center.X - 300f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if ((Main.player[npc.target].Center - npc.Center).Length() > 200f) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water) - { - if (!NPC.AnyNPCs(mod.NPCType("AquaticSeekerHead"))) - return 0.01f; - } - return 0f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerHead"), 1f); - } - } - - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != 1) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == 2) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 60); - } - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class AquaticSeekerHead : ModNPC + { + public bool flies = true; + public const int minLength = 3; + public const int maxLength = 4; + public float speed = 6f; //10 + public float turnSpeed = 0.1f; //0.15 + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Seeker"); + } + + public override void SetDefaults() + { + npc.damage = 20; + npc.width = 22; //36 + npc.height = 28; //20 + npc.defense = 5; + npc.lifeMax = 60; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 60000; + } + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + banner = npc.type; + bannerItem = mod.ItemType("AquaticSeekerBanner"); + } + + public override void AI() + { + 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 (Main.netMode != 1) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticSeekerBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticSeekerTail"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + 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 (npc.velocity.X < 0f) + { + npc.spriteDirection = 1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = -1; + } + npc.localAI[1] = 0f; + bool canFly = flies; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(mod.NPCType("AquaticSeekerTail"))) + { + npc.active = 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 200); //800 + if ((Main.player[npc.target].Center - npc.Center).Length() > 200f) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 300f; + } + else + { + num191 = Main.player[npc.target].Center.X - 300f; + } + } + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if ((Main.player[npc.target].Center - npc.Center).Length() > 200f) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water) + { + if (!NPC.AnyNPCs(mod.NPCType("AquaticSeekerHead"))) + return 0.01f; + } + return 0f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerHead"), 1f); + } + } + + public override bool CheckActive() + { + if (npc.timeLeft <= 0 && Main.netMode != 1) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == 2) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 120, true); + player.AddBuff(BuffID.Venom, 120, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 60); + } + } + } +} diff --git a/NPCs/AbyssNPCs/AquaticSeekerTail.cs b/NPCs/AbyssNPCs/AquaticSeekerTail.cs index 5fee71bc67..bfa1fd55ed 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerTail.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerTail.cs @@ -1,301 +1,301 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class AquaticSeekerTail : ModNPC - { - public float speed = 6f; //10 - public float turnSpeed = 0.1f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Seeker"); - } - - public override void SetDefaults() - { - npc.damage = 5; //70 - npc.width = 16; //28 - npc.height = 22; //28 - npc.defense = 20; - npc.lifeMax = 60; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 60000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - banner = mod.NPCType("AquaticSeekerHead"); - bannerItem = mod.ItemType("AquaticSeekerBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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("AquaticSeekerHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerTail"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class AquaticSeekerTail : ModNPC + { + public float speed = 6f; //10 + public float turnSpeed = 0.1f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Seeker"); + } + + public override void SetDefaults() + { + npc.damage = 5; //70 + npc.width = 16; //28 + npc.height = 22; //28 + npc.defense = 20; + npc.lifeMax = 60; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 60000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + banner = mod.NPCType("AquaticSeekerHead"); + bannerItem = mod.ItemType("AquaticSeekerBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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("AquaticSeekerHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerTail"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/AquaticUrchin.cs b/NPCs/AbyssNPCs/AquaticUrchin.cs index 11d8cb21f2..2dfcd80476 100644 --- a/NPCs/AbyssNPCs/AquaticUrchin.cs +++ b/NPCs/AbyssNPCs/AquaticUrchin.cs @@ -1,369 +1,369 @@ -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; -using CalamityMod; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class AquaticUrchin : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Urchin"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 25; - npc.width = 40; //324 - npc.height = 40; //216 - npc.defense = 10; - npc.lifeMax = 50; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } - npc.knockBackResist = 0.8f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath15; - npc.behindTiles = true; - banner = npc.type; - bannerItem = mod.ItemType("AquaticUrchinBanner"); - } - - public override void AI() - { - int num = 30; - int num2 = 10; - bool flag = false; - bool flag2 = false; - bool flag3 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag2 = true; - npc.ai[3] += 1f; - } - num2 = 4; - bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - } - } - if (flag4) - { - npc.velocity.Y = 0f; - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) - { - npc.ai[3] += 1f; - flag3 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num * num2)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num) - { - npc.netUpdate = true; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num4 = Main.player[npc.target].position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - if (num5 < 200f && !flag3) - { - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - (npc.wet ? 24f : 8f); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default(Color), 1f); - } - } - if (npc.ai[3] < (float)num) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num7 = 6f; - float num8 = 0.07f; - if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) - { - if (Math.Sign(npc.velocity.X) != npc.direction) - { - npc.velocity.X = npc.velocity.X * 0.92f; - } - num7 = 9f; - num8 = 0.4f; - if (npc.velocity.X < -num7 || npc.velocity.X > num7) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num7 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X > num7) - { - npc.velocity.X = num7; - } - } - else if (npc.velocity.X > -num7 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X < -num7) - { - npc.velocity.X = -num7; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num10 = 0; - if (npc.velocity.X < 0f) - { - num10 = -1; - } - if (npc.velocity.X > 0f) - { - num10 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); - int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num11, num12] == null) - { - Main.tile[num11, num12] = new Tile(); - } - if (Main.tile[num11, num12 - 1] == null) - { - Main.tile[num11, num12 - 1] = new Tile(); - } - if (Main.tile[num11, num12 - 2] == null) - { - Main.tile[num11, num12 - 2] = new Tile(); - } - if (Main.tile[num11, num12 - 3] == null) - { - Main.tile[num11, num12 - 3] = new Tile(); - } - if (Main.tile[num11, num12 + 1] == null) - { - Main.tile[num11, num12 + 1] = new Tile(); - } - if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) - { - float num13 = (float)(num12 * 16); - if (Main.tile[num11, num12].halfBrick()) - { - num13 += 8f; - } - if (Main.tile[num11, num12 - 1].halfBrick()) - { - num13 -= 8f; - } - if (num13 < position.Y + (float)npc.height) - { - float num14 = position.Y + (float)npc.height - num13; - if ((double)num14 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num13; - npc.position.Y = num13 - (float)npc.height; - if (num14 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num15, num16] == null) - { - Main.tile[num15, num16] = new Tile(); - } - if (Main.tile[num15, num16 - 1] == null) - { - Main.tile[num15, num16 - 1] = new Tile(); - } - if (Main.tile[num15, num16 - 2] == null) - { - Main.tile[num15, num16 - 2] = new Tile(); - } - if (Main.tile[num15, num16 - 3] == null) - { - Main.tile[num15, num16 - 3] = new Tile(); - } - if (Main.tile[num15, num16 + 1] == null) - { - Main.tile[num15, num16 + 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 - 1] == null) - { - Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 + 1] == null) - { - Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); - } - if (Main.tile[num15 - npc.direction, num16 + 1] == null) - { - Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); - } - int num17 = npc.spriteDirection; - num17 *= -1; - if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) - { - float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) - { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) - { - npc.velocity.Y = (npc.wet ? -34f : -12.5f); - npc.netUpdate = true; - } - else - { - npc.velocity.Y = (npc.wet ? -30f : -11.5f); - npc.netUpdate = true; - } - } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) - { - npc.velocity.Y = (npc.wet ? -28f : -11f); - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) - { - npc.velocity.Y = (npc.wet ? -24f : -9f); - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) - { - npc.velocity.Y = (npc.wet ? -32f : -12f); - npc.netUpdate = true; - } - } - } - npc.rotation += npc.velocity.X * 0.05f; - npc.spriteDirection = -npc.direction; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 120, true); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water && NPC.CountNPCS(mod.NPCType("AquaticUrchin")) < 2) - { - return 0.2f; - } - return 0f; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UrchinStinger"), Main.rand.Next(15, 26)); - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin3"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class AquaticUrchin : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Urchin"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 25; + npc.width = 40; //324 + npc.height = 40; //216 + npc.defense = 10; + npc.lifeMax = 50; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 50000; + } + npc.knockBackResist = 0.8f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath15; + npc.behindTiles = true; + banner = npc.type; + bannerItem = mod.ItemType("AquaticUrchinBanner"); + } + + public override void AI() + { + int num = 30; + int num2 = 10; + bool flag = false; + bool flag2 = false; + bool flag3 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag2 = true; + npc.ai[3] += 1f; + } + num2 = 4; + bool flag4 = npc.velocity.Y == 0f; + for (int i = 0; i < 200; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + } + } + if (flag4) + { + npc.velocity.Y = 0f; + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) + { + npc.ai[3] += 1f; + flag3 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num * num2)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num) + { + npc.netUpdate = true; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num4 = Main.player[npc.target].position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + if (num5 < 200f && !flag3) + { + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - (npc.wet ? 24f : 8f); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default(Color), 1f); + } + } + if (npc.ai[3] < (float)num) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num7 = 6f; + float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) + { + if (Math.Sign(npc.velocity.X) != npc.direction) + { + npc.velocity.X = npc.velocity.X * 0.92f; + } + num7 = 9f; + num8 = 0.4f; + if (npc.velocity.X < -num7 || npc.velocity.X > num7) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num7 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X > num7) + { + npc.velocity.X = num7; + } + } + else if (npc.velocity.X > -num7 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X < -num7) + { + npc.velocity.X = -num7; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num10 = 0; + if (npc.velocity.X < 0f) + { + num10 = -1; + } + if (npc.velocity.X > 0f) + { + num10 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); + int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num11, num12] == null) + { + Main.tile[num11, num12] = new Tile(); + } + if (Main.tile[num11, num12 - 1] == null) + { + Main.tile[num11, num12 - 1] = new Tile(); + } + if (Main.tile[num11, num12 - 2] == null) + { + Main.tile[num11, num12 - 2] = new Tile(); + } + if (Main.tile[num11, num12 - 3] == null) + { + Main.tile[num11, num12 - 3] = new Tile(); + } + if (Main.tile[num11, num12 + 1] == null) + { + Main.tile[num11, num12 + 1] = new Tile(); + } + if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) + { + float num13 = (float)(num12 * 16); + if (Main.tile[num11, num12].halfBrick()) + { + num13 += 8f; + } + if (Main.tile[num11, num12 - 1].halfBrick()) + { + num13 -= 8f; + } + if (num13 < position.Y + (float)npc.height) + { + float num14 = position.Y + (float)npc.height - num13; + if ((double)num14 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num13; + npc.position.Y = num13 - (float)npc.height; + if (num14 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num15, num16] == null) + { + Main.tile[num15, num16] = new Tile(); + } + if (Main.tile[num15, num16 - 1] == null) + { + Main.tile[num15, num16 - 1] = new Tile(); + } + if (Main.tile[num15, num16 - 2] == null) + { + Main.tile[num15, num16 - 2] = new Tile(); + } + if (Main.tile[num15, num16 - 3] == null) + { + Main.tile[num15, num16 - 3] = new Tile(); + } + if (Main.tile[num15, num16 + 1] == null) + { + Main.tile[num15, num16 + 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 - 1] == null) + { + Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 + 1] == null) + { + Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); + } + if (Main.tile[num15 - npc.direction, num16 + 1] == null) + { + Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); + } + int num17 = npc.spriteDirection; + num17 *= -1; + if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) + { + float num18 = 3f; + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + { + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + { + npc.velocity.Y = (npc.wet ? -34f : -12.5f); + npc.netUpdate = true; + } + else + { + npc.velocity.Y = (npc.wet ? -30f : -11.5f); + npc.netUpdate = true; + } + } + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + { + npc.velocity.Y = (npc.wet ? -28f : -11f); + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + { + npc.velocity.Y = (npc.wet ? -24f : -9f); + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + { + npc.velocity.Y = (npc.wet ? -32f : -12f); + npc.netUpdate = true; + } + } + } + npc.rotation += npc.velocity.X * 0.05f; + npc.spriteDirection = -npc.direction; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 120, true); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water && NPC.CountNPCS(mod.NPCType("AquaticUrchin")) < 2) + { + return 0.2f; + } + return 0f; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UrchinStinger"), Main.rand.Next(15, 26)); + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin3"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/Bloatfish.cs b/NPCs/AbyssNPCs/Bloatfish.cs index 64f3372310..4231c91d96 100644 --- a/NPCs/AbyssNPCs/Bloatfish.cs +++ b/NPCs/AbyssNPCs/Bloatfish.cs @@ -1,229 +1,229 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class Bloatfish : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloatfish"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 5; - npc.width = 74; - npc.height = 94; - npc.defense = 100; - npc.lifeMax = 12000; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 30, 0); - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.9f; - banner = npc.type; - bannerItem = mod.ItemType("BloatfishBanner"); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - npc.TargetClosest(false); - 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; - } - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) - { - 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) - { - 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 > 3f) - { - npc.velocity.Y = 3f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - - 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 OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 900, true); - } - - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && NPC.CountNPCS(mod.NPCType("Bloatfish")) < 3) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - return 0f; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(10, 21)); - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); - } - } - } - - 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 < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - if (npc.scale < 2f) - { - npc.scale += 0.05f; - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class Bloatfish : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloatfish"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.lavaImmune = true; + npc.damage = 5; + npc.width = 74; + npc.height = 94; + npc.defense = 100; + npc.lifeMax = 12000; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 30, 0); + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.9f; + banner = npc.type; + bannerItem = mod.ItemType("BloatfishBanner"); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + npc.TargetClosest(false); + 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; + } + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) + { + 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) + { + 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 > 3f) + { + npc.velocity.Y = 3f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + + 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 OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 900, true); + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && NPC.CountNPCS(mod.NPCType("Bloatfish")) < 3) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + return 0f; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(10, 21)); + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); + } + } + } + + 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 < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + if (npc.scale < 2f) + { + npc.scale += 0.05f; + } + } + } +} diff --git a/NPCs/AbyssNPCs/BobbitWormHead.cs b/NPCs/AbyssNPCs/BobbitWormHead.cs index f940383627..cd01e63352 100644 --- a/NPCs/AbyssNPCs/BobbitWormHead.cs +++ b/NPCs/AbyssNPCs/BobbitWormHead.cs @@ -1,276 +1,276 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class BobbitWormHead : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bobbit Worm"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.damage = 150; - npc.width = 80; //324 - npc.height = 40; //216 - npc.defense = 50; - npc.lifeMax = 10000; - npc.knockBackResist = 0f; - aiType = -1; - npc.noGravity = true; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("BobbitWormBanner"); - } - - public override void AI() - { - if (CalamityGlobalNPC.bobbitWormBottom < 0 || !Main.npc[CalamityGlobalNPC.bobbitWormBottom].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.ai[0] == 0f) - { - npc.noTileCollide = true; - float num659 = 14f; - Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); - float num660 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - vector79.Y; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 11f + num659) - { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f) - { - npc.TargetClosest(true); - if (npc.Center.Y + ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || - Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 50f : 100f) > Main.player[npc.target].Center.Y && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - return; - } - npc.ai[1] = 0f; - return; - } - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - } - else if (npc.ai[0] == 1f) - { - npc.noTileCollide = true; - npc.collideX = false; - npc.collideY = false; - float num663 = 11f; - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num664 = Main.player[npc.target].Center.X - vector80.X; - float num665 = Main.player[npc.target].Center.Y - vector80.Y; - float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); - num666 = num663 / num666; - npc.velocity.X = num664 * num666; - npc.velocity.Y = num665 * num666; - npc.ai[0] = 2f; - npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)) - 1.57f; - } - else if (npc.ai[0] == 2f) - { - 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) - { - npc.noTileCollide = false; - } - 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) - { - npc.noTileCollide = false; - } - if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) - { - npc.noTileCollide = false; - } - } - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); - float num667 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - vector81.X; - float num668 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - vector81.Y; - float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); - if (num669 > 700f || npc.collideX || npc.collideY) - { - npc.noTileCollide = true; - npc.ai[0] = 0f; - return; - } - } - else if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - float num671 = 11f; - float num672 = 0.25f; - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); - float num673 = Main.player[npc.target].Center.X - vector82.X; - float num674 = Main.player[npc.target].Center.Y - vector82.Y; - float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); - num675 = num671 / num675; - num673 *= num675; - num674 *= num675; - if (npc.velocity.X < num673) - { - npc.velocity.X = npc.velocity.X + num672; - 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) - { - npc.velocity.X = npc.velocity.X - num672 * 2f; - } - } - if (npc.velocity.Y < num674) - { - npc.velocity.Y = npc.velocity.Y + num672; - 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) - { - npc.velocity.Y = npc.velocity.Y - num672 * 2f; - } - } - npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); - } - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float drawPositionX = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - center.X; - float drawPositionY = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - center.Y; - float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; - bool draw = true; - while (draw) - { - float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); - if (totalDrawDistance < 16f) - { - draw = false; - } - else - { - totalDrawDistance = 16f / totalDrawDistance; - drawPositionX *= totalDrawDistance; - drawPositionY *= totalDrawDistance; - center.X += drawPositionX; - center.Y += drawPositionY; - drawPositionX = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - center.X; - drawPositionY = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - center.Y; - drawPositionY += 4f; - Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment"), 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/AbyssNPCs/BobbitWormSegment").Width, mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Height)), color, rotation, - new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Width * 0.5f, (float)mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Height * 0.5f), 1f, SpriteEffects.None, 0f); - } - } - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(mod.BuffType("CrushDepth"), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 300); - player.AddBuff(mod.BuffType("Horror"), 120, true); - } - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); - } - } - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm4"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class BobbitWormHead : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bobbit Worm"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = -1; + npc.damage = 150; + npc.width = 80; //324 + npc.height = 40; //216 + npc.defense = 50; + npc.lifeMax = 10000; + npc.knockBackResist = 0f; + aiType = -1; + npc.noGravity = true; + npc.value = Item.buyPrice(0, 0, 50, 0); + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("BobbitWormBanner"); + } + + public override void AI() + { + if (CalamityGlobalNPC.bobbitWormBottom < 0 || !Main.npc[CalamityGlobalNPC.bobbitWormBottom].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.ai[0] == 0f) + { + npc.noTileCollide = true; + float num659 = 14f; + Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); + float num660 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - vector79.X; + float num661 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - vector79.Y; + float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + if (num662 < 11f + num659) + { + npc.rotation = 0f; + npc.velocity.X = num660; + npc.velocity.Y = num661; + npc.ai[1] += 1f; + if (npc.ai[1] >= 60f) + { + npc.TargetClosest(true); + if (npc.Center.Y + ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || + Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 50f : 100f) > Main.player[npc.target].Center.Y && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.ai[1] = 0f; + npc.ai[0] = 1f; + return; + } + npc.ai[1] = 0f; + return; + } + } + else + { + num662 = num659 / num662; + npc.velocity.X = num660 * num662; + npc.velocity.Y = num661 * num662; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + } + else if (npc.ai[0] == 1f) + { + npc.noTileCollide = true; + npc.collideX = false; + npc.collideY = false; + float num663 = 11f; + Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); + float num664 = Main.player[npc.target].Center.X - vector80.X; + float num665 = Main.player[npc.target].Center.Y - vector80.Y; + float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); + num666 = num663 / num666; + npc.velocity.X = num664 * num666; + npc.velocity.Y = num665 * num666; + npc.ai[0] = 2f; + npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)) - 1.57f; + } + else if (npc.ai[0] == 2f) + { + 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) + { + npc.noTileCollide = false; + } + 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) + { + npc.noTileCollide = false; + } + if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) + { + npc.noTileCollide = false; + } + } + Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); + float num667 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - vector81.X; + float num668 = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - vector81.Y; + float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); + if (num669 > 700f || npc.collideX || npc.collideY) + { + npc.noTileCollide = true; + npc.ai[0] = 0f; + return; + } + } + else if (npc.ai[0] == 3f) + { + npc.noTileCollide = true; + float num671 = 11f; + float num672 = 0.25f; + Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); + float num673 = Main.player[npc.target].Center.X - vector82.X; + float num674 = Main.player[npc.target].Center.Y - vector82.Y; + float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); + num675 = num671 / num675; + num673 *= num675; + num674 *= num675; + if (npc.velocity.X < num673) + { + npc.velocity.X = npc.velocity.X + num672; + 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) + { + npc.velocity.X = npc.velocity.X - num672 * 2f; + } + } + if (npc.velocity.Y < num674) + { + npc.velocity.Y = npc.velocity.Y + num672; + 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) + { + npc.velocity.Y = npc.velocity.Y - num672 * 2f; + } + } + npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); + } + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.1f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + float drawPositionX = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - center.X; + float drawPositionY = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - center.Y; + float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; + bool draw = true; + while (draw) + { + float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); + if (totalDrawDistance < 16f) + { + draw = false; + } + else + { + totalDrawDistance = 16f / totalDrawDistance; + drawPositionX *= totalDrawDistance; + drawPositionY *= totalDrawDistance; + center.X += drawPositionX; + center.Y += drawPositionY; + drawPositionX = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.X - center.X; + drawPositionY = Main.npc[CalamityGlobalNPC.bobbitWormBottom].Center.Y - center.Y; + drawPositionY += 4f; + Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment"), 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/AbyssNPCs/BobbitWormSegment").Width, mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Height)), color, rotation, + new Vector2((float)mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Width * 0.5f, (float)mod.GetTexture("NPCs/AbyssNPCs/BobbitWormSegment").Height * 0.5f), 1f, SpriteEffects.None, 0f); + } + } + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 300, true); + player.AddBuff(mod.BuffType("CrushDepth"), 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 300); + player.AddBuff(mod.BuffType("Horror"), 120, true); + } + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); + } + } + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm4"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/BobbitWormSegment.cs b/NPCs/AbyssNPCs/BobbitWormSegment.cs index 2727fbbafa..576ecc9587 100644 --- a/NPCs/AbyssNPCs/BobbitWormSegment.cs +++ b/NPCs/AbyssNPCs/BobbitWormSegment.cs @@ -1,70 +1,70 @@ -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.AbyssNPCs -{ - public class BobbitWormSegment : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bobbit Worm"); - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.damage = 0; - npc.alpha = 255; - npc.width = 26; //324 - npc.height = 26; //216 - npc.defense = 0; - npc.lifeMax = 100; - npc.knockBackResist = 0f; - aiType = -1; - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override void AI() - { - CalamityGlobalNPC.bobbitWormBottom = npc.whoAmI; - if (Main.netMode != 1) - { - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("BobbitWormHead"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - if (!NPC.AnyNPCs(mod.NPCType("BobbitWormHead"))) - { - npc.active = false; - npc.netUpdate = true; - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water) - { - if (!NPC.AnyNPCs(mod.NPCType("BobbitWormSegment"))) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - return 0f; - } - - public override bool CheckActive() - { - return false; - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class BobbitWormSegment : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bobbit Worm"); + } + + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = -1; + npc.damage = 0; + npc.alpha = 255; + npc.width = 26; //324 + npc.height = 26; //216 + npc.defense = 0; + npc.lifeMax = 100; + npc.knockBackResist = 0f; + aiType = -1; + npc.dontTakeDamage = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override void AI() + { + CalamityGlobalNPC.bobbitWormBottom = npc.whoAmI; + if (Main.netMode != 1) + { + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("BobbitWormHead"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + if (!NPC.AnyNPCs(mod.NPCType("BobbitWormHead"))) + { + npc.active = false; + npc.netUpdate = true; + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water) + { + if (!NPC.AnyNPCs(mod.NPCType("BobbitWormSegment"))) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + return 0f; + } + + public override bool CheckActive() + { + return false; + } + } +} diff --git a/NPCs/AbyssNPCs/BoxJellyfish.cs b/NPCs/AbyssNPCs/BoxJellyfish.cs index ffc6f7cd26..471975a511 100644 --- a/NPCs/AbyssNPCs/BoxJellyfish.cs +++ b/NPCs/AbyssNPCs/BoxJellyfish.cs @@ -1,215 +1,215 @@ -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.AbyssNPCs -{ - public class BoxJellyfish : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Box Jellyfish"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 22; - npc.width = 30; - npc.height = 30; - npc.defense = 5; - npc.lifeMax = 45; - npc.alpha = 20; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; - bannerItem = mod.ItemType("BoxJellyfishBanner"); - } - - public override void AI() - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (!npc.wet) - { - npc.rotation += npc.velocity.X * 0.1f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - return; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - } - if (npc.collideY) - { - 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; - } - } - bool flag16 = false; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead) - { - flag16 = true; - } - if (flag16) - { - npc.localAI[2] = 1f; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - npc.velocity *= 0.975f; - float num263 = 0.8f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) - { - npc.TargetClosest(true); - float num264 = 8f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; - float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); - num267 = num264 / num267; - num265 *= num267; - num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; - return; - } - } - else - { - npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.4f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) - { - npc.ai[0] = -1f; - } - } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num268, num269 - 1] == null) - { - Main.tile[num268, num269 - 1] = new Tile(); - } - if (Main.tile[num268, num269 + 1] == null) - { - Main.tile[num268, num269 + 1] = new Tile(); - } - if (Main.tile[num268, num269 + 2] == null) - { - Main.tile[num268, num269 + 2] = new Tile(); - } - if (Main.tile[num268, num269 - 1].liquid > 128) - { - if (Main.tile[num268, num269 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num268, num269 + 2].active()) - { - npc.ai[0] = -1f; - } - } - else - { - npc.ai[0] = 1f; - } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) - { - npc.velocity.Y = npc.velocity.Y * 0.99f; - } - } - } - - 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 float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return SpawnCondition.OceanMonster.Chance * 0.1f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 120, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 +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.AbyssNPCs +{ + public class BoxJellyfish : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Box Jellyfish"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 22; + npc.width = 30; + npc.height = 30; + npc.defense = 5; + npc.lifeMax = 45; + npc.alpha = 20; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit25; + npc.DeathSound = SoundID.NPCDeath28; + banner = npc.type; + bannerItem = mod.ItemType("BoxJellyfishBanner"); + } + + public override void AI() + { + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (!npc.wet) + { + npc.rotation += npc.velocity.X * 0.1f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + return; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + } + if (npc.collideY) + { + 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; + } + } + bool flag16 = false; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead) + { + flag16 = true; + } + if (flag16) + { + npc.localAI[2] = 1f; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.velocity *= 0.975f; + float num263 = 0.8f; + if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + { + npc.TargetClosest(true); + float num264 = 8f; + Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; + float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); + num267 = num264 / num267; + num265 *= num267; + num266 *= num267; + npc.velocity.X = num265; + npc.velocity.Y = num266; + return; + } + } + else + { + npc.localAI[2] = 0f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; + npc.rotation = npc.velocity.X * 0.4f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if (npc.velocity.Y < -1f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if (npc.velocity.Y > 1f) + { + npc.ai[0] = -1f; + } + } + int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num268, num269 - 1] == null) + { + Main.tile[num268, num269 - 1] = new Tile(); + } + if (Main.tile[num268, num269 + 1] == null) + { + Main.tile[num268, num269 + 1] = new Tile(); + } + if (Main.tile[num268, num269 + 2] == null) + { + Main.tile[num268, num269 + 2] = new Tile(); + } + if (Main.tile[num268, num269 - 1].liquid > 128) + { + if (Main.tile[num268, num269 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num268, num269 + 2].active()) + { + npc.ai[0] = -1f; + } + } + else + { + npc.ai[0] = 1f; + } + if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + { + npc.velocity.Y = npc.velocity.Y * 0.99f; + } + } + } + + 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 float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return SpawnCondition.OceanMonster.Chance * 0.1f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 120, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/Catfish.cs b/NPCs/AbyssNPCs/Catfish.cs index e37c7f0004..159c88717a 100644 --- a/NPCs/AbyssNPCs/Catfish.cs +++ b/NPCs/AbyssNPCs/Catfish.cs @@ -1,278 +1,278 @@ -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.AbyssNPCs -{ - public class Catfish : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catfish"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 30; - npc.width = 98; - npc.height = 40; - npc.defense = 12; - npc.lifeMax = 120; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath40; - npc.knockBackResist = 0.8f; - banner = npc.type; - bannerItem = mod.ItemType("CatfishBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - npc.chaseable = hasBeenHit; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - if (npc.wet) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - (Main.player[npc.target].Center - npc.Center).Length() < 200f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - flag14 = true; - } - if (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.25f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - if (npc.velocity.X > 8f) - { - npc.velocity.X = 8f; - } - if (npc.velocity.X < -8f) - { - npc.velocity.X = -8f; - } - if (npc.velocity.Y > 6f) - { - npc.velocity.Y = 6f; - } - if (npc.velocity.Y < -6f) - { - npc.velocity.Y = -6f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { - 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) - { - 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.4f; - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = 12f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - 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 OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water) - { - return 0.2f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); - } - } - - 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 < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class Catfish : ModNPC + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catfish"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 30; + npc.width = 98; + npc.height = 40; + npc.defense = 12; + npc.lifeMax = 120; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath40; + npc.knockBackResist = 0.8f; + banner = npc.type; + bannerItem = mod.ItemType("CatfishBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + npc.chaseable = hasBeenHit; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.justHit) + { + hasBeenHit = true; + } + if (npc.wet) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + (Main.player[npc.target].Center - npc.Center).Length() < 200f && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + flag14 = true; + } + if (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.25f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + if (npc.velocity.X > 8f) + { + npc.velocity.X = 8f; + } + if (npc.velocity.X < -8f) + { + npc.velocity.X = -8f; + } + if (npc.velocity.Y > 6f) + { + npc.velocity.Y = 6f; + } + if (npc.velocity.Y < -6f) + { + npc.velocity.Y = -6f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + 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) + { + 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.4f; + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = 12f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + 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 OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(BuffID.Venom, 180, true); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water) + { + return 0.2f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); + } + } + + 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 < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/ChaoticPuffer.cs b/NPCs/AbyssNPCs/ChaoticPuffer.cs index 3a3b8d3751..ce443ccf37 100644 --- a/NPCs/AbyssNPCs/ChaoticPuffer.cs +++ b/NPCs/AbyssNPCs/ChaoticPuffer.cs @@ -1,261 +1,261 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class ChaoticPuffer : ModNPC - { - public bool puffedUp = false; - public bool puffing = false; - public bool unpuffing = false; - public int puffTimer = 0; - public int puffingTimer = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaotic Puffer"); - Main.npcFrameCount[npc.type] = 11; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.lavaImmune = true; - npc.width = 78; - npc.height = 70; - npc.defense = 25; - npc.lifeMax = 7500; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 30, 0); - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; - bannerItem = mod.ItemType("ChaoticPufferBanner"); - } - - public override void AI() - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.03f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.03f; - - npc.damage = puffedUp ? (Main.expertMode ? 230 : 115) : 0; - - - if (!puffing || !unpuffing) - { - ++puffTimer; - } - - if (puffTimer >= 300) - { - - if (!puffedUp) - { - puffing = true; - } - else - { - unpuffing = true; - } - - puffTimer = 0; - - } - else if (puffing || unpuffing) - { - - ++puffingTimer; - - if (puffingTimer > 16 && puffing) - { - - puffing = false; - puffedUp = true; - puffingTimer = 0; - - } - else if (puffingTimer > 16 && unpuffing) - { - - unpuffing = false; - puffedUp = false; - puffingTimer = 0; - - } - - } - - if (npc.velocity.X >= 1 || npc.velocity.X <= -1) - { - - npc.velocity.X = npc.velocity.X * 0.97f; - - } - - if (npc.velocity.Y >= 1 || npc.velocity.Y <= -1) - { - - npc.velocity.Y = npc.velocity.Y * 0.97f; - - } - - npc.rotation += npc.velocity.X * 0.05f; - - } - - public void Boom() - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 14); - if (Main.netMode != 1 && puffedUp) - { - int damageBoom = 100; - int projectileType = mod.ProjectileType("PufferExplosion"); - int boom = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - } - npc.netUpdate = true; - } - - - 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/AbyssNPCs/ChaoticPufferGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ChaoticPufferGlow").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.Yellow); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ChaoticPufferGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - if (!unpuffing) - { - npc.frame.Y = npc.frame.Y + frameHeight; - } - else - { - npc.frame.Y = npc.frame.Y - frameHeight; - } - } - if (puffing) - { - if (npc.frame.Y < frameHeight * 3) - { - npc.frame.Y = frameHeight * 3; - } - if (npc.frame.Y > frameHeight * 6) - { - npc.frame.Y = frameHeight * 3; - } - } - else if (unpuffing) - { - if (npc.frame.Y > frameHeight * 6) - { - npc.frame.Y = frameHeight * 6; - } - if (npc.frame.Y < frameHeight * 3) - { - npc.frame.Y = frameHeight * 6; - } - } - else if (!puffedUp) - { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frame.Y < frameHeight * 7) - { - npc.frame.Y = frameHeight * 7; - } - if (npc.frame.Y > frameHeight * 10) - { - npc.frame.Y = frameHeight * 7; - } - } - - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedGolemBoss) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ChaoticOre"), Main.rand.Next(10, 27)); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - - if (puffedUp) - { - Boom(); - npc.active = false; - } - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - npc.velocity.X = projectile.velocity.X; - npc.velocity.Y = projectile.velocity.Y; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Boom(); - - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class ChaoticPuffer : ModNPC + { + public bool puffedUp = false; + public bool puffing = false; + public bool unpuffing = false; + public int puffTimer = 0; + public int puffingTimer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaotic Puffer"); + Main.npcFrameCount[npc.type] = 11; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.lavaImmune = true; + npc.width = 78; + npc.height = 70; + npc.defense = 25; + npc.lifeMax = 7500; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 30, 0); + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath28; + banner = npc.type; + bannerItem = mod.ItemType("ChaoticPufferBanner"); + } + + public override void AI() + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.03f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.03f; + + npc.damage = puffedUp ? (Main.expertMode ? 230 : 115) : 0; + + + if (!puffing || !unpuffing) + { + ++puffTimer; + } + + if (puffTimer >= 300) + { + + if (!puffedUp) + { + puffing = true; + } + else + { + unpuffing = true; + } + + puffTimer = 0; + + } + else if (puffing || unpuffing) + { + + ++puffingTimer; + + if (puffingTimer > 16 && puffing) + { + + puffing = false; + puffedUp = true; + puffingTimer = 0; + + } + else if (puffingTimer > 16 && unpuffing) + { + + unpuffing = false; + puffedUp = false; + puffingTimer = 0; + + } + + } + + if (npc.velocity.X >= 1 || npc.velocity.X <= -1) + { + + npc.velocity.X = npc.velocity.X * 0.97f; + + } + + if (npc.velocity.Y >= 1 || npc.velocity.Y <= -1) + { + + npc.velocity.Y = npc.velocity.Y * 0.97f; + + } + + npc.rotation += npc.velocity.X * 0.05f; + + } + + public void Boom() + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 14); + if (Main.netMode != 1 && puffedUp) + { + int damageBoom = 100; + int projectileType = mod.ProjectileType("PufferExplosion"); + int boom = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + npc.netUpdate = true; + } + + + 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/AbyssNPCs/ChaoticPufferGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ChaoticPufferGlow").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.Yellow); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ChaoticPufferGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + if (!unpuffing) + { + npc.frame.Y = npc.frame.Y + frameHeight; + } + else + { + npc.frame.Y = npc.frame.Y - frameHeight; + } + } + if (puffing) + { + if (npc.frame.Y < frameHeight * 3) + { + npc.frame.Y = frameHeight * 3; + } + if (npc.frame.Y > frameHeight * 6) + { + npc.frame.Y = frameHeight * 3; + } + } + else if (unpuffing) + { + if (npc.frame.Y > frameHeight * 6) + { + npc.frame.Y = frameHeight * 6; + } + if (npc.frame.Y < frameHeight * 3) + { + npc.frame.Y = frameHeight * 6; + } + } + else if (!puffedUp) + { + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frame.Y < frameHeight * 7) + { + npc.frame.Y = frameHeight * 7; + } + if (npc.frame.Y > frameHeight * 10) + { + npc.frame.Y = frameHeight * 7; + } + } + + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedGolemBoss) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ChaoticOre"), Main.rand.Next(10, 27)); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + + if (puffedUp) + { + Boom(); + npc.active = false; + } + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + npc.velocity.X = projectile.velocity.X; + npc.velocity.Y = projectile.velocity.Y; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Boom(); + + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/ColossalSquid.cs b/NPCs/AbyssNPCs/ColossalSquid.cs index d882275bff..faadc836d7 100644 --- a/NPCs/AbyssNPCs/ColossalSquid.cs +++ b/NPCs/AbyssNPCs/ColossalSquid.cs @@ -1,601 +1,601 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class ColossalSquid : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Colossal Squid"); - Main.npcFrameCount[npc.type] = 11; - } - - public override void SetDefaults() - { - npc.npcSlots = 9f; - npc.noGravity = true; - npc.damage = 150; - npc.width = 180; - npc.height = 180; - npc.defense = 50; - npc.lifeMax = 220000; - npc.aiStyle = -1; - aiType = -1; - 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.timeLeft = NPC.activeTime * 30; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit20; - npc.DeathSound = SoundID.NPCDeath23; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("ColossalSquidBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); - } - - public override void AI() - { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !Main.player[npc.target].GetModPlayer(mod).ZoneAbyss) - { - npc.active = false; - } - if (npc.localAI[1] == 1f) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 180f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - if (Main.rand.Next(300) == 0) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 34); - } - npc.noTileCollide = false; - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 1f; - } - else - { - Vector2 value29 = Main.player[npc.target].Center - npc.Center; - value29.Y -= (float)(Main.player[npc.target].height / 4); - float num1310 = value29.Length(); - if (num1310 > 800f) - { - npc.ai[0] = 2f; - } - else - { - Vector2 center26 = npc.Center; - center26.X = Main.player[npc.target].Center.X; - Vector2 vector230 = center26 - npc.Center; - if (vector230.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center26, 1, 1)) - { - npc.ai[0] = 3f; - npc.ai[1] = center26.X; - npc.ai[2] = center26.Y; - Vector2 center27 = npc.Center; - center27.Y = Main.player[npc.target].Center.Y; - if (vector230.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center27, 1, 1) && Collision.CanHit(center27, 1, 1, Main.player[npc.target].position, 1, 1)) - { - npc.ai[0] = 3f; - npc.ai[1] = center27.X; - npc.ai[2] = center27.Y; - } - } - else - { - center26 = npc.Center; - center26.Y = Main.player[npc.target].Center.Y; - if ((center26 - npc.Center).Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center26, 1, 1)) - { - npc.ai[0] = 3f; - npc.ai[1] = center26.X; - npc.ai[2] = center26.Y; - } - } - if (npc.ai[0] == 0f) - { - npc.localAI[0] = 0f; - value29.Normalize(); - value29 *= 0.5f; - npc.velocity += value29; - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - } - } - } - else if (npc.ai[0] == 1f) - { - npc.rotation += (float)npc.direction * 0.1f; - Vector2 value30 = Main.player[npc.target].Center - npc.Center; - value30 = Main.player[npc.target].Top - npc.Center; - float num1311 = value30.Length(); - float num1312 = 5.5f; - num1312 += num1311 / 100f; - int num1313 = 50; - value30.Normalize(); - value30 *= num1312; - npc.velocity = (npc.velocity * (float)(num1313 - 1) + value30) / (float)num1313; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - } - if (num1311 < 160f && Main.player[npc.target].active && !Main.player[npc.target].dead) - { - npc.Center = Main.player[npc.target].Top; - npc.velocity = Vector2.Zero; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.rotation = npc.velocity.X * 0.05f; - npc.noTileCollide = true; - Vector2 value31 = Main.player[npc.target].Center - npc.Center; - float num1315 = value31.Length(); - float scaleFactor11 = 3f; - int num1316 = 3; - value31.Normalize(); - value31 *= scaleFactor11; - npc.velocity = (npc.velocity * (float)(num1316 - 1) + value31) / (float)num1316; - if (num1315 < 600f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - npc.rotation = npc.velocity.X * 0.05f; - Vector2 value32 = new Vector2(npc.ai[1], npc.ai[2]); - Vector2 value33 = value32 - npc.Center; - float num1317 = value33.Length(); - float num1318 = 2f; - float num1319 = 3f; - value33.Normalize(); - value33 *= num1318; - npc.velocity = (npc.velocity * (num1319 - 1f) + value33) / num1319; - if (npc.collideX || npc.collideY) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - if (num1317 < num1318 || num1317 > 800f || Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 4f) - { - npc.rotation = npc.velocity.X * 0.05f; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -0.8f; - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * -0.8f; - } - Vector2 value34; - if (npc.velocity.X == 0f && npc.velocity.Y == 0f) - { - value34 = Main.player[npc.target].Center - npc.Center; - value34.Y -= (float)(Main.player[npc.target].height / 4); - value34.Normalize(); - npc.velocity = value34 * 0.1f; - } - float scaleFactor12 = 2f; - float num1320 = 20f; - value34 = npc.velocity; - value34.Normalize(); - value34 *= scaleFactor12; - npc.velocity = (npc.velocity * (num1320 - 1f) + value34) / num1320; - npc.ai[1] += 1f; - if (npc.ai[1] > 180f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - } - if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 0f; - } - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 5f && !Collision.SolidCollision(npc.position - new Vector2(10f, 10f), npc.width + 20, npc.height + 20)) - { - npc.localAI[0] = 0f; - Vector2 center28 = npc.Center; - center28.X = Main.player[npc.target].Center.X; - if (Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center28, 1, 1)) - { - npc.ai[0] = 3f; - npc.ai[1] = center28.X; - npc.ai[2] = center28.Y; - } - else - { - center28 = npc.Center; - center28.Y = Main.player[npc.target].Center.Y; - if (Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center28, 1, 1)) - { - npc.ai[0] = 3f; - npc.ai[1] = center28.X; - npc.ai[2] = center28.Y; - } - } - } - } - else if (npc.ai[0] == 5f) - { - Player player7 = Main.player[npc.target]; - if (!player7.active || player7.dead) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - else - { - npc.Center = ((player7.gravDir == 1f) ? player7.Top : player7.Bottom) + new Vector2((float)(player7.direction * 4), 0f); - npc.gfxOffY = player7.gfxOffY; - npc.velocity = Vector2.Zero; - player7.AddBuff(163, 59, true); - } - } - npc.rotation = npc.velocity.X * 0.05f; - } - else - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (!npc.noTileCollide) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - } - if (npc.collideY) - { - 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; - } - } - } - npc.TargetClosest(false); - if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || - Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 150f : 300f) * - (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) || - npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (hasBeenHit) - { - if (Main.rand.Next(300) == 0) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 34); - } - if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - 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.ai[3] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[3] == 0f) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 120f) - { - npc.ai[3] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - if (npc.ai[3] == 0f) - { - npc.noTileCollide = false; - } - else - { - npc.noTileCollide = true; - } - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 420f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.localAI[0] = 0f; - npc.localAI[1] = 1f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - npc.localAI[2] = 1f; - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 150f) - { - npc.localAI[0] = 0f; - npc.netUpdate = true; - int damage = 70; - if (Main.expertMode) - { - damage = 55; - } - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 111); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y + 60, 0f, 2f, mod.ProjectileType("InkBomb"), damage, 0f, Main.myPlayer, 0f, 0f); - } - npc.rotation = npc.velocity.X * 0.05f; - npc.velocity *= 0.975f; - float num263 = 2.5f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) - { - npc.TargetClosest(true); - float num264 = 20f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; - float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); - num267 = num264 / num267; - num265 *= num267; - num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; - return; - } - } - else - { - if (Main.rand.Next(300) == 0) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 35); - } - npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - npc.rotation = npc.velocity.X * 0.2f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) - { - npc.ai[0] = -1f; - } - } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num268, num269 - 1] == null) - { - Main.tile[num268, num269 - 1] = new Tile(); - } - if (Main.tile[num268, num269 + 1] == null) - { - Main.tile[num268, num269 + 1] = new Tile(); - } - if (Main.tile[num268, num269 + 2] == null) - { - Main.tile[num268, num269 + 2] = new Tile(); - } - if (Main.tile[num268, num269 - 1].liquid > 128) - { - if (Main.tile[num268, num269 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num268, num269 + 2].active()) - { - npc.ai[0] = -1f; - } - } - else - { - npc.ai[0] = 1f; - } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) - { - npc.velocity.Y = npc.velocity.Y * 0.99f; - return; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.ai[0] == 5f) - { - return false; - } - return true; - } - - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.ai[0] == 5f) - { - Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, - (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Player player = Main.player[npc.target]; - player.invis = true; - player.aggro = -750; - if (player.gravDir == -1f) - { - spriteEffects |= SpriteEffects.FlipVertically; - } - Main.spriteBatch.Draw(Main.npcTexture[npc.type], - new Vector2((float)(player.direction * 4), player.gfxOffY) + ((player.gravDir == 1f) ? player.Top : player.Bottom) - Main.screenPosition, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), npc.GetAlpha(color), npc.rotation, npc.frame.Size() / 2f, npc.scale, spriteEffects, 0f); - } - } - - 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 (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && - !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 600, true); - player.AddBuff(BuffID.Darkness, 600, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 300); - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlackInk, Main.rand.Next(3, 6)); - if (Main.rand.Next(10000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (CalamityWorld.downedPolterghast) - { - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamarisLament")); - } - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(26, 39)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); - } - } - } - - 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 < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid4"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class ColossalSquid : ModNPC + { + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Colossal Squid"); + Main.npcFrameCount[npc.type] = 11; + } + + public override void SetDefaults() + { + npc.npcSlots = 9f; + npc.noGravity = true; + npc.damage = 150; + npc.width = 180; + npc.height = 180; + npc.defense = 50; + npc.lifeMax = 220000; + npc.aiStyle = -1; + aiType = -1; + 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.timeLeft = NPC.activeTime * 30; + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.HitSound = SoundID.NPCHit20; + npc.DeathSound = SoundID.NPCDeath23; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("ColossalSquidBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); + writer.Write(npc.localAI[3]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); + npc.localAI[3] = reader.ReadSingle(); + } + + public override void AI() + { + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !Main.player[npc.target].GetModPlayer(mod).ZoneAbyss) + { + npc.active = false; + } + if (npc.localAI[1] == 1f) + { + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 180f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + npc.localAI[3] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + if (Main.rand.Next(300) == 0) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 34); + } + npc.noTileCollide = false; + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 1f; + } + else + { + Vector2 value29 = Main.player[npc.target].Center - npc.Center; + value29.Y -= (float)(Main.player[npc.target].height / 4); + float num1310 = value29.Length(); + if (num1310 > 800f) + { + npc.ai[0] = 2f; + } + else + { + Vector2 center26 = npc.Center; + center26.X = Main.player[npc.target].Center.X; + Vector2 vector230 = center26 - npc.Center; + if (vector230.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center26, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center26.X; + npc.ai[2] = center26.Y; + Vector2 center27 = npc.Center; + center27.Y = Main.player[npc.target].Center.Y; + if (vector230.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center27, 1, 1) && Collision.CanHit(center27, 1, 1, Main.player[npc.target].position, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center27.X; + npc.ai[2] = center27.Y; + } + } + else + { + center26 = npc.Center; + center26.Y = Main.player[npc.target].Center.Y; + if ((center26 - npc.Center).Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center26, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center26.X; + npc.ai[2] = center26.Y; + } + } + if (npc.ai[0] == 0f) + { + npc.localAI[0] = 0f; + value29.Normalize(); + value29 *= 0.5f; + npc.velocity += value29; + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + } + } + } + else if (npc.ai[0] == 1f) + { + npc.rotation += (float)npc.direction * 0.1f; + Vector2 value30 = Main.player[npc.target].Center - npc.Center; + value30 = Main.player[npc.target].Top - npc.Center; + float num1311 = value30.Length(); + float num1312 = 5.5f; + num1312 += num1311 / 100f; + int num1313 = 50; + value30.Normalize(); + value30 *= num1312; + npc.velocity = (npc.velocity * (float)(num1313 - 1) + value30) / (float)num1313; + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + } + if (num1311 < 160f && Main.player[npc.target].active && !Main.player[npc.target].dead) + { + npc.Center = Main.player[npc.target].Top; + npc.velocity = Vector2.Zero; + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.rotation = npc.velocity.X * 0.05f; + npc.noTileCollide = true; + Vector2 value31 = Main.player[npc.target].Center - npc.Center; + float num1315 = value31.Length(); + float scaleFactor11 = 3f; + int num1316 = 3; + value31.Normalize(); + value31 *= scaleFactor11; + npc.velocity = (npc.velocity * (float)(num1316 - 1) + value31) / (float)num1316; + if (num1315 < 600f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + npc.rotation = npc.velocity.X * 0.05f; + Vector2 value32 = new Vector2(npc.ai[1], npc.ai[2]); + Vector2 value33 = value32 - npc.Center; + float num1317 = value33.Length(); + float num1318 = 2f; + float num1319 = 3f; + value33.Normalize(); + value33 *= num1318; + npc.velocity = (npc.velocity * (num1319 - 1f) + value33) / num1319; + if (npc.collideX || npc.collideY) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + if (num1317 < num1318 || num1317 > 800f || Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 4f) + { + npc.rotation = npc.velocity.X * 0.05f; + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -0.8f; + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * -0.8f; + } + Vector2 value34; + if (npc.velocity.X == 0f && npc.velocity.Y == 0f) + { + value34 = Main.player[npc.target].Center - npc.Center; + value34.Y -= (float)(Main.player[npc.target].height / 4); + value34.Normalize(); + npc.velocity = value34 * 0.1f; + } + float scaleFactor12 = 2f; + float num1320 = 20f; + value34 = npc.velocity; + value34.Normalize(); + value34 *= scaleFactor12; + npc.velocity = (npc.velocity * (num1320 - 1f) + value34) / num1320; + npc.ai[1] += 1f; + if (npc.ai[1] > 180f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + } + if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 0f; + } + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 5f && !Collision.SolidCollision(npc.position - new Vector2(10f, 10f), npc.width + 20, npc.height + 20)) + { + npc.localAI[0] = 0f; + Vector2 center28 = npc.Center; + center28.X = Main.player[npc.target].Center.X; + if (Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center28, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center28.X; + npc.ai[2] = center28.Y; + } + else + { + center28 = npc.Center; + center28.Y = Main.player[npc.target].Center.Y; + if (Collision.CanHit(npc.Center, 1, 1, center28, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center28, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center28.X; + npc.ai[2] = center28.Y; + } + } + } + } + else if (npc.ai[0] == 5f) + { + Player player7 = Main.player[npc.target]; + if (!player7.active || player7.dead) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + else + { + npc.Center = ((player7.gravDir == 1f) ? player7.Top : player7.Bottom) + new Vector2((float)(player7.direction * 4), 0f); + npc.gfxOffY = player7.gfxOffY; + npc.velocity = Vector2.Zero; + player7.AddBuff(163, 59, true); + } + } + npc.rotation = npc.velocity.X * 0.05f; + } + else + { + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (!npc.noTileCollide) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + } + if (npc.collideY) + { + 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; + } + } + } + npc.TargetClosest(false); + if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || + Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 150f : 300f) * + (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) || + npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (hasBeenHit) + { + if (Main.rand.Next(300) == 0) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 34); + } + if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + 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.ai[3] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[3] == 0f) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 120f) + { + npc.ai[3] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + if (npc.ai[3] == 0f) + { + npc.noTileCollide = false; + } + else + { + npc.noTileCollide = true; + } + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 420f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.localAI[0] = 0f; + npc.localAI[1] = 1f; + npc.localAI[2] = 0f; + npc.localAI[3] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + npc.localAI[2] = 1f; + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 150f) + { + npc.localAI[0] = 0f; + npc.netUpdate = true; + int damage = 70; + if (Main.expertMode) + { + damage = 55; + } + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 111); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y + 60, 0f, 2f, mod.ProjectileType("InkBomb"), damage, 0f, Main.myPlayer, 0f, 0f); + } + npc.rotation = npc.velocity.X * 0.05f; + npc.velocity *= 0.975f; + float num263 = 2.5f; + if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + { + npc.TargetClosest(true); + float num264 = 20f; + Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; + float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); + num267 = num264 / num267; + num265 *= num267; + num266 *= num267; + npc.velocity.X = num265; + npc.velocity.Y = num266; + return; + } + } + else + { + if (Main.rand.Next(300) == 0) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 35); + } + npc.localAI[2] = 0f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; + npc.rotation = npc.velocity.X * 0.2f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if (npc.velocity.Y < -1f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if (npc.velocity.Y > 1f) + { + npc.ai[0] = -1f; + } + } + int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num268, num269 - 1] == null) + { + Main.tile[num268, num269 - 1] = new Tile(); + } + if (Main.tile[num268, num269 + 1] == null) + { + Main.tile[num268, num269 + 1] = new Tile(); + } + if (Main.tile[num268, num269 + 2] == null) + { + Main.tile[num268, num269 + 2] = new Tile(); + } + if (Main.tile[num268, num269 - 1].liquid > 128) + { + if (Main.tile[num268, num269 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num268, num269 + 2].active()) + { + npc.ai[0] = -1f; + } + } + else + { + npc.ai[0] = 1f; + } + if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + { + npc.velocity.Y = npc.velocity.Y * 0.99f; + return; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.ai[0] == 5f) + { + return false; + } + return true; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.ai[0] == 5f) + { + Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, + (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Player player = Main.player[npc.target]; + player.invis = true; + player.aggro = -750; + if (player.gravDir == -1f) + { + spriteEffects |= SpriteEffects.FlipVertically; + } + Main.spriteBatch.Draw(Main.npcTexture[npc.type], + new Vector2((float)(player.direction * 4), player.gfxOffY) + ((player.gravDir == 1f) ? player.Top : player.Bottom) - Main.screenPosition, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), npc.GetAlpha(color), npc.rotation, npc.frame.Size() / 2f, npc.scale, spriteEffects, 0f); + } + } + + 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 (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && + !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 600, true); + player.AddBuff(BuffID.Darkness, 600, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 300); + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlackInk, Main.rand.Next(3, 6)); + if (Main.rand.Next(10000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (CalamityWorld.downedPolterghast) + { + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamarisLament")); + } + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(26, 39)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); + } + } + } + + 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 < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid4"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/Cuttlefish.cs b/NPCs/AbyssNPCs/Cuttlefish.cs index eedc793779..3cc56243f8 100644 --- a/NPCs/AbyssNPCs/Cuttlefish.cs +++ b/NPCs/AbyssNPCs/Cuttlefish.cs @@ -1,342 +1,342 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class Cuttlefish : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cuttlefish"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.chaseable = false; - npc.damage = 17; - npc.width = 50; - npc.height = 28; - npc.defense = 12; - npc.lifeMax = 55; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath28; - npc.knockBackResist = 0.3f; - banner = npc.type; - bannerItem = mod.ItemType("CuttlefishBanner"); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - int num = 200; - if (npc.ai[2] == 0f) - { - npc.localAI[0] += 1f; - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[2] = -16f; - } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit || npc.localAI[0] >= 420f) - { - npc.ai[2] = -16f; - } - return; - } - if (npc.ai[2] < 0f) - { - if (npc.alpha > 0) - { - npc.alpha -= num / 16; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); - } - return; - } - if (npc.ai[2] == 1f) - { - npc.chaseable = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet || npc.noTileCollide) - { - bool flag14 = false; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead) - { - flag14 = true; - } - if (!flag14) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.noTileCollide = false; - } - 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) - { - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[3] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[3] == 0f) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 150f) - { - npc.ai[3] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - if (npc.ai[3] == 0f) - { - npc.alpha = 0; - npc.noTileCollide = false; - } - else - { - npc.alpha = 200; - npc.noTileCollide = true; - } - 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 > 9f) - { - npc.velocity.X = 9f; - } - if (npc.velocity.X < -9f) - { - npc.velocity.X = -9f; - } - if (npc.velocity.Y > 7f) - { - npc.velocity.Y = 7f; - } - if (npc.velocity.Y < -7f) - { - npc.velocity.Y = -7f; - } - } - else - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.noTileCollide = false; - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - 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) - { - 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.25f; - if (npc.velocity.Y > 7f) - { - npc.velocity.Y = 7f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - } - - public override void FindFrame(int frameHeight) - { - if (!npc.wet && !npc.noTileCollide) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - 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/AbyssNPCs/CuttlefishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/CuttlefishGlow").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.Gold); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/CuttlefishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Darkness, 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 60, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland")); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class Cuttlefish : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cuttlefish"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.chaseable = false; + npc.damage = 17; + npc.width = 50; + npc.height = 28; + npc.defense = 12; + npc.lifeMax = 55; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath28; + npc.knockBackResist = 0.3f; + banner = npc.type; + bannerItem = mod.ItemType("CuttlefishBanner"); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + int num = 200; + if (npc.ai[2] == 0f) + { + npc.localAI[0] += 1f; + npc.alpha = num; + npc.TargetClosest(true); + if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.ai[2] = -16f; + } + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit || npc.localAI[0] >= 420f) + { + npc.ai[2] = -16f; + } + return; + } + if (npc.ai[2] < 0f) + { + if (npc.alpha > 0) + { + npc.alpha -= num / 16; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] == 0f) + { + npc.ai[2] = 1f; + npc.velocity.X = (float)(npc.direction * 2); + } + return; + } + if (npc.ai[2] == 1f) + { + npc.chaseable = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet || npc.noTileCollide) + { + bool flag14 = false; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead) + { + flag14 = true; + } + if (!flag14) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.noTileCollide = false; + } + 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) + { + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[3] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[3] == 0f) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 150f) + { + npc.ai[3] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + if (npc.ai[3] == 0f) + { + npc.alpha = 0; + npc.noTileCollide = false; + } + else + { + npc.alpha = 200; + npc.noTileCollide = true; + } + 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 > 9f) + { + npc.velocity.X = 9f; + } + if (npc.velocity.X < -9f) + { + npc.velocity.X = -9f; + } + if (npc.velocity.Y > 7f) + { + npc.velocity.Y = 7f; + } + if (npc.velocity.Y < -7f) + { + npc.velocity.Y = -7f; + } + } + else + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.noTileCollide = false; + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + 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) + { + 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.25f; + if (npc.velocity.Y > 7f) + { + npc.velocity.Y = 7f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet && !npc.noTileCollide) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + 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/AbyssNPCs/CuttlefishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/CuttlefishGlow").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.Gold); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/CuttlefishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Darkness, 120, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 60, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/DevilFish.cs b/NPCs/AbyssNPCs/DevilFish.cs index 8ab1839321..eeb197a5aa 100644 --- a/NPCs/AbyssNPCs/DevilFish.cs +++ b/NPCs/AbyssNPCs/DevilFish.cs @@ -1,360 +1,360 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class DevilFish : ModNPC - { - public bool hasBeenHit = false; - public bool brokenMask = false; - public int hitCounter = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Devil Fish"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 60; - npc.width = 126; - npc.height = 66; - npc.defense = 999999; - npc.lifeMax = 200; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.85f; - banner = npc.type; - bannerItem = mod.ItemType("DevilFishBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(brokenMask); - writer.Write(hitCounter); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - brokenMask = reader.ReadBoolean(); - hitCounter = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - Player player = Main.player[npc.target]; - float speedBoost = brokenMask ? 1.5f : 1; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - npc.chaseable = hasBeenHit; - - if (hitCounter >= 5 && !brokenMask) - { - brokenMask = true; - npc.HitSound = SoundID.NPCHit1; - npc.defense = 15; - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask3"), 1f); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/DevilMaskBreak"), (int)npc.position.X, (int)npc.position.Y); - } - - if (npc.wet) - { - bool flag14 = brokenMask; - npc.TargetClosest(false); - if (player.statLife <= player.statLifeMax2 / 4) - { - flag14 = true; - } - if ((!player.wet || player.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.25f * speedBoost; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f * speedBoost; - if (npc.velocity.X > 6f * speedBoost) - { - npc.velocity.X = 6f * speedBoost; - } - if (npc.velocity.X < -6f * speedBoost) - { - npc.velocity.X = -6f * speedBoost; - } - if (npc.velocity.Y > 6f * speedBoost) - { - npc.velocity.Y = 6f * speedBoost; - } - if (npc.velocity.Y < -6f * speedBoost) - { - npc.velocity.Y = -6f * speedBoost; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { - 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) - { - 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 > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (!brokenMask) - { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frame.Y < frameHeight * 4) - { - npc.frame.Y = frameHeight * 4; - } - if (npc.frame.Y > frameHeight * 7) - { - npc.frame.Y = frameHeight * 4; - } - } - } - - 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/AbyssNPCs/DevilFishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/DevilFishGlow").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.Red); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/DevilFishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - player.AddBuff(mod.BuffType("Horror"), 120, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.45f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); - } - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); - } - } - 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")); - } - } - } - - 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 < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - - if (hitCounter <= 5) - { - ++hitCounter; - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class DevilFish : ModNPC + { + public bool hasBeenHit = false; + public bool brokenMask = false; + public int hitCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Devil Fish"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.lavaImmune = true; + npc.damage = 60; + npc.width = 126; + npc.height = 66; + npc.defense = 999999; + npc.lifeMax = 200; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.85f; + banner = npc.type; + bannerItem = mod.ItemType("DevilFishBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(brokenMask); + writer.Write(hitCounter); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + brokenMask = reader.ReadBoolean(); + hitCounter = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + Player player = Main.player[npc.target]; + float speedBoost = brokenMask ? 1.5f : 1; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + npc.chaseable = hasBeenHit; + + if (hitCounter >= 5 && !brokenMask) + { + brokenMask = true; + npc.HitSound = SoundID.NPCHit1; + npc.defense = 15; + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DevilFishMask3"), 1f); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/DevilMaskBreak"), (int)npc.position.X, (int)npc.position.Y); + } + + if (npc.wet) + { + bool flag14 = brokenMask; + npc.TargetClosest(false); + if (player.statLife <= player.statLifeMax2 / 4) + { + flag14 = true; + } + if ((!player.wet || player.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.25f * speedBoost; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f * speedBoost; + if (npc.velocity.X > 6f * speedBoost) + { + npc.velocity.X = 6f * speedBoost; + } + if (npc.velocity.X < -6f * speedBoost) + { + npc.velocity.X = -6f * speedBoost; + } + if (npc.velocity.Y > 6f * speedBoost) + { + npc.velocity.Y = 6f * speedBoost; + } + if (npc.velocity.Y < -6f * speedBoost) + { + npc.velocity.Y = -6f * speedBoost; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + 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) + { + 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 > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (!brokenMask) + { + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frame.Y < frameHeight * 4) + { + npc.frame.Y = frameHeight * 4; + } + if (npc.frame.Y > frameHeight * 7) + { + npc.frame.Y = frameHeight * 4; + } + } + } + + 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/AbyssNPCs/DevilFishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/DevilFishGlow").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.Red); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/DevilFishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + player.AddBuff(mod.BuffType("Horror"), 120, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.45f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); + } + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); + } + } + 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")); + } + } + } + + 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 < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + + if (hitCounter <= 5) + { + ++hitCounter; + } + } + } +} diff --git a/NPCs/AbyssNPCs/EidolonWyrmBody.cs b/NPCs/AbyssNPCs/EidolonWyrmBody.cs index f7959de8ce..a9f3bbb7e8 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBody.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBody.cs @@ -1,321 +1,321 @@ -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.AbyssNPCs -{ - public class EidolonWyrmBody : ModNPC - { - public float speed = 5f; //10 - public float turnSpeed = 0.1f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 48; //36 - npc.height = 58; - npc.defense = 0; - npc.lifeMax = 160000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - npc.damage = 0; - 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("EidolonWyrmHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 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/AbyssNPCs/EidolonWyrmBodyGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmBodyGlow").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/AbyssNPCs/EidolonWyrmBodyGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm2"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 500, true); - player.AddBuff(mod.BuffType("Horror"), 200, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 200); - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class EidolonWyrmBody : ModNPC + { + public float speed = 5f; //10 + public float turnSpeed = 0.1f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Wyrm"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 48; //36 + npc.height = 58; + npc.defense = 0; + npc.lifeMax = 160000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + npc.dontCountMe = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + npc.damage = 0; + 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("EidolonWyrmHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 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/AbyssNPCs/EidolonWyrmBodyGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmBodyGlow").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/AbyssNPCs/EidolonWyrmBodyGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm2"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 500, true); + player.AddBuff(mod.BuffType("Horror"), 200, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 200); + } + } +} diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs index 5b1c24780a..46f6859317 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyAlt.cs @@ -1,321 +1,321 @@ -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.AbyssNPCs -{ - public class EidolonWyrmBodyAlt : ModNPC - { - public float speed = 5f; //10 - public float turnSpeed = 0.1f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 48; //36 - npc.height = 58; - npc.defense = 0; - npc.lifeMax = 160000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - npc.damage = 0; - 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("EidolonWyrmHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 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/AbyssNPCs/EidolonWyrmBodyAltGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmBodyAltGlow").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/AbyssNPCs/EidolonWyrmBodyAltGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm3"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 500, true); - player.AddBuff(mod.BuffType("Horror"), 200, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 200); - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class EidolonWyrmBodyAlt : ModNPC + { + public float speed = 5f; //10 + public float turnSpeed = 0.1f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Wyrm"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 48; //36 + npc.height = 58; + npc.defense = 0; + npc.lifeMax = 160000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + npc.dontCountMe = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + npc.damage = 0; + 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("EidolonWyrmHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 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/AbyssNPCs/EidolonWyrmBodyAltGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmBodyAltGlow").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/AbyssNPCs/EidolonWyrmBodyAltGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm3"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 500, true); + player.AddBuff(mod.BuffType("Horror"), 200, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 200); + } + } +} diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs index 2cf7fffda8..da818a09d7 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyAltHuge.cs @@ -1,321 +1,321 @@ -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.AbyssNPCs -{ - public class EidolonWyrmBodyAltHuge : ModNPC - { - public float speed = 7.5f; //10 - public float turnSpeed = 0.15f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 60; //36 - npc.height = 88; - npc.defense = 0; - npc.lifeMax = 1000000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - npc.damage = 0; - 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("EidolonWyrmHeadHuge"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 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/AbyssNPCs/EidolonWyrmBodyAltGlowHuge").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmBodyAltGlowHuge").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/AbyssNPCs/EidolonWyrmBodyAltGlowHuge"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult3"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 500, true); - player.AddBuff(mod.BuffType("Horror"), 200, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 200); - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class EidolonWyrmBodyAltHuge : ModNPC + { + public float speed = 7.5f; //10 + public float turnSpeed = 0.15f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Wyrm"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 60; //36 + npc.height = 88; + npc.defense = 0; + npc.lifeMax = 1000000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + npc.dontCountMe = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + npc.damage = 0; + 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("EidolonWyrmHeadHuge"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 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/AbyssNPCs/EidolonWyrmBodyAltGlowHuge").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmBodyAltGlowHuge").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/AbyssNPCs/EidolonWyrmBodyAltGlowHuge"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult3"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 500, true); + player.AddBuff(mod.BuffType("Horror"), 200, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 200); + } + } +} diff --git a/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs index 7b970c0417..b7144b647a 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmBodyHuge.cs @@ -1,321 +1,321 @@ -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.AbyssNPCs -{ - public class EidolonWyrmBodyHuge : ModNPC - { - public float speed = 7.5f; //10 - public float turnSpeed = 0.15f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 60; //36 - npc.height = 88; - npc.defense = 0; - npc.lifeMax = 1000000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - npc.damage = 0; - 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("EidolonWyrmHeadHuge"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 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/AbyssNPCs/EidolonWyrmBodyGlowHuge").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmBodyGlowHuge").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/AbyssNPCs/EidolonWyrmBodyGlowHuge"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult2"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 500, true); - player.AddBuff(mod.BuffType("Horror"), 200, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 200); - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class EidolonWyrmBodyHuge : ModNPC + { + public float speed = 7.5f; //10 + public float turnSpeed = 0.15f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Wyrm"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 60; //36 + npc.height = 88; + npc.defense = 0; + npc.lifeMax = 1000000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + npc.dontCountMe = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + npc.damage = 0; + 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("EidolonWyrmHeadHuge"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 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/AbyssNPCs/EidolonWyrmBodyGlowHuge").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmBodyGlowHuge").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/AbyssNPCs/EidolonWyrmBodyGlowHuge"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult2"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 500, true); + player.AddBuff(mod.BuffType("Horror"), 200, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 200); + } + } +} diff --git a/NPCs/AbyssNPCs/EidolonWyrmHead.cs b/NPCs/AbyssNPCs/EidolonWyrmHead.cs index e46904d964..5932b28589 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHead.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHead.cs @@ -1,620 +1,620 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class EidolonWyrmHead : ModNPC - { - public bool detectsPlayer = false; - public bool flies = true; - public const int minLength = 40; - public const int maxLength = 41; - public float speed = 5f; //10 - public float turnSpeed = 0.1f; //0.15 - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } - - public override void SetDefaults() - { - npc.npcSlots = 8f; - npc.damage = 170; - npc.width = 126; //36 - npc.height = 76; //20 - npc.defense = 300; - npc.lifeMax = 160000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("EidolonWyrmJuvenileBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) - { - detectsPlayer = true; - npc.damage = Main.expertMode ? 340 : 170; - } - else - { - npc.damage = 0; - } - npc.chaseable = detectsPlayer; - if (detectsPlayer) - { - if (npc.soundDelay <= 0) - { - npc.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); - } - } - else - { - if (Main.rand.Next(900) == 0) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); - } - } - 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 (Main.netMode != 1) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - if (num36 % 2 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyAlt"), npc.whoAmI); - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmTail"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - if (detectsPlayer) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - int damage = 80; - if (Main.expertMode) - { - damage = 60; - } - float xPos = (Main.rand.Next(2) == 0 ? npc.position.X + 200f : npc.position.X - 200f); - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); - int random = Main.rand.Next(3); - if (random == 0) - { - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (random == 1) - { - 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(vector2.X, vector2.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - else - { - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f || Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.PlaySound(SoundID.Item117, Main.player[npc.target].position); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 0.6f; - 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(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 0.2f; - } - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) - { - Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 1.5f; - } - if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 1.5f; - } - } - } - } - } - } - 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 (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool canFly = flies; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTail")) || !Main.player[npc.target].GetModPlayer(mod).ZoneAbyss) - { - npc.active = 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 600); //800 - if (!detectsPlayer) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 400f) //500 - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 500f; //600 - } - else - { - num191 = Main.player[npc.target].Center.X - 500f; //600 - } - } - } - } - if (detectsPlayer) - { - num188 = 7.5f; - num189 = 0.125f; - if (!Main.player[npc.target].wet) - { - num188 = 15f; - num189 = 0.25f; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (!detectsPlayer) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return detectsPlayer; - } - return null; - } - - 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/AbyssNPCs/EidolonWyrmHeadGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlow").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/AbyssNPCs/EidolonWyrmHeadGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && - !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(30, 41)); - 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 (Main.rand.Next(10000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (CalamityWorld.downedPolterghast) - { - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SoulEdge")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolicWail")); - } - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(8, 13)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(6, 9)); - 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, 4)); - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, 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, 4, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm"), 1f); - } - } - - public override bool CheckActive() - { - if (detectsPlayer && !Main.player[npc.target].dead) - { - return false; - } - if (npc.timeLeft <= 0 && Main.netMode != 1) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == 2) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 1200, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 600); - } - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class EidolonWyrmHead : ModNPC + { + public bool detectsPlayer = false; + public bool flies = true; + public const int minLength = 40; + public const int maxLength = 41; + public float speed = 5f; //10 + public float turnSpeed = 0.1f; //0.15 + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Wyrm"); + } + + public override void SetDefaults() + { + npc.npcSlots = 8f; + npc.damage = 170; + npc.width = 126; //36 + npc.height = 76; //20 + npc.defense = 300; + npc.lifeMax = 160000; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("EidolonWyrmJuvenileBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) + { + detectsPlayer = true; + npc.damage = Main.expertMode ? 340 : 170; + } + else + { + npc.damage = 0; + } + npc.chaseable = detectsPlayer; + if (detectsPlayer) + { + if (npc.soundDelay <= 0) + { + npc.soundDelay = 420; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); + } + } + else + { + if (Main.rand.Next(900) == 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); + } + } + 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 (Main.netMode != 1) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + if (num36 % 2 == 0) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyAlt"), npc.whoAmI); + } + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmTail"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + if (detectsPlayer) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + int damage = 80; + if (Main.expertMode) + { + damage = 60; + } + float xPos = (Main.rand.Next(2) == 0 ? npc.position.X + 200f : npc.position.X - 200f); + Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); + int random = Main.rand.Next(3); + if (random == 0) + { + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (random == 1) + { + 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(vector2.X, vector2.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + else + { + if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f || Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) + { + Main.PlaySound(SoundID.Item117, Main.player[npc.target].position); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 0.6f; + 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(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 0.2f; + } + if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) + { + Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 1.5f; + } + if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) + { + Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 1.5f; + } + } + } + } + } + } + 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 (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool canFly = flies; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTail")) || !Main.player[npc.target].GetModPlayer(mod).ZoneAbyss) + { + npc.active = 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 600); //800 + if (!detectsPlayer) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 400f) //500 + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 500f; //600 + } + else + { + num191 = Main.player[npc.target].Center.X - 500f; //600 + } + } + } + } + if (detectsPlayer) + { + num188 = 7.5f; + num189 = 0.125f; + if (!Main.player[npc.target].wet) + { + num188 = 15f; + num189 = 0.25f; + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (!detectsPlayer) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return detectsPlayer; + } + return null; + } + + 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/AbyssNPCs/EidolonWyrmHeadGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlow").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/AbyssNPCs/EidolonWyrmHeadGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && + !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(30, 41)); + 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 (Main.rand.Next(10000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (CalamityWorld.downedPolterghast) + { + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SoulEdge")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolicWail")); + } + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(8, 13)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(6, 9)); + 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, 4)); + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, 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, 4, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm"), 1f); + } + } + + public override bool CheckActive() + { + if (detectsPlayer && !Main.player[npc.target].dead) + { + return false; + } + if (npc.timeLeft <= 0 && Main.netMode != 1) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == 2) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 1200, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 600, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 600); + } + } + } +} diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs index 6e539b464a..27b9355b20 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs @@ -1,610 +1,610 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class EidolonWyrmHeadHuge : ModNPC - { - public bool detectsPlayer = false; - public bool flies = true; - public const int minLength = 40; - public const int maxLength = 41; - public float speed = 7.5f; //10 - public float turnSpeed = 0.15f; //0.15 - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } - - public override void SetDefaults() - { - npc.npcSlots = 24f; - npc.damage = 1500; - npc.width = 254; //36 - npc.height = 138; //20 - npc.defense = 3000; - npc.lifeMax = 1000000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(10, 0, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) - { - detectsPlayer = true; - npc.damage = 1500; - } - else - { - npc.damage = 0; - } - npc.chaseable = detectsPlayer; - if (detectsPlayer) - { - if (npc.soundDelay <= 0) - { - npc.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - } - } - else - { - if (Main.rand.Next(900) == 0) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - } - } - 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 (Main.netMode != 1) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - if (num36 % 2 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyHuge"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyAltHuge"), npc.whoAmI); - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmTailHuge"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - if (detectsPlayer) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - int damage = Main.expertMode ? 300 : 400; - float xPos = (Main.rand.Next(2) == 0 ? npc.position.X + 200f : npc.position.X - 200f); - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); - int random = Main.rand.Next(3); - if (random == 0) - { - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(-vector2.X, -vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (random == 1) - { - 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(vector2.X, vector2.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(-vector2.X, -vector2.Y, -vector4.X, -vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - else - { - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f || Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.PlaySound(SoundID.Item117, Main.player[npc.target].position); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 0.6f; - 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(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), - Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 0.2f; - } - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) - { - Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 2f; - } - if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 2f; - } - } - } - } - } - } - 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 (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool canFly = flies; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTailHuge"))) - { - npc.active = 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 600); //800 - if (!detectsPlayer) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 400f) //500 - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 500f; //600 - } - else - { - num191 = Main.player[npc.target].Center.X - 500f; //600 - } - } - } - } - if (detectsPlayer) - { - num188 = 10f; - num189 = 0.175f; - if (!Main.player[npc.target].wet) - { - num188 = 20f; - num189 = 0.25f; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (!detectsPlayer) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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; - } - } - } - } - } - 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) - { - return detectsPlayer; - } - return null; - } - - 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/AbyssNPCs/EidolonWyrmHeadGlowHuge").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge").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/AbyssNPCs/EidolonWyrmHeadGlowHuge"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && - !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && - CalamityWorld.downedPolterghast) - { - return SpawnCondition.CaveJellyfish.Chance * 0.006f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && - !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && - CalamityWorld.downedPolterghast) - { - return SpawnCondition.CaveJellyfish.Chance * 0.012f; - } - return 0f; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(80, 101)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolicWail")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SoulEdge")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(21, 33)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(50, 109)); - if (CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - 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(15, 28)); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, 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, 4, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult"), 1f); - } - } - - public override bool CheckActive() - { - if (detectsPlayer && !Main.player[npc.target].dead) - { - return false; - } - if (npc.timeLeft <= 0 && Main.netMode != 1) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == 2) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 1200, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 1200, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 1200); - } - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class EidolonWyrmHeadHuge : ModNPC + { + public bool detectsPlayer = false; + public bool flies = true; + public const int minLength = 40; + public const int maxLength = 41; + public float speed = 7.5f; //10 + public float turnSpeed = 0.15f; //0.15 + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Wyrm"); + } + + public override void SetDefaults() + { + npc.npcSlots = 24f; + npc.damage = 1500; + npc.width = 254; //36 + npc.height = 138; //20 + npc.defense = 3000; + npc.lifeMax = 1000000; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(10, 0, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) + { + detectsPlayer = true; + npc.damage = 1500; + } + else + { + npc.damage = 0; + } + npc.chaseable = detectsPlayer; + if (detectsPlayer) + { + if (npc.soundDelay <= 0) + { + npc.soundDelay = 420; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); + } + } + else + { + if (Main.rand.Next(900) == 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); + } + } + 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 (Main.netMode != 1) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + if (num36 % 2 == 0) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyHuge"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmBodyAltHuge"), npc.whoAmI); + } + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("EidolonWyrmTailHuge"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + if (detectsPlayer) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + int damage = Main.expertMode ? 300 : 400; + float xPos = (Main.rand.Next(2) == 0 ? npc.position.X + 200f : npc.position.X - 200f); + Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-200, 201)); + int random = Main.rand.Next(3); + if (random == 0) + { + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(-vector2.X, -vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (random == 1) + { + 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(vector2.X, vector2.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(-vector2.X, -vector2.Y, -vector4.X, -vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + else + { + if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f || Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) + { + Main.PlaySound(SoundID.Item117, Main.player[npc.target].position); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 0.6f; + 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(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y), + Main.player[npc.target].width, Main.player[npc.target].height, 185, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 0.2f; + } + if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) + { + Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 2f; + } + if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) + { + Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 2f; + } + } + } + } + } + } + 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 (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool canFly = flies; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(mod.NPCType("EidolonWyrmTailHuge"))) + { + npc.active = 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 600); //800 + if (!detectsPlayer) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 400f) //500 + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 500f; //600 + } + else + { + num191 = Main.player[npc.target].Center.X - 500f; //600 + } + } + } + } + if (detectsPlayer) + { + num188 = 10f; + num189 = 0.175f; + if (!Main.player[npc.target].wet) + { + num188 = 20f; + num189 = 0.25f; + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (!detectsPlayer) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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; + } + } + } + } + } + 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) + { + return detectsPlayer; + } + return null; + } + + 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/AbyssNPCs/EidolonWyrmHeadGlowHuge").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmHeadGlowHuge").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/AbyssNPCs/EidolonWyrmHeadGlowHuge"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && + !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && + CalamityWorld.downedPolterghast) + { + return SpawnCondition.CaveJellyfish.Chance * 0.006f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge")) && + !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && + CalamityWorld.downedPolterghast) + { + return SpawnCondition.CaveJellyfish.Chance * 0.012f; + } + return 0f; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(80, 101)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolicWail")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SoulEdge")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(21, 33)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(50, 109)); + if (CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + 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(15, 28)); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, 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, 4, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult"), 1f); + } + } + + public override bool CheckActive() + { + if (detectsPlayer && !Main.player[npc.target].dead) + { + return false; + } + if (npc.timeLeft <= 0 && Main.netMode != 1) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == 2) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 1200, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 1200, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 1200); + } + } + } +} diff --git a/NPCs/AbyssNPCs/EidolonWyrmTail.cs b/NPCs/AbyssNPCs/EidolonWyrmTail.cs index d51bba3f95..1bb607f81c 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmTail.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmTail.cs @@ -1,320 +1,320 @@ -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.AbyssNPCs -{ - public class EidolonWyrmTail : ModNPC - { - public float speed = 5f; //10 - public float turnSpeed = 0.1f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 46; //28 - npc.height = 66; //28 - npc.defense = 0; - npc.lifeMax = 160000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - npc.damage = 0; - 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("EidolonWyrmHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 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/AbyssNPCs/EidolonWyrmTailGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmTailGlow").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/AbyssNPCs/EidolonWyrmTailGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm4"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - player.AddBuff(mod.BuffType("CrushDepth"), 60, true); - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class EidolonWyrmTail : ModNPC + { + public float speed = 5f; //10 + public float turnSpeed = 0.1f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Wyrm"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 46; //28 + npc.height = 66; //28 + npc.defense = 0; + npc.lifeMax = 160000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + npc.dontCountMe = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + npc.damage = 0; + 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("EidolonWyrmHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 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/AbyssNPCs/EidolonWyrmTailGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmTailGlow").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/AbyssNPCs/EidolonWyrmTailGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Wyrm4"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 60, true); + player.AddBuff(mod.BuffType("CrushDepth"), 60, true); + } + } +} diff --git a/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs index 551063b77c..af3a6beb43 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmTailHuge.cs @@ -1,320 +1,320 @@ -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.AbyssNPCs -{ - public class EidolonWyrmTailHuge : ModNPC - { - public float speed = 7.5f; //10 - public float turnSpeed = 0.15f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolon Wyrm"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.width = 86; //28 - npc.height = 120; //28 - npc.defense = 0; - npc.lifeMax = 1000000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.netAlways = true; - npc.dontCountMe = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - npc.damage = 0; - 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("EidolonWyrmHeadHuge"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 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/AbyssNPCs/EidolonWyrmTailGlowHuge").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmTailGlowHuge").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/AbyssNPCs/EidolonWyrmTailGlowHuge"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult4"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - player.AddBuff(mod.BuffType("CrushDepth"), 60, true); - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class EidolonWyrmTailHuge : ModNPC + { + public float speed = 7.5f; //10 + public float turnSpeed = 0.15f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolon Wyrm"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.width = 86; //28 + npc.height = 120; //28 + npc.defense = 0; + npc.lifeMax = 1000000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.netAlways = true; + npc.dontCountMe = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + npc.damage = 0; + 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("EidolonWyrmHeadHuge"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 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/AbyssNPCs/EidolonWyrmTailGlowHuge").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/EidolonWyrmTailGlowHuge").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/AbyssNPCs/EidolonWyrmTailGlowHuge"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult4"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 60, true); + player.AddBuff(mod.BuffType("CrushDepth"), 60, true); + } + } +} diff --git a/NPCs/AbyssNPCs/Flounder.cs b/NPCs/AbyssNPCs/Flounder.cs index 82b647a40e..5446f47adc 100644 --- a/NPCs/AbyssNPCs/Flounder.cs +++ b/NPCs/AbyssNPCs/Flounder.cs @@ -1,307 +1,307 @@ -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.AbyssNPCs -{ - public class Flounder : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flounder"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.chaseable = false; - npc.damage = 10; - npc.width = 42; - npc.height = 32; - npc.defense = 15; - npc.lifeMax = 40; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = SoundID.NPCDeath53; - npc.knockBackResist = 0.35f; - banner = npc.type; - bannerItem = mod.ItemType("FlounderBanner"); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - int num = 200; - if (npc.ai[2] == 0f) - { - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[2] = -16f; - } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit) - { - npc.ai[2] = -16f; - } - return; - } - if (npc.ai[2] < 0f) - { - if (npc.alpha > 0) - { - npc.alpha -= num / 16; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); - } - return; - } - npc.alpha = 0; - if (npc.ai[2] == 1f) - { - npc.chaseable = true; - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - bool flag14 = false; - npc.TargetClosest(false); - if (!Main.player[npc.target].dead) - { - flag14 = true; - } - 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.1f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; - if (npc.velocity.X > 2f) - { - npc.velocity.X = 2f; - } - if (npc.velocity.X < -2f) - { - npc.velocity.X = -2f; - } - if (npc.velocity.Y > 1f) - { - npc.velocity.Y = 1f; - } - if (npc.velocity.Y < -1f) - { - npc.velocity.Y = -1f; - } - if ((Main.player[npc.target].Center - npc.Center).Length() < 350f) - { - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 180f) - { - 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 = 4f; - 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 = 25; - if (Main.expertMode) - { - damage = 19; - } - int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 10f : -10f), npc.Center.Y, num6, num7, mod.ProjectileType("SulphuricAcidMist"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - 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) - { - 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.2f; - 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.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 120, true); - } - - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 0.15f; - 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) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water) - { - return 0.2f; - } - return 0f; - } - - 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("CloakingGland")); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 +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.AbyssNPCs +{ + public class Flounder : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flounder"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.chaseable = false; + npc.damage = 10; + npc.width = 42; + npc.height = 32; + npc.defense = 15; + npc.lifeMax = 40; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit50; + npc.DeathSound = SoundID.NPCDeath53; + npc.knockBackResist = 0.35f; + banner = npc.type; + bannerItem = mod.ItemType("FlounderBanner"); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + int num = 200; + if (npc.ai[2] == 0f) + { + npc.alpha = num; + npc.TargetClosest(true); + if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.ai[2] = -16f; + } + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit) + { + npc.ai[2] = -16f; + } + return; + } + if (npc.ai[2] < 0f) + { + if (npc.alpha > 0) + { + npc.alpha -= num / 16; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] == 0f) + { + npc.ai[2] = 1f; + npc.velocity.X = (float)(npc.direction * 2); + } + return; + } + npc.alpha = 0; + if (npc.ai[2] == 1f) + { + npc.chaseable = true; + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + bool flag14 = false; + npc.TargetClosest(false); + if (!Main.player[npc.target].dead) + { + flag14 = true; + } + 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.1f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; + if (npc.velocity.X > 2f) + { + npc.velocity.X = 2f; + } + if (npc.velocity.X < -2f) + { + npc.velocity.X = -2f; + } + if (npc.velocity.Y > 1f) + { + npc.velocity.Y = 1f; + } + if (npc.velocity.Y < -1f) + { + npc.velocity.Y = -1f; + } + if ((Main.player[npc.target].Center - npc.Center).Length() < 350f) + { + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 180f) + { + 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 = 4f; + 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 = 25; + if (Main.expertMode) + { + damage = 19; + } + int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 10f : -10f), npc.Center.Y, num6, num7, mod.ProjectileType("SulphuricAcidMist"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + 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) + { + 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.2f; + 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.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 120, true); + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 0.15f; + 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) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water) + { + return 0.2f; + } + return 0f; + } + + 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("CloakingGland")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/Frogfish.cs b/NPCs/AbyssNPCs/Frogfish.cs index b7edb3a530..79aeccc31c 100644 --- a/NPCs/AbyssNPCs/Frogfish.cs +++ b/NPCs/AbyssNPCs/Frogfish.cs @@ -1,275 +1,275 @@ -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.AbyssNPCs -{ - public class Frogfish : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frogfish"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.chaseable = false; - npc.damage = 25; - npc.width = 60; - npc.height = 50; - npc.defense = 10; - npc.lifeMax = 80; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.5f; - banner = npc.type; - bannerItem = mod.ItemType("FrogfishBanner"); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - int num = 200; - if (npc.ai[2] == 0f) - { - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[2] = -16f; - } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit) - { - npc.ai[2] = -16f; - } - return; - } - if (npc.ai[2] < 0f) - { - if (npc.alpha > 0) - { - npc.alpha -= num / 16; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); - } - return; - } - npc.alpha = 0; - if (npc.ai[2] == 1f) - { - npc.chaseable = true; - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - bool flag14 = false; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead) - { - flag14 = true; - } - 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.15f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - if (npc.velocity.X > 3.5f) - { - npc.velocity.X = 3.5f; - } - if (npc.velocity.X < -3.5f) - { - npc.velocity.X = -3.5f; - } - if (npc.velocity.Y > 1.5f) - { - npc.velocity.Y = 1.5f; - } - if (npc.velocity.Y < -1.5f) - { - npc.velocity.Y = -1.5f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - 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) - { - 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.2f; - 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.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 180, true); - } - - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 0.15f; - 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 || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OceanMonster.Chance * 0.2f; - } - - 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("CloakingGland")); - } - } - - 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 < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class Frogfish : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frogfish"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.chaseable = false; + npc.damage = 25; + npc.width = 60; + npc.height = 50; + npc.defense = 10; + npc.lifeMax = 80; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.5f; + banner = npc.type; + bannerItem = mod.ItemType("FrogfishBanner"); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + int num = 200; + if (npc.ai[2] == 0f) + { + npc.alpha = num; + npc.TargetClosest(true); + if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.ai[2] = -16f; + } + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit) + { + npc.ai[2] = -16f; + } + return; + } + if (npc.ai[2] < 0f) + { + if (npc.alpha > 0) + { + npc.alpha -= num / 16; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] == 0f) + { + npc.ai[2] = 1f; + npc.velocity.X = (float)(npc.direction * 2); + } + return; + } + npc.alpha = 0; + if (npc.ai[2] == 1f) + { + npc.chaseable = true; + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + bool flag14 = false; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead) + { + flag14 = true; + } + 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.15f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + if (npc.velocity.X > 3.5f) + { + npc.velocity.X = 3.5f; + } + if (npc.velocity.X < -3.5f) + { + npc.velocity.X = -3.5f; + } + if (npc.velocity.Y > 1.5f) + { + npc.velocity.Y = 1.5f; + } + if (npc.velocity.Y < -1.5f) + { + npc.velocity.Y = -1.5f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + 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) + { + 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.2f; + 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.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 180, true); + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 0.15f; + 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 || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OceanMonster.Chance * 0.2f; + } + + 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("CloakingGland")); + } + } + + 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 < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/GiantSquid.cs b/NPCs/AbyssNPCs/GiantSquid.cs index e3d6848f91..e517dbedc7 100644 --- a/NPCs/AbyssNPCs/GiantSquid.cs +++ b/NPCs/AbyssNPCs/GiantSquid.cs @@ -1,292 +1,292 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class GiantSquid : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Giant Squid"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 80; - npc.width = 50; - npc.height = 220; - npc.defense = 25; - npc.lifeMax = 400; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("GiantSquidBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (!npc.wet) - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - return; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - } - if (npc.collideY) - { - 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; - } - } - npc.TargetClosest(false); - if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || - Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 300f : 500f) * - (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) || - npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - npc.rotation = npc.velocity.X * 0.02f; - if (hasBeenHit) - { - npc.localAI[2] = 1f; - npc.velocity *= 0.975f; - float num263 = 1.6f; - if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) - { - npc.TargetClosest(true); - float num264 = 16f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; - float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); - num267 = num264 / num267; - num265 *= num267; - num266 *= num267; - npc.velocity.X = num265; - npc.velocity.Y = num266; - return; - } - } - else - { - npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; - if (npc.velocity.X < -1f || npc.velocity.X > 1f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if (npc.velocity.Y < -1f) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if (npc.velocity.Y > 1f) - { - npc.ai[0] = -1f; - } - } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num268, num269 - 1] == null) - { - Main.tile[num268, num269 - 1] = new Tile(); - } - if (Main.tile[num268, num269 + 1] == null) - { - Main.tile[num268, num269 + 1] = new Tile(); - } - if (Main.tile[num268, num269 + 2] == null) - { - Main.tile[num268, num269 + 2] = new Tile(); - } - if (Main.tile[num268, num269 - 1].liquid > 128) - { - if (Main.tile[num268, num269 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num268, num269 + 2].active()) - { - npc.ai[0] = -1f; - } - } - else - { - npc.ai[0] = 1f; - } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) - { - npc.velocity.Y = npc.velocity.Y * 0.99f; - return; - } - } - } - - 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 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/AbyssNPCs/GiantSquidGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GiantSquidGlow").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.Cyan); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/GiantSquidGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 180, true); - player.AddBuff(BuffID.Darkness, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - player.AddBuff(mod.BuffType("Horror"), 120, true); - } - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); - } - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 5)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); - } - } - } - - 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 < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid4"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class GiantSquid : ModNPC + { + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Giant Squid"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 80; + npc.width = 50; + npc.height = 220; + npc.defense = 25; + npc.lifeMax = 400; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 15, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("GiantSquidBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (!npc.wet) + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + if ((double)npc.velocity.X > -0.01 && (double)npc.velocity.X < 0.01) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + return; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + } + if (npc.collideY) + { + 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; + } + } + npc.TargetClosest(false); + if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || + Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 300f : 500f) * + (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) || + npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + npc.rotation = npc.velocity.X * 0.02f; + if (hasBeenHit) + { + npc.localAI[2] = 1f; + npc.velocity *= 0.975f; + float num263 = 1.6f; + if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) + { + npc.TargetClosest(true); + float num264 = 16f; + Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; + float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; + float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); + num267 = num264 / num267; + num265 *= num267; + num266 *= num267; + npc.velocity.X = num265; + npc.velocity.Y = num266; + return; + } + } + else + { + npc.localAI[2] = 0f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if (npc.velocity.Y < -1f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if (npc.velocity.Y > 1f) + { + npc.ai[0] = -1f; + } + } + int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num268, num269 - 1] == null) + { + Main.tile[num268, num269 - 1] = new Tile(); + } + if (Main.tile[num268, num269 + 1] == null) + { + Main.tile[num268, num269 + 1] = new Tile(); + } + if (Main.tile[num268, num269 + 2] == null) + { + Main.tile[num268, num269 + 2] = new Tile(); + } + if (Main.tile[num268, num269 - 1].liquid > 128) + { + if (Main.tile[num268, num269 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num268, num269 + 2].active()) + { + npc.ai[0] = -1f; + } + } + else + { + npc.ai[0] = 1f; + } + if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + { + npc.velocity.Y = npc.velocity.Y * 0.99f; + return; + } + } + } + + 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 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/AbyssNPCs/GiantSquidGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GiantSquidGlow").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.Cyan); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/GiantSquidGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 180, true); + player.AddBuff(BuffID.Darkness, 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + player.AddBuff(mod.BuffType("Horror"), 120, true); + } + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); + } + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 5)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); + } + } + } + + 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 < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid4"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/Gnasher.cs b/NPCs/AbyssNPCs/Gnasher.cs index 741ed1f51b..350e244e11 100644 --- a/NPCs/AbyssNPCs/Gnasher.cs +++ b/NPCs/AbyssNPCs/Gnasher.cs @@ -1,138 +1,138 @@ -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.AbyssNPCs -{ - public class Gnasher : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gnasher"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.damage = 25; - npc.width = 50; - npc.height = 36; - npc.defense = 30; - npc.lifeMax = 35; - npc.knockBackResist = 0.25f; - npc.aiStyle = 3; - aiType = 67; - npc.value = Item.buyPrice(0, 0, 0, 60); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = SoundID.NPCDeath54; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - banner = npc.type; - bannerItem = mod.ItemType("GnasherBanner"); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); - float num78 = 0.5f; - float num79 = (Main.player[npc.target].Center - npc.Center).Length(); - num79 *= 0.0025f; - if ((double)num79 > 1.5) - { - num79 = 1.5f; - } - if (Main.expertMode) - { - num78 = 2.5f - num79; - } - else - { - num78 = 2.25f - num79; - } - num78 *= 0.8f; - if (npc.velocity.X < -num78 || npc.velocity.X > num78) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num78 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + 1f; - if (npc.velocity.X > num78) - { - npc.velocity.X = num78; - } - } - else if (npc.velocity.X > -num78 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - 1f; - if (npc.velocity.X < -num78) - { - npc.velocity.X = -num78; - } - } - } - - 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 OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, true); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0.2f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.hardMode && Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TurtleShell); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gnasher"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gnasher2"), 1f); - } - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class Gnasher : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gnasher"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.damage = 25; + npc.width = 50; + npc.height = 36; + npc.defense = 30; + npc.lifeMax = 35; + npc.knockBackResist = 0.25f; + npc.aiStyle = 3; + aiType = 67; + npc.value = Item.buyPrice(0, 0, 0, 60); + npc.HitSound = SoundID.NPCHit50; + npc.DeathSound = SoundID.NPCDeath54; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + banner = npc.type; + bannerItem = mod.ItemType("GnasherBanner"); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); + float num78 = 0.5f; + float num79 = (Main.player[npc.target].Center - npc.Center).Length(); + num79 *= 0.0025f; + if ((double)num79 > 1.5) + { + num79 = 1.5f; + } + if (Main.expertMode) + { + num78 = 2.5f - num79; + } + else + { + num78 = 2.25f - num79; + } + num78 *= 0.8f; + if (npc.velocity.X < -num78 || npc.velocity.X > num78) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num78 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + 1f; + if (npc.velocity.X > num78) + { + npc.velocity.X = num78; + } + } + else if (npc.velocity.X > -num78 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - 1f; + if (npc.velocity.X < -num78) + { + npc.velocity.X = -num78; + } + } + } + + 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 OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 120, true); + player.AddBuff(BuffID.Venom, 120, true); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0.2f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.hardMode && Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TurtleShell); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gnasher"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gnasher2"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/GulperEelBody.cs b/NPCs/AbyssNPCs/GulperEelBody.cs index 739254fbe6..aab26c9f40 100644 --- a/NPCs/AbyssNPCs/GulperEelBody.cs +++ b/NPCs/AbyssNPCs/GulperEelBody.cs @@ -1,321 +1,321 @@ -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.AbyssNPCs -{ - public class GulperEelBody : ModNPC - { - public float speed = 5f; //10 - public float turnSpeed = 0.075f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gulper Eel"); - } - - public override void SetDefaults() - { - npc.damage = 90; //70 - npc.width = 56; //36 - npc.height = 36; - npc.defense = 80; - npc.lifeMax = 80000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - banner = mod.NPCType("GulperEelHead"); - bannerItem = mod.ItemType("GulperEelBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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("GulperEelHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 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/AbyssNPCs/GulperEelBodyGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GulperEelBodyGlow").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/AbyssNPCs/GulperEelBodyGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel3"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(mod.BuffType("CrushDepth"), 120, true); - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class GulperEelBody : ModNPC + { + public float speed = 5f; //10 + public float turnSpeed = 0.075f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gulper Eel"); + } + + public override void SetDefaults() + { + npc.damage = 90; //70 + npc.width = 56; //36 + npc.height = 36; + npc.defense = 80; + npc.lifeMax = 80000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit9; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + banner = mod.NPCType("GulperEelHead"); + bannerItem = mod.ItemType("GulperEelBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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("GulperEelHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 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/AbyssNPCs/GulperEelBodyGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GulperEelBodyGlow").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/AbyssNPCs/GulperEelBodyGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel3"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 120, true); + player.AddBuff(mod.BuffType("CrushDepth"), 120, true); + } + } +} diff --git a/NPCs/AbyssNPCs/GulperEelBodyAlt.cs b/NPCs/AbyssNPCs/GulperEelBodyAlt.cs index 6da8c9ab11..d4f590d169 100644 --- a/NPCs/AbyssNPCs/GulperEelBodyAlt.cs +++ b/NPCs/AbyssNPCs/GulperEelBodyAlt.cs @@ -1,321 +1,321 @@ -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.AbyssNPCs -{ - public class GulperEelBodyAlt : ModNPC - { - public float speed = 5f; //10 - public float turnSpeed = 0.075f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gulper Eel"); - } - - public override void SetDefaults() - { - npc.damage = 90; //70 - npc.width = 36; //36 - npc.height = 36; - npc.defense = 80; - npc.lifeMax = 80000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - banner = mod.NPCType("GulperEelHead"); - bannerItem = mod.ItemType("GulperEelBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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("GulperEelHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 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/AbyssNPCs/GulperEelBodyAltGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GulperEelBodyAltGlow").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/AbyssNPCs/GulperEelBodyAltGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel3"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(mod.BuffType("CrushDepth"), 120, true); - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class GulperEelBodyAlt : ModNPC + { + public float speed = 5f; //10 + public float turnSpeed = 0.075f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gulper Eel"); + } + + public override void SetDefaults() + { + npc.damage = 90; //70 + npc.width = 36; //36 + npc.height = 36; + npc.defense = 80; + npc.lifeMax = 80000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit9; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + banner = mod.NPCType("GulperEelHead"); + bannerItem = mod.ItemType("GulperEelBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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("GulperEelHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 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/AbyssNPCs/GulperEelBodyAltGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GulperEelBodyAltGlow").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/AbyssNPCs/GulperEelBodyAltGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel3"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 120, true); + player.AddBuff(mod.BuffType("CrushDepth"), 120, true); + } + } +} diff --git a/NPCs/AbyssNPCs/GulperEelHead.cs b/NPCs/AbyssNPCs/GulperEelHead.cs index 670abd3237..71be76ecc7 100644 --- a/NPCs/AbyssNPCs/GulperEelHead.cs +++ b/NPCs/AbyssNPCs/GulperEelHead.cs @@ -1,512 +1,512 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class GulperEelHead : ModNPC - { - public bool detectsPlayer = false; - public bool flies = true; - public const int minLength = 20; - public const int maxLength = 21; - public float speed = 5f; //10 - public float turnSpeed = 0.075f; //0.15 - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gulper Eel"); - } - - public override void SetDefaults() - { - npc.damage = 135; - npc.width = 66; //36 - npc.height = 86; //20 - npc.defense = 50; - npc.lifeMax = 80000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - banner = npc.type; - bannerItem = mod.ItemType("GulperEelBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detectsPlayer); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - if ((Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || - Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 100f : 600f) * - (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f) || - npc.justHit) - { - detectsPlayer = true; - } - npc.chaseable = detectsPlayer; - 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 (Main.netMode != 1) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - if (num36 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelBodyAlt"), npc.whoAmI); - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelTail"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - } - 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 (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool canFly = flies; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(mod.NPCType("GulperEelTail"))) - { - npc.active = 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 400); //800 - if (!detectsPlayer) - { - num192 = num47; - 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 + 400f; - } - else - { - num191 = Main.player[npc.target].Center.X - 400f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (!detectsPlayer) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return detectsPlayer; - } - return null; - } - - 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/AbyssNPCs/GulperEelHeadGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GulperEelHeadGlow").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/AbyssNPCs/GulperEelHeadGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (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, 4)); - } - 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")); - } - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(6, 9)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); - } - } - } - - 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); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel"), 1f); - } - } - - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != 1) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == 2) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(mod.BuffType("CrushDepth"), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class GulperEelHead : ModNPC + { + public bool detectsPlayer = false; + public bool flies = true; + public const int minLength = 20; + public const int maxLength = 21; + public float speed = 5f; //10 + public float turnSpeed = 0.075f; //0.15 + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gulper Eel"); + } + + public override void SetDefaults() + { + npc.damage = 135; + npc.width = 66; //36 + npc.height = 86; //20 + npc.defense = 50; + npc.lifeMax = 80000; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 50, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit9; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + banner = npc.type; + bannerItem = mod.ItemType("GulperEelBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detectsPlayer); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detectsPlayer = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + if ((Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || + Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 100f : 600f) * + (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f) || + npc.justHit) + { + detectsPlayer = true; + } + npc.chaseable = detectsPlayer; + 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 (Main.netMode != 1) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + if (num36 == 0) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelBodyAlt"), npc.whoAmI); + } + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("GulperEelTail"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + 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 (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool canFly = flies; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(mod.NPCType("GulperEelTail"))) + { + npc.active = 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 400); //800 + if (!detectsPlayer) + { + num192 = num47; + 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 + 400f; + } + else + { + num191 = Main.player[npc.target].Center.X - 400f; + } + } + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (!detectsPlayer) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return detectsPlayer; + } + return null; + } + + 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/AbyssNPCs/GulperEelHeadGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GulperEelHeadGlow").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/AbyssNPCs/GulperEelHeadGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GulperEelHead"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (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, 4)); + } + 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")); + } + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(6, 9)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); + } + } + } + + 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); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel"), 1f); + } + } + + public override bool CheckActive() + { + if (npc.timeLeft <= 0 && Main.netMode != 1) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == 2) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 300, true); + player.AddBuff(mod.BuffType("CrushDepth"), 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + } +} diff --git a/NPCs/AbyssNPCs/GulperEelTail.cs b/NPCs/AbyssNPCs/GulperEelTail.cs index c42a1ef6ea..8da9b448aa 100644 --- a/NPCs/AbyssNPCs/GulperEelTail.cs +++ b/NPCs/AbyssNPCs/GulperEelTail.cs @@ -1,320 +1,320 @@ -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.AbyssNPCs -{ - public class GulperEelTail : ModNPC - { - public float speed = 5f; //10 - public float turnSpeed = 0.075f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gulper Eel"); - } - - public override void SetDefaults() - { - npc.damage = 65; //70 - npc.width = 54; //28 - npc.height = 76; //28 - npc.defense = 100; - npc.lifeMax = 80000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit9; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - banner = mod.NPCType("GulperEelHead"); - bannerItem = mod.ItemType("GulperEelBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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("GulperEelHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 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/AbyssNPCs/GulperEelTailGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GulperEelTailGlow").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/AbyssNPCs/GulperEelTailGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel4"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - player.AddBuff(mod.BuffType("CrushDepth"), 60, true); - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class GulperEelTail : ModNPC + { + public float speed = 5f; //10 + public float turnSpeed = 0.075f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gulper Eel"); + } + + public override void SetDefaults() + { + npc.damage = 65; //70 + npc.width = 54; //28 + npc.height = 76; //28 + npc.defense = 100; + npc.lifeMax = 80000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit9; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + banner = mod.NPCType("GulperEelHead"); + bannerItem = mod.ItemType("GulperEelBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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("GulperEelHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 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/AbyssNPCs/GulperEelTailGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/GulperEelTailGlow").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/AbyssNPCs/GulperEelTailGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel4"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 60, true); + player.AddBuff(mod.BuffType("CrushDepth"), 60, true); + } + } +} diff --git a/NPCs/AbyssNPCs/Laserfish.cs b/NPCs/AbyssNPCs/Laserfish.cs index a9708a8756..80cb87a7e1 100644 --- a/NPCs/AbyssNPCs/Laserfish.cs +++ b/NPCs/AbyssNPCs/Laserfish.cs @@ -1,322 +1,322 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class Laserfish : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laserfish"); - Main.npcFrameCount[npc.type] = 12; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 20; - npc.width = 60; - npc.height = 26; - npc.defense = 25; - npc.lifeMax = 240; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath26; - npc.knockBackResist = 0.65f; - banner = npc.type; - bannerItem = mod.ItemType("LaserfishBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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 && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || - Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 200f : 400f) * - (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) - { - flag14 = true; - } - 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.15f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - if (npc.velocity.X > 4f) - { - npc.velocity.X = 4f; - } - if (npc.velocity.X < -4f) - { - npc.velocity.X = -4f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 120f) - { - 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(-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 = 40; - if (Main.expertMode) - { - damage = 30; - } - int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 15f : -15f), npc.Center.Y, num6, num7, 259, 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 < -1f || npc.velocity.X > 1f) - { - 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) - { - 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 > 10f) - { - npc.velocity.Y = 10f; - } - 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 void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - 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 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/AbyssNPCs/LaserfishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/LaserfishGlow").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.Yellow); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/LaserfishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); - } - } - } - - 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 < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish3"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class Laserfish : ModNPC + { + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laserfish"); + Main.npcFrameCount[npc.type] = 12; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 20; + npc.width = 60; + npc.height = 26; + npc.defense = 25; + npc.lifeMax = 240; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit51; + npc.DeathSound = SoundID.NPCDeath26; + npc.knockBackResist = 0.65f; + banner = npc.type; + bannerItem = mod.ItemType("LaserfishBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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 && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || + Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 200f : 400f) * + (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) + { + flag14 = true; + } + 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.15f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + if (npc.velocity.X > 4f) + { + npc.velocity.X = 4f; + } + if (npc.velocity.X < -4f) + { + npc.velocity.X = -4f; + } + if (npc.velocity.Y > 4f) + { + npc.velocity.Y = 4f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 120f) + { + 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(-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 = 40; + if (Main.expertMode) + { + damage = 30; + } + int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 15f : -15f), npc.Center.Y, num6, num7, 259, 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 < -1f || npc.velocity.X > 1f) + { + 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) + { + 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 > 10f) + { + npc.velocity.Y = 10f; + } + 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 void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + 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 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/AbyssNPCs/LaserfishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/LaserfishGlow").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.Yellow); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/LaserfishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); + } + } + } + + 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 < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish3"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/LuminousCorvina.cs b/NPCs/AbyssNPCs/LuminousCorvina.cs index dc3287e89e..d04ad31e5d 100644 --- a/NPCs/AbyssNPCs/LuminousCorvina.cs +++ b/NPCs/AbyssNPCs/LuminousCorvina.cs @@ -1,322 +1,322 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class LuminousCorvina : ModNPC - { - private bool hasBeenHit = false; - private int screamTimer = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Luminous Corvina"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 10; - npc.width = 74; - npc.height = 56; - npc.defense = 20; - npc.lifeMax = 800; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.85f; - banner = npc.type; - bannerItem = mod.ItemType("LuminousCorvinaBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(screamTimer); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - screamTimer = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); - } - - 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 ((Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height) && ((npc.Center.X - 15f < Main.player[npc.target].Center.X && - npc.direction == 1) || (npc.Center.X + 15f > Main.player[npc.target].Center.X && npc.direction == -1))) || - (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height) && flag14)) - { - ++screamTimer; - - if (screamTimer >= 300) - { - if (screamTimer == 300) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CorvinaScream"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != 2) - { - if (!Main.player[npc.target].dead && Main.player[npc.target].active) - { - Main.player[npc.target].AddBuff(mod.BuffType("FishAlert"), 360, true); - } - } - } - if (screamTimer >= 360) - { - screamTimer = 0; - } - return; - } - } - if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) - { - flag14 = false; - } - 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; - } - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) - { - 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) - { - 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 > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (screamTimer <= 300) - { - if (npc.frame.Y > frameHeight * 5) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frame.Y < frameHeight * 6) - { - npc.frame.Y = frameHeight * 6; - } - if (npc.frame.Y > frameHeight * 7) - { - npc.frame.Y = frameHeight * 6; - } - } - - } - - 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/AbyssNPCs/LuminousCorvinaGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/LuminousCorvinaGlow").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.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/LuminousCorvinaGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 180, true); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(8, 16)); - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); - } - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 139, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 139, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class LuminousCorvina : ModNPC + { + private bool hasBeenHit = false; + private int screamTimer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Luminous Corvina"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 10; + npc.width = 74; + npc.height = 56; + npc.defense = 20; + npc.lifeMax = 800; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 15, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.85f; + banner = npc.type; + bannerItem = mod.ItemType("LuminousCorvinaBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(screamTimer); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + screamTimer = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + } + + 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 ((Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height) && ((npc.Center.X - 15f < Main.player[npc.target].Center.X && + npc.direction == 1) || (npc.Center.X + 15f > Main.player[npc.target].Center.X && npc.direction == -1))) || + (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height) && flag14)) + { + ++screamTimer; + + if (screamTimer >= 300) + { + if (screamTimer == 300) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CorvinaScream"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != 2) + { + if (!Main.player[npc.target].dead && Main.player[npc.target].active) + { + Main.player[npc.target].AddBuff(mod.BuffType("FishAlert"), 360, true); + } + } + } + if (screamTimer >= 360) + { + screamTimer = 0; + } + return; + } + } + if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + { + flag14 = false; + } + 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; + } + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) + { + 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) + { + 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 > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (screamTimer <= 300) + { + if (npc.frame.Y > frameHeight * 5) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frame.Y < frameHeight * 6) + { + npc.frame.Y = frameHeight * 6; + } + if (npc.frame.Y > frameHeight * 7) + { + npc.frame.Y = frameHeight * 6; + } + } + + } + + 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/AbyssNPCs/LuminousCorvinaGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/LuminousCorvinaGlow").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.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/LuminousCorvinaGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 180, true); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(8, 16)); + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); + } + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 139, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 139, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/MantisShrimp.cs b/NPCs/AbyssNPCs/MantisShrimp.cs index af77c8e71c..11865465e9 100644 --- a/NPCs/AbyssNPCs/MantisShrimp.cs +++ b/NPCs/AbyssNPCs/MantisShrimp.cs @@ -1,130 +1,130 @@ -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.AbyssNPCs -{ - public class MantisShrimp : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mantis Shrimp"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 200; - npc.width = 40; - npc.height = 24; - npc.defense = 10; - npc.lifeMax = 30; - npc.aiStyle = 3; - aiType = 67; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[189] = true; - banner = npc.type; - bannerItem = mod.ItemType("MantisShrimpBanner"); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); - float num78 = 1f; - float num79 = (Main.player[npc.target].Center - npc.Center).Length(); - num79 *= 0.0025f; - if ((double)num79 > 1.5) - { - num79 = 1.5f; - } - if (Main.expertMode) - { - num78 = 3f - num79; - } - else - { - num78 = 2.5f - num79; - } - num78 *= 0.8f; - if (npc.velocity.X < -num78 || npc.velocity.X > num78) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num78 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + 1f; - if (npc.velocity.X > num78) - { - npc.velocity.X = num78; - } - } - else if (npc.velocity.X > -num78 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - 1f; - if (npc.velocity.X < -num78) - { - npc.velocity.X = -num78; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (Main.netMode != 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, 612, 0, 0f, Main.myPlayer); - } - } - - 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 float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OceanMonster.Chance * 0.2f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(5) == 0 && NPC.downedPlantBoss) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MantisClaws")); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 +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.AbyssNPCs +{ + public class MantisShrimp : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mantis Shrimp"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 200; + npc.width = 40; + npc.height = 24; + npc.defense = 10; + npc.lifeMax = 30; + npc.aiStyle = 3; + aiType = 67; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[189] = true; + banner = npc.type; + bannerItem = mod.ItemType("MantisShrimpBanner"); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); + float num78 = 1f; + float num79 = (Main.player[npc.target].Center - npc.Center).Length(); + num79 *= 0.0025f; + if ((double)num79 > 1.5) + { + num79 = 1.5f; + } + if (Main.expertMode) + { + num78 = 3f - num79; + } + else + { + num78 = 2.5f - num79; + } + num78 *= 0.8f; + if (npc.velocity.X < -num78 || npc.velocity.X > num78) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num78 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + 1f; + if (npc.velocity.X > num78) + { + npc.velocity.X = num78; + } + } + else if (npc.velocity.X > -num78 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - 1f; + if (npc.velocity.X < -num78) + { + npc.velocity.X = -num78; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (Main.netMode != 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, 612, 0, 0f, Main.myPlayer); + } + } + + 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 float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OceanMonster.Chance * 0.2f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(5) == 0 && NPC.downedPlantBoss) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MantisClaws")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/Mauler.cs b/NPCs/AbyssNPCs/Mauler.cs index bf361bc417..e4afec25f5 100644 --- a/NPCs/AbyssNPCs/Mauler.cs +++ b/NPCs/AbyssNPCs/Mauler.cs @@ -1,404 +1,404 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class Mauler : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mauler"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 135; - npc.width = 180; - npc.height = 90; - npc.defense = 50; - npc.lifeMax = 165000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath60; - npc.knockBackResist = 0f; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("MaulerBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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 && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < 300f) - { - flag14 = true; - } - if (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) - { - 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] += 1f; - } - else - { - if (npc.localAI[1] > 0f) - { - npc.localAI[1] -= 1f; - } - } - npc.localAI[2] += 1f; - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.5f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.25f; - if (npc.velocity.X > 22f) - { - npc.velocity.X = 22f; - } - if (npc.velocity.X < -22f) - { - npc.velocity.X = -22f; - } - if (npc.velocity.Y > 13f) - { - npc.velocity.Y = 13f; - } - if (npc.velocity.Y < -13f) - { - npc.velocity.Y = -13f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; - if (npc.velocity.X < -4f || npc.velocity.X > 4f) - { - 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) - { - 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 - { - npc.localAI[1] += 1f; - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 30f) - { - 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 = 50; - if (Main.expertMode) - { - damage = 45; - } - int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 60f : -60f), npc.Center.Y, num6, num7, mod.ProjectileType("SulphuricAcidMist"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - if (npc.velocity.Y == 0f) - { - if (Main.netMode != 1) - { - npc.velocity.Y = (float)Main.rand.Next(-200, -150) * 0.1f; //50 20 - npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f; //20 20 - npc.netUpdate = true; - } - } - npc.velocity.Y = npc.velocity.Y + 0.4f; //0.4 - if (npc.velocity.Y > 16f) - { - npc.velocity.Y = 16f; - } - npc.ai[0] = 1f; - } - if (hasBeenHit) - { - if (Main.rand.Next(300) == 0) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), (int)npc.position.X, (int)npc.position.Y); - } - } - if (npc.localAI[1] >= 255f || npc.localAI[2] >= 600f) - { - npc.localAI[2] = 0f; - BlowUp(); - return; - } - else if (npc.localAI[1] > 0f) - { - for (int k = 0; k < (int)((double)npc.localAI[1] * 0.05); k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 0, default(Color), 1f); - } - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public void BlowUp() - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 60); - if (Main.netMode != 1) - { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; - int damageBoom = (npc.localAI[1] >= 255f ? 200 : 50); - for (iBoom = 0; iBoom < 25; iBoom++) - { - int projectileType = (Main.rand.Next(2) == 0 ? mod.ProjectileType("SulphuricAcidMist") : mod.ProjectileType("SulphuricAcidCannon")); - offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - } - } - for (int num621 = 0; num621 < 25; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.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; - } - Main.dust[num622].noGravity = true; - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 3f); - 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, 5, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - if (npc.localAI[1] >= 255f) - { - npc.active = false; - } - npc.netUpdate = true; - } - - 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 OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(BuffID.Venom, 300, true); - player.AddBuff(BuffID.Rabies, 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - - public override void NPCLoot() - { - if (CalamityWorld.downedPolterghast) - { - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SulphuricAcidCannon")); - } - } - int item = Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false); - Main.item[item].color = new Color(151, 115, 57, 255); - NetMessage.SendData(88, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Mauler")) && - !NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) - { - if (!Main.hardMode) - { - return 0.001f; - } - if (!NPC.downedMoonlord) - { - return 0.01f; - } - return 0.1f; - } - return 0f; - } - - 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 < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler5"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class Mauler : ModNPC + { + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mauler"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 135; + npc.width = 180; + npc.height = 90; + npc.defense = 50; + npc.lifeMax = 165000; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath60; + npc.knockBackResist = 0f; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("MaulerBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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 && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + (Main.player[npc.target].Center - npc.Center).Length() < 300f) + { + flag14 = true; + } + if (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) + { + 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] += 1f; + } + else + { + if (npc.localAI[1] > 0f) + { + npc.localAI[1] -= 1f; + } + } + npc.localAI[2] += 1f; + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.5f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.25f; + if (npc.velocity.X > 22f) + { + npc.velocity.X = 22f; + } + if (npc.velocity.X < -22f) + { + npc.velocity.X = -22f; + } + if (npc.velocity.Y > 13f) + { + npc.velocity.Y = 13f; + } + if (npc.velocity.Y < -13f) + { + npc.velocity.Y = -13f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; + if (npc.velocity.X < -4f || npc.velocity.X > 4f) + { + 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) + { + 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 + { + npc.localAI[1] += 1f; + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 30f) + { + 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 = 50; + if (Main.expertMode) + { + damage = 45; + } + int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 60f : -60f), npc.Center.Y, num6, num7, mod.ProjectileType("SulphuricAcidMist"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if (npc.velocity.Y == 0f) + { + if (Main.netMode != 1) + { + npc.velocity.Y = (float)Main.rand.Next(-200, -150) * 0.1f; //50 20 + npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f; //20 20 + npc.netUpdate = true; + } + } + npc.velocity.Y = npc.velocity.Y + 0.4f; //0.4 + if (npc.velocity.Y > 16f) + { + npc.velocity.Y = 16f; + } + npc.ai[0] = 1f; + } + if (hasBeenHit) + { + if (Main.rand.Next(300) == 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), (int)npc.position.X, (int)npc.position.Y); + } + } + if (npc.localAI[1] >= 255f || npc.localAI[2] >= 600f) + { + npc.localAI[2] = 0f; + BlowUp(); + return; + } + else if (npc.localAI[1] > 0f) + { + for (int k = 0; k < (int)((double)npc.localAI[1] * 0.05); k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 0, default(Color), 1f); + } + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public void BlowUp() + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 60); + if (Main.netMode != 1) + { + Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + int damageBoom = (npc.localAI[1] >= 255f ? 200 : 50); + for (iBoom = 0; iBoom < 25; iBoom++) + { + int projectileType = (Main.rand.Next(2) == 0 ? mod.ProjectileType("SulphuricAcidMist") : mod.ProjectileType("SulphuricAcidCannon")); + offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; + int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + } + for (int num621 = 0; num621 < 25; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.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; + } + Main.dust[num622].noGravity = true; + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 3f); + 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, 5, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + if (npc.localAI[1] >= 255f) + { + npc.active = false; + } + npc.netUpdate = true; + } + + 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 OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 300, true); + player.AddBuff(BuffID.Venom, 300, true); + player.AddBuff(BuffID.Rabies, 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override void NPCLoot() + { + if (CalamityWorld.downedPolterghast) + { + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SulphuricAcidCannon")); + } + } + int item = Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false); + Main.item[item].color = new Color(151, 115, 57, 255); + NetMessage.SendData(88, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Mauler")) && + !NPC.AnyNPCs(mod.NPCType("AquaticScourgeHead"))) + { + if (!Main.hardMode) + { + return 0.001f; + } + if (!NPC.downedMoonlord) + { + return 0.01f; + } + return 0.1f; + } + return 0f; + } + + 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 < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler5"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/MirageJelly.cs b/NPCs/AbyssNPCs/MirageJelly.cs index d8baedde74..9376010ca3 100644 --- a/NPCs/AbyssNPCs/MirageJelly.cs +++ b/NPCs/AbyssNPCs/MirageJelly.cs @@ -1,253 +1,253 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class MirageJelly : ModNPC - { - private bool teleporting = false; - private bool rephasing = false; - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mirage Jelly"); - Main.npcFrameCount[npc.type] = 7; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.damage = 100; - npc.width = 70; - npc.height = 162; - npc.defense = 10; - npc.lifeMax = 6000; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; - bannerItem = mod.ItemType("MirageJellyBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(teleporting); - writer.Write(rephasing); - writer.Write(npc.chaseable); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - teleporting = reader.ReadBoolean(); - rephasing = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override void AI() - { - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - npc.velocity *= 0.985f; - if (npc.velocity.Y > -0.3f) - { - npc.velocity.Y = -3f; - } - if (npc.justHit) - { - if (Main.rand.Next(10) == 0) - { - teleporting = true; - } - hasBeenHit = true; - } - if (npc.ai[0] == 0f) - { - npc.chaseable = true; - npc.dontTakeDamage = false; - if (Main.netMode != 1) - { - if (teleporting) - { - teleporting = false; - npc.TargetClosest(true); - int num1249 = 0; - int num1250; - int num1251; - while (true) - { - num1249++; - num1250 = (int)player.Center.X / 16; - num1251 = (int)player.Center.Y / 16; - num1250 += Main.rand.Next(-50, 51); - num1251 += Main.rand.Next(-50, 51); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height) && - Main.tile[num1250, num1251].liquid > 204) - { - break; - } - if (num1249 > 100) - { - goto Block; - } - } - npc.ai[0] = 1f; - npc.ai[1] = (float)num1250; - npc.ai[2] = (float)num1251; - npc.netUpdate = true; - Block:; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.alpha += 5; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= 5; - if (npc.alpha <= 0) - { - npc.damage = Main.expertMode ? 160 : 80; - npc.chaseable = true; - npc.dontTakeDamage = false; - npc.alpha = 0; - npc.ai[0] = 0f; - npc.netUpdate = true; - } - } - } - - 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/AbyssNPCs/MirageJellyGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/MirageJellyGlow").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.Purple); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/MirageJellyGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.1f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); - } - } - 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")); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); - } - 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("VitalJelly")); - } - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); - } - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 240, true); - player.AddBuff(BuffID.Electrified, 60, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class MirageJelly : ModNPC + { + private bool teleporting = false; + private bool rephasing = false; + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mirage Jelly"); + Main.npcFrameCount[npc.type] = 7; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.damage = 100; + npc.width = 70; + npc.height = 162; + npc.defense = 10; + npc.lifeMax = 6000; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 25, 0); + npc.HitSound = SoundID.NPCHit25; + npc.DeathSound = SoundID.NPCDeath28; + banner = npc.type; + bannerItem = mod.ItemType("MirageJellyBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(teleporting); + writer.Write(rephasing); + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + teleporting = reader.ReadBoolean(); + rephasing = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void AI() + { + npc.TargetClosest(true); + Player player = Main.player[npc.target]; + npc.velocity *= 0.985f; + if (npc.velocity.Y > -0.3f) + { + npc.velocity.Y = -3f; + } + if (npc.justHit) + { + if (Main.rand.Next(10) == 0) + { + teleporting = true; + } + hasBeenHit = true; + } + if (npc.ai[0] == 0f) + { + npc.chaseable = true; + npc.dontTakeDamage = false; + if (Main.netMode != 1) + { + if (teleporting) + { + teleporting = false; + npc.TargetClosest(true); + int num1249 = 0; + int num1250; + int num1251; + while (true) + { + num1249++; + num1250 = (int)player.Center.X / 16; + num1251 = (int)player.Center.Y / 16; + num1250 += Main.rand.Next(-50, 51); + num1251 += Main.rand.Next(-50, 51); + if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height) && + Main.tile[num1250, num1251].liquid > 204) + { + break; + } + if (num1249 > 100) + { + goto Block; + } + } + npc.ai[0] = 1f; + npc.ai[1] = (float)num1250; + npc.ai[2] = (float)num1251; + npc.netUpdate = true; + Block:; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.alpha += 5; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.alpha -= 5; + if (npc.alpha <= 0) + { + npc.damage = Main.expertMode ? 160 : 80; + npc.chaseable = true; + npc.dontTakeDamage = false; + npc.alpha = 0; + npc.ai[0] = 0f; + npc.netUpdate = true; + } + } + } + + 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/AbyssNPCs/MirageJellyGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/MirageJellyGlow").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.Purple); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/MirageJellyGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.1f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(5, 8)); + } + } + 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")); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); + } + 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("VitalJelly")); + } + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); + } + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 240, true); + player.AddBuff(BuffID.Electrified, 60, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/MorayEel.cs b/NPCs/AbyssNPCs/MorayEel.cs index 7e69f4e267..fb2daad89f 100644 --- a/NPCs/AbyssNPCs/MorayEel.cs +++ b/NPCs/AbyssNPCs/MorayEel.cs @@ -1,289 +1,289 @@ -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.AbyssNPCs -{ - public class MorayEel : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moray Eel"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 45; - npc.width = 136; - npc.height = 40; - npc.defense = 8; - npc.lifeMax = 180; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.75f; - banner = npc.type; - bannerItem = mod.ItemType("MorayEelBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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 && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || - Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 250f : 300f) * - (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) - { - flag14 = true; - } - 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.15f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; - if (npc.velocity.X > 6f) - { - npc.velocity.X = 6f; - } - if (npc.velocity.X < -6f) - { - npc.velocity.X = -6f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - else - { - 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.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) - { - 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.4f; - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = 12f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - - 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 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/AbyssNPCs/MorayEelGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/MorayEelGlow").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.Gold); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/MorayEelGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 90, true); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return SpawnCondition.OceanMonster.Chance * 0.1f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Flipper); - } - } - - 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 < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class MorayEel : ModNPC + { + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moray Eel"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 45; + npc.width = 136; + npc.height = 40; + npc.defense = 8; + npc.lifeMax = 180; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.75f; + banner = npc.type; + bannerItem = mod.ItemType("MorayEelBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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 && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || + Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 250f : 300f) * + (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) + { + flag14 = true; + } + 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.15f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; + if (npc.velocity.X > 6f) + { + npc.velocity.X = 6f; + } + if (npc.velocity.X < -6f) + { + npc.velocity.X = -6f; + } + if (npc.velocity.Y > 4f) + { + npc.velocity.Y = 4f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + else + { + 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.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) + { + 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.4f; + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = 12f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + + 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 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/AbyssNPCs/MorayEelGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/MorayEelGlow").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.Gold); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/MorayEelGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(BuffID.Venom, 90, true); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return SpawnCondition.OceanMonster.Chance * 0.1f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Flipper); + } + } + + 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 < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/OarfishBody.cs b/NPCs/AbyssNPCs/OarfishBody.cs index 4ba46daf1e..baa9d9af7b 100644 --- a/NPCs/AbyssNPCs/OarfishBody.cs +++ b/NPCs/AbyssNPCs/OarfishBody.cs @@ -1,296 +1,296 @@ -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.AbyssNPCs -{ - public class OarfishBody : ModNPC - { - public float speed = 3f; //10 - public float turnSpeed = 0.05f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oarfish"); - } - - public override void SetDefaults() - { - npc.damage = 20; //70 - npc.width = 16; //28 - npc.height = 16; //28 - npc.defense = 20; - npc.lifeMax = 2000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - banner = mod.NPCType("OarfishHead"); - bannerItem = mod.ItemType("OarfishBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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("OarfishHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class OarfishBody : ModNPC + { + public float speed = 3f; //10 + public float turnSpeed = 0.05f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oarfish"); + } + + public override void SetDefaults() + { + npc.damage = 20; //70 + npc.width = 16; //28 + npc.height = 16; //28 + npc.defense = 20; + npc.lifeMax = 2000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + banner = mod.NPCType("OarfishHead"); + bannerItem = mod.ItemType("OarfishBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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("OarfishHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/OarfishHead.cs b/NPCs/AbyssNPCs/OarfishHead.cs index 298b46f74f..59c6afbf7b 100644 --- a/NPCs/AbyssNPCs/OarfishHead.cs +++ b/NPCs/AbyssNPCs/OarfishHead.cs @@ -1,453 +1,453 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class OarfishHead : ModNPC - { - public bool flies = true; - public const int minLength = 40; - public const int maxLength = 41; - public float speed = 3f; //10 - public float turnSpeed = 0.05f; //0.15 - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oarfish"); - } - - public override void SetDefaults() - { - npc.damage = 30; - npc.width = 16; //36 - npc.height = 16; //20 - npc.defense = 10; - npc.lifeMax = 2000; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - banner = npc.type; - bannerItem = mod.ItemType("OarfishBanner"); - } - - public override void AI() - { - 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 (Main.netMode != 1) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("OarfishBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("OarfishTail"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - } - 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 (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - npc.localAI[1] = 0f; - bool canFly = flies; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(mod.NPCType("OarfishTail"))) - { - npc.active = 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 200); //800 - if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || - Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 150f : 250f) * - (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 300f; - } - else - { - num191 = Main.player[npc.target].Center.X - 300f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || - Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 150f : 250f) * - (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(3, 6)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != 1) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == 2) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 90); - player.AddBuff(mod.BuffType("Horror"), 90, true); - } - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class OarfishHead : ModNPC + { + public bool flies = true; + public const int minLength = 40; + public const int maxLength = 41; + public float speed = 3f; //10 + public float turnSpeed = 0.05f; //0.15 + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oarfish"); + } + + public override void SetDefaults() + { + npc.damage = 30; + npc.width = 16; //36 + npc.height = 16; //20 + npc.defense = 10; + npc.lifeMax = 2000; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + banner = npc.type; + bannerItem = mod.ItemType("OarfishBanner"); + } + + public override void AI() + { + 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 (Main.netMode != 1) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("OarfishBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("OarfishTail"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + 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 (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + npc.localAI[1] = 0f; + bool canFly = flies; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(mod.NPCType("OarfishTail"))) + { + npc.active = 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 200); //800 + if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || + Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 150f : 250f) * + (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 300f; + } + else + { + num191 = Main.player[npc.target].Center.X - 300f; + } + } + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || + Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 150f : 250f) * + (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("OarfishHead"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(3, 6)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override bool CheckActive() + { + if (npc.timeLeft <= 0 && Main.netMode != 1) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == 2) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 90); + player.AddBuff(mod.BuffType("Horror"), 90, true); + } + } + } +} diff --git a/NPCs/AbyssNPCs/OarfishTail.cs b/NPCs/AbyssNPCs/OarfishTail.cs index 891fd7e9ab..752afb6222 100644 --- a/NPCs/AbyssNPCs/OarfishTail.cs +++ b/NPCs/AbyssNPCs/OarfishTail.cs @@ -1,296 +1,296 @@ -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.AbyssNPCs -{ - public class OarfishTail : ModNPC - { - public float speed = 3f; //10 - public float turnSpeed = 0.05f; //0.15 - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oarfish"); - } - - public override void SetDefaults() - { - npc.damage = 10; //70 - npc.width = 14; //28 - npc.height = 16; //28 - npc.defense = 30; - npc.lifeMax = 2000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - banner = mod.NPCType("OarfishHead"); - bannerItem = mod.ItemType("OarfishBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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("OarfishHead"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class OarfishTail : ModNPC + { + public float speed = 3f; //10 + public float turnSpeed = 0.05f; //0.15 + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oarfish"); + } + + public override void SetDefaults() + { + npc.damage = 10; //70 + npc.width = 14; //28 + npc.height = 16; //28 + npc.defense = 30; + npc.lifeMax = 2000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + banner = mod.NPCType("OarfishHead"); + bannerItem = mod.ItemType("OarfishBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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("OarfishHead"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/Reaper.cs b/NPCs/AbyssNPCs/Reaper.cs index d6ba1de1ac..1e46b2eaad 100644 --- a/NPCs/AbyssNPCs/Reaper.cs +++ b/NPCs/AbyssNPCs/Reaper.cs @@ -1,712 +1,712 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class Reaper : ModNPC - { - public bool hasBeenHit = false; - public bool reset = false; - public bool reset2 = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaper Shark"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 6f; - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 160; - npc.width = 280; - npc.height = 150; - npc.defense = 70; - npc.lifeMax = 190000; - npc.aiStyle = -1; - 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.timeLeft = NPC.activeTime * 30; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; - npc.knockBackResist = 0f; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("ReaperSharkBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(reset); - writer.Write(reset2); - writer.Write(hasBeenHit); - writer.Write(npc.localAI[0]); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - reset = reader.ReadBoolean(); - reset2 = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !Main.player[npc.target].GetModPlayer(mod).ZoneAbyss) - { - npc.active = false; - } - bool phase1 = (double)npc.life > (double)npc.lifeMax * 0.5; - bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.5; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.1; - npc.chaseable = hasBeenHit; - if (npc.soundDelay <= 0) - { - npc.soundDelay = 360; - if (hasBeenHit) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y); - } - else - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperSearchRoar"), (int)npc.position.X, (int)npc.position.Y); - } - } - if (phase3 || phase1) - { - if (!reset2 && phase3) - { - npc.damage /= 2; - npc.noTileCollide = true; - npc.netAlways = true; - npc.localAI[0] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = -16f; - npc.ai[3] = 0f; - reset2 = true; - npc.netUpdate = true; - } - npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); - int num = 200; - if (npc.ai[2] == 0f) - { - npc.localAI[0] += 1f; - npc.alpha = num; - npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f) - { - npc.ai[2] = -16f; - } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit || npc.localAI[0] >= 420f) - { - npc.ai[2] = -16f; - } - return; - } - if (npc.ai[2] < 0f) - { - if (npc.alpha > 0) - { - npc.alpha -= num / 16; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); - } - return; - } - if (npc.ai[2] == 1f) - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet || npc.noTileCollide) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if ((!Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || - Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 300f : 500f) * - (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) || - npc.justHit) - { - hasBeenHit = true; - } - if (!flag14) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.noTileCollide = false; - } - 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) - { - if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - 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.ai[3] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[3] == 0f) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 90f) - { - npc.ai[3] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - if (npc.ai[3] == 0f) - { - npc.noTileCollide = false; - } - else - { - npc.noTileCollide = true; - } - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.3f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; - float speedX = (phase3 ? 3f : 12f); - float speedY = (phase3 ? 2.25f : 9f); - if (npc.velocity.X > speedX) - { - npc.velocity.X = speedX; - } - if (npc.velocity.X < -speedX) - { - npc.velocity.X = -speedX; - } - if (npc.velocity.Y > speedY) - { - npc.velocity.Y = speedY; - } - if (npc.velocity.Y < -speedY) - { - npc.velocity.Y = -speedY; - } - } - else - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.noTileCollide = false; - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; - if (npc.velocity.X < -4f || npc.velocity.X > 4f) - { - 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) - { - 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) - { - if (Main.netMode != 1) - { - npc.velocity.Y = (float)Main.rand.Next(-250, -180) * 0.1f; //50 20 - npc.velocity.X = (float)Main.rand.Next(-50, 50) * 0.1f; //20 20 - npc.netUpdate = true; - } - } - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.velocity.Y > 16f) - { - npc.velocity.Y = 16f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - } - else if (phase2) - { - if (!reset) - { - npc.noTileCollide = true; - npc.netAlways = true; - npc.localAI[0] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - reset = true; - npc.netUpdate = true; - } - bool expertMode = Main.expertMode; - int num2 = 30; - float num3 = expertMode ? 0.4f : 0.35f; - float scaleFactor = expertMode ? 6f : 5.5f; - int num4 = expertMode ? 28 : 30; - float num5 = expertMode ? 12f : 11f; - int num9 = 90; - int num16 = 75; - 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; - } - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != 1) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - 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; - } - if (npc.ai[0] == -1f) - { - num17 = 0f; - } - 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] != -1f) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.alpha += 15; - } - else - { - npc.alpha -= 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - if (npc.ai[0] == -1f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity *= 0.98f; - int num19 = Math.Sign(player.Center.X - vector.X); - if (num19 != 0) - { - npc.direction = num19; - npc.spriteDirection = -npc.direction; - } - if (npc.ai[2] > 20f) - { - npc.velocity.Y = -2f; - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.alpha += 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - if (npc.ai[2] == (float)(num9 - 30)) - { - int num20 = 36; - for (int i = 0; i < num20; i++) - { - Vector2 expr_80F = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + npc.Center; - Vector2 vector2 = expr_80F - npc.Center; - int num21 = Dust.NewDust(expr_80F + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num21].noGravity = true; - Main.dust[num21].noLight = true; - Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; - } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num16) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 0f && !player.dead) - { - npc.dontTakeDamage = false; - npc.chaseable = true; - 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) - { - int num24 = 7; - for (int j = 0; j < num24; j++) - { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default(Vector2)) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num4) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - } - } - } - - 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 OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Darkness, 300, true); - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(BuffID.Rabies, 300, true); - player.AddBuff(mod.BuffType("CrushDepth"), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - player.AddBuff(mod.BuffType("Horror"), 120, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper")) && - !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper"))) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return 0f; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(40, 51)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland"), Main.rand.Next(2, 4)); - if (Main.rand.Next(10000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (CalamityWorld.downedPolterghast) - { - 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) - { - 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) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(10, 18)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(4, 6)); - } - } - } - - 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 < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class Reaper : ModNPC + { + public bool hasBeenHit = false; + public bool reset = false; + public bool reset2 = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaper Shark"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 6f; + npc.noGravity = true; + npc.lavaImmune = true; + npc.damage = 160; + npc.width = 280; + npc.height = 150; + npc.defense = 70; + npc.lifeMax = 190000; + npc.aiStyle = -1; + 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.timeLeft = NPC.activeTime * 30; + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.HitSound = SoundID.NPCHit56; + npc.DeathSound = SoundID.NPCDeath60; + npc.knockBackResist = 0f; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("ReaperSharkBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(reset); + writer.Write(reset2); + writer.Write(hasBeenHit); + writer.Write(npc.localAI[0]); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + reset = reader.ReadBoolean(); + reset2 = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !Main.player[npc.target].GetModPlayer(mod).ZoneAbyss) + { + npc.active = false; + } + bool phase1 = (double)npc.life > (double)npc.lifeMax * 0.5; + bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.5; + bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.1; + npc.chaseable = hasBeenHit; + if (npc.soundDelay <= 0) + { + npc.soundDelay = 360; + if (hasBeenHit) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y); + } + else + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperSearchRoar"), (int)npc.position.X, (int)npc.position.Y); + } + } + if (phase3 || phase1) + { + if (!reset2 && phase3) + { + npc.damage /= 2; + npc.noTileCollide = true; + npc.netAlways = true; + npc.localAI[0] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = -16f; + npc.ai[3] = 0f; + reset2 = true; + npc.netUpdate = true; + } + npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); + int num = 200; + if (npc.ai[2] == 0f) + { + npc.localAI[0] += 1f; + npc.alpha = num; + npc.TargetClosest(true); + if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f) + { + npc.ai[2] = -16f; + } + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit || npc.localAI[0] >= 420f) + { + npc.ai[2] = -16f; + } + return; + } + if (npc.ai[2] < 0f) + { + if (npc.alpha > 0) + { + npc.alpha -= num / 16; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] == 0f) + { + npc.ai[2] = 1f; + npc.velocity.X = (float)(npc.direction * 2); + } + return; + } + if (npc.ai[2] == 1f) + { + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet || npc.noTileCollide) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if ((!Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || + Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 300f : 500f) * + (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) || + npc.justHit) + { + hasBeenHit = true; + } + if (!flag14) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.noTileCollide = false; + } + 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) + { + if (npc.ai[3] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + 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.ai[3] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[3] == 0f) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 90f) + { + npc.ai[3] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + if (npc.ai[3] == 0f) + { + npc.noTileCollide = false; + } + else + { + npc.noTileCollide = true; + } + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.3f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; + float speedX = (phase3 ? 3f : 12f); + float speedY = (phase3 ? 2.25f : 9f); + if (npc.velocity.X > speedX) + { + npc.velocity.X = speedX; + } + if (npc.velocity.X < -speedX) + { + npc.velocity.X = -speedX; + } + if (npc.velocity.Y > speedY) + { + npc.velocity.Y = speedY; + } + if (npc.velocity.Y < -speedY) + { + npc.velocity.Y = -speedY; + } + } + else + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.noTileCollide = false; + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; + if (npc.velocity.X < -4f || npc.velocity.X > 4f) + { + 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) + { + 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) + { + if (Main.netMode != 1) + { + npc.velocity.Y = (float)Main.rand.Next(-250, -180) * 0.1f; //50 20 + npc.velocity.X = (float)Main.rand.Next(-50, 50) * 0.1f; //20 20 + npc.netUpdate = true; + } + } + npc.velocity.Y = npc.velocity.Y + 0.4f; + if (npc.velocity.Y > 16f) + { + npc.velocity.Y = 16f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + } + else if (phase2) + { + if (!reset) + { + npc.noTileCollide = true; + npc.netAlways = true; + npc.localAI[0] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + reset = true; + npc.netUpdate = true; + } + bool expertMode = Main.expertMode; + int num2 = 30; + float num3 = expertMode ? 0.4f : 0.35f; + float scaleFactor = expertMode ? 6f : 5.5f; + int num4 = expertMode ? 28 : 30; + float num5 = expertMode ? 12f : 11f; + int num9 = 90; + int num16 = 75; + 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; + } + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != 1) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + 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; + } + if (npc.ai[0] == -1f) + { + num17 = 0f; + } + 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] != -1f) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.alpha += 15; + } + else + { + npc.alpha -= 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + if (npc.ai[0] == -1f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.velocity *= 0.98f; + int num19 = Math.Sign(player.Center.X - vector.X); + if (num19 != 0) + { + npc.direction = num19; + npc.spriteDirection = -npc.direction; + } + if (npc.ai[2] > 20f) + { + npc.velocity.Y = -2f; + npc.alpha -= 5; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.alpha += 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + if (npc.ai[2] == (float)(num9 - 30)) + { + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 expr_80F = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + npc.Center; + Vector2 vector2 = expr_80F - npc.Center; + int num21 = Dust.NewDust(expr_80F + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num21].noGravity = true; + Main.dust[num21].noLight = true; + Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; + } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num16) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 0f && !player.dead) + { + npc.dontTakeDamage = false; + npc.chaseable = true; + 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) + { + int num24 = 7; + for (int j = 0; j < num24; j++) + { + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default(Vector2)) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num25].noGravity = true; + Main.dust[num25].noLight = true; + Main.dust[num25].velocity /= 4f; + Main.dust[num25].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num4) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + } + } + } + + 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 OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Darkness, 300, true); + player.AddBuff(BuffID.Bleeding, 300, true); + player.AddBuff(BuffID.Rabies, 300, true); + player.AddBuff(mod.BuffType("CrushDepth"), 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + player.AddBuff(mod.BuffType("Horror"), 120, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper")) && + !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper"))) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return 0f; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Voidstone"), Main.rand.Next(40, 51)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland"), Main.rand.Next(2, 4)); + if (Main.rand.Next(10000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (CalamityWorld.downedPolterghast) + { + 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) + { + 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) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(10, 18)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(4, 6)); + } + } + } + + 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 < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/SeaUrchin.cs b/NPCs/AbyssNPCs/SeaUrchin.cs index 430beec79f..2691173e0d 100644 --- a/NPCs/AbyssNPCs/SeaUrchin.cs +++ b/NPCs/AbyssNPCs/SeaUrchin.cs @@ -1,353 +1,353 @@ -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; -using CalamityMod; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class SeaUrchin : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Urchin"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 20; - npc.width = 40; //324 - npc.height = 40; //216 - npc.defense = 10; - npc.lifeMax = 30; - npc.knockBackResist = 0.8f; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath15; - npc.behindTiles = true; - banner = npc.type; - bannerItem = mod.ItemType("SeaUrchinBanner"); - } - - public override void AI() - { - int num = 30; - int num2 = 10; - bool flag = false; - bool flag2 = false; - bool flag3 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag2 = true; - npc.ai[3] += 1f; - } - num2 = 4; - bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - } - } - if (flag4) - { - npc.velocity.Y = 0f; - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) - { - npc.ai[3] += 1f; - flag3 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num * num2)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num) - { - npc.netUpdate = true; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num4 = Main.player[npc.target].position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - if (num5 < 200f && !flag3) - { - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - (npc.wet ? 12f : 4f); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default(Color), 1f); - } - } - if (npc.ai[3] < (float)num) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num7 = 6f; - float num8 = 0.07f; - if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) - { - if (Math.Sign(npc.velocity.X) != npc.direction) - { - npc.velocity.X = npc.velocity.X * 0.92f; - } - num7 = 5f; - num8 = 0.2f; - if (npc.velocity.X < -num7 || npc.velocity.X > num7) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num7 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X > num7) - { - npc.velocity.X = num7; - } - } - else if (npc.velocity.X > -num7 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X < -num7) - { - npc.velocity.X = -num7; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num10 = 0; - if (npc.velocity.X < 0f) - { - num10 = -1; - } - if (npc.velocity.X > 0f) - { - num10 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); - int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num11, num12] == null) - { - Main.tile[num11, num12] = new Tile(); - } - if (Main.tile[num11, num12 - 1] == null) - { - Main.tile[num11, num12 - 1] = new Tile(); - } - if (Main.tile[num11, num12 - 2] == null) - { - Main.tile[num11, num12 - 2] = new Tile(); - } - if (Main.tile[num11, num12 - 3] == null) - { - Main.tile[num11, num12 - 3] = new Tile(); - } - if (Main.tile[num11, num12 + 1] == null) - { - Main.tile[num11, num12 + 1] = new Tile(); - } - if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) - { - float num13 = (float)(num12 * 16); - if (Main.tile[num11, num12].halfBrick()) - { - num13 += 8f; - } - if (Main.tile[num11, num12 - 1].halfBrick()) - { - num13 -= 8f; - } - if (num13 < position.Y + (float)npc.height) - { - float num14 = position.Y + (float)npc.height - num13; - if ((double)num14 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num13; - npc.position.Y = num13 - (float)npc.height; - if (num14 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num15, num16] == null) - { - Main.tile[num15, num16] = new Tile(); - } - if (Main.tile[num15, num16 - 1] == null) - { - Main.tile[num15, num16 - 1] = new Tile(); - } - if (Main.tile[num15, num16 - 2] == null) - { - Main.tile[num15, num16 - 2] = new Tile(); - } - if (Main.tile[num15, num16 - 3] == null) - { - Main.tile[num15, num16 - 3] = new Tile(); - } - if (Main.tile[num15, num16 + 1] == null) - { - Main.tile[num15, num16 + 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 - 1] == null) - { - Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 + 1] == null) - { - Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); - } - if (Main.tile[num15 - npc.direction, num16 + 1] == null) - { - Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); - } - int num17 = npc.spriteDirection; - num17 *= -1; - if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) - { - float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) - { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) - { - npc.velocity.Y = (npc.wet ? -17f : -8.5f); - npc.netUpdate = true; - } - else - { - npc.velocity.Y = (npc.wet ? -15f : -7.5f); - npc.netUpdate = true; - } - } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) - { - npc.velocity.Y = (npc.wet ? -14f : -7f); - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) - { - npc.velocity.Y = (npc.wet ? -12f : -6f); - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) - { - npc.velocity.Y = (npc.wet ? -16f : -8f); - npc.netUpdate = true; - } - } - } - npc.rotation += npc.velocity.X * 0.05f; - npc.spriteDirection = -npc.direction; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Venom, 120, true); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OceanMonster.Chance * 0.2f; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UrchinStinger"), Main.rand.Next(15, 26)); - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class SeaUrchin : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Urchin"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 20; + npc.width = 40; //324 + npc.height = 40; //216 + npc.defense = 10; + npc.lifeMax = 30; + npc.knockBackResist = 0.8f; + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath15; + npc.behindTiles = true; + banner = npc.type; + bannerItem = mod.ItemType("SeaUrchinBanner"); + } + + public override void AI() + { + int num = 30; + int num2 = 10; + bool flag = false; + bool flag2 = false; + bool flag3 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag2 = true; + npc.ai[3] += 1f; + } + num2 = 4; + bool flag4 = npc.velocity.Y == 0f; + for (int i = 0; i < 200; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + } + } + if (flag4) + { + npc.velocity.Y = 0f; + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) + { + npc.ai[3] += 1f; + flag3 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num * num2)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num) + { + npc.netUpdate = true; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num4 = Main.player[npc.target].position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + if (num5 < 200f && !flag3) + { + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - (npc.wet ? 12f : 4f); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default(Color), 1f); + } + } + if (npc.ai[3] < (float)num) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num7 = 6f; + float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) + { + if (Math.Sign(npc.velocity.X) != npc.direction) + { + npc.velocity.X = npc.velocity.X * 0.92f; + } + num7 = 5f; + num8 = 0.2f; + if (npc.velocity.X < -num7 || npc.velocity.X > num7) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num7 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X > num7) + { + npc.velocity.X = num7; + } + } + else if (npc.velocity.X > -num7 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X < -num7) + { + npc.velocity.X = -num7; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num10 = 0; + if (npc.velocity.X < 0f) + { + num10 = -1; + } + if (npc.velocity.X > 0f) + { + num10 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); + int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num11, num12] == null) + { + Main.tile[num11, num12] = new Tile(); + } + if (Main.tile[num11, num12 - 1] == null) + { + Main.tile[num11, num12 - 1] = new Tile(); + } + if (Main.tile[num11, num12 - 2] == null) + { + Main.tile[num11, num12 - 2] = new Tile(); + } + if (Main.tile[num11, num12 - 3] == null) + { + Main.tile[num11, num12 - 3] = new Tile(); + } + if (Main.tile[num11, num12 + 1] == null) + { + Main.tile[num11, num12 + 1] = new Tile(); + } + if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) + { + float num13 = (float)(num12 * 16); + if (Main.tile[num11, num12].halfBrick()) + { + num13 += 8f; + } + if (Main.tile[num11, num12 - 1].halfBrick()) + { + num13 -= 8f; + } + if (num13 < position.Y + (float)npc.height) + { + float num14 = position.Y + (float)npc.height - num13; + if ((double)num14 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num13; + npc.position.Y = num13 - (float)npc.height; + if (num14 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num15, num16] == null) + { + Main.tile[num15, num16] = new Tile(); + } + if (Main.tile[num15, num16 - 1] == null) + { + Main.tile[num15, num16 - 1] = new Tile(); + } + if (Main.tile[num15, num16 - 2] == null) + { + Main.tile[num15, num16 - 2] = new Tile(); + } + if (Main.tile[num15, num16 - 3] == null) + { + Main.tile[num15, num16 - 3] = new Tile(); + } + if (Main.tile[num15, num16 + 1] == null) + { + Main.tile[num15, num16 + 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 - 1] == null) + { + Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 + 1] == null) + { + Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); + } + if (Main.tile[num15 - npc.direction, num16 + 1] == null) + { + Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); + } + int num17 = npc.spriteDirection; + num17 *= -1; + if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) + { + float num18 = 3f; + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + { + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + { + npc.velocity.Y = (npc.wet ? -17f : -8.5f); + npc.netUpdate = true; + } + else + { + npc.velocity.Y = (npc.wet ? -15f : -7.5f); + npc.netUpdate = true; + } + } + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + { + npc.velocity.Y = (npc.wet ? -14f : -7f); + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + { + npc.velocity.Y = (npc.wet ? -12f : -6f); + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + { + npc.velocity.Y = (npc.wet ? -16f : -8f); + npc.netUpdate = true; + } + } + } + npc.rotation += npc.velocity.X * 0.05f; + npc.spriteDirection = -npc.direction; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Venom, 120, true); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OceanMonster.Chance * 0.2f; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UrchinStinger"), Main.rand.Next(15, 26)); + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/ToxicMinnow.cs b/NPCs/AbyssNPCs/ToxicMinnow.cs index b335f4c342..518c82bff1 100644 --- a/NPCs/AbyssNPCs/ToxicMinnow.cs +++ b/NPCs/AbyssNPCs/ToxicMinnow.cs @@ -1,295 +1,295 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class ToxicMinnow : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Toxic Minnow"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 20; - npc.width = 80; - npc.height = 40; - npc.defense = 20; - npc.lifeMax = 240; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.15f; - banner = npc.type; - bannerItem = mod.ItemType("ToxicMinnowBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - npc.TargetClosest(false); - 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; - } - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) - { - 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) - { - 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 > 3f) - { - npc.velocity.Y = 3f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override bool CheckDead() - { - Main.PlaySound(4, (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.width = (npc.height = 40); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - if (Main.netMode != 1) - { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; - int damageBoom = 30; - for (iBoom = 0; iBoom < 5; iBoom++) - { - int projectileType = mod.ProjectileType("ToxicMinnowCloud"); - offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.netUpdate = true; - return true; - } - - 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/AbyssNPCs/ToxicMinnowGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ToxicMinnowGlow").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.LightGreen); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ToxicMinnowGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("CrushDepth"), 120, true); - } - - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 40, 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, 40, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class ToxicMinnow : ModNPC + { + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxic Minnow"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 20; + npc.width = 80; + npc.height = 40; + npc.defense = 20; + npc.lifeMax = 240; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.15f; + banner = npc.type; + bannerItem = mod.ItemType("ToxicMinnowBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + npc.TargetClosest(false); + 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; + } + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -0.2f || npc.velocity.X > 0.2f) + { + 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) + { + 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 > 3f) + { + npc.velocity.Y = 3f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override bool CheckDead() + { + Main.PlaySound(4, (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.width = (npc.height = 40); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + if (Main.netMode != 1) + { + Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + int damageBoom = 30; + for (iBoom = 0; iBoom < 5; iBoom++) + { + int projectileType = mod.ProjectileType("ToxicMinnowCloud"); + offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; + int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.netUpdate = true; + return true; + } + + 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/AbyssNPCs/ToxicMinnowGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ToxicMinnowGlow").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.LightGreen); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ToxicMinnowGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("CrushDepth"), 120, true); + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.9f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(2, 4)); + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 40, 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, 40, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/AbyssNPCs/Trasher.cs b/NPCs/AbyssNPCs/Trasher.cs index 787e9ae446..015aa743bf 100644 --- a/NPCs/AbyssNPCs/Trasher.cs +++ b/NPCs/AbyssNPCs/Trasher.cs @@ -1,387 +1,387 @@ -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.AbyssNPCs -{ - public class Trasher : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trasher"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 50; - npc.width = 150; - npc.height = 40; - npc.defense = 22; - npc.lifeMax = 200; - npc.aiStyle = -1; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 0, 3, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath5; - npc.knockBackResist = 0f; - banner = npc.type; - bannerItem = mod.ItemType("TrasherBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); - npc.chaseable = hasBeenHit; - if (npc.justHit) - { - hasBeenHit = true; - } - if (npc.wet) - { - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - npc.noTileCollide = false; - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < 200f) - { - flag14 = true; - } - if (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.3f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; - if (npc.velocity.X > 10f) - { - npc.velocity.X = 10f; - } - if (npc.velocity.X < -10f) - { - npc.velocity.X = -10f; - } - if (npc.velocity.Y > 5f) - { - npc.velocity.Y = 5f; - } - if (npc.velocity.Y < -5f) - { - npc.velocity.Y = -5f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1.5f || npc.velocity.X > 1.5f) - { - 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) - { - 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 (Collision.WetCollision(npc.position, npc.width, npc.height)) - { - npc.noTileCollide = false; - npc.netUpdate = true; - return; - } - npc.noTileCollide = true; - float num823 = 1f; - npc.TargetClosest(true); - bool flag51 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num823 = 1.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num823 = 2.5f; - } - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 20f) - { - 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 - { - 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; - } - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.05f; - 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 void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 1.25 : 1.0); - if (npc.frameCounter < 6.0) - { - npc.frame.Y = 0; - } - else if (npc.frameCounter < 12.0) - { - npc.frame.Y = frameHeight; - } - else if (npc.frameCounter < 18.0) - { - npc.frame.Y = frameHeight * 2; - } - else if (npc.frameCounter < 24.0) - { - npc.frame.Y = frameHeight * 3; - } - else - { - npc.frameCounter = 0.0; - npc.frame.Y = 0; - } - if (!npc.wet) - { - npc.frame.Y = npc.frame.Y + frameHeight * 4; - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur || (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water)) - { - return 0.1f; - } - return 0f; - } - - public override void NPCLoot() - { - if (!NPC.savedAngler && !NPC.AnyNPCs(NPCID.Angler) && !NPC.AnyNPCs(NPCID.SleepingAngler) && Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Angler, 0, 0f, 0f, 0f, 0f, 255); - NPC.savedAngler = true; - } - if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrashmanTrashcan")); - } - if (Main.rand.Next(10) == 0 && Main.hardMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gatligator); - } - } - - 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 < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher2"), 1f); - } - } - } -} \ No newline at end of file +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.AbyssNPCs +{ + public class Trasher : ModNPC + { + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trasher"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 50; + npc.width = 150; + npc.height = 40; + npc.defense = 22; + npc.lifeMax = 200; + npc.aiStyle = -1; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 0, 3, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath5; + npc.knockBackResist = 0f; + banner = npc.type; + bannerItem = mod.ItemType("TrasherBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? -1 : 1); + npc.chaseable = hasBeenHit; + if (npc.justHit) + { + hasBeenHit = true; + } + if (npc.wet) + { + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + npc.noTileCollide = false; + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + (Main.player[npc.target].Center - npc.Center).Length() < 200f) + { + flag14 = true; + } + if (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.3f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; + if (npc.velocity.X > 10f) + { + npc.velocity.X = 10f; + } + if (npc.velocity.X < -10f) + { + npc.velocity.X = -10f; + } + if (npc.velocity.Y > 5f) + { + npc.velocity.Y = 5f; + } + if (npc.velocity.Y < -5f) + { + npc.velocity.Y = -5f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1.5f || npc.velocity.X > 1.5f) + { + 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) + { + 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 (Collision.WetCollision(npc.position, npc.width, npc.height)) + { + npc.noTileCollide = false; + npc.netUpdate = true; + return; + } + npc.noTileCollide = true; + float num823 = 1f; + npc.TargetClosest(true); + bool flag51 = false; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num823 = 1.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num823 = 2.5f; + } + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 20f) + { + 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 + { + 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; + } + } + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.05f; + 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 void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 1.25 : 1.0); + if (npc.frameCounter < 6.0) + { + npc.frame.Y = 0; + } + else if (npc.frameCounter < 12.0) + { + npc.frame.Y = frameHeight; + } + else if (npc.frameCounter < 18.0) + { + npc.frame.Y = frameHeight * 2; + } + else if (npc.frameCounter < 24.0) + { + npc.frame.Y = frameHeight * 3; + } + else + { + npc.frameCounter = 0.0; + npc.frame.Y = 0; + } + if (!npc.wet) + { + npc.frame.Y = npc.frame.Y + frameHeight * 4; + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(BuffID.Venom, 180, true); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneSulphur || (spawnInfo.player.GetModPlayer(mod).ZoneSulphur && spawnInfo.water)) + { + return 0.1f; + } + return 0f; + } + + public override void NPCLoot() + { + if (!NPC.savedAngler && !NPC.AnyNPCs(NPCID.Angler) && !NPC.AnyNPCs(NPCID.SleepingAngler) && Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Angler, 0, 0f, 0f, 0f, 0f, 255); + NPC.savedAngler = true; + } + if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrashmanTrashcan")); + } + if (Main.rand.Next(10) == 0 && Main.hardMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gatligator); + } + } + + 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 < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher2"), 1f); + } + } + } +} diff --git a/NPCs/AbyssNPCs/Viperfish.cs b/NPCs/AbyssNPCs/Viperfish.cs index e6c6a20fdc..af737716f8 100644 --- a/NPCs/AbyssNPCs/Viperfish.cs +++ b/NPCs/AbyssNPCs/Viperfish.cs @@ -1,317 +1,317 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AbyssNPCs -{ - public class Viperfish : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Viperfish"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 60; - npc.width = 72; - npc.height = 30; - npc.defense = 15; - npc.lifeMax = 160; - npc.aiStyle = -1; - aiType = -1; - npc.buffImmune[mod.BuffType("CrushDepth")] = true; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.85f; - banner = npc.type; - bannerItem = mod.ItemType("ViperfishBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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 && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || - Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 200f : 600f) * - (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) - { - flag14 = true; - } - 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.25f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - 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; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { - 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) - { - 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 > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - 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 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/AbyssNPCs/ViperfishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ViperfishGlow").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.Gold); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ViperfishGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(mod.BuffType("CrushDepth"), 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 90); - player.AddBuff(mod.BuffType("Horror"), 90, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); - } - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); - } - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); - } - } - } - - 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 < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish2"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AbyssNPCs +{ + public class Viperfish : ModNPC + { + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Viperfish"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 60; + npc.width = 72; + npc.height = 30; + npc.defense = 15; + npc.lifeMax = 160; + npc.aiStyle = -1; + aiType = -1; + npc.buffImmune[mod.BuffType("CrushDepth")] = true; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.85f; + banner = npc.type; + bannerItem = mod.ItemType("ViperfishBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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 && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && + (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetModPlayer(mod).anechoicPlating || + Main.player[npc.target].GetModPlayer(mod).anechoicCoating) ? 200f : 600f) * + (Main.player[npc.target].GetModPlayer(mod).fishAlert ? 3f : 1f)) + { + flag14 = true; + } + 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.25f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + 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; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + 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) + { + 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 > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + 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 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/AbyssNPCs/ViperfishGlow").Width, (float)(mod.GetTexture("NPCs/AbyssNPCs/ViperfishGlow").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.Gold); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/AbyssNPCs/ViperfishGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 120, true); + player.AddBuff(mod.BuffType("CrushDepth"), 120, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 90); + player.AddBuff(mod.BuffType("Horror"), 90, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer1 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(1000000) == 0 && CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HalibutCannon")); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite")); + } + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells"), Main.rand.Next(1, 3)); + } + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthCells")); + } + } + } + + 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 < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish2"), 1f); + } + } + } +} diff --git a/NPCs/Astrageldon/Astrageldon.cs b/NPCs/Astrageldon/Astrageldon.cs index 1fc98a8d39..fe6534e712 100644 --- a/NPCs/Astrageldon/Astrageldon.cs +++ b/NPCs/Astrageldon/Astrageldon.cs @@ -1,848 +1,848 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Astrageldon -{ - [AutoloadBossHead] - public class Astrageldon : ModNPC - { - private float bossLife; - private int teleportLocationY = 0; - private bool stomping = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Aureus"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.npcSlots = 15f; - npc.damage = 90; - npc.width = 400; - npc.height = 280; - npc.defense = 120; - 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.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; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(stomping); - writer.Write(teleportLocationY); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - stomping = reader.ReadBoolean(); - teleportLocationY = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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 || (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; - teleportLocationY = 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 = (float)teleportLocationY * 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 bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return (npc.alpha == 0 && npc.ai[0] > 1f); - } - - 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 (stomping) - { - stomping = false; - } - 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 (!stomping) - { - stomping = true; - npc.frameCounter = 0.0; - npc.frame.Y = 0; - } - 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 (stomping) - { - stomping = false; - } - 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 (stomping) - { - stomping = false; - } - 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 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; - } - - 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"); - } - } - - 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); - - Main.spriteBatch.Draw(GlowMaskTexture, vector, - new Microsoft.Xna.Framework.Rectangle?(frame), color, rotation, vector11, 1f, spriteEffects, 0f); - } - return false; - } - - public override void BossLoot(ref string name, ref int potionType) - { - 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(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HallowedKey); - } - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AureusMask")); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Nebulash")); - } - } - if (NPC.downedMoonlord) - { - int amount = Main.rand.Next(6, 11); - 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 = 20; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstrumAureusHit"), npc.Center); - } - - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 150; - npc.height = 100; - 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 < 50; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 100; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); - 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), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Astrageldon +{ + [AutoloadBossHead] + public class Astrageldon : ModNPC + { + private float bossLife; + private int teleportLocationY = 0; + private bool stomping = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Aureus"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.npcSlots = 15f; + npc.damage = 90; + npc.width = 400; + npc.height = 280; + npc.defense = 120; + 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.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; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(stomping); + writer.Write(teleportLocationY); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + stomping = reader.ReadBoolean(); + teleportLocationY = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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 || (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; + teleportLocationY = 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 = (float)teleportLocationY * 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 bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return (npc.alpha == 0 && npc.ai[0] > 1f); + } + + 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 (stomping) + { + stomping = false; + } + 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 (!stomping) + { + stomping = true; + npc.frameCounter = 0.0; + npc.frame.Y = 0; + } + 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 (stomping) + { + stomping = false; + } + 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 (stomping) + { + stomping = false; + } + 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 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; + } + + 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"); + } + } + + 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); + + Main.spriteBatch.Draw(GlowMaskTexture, vector, + new Microsoft.Xna.Framework.Rectangle?(frame), color, rotation, vector11, 1f, spriteEffects, 0f); + } + return false; + } + + public override void BossLoot(ref string name, ref int potionType) + { + 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(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HallowedKey); + } + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AureusMask")); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Nebulash")); + } + } + if (NPC.downedMoonlord) + { + int amount = Main.rand.Next(6, 11); + 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 = 20; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstrumAureusHit"), npc.Center); + } + + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 150; + npc.height = 100; + 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 < 50; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 100; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); + 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), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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 8c4e674e95..6800765a63 100644 --- a/NPCs/Astrageldon/AstrageldonSlime.cs +++ b/NPCs/Astrageldon/AstrageldonSlime.cs @@ -1,271 +1,271 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Astrageldon -{ - public class AstrageldonSlime : ModNPC - { - private bool boostDR = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aureus Spawn"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 90; //324 - npc.height = 60; //216 - npc.defense = 0; - npc.alpha = 255; - npc.lifeMax = Main.expertMode ? 1007 : 1012; - 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; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(boostDR); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - boostDR = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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; - } - 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 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++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Astrageldon +{ + public class AstrageldonSlime : ModNPC + { + private bool boostDR = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aureus Spawn"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 90; //324 + npc.height = 60; //216 + npc.defense = 0; + npc.alpha = 255; + npc.lifeMax = Main.expertMode ? 1007 : 1012; + 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; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(boostDR); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + boostDR = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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; + } + 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 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++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + 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; + } + } +} diff --git a/NPCs/AstralBiomeNPCs/Aries.cs b/NPCs/AstralBiomeNPCs/Aries.cs index ffc0d082a1..355a2d047b 100644 --- a/NPCs/AstralBiomeNPCs/Aries.cs +++ b/NPCs/AstralBiomeNPCs/Aries.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs { DisplayName.SetDefault("Aries"); Main.npcFrameCount[npc.type] = 8; - if (!Main.dedServ) + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AriesGlow"); } @@ -36,15 +36,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.6f; npc.value = Item.buyPrice(0, 0, 10, 0); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - banner = npc.type; - bannerItem = mod.ItemType("AriesBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 85; - npc.defense = 24; - npc.knockBackResist = 0.5f; - npc.lifeMax = 450; - } + banner = npc.type; + bannerItem = mod.ItemType("AriesBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 85; + npc.defense = 24; + npc.knockBackResist = 0.5f; + npc.lifeMax = 450; + } } public override void FindFrame(int frameHeight) @@ -74,21 +74,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs 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.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; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, mod.DustType("AstralOrange"), 1f, 4, 24); @@ -109,20 +109,20 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - 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("Stardust"), Main.rand.Next(1, 3)); - } - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StellarKnife")); - } + 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("Stardust"), Main.rand.Next(1, 3)); + } + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StellarKnife")); + } } } } diff --git a/NPCs/AstralBiomeNPCs/AstralProbe.cs b/NPCs/AstralBiomeNPCs/AstralProbe.cs index e2b7b6b9a2..eb922df6b3 100644 --- a/NPCs/AstralBiomeNPCs/AstralProbe.cs +++ b/NPCs/AstralBiomeNPCs/AstralProbe.cs @@ -1,318 +1,318 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AstralBiomeNPCs -{ - public class AstralProbe : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Probe"); - } - - public override void SetDefaults() - { - npc.damage = 20; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 10; - npc.lifeMax = 50; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0.95f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.noGravity = true; - npc.noTileCollide = true; - npc.DeathSound = SoundID.NPCDeath14; - banner = npc.type; - bannerItem = mod.ItemType("AstralProbeBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 30; - npc.defense = 20; - npc.knockBackResist = 0.85f; - npc.lifeMax = 70; - } - } - - public override void AI() - { - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = 5f; - float num2 = 0.05f; - 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 (npc.justHit) - { - npc.localAI[0] = 0f; - } - if (Main.netMode != 1 && npc.localAI[0] >= 200f) - { - 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)) - { - int num8 = Main.expertMode ? 14 : 18; - if (CalamityWorld.downedAstrageldon) - num8 += 6; - - int num9 = 84; - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 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 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); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - 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 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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 NPCLoot() - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(1, 3)); - } - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - return (spawnInfo.player.GetModPlayer(mod).ZoneAstral && !spawnInfo.player.ZoneTowerStardust && !spawnInfo.player.ZoneTowerSolar && !spawnInfo.player.ZoneTowerVortex && !spawnInfo.player.ZoneTowerNebula) ? 0.1f : 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.downedAstrageldon) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AstralBiomeNPCs +{ + public class AstralProbe : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Probe"); + } + + public override void SetDefaults() + { + npc.damage = 20; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 10; + npc.lifeMax = 50; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0.95f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.noGravity = true; + npc.noTileCollide = true; + npc.DeathSound = SoundID.NPCDeath14; + banner = npc.type; + bannerItem = mod.ItemType("AstralProbeBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 30; + npc.defense = 20; + npc.knockBackResist = 0.85f; + npc.lifeMax = 70; + } + } + + public override void AI() + { + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = 5f; + float num2 = 0.05f; + 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 (npc.justHit) + { + npc.localAI[0] = 0f; + } + if (Main.netMode != 1 && npc.localAI[0] >= 200f) + { + 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)) + { + int num8 = Main.expertMode ? 14 : 18; + if (CalamityWorld.downedAstrageldon) + num8 += 6; + + int num9 = 84; + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 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 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); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + 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 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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 NPCLoot() + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(1, 3)); + } + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return (spawnInfo.player.GetModPlayer(mod).ZoneAstral && !spawnInfo.player.ZoneTowerStardust && !spawnInfo.player.ZoneTowerSolar && !spawnInfo.player.ZoneTowerVortex && !spawnInfo.player.ZoneTowerNebula) ? 0.1f : 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.downedAstrageldon) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 150, true); + } + } + } +} diff --git a/NPCs/AstralBiomeNPCs/AstralSlime.cs b/NPCs/AstralBiomeNPCs/AstralSlime.cs index 70800cbf09..e975343c5d 100644 --- a/NPCs/AstralBiomeNPCs/AstralSlime.cs +++ b/NPCs/AstralBiomeNPCs/AstralSlime.cs @@ -35,14 +35,14 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; animationType = NPCID.BlueSlime; - banner = npc.type; - bannerItem = mod.ItemType("AstralSlimeBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 65; - npc.defense = 18; - npc.lifeMax = 310; - } + banner = npc.type; + bannerItem = mod.ItemType("AstralSlimeBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 65; + npc.defense = 18; + npc.lifeMax = 310; + } } public override void FindFrame(int frameHeight) diff --git a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs index e2c0c0f793..26838aa02b 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs Main.npcFrameCount[npc.type] = 5; - if (!Main.dedServ) + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AstralachneaGroundGlow"); base.SetStaticDefaults(); @@ -42,15 +42,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.buffImmune[31] = false; npc.timeLeft = NPC.activeTime * 2; animationType = NPCID.WallCreeper; - banner = npc.type; - bannerItem = mod.ItemType("AstralachneaBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 90; - npc.defense = 30; - npc.knockBackResist = 0.28f; - npc.lifeMax = 750; - } + banner = npc.type; + bannerItem = mod.ItemType("AstralachneaBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 90; + npc.defense = 30; + npc.knockBackResist = 0.28f; + npc.lifeMax = 750; + } } public override void AI() @@ -107,21 +107,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs 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.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; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 22); @@ -151,17 +151,17 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstralachneaStaff")); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstralachneaStaff")); + } } } } diff --git a/NPCs/AstralBiomeNPCs/AstralachneaWall.cs b/NPCs/AstralBiomeNPCs/AstralachneaWall.cs index 089f307089..ca8cb52e16 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaWall.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaWall.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs Main.npcFrameCount[npc.type] = 4; - if (!Main.dedServ) + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AstralachneaWallGlow"); base.SetStaticDefaults(); @@ -43,14 +43,14 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.buffImmune[31] = false; npc.timeLeft = NPC.activeTime * 2; animationType = NPCID.BlackRecluseWall; - banner = mod.NPCType("AstralachneaGround"); - bannerItem = mod.ItemType("AstralachneaBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 90; - npc.defense = 30; - npc.lifeMax = 750; - } + banner = mod.NPCType("AstralachneaGround"); + bannerItem = mod.ItemType("AstralachneaBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 90; + npc.defense = 30; + npc.lifeMax = 750; + } } public override void AI() @@ -93,21 +93,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs 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.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; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 22); @@ -128,17 +128,17 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition - new Vector2(0, 8f), npc.frame, Color.White * 0.6f, npc.rotation, origin, 1f, SpriteEffects.None, 0); } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstralachneaStaff")); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstralachneaStaff")); + } } } } diff --git a/NPCs/AstralBiomeNPCs/Atlas.cs b/NPCs/AstralBiomeNPCs/Atlas.cs index 9a0fb193e2..b1ecc25691 100644 --- a/NPCs/AstralBiomeNPCs/Atlas.cs +++ b/NPCs/AstralBiomeNPCs/Atlas.cs @@ -90,17 +90,17 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Atlas"); - Main.npcFrameCount[npc.type] = 6; - //not really important seeing as custom drawing, but for heights sake, 6 - //also it's visuals are messed up on npc spawners etc. because the sheet is 3 wide. - //not much we can do. looks fine in-game so /shrug - if (!Main.dedServ) + Main.npcFrameCount[npc.type] = 6; + //not really important seeing as custom drawing, but for heights sake, 6 + //also it's visuals are messed up on npc spawners etc. because the sheet is 3 wide. + //not much we can do. looks fine in-game so /shrug + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/AtlasGlow"); } public override void SetDefaults() { - npc.lavaImmune = true; + npc.lavaImmune = true; npc.width = 78; npc.height = 88; npc.damage = 70; @@ -110,22 +110,22 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.value = Item.buyPrice(0, 1, 0, 0); npc.aiStyle = -1; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AtlasDeath"); - banner = npc.type; - bannerItem = mod.ItemType("AtlasBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 100; - npc.defense = 50; - npc.knockBackResist = 0.04f; - npc.lifeMax = 1600; - } - if (NPC.downedAncientCultist) - { - npc.damage = 150; - npc.defense = 75; - npc.knockBackResist = 0f; - npc.lifeMax = 2400; - } + banner = npc.type; + bannerItem = mod.ItemType("AtlasBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 100; + npc.defense = 50; + npc.knockBackResist = 0.04f; + npc.lifeMax = 1600; + } + if (NPC.downedAncientCultist) + { + npc.damage = 150; + npc.defense = 75; + npc.knockBackResist = 0f; + npc.lifeMax = 2400; + } } public override void SendExtraAI(BinaryWriter writer) @@ -410,21 +410,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void HitEffect(int hitDirection, double damage) { //play sound - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - switch (Main.rand.Next(3)) - { - case 0: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt0"), npc.Center); - break; - case 1: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt1"), npc.Center); - break; - case 2: - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt2"), npc.Center); - break; - } + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + switch (Main.rand.Next(3)) + { + case 0: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt0"), npc.Center); + break; + case 1: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt1"), npc.Center); + break; + case 2: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt2"), npc.Center); + break; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 30); @@ -609,17 +609,17 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(6, 9)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TitanArm")); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(6, 9)); + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TitanArm")); + } } } } diff --git a/NPCs/AstralBiomeNPCs/BigSightseer.cs b/NPCs/AstralBiomeNPCs/BigSightseer.cs index e58b7b9d60..a4ddfb607b 100644 --- a/NPCs/AstralBiomeNPCs/BigSightseer.cs +++ b/NPCs/AstralBiomeNPCs/BigSightseer.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs { DisplayName.SetDefault("Big Sightseer"); Main.npcFrameCount[npc.type] = 4; - if (!Main.dedServ) + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/BigSightseerGlow"); } @@ -38,15 +38,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.8f; npc.value = Item.buyPrice(0, 0, 20, 0); npc.aiStyle = -1; - banner = npc.type; - bannerItem = mod.ItemType("BigSightseerBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 85; - npc.defense = 30; - npc.knockBackResist = 0.7f; - npc.lifeMax = 640; - } + banner = npc.type; + bannerItem = mod.ItemType("BigSightseerBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 85; + npc.defense = 30; + npc.knockBackResist = 0.7f; + npc.lifeMax = 640; + } } public override void FindFrame(int frameHeight) @@ -110,21 +110,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs 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.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; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 22); @@ -155,13 +155,13 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } } } @@ -187,10 +187,10 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.noTileCollide = true; npc.alpha = 80; npc.aiStyle = -1; - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 75; - } + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 75; + } } public override void AI() diff --git a/NPCs/AstralBiomeNPCs/FusionFeeder.cs b/NPCs/AstralBiomeNPCs/FusionFeeder.cs index 290e62003d..5a8203ed62 100644 --- a/NPCs/AstralBiomeNPCs/FusionFeeder.cs +++ b/NPCs/AstralBiomeNPCs/FusionFeeder.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Fusion Feeder"); - if (!Main.dedServ) + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/FusionFeederGlow"); Main.npcFrameCount[npc.type] = 4; } @@ -40,15 +40,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.behindTiles = true; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); animationType = NPCID.SandShark; - banner = npc.type; - bannerItem = mod.ItemType("FusionFeederBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 65; - npc.defense = 22; - npc.knockBackResist = 0.7f; - npc.lifeMax = 600; - } + banner = npc.type; + bannerItem = mod.ItemType("FusionFeederBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 65; + npc.defense = 22; + npc.knockBackResist = 0.7f; + npc.lifeMax = 600; + } } public override void FindFrame(int frameHeight) @@ -63,21 +63,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs 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.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; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 25); @@ -116,13 +116,13 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } } } } diff --git a/NPCs/AstralBiomeNPCs/Hadarian.cs b/NPCs/AstralBiomeNPCs/Hadarian.cs index 32cb630e1c..f12f162fa7 100644 --- a/NPCs/AstralBiomeNPCs/Hadarian.cs +++ b/NPCs/AstralBiomeNPCs/Hadarian.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Hadarian"); - if (!Main.dedServ) + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HadarianGlow"); Main.npcFrameCount[npc.type] = 7; } @@ -37,15 +37,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0.75f; npc.value = Item.buyPrice(0, 0, 15, 0); - banner = npc.type; - bannerItem = mod.ItemType("HadarianBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 80; - npc.defense = 18; - npc.knockBackResist = 0.65f; - npc.lifeMax = 490; - } + banner = npc.type; + bannerItem = mod.ItemType("HadarianBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 80; + npc.defense = 18; + npc.knockBackResist = 0.65f; + npc.lifeMax = 490; + } } public override void AI() @@ -150,21 +150,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs 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.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; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 20); @@ -189,17 +189,17 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - if (CalamityWorld.downedAstrageldon && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HadarianMembrane"), Main.rand.Next(1, 3)); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + if (CalamityWorld.downedAstrageldon && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HadarianMembrane"), Main.rand.Next(1, 3)); + } } } } diff --git a/NPCs/AstralBiomeNPCs/Hive.cs b/NPCs/AstralBiomeNPCs/Hive.cs index 8a143bec50..82bb809d3a 100644 --- a/NPCs/AstralBiomeNPCs/Hive.cs +++ b/NPCs/AstralBiomeNPCs/Hive.cs @@ -13,137 +13,137 @@ using Terraria.ModLoader; using CalamityMod.World; namespace CalamityMod.NPCs.AstralBiomeNPCs -{ - public class Hive : ModNPC - { - private static Texture2D glowmask; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive"); - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HiveGlow"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.width = 38; - npc.height = 60; - npc.aiStyle = -1; - npc.damage = 55; - npc.defense = 15; - npc.lifeMax = 470; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.knockBackResist = 0f; +{ + public class Hive : ModNPC + { + private static Texture2D glowmask; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HiveGlow"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.width = 38; + npc.height = 60; + npc.aiStyle = -1; + npc.damage = 55; + npc.defense = 15; + npc.lifeMax = 470; + npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 15, 0); - banner = npc.type; - bannerItem = mod.ItemType("HiveBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 90; - npc.defense = 25; - npc.lifeMax = 700; - } - } - - public override void AI() - { - npc.ai[0]++; - if (npc.ai[0] > 180) - { - if (Main.rand.Next(100) == 0) - { - npc.ai[0] = 0; - - //spawn hiveling, it's ai[0] is the hive npc index. - int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Hiveling"), 0, npc.whoAmI); - Main.npc[n].velocity.X = Main.rand.NextFloat(-0.4f, 0.4f); - Main.npc[n].velocity.Y = Main.rand.NextFloat(-0.5f, -0.05f); - } - } - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter++; - if (npc.frameCounter > 10) - { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y > frameHeight * 4) - { - npc.frame.Y = 0; - } - } - } - - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - //draw glowmask - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition, npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(19, 30), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - } - - 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; - } - } - - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 20); - - //if dead do gores - if (npc.life <= 0) - { - int type = mod.NPCType("Hiveling"); - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].type == type) - { - Main.npc[i].ai[0] = -1f; - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - //only 1 hive possible. - bool anyHives = NPC.CountNPCS(npc.type) > 0; - if (anyHives) return 0f; - - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.GetModPlayer().ZoneAstral && (spawnInfo.player.ZoneDirtLayerHeight || spawnInfo.player.ZoneRockLayerHeight)) - { - return 0.17f; - } - return 0f; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HivePod")); - } - } + banner = npc.type; + bannerItem = mod.ItemType("HiveBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 90; + npc.defense = 25; + npc.lifeMax = 700; + } + } + + public override void AI() + { + npc.ai[0]++; + if (npc.ai[0] > 180) + { + if (Main.rand.Next(100) == 0) + { + npc.ai[0] = 0; + + //spawn hiveling, it's ai[0] is the hive npc index. + int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Hiveling"), 0, npc.whoAmI); + Main.npc[n].velocity.X = Main.rand.NextFloat(-0.4f, 0.4f); + Main.npc[n].velocity.Y = Main.rand.NextFloat(-0.5f, -0.05f); + } + } + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter > 10) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y > frameHeight * 4) + { + npc.frame.Y = 0; + } + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + //draw glowmask + spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition, npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(19, 30), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + } + + 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; + } + } + + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 20); + + //if dead do gores + if (npc.life <= 0) + { + int type = mod.NPCType("Hiveling"); + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].type == type) + { + Main.npc[i].ai[0] = -1f; + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + //only 1 hive possible. + bool anyHives = NPC.CountNPCS(npc.type) > 0; + if (anyHives) return 0f; + + Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; + if (spawnInfo.player.GetModPlayer().ZoneAstral && (spawnInfo.player.ZoneDirtLayerHeight || spawnInfo.player.ZoneRockLayerHeight)) + { + return 0.17f; + } + return 0f; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HivePod")); + } + } } } diff --git a/NPCs/AstralBiomeNPCs/Hiveling.cs b/NPCs/AstralBiomeNPCs/Hiveling.cs index c3cc5199d3..d8af6b2b02 100644 --- a/NPCs/AstralBiomeNPCs/Hiveling.cs +++ b/NPCs/AstralBiomeNPCs/Hiveling.cs @@ -13,116 +13,116 @@ using Terraria.ModLoader; using CalamityMod.World; namespace CalamityMod.NPCs.AstralBiomeNPCs -{ - public class Hiveling : ModNPC - { - private static Texture2D glowmask; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hiveling"); - if (!Main.dedServ) - glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HivelingGlow"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.width = 50; - npc.height = 40; - npc.aiStyle = -1; - npc.damage = 30; - npc.defense = 0; - npc.lifeMax = 150; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.knockBackResist = 0.5f; - npc.noGravity = true; - npc.value = Item.buyPrice(0, 0, 5, 0); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 50; - npc.defense = 8; - npc.knockBackResist = 0.4f; - npc.lifeMax = 220; - } - } - - public override void AI() - { - if (npc.ai[1] == 0f) - { - npc.velocity *= 0.97f; - - npc.TargetClosest(false); - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Player targ = Main.player[npc.target]; - - if (Collision.CanHit(npc.position, npc.width, npc.height, targ.position, targ.width, targ.height) || Vector2.Distance(npc.Center, targ.MountedCenter) < 320f) - { - npc.ai[1] = 1f; - } - } - else - { - CalamityGlobalNPC.DoFlyingAI(npc, 3f, 0.05f, 200f); - } - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.05f + npc.velocity.Length() * 0.667f; - if (npc.frameCounter >= 8) - { - npc.frameCounter = 0; - npc.frame.Y += frameHeight; - if (npc.frame.Y > npc.height * 2) - { - npc.frame.Y = 0; - } - } - - //DO DUST - Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 30, frameHeight, mod.DustType("AstralOrange"), new Rectangle(16, 8, 6, 6), Vector2.Zero, 0.3f, true); - if (d != null) - { - d.customData = 0.04f; - } - } - - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - //draw glowmask - spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition + new Vector2(0, 12), npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(15, 10), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - } - - 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; - } - } - - CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 20); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - return 0f; - } +{ + public class Hiveling : ModNPC + { + private static Texture2D glowmask; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hiveling"); + if (!Main.dedServ) + glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/HivelingGlow"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.width = 50; + npc.height = 40; + npc.aiStyle = -1; + npc.damage = 30; + npc.defense = 0; + npc.lifeMax = 150; + npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); + npc.knockBackResist = 0.5f; + npc.noGravity = true; + npc.value = Item.buyPrice(0, 0, 5, 0); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 50; + npc.defense = 8; + npc.knockBackResist = 0.4f; + npc.lifeMax = 220; + } + } + + public override void AI() + { + if (npc.ai[1] == 0f) + { + npc.velocity *= 0.97f; + + npc.TargetClosest(false); + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + Player targ = Main.player[npc.target]; + + if (Collision.CanHit(npc.position, npc.width, npc.height, targ.position, targ.width, targ.height) || Vector2.Distance(npc.Center, targ.MountedCenter) < 320f) + { + npc.ai[1] = 1f; + } + } + else + { + CalamityGlobalNPC.DoFlyingAI(npc, 3f, 0.05f, 200f); + } + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.05f + npc.velocity.Length() * 0.667f; + if (npc.frameCounter >= 8) + { + npc.frameCounter = 0; + npc.frame.Y += frameHeight; + if (npc.frame.Y > npc.height * 2) + { + npc.frame.Y = 0; + } + } + + //DO DUST + Dust d = CalamityGlobalNPC.SpawnDustOnNPC(npc, 30, frameHeight, mod.DustType("AstralOrange"), new Rectangle(16, 8, 6, 6), Vector2.Zero, 0.3f, true); + if (d != null) + { + d.customData = 0.04f; + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + //draw glowmask + spriteBatch.Draw(glowmask, npc.Center - Main.screenPosition + new Vector2(0, 12), npc.frame, Color.White * 0.6f, npc.rotation, new Vector2(15, 10), 1f, npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + } + + 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; + } + } + + CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 20); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return 0f; + } } } diff --git a/NPCs/AstralBiomeNPCs/Mantis.cs b/NPCs/AstralBiomeNPCs/Mantis.cs index 8057e617e4..4bd0b6ea88 100644 --- a/NPCs/AstralBiomeNPCs/Mantis.cs +++ b/NPCs/AstralBiomeNPCs/Mantis.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs { DisplayName.SetDefault("Mantis"); Main.npcFrameCount[npc.type] = 14; - if (!Main.dedServ) + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/MantisGlow"); } @@ -36,15 +36,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.2f; npc.value = Item.buyPrice(0, 0, 15, 0); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - banner = npc.type; - bannerItem = mod.ItemType("MantisBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 85; - npc.defense = 16; - npc.knockBackResist = 0.1f; - npc.lifeMax = 510; - } + banner = npc.type; + bannerItem = mod.ItemType("MantisBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 85; + npc.defense = 16; + npc.knockBackResist = 0.1f; + npc.lifeMax = 510; + } } public override void AI() @@ -198,21 +198,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs 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.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; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, mod.DustType("AstralOrange"), 1f, 4, 24); @@ -233,17 +233,17 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstralScythe")); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstralScythe")); + } } } } diff --git a/NPCs/AstralBiomeNPCs/Nova.cs b/NPCs/AstralBiomeNPCs/Nova.cs index 8041fa28af..998340283b 100644 --- a/NPCs/AstralBiomeNPCs/Nova.cs +++ b/NPCs/AstralBiomeNPCs/Nova.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs DisplayName.SetDefault("Nova"); Main.npcFrameCount[npc.type] = 8; - if (!Main.dedServ) + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/NovaGlow"); } @@ -46,15 +46,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.5f; npc.value = Item.buyPrice(0, 0, 20, 0); npc.aiStyle = -1; - banner = npc.type; - bannerItem = mod.ItemType("NovaBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 75; - npc.defense = 25; - npc.knockBackResist = 0.4f; - npc.lifeMax = 350; - } + banner = npc.type; + bannerItem = mod.ItemType("NovaBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 75; + npc.defense = 25; + npc.knockBackResist = 0.4f; + npc.lifeMax = 350; + } } public override void FindFrame(int frameHeight) @@ -214,21 +214,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs 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.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; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 3, 40); @@ -262,17 +262,17 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } - if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StellarCannon")); - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(2, 4)); + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } + if (CalamityWorld.downedAstrageldon && Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StellarCannon")); + } } } } diff --git a/NPCs/AstralBiomeNPCs/SmallSightseer.cs b/NPCs/AstralBiomeNPCs/SmallSightseer.cs index 21474e77cf..d1a6663c45 100644 --- a/NPCs/AstralBiomeNPCs/SmallSightseer.cs +++ b/NPCs/AstralBiomeNPCs/SmallSightseer.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs DisplayName.SetDefault("Small Sightseer"); Main.npcFrameCount[npc.type] = 4; - if (!Main.dedServ) + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/SmallSightseerGlow"); } @@ -39,15 +39,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.knockBackResist = 0.58f; npc.value = Item.buyPrice(0, 0, 10, 0); npc.aiStyle = -1; - banner = npc.type; - bannerItem = mod.ItemType("SmallSightseerBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 58; - npc.defense = 26; - npc.knockBackResist = 0.48f; - npc.lifeMax = 460; - } + banner = npc.type; + bannerItem = mod.ItemType("SmallSightseerBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 58; + npc.defense = 26; + npc.knockBackResist = 0.48f; + npc.lifeMax = 460; + } } public override void FindFrame(int frameHeight) @@ -78,21 +78,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs 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.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; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 22); @@ -123,16 +123,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - 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("Stardust"), Main.rand.Next(1, 3)); - } - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } + 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("Stardust"), Main.rand.Next(1, 3)); + } + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } } } } diff --git a/NPCs/AstralBiomeNPCs/StellarCulex.cs b/NPCs/AstralBiomeNPCs/StellarCulex.cs index 83fa64e73e..7600f2925a 100644 --- a/NPCs/AstralBiomeNPCs/StellarCulex.cs +++ b/NPCs/AstralBiomeNPCs/StellarCulex.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Stellar Culex"); - if (!Main.dedServ) + if (!Main.dedServ) glowmask = mod.GetTexture("NPCs/AstralBiomeNPCs/StellarCulexGlow"); Main.npcFrameCount[npc.type] = 4; } @@ -40,15 +40,15 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.buffImmune[31] = false; animationType = NPCID.GiantFlyingFox; - banner = npc.type; - bannerItem = mod.ItemType("StellarCulexBanner"); - if (CalamityWorld.downedAstrageldon) - { - npc.damage = 90; - npc.defense = 28; - npc.knockBackResist = 0.55f; - npc.lifeMax = 320; - } + banner = npc.type; + bannerItem = mod.ItemType("StellarCulexBanner"); + if (CalamityWorld.downedAstrageldon) + { + npc.damage = 90; + npc.defense = 28; + npc.knockBackResist = 0.55f; + npc.lifeMax = 320; + } } public override void FindFrame(int frameHeight) @@ -64,21 +64,21 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs 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.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; + } } CalamityGlobalNPC.DoHitDust(npc, hitDirection, (Main.rand.Next(0, Math.Max(0, npc.life)) == 0) ? 5 : mod.DustType("AstralEnemy"), 1f, 4, 22); @@ -108,16 +108,16 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs return 0f; } - 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("Stardust"), Main.rand.Next(1, 3)); - } - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); - } + 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("Stardust"), Main.rand.Next(1, 3)); + } + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust")); + } } } } diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 6ef2789d25..a589bf14e5 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -1,271 +1,271 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusBody : ModNPC - { - private int spawn = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 90; //70 - npc.npcSlots = 5f; - npc.width = 38; //324 - npc.height = 44; //216 - npc.defense = 45; - npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; - if (CalamityWorld.death) - { - npc.lifeMax = 29100; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(spawn); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - writer.Write(npc.localAI[3]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - spawn = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - npc.localAI[3] = reader.ReadSingle(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - } - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - 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; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.netMode != 1) - { - int shootTime = 4; - if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive) - { - shootTime += 2; - } - npc.localAI[0] += (float)Main.rand.Next(shootTime); - if (npc.localAI[0] >= (float)Main.rand.Next(1400, 26000)) - { - npc.localAI[0] = 0f; - 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 num941 = revenge ? 13f : 12f; //speed - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num941 = 18f; - } - 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; - int num945 = expertMode ? 35 : 45; - int num946 = mod.ProjectileType("AstralShot2"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Color lightColor = new Color(125, 75, Main.DiscoB, npc.alpha); //250 150 Disco - Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); - Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAlt"); - CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, newColor); - return false; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } - else if (projectile.type == mod.ProjectileType("GoliathExplosion")) - { - damage = (int)((double)damage * 0.6); - } - if (projectile.penetrate == -1 && !projectile.minion) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1) - { - damage /= projectile.penetrate; - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (NPC.CountNPCS(mod.NPCType("AstrumDeusProbe3")) < 3 && CalamityWorld.revenge) - { - if (npc.life > 0 && Main.netMode != 1 && spawn == 0 && Main.rand.Next(25) == 0) - { - spawn = 1; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("AstrumDeusProbe3"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == 2 && num660 < 200) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - if (npc.life <= 0) - { - 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; - 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 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); - 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), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 120, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AstrumDeus +{ + public class AstrumDeusBody : ModNPC + { + private int spawn = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 90; //70 + npc.npcSlots = 5f; + npc.width = 38; //324 + npc.height = 44; //216 + npc.defense = 45; + npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; + if (CalamityWorld.death) + { + npc.lifeMax = 29100; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(spawn); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + writer.Write(npc.localAI[3]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + spawn = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + npc.localAI[3] = reader.ReadSingle(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + { + if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; + npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + } + } + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + 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; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.netMode != 1) + { + int shootTime = 4; + if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive) + { + shootTime += 2; + } + npc.localAI[0] += (float)Main.rand.Next(shootTime); + if (npc.localAI[0] >= (float)Main.rand.Next(1400, 26000)) + { + npc.localAI[0] = 0f; + 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 num941 = revenge ? 13f : 12f; //speed + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num941 = 18f; + } + 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; + int num945 = expertMode ? 35 : 45; + int num946 = mod.ProjectileType("AstralShot2"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return !npc.dontTakeDamage; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Color lightColor = new Color(125, 75, Main.DiscoB, npc.alpha); //250 150 Disco + Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); + Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAlt"); + CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, newColor); + return false; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } + else if (projectile.type == mod.ProjectileType("GoliathExplosion")) + { + damage = (int)((double)damage * 0.6); + } + if (projectile.penetrate == -1 && !projectile.minion) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1) + { + damage /= projectile.penetrate; + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (NPC.CountNPCS(mod.NPCType("AstrumDeusProbe3")) < 3 && CalamityWorld.revenge) + { + if (npc.life > 0 && Main.netMode != 1 && spawn == 0 && Main.rand.Next(25) == 0) + { + spawn = 1; + int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("AstrumDeusProbe3"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == 2 && num660 < 200) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + } + if (npc.life <= 0) + { + 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; + 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 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); + 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), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 120, true); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index 33e2d4210a..e83b65317d 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -1,316 +1,316 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusBodySpectral : ModNPC - { - private int spawn = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.npcSlots = 5f; - npc.width = 38; //324 - npc.height = 44; //216 - npc.defense = 60; - npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; - if (CalamityWorld.death) - { - npc.lifeMax = 80700; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - 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/AstrumDeus"); - else - music = MusicID.Boss3; - npc.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(spawn); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - spawn = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - 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; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.netMode != 1) - { - int shootTime = 4; - if ((double)npc.life <= (double)npc.lifeMax * 0.65 || Main.player[npc.target].gravDir == -1f) - { - shootTime += CalamityWorld.death ? 4 : 2; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f) - { - shootTime += CalamityWorld.death ? 6 : 2; - } - npc.localAI[0] += (float)Main.rand.Next(shootTime); - if (npc.localAI[0] >= (float)Main.rand.Next(1400, 20000)) - { - npc.localAI[0] = 0f; - 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 num941 = revenge ? 14f : 13f; //speed - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num941 = 20f; - } - if (Main.player[npc.target].gravDir == -1f) - { - num941 *= 2f; - } - 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; - int num945 = expertMode ? 35 : 45; - int num946 = mod.ProjectileType("AstralShot2"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAltSpectral"); - SpriteEffects spriteEffects = SpriteEffects.None; - Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]); - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - CalamityMod.DrawTexture(spriteBatch, texture2D3, 0, npc, newColor); - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } - else if (projectile.type == mod.ProjectileType("GoliathExplosion")) - { - damage = (int)((double)damage * 0.6); - } - if (projectile.penetrate == -1 && !projectile.minion) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1) - { - damage /= projectile.penetrate; - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (NPC.CountNPCS(mod.NPCType("AstrumDeusProbe3")) < 6 && CalamityWorld.revenge) - { - if (npc.life > 0 && Main.netMode != 1 && spawn == 0 && Main.rand.Next(25) == 0) - { - spawn = 1; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("AstrumDeusProbe3"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == 2 && num660 < 200) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - if (npc.life <= 0) - { - 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; - 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 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); - 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), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 120, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AstrumDeus +{ + public class AstrumDeusBodySpectral : ModNPC + { + private int spawn = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.npcSlots = 5f; + npc.width = 38; //324 + npc.height = 44; //216 + npc.defense = 60; + npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; + if (CalamityWorld.death) + { + npc.lifeMax = 80700; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + 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/AstrumDeus"); + else + music = MusicID.Boss3; + npc.dontCountMe = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(spawn); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + spawn = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + { + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; + npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + } + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + 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; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.netMode != 1) + { + int shootTime = 4; + if ((double)npc.life <= (double)npc.lifeMax * 0.65 || Main.player[npc.target].gravDir == -1f) + { + shootTime += CalamityWorld.death ? 4 : 2; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f) + { + shootTime += CalamityWorld.death ? 6 : 2; + } + npc.localAI[0] += (float)Main.rand.Next(shootTime); + if (npc.localAI[0] >= (float)Main.rand.Next(1400, 20000)) + { + npc.localAI[0] = 0f; + 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 num941 = revenge ? 14f : 13f; //speed + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num941 = 20f; + } + if (Main.player[npc.target].gravDir == -1f) + { + num941 *= 2f; + } + 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; + int num945 = expertMode ? 35 : 45; + int num946 = mod.ProjectileType("AstralShot2"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = mod.GetTexture("NPCs/AstrumDeus/AstrumDeusBodyAltSpectral"); + SpriteEffects spriteEffects = SpriteEffects.None; + Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]); + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + CalamityMod.DrawTexture(spriteBatch, texture2D3, 0, npc, newColor); + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return !npc.dontTakeDamage; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } + else if (projectile.type == mod.ProjectileType("GoliathExplosion")) + { + damage = (int)((double)damage * 0.6); + } + if (projectile.penetrate == -1 && !projectile.minion) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1) + { + damage /= projectile.penetrate; + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (NPC.CountNPCS(mod.NPCType("AstrumDeusProbe3")) < 6 && CalamityWorld.revenge) + { + if (npc.life > 0 && Main.netMode != 1 && spawn == 0 && Main.rand.Next(25) == 0) + { + spawn = 1; + int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("AstrumDeusProbe3"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == 2 && num660 < 200) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + } + if (npc.life <= 0) + { + 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; + 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 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); + 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), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 120, true); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index deaccffb77..0e1098861f 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -1,671 +1,671 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AstrumDeus -{ - [AutoloadBossHead] - public class AstrumDeusHead : ModNPC - { - private bool flies = false; - private const int minLength = 4; - private const int maxLength = 5; - private int addOrbiter = 0; - private int addOrbiter2 = 0; - private float speed = 0.15f; - private float turnSpeed = 0.1f; - private bool tailSpawned = false; - private bool secondStage = false; - private bool thirdStage = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 105; //150 - npc.npcSlots = 5f; - npc.width = 56; //324 - npc.height = 56; //216 - npc.defense = 30; - npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; - if (CalamityWorld.death) - { - npc.lifeMax = 29100; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - else - music = MusicID.Boss3; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(addOrbiter); - writer.Write(addOrbiter2); - writer.Write(secondStage); - writer.Write(thirdStage); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - addOrbiter = reader.ReadInt32(); - addOrbiter2 = reader.ReadInt32(); - secondStage = reader.ReadBoolean(); - thirdStage = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - } - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - 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 (CalamityWorld.death || CalamityWorld.bossRushActive) - { - if ((npc.life <= npc.lifeMax * 0.9f)) - { - if (secondStage == false && Main.netMode != 1) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 3; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), mod.NPCType("AstrumDeusProbe"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 120; - Eye.ai[3] = I * 120; - } - secondStage = true; - } - } - if ((npc.life <= npc.lifeMax * 0.8f)) - { - if (thirdStage == false && Main.netMode != 1) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 5; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("AstrumDeusProbe2"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 72; - Eye.ai[3] = I * 72; - } - thirdStage = true; - } - } - } - else - { - if ((npc.life <= npc.lifeMax * 0.65f)) - { - if (secondStage == false && Main.netMode != 1) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 3; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), mod.NPCType("AstrumDeusProbe"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 120; - Eye.ai[3] = I * 120; - } - secondStage = true; - } - } - if ((npc.life <= npc.lifeMax * 0.3f)) - { - if (thirdStage == false && Main.netMode != 1) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 5; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("AstrumDeusProbe2"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 72; - Eye.ai[3] = I * 72; - } - thirdStage = true; - } - } - } - 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(); - float speedMult = expertMode ? 1.8f : 1.6f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - speedMult = ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2.8f : 2.5f); - } - float life = (float)npc.life; - float totalLife = (float)npc.lifeMax; - float newSpeed = speed * (speedMult - (life / totalLife)); - float newTurnSpeed = turnSpeed * (speedMult - (life / totalLife)); - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != 1) - { - if (!tailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusTail"), npc.whoAmI); - } - if (num36 % 2 == 0) - { - Main.npc[lol].localAI[3] = 1f; - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - Previous = lol; - } - tailSpawned = true; - } - if (!npc.active && Main.netMode == 2) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - 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; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - 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); - 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 100 : 200); - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - rectX, (int)Main.player[num955].position.Y - rectY, rectX * 2, rectY * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - float maxSpeed = 20f; - if (Main.dayTime || Main.player[npc.target].dead || CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - flag94 = true; - npc.velocity.Y = npc.velocity.Y - 2f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 2f; - maxSpeed = 40f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - float num188 = newSpeed; - float num189 = newTurnSpeed; - 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; - } - else - { - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > maxSpeed) - { - npc.velocity.Y = maxSpeed; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num188 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num188 * 1.1f; - } - } - else if (npc.velocity.Y == maxSpeed) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num188; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num188; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num188 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num188 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = maxSpeed / 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 ((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 + num188; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num188; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num188; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num188; - } - } - if ((double)System.Math.Abs(num192) < (double)maxSpeed * 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 + num188 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num188 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)maxSpeed * 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 + num188 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num188 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num188 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num188 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num188; - } - else - { - npc.velocity.Y = npc.velocity.Y - num188; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num188 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num188 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num188; - } - else - { - npc.velocity.X = npc.velocity.X - num188; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - 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 bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } - - public override Color? GetAlpha(Color drawColor) - { - if (npc.dontTakeDamage) - return new Color(125, 75, Main.DiscoB, npc.alpha); - return null; - } - - public override bool CheckActive() - { - return false; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } - else if (projectile.type == mod.ProjectileType("GoliathExplosion")) - { - damage = (int)((double)damage * 0.6); - } - if (projectile.penetrate == -1 && !projectile.minion) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1) - { - damage /= projectile.penetrate; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); - 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), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AstrumDeus +{ + [AutoloadBossHead] + public class AstrumDeusHead : ModNPC + { + private bool flies = false; + private const int minLength = 4; + private const int maxLength = 5; + private int addOrbiter = 0; + private int addOrbiter2 = 0; + private float speed = 0.15f; + private float turnSpeed = 0.1f; + private bool tailSpawned = false; + private bool secondStage = false; + private bool thirdStage = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 105; //150 + npc.npcSlots = 5f; + npc.width = 56; //324 + npc.height = 56; //216 + npc.defense = 30; + npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; + if (CalamityWorld.death) + { + npc.lifeMax = 29100; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + else + music = MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(addOrbiter); + writer.Write(addOrbiter2); + writer.Write(secondStage); + writer.Write(thirdStage); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + addOrbiter = reader.ReadInt32(); + addOrbiter2 = reader.ReadInt32(); + secondStage = reader.ReadBoolean(); + thirdStage = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + { + if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; + npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + } + } + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + 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 (CalamityWorld.death || CalamityWorld.bossRushActive) + { + if ((npc.life <= npc.lifeMax * 0.9f)) + { + if (secondStage == false && Main.netMode != 1) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 3; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), mod.NPCType("AstrumDeusProbe"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 120; + Eye.ai[3] = I * 120; + } + secondStage = true; + } + } + if ((npc.life <= npc.lifeMax * 0.8f)) + { + if (thirdStage == false && Main.netMode != 1) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 5; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("AstrumDeusProbe2"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 72; + Eye.ai[3] = I * 72; + } + thirdStage = true; + } + } + } + else + { + if ((npc.life <= npc.lifeMax * 0.65f)) + { + if (secondStage == false && Main.netMode != 1) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 3; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), mod.NPCType("AstrumDeusProbe"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 120; + Eye.ai[3] = I * 120; + } + secondStage = true; + } + } + if ((npc.life <= npc.lifeMax * 0.3f)) + { + if (thirdStage == false && Main.netMode != 1) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 5; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("AstrumDeusProbe2"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 72; + Eye.ai[3] = I * 72; + } + thirdStage = true; + } + } + } + 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(); + float speedMult = expertMode ? 1.8f : 1.6f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + speedMult = ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2.8f : 2.5f); + } + float life = (float)npc.life; + float totalLife = (float)npc.lifeMax; + float newSpeed = speed * (speedMult - (life / totalLife)); + float newTurnSpeed = turnSpeed * (speedMult - (life / totalLife)); + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != 1) + { + if (!tailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusTail"), npc.whoAmI); + } + if (num36 % 2 == 0) + { + Main.npc[lol].localAI[3] = 1f; + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + Previous = lol; + } + tailSpawned = true; + } + if (!npc.active && Main.netMode == 2) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + } + 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; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + 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); + 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 100 : 200); + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - rectX, (int)Main.player[num955].position.Y - rectY, rectX * 2, rectY * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + float maxSpeed = 20f; + if (Main.dayTime || Main.player[npc.target].dead || CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + flag94 = true; + npc.velocity.Y = npc.velocity.Y - 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 2f; + maxSpeed = 40f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + float num188 = newSpeed; + float num189 = newTurnSpeed; + 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; + } + else + { + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + 0.15f; + if (npc.velocity.Y > maxSpeed) + { + npc.velocity.Y = maxSpeed; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num188 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num188 * 1.1f; + } + } + else if (npc.velocity.Y == maxSpeed) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num188; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num188; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num188 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num188 * 0.9f; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = maxSpeed / 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 ((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 + num188; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num188; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num188; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num188; + } + } + if ((double)System.Math.Abs(num192) < (double)maxSpeed * 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 + num188 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num188 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)maxSpeed * 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 + num188 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num188 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num188 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num188 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num188; + } + else + { + npc.velocity.Y = npc.velocity.Y - num188; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num188 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num188 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num188; + } + else + { + npc.velocity.X = npc.velocity.X - num188; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + 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 bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return !npc.dontTakeDamage; + } + + public override Color? GetAlpha(Color drawColor) + { + if (npc.dontTakeDamage) + return new Color(125, 75, Main.DiscoB, npc.alpha); + return null; + } + + public override bool CheckActive() + { + return false; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } + else if (projectile.type == mod.ProjectileType("GoliathExplosion")) + { + damage = (int)((double)damage * 0.6); + } + if (projectile.penetrate == -1 && !projectile.minion) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1) + { + damage /= projectile.penetrate; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); + 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), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 940d07a3ec..4eac848f0a 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -1,586 +1,586 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AstrumDeus -{ - [AutoloadBossHead] - public class AstrumDeusHeadSpectral : ModNPC - { - private bool colorChange = false; - private bool flies = true; - private const int minLength = 12; - private const int maxLength = 13; - private float speed = 10f; - private float turnSpeed = 0.2f; - private bool tailSpawned = false; - private int deusHeadCount = 0; - private int astrumDeusTotalHPMax = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 130; //150 - npc.npcSlots = 5f; - npc.width = 56; //324 - npc.height = 56; //216 - npc.defense = 40; - npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; - if (CalamityWorld.death) - { - npc.lifeMax = 80700; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - npc.boss = true; - npc.value = Item.buyPrice(0, 20, 0, 0); - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - else - music = MusicID.Boss3; - bossBag = mod.ItemType("AstrumDeusBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(deusHeadCount); - writer.Write(astrumDeusTotalHPMax); - writer.Write(colorChange); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - deusHeadCount = reader.ReadInt32(); - astrumDeusTotalHPMax = reader.ReadInt32(); - colorChange = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - CalamityGlobalNPC.astrumDeusHeadMain = npc.whoAmI; - colorChange = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - int astrumDeusTotalHP = 0; - double astrumDeusHPRatio = 0; - double mainDeusHPRatio = (double)npc.life / (double)npc.lifeMax; - if (colorChange) - { - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].type == mod.NPCType("AstrumDeusHead")) - { - astrumDeusTotalHP += Main.npc[i].life; - if (deusHeadCount < 10) - { - deusHeadCount++; - astrumDeusTotalHPMax += Main.npc[i].lifeMax; - } - } - } - astrumDeusHPRatio = (double)astrumDeusTotalHP / (double)astrumDeusTotalHPMax; - if (astrumDeusHPRatio < 0.33) - { - if (mainDeusHPRatio > 0.33) - colorChange = false; - } - else if (astrumDeusHPRatio < 0.66) - { - if (mainDeusHPRatio > 0.66) - colorChange = false; - } - } - npc.dontTakeDamage = colorChange; - npc.chaseable = !colorChange; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - float speedLimit = CalamityWorld.revenge ? 9f : 7f; - float turnSpeedLimit = CalamityWorld.revenge ? 0.14f : 0.12f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - 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)mainDeusHPRatio); - float turnSpeedBoost = turnSpeedLimit * (1f - (float)mainDeusHPRatio); - if (Main.player[npc.target].gravDir == -1f) - { - speedBoost = speedLimit; - turnSpeedBoost = turnSpeedLimit; - } - 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) - { - 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.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != 1) - { - if (!tailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusBodySpectral"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusTailSpectral"), npc.whoAmI); - } - if (num36 % 2 == 0) - { - Main.npc[lol].localAI[3] = 1f; - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - Previous = lol; - } - tailSpawned = true; - } - if (!npc.active && Main.netMode == 2) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - 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; - } - bool canFly = flies; - if (Main.player[npc.target].dead || Main.dayTime) - { - npc.TargetClosest(false); - canFly = true; - npc.velocity.Y = npc.velocity.Y - 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 3f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - /*else if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 3600f) - { - if (Main.player[npc.target].velocity.X >= 0f) - { - npc.position.X = Main.player[npc.target].position.X + 800f; - } - else - { - npc.position.X = Main.player[npc.target].position.X - 800f; - } - npc.position.Y = Main.player[npc.target].position.Y; - }*/ - float num188 = speed + speedBoost; - float num189 = turnSpeed + turnSpeedBoost; - 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - 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; - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); - Color newColor = (colorChange ? lightColor : drawColor); - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - if (colorChange && Main.player[npc.target].gravDir != -1f) - { - return false; - } - 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("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } - else if (projectile.type == mod.ProjectileType("GoliathExplosion")) - { - damage = (int)((double)damage * 0.6); - } - if (projectile.penetrate == -1 && !projectile.minion) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1) - { - damage /= projectile.penetrate; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); - 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), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = mod.ItemType("Stardust"); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AstrumDeus +{ + [AutoloadBossHead] + public class AstrumDeusHeadSpectral : ModNPC + { + private bool colorChange = false; + private bool flies = true; + private const int minLength = 12; + private const int maxLength = 13; + private float speed = 10f; + private float turnSpeed = 0.2f; + private bool tailSpawned = false; + private int deusHeadCount = 0; + private int astrumDeusTotalHPMax = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 130; //150 + npc.npcSlots = 5f; + npc.width = 56; //324 + npc.height = 56; //216 + npc.defense = 40; + npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; + if (CalamityWorld.death) + { + npc.lifeMax = 80700; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + npc.boss = true; + npc.value = Item.buyPrice(0, 20, 0, 0); + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); + else + music = MusicID.Boss3; + bossBag = mod.ItemType("AstrumDeusBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(deusHeadCount); + writer.Write(astrumDeusTotalHPMax); + writer.Write(colorChange); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + deusHeadCount = reader.ReadInt32(); + astrumDeusTotalHPMax = reader.ReadInt32(); + colorChange = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + CalamityGlobalNPC.astrumDeusHeadMain = npc.whoAmI; + colorChange = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + int astrumDeusTotalHP = 0; + double astrumDeusHPRatio = 0; + double mainDeusHPRatio = (double)npc.life / (double)npc.lifeMax; + if (colorChange) + { + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].type == mod.NPCType("AstrumDeusHead")) + { + astrumDeusTotalHP += Main.npc[i].life; + if (deusHeadCount < 10) + { + deusHeadCount++; + astrumDeusTotalHPMax += Main.npc[i].lifeMax; + } + } + } + astrumDeusHPRatio = (double)astrumDeusTotalHP / (double)astrumDeusTotalHPMax; + if (astrumDeusHPRatio < 0.33) + { + if (mainDeusHPRatio > 0.33) + colorChange = false; + } + else if (astrumDeusHPRatio < 0.66) + { + if (mainDeusHPRatio > 0.66) + colorChange = false; + } + } + npc.dontTakeDamage = colorChange; + npc.chaseable = !colorChange; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + float speedLimit = CalamityWorld.revenge ? 9f : 7f; + float turnSpeedLimit = CalamityWorld.revenge ? 0.14f : 0.12f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + 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)mainDeusHPRatio); + float turnSpeedBoost = turnSpeedLimit * (1f - (float)mainDeusHPRatio); + if (Main.player[npc.target].gravDir == -1f) + { + speedBoost = speedLimit; + turnSpeedBoost = turnSpeedLimit; + } + 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) + { + 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.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != 1) + { + if (!tailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusBodySpectral"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusTailSpectral"), npc.whoAmI); + } + if (num36 % 2 == 0) + { + Main.npc[lol].localAI[3] = 1f; + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + Previous = lol; + } + tailSpawned = true; + } + if (!npc.active && Main.netMode == 2) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + } + 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; + } + bool canFly = flies; + if (Main.player[npc.target].dead || Main.dayTime) + { + npc.TargetClosest(false); + canFly = true; + npc.velocity.Y = npc.velocity.Y - 3f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 3f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + /*else if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 3600f) + { + if (Main.player[npc.target].velocity.X >= 0f) + { + npc.position.X = Main.player[npc.target].position.X + 800f; + } + else + { + npc.position.X = Main.player[npc.target].position.X - 800f; + } + npc.position.Y = Main.player[npc.target].position.Y; + }*/ + float num188 = speed + speedBoost; + float num189 = turnSpeed + turnSpeedBoost; + 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + 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; + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); + Color newColor = (colorChange ? lightColor : drawColor); + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + if (colorChange && Main.player[npc.target].gravDir != -1f) + { + return false; + } + 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("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } + else if (projectile.type == mod.ProjectileType("GoliathExplosion")) + { + damage = (int)((double)damage * 0.6); + } + if (projectile.penetrate == -1 && !projectile.minion) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1) + { + damage /= projectile.penetrate; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); + 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), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = mod.ItemType("Stardust"); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/AstrumDeus/AstrumDeusProbe.cs b/NPCs/AstrumDeus/AstrumDeusProbe.cs index 214edd44d5..2cdf5f9fed 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe.cs @@ -1,142 +1,142 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusProbe : ModNPC - { - private int timer = 0; - private bool start = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus Probe"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 30; - npc.height = 30; - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 100; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override bool PreAI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - if (start) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - } - npc.ai[1] = npc.ai[0]; - start = false; - } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= 9f; - npc.rotation = direction.ToRotation(); - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 720f) - { - npc.localAI[0] = 0f; - int num8 = expertMode ? 42 : 55; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); - } - bool anySmallDeusHeads = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - int npcType = (anySmallDeusHeads ? mod.NPCType("AstrumDeusHead") : mod.NPCType("AstrumDeusHeadSpectral")); - NPC parent = Main.npc[NPC.FindFirstNPC(npcType)]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 75; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 2f; - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 5; 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), 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); - 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), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.velocity != Vector2.Zero) - { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); - for (int i = 1; i < npc.oldPos.Length; ++i) - { - Vector2 vector2_2 = npc.oldPos[i]; - Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; - color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); - color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); - color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); - color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), - npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); - } - } - return true; - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AstrumDeus +{ + public class AstrumDeusProbe : ModNPC + { + private int timer = 0; + private bool start = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Probe"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 30; + npc.height = 30; + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.damage = 0; + npc.defense = 0; + npc.lifeMax = 100; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override bool PreAI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + if (start) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + } + npc.ai[1] = npc.ai[0]; + start = false; + } + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= 9f; + npc.rotation = direction.ToRotation(); + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 720f) + { + npc.localAI[0] = 0f; + int num8 = expertMode ? 42 : 55; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); + } + bool anySmallDeusHeads = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + Player player = Main.player[npc.target]; + int npcType = (anySmallDeusHeads ? mod.NPCType("AstrumDeusHead") : mod.NPCType("AstrumDeusHeadSpectral")); + NPC parent = Main.npc[NPC.FindFirstNPC(npcType)]; + double deg = (double)npc.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 75; + npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.ai[1] += 2f; + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 5; 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), 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); + 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), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.velocity != Vector2.Zero) + { + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + for (int i = 1; i < npc.oldPos.Length; ++i) + { + Vector2 vector2_2 = npc.oldPos[i]; + Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; + color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); + color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); + color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); + color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), + npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); + } + } + return true; + } + } +} diff --git a/NPCs/AstrumDeus/AstrumDeusProbe2.cs b/NPCs/AstrumDeus/AstrumDeusProbe2.cs index 66428973a1..077dc1f401 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe2.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe2.cs @@ -1,142 +1,142 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusProbe2 : ModNPC - { - public int timer = 0; - public bool start = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus Probe"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 30; - npc.height = 30; - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 100; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override bool PreAI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - if (start) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - } - npc.ai[1] = npc.ai[0]; - start = false; - } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= 9f; - npc.rotation = direction.ToRotation(); - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 360f) - { - npc.localAI[0] = 0f; - int num8 = expertMode ? 42 : 55; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); - } - bool anySmallDeusHeads = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); - if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - int npcType = (anySmallDeusHeads ? mod.NPCType("AstrumDeusHead") : mod.NPCType("AstrumDeusHeadSpectral")); - NPC parent = Main.npc[NPC.FindFirstNPC(npcType)]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 150; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 2f; - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 5; 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), 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); - 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), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.velocity != Vector2.Zero) - { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); - for (int i = 1; i < npc.oldPos.Length; ++i) - { - Vector2 vector2_2 = npc.oldPos[i]; - Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; - color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); - color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); - color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); - color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), - npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); - } - } - return true; - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AstrumDeus +{ + public class AstrumDeusProbe2 : ModNPC + { + public int timer = 0; + public bool start = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Probe"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 30; + npc.height = 30; + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.damage = 0; + npc.defense = 0; + npc.lifeMax = 100; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override bool PreAI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + if (start) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + } + npc.ai[1] = npc.ai[0]; + start = false; + } + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= 9f; + npc.rotation = direction.ToRotation(); + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 360f) + { + npc.localAI[0] = 0f; + int num8 = expertMode ? 42 : 55; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 5f, direction.Y * 5f, mod.ProjectileType("DeusMine"), num8, 0f, Main.myPlayer, 0f, 0f); + } + bool anySmallDeusHeads = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); + if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + Player player = Main.player[npc.target]; + int npcType = (anySmallDeusHeads ? mod.NPCType("AstrumDeusHead") : mod.NPCType("AstrumDeusHeadSpectral")); + NPC parent = Main.npc[NPC.FindFirstNPC(npcType)]; + double deg = (double)npc.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 150; + npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.ai[1] += 2f; + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 5; 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), 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); + 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), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.velocity != Vector2.Zero) + { + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + for (int i = 1; i < npc.oldPos.Length; ++i) + { + Vector2 vector2_2 = npc.oldPos[i]; + Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; + color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); + color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); + color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); + color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), + npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); + } + } + return true; + } + } +} diff --git a/NPCs/AstrumDeus/AstrumDeusProbe3.cs b/NPCs/AstrumDeus/AstrumDeusProbe3.cs index 4368073dbd..98855666fd 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe3.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe3.cs @@ -1,313 +1,313 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusProbe3 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus Probe"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.npcSlots = 2f; - npc.damage = 0; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 30; - npc.lifeMax = 1400; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 120000; - } - npc.knockBackResist = 0.95f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.DeathSound = SoundID.NPCDeath14; - npc.buffImmune[24] = true; - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = revenge ? 6f : 5f; - float num2 = revenge ? 0.07f : 0.065f; - if (CalamityWorld.death) - { - num = 8f; - num2 = 0.08f; - } - 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] >= 180f) - { - 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)) - { - int num8 = 45; - if (Main.expertMode) - { - num8 = 35; - } - int num9 = 84; - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 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 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); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - 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 < 5; 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), 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); - 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), 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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 bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 90, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AstrumDeus +{ + public class AstrumDeusProbe3 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus Probe"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.npcSlots = 2f; + npc.damage = 0; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 30; + npc.lifeMax = 1400; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 120000; + } + npc.knockBackResist = 0.95f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.DeathSound = SoundID.NPCDeath14; + npc.buffImmune[24] = true; + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = revenge ? 6f : 5f; + float num2 = revenge ? 0.07f : 0.065f; + if (CalamityWorld.death) + { + num = 8f; + num2 = 0.08f; + } + 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] >= 180f) + { + 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)) + { + int num8 = 45; + if (Main.expertMode) + { + num8 = 35; + } + int num9 = 84; + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 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 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); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + 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 < 5; 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), 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); + 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), 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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 bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 90, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + } +} diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index a993f8008f..763b79f326 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -1,212 +1,212 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 70; - npc.npcSlots = 5f; - npc.width = 52; //324 - npc.height = 68; //216 - npc.defense = 60; - npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; - if (CalamityWorld.death) - { - npc.lifeMax = 29100; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - } - 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; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } - - public override Color? GetAlpha(Color drawColor) - { - if (npc.dontTakeDamage) - return new Color(125, 75, Main.DiscoB, npc.alpha); - return null; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } - else if (projectile.type == mod.ProjectileType("GoliathExplosion")) - { - damage = (int)((double)damage * 0.6); - } - if (projectile.penetrate == -1 && !projectile.minion) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1) - { - damage /= projectile.penetrate; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); - 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), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 90, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AstrumDeus +{ + public class AstrumDeusTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 70; + npc.npcSlots = 5f; + npc.width = 52; //324 + npc.height = 68; //216 + npc.defense = 60; + npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; + if (CalamityWorld.death) + { + npc.lifeMax = 29100; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + { + if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) + { + npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; + npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + } + } + 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; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return !npc.dontTakeDamage; + } + + public override Color? GetAlpha(Color drawColor) + { + if (npc.dontTakeDamage) + return new Color(125, 75, Main.DiscoB, npc.alpha); + return null; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } + else if (projectile.type == mod.ProjectileType("GoliathExplosion")) + { + damage = (int)((double)damage * 0.6); + } + if (projectile.penetrate == -1 && !projectile.minion) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1) + { + damage /= projectile.penetrate; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); + 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), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 90, true); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index 48a68558c9..564ab4123f 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -1,253 +1,253 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusTailSpectral : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 75; - npc.npcSlots = 5f; - npc.width = 52; //324 - npc.height = 68; //216 - npc.defense = 80; - npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; - if (CalamityWorld.death) - { - npc.lifeMax = 80700; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - 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/AstrumDeus"); - else - music = MusicID.Boss3; - npc.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - 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; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); - Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)((double)damage * 0.1); - } - else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) - { - damage = (int)((double)damage * 0.3); - } - else if (projectile.type == mod.ProjectileType("SpikecragSpike")) - { - damage = (int)((double)damage * 0.5); - } - else if (projectile.type == mod.ProjectileType("GoliathExplosion")) - { - damage = (int)((double)damage * 0.6); - } - if (projectile.penetrate == -1 && !projectile.minion) - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 1) - { - damage /= projectile.penetrate; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); - 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), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 90, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.AstrumDeus +{ + public class AstrumDeusTailSpectral : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + npc.damage = 75; + npc.npcSlots = 5f; + npc.width = 52; //324 + npc.height = 68; //216 + npc.defense = 80; + npc.lifeMax = CalamityWorld.revenge ? 53800 : 37500; + if (CalamityWorld.death) + { + npc.lifeMax = 80700; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + 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/AstrumDeus"); + else + music = MusicID.Boss3; + npc.dontCountMe = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + { + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; + npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + } + 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; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha); + Color newColor = (npc.dontTakeDamage ? lightColor : drawColor); + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return !npc.dontTakeDamage; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("RainbowBoom") || projectile.type == mod.ProjectileType("PlagueBee") || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)((double)damage * 0.1); + } + else if (projectile.type == mod.ProjectileType("RainBolt") || projectile.type == mod.ProjectileType("AtlantisSpear2")) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == mod.ProjectileType("CraniumSmasherExplosive") || projectile.type == mod.ProjectileType("BigNukeExplosion")) + { + damage = (int)((double)damage * 0.3); + } + else if (projectile.type == mod.ProjectileType("SpikecragSpike")) + { + damage = (int)((double)damage * 0.5); + } + else if (projectile.type == mod.ProjectileType("GoliathExplosion")) + { + damage = (int)((double)damage * 0.6); + } + if (projectile.penetrate == -1 && !projectile.minion) + { + damage = (int)((double)damage * 0.2); + } + else if (projectile.penetrate > 1) + { + damage /= projectile.penetrate; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 3f); + 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), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 90, true); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/BrimstoneWaifu/Brimling.cs b/NPCs/BrimstoneWaifu/Brimling.cs index c3af3410fb..908777184f 100644 --- a/NPCs/BrimstoneWaifu/Brimling.cs +++ b/NPCs/BrimstoneWaifu/Brimling.cs @@ -1,296 +1,296 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.BrimstoneWaifu -{ - public class Brimling : ModNPC - { - private bool boostDR = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimling"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.aiStyle = -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; - } - 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; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath39; - if (CalamityWorld.downedProvidence) - { - npc.lifeMax = 40000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 100000; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(boostDR); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - boostDR = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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); - if (CalamityGlobalNPC.brimstoneElemental < 0 || !Main.npc[CalamityGlobalNPC.brimstoneElemental].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - 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; - } - 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 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++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.BrimstoneWaifu +{ + public class Brimling : ModNPC + { + private bool boostDR = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimling"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.aiStyle = -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; + } + 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; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath39; + if (CalamityWorld.downedProvidence) + { + npc.lifeMax = 40000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 100000; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(boostDR); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + boostDR = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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); + if (CalamityGlobalNPC.brimstoneElemental < 0 || !Main.npc[CalamityGlobalNPC.brimstoneElemental].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + 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; + } + 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 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++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs index 0221b8707c..d7cd568ccf 100644 --- a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs +++ b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs @@ -1,617 +1,617 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.BrimstoneWaifu -{ - [AutoloadBossHead] - public class BrimstoneElemental : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Elemental"); - Main.npcFrameCount[npc.type] = 12; - } - - public override void SetDefaults() - { - npc.npcSlots = 64f; - npc.damage = 60; - npc.width = 100; - npc.height = 150; - npc.defense = 20; - npc.lifeMax = CalamityWorld.revenge ? 35708 : 26000; - if (CalamityWorld.death) - { - npc.lifeMax = 54050; - } - npc.knockBackResist = 0f; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.value = Item.buyPrice(0, 12, 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("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; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath39; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeftAlone"); - else - music = MusicID.Boss4; - bossBag = mod.ItemType("BrimstoneWaifuBag"); - if (CalamityWorld.downedProvidence) - { - npc.damage = 210; - npc.defense = 120; - npc.lifeMax = 300000; - npc.value = Item.buyPrice(0, 35, 0, 0); - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2300000 : 2000000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; - Player player = Main.player[npc.target]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - bool brimTeleport = (double)npc.life <= (double)npc.lifeMax * 0.2; - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool calamity = modPlayer.ZoneCalamity; - npc.TargetClosest(true); - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vectorCenter = npc.Center; - float xDistance = player.Center.X - center.X; - float yDistance = player.Center.Y - center.Y; - float totalDistance = (float)Math.Sqrt((double)(xDistance * xDistance + yDistance * yDistance)); - int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; - int size = (npc.ai[0] == 2f) ? 50 : 35; - float speed = expertMode ? 5f : 4.5f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - speed = 5.5f; - } - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < dustAmt) - { - int dust = Dust.NewDust(npc.Center - new Vector2((float)size), size * 2, size * 2, 235, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.2f; - Main.dust[dust].fadeIn = 1f; - } - } - if (Vector2.Distance(player.Center, vectorCenter) > 5600f) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - } - else if (npc.timeLeft > 1800) - { - npc.timeLeft = 1800; - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed = 11f; - } - else if (!calamity) - { - speed = 7f; - } - else if ((double)npc.life <= (double)npc.lifeMax * 0.65) - { - speed = expertMode ? 6f : 5f; - } - if (npc.ai[0] <= 2f) - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - 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 = provy ? 120 : 20; - npc.chaseable = true; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (npc.justHit) - { - npc.localAI[1] += 1f; - } - if (npc.localAI[1] >= (float)(200 + Main.rand.Next(100))) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int timer = 0; - int playerPosX; - int playerPosY; - while (true) - { - timer++; - playerPosX = (int)player.Center.X / 16; - playerPosY = (int)player.Center.Y / 16; - playerPosX += Main.rand.Next(-50, 51); - playerPosY += Main.rand.Next(-50, 51); - if (!WorldGen.SolidTile(playerPosX, playerPosY) && Collision.CanHit(new Vector2((float)(playerPosX * 16), (float)(playerPosY * 16)), 1, 1, player.position, player.width, player.height)) - { - break; - } - if (timer > 100) - { - return; - } - } - npc.ai[0] = 1f; - npc.ai[1] = (float)playerPosX; - npc.ai[2] = (float)playerPosY; - npc.netUpdate = true; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.dontTakeDamage = true; - npc.defense = provy ? 120 : 20; - npc.chaseable = false; - npc.alpha += (brimTeleport ? 5 : 4); - if (npc.alpha >= 255) - { - if (Main.netMode != 1 && NPC.CountNPCS(mod.NPCType("Brimling")) < 2 && revenge) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Brimling"), 0, 0f, 0f, 0f, 0f, 255); - } - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= (brimTeleport ? 5 : 4); - if (npc.alpha <= 0) - { - npc.dontTakeDamage = false; - npc.defense = provy ? 120 : 20; - npc.chaseable = true; - npc.ai[3] += 1f; - npc.alpha = 0; - if (npc.ai[3] >= 2f) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else - { - npc.ai[0] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - npc.defense = provy ? 120 : 20; - npc.dontTakeDamage = false; - npc.chaseable = true; - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - if (npc.ai[1] % 10f == 9f) - { - shootProjectile = true; - } - } - else if (CalamityWorld.bossRushActive) - { - if (npc.ai[1] % 15f == 14f) - { - shootProjectile = true; - } - } - else if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - if (npc.ai[1] % 20f == 19f) - { - shootProjectile = true; - } - } - else if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - if (npc.ai[1] % 25f == 24f) - { - shootProjectile = true; - } - } - else if (npc.ai[1] % 30f == 29f) - { - shootProjectile = true; - } - if (shootProjectile && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(shootFromVectorX, 1, 1, player.position, player.width, player.height)) - { - if (Main.netMode != 1) - { - float projectileSpeed = 6f; //changed from 10 - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - projectileSpeed += 4f; - } - if (revenge) - { - projectileSpeed += 1f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - projectileSpeed += 1f; //changed from 3 not a prob - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - projectileSpeed += 1f; - } - if (!calamity) - { - projectileSpeed += 2f; - } - float relativeSpeedX = player.position.X + (float)player.width * 0.5f - shootFromVectorX.X + (float)Main.rand.Next(-80, 81); - float relativeSpeedY = player.position.Y + (float)player.height * 0.5f - shootFromVectorX.Y + (float)Main.rand.Next(-40, 41); - float totalRelativeSpeed = (float)Math.Sqrt((double)(relativeSpeedX * relativeSpeedX + relativeSpeedY * relativeSpeedY)); - totalRelativeSpeed = projectileSpeed / totalRelativeSpeed; - relativeSpeedX *= totalRelativeSpeed; - relativeSpeedY *= totalRelativeSpeed; - int projectileDamage = expertMode ? 24 : 32; //projectile damage - int projectileType = mod.ProjectileType("BrimstoneHellfireball"); //projectile type - int projectileShot = Projectile.NewProjectile(shootFromVectorX.X, shootFromVectorX.Y, relativeSpeedX, relativeSpeedY, projectileType, projectileDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[projectileShot].timeLeft = 240; - } - } - if (npc.position.Y > player.position.Y - 150f) //200 - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.98f; - } - npc.velocity.Y = npc.velocity.Y - 0.1f; - if (npc.velocity.Y > 2f) - { - npc.velocity.Y = 2f; - } - } - else if (npc.position.Y < player.position.Y - 400f) //500 - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.98f; - } - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y < -2f) - { - npc.velocity.Y = -2f; - } - } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 150f) //100 - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X * 0.985f; - } - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > 8f) - { - npc.velocity.X = 8f; - } - } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 150f) //100 - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X * 0.985f; - } - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -8f) - { - npc.velocity.X = -8f; - } - } - if (npc.ai[1] > 300f) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - npc.defense = 99999; - npc.dontTakeDamage = false; - npc.chaseable = false; - if (Main.netMode != 1) - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.localAI[0] += 3f; - } - if (CalamityWorld.death || !calamity) - { - npc.localAI[0] += 2f; - } - if (npc.localAI[0] >= 140f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - float projectileSpeed = revenge ? 8f : 6f; - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - shootFromVector.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = projectileSpeed / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 22 : 30; - int num185 = mod.ProjectileType("BrimstoneHellblast"); - shootFromVector.X += num180; - shootFromVector.Y += num182; - for (int num186 = 0; num186 < 6; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - shootFromVector.X; - num182 = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = projectileSpeed / num183; - num180 += (float)Main.rand.Next(-80, 81); - num182 += (float)Main.rand.Next(-80, 81); - num180 *= num183; - num182 *= num183; - int projectile = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, num180, num182, num185, num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].timeLeft = 300; - Main.projectile[projectile].tileCollide = false; - } - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = expertMode ? 22 : 30; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int projectile = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 6f), (float)(Math.Cos(offsetAngle) * 6f), mod.ProjectileType("BrimstoneBarrage"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - int projectile2 = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 6f), (float)(-Math.Cos(offsetAngle) * 6f), mod.ProjectileType("BrimstoneBarrage"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - npc.TargetClosest(true); - npc.ai[1] += 1f; - npc.velocity *= 0.95f; - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (npc.ai[1] > 300f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - } - - 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) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - - public override void FindFrame(int frameHeight) //9 total frames - { - npc.frameCounter += 1.0; - if (npc.ai[0] <= 2f) - { - 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.ai[0] == 3f) - { - 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; - } - } - else - { - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y < frameHeight * 8) - { - npc.frame.Y = frameHeight * 8; - } - if (npc.frame.Y >= frameHeight * 12) - { - npc.frame.Y = frameHeight * 8; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneElementalTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - 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(20, 31)); - } - if (Main.rand.Next(10) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("RoseStone"), 1, true); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SoulofFright, Main.rand.Next(20, 41)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(4, 9)); - switch (Main.rand.Next(3)) - { - case 0: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Abaddon")); - break; - case 1: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Brimlance")); - break; - case 2: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeethingDischarge")); - break; - } - } - } - - 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 HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 200; - npc.height = 150; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore4"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.BrimstoneWaifu +{ + [AutoloadBossHead] + public class BrimstoneElemental : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Elemental"); + Main.npcFrameCount[npc.type] = 12; + } + + public override void SetDefaults() + { + npc.npcSlots = 64f; + npc.damage = 60; + npc.width = 100; + npc.height = 150; + npc.defense = 20; + npc.lifeMax = CalamityWorld.revenge ? 35708 : 26000; + if (CalamityWorld.death) + { + npc.lifeMax = 54050; + } + npc.knockBackResist = 0f; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.value = Item.buyPrice(0, 12, 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("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; + npc.netAlways = true; + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath39; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeftAlone"); + else + music = MusicID.Boss4; + bossBag = mod.ItemType("BrimstoneWaifuBag"); + if (CalamityWorld.downedProvidence) + { + npc.damage = 210; + npc.defense = 120; + npc.lifeMax = 300000; + npc.value = Item.buyPrice(0, 35, 0, 0); + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2300000 : 2000000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; + Player player = Main.player[npc.target]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + bool brimTeleport = (double)npc.life <= (double)npc.lifeMax * 0.2; + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool calamity = modPlayer.ZoneCalamity; + npc.TargetClosest(true); + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vectorCenter = npc.Center; + float xDistance = player.Center.X - center.X; + float yDistance = player.Center.Y - center.Y; + float totalDistance = (float)Math.Sqrt((double)(xDistance * xDistance + yDistance * yDistance)); + int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; + int size = (npc.ai[0] == 2f) ? 50 : 35; + float speed = expertMode ? 5f : 4.5f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + speed = 5.5f; + } + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < dustAmt) + { + int dust = Dust.NewDust(npc.Center - new Vector2((float)size), size * 2, size * 2, 235, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].fadeIn = 1f; + } + } + if (Vector2.Distance(player.Center, vectorCenter) > 5600f) + { + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + } + else if (npc.timeLeft > 1800) + { + npc.timeLeft = 1800; + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed = 11f; + } + else if (!calamity) + { + speed = 7f; + } + else if ((double)npc.life <= (double)npc.lifeMax * 0.65) + { + speed = expertMode ? 6f : 5f; + } + if (npc.ai[0] <= 2f) + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + 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 = provy ? 120 : 20; + npc.chaseable = true; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (npc.justHit) + { + npc.localAI[1] += 1f; + } + if (npc.localAI[1] >= (float)(200 + Main.rand.Next(100))) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int timer = 0; + int playerPosX; + int playerPosY; + while (true) + { + timer++; + playerPosX = (int)player.Center.X / 16; + playerPosY = (int)player.Center.Y / 16; + playerPosX += Main.rand.Next(-50, 51); + playerPosY += Main.rand.Next(-50, 51); + if (!WorldGen.SolidTile(playerPosX, playerPosY) && Collision.CanHit(new Vector2((float)(playerPosX * 16), (float)(playerPosY * 16)), 1, 1, player.position, player.width, player.height)) + { + break; + } + if (timer > 100) + { + return; + } + } + npc.ai[0] = 1f; + npc.ai[1] = (float)playerPosX; + npc.ai[2] = (float)playerPosY; + npc.netUpdate = true; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.dontTakeDamage = true; + npc.defense = provy ? 120 : 20; + npc.chaseable = false; + npc.alpha += (brimTeleport ? 5 : 4); + if (npc.alpha >= 255) + { + if (Main.netMode != 1 && NPC.CountNPCS(mod.NPCType("Brimling")) < 2 && revenge) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Brimling"), 0, 0f, 0f, 0f, 0f, 255); + } + npc.alpha = 255; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.alpha -= (brimTeleport ? 5 : 4); + if (npc.alpha <= 0) + { + npc.dontTakeDamage = false; + npc.defense = provy ? 120 : 20; + npc.chaseable = true; + npc.ai[3] += 1f; + npc.alpha = 0; + if (npc.ai[3] >= 2f) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else + { + npc.ai[0] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + npc.defense = provy ? 120 : 20; + npc.dontTakeDamage = false; + npc.chaseable = true; + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + if (npc.ai[1] % 10f == 9f) + { + shootProjectile = true; + } + } + else if (CalamityWorld.bossRushActive) + { + if (npc.ai[1] % 15f == 14f) + { + shootProjectile = true; + } + } + else if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + if (npc.ai[1] % 20f == 19f) + { + shootProjectile = true; + } + } + else if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + if (npc.ai[1] % 25f == 24f) + { + shootProjectile = true; + } + } + else if (npc.ai[1] % 30f == 29f) + { + shootProjectile = true; + } + if (shootProjectile && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(shootFromVectorX, 1, 1, player.position, player.width, player.height)) + { + if (Main.netMode != 1) + { + float projectileSpeed = 6f; //changed from 10 + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + projectileSpeed += 4f; + } + if (revenge) + { + projectileSpeed += 1f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + projectileSpeed += 1f; //changed from 3 not a prob + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + projectileSpeed += 1f; + } + if (!calamity) + { + projectileSpeed += 2f; + } + float relativeSpeedX = player.position.X + (float)player.width * 0.5f - shootFromVectorX.X + (float)Main.rand.Next(-80, 81); + float relativeSpeedY = player.position.Y + (float)player.height * 0.5f - shootFromVectorX.Y + (float)Main.rand.Next(-40, 41); + float totalRelativeSpeed = (float)Math.Sqrt((double)(relativeSpeedX * relativeSpeedX + relativeSpeedY * relativeSpeedY)); + totalRelativeSpeed = projectileSpeed / totalRelativeSpeed; + relativeSpeedX *= totalRelativeSpeed; + relativeSpeedY *= totalRelativeSpeed; + int projectileDamage = expertMode ? 24 : 32; //projectile damage + int projectileType = mod.ProjectileType("BrimstoneHellfireball"); //projectile type + int projectileShot = Projectile.NewProjectile(shootFromVectorX.X, shootFromVectorX.Y, relativeSpeedX, relativeSpeedY, projectileType, projectileDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[projectileShot].timeLeft = 240; + } + } + if (npc.position.Y > player.position.Y - 150f) //200 + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.98f; + } + npc.velocity.Y = npc.velocity.Y - 0.1f; + if (npc.velocity.Y > 2f) + { + npc.velocity.Y = 2f; + } + } + else if (npc.position.Y < player.position.Y - 400f) //500 + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.98f; + } + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y < -2f) + { + npc.velocity.Y = -2f; + } + } + if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 150f) //100 + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X * 0.985f; + } + npc.velocity.X = npc.velocity.X - 0.1f; + if (npc.velocity.X > 8f) + { + npc.velocity.X = 8f; + } + } + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 150f) //100 + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X * 0.985f; + } + npc.velocity.X = npc.velocity.X + 0.1f; + if (npc.velocity.X < -8f) + { + npc.velocity.X = -8f; + } + } + if (npc.ai[1] > 300f) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + npc.defense = 99999; + npc.dontTakeDamage = false; + npc.chaseable = false; + if (Main.netMode != 1) + { + npc.localAI[0] += (float)Main.rand.Next(4); + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npc.localAI[0] += 3f; + } + if (CalamityWorld.death || !calamity) + { + npc.localAI[0] += 2f; + } + if (npc.localAI[0] >= 140f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + float projectileSpeed = revenge ? 8f : 6f; + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - shootFromVector.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = projectileSpeed / num183; + num180 *= num183; + num182 *= num183; + int num184 = expertMode ? 22 : 30; + int num185 = mod.ProjectileType("BrimstoneHellblast"); + shootFromVector.X += num180; + shootFromVector.Y += num182; + for (int num186 = 0; num186 < 6; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - shootFromVector.X; + num182 = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = projectileSpeed / num183; + num180 += (float)Main.rand.Next(-80, 81); + num182 += (float)Main.rand.Next(-80, 81); + num180 *= num183; + num182 *= num183; + int projectile = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, num180, num182, num185, num184 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].timeLeft = 300; + Main.projectile[projectile].tileCollide = false; + } + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int damage = expertMode ? 22 : 30; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int projectile = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 6f), (float)(Math.Cos(offsetAngle) * 6f), mod.ProjectileType("BrimstoneBarrage"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + int projectile2 = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 6f), (float)(-Math.Cos(offsetAngle) * 6f), mod.ProjectileType("BrimstoneBarrage"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } + npc.TargetClosest(true); + npc.ai[1] += 1f; + npc.velocity *= 0.95f; + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (npc.ai[1] > 300f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + } + + 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) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + + public override void FindFrame(int frameHeight) //9 total frames + { + npc.frameCounter += 1.0; + if (npc.ai[0] <= 2f) + { + 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.ai[0] == 3f) + { + 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; + } + } + else + { + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y < frameHeight * 8) + { + npc.frame.Y = frameHeight * 8; + } + if (npc.frame.Y >= frameHeight * 12) + { + npc.frame.Y = frameHeight * 8; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneElementalTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + 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(20, 31)); + } + if (Main.rand.Next(10) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("RoseStone"), 1, true); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SoulofFright, Main.rand.Next(20, 41)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos"), Main.rand.Next(4, 9)); + switch (Main.rand.Next(3)) + { + case 0: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Abaddon")); + break; + case 1: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Brimlance")); + break; + case 2: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeethingDischarge")); + break; + } + } + } + + 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 HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 200; + npc.height = 150; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BrimstoneGore4"), 1f); + } + } + } +} diff --git a/NPCs/Bumblefuck/Bumblefuck.cs b/NPCs/Bumblefuck/Bumblefuck.cs index 79358d1dd6..4e18555efa 100644 --- a/NPCs/Bumblefuck/Bumblefuck.cs +++ b/NPCs/Bumblefuck/Bumblefuck.cs @@ -1,641 +1,641 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Bumblefuck -{ - [AutoloadBossHead] - public class Bumblefuck : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bumblebirb"); - Main.npcFrameCount[npc.type] = 10; - } - - public override void SetDefaults() - { - npc.npcSlots = 32f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 160; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 40; - npc.lifeMax = CalamityWorld.revenge ? 252500 : 227500; - if (CalamityWorld.death) - { - npc.lifeMax = 302500; - } - if (CalamityWorld.bossRushActive) - { - 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.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Murderswarm"); - else - music = MusicID.Boss4; - npc.lavaImmune = true; - npc.noGravity = true; - npc.value = Item.buyPrice(0, 30, 0, 0); - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath46; - bossBag = mod.ItemType("BumblebirbBag"); - } - - public override void AI() - { - Player player = Main.player[npc.target]; - bool revenge = CalamityWorld.revenge; - Vector2 vector = npc.Center; - int num1305 = revenge ? 6 : 4; - if (CalamityWorld.death) - { - num1305 = 8; - } - npc.noTileCollide = false; - npc.noGravity = true; - npc.damage = npc.defDamage; - if (Vector2.Distance(player.Center, vector) > 5600f) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - } - Vector2 vector205 = player.Center - npc.Center; - if (npc.ai[0] > 1f && vector205.Length() > 5200f) - { - npc.ai[0] = 1f; - } - 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 > 26f) //4 - { - npc.velocity.X = 26f; //4 - } - if (npc.velocity.X < -26f) //4 - { - npc.velocity.X = -26f; //4 - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > 26f) //4 - { - npc.velocity.Y = 26f; //4 - } - if (npc.velocity.Y < -26f) //4 - { - npc.velocity.Y = -26f; //4 - } - } - Vector2 value51 = player.Center - npc.Center; - value51.Y -= 200f; - if (value51.Length() > 800f) //800 Charge to get closer and spawn birbs - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (value51.Length() > 80f) - { - float scaleFactor15 = 12f; //6 - float num1306 = 30f; - value51.Normalize(); - value51 *= scaleFactor15; - npc.velocity = (npc.velocity * (num1306 - 1f) + value51) / num1306; - } - else if (npc.velocity.Length() > 18f) //8 - { - npc.velocity *= 0.95f; - } - else if (npc.velocity.Length() < 9f) //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 damage = Main.expertMode ? 45 : 60; //180 120 - 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; - } - else if (NPC.CountNPCS(mod.NPCType("Bumblefuck2")) < num1305) - { - npc.ai[0] = 4f; //summon more birbs - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 102); - for (int num186 = 0; num186 < 6; num186++) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-10, 10), (float)Main.rand.Next(-5, -2), mod.ProjectileType("RedLightningFeather"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - return; - } - } - else - { - if (npc.ai[0] == 1f) //move closer and spawn birbs - { - 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 = 13f + 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.9); - 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 > 27f) //4 - { - npc.velocity.X = 27f; //4 - } - if (npc.velocity.X < -27f) //4 - { - npc.velocity.X = -27f; //4 - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > 27f) //4 - { - npc.velocity.Y = 27f; //4 - } - if (npc.velocity.Y < -27f) //4 - { - npc.velocity.Y = -27f; //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 = 12f + 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] > 180f || !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 = 18f + 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 = 26f; //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 = (18f + npc.ai[2]) * npc.ai[1]; //16 - if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + 400f) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - 400f)) - { - 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) > 800f) //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; - } - if (npc.ai[0] == 4f) - { - npc.ai[0] = 0f; - npc.TargetClosest(true); - if (Main.netMode != 1) - { - npc.ai[1] = -1f; - npc.ai[2] = -1f; - for (int num1312 = 0; num1312 < 1000; num1312++) - { - int num1313 = (int)player.Center.X / 16; - int num1314 = (int)player.Center.Y / 16; - int num1315 = 30 + num1312 / 50; - int num1316 = 20 + num1312 / 75; - num1313 += Main.rand.Next(-num1315, num1315 + 1); - num1314 += Main.rand.Next(-num1316, num1316 + 1); - if (!WorldGen.SolidTile(num1313, num1314)) - { - while (!WorldGen.SolidTile(num1313, num1314) && (double)num1314 < Main.worldSurface) - { - num1314++; - } - if ((new Vector2((float)(num1313 * 16 + 8), (float)(num1314 * 16 + 8)) - player.Center).Length() < 5600f) //600 - { - npc.ai[0] = 4.1f; - npc.ai[1] = (float)num1313; - npc.ai[2] = (float)num1314; - break; - } - } - } - } - npc.netUpdate = true; - return; - } - if (npc.ai[0] == 4.1f) - { - if (npc.velocity.X < -2f) - { - npc.direction = -1; - } - else if (npc.velocity.X > 2f) - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - npc.noTileCollide = true; - int num1317 = (int)npc.ai[1]; - int num1318 = (int)npc.ai[2]; - float x2 = (float)(num1317 * 16 + 8); - float y2 = (float)(num1318 * 16 - 20); - Vector2 vector207 = new Vector2(x2, y2); - vector207 -= npc.Center; - float num1319 = 6f + vector207.Length() / 150f; - if (num1319 > 10f) - { - num1319 = 10f; - } - float num1320 = 10f; //10 - if (vector207.Length() < 100f) //10 - { - npc.ai[0] = 4.2f; - } - vector207.Normalize(); - vector207 *= num1319; - npc.velocity = (npc.velocity * (num1320 - 1f) + vector207) / num1320; - return; - } - if (npc.ai[0] == 4.2f) - { - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - npc.noTileCollide = true; - int num1321 = (int)npc.ai[1]; - int num1322 = (int)npc.ai[2]; - float x3 = (float)(num1321 * 16 + 8); - float y3 = (float)(num1322 * 16 - 20); - Vector2 vector208 = new Vector2(x3, y3); - vector208 -= npc.Center; - float num1323 = 40f; //4 - float num1324 = 2f; //2 - if (Main.netMode != 1 && vector208.Length() < 40f) //4 - { - int num1325 = 10; - if (Main.expertMode) - { - num1325 = (int)((double)num1325 * 0.75); - } - npc.ai[3] += 1f; - if (npc.ai[3] == (float)num1325) - { - NPC.NewNPC(num1321 * 16 + 8, num1322 * 16, mod.NPCType("Bumblefuck2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - else if (npc.ai[3] == (float)(num1325 * 2)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (NPC.CountNPCS(mod.NPCType("Bumblefuck2")) < num1305 && Main.rand.Next(5) != 0) - { - npc.ai[0] = 4f; - } - else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 1f; - } - } - } - if (vector208.Length() > num1323) - { - vector208.Normalize(); - vector208 *= num1323; - } - npc.velocity = (npc.velocity * (num1324 - 1f) + vector208) / num1324; - return; - } - } - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - 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 BossLoot(ref string name, ref int potionType) - { - name = "A Bumblebirb"; - potionType = ItemID.SuperHealingPotion; - } - - 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 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); - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleHead"), 1f); - for (int wing = 0; wing < 2; wing++) - { - randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleWing"), 1f); - } - for (int leg = 0; leg < 4; leg++) - { - randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleLeg"), 1f); - } - } - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BumblebirbTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - 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)) - { - case 0: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RougeSlash")); - break; - case 1: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GildedProboscis")); - break; - case 2: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GoldenEagle")); - break; - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Bumblefuck +{ + [AutoloadBossHead] + public class Bumblefuck : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bumblebirb"); + Main.npcFrameCount[npc.type] = 10; + } + + public override void SetDefaults() + { + npc.npcSlots = 32f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 160; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 40; + npc.lifeMax = CalamityWorld.revenge ? 252500 : 227500; + if (CalamityWorld.death) + { + npc.lifeMax = 302500; + } + if (CalamityWorld.bossRushActive) + { + 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.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Murderswarm"); + else + music = MusicID.Boss4; + npc.lavaImmune = true; + npc.noGravity = true; + npc.value = Item.buyPrice(0, 30, 0, 0); + npc.HitSound = SoundID.NPCHit51; + npc.DeathSound = SoundID.NPCDeath46; + bossBag = mod.ItemType("BumblebirbBag"); + } + + public override void AI() + { + Player player = Main.player[npc.target]; + bool revenge = CalamityWorld.revenge; + Vector2 vector = npc.Center; + int num1305 = revenge ? 6 : 4; + if (CalamityWorld.death) + { + num1305 = 8; + } + npc.noTileCollide = false; + npc.noGravity = true; + npc.damage = npc.defDamage; + if (Vector2.Distance(player.Center, vector) > 5600f) + { + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + } + Vector2 vector205 = player.Center - npc.Center; + if (npc.ai[0] > 1f && vector205.Length() > 5200f) + { + npc.ai[0] = 1f; + } + 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 > 26f) //4 + { + npc.velocity.X = 26f; //4 + } + if (npc.velocity.X < -26f) //4 + { + npc.velocity.X = -26f; //4 + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + if (npc.velocity.Y > 26f) //4 + { + npc.velocity.Y = 26f; //4 + } + if (npc.velocity.Y < -26f) //4 + { + npc.velocity.Y = -26f; //4 + } + } + Vector2 value51 = player.Center - npc.Center; + value51.Y -= 200f; + if (value51.Length() > 800f) //800 Charge to get closer and spawn birbs + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (value51.Length() > 80f) + { + float scaleFactor15 = 12f; //6 + float num1306 = 30f; + value51.Normalize(); + value51 *= scaleFactor15; + npc.velocity = (npc.velocity * (num1306 - 1f) + value51) / num1306; + } + else if (npc.velocity.Length() > 18f) //8 + { + npc.velocity *= 0.95f; + } + else if (npc.velocity.Length() < 9f) //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 damage = Main.expertMode ? 45 : 60; //180 120 + 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; + } + else if (NPC.CountNPCS(mod.NPCType("Bumblefuck2")) < num1305) + { + npc.ai[0] = 4f; //summon more birbs + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 102); + for (int num186 = 0; num186 < 6; num186++) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-10, 10), (float)Main.rand.Next(-5, -2), mod.ProjectileType("RedLightningFeather"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + return; + } + } + else + { + if (npc.ai[0] == 1f) //move closer and spawn birbs + { + 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 = 13f + 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.9); + 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 > 27f) //4 + { + npc.velocity.X = 27f; //4 + } + if (npc.velocity.X < -27f) //4 + { + npc.velocity.X = -27f; //4 + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + if (npc.velocity.Y > 27f) //4 + { + npc.velocity.Y = 27f; //4 + } + if (npc.velocity.Y < -27f) //4 + { + npc.velocity.Y = -27f; //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 = 12f + 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] > 180f || !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 = 18f + 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 = 26f; //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 = (18f + npc.ai[2]) * npc.ai[1]; //16 + if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + 400f) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - 400f)) + { + 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) > 800f) //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; + } + if (npc.ai[0] == 4f) + { + npc.ai[0] = 0f; + npc.TargetClosest(true); + if (Main.netMode != 1) + { + npc.ai[1] = -1f; + npc.ai[2] = -1f; + for (int num1312 = 0; num1312 < 1000; num1312++) + { + int num1313 = (int)player.Center.X / 16; + int num1314 = (int)player.Center.Y / 16; + int num1315 = 30 + num1312 / 50; + int num1316 = 20 + num1312 / 75; + num1313 += Main.rand.Next(-num1315, num1315 + 1); + num1314 += Main.rand.Next(-num1316, num1316 + 1); + if (!WorldGen.SolidTile(num1313, num1314)) + { + while (!WorldGen.SolidTile(num1313, num1314) && (double)num1314 < Main.worldSurface) + { + num1314++; + } + if ((new Vector2((float)(num1313 * 16 + 8), (float)(num1314 * 16 + 8)) - player.Center).Length() < 5600f) //600 + { + npc.ai[0] = 4.1f; + npc.ai[1] = (float)num1313; + npc.ai[2] = (float)num1314; + break; + } + } + } + } + npc.netUpdate = true; + return; + } + if (npc.ai[0] == 4.1f) + { + if (npc.velocity.X < -2f) + { + npc.direction = -1; + } + else if (npc.velocity.X > 2f) + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; + npc.noTileCollide = true; + int num1317 = (int)npc.ai[1]; + int num1318 = (int)npc.ai[2]; + float x2 = (float)(num1317 * 16 + 8); + float y2 = (float)(num1318 * 16 - 20); + Vector2 vector207 = new Vector2(x2, y2); + vector207 -= npc.Center; + float num1319 = 6f + vector207.Length() / 150f; + if (num1319 > 10f) + { + num1319 = 10f; + } + float num1320 = 10f; //10 + if (vector207.Length() < 100f) //10 + { + npc.ai[0] = 4.2f; + } + vector207.Normalize(); + vector207 *= num1319; + npc.velocity = (npc.velocity * (num1320 - 1f) + vector207) / num1320; + return; + } + if (npc.ai[0] == 4.2f) + { + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; + npc.noTileCollide = true; + int num1321 = (int)npc.ai[1]; + int num1322 = (int)npc.ai[2]; + float x3 = (float)(num1321 * 16 + 8); + float y3 = (float)(num1322 * 16 - 20); + Vector2 vector208 = new Vector2(x3, y3); + vector208 -= npc.Center; + float num1323 = 40f; //4 + float num1324 = 2f; //2 + if (Main.netMode != 1 && vector208.Length() < 40f) //4 + { + int num1325 = 10; + if (Main.expertMode) + { + num1325 = (int)((double)num1325 * 0.75); + } + npc.ai[3] += 1f; + if (npc.ai[3] == (float)num1325) + { + NPC.NewNPC(num1321 * 16 + 8, num1322 * 16, mod.NPCType("Bumblefuck2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + else if (npc.ai[3] == (float)(num1325 * 2)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + if (NPC.CountNPCS(mod.NPCType("Bumblefuck2")) < num1305 && Main.rand.Next(5) != 0) + { + npc.ai[0] = 4f; + } + else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 1f; + } + } + } + if (vector208.Length() > num1323) + { + vector208.Normalize(); + vector208 *= num1323; + } + npc.velocity = (npc.velocity * (num1324 - 1f) + vector208) / num1324; + return; + } + } + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + 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 BossLoot(ref string name, ref int potionType) + { + name = "A Bumblebirb"; + potionType = ItemID.SuperHealingPotion; + } + + 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 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); + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleHead"), 1f); + for (int wing = 0; wing < 2; wing++) + { + randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleWing"), 1f); + } + for (int leg = 0; leg < 4; leg++) + { + randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/BumbleLeg"), 1f); + } + } + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BumblebirbTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + 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)) + { + case 0: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RougeSlash")); + break; + case 1: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GildedProboscis")); + break; + case 2: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GoldenEagle")); + break; + } + } + } + } +} diff --git a/NPCs/Bumblefuck/Bumblefuck2.cs b/NPCs/Bumblefuck/Bumblefuck2.cs index 02b856afb8..da0370250f 100644 --- a/NPCs/Bumblefuck/Bumblefuck2.cs +++ b/NPCs/Bumblefuck/Bumblefuck2.cs @@ -1,345 +1,345 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Bumblefuck -{ - public class Bumblefuck2 : 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 = 110; - npc.width = 80; //324 - npc.height = 80; //216 - npc.scale = 0.66f; - npc.defense = 25; - npc.lifeMax = 30000; - if (CalamityWorld.bossRushActive) - { - 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() - { - Player player = Main.player[npc.target]; - bool revenge = CalamityWorld.revenge; - Vector2 vector = npc.Center; - npc.damage = npc.defDamage; - if (Vector2.Distance(player.Center, vector) > 5600f) - { - if (npc.timeLeft > 5) - { - npc.timeLeft = 5; - } - } - npc.noTileCollide = false; - npc.noGravity = true; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - if (npc.ai[0] == 0f || npc.ai[0] == 1f) - { - int num; - for (int num1376 = 0; num1376 < 200; num1376 = num + 1) - { - if (num1376 != npc.whoAmI && Main.npc[num1376].active && Main.npc[num1376].type == npc.type) - { - Vector2 value42 = Main.npc[num1376].Center - npc.Center; - if (value42.Length() < (float)(npc.width + npc.height)) - { - value42.Normalize(); - value42 *= -0.1f; - npc.velocity += value42; - NPC nPC6 = Main.npc[num1376]; - nPC6.velocity -= value42; - } - } - num = num1376; - } - } - if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - Vector2 vector240 = Main.player[npc.target].Center - npc.Center; - if (Main.player[npc.target].dead || vector240.Length() > 5600f) - { - npc.ai[0] = -1f; - } - } - else - { - Vector2 vector241 = Main.player[npc.target].Center - npc.Center; - if (npc.ai[0] > 1f && vector241.Length() > 1000f) - { - npc.ai[0] = 1f; - } - } - if (npc.ai[0] == -1f) - { - Vector2 value43 = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * 21f + value43) / 10f; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - return; - } - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > 21f) - { - npc.velocity.X = 21f; - } - if (npc.velocity.X < -21f) - { - npc.velocity.X = -21f; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > 21f) - { - npc.velocity.Y = 21f; - } - if (npc.velocity.Y < -21f) - { - npc.velocity.Y = -21f; - } - } - Vector2 value44 = Main.player[npc.target].Center - npc.Center; - if (value44.Length() > 1600f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (value44.Length() > 400f) - { - float scaleFactor20 = 5.5f + value44.Length() / 100f + npc.ai[1] / 15f; - float num1377 = 30f; - value44.Normalize(); - value44 *= scaleFactor20; - npc.velocity = (npc.velocity * (num1377 - 1f) + value44) / 29.9f; //39 - } - else if (npc.velocity.Length() > 20f) - { - npc.velocity *= 0.95f; - } - else if (npc.velocity.Length() < 10f) - { - npc.velocity *= 1.05f; - } - npc.ai[1] += 1f; - if (npc.ai[1] >= 90f) - { - npc.ai[1] = 0f; - npc.ai[0] = 2f; - return; - } - } - else - { - if (npc.ai[0] == 1f) - { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - npc.knockBackResist = 0f; - if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].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 value45 = Main.player[npc.target].Center - npc.Center; - if (value45.Length() < 1200f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - npc.ai[2] += 0.0166666675f; - float scaleFactor21 = 5.5f + npc.ai[2] + value45.Length() / 150f; - float num1378 = 26f; - value45.Normalize(); - value45 *= scaleFactor21; - npc.velocity = (npc.velocity * (num1378 - 1f) + value45) / 25.9f; //34.5 - return; - } - if (npc.ai[0] == 2f) - { - 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 * 7f + npc.velocity.X * 0.05f) / 8f; - npc.knockBackResist = 0f; - npc.noTileCollide = true; - Vector2 vector242 = Main.player[npc.target].Center - npc.Center; - vector242.Y -= 8f; - float scaleFactor22 = 21f; //9 - float num1379 = 8f; - vector242.Normalize(); - vector242 *= scaleFactor22; - npc.velocity = (npc.velocity * (num1379 - 1f) + vector242) / 8f; //7.9 - 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 = vector242; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.ai[0] = 2.1f; - npc.ai[1] = 0f; - return; - } - } - else if (npc.ai[0] == 2.1f) - { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else if (npc.velocity.X > 0f) - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.velocity *= 1.01f; - npc.knockBackResist = 0f; - npc.noTileCollide = true; - npc.ai[1] += 1f; - int num1380 = 30; //45 - if (npc.ai[1] > (float)num1380) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - return; - } - if (npc.ai[1] > (float)(num1380 * 2)) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - return; - } - } - } - } - } - - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Bumblefuck +{ + public class Bumblefuck2 : 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 = 110; + npc.width = 80; //324 + npc.height = 80; //216 + npc.scale = 0.66f; + npc.defense = 25; + npc.lifeMax = 30000; + if (CalamityWorld.bossRushActive) + { + 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() + { + Player player = Main.player[npc.target]; + bool revenge = CalamityWorld.revenge; + Vector2 vector = npc.Center; + npc.damage = npc.defDamage; + if (Vector2.Distance(player.Center, vector) > 5600f) + { + if (npc.timeLeft > 5) + { + npc.timeLeft = 5; + } + } + npc.noTileCollide = false; + npc.noGravity = true; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; + if (npc.ai[0] == 0f || npc.ai[0] == 1f) + { + int num; + for (int num1376 = 0; num1376 < 200; num1376 = num + 1) + { + if (num1376 != npc.whoAmI && Main.npc[num1376].active && Main.npc[num1376].type == npc.type) + { + Vector2 value42 = Main.npc[num1376].Center - npc.Center; + if (value42.Length() < (float)(npc.width + npc.height)) + { + value42.Normalize(); + value42 *= -0.1f; + npc.velocity += value42; + NPC nPC6 = Main.npc[num1376]; + nPC6.velocity -= value42; + } + } + num = num1376; + } + } + if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + Vector2 vector240 = Main.player[npc.target].Center - npc.Center; + if (Main.player[npc.target].dead || vector240.Length() > 5600f) + { + npc.ai[0] = -1f; + } + } + else + { + Vector2 vector241 = Main.player[npc.target].Center - npc.Center; + if (npc.ai[0] > 1f && vector241.Length() > 1000f) + { + npc.ai[0] = 1f; + } + } + if (npc.ai[0] == -1f) + { + Vector2 value43 = new Vector2(0f, -8f); + npc.velocity = (npc.velocity * 21f + value43) / 10f; + npc.noTileCollide = true; + npc.dontTakeDamage = true; + return; + } + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); + if (npc.velocity.X > 21f) + { + npc.velocity.X = 21f; + } + if (npc.velocity.X < -21f) + { + npc.velocity.X = -21f; + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + if (npc.velocity.Y > 21f) + { + npc.velocity.Y = 21f; + } + if (npc.velocity.Y < -21f) + { + npc.velocity.Y = -21f; + } + } + Vector2 value44 = Main.player[npc.target].Center - npc.Center; + if (value44.Length() > 1600f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (value44.Length() > 400f) + { + float scaleFactor20 = 5.5f + value44.Length() / 100f + npc.ai[1] / 15f; + float num1377 = 30f; + value44.Normalize(); + value44 *= scaleFactor20; + npc.velocity = (npc.velocity * (num1377 - 1f) + value44) / 29.9f; //39 + } + else if (npc.velocity.Length() > 20f) + { + npc.velocity *= 0.95f; + } + else if (npc.velocity.Length() < 10f) + { + npc.velocity *= 1.05f; + } + npc.ai[1] += 1f; + if (npc.ai[1] >= 90f) + { + npc.ai[1] = 0f; + npc.ai[0] = 2f; + return; + } + } + else + { + if (npc.ai[0] == 1f) + { + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + npc.knockBackResist = 0f; + if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].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 value45 = Main.player[npc.target].Center - npc.Center; + if (value45.Length() < 1200f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + npc.ai[2] += 0.0166666675f; + float scaleFactor21 = 5.5f + npc.ai[2] + value45.Length() / 150f; + float num1378 = 26f; + value45.Normalize(); + value45 *= scaleFactor21; + npc.velocity = (npc.velocity * (num1378 - 1f) + value45) / 25.9f; //34.5 + return; + } + if (npc.ai[0] == 2f) + { + 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 * 7f + npc.velocity.X * 0.05f) / 8f; + npc.knockBackResist = 0f; + npc.noTileCollide = true; + Vector2 vector242 = Main.player[npc.target].Center - npc.Center; + vector242.Y -= 8f; + float scaleFactor22 = 21f; //9 + float num1379 = 8f; + vector242.Normalize(); + vector242 *= scaleFactor22; + npc.velocity = (npc.velocity * (num1379 - 1f) + vector242) / 8f; //7.9 + 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 = vector242; + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.ai[0] = 2.1f; + npc.ai[1] = 0f; + return; + } + } + else if (npc.ai[0] == 2.1f) + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else if (npc.velocity.X > 0f) + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.velocity *= 1.01f; + npc.knockBackResist = 0f; + npc.noTileCollide = true; + npc.ai[1] += 1f; + int num1380 = 30; //45 + if (npc.ai[1] > (float)num1380) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + return; + } + if (npc.ai[1] > (float)(num1380 * 2)) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + return; + } + } + } + } + } + + 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); + } + } + } + } +} diff --git a/NPCs/Calamitas/CalScreenShaderData.cs b/NPCs/Calamitas/CalScreenShaderData.cs index 42a1eb8c9c..e2e8a841ba 100644 --- a/NPCs/Calamitas/CalScreenShaderData.cs +++ b/NPCs/Calamitas/CalScreenShaderData.cs @@ -1,44 +1,44 @@ -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Calamitas -{ - public class CalScreenShaderData : ScreenShaderData - { - private int CalIndex; - - public CalScreenShaderData(string passName) - : base(passName) - { - } - - private void UpdateCalIndex() - { - int CalType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); - if (CalIndex >= 0 && Main.npc[CalIndex].active && Main.npc[CalIndex].type == CalType) - { - return; - } - CalIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == CalType) - { - CalIndex = i; - break; - } - } - } - - public override void Apply() - { - UpdateCalIndex(); - if (CalIndex != -1) - { - UseTargetPosition(Main.npc[CalIndex].Center); - } - base.Apply(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Calamitas +{ + public class CalScreenShaderData : ScreenShaderData + { + private int CalIndex; + + public CalScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateCalIndex() + { + int CalType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); + if (CalIndex >= 0 && Main.npc[CalIndex].active && Main.npc[CalIndex].type == CalType) + { + return; + } + CalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == CalType) + { + CalIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateCalIndex(); + if (CalIndex != -1) + { + UseTargetPosition(Main.npc[CalIndex].Center); + } + base.Apply(); + } + } +} diff --git a/NPCs/Calamitas/CalSky.cs b/NPCs/Calamitas/CalSky.cs index dea19b389d..c3e99cebed 100644 --- a/NPCs/Calamitas/CalSky.cs +++ b/NPCs/Calamitas/CalSky.cs @@ -1,101 +1,101 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Calamitas -{ - public class CalSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int CalIndex = -1; - - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } - - private float GetIntensity() - { - if (this.UpdateCalIndex()) - { - float x = 0f; - if (this.CalIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.CalIndex].Center); - } - return 1f - Utils.SmoothStep(3000f, 6000f, x); - } - return 0f; - } - - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } - - private bool UpdateCalIndex() - { - int CalType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); - if (CalIndex >= 0 && Main.npc[CalIndex].active && Main.npc[CalIndex].type == CalType) - { - return true; - } - CalIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == CalType) - { - CalIndex = i; - break; - } - } - //this.DoGIndex = DoGIndex; - return CalIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); - } - } - - public override float GetCloudAlpha() - { - return 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } - - public override void Deactivate(params object[] args) - { - isActive = false; - } - - public override void Reset() - { - isActive = false; - } - - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Calamitas +{ + public class CalSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int CalIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdateCalIndex()) + { + float x = 0f; + if (this.CalIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.CalIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateCalIndex() + { + int CalType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); + if (CalIndex >= 0 && Main.npc[CalIndex].active && Main.npc[CalIndex].type == CalType) + { + return true; + } + CalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == CalType) + { + CalIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return CalIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs index d801e307fb..763f4ecedd 100644 --- a/NPCs/Calamitas/Calamitas.cs +++ b/NPCs/Calamitas/Calamitas.cs @@ -1,467 +1,467 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria.Localization; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Calamitas -{ - [AutoloadBossHead] - public class Calamitas : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 70; - npc.npcSlots = 14f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 15; - npc.value = 0f; - npc.lifeMax = CalamityWorld.revenge ? 51750 : 37500; - if (CalamityWorld.death) - { - npc.lifeMax = 82750; - } - 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.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - music = MusicID.Boss2; - if (CalamityWorld.downedProvidence) - { - npc.damage = 150; - npc.defense = 130; - npc.lifeMax *= 3; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 4600000 : 4100000; - } - 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 AI() - { - if ((double)npc.life <= (double)npc.lifeMax * 0.75 && Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun3"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - string key = "Mods.CalamityMod.CalamitasBossText"; - 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.active = false; - npc.netUpdate = true; - return; - } - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool dayTime = Main.dayTime; - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - } - float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; - if (num803 < 0f) - { - num803 += 6.283f; - } - else if ((double)num803 > 6.283) - { - num803 -= 6.283f; - } - float num804 = 0.1f; - if (npc.rotation < num803) - { - if ((double)(num803 - npc.rotation) > 3.1415) - { - npc.rotation -= num804; - } - else - { - npc.rotation += num804; - } - } - else if (npc.rotation > num803) - { - if ((double)(npc.rotation - num803) > 3.1415) - { - npc.rotation += num804; - } - else - { - npc.rotation -= num804; - } - } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - { - npc.rotation = num803; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.283f; - } - else if ((double)npc.rotation > 6.283) - { - npc.rotation -= 6.283f; - } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - { - npc.rotation = num803; - } - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - 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[1] == 0f) - { - float num823 = expertMode ? 9.5f : 8f; - float num824 = expertMode ? 0.175f : 0.15f; - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - 300f - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; - if (npc.velocity.X < num825) - { - npc.velocity.X = npc.velocity.X + num824; - if (npc.velocity.X < 0f && num825 > 0f) - { - npc.velocity.X = npc.velocity.X + num824; - } - } - else if (npc.velocity.X > num825) - { - npc.velocity.X = npc.velocity.X - num824; - if (npc.velocity.X > 0f && num825 < 0f) - { - npc.velocity.X = npc.velocity.X - num824; - } - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y = npc.velocity.Y + num824; - if (npc.velocity.Y < 0f && num826 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num824; - } - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y = npc.velocity.Y - num824; - if (npc.velocity.Y > 0f && num826 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num824; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (revenge) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1f; - } - if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - float num828 = expertMode ? 13f : 10.5f; - int num829 = expertMode ? 24 : 30; - int num830 = mod.ProjectileType("BrimstoneLaser"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - else - { - int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num831 = -1; - } - float num832 = expertMode ? 9.5f : 8f; - float num833 = expertMode ? 0.25f : 0.2f; - Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 360) - vector83.X; - float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num832 / num836; - num834 *= num836; - num835 *= num836; - if (npc.velocity.X < num834) - { - npc.velocity.X = npc.velocity.X + num833; - if (npc.velocity.X < 0f && num834 > 0f) - { - npc.velocity.X = npc.velocity.X + num833; - } - } - else if (npc.velocity.X > num834) - { - npc.velocity.X = npc.velocity.X - num833; - if (npc.velocity.X > 0f && num834 < 0f) - { - npc.velocity.X = npc.velocity.X - num833; - } - } - if (npc.velocity.Y < num835) - { - npc.velocity.Y = npc.velocity.Y + num833; - if (npc.velocity.Y < 0f && num835 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num833; - } - } - else if (npc.velocity.Y > num835) - { - npc.velocity.Y = npc.velocity.Y - num833; - if (npc.velocity.Y > 0f && num835 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num833; - } - } - vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (revenge) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1f; - } - if (Main.expertMode || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - float num837 = 10.5f; - int num838 = expertMode ? 15 : 22; - int num839 = mod.ProjectileType("BrimstoneLaser"); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 15f; - vector83.Y += num835 * 15f; - Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 180f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life > 0) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - } - else - { - 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Localization; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Calamitas +{ + [AutoloadBossHead] + public class Calamitas : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 70; + npc.npcSlots = 14f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 15; + npc.value = 0f; + npc.lifeMax = CalamityWorld.revenge ? 51750 : 37500; + if (CalamityWorld.death) + { + npc.lifeMax = 82750; + } + 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.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + music = MusicID.Boss2; + if (CalamityWorld.downedProvidence) + { + npc.damage = 150; + npc.defense = 130; + npc.lifeMax *= 3; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 4600000 : 4100000; + } + 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 AI() + { + if ((double)npc.life <= (double)npc.lifeMax * 0.75 && Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun3"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + string key = "Mods.CalamityMod.CalamitasBossText"; + 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.active = false; + npc.netUpdate = true; + return; + } + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool dayTime = Main.dayTime; + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + } + float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); + float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); + float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; + if (num803 < 0f) + { + num803 += 6.283f; + } + else if ((double)num803 > 6.283) + { + num803 -= 6.283f; + } + float num804 = 0.1f; + if (npc.rotation < num803) + { + if ((double)(num803 - npc.rotation) > 3.1415) + { + npc.rotation -= num804; + } + else + { + npc.rotation += num804; + } + } + else if (npc.rotation > num803) + { + if ((double)(npc.rotation - num803) > 3.1415) + { + npc.rotation += num804; + } + else + { + npc.rotation -= num804; + } + } + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + { + npc.rotation = num803; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.283f; + } + else if ((double)npc.rotation > 6.283) + { + npc.rotation -= 6.283f; + } + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + { + npc.rotation = num803; + } + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + 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[1] == 0f) + { + float num823 = expertMode ? 9.5f : 8f; + float num824 = expertMode ? 0.175f : 0.15f; + Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num825 = player.position.X + (float)(player.width / 2) - vector82.X; + float num826 = player.position.Y + (float)(player.height / 2) - 300f - vector82.Y; + float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; + if (npc.velocity.X < num825) + { + npc.velocity.X = npc.velocity.X + num824; + if (npc.velocity.X < 0f && num825 > 0f) + { + npc.velocity.X = npc.velocity.X + num824; + } + } + else if (npc.velocity.X > num825) + { + npc.velocity.X = npc.velocity.X - num824; + if (npc.velocity.X > 0f && num825 < 0f) + { + npc.velocity.X = npc.velocity.X - num824; + } + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y = npc.velocity.Y + num824; + if (npc.velocity.Y < 0f && num826 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num824; + } + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y = npc.velocity.Y - num824; + if (npc.velocity.Y > 0f && num826 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num824; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num825 = player.position.X + (float)(player.width / 2) - vector82.X; + num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (revenge) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1f; + } + if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.localAI[1] = 0f; + float num828 = expertMode ? 13f : 10.5f; + int num829 = expertMode ? 24 : 30; + int num830 = mod.ProjectileType("BrimstoneLaser"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 15f; + vector82.Y += num826 * 15f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } + else + { + int num831 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num831 = -1; + } + float num832 = expertMode ? 9.5f : 8f; + float num833 = expertMode ? 0.25f : 0.2f; + Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 360) - vector83.X; + float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num832 / num836; + num834 *= num836; + num835 *= num836; + if (npc.velocity.X < num834) + { + npc.velocity.X = npc.velocity.X + num833; + if (npc.velocity.X < 0f && num834 > 0f) + { + npc.velocity.X = npc.velocity.X + num833; + } + } + else if (npc.velocity.X > num834) + { + npc.velocity.X = npc.velocity.X - num833; + if (npc.velocity.X > 0f && num834 < 0f) + { + npc.velocity.X = npc.velocity.X - num833; + } + } + if (npc.velocity.Y < num835) + { + npc.velocity.Y = npc.velocity.Y + num833; + if (npc.velocity.Y < 0f && num835 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num833; + } + } + else if (npc.velocity.Y > num835) + { + npc.velocity.Y = npc.velocity.Y - num833; + if (npc.velocity.Y > 0f && num835 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num833; + } + } + vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num834 = player.position.X + (float)(player.width / 2) - vector83.X; + num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (revenge) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1f; + } + if (Main.expertMode || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.localAI[1] = 0f; + float num837 = 10.5f; + int num838 = expertMode ? 15 : 22; + int num839 = mod.ProjectileType("BrimstoneLaser"); + num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 15f; + vector83.Y += num835 * 15f; + Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 180f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life > 0) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + } + else + { + 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); + } + } +} diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 5bae249b73..447462039c 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -1,511 +1,511 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Calamitas -{ - [AutoloadBossHead] - public class CalamitasRun : ModNPC - { - private bool canDespawn = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclysm"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 60; - npc.npcSlots = 5f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 10; - npc.lifeMax = CalamityWorld.revenge ? 13200 : 9000; - if (CalamityWorld.death) - { - npc.lifeMax = 15000; - } - 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.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; - if (CalamityWorld.downedProvidence) - { - npc.damage = 170; - npc.defense = 80; - npc.lifeMax *= 3; - } - 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 SendExtraAI(BinaryWriter writer) - { - writer.Write(canDespawn); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - canDespawn = reader.ReadBoolean(); - } - - 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() - { - CalamityGlobalNPC.cataclysm = npc.whoAmI; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool dayTime = Main.dayTime; - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - } - float num840 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num841 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num842 = (float)Math.Atan2((double)num841, (double)num840) + 1.57f; - if (num842 < 0f) - { - num842 += 6.283f; - } - else if ((double)num842 > 6.283) - { - num842 -= 6.283f; - } - float num843 = 0.15f; - if (npc.rotation < num842) - { - if ((double)(num842 - npc.rotation) > 3.1415) - { - npc.rotation -= num843; - } - else - { - npc.rotation += num843; - } - } - else if (npc.rotation > num842) - { - if ((double)(npc.rotation - num842) > 3.1415) - { - npc.rotation += num843; - } - else - { - npc.rotation -= num843; - } - } - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - { - npc.rotation = num842; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.283f; - } - else if ((double)npc.rotation > 6.283) - { - npc.rotation -= 6.283f; - } - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - { - npc.rotation = num842; - } - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.velocity = new Vector2(0f, -10f); - canDespawn = true; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else - { - canDespawn = false; - } - if (npc.ai[1] == 0f) - { - float num861 = 5f; - float num862 = 0.1f; - int num863 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.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 = player.position.X + (float)(player.width / 2) + (float)(num863 * 180) - vector86.X; - float num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; - float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - if (expertMode) - { - if (num866 > 300f) - { - num861 += 0.5f; - } - if (num866 > 400f) - { - num861 += 0.5f; - } - if (num866 > 500f) - { - num861 += 0.55f; - } - if (num866 > 600f) - { - num861 += 0.55f; - } - if (num866 > 700f) - { - num861 += 0.6f; - } - if (num866 > 800f) - { - num861 += 0.6f; - } - } - num866 = num861 / num866; - num864 *= num866; - num865 *= num866; - if (npc.velocity.X < num864) - { - npc.velocity.X = npc.velocity.X + num862; - if (npc.velocity.X < 0f && num864 > 0f) - { - npc.velocity.X = npc.velocity.X + num862; - } - } - else if (npc.velocity.X > num864) - { - npc.velocity.X = npc.velocity.X - num862; - if (npc.velocity.X > 0f && num864 < 0f) - { - npc.velocity.X = npc.velocity.X - num862; - } - } - if (npc.velocity.Y < num865) - { - npc.velocity.Y = npc.velocity.Y + num862; - if (npc.velocity.Y < 0f && num865 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num862; - } - } - else if (npc.velocity.Y > num865) - { - npc.velocity.Y = npc.velocity.Y - num862; - if (npc.velocity.Y > 0f && num865 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num862; - } - } - npc.ai[2] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); - if (npc.ai[2] >= 240f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - 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) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 22f) - { - npc.localAI[2] = 0f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); - } - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (revenge) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if (npc.localAI[1] > 12f) - { - npc.localAI[1] = 0f; - float num867 = 6f; - int num868 = expertMode ? 26 : 32; - int num869 = mod.ProjectileType("BrimstoneFire"); - vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num864 = player.position.X + (float)(player.width / 2) - vector86.X; - num865 = player.position.Y + (float)(player.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(-40, 41) * 0.01f; - num864 += (float)Main.rand.Next(-40, 41) * 0.01f; - num865 += npc.velocity.Y * 0.5f; - num864 += npc.velocity.X * 0.5f; - vector86.X -= num864 * 1f; - vector86.Y -= num865 * 1f; - Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); - npc.rotation = num842; - float num870 = 14f; - if (expertMode) - { - num870 += 2.5f; - } - if (revenge) - { - num870 += 2.5f; - } - 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; - float num873 = (float)Math.Sqrt((double)(num871 * num871 + num872 * num872)); - num873 = num870 / num873; - npc.velocity.X = num871 * num873; - npc.velocity.Y = num872 * num873; - npc.ai[1] = 2f; - return; - } - if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (expertMode) - { - npc.ai[2] += 0.5f; - } - if (revenge) - { - npc.ai[2] += 0.5f; - } - if (npc.ai[2] >= 75f) - { - npc.velocity.X = npc.velocity.X * 0.93f; - npc.velocity.Y = npc.velocity.Y * 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - if (npc.ai[2] >= 105f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num842; - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (npc.ai[1] > 0f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool CheckActive() - { - return canDespawn; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CataclysmTrophy")); - } - 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("BrimstoneFlamesprayer")); - } - else if (Main.rand.Next(12) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlamesprayer")); - } - 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("BrimstoneFlameblaster")); - } - else if (Main.rand.Next(12) == 0) - { - 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++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm5"), 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Calamitas +{ + [AutoloadBossHead] + public class CalamitasRun : ModNPC + { + private bool canDespawn = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclysm"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 60; + npc.npcSlots = 5f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 10; + npc.lifeMax = CalamityWorld.revenge ? 13200 : 9000; + if (CalamityWorld.death) + { + npc.lifeMax = 15000; + } + 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.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; + if (CalamityWorld.downedProvidence) + { + npc.damage = 170; + npc.defense = 80; + npc.lifeMax *= 3; + } + 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 SendExtraAI(BinaryWriter writer) + { + writer.Write(canDespawn); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + canDespawn = reader.ReadBoolean(); + } + + 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() + { + CalamityGlobalNPC.cataclysm = npc.whoAmI; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool dayTime = Main.dayTime; + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + } + float num840 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); + float num841 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); + float num842 = (float)Math.Atan2((double)num841, (double)num840) + 1.57f; + if (num842 < 0f) + { + num842 += 6.283f; + } + else if ((double)num842 > 6.283) + { + num842 -= 6.283f; + } + float num843 = 0.15f; + if (npc.rotation < num842) + { + if ((double)(num842 - npc.rotation) > 3.1415) + { + npc.rotation -= num843; + } + else + { + npc.rotation += num843; + } + } + else if (npc.rotation > num842) + { + if ((double)(npc.rotation - num842) > 3.1415) + { + npc.rotation += num843; + } + else + { + npc.rotation -= num843; + } + } + if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) + { + npc.rotation = num842; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.283f; + } + else if ((double)npc.rotation > 6.283) + { + npc.rotation -= 6.283f; + } + if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) + { + npc.rotation = num842; + } + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.velocity = new Vector2(0f, -10f); + canDespawn = true; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else + { + canDespawn = false; + } + if (npc.ai[1] == 0f) + { + float num861 = 5f; + float num862 = 0.1f; + int num863 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.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 = player.position.X + (float)(player.width / 2) + (float)(num863 * 180) - vector86.X; + float num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; + float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + if (expertMode) + { + if (num866 > 300f) + { + num861 += 0.5f; + } + if (num866 > 400f) + { + num861 += 0.5f; + } + if (num866 > 500f) + { + num861 += 0.55f; + } + if (num866 > 600f) + { + num861 += 0.55f; + } + if (num866 > 700f) + { + num861 += 0.6f; + } + if (num866 > 800f) + { + num861 += 0.6f; + } + } + num866 = num861 / num866; + num864 *= num866; + num865 *= num866; + if (npc.velocity.X < num864) + { + npc.velocity.X = npc.velocity.X + num862; + if (npc.velocity.X < 0f && num864 > 0f) + { + npc.velocity.X = npc.velocity.X + num862; + } + } + else if (npc.velocity.X > num864) + { + npc.velocity.X = npc.velocity.X - num862; + if (npc.velocity.X > 0f && num864 < 0f) + { + npc.velocity.X = npc.velocity.X - num862; + } + } + if (npc.velocity.Y < num865) + { + npc.velocity.Y = npc.velocity.Y + num862; + if (npc.velocity.Y < 0f && num865 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num862; + } + } + else if (npc.velocity.Y > num865) + { + npc.velocity.Y = npc.velocity.Y - num862; + if (npc.velocity.Y > 0f && num865 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num862; + } + } + npc.ai[2] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); + if (npc.ai[2] >= 240f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + 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) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] > 22f) + { + npc.localAI[2] = 0f; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); + } + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (revenge) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if (npc.localAI[1] > 12f) + { + npc.localAI[1] = 0f; + float num867 = 6f; + int num868 = expertMode ? 26 : 32; + int num869 = mod.ProjectileType("BrimstoneFire"); + vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num864 = player.position.X + (float)(player.width / 2) - vector86.X; + num865 = player.position.Y + (float)(player.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(-40, 41) * 0.01f; + num864 += (float)Main.rand.Next(-40, 41) * 0.01f; + num865 += npc.velocity.Y * 0.5f; + num864 += npc.velocity.X * 0.5f; + vector86.X -= num864 * 1f; + vector86.Y -= num865 * 1f; + Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + if (npc.ai[1] == 1f) + { + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + npc.rotation = num842; + float num870 = 14f; + if (expertMode) + { + num870 += 2.5f; + } + if (revenge) + { + num870 += 2.5f; + } + 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; + float num873 = (float)Math.Sqrt((double)(num871 * num871 + num872 * num872)); + num873 = num870 / num873; + npc.velocity.X = num871 * num873; + npc.velocity.Y = num872 * num873; + npc.ai[1] = 2f; + return; + } + if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (expertMode) + { + npc.ai[2] += 0.5f; + } + if (revenge) + { + npc.ai[2] += 0.5f; + } + if (npc.ai[2] >= 75f) + { + npc.velocity.X = npc.velocity.X * 0.93f; + npc.velocity.Y = npc.velocity.Y * 0.93f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + if (npc.ai[2] >= 105f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num842; + if (npc.ai[3] >= 3f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return; + } + npc.ai[1] = 1f; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (npc.ai[1] > 0f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool CheckActive() + { + return canDespawn; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CataclysmTrophy")); + } + 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("BrimstoneFlamesprayer")); + } + else if (Main.rand.Next(12) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlamesprayer")); + } + 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("BrimstoneFlameblaster")); + } + else if (Main.rand.Next(12) == 0) + { + 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++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Cataclysm5"), 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); + } + } +} diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index 9037c5138e..f2c47030a1 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -1,502 +1,502 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Calamitas -{ - [AutoloadBossHead] - public class CalamitasRun2 : ModNPC - { - private bool canDespawn = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastrophe"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 65; - npc.npcSlots = 5f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 10; - npc.lifeMax = CalamityWorld.revenge ? 11025 : 7500; - if (CalamityWorld.death) - { - npc.lifeMax = 13200; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - 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.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) - { - npc.damage = 200; - npc.defense = 95; - npc.lifeMax *= 3; - } - 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 SendExtraAI(BinaryWriter writer) - { - writer.Write(canDespawn); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - canDespawn = reader.ReadBoolean(); - } - - 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() - { - CalamityGlobalNPC.catastrophe = npc.whoAmI; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool dayTime = Main.dayTime; - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - } - float num840 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num841 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num842 = (float)Math.Atan2((double)num841, (double)num840) + 1.57f; - if (num842 < 0f) - { - num842 += 6.283f; - } - else if ((double)num842 > 6.283) - { - num842 -= 6.283f; - } - float num843 = 0.15f; - if (npc.rotation < num842) - { - if ((double)(num842 - npc.rotation) > 3.1415) - { - npc.rotation -= num843; - } - else - { - npc.rotation += num843; - } - } - else if (npc.rotation > num842) - { - if ((double)(npc.rotation - num842) > 3.1415) - { - npc.rotation += num843; - } - else - { - npc.rotation -= num843; - } - } - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - { - npc.rotation = num842; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.283f; - } - else if ((double)npc.rotation > 6.283) - { - npc.rotation -= 6.283f; - } - if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) - { - npc.rotation = num842; - } - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.velocity = new Vector2(0f, -10f); - canDespawn = true; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else - { - canDespawn = false; - } - if (npc.ai[1] == 0f) - { - float num861 = 4.5f; - float num862 = 0.2f; - int num863 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.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 = player.position.X + (float)(player.width / 2) + (float)(num863 * 180) - vector86.X; - float num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; - float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - if (expertMode) - { - if (num866 > 300f) - { - num861 += 0.5f; - } - if (num866 > 400f) - { - num861 += 0.5f; - } - if (num866 > 500f) - { - num861 += 0.55f; - } - if (num866 > 600f) - { - num861 += 0.55f; - } - if (num866 > 700f) - { - num861 += 0.6f; - } - if (num866 > 800f) - { - num861 += 0.6f; - } - } - num866 = num861 / num866; - num864 *= num866; - num865 *= num866; - if (npc.velocity.X < num864) - { - npc.velocity.X = npc.velocity.X + num862; - if (npc.velocity.X < 0f && num864 > 0f) - { - npc.velocity.X = npc.velocity.X + num862; - } - } - else if (npc.velocity.X > num864) - { - npc.velocity.X = npc.velocity.X - num862; - if (npc.velocity.X > 0f && num864 < 0f) - { - npc.velocity.X = npc.velocity.X - num862; - } - } - if (npc.velocity.Y < num865) - { - npc.velocity.Y = npc.velocity.Y + num862; - if (npc.velocity.Y < 0f && num865 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num862; - } - } - else if (npc.velocity.Y > num865) - { - npc.velocity.Y = npc.velocity.Y - num862; - if (npc.velocity.Y > 0f && num865 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num862; - } - } - npc.ai[2] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); - if (npc.ai[2] >= 180f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - 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) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 36f) - { - npc.localAI[2] = 0f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); - } - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (revenge) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if (npc.localAI[1] > 50f) - { - npc.localAI[1] = 0f; - float num867 = 12f; - int num868 = expertMode ? 29 : 36; - int num869 = mod.ProjectileType("BrimstoneBall"); - vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num864 = player.position.X + (float)(player.width / 2) - vector86.X; - num865 = player.position.Y + (float)(player.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(-40, 41) * 0.01f; - num864 += (float)Main.rand.Next(-40, 41) * 0.01f; - num865 += npc.velocity.Y * 0.5f; - num864 += npc.velocity.X * 0.5f; - vector86.X -= num864 * 1f; - vector86.Y -= num865 * 1f; - Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); - npc.rotation = num842; - float num870 = 16f; - if (expertMode) - { - num870 += 2.5f; - } - if (revenge) - { - num870 += 2.5f; - } - 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; - float num873 = (float)Math.Sqrt((double)(num871 * num871 + num872 * num872)); - num873 = num870 / num873; - npc.velocity.X = num871 * num873; - npc.velocity.Y = num872 * num873; - npc.ai[1] = 2f; - return; - } - if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (expertMode) - { - npc.ai[2] += 0.5f; - } - if (revenge) - { - npc.ai[2] += 0.5f; - } - if (npc.ai[2] >= 60f) //50 - { - npc.velocity.X = npc.velocity.X * 0.93f; - npc.velocity.Y = npc.velocity.Y * 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - if (npc.ai[2] >= 90f) //80 - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num842; - if (npc.ai[3] >= 4f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (npc.ai[1] > 0f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool CheckActive() - { - return canDespawn; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CatastropheTrophy")); - } - 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("CrushsawCrasher")); - } - else if (Main.rand.Next(15) == 0) - { - 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++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe5"), 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Calamitas +{ + [AutoloadBossHead] + public class CalamitasRun2 : ModNPC + { + private bool canDespawn = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 65; + npc.npcSlots = 5f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 10; + npc.lifeMax = CalamityWorld.revenge ? 11025 : 7500; + if (CalamityWorld.death) + { + npc.lifeMax = 13200; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + 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.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) + { + npc.damage = 200; + npc.defense = 95; + npc.lifeMax *= 3; + } + 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 SendExtraAI(BinaryWriter writer) + { + writer.Write(canDespawn); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + canDespawn = reader.ReadBoolean(); + } + + 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() + { + CalamityGlobalNPC.catastrophe = npc.whoAmI; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool dayTime = Main.dayTime; + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + } + float num840 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); + float num841 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); + float num842 = (float)Math.Atan2((double)num841, (double)num840) + 1.57f; + if (num842 < 0f) + { + num842 += 6.283f; + } + else if ((double)num842 > 6.283) + { + num842 -= 6.283f; + } + float num843 = 0.15f; + if (npc.rotation < num842) + { + if ((double)(num842 - npc.rotation) > 3.1415) + { + npc.rotation -= num843; + } + else + { + npc.rotation += num843; + } + } + else if (npc.rotation > num842) + { + if ((double)(npc.rotation - num842) > 3.1415) + { + npc.rotation += num843; + } + else + { + npc.rotation -= num843; + } + } + if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) + { + npc.rotation = num842; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.283f; + } + else if ((double)npc.rotation > 6.283) + { + npc.rotation -= 6.283f; + } + if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) + { + npc.rotation = num842; + } + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.velocity = new Vector2(0f, -10f); + canDespawn = true; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else + { + canDespawn = false; + } + if (npc.ai[1] == 0f) + { + float num861 = 4.5f; + float num862 = 0.2f; + int num863 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.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 = player.position.X + (float)(player.width / 2) + (float)(num863 * 180) - vector86.X; + float num865 = player.position.Y + (float)(player.height / 2) - vector86.Y; + float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + if (expertMode) + { + if (num866 > 300f) + { + num861 += 0.5f; + } + if (num866 > 400f) + { + num861 += 0.5f; + } + if (num866 > 500f) + { + num861 += 0.55f; + } + if (num866 > 600f) + { + num861 += 0.55f; + } + if (num866 > 700f) + { + num861 += 0.6f; + } + if (num866 > 800f) + { + num861 += 0.6f; + } + } + num866 = num861 / num866; + num864 *= num866; + num865 *= num866; + if (npc.velocity.X < num864) + { + npc.velocity.X = npc.velocity.X + num862; + if (npc.velocity.X < 0f && num864 > 0f) + { + npc.velocity.X = npc.velocity.X + num862; + } + } + else if (npc.velocity.X > num864) + { + npc.velocity.X = npc.velocity.X - num862; + if (npc.velocity.X > 0f && num864 < 0f) + { + npc.velocity.X = npc.velocity.X - num862; + } + } + if (npc.velocity.Y < num865) + { + npc.velocity.Y = npc.velocity.Y + num862; + if (npc.velocity.Y < 0f && num865 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num862; + } + } + else if (npc.velocity.Y > num865) + { + npc.velocity.Y = npc.velocity.Y - num862; + if (npc.velocity.Y > 0f && num865 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num862; + } + } + npc.ai[2] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); + if (npc.ai[2] >= 180f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + 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) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] > 36f) + { + npc.localAI[2] = 0f; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); + } + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (revenge) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if (npc.localAI[1] > 50f) + { + npc.localAI[1] = 0f; + float num867 = 12f; + int num868 = expertMode ? 29 : 36; + int num869 = mod.ProjectileType("BrimstoneBall"); + vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num864 = player.position.X + (float)(player.width / 2) - vector86.X; + num865 = player.position.Y + (float)(player.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(-40, 41) * 0.01f; + num864 += (float)Main.rand.Next(-40, 41) * 0.01f; + num865 += npc.velocity.Y * 0.5f; + num864 += npc.velocity.X * 0.5f; + vector86.X -= num864 * 1f; + vector86.Y -= num865 * 1f; + Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + if (npc.ai[1] == 1f) + { + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + npc.rotation = num842; + float num870 = 16f; + if (expertMode) + { + num870 += 2.5f; + } + if (revenge) + { + num870 += 2.5f; + } + 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; + float num873 = (float)Math.Sqrt((double)(num871 * num871 + num872 * num872)); + num873 = num870 / num873; + npc.velocity.X = num871 * num873; + npc.velocity.Y = num872 * num873; + npc.ai[1] = 2f; + return; + } + if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (expertMode) + { + npc.ai[2] += 0.5f; + } + if (revenge) + { + npc.ai[2] += 0.5f; + } + if (npc.ai[2] >= 60f) //50 + { + npc.velocity.X = npc.velocity.X * 0.93f; + npc.velocity.Y = npc.velocity.Y * 0.93f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + if (npc.ai[2] >= 90f) //80 + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num842; + if (npc.ai[3] >= 4f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + return; + } + npc.ai[1] = 1f; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (npc.ai[1] > 0f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool CheckActive() + { + return canDespawn; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CatastropheTrophy")); + } + 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("CrushsawCrasher")); + } + else if (Main.rand.Next(15) == 0) + { + 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++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Catastrophe5"), 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); + } + } +} diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index b6c5787bec..5d7571448d 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -1,646 +1,646 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.NPCs.Calamitas; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Calamitas -{ - [AutoloadBossHead] - public class CalamitasRun3 : ModNPC - { - private float bossLife; - private bool halfLife = false; - private bool secondStage = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 80; - npc.npcSlots = 14f; - npc.width = 120; - npc.height = 120; - npc.defense = 25; - npc.lifeMax = CalamityWorld.revenge ? 38812 : 28125; - if (CalamityWorld.death) - { - npc.lifeMax = 62062; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 15, 0, 0); - 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.boss = true; - 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; - bossBag = mod.ItemType("CalamitasBag"); - if (CalamityWorld.downedProvidence) - { - npc.damage = 160; - npc.defense = 150; - npc.lifeMax *= 3; - npc.value = Item.buyPrice(0, 35, 0, 0); - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 3450000 : 3075000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(secondStage); - writer.Write(halfLife); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - secondStage = reader.ReadBoolean(); - halfLife = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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() - { - CalamityGlobalNPC.calamitas = npc.whoAmI; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool dayTime = Main.dayTime; - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - if (!halfLife && npc.life <= npc.lifeMax / 2) - { - if (!secondStage && Main.netMode != 1) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 5; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("SoulSeeker"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 72; - Eye.ai[3] = I * 72; - } - secondStage = true; - } - string key = "Mods.CalamityMod.CalamitasBossText3"; - 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); - } - halfLife = true; - } - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.3); //70%, 40%, and 10% - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - if (bossLife <= (float)npc.lifeMax * 0.1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - string key = "Mods.CalamityMod.CalamitasBossText2"; - 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); - } - } - else if (bossLife <= (float)npc.lifeMax * 0.4) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - else - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } - } - bool flag100 = false; - int num568 = 0; - if (expertMode) - { - if (CalamityGlobalNPC.cataclysm != -1) - { - if (Main.npc[CalamityGlobalNPC.cataclysm].active) - { - flag100 = true; - num568 += 255; - } - } - if (CalamityGlobalNPC.catastrophe != -1) - { - if (Main.npc[CalamityGlobalNPC.catastrophe].active) - { - flag100 = true; - num568 += 255; - } - } - npc.defense += num568 * 50; - if (!flag100) - { - npc.defense = provy ? 150 : 25; - } - } - npc.chaseable = !flag100; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - } - float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; - if (num803 < 0f) - { - num803 += 6.283f; - } - else if ((double)num803 > 6.283) - { - num803 -= 6.283f; - } - float num804 = 0.1f; - if (npc.rotation < num803) - { - if ((double)(num803 - npc.rotation) > 3.1415) - { - npc.rotation -= num804; - } - else - { - npc.rotation += num804; - } - } - else if (npc.rotation > num803) - { - if ((double)(npc.rotation - num803) > 3.1415) - { - npc.rotation += num804; - } - else - { - npc.rotation -= num804; - } - } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - { - npc.rotation = num803; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.283f; - } - else if ((double)npc.rotation > 6.283) - { - npc.rotation -= 6.283f; - } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - { - npc.rotation = num803; - } - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) - { - 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[1] == 0f) - { - float num823 = expertMode ? 10f : 8.5f; - float num824 = expertMode ? 0.18f : 0.155f; - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - 360f - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; - if (npc.velocity.X < num825) - { - npc.velocity.X = npc.velocity.X + num824; - if (npc.velocity.X < 0f && num825 > 0f) - { - npc.velocity.X = npc.velocity.X + num824; - } - } - else if (npc.velocity.X > num825) - { - npc.velocity.X = npc.velocity.X - num824; - if (npc.velocity.X > 0f && num825 < 0f) - { - npc.velocity.X = npc.velocity.X - num824; - } - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y = npc.velocity.Y + num824; - if (npc.velocity.Y < 0f && num826 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num824; - } - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y = npc.velocity.Y - num824; - if (npc.velocity.Y > 0f && num826 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num824; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 200f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (!flag100) - { - if (revenge) - { - npc.localAI[1] += 0.5f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - } - if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - float num828 = expertMode ? 14f : 12.5f; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num828 += 5f; - } - int num829 = expertMode ? 34 : 42; - int num830 = mod.ProjectileType("BrimstoneHellfireball"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - else - { - int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num831 = -1; - } - float num832 = expertMode ? 10f : 8.5f; - float num833 = expertMode ? 0.255f : 0.205f; - Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 360) - vector83.X; - float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num832 / num836; - num834 *= num836; - num835 *= num836; - if (npc.velocity.X < num834) - { - npc.velocity.X = npc.velocity.X + num833; - if (npc.velocity.X < 0f && num834 > 0f) - { - npc.velocity.X = npc.velocity.X + num833; - } - } - else if (npc.velocity.X > num834) - { - npc.velocity.X = npc.velocity.X - num833; - if (npc.velocity.X > 0f && num834 < 0f) - { - npc.velocity.X = npc.velocity.X - num833; - } - } - if (npc.velocity.Y < num835) - { - npc.velocity.Y = npc.velocity.Y + num833; - if (npc.velocity.Y < 0f && num835 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num833; - } - } - else if (npc.velocity.Y > num835) - { - npc.velocity.Y = npc.velocity.Y - num833; - if (npc.velocity.Y > 0f && num835 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num833; - } - } - vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (!flag100) - { - if (revenge) - { - npc.localAI[1] += 0.5f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 0.5f; - } - if (expertMode) - { - npc.localAI[1] += 0.5f; - } - } - if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - float num837 = 11f; - int num838 = expertMode ? 24 : 30; - int num839 = mod.ProjectileType("BrimstoneLaser"); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 15f; - vector83.Y += num835 * 15f; - Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 120f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasTrophy")); - } - 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("EssenceofChaos"), Main.rand.Next(4, 9)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamityDust"), Main.rand.Next(9, 15)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedLens"), Main.rand.Next(1, 3)); - if (CalamityWorld.downedProvidence) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone"), Main.rand.Next(30, 41)); - } - if (Main.rand.Next(10) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ChaosStone"), 1, true); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasInferno")); - } - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasMask")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheEyeofCalamitas")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedEyeStaff")); - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - name = "The Calamitas Clone"; - potionType = ItemID.GreaterHealingPotion; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas6"), 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.damage = (int)(npc.damage * 0.8f); - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Calamitas +{ + [AutoloadBossHead] + public class CalamitasRun3 : ModNPC + { + private float bossLife; + private bool halfLife = false; + private bool secondStage = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 80; + npc.npcSlots = 14f; + npc.width = 120; + npc.height = 120; + npc.defense = 25; + npc.lifeMax = CalamityWorld.revenge ? 38812 : 28125; + if (CalamityWorld.death) + { + npc.lifeMax = 62062; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 15, 0, 0); + 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.boss = true; + 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; + bossBag = mod.ItemType("CalamitasBag"); + if (CalamityWorld.downedProvidence) + { + npc.damage = 160; + npc.defense = 150; + npc.lifeMax *= 3; + npc.value = Item.buyPrice(0, 35, 0, 0); + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 3450000 : 3075000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(secondStage); + writer.Write(halfLife); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + secondStage = reader.ReadBoolean(); + halfLife = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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() + { + CalamityGlobalNPC.calamitas = npc.whoAmI; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool dayTime = Main.dayTime; + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + if (!halfLife && npc.life <= npc.lifeMax / 2) + { + if (!secondStage && Main.netMode != 1) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 5; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), mod.NPCType("SoulSeeker"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 72; + Eye.ai[3] = I * 72; + } + secondStage = true; + } + string key = "Mods.CalamityMod.CalamitasBossText3"; + 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); + } + halfLife = true; + } + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.3); //70%, 40%, and 10% + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + if (bossLife <= (float)npc.lifeMax * 0.1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + string key = "Mods.CalamityMod.CalamitasBossText2"; + 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); + } + } + else if (bossLife <= (float)npc.lifeMax * 0.4) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + else + { + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("CalamitasRun"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } + } + bool flag100 = false; + int num568 = 0; + if (expertMode) + { + if (CalamityGlobalNPC.cataclysm != -1) + { + if (Main.npc[CalamityGlobalNPC.cataclysm].active) + { + flag100 = true; + num568 += 255; + } + } + if (CalamityGlobalNPC.catastrophe != -1) + { + if (Main.npc[CalamityGlobalNPC.catastrophe].active) + { + flag100 = true; + num568 += 255; + } + } + npc.defense += num568 * 50; + if (!flag100) + { + npc.defense = provy ? 150 : 25; + } + } + npc.chaseable = !flag100; + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + } + float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); + float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); + float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; + if (num803 < 0f) + { + num803 += 6.283f; + } + else if ((double)num803 > 6.283) + { + num803 -= 6.283f; + } + float num804 = 0.1f; + if (npc.rotation < num803) + { + if ((double)(num803 - npc.rotation) > 3.1415) + { + npc.rotation -= num804; + } + else + { + npc.rotation += num804; + } + } + else if (npc.rotation > num803) + { + if ((double)(npc.rotation - num803) > 3.1415) + { + npc.rotation += num804; + } + else + { + npc.rotation -= num804; + } + } + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + { + npc.rotation = num803; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.283f; + } + else if ((double)npc.rotation > 6.283) + { + npc.rotation -= 6.283f; + } + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + { + npc.rotation = num803; + } + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || (dayTime && !Main.eclipse)) + { + 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[1] == 0f) + { + float num823 = expertMode ? 10f : 8.5f; + float num824 = expertMode ? 0.18f : 0.155f; + Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num825 = player.position.X + (float)(player.width / 2) - vector82.X; + float num826 = player.position.Y + (float)(player.height / 2) - 360f - vector82.Y; + float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; + if (npc.velocity.X < num825) + { + npc.velocity.X = npc.velocity.X + num824; + if (npc.velocity.X < 0f && num825 > 0f) + { + npc.velocity.X = npc.velocity.X + num824; + } + } + else if (npc.velocity.X > num825) + { + npc.velocity.X = npc.velocity.X - num824; + if (npc.velocity.X > 0f && num825 < 0f) + { + npc.velocity.X = npc.velocity.X - num824; + } + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y = npc.velocity.Y + num824; + if (npc.velocity.Y < 0f && num826 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num824; + } + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y = npc.velocity.Y - num824; + if (npc.velocity.Y > 0f && num826 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num824; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 200f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num825 = player.position.X + (float)(player.width / 2) - vector82.X; + num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (!flag100) + { + if (revenge) + { + npc.localAI[1] += 0.5f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + } + if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.localAI[1] = 0f; + float num828 = expertMode ? 14f : 12.5f; + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num828 += 5f; + } + int num829 = expertMode ? 34 : 42; + int num830 = mod.ProjectileType("BrimstoneHellfireball"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 15f; + vector82.Y += num826 * 15f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + } + else + { + int num831 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num831 = -1; + } + float num832 = expertMode ? 10f : 8.5f; + float num833 = expertMode ? 0.255f : 0.205f; + Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 360) - vector83.X; + float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num832 / num836; + num834 *= num836; + num835 *= num836; + if (npc.velocity.X < num834) + { + npc.velocity.X = npc.velocity.X + num833; + if (npc.velocity.X < 0f && num834 > 0f) + { + npc.velocity.X = npc.velocity.X + num833; + } + } + else if (npc.velocity.X > num834) + { + npc.velocity.X = npc.velocity.X - num833; + if (npc.velocity.X > 0f && num834 < 0f) + { + npc.velocity.X = npc.velocity.X - num833; + } + } + if (npc.velocity.Y < num835) + { + npc.velocity.Y = npc.velocity.Y + num833; + if (npc.velocity.Y < 0f && num835 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num833; + } + } + else if (npc.velocity.Y > num835) + { + npc.velocity.Y = npc.velocity.Y - num833; + if (npc.velocity.Y > 0f && num835 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num833; + } + } + vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num834 = player.position.X + (float)(player.width / 2) - vector83.X; + num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (!flag100) + { + if (revenge) + { + npc.localAI[1] += 0.5f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 0.5f; + } + if (expertMode) + { + npc.localAI[1] += 0.5f; + } + } + if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.localAI[1] = 0f; + float num837 = 11f; + int num838 = expertMode ? 24 : 30; + int num839 = mod.ProjectileType("BrimstoneLaser"); + num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 15f; + vector83.Y += num835 * 15f; + Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 120f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasTrophy")); + } + 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("EssenceofChaos"), Main.rand.Next(4, 9)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamityDust"), Main.rand.Next(9, 15)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedLens"), Main.rand.Next(1, 3)); + if (CalamityWorld.downedProvidence) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone"), Main.rand.Next(30, 41)); + } + if (Main.rand.Next(10) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ChaosStone"), 1, true); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasInferno")); + } + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CalamitasMask")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheEyeofCalamitas")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlightedEyeStaff")); + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + name = "The Calamitas Clone"; + potionType = ItemID.GreaterHealingPotion; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas5"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/Calamitas6"), 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.damage = (int)(npc.damage * 0.8f); + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + player.AddBuff(mod.BuffType("BrimstoneFlames"), 300, true); + } + } +} diff --git a/NPCs/Calamitas/LifeSeeker.cs b/NPCs/Calamitas/LifeSeeker.cs index 6545e667e4..b136fa105e 100644 --- a/NPCs/Calamitas/LifeSeeker.cs +++ b/NPCs/Calamitas/LifeSeeker.cs @@ -1,73 +1,73 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Calamitas -{ - public class LifeSeeker : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Life Seeker"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.damage = 35; - npc.width = 44; //324 - npc.height = 30; //216 - npc.defense = 20; - npc.lifeMax = 200; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 30000; - } - npc.aiStyle = 5; - aiType = 139; - npc.knockBackResist = 0.25f; - animationType = 2; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.buffImmune[24] = true; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker3"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Calamitas +{ + public class LifeSeeker : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Life Seeker"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.damage = 35; + npc.width = 44; //324 + npc.height = 30; //216 + npc.defense = 20; + npc.lifeMax = 200; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 30000; + } + npc.aiStyle = 5; + aiType = 139; + npc.knockBackResist = 0.25f; + animationType = 2; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.buffImmune[24] = true; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/LifeSeeker3"), 1f); + } + } + } +} diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index d7804f395e..ab31f5f09f 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -1,167 +1,167 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Calamitas -{ - public class SoulSeeker : ModNPC - { - private int timer = 0; - private bool start = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Seeker"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 40; - npc.height = 40; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.damage = 60; - npc.defense = 20; - npc.lifeMax = 3750; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 200000 : 150000; - } - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override bool PreAI() - { - bool expertMode = Main.expertMode; - if (start) - { - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 2f); - } - npc.ai[1] = npc.ai[0]; - start = false; - } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= 9f; - npc.rotation = direction.ToRotation(); - timer++; - if (timer > 60) - { - 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); - } - int damage = expertMode ? 22 : 30; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("BrimstoneBarrage"), damage, 1f, npc.target); - } - timer = 0; - } - if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - NPC parent = Main.npc[NPC.FindFirstNPC(mod.NPCType("CalamitasRun3"))]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 150; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 2f; - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper4"), 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; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.velocity != Vector2.Zero) - { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); - for (int i = 1; i < npc.oldPos.Length; ++i) - { - Vector2 vector2_2 = npc.oldPos[i]; - Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; - color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); - color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); - color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); - color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), - npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); - } - } - return true; - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Calamitas +{ + public class SoulSeeker : ModNPC + { + private int timer = 0; + private bool start = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Seeker"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 40; + npc.height = 40; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.damage = 60; + npc.defense = 20; + npc.lifeMax = 3750; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 200000 : 150000; + } + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override bool PreAI() + { + bool expertMode = Main.expertMode; + if (start) + { + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 2f); + } + npc.ai[1] = npc.ai[0]; + start = false; + } + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= 9f; + npc.rotation = direction.ToRotation(); + timer++; + if (timer > 60) + { + 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); + } + int damage = expertMode ? 22 : 30; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("BrimstoneBarrage"), damage, 1f, npc.target); + } + timer = 0; + } + if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + Player player = Main.player[npc.target]; + NPC parent = Main.npc[NPC.FindFirstNPC(mod.NPCType("CalamitasRun3"))]; + double deg = (double)npc.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 150; + npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.ai[1] += 2f; + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper4"), 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; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.velocity != Vector2.Zero) + { + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + for (int i = 1; i < npc.oldPos.Length; ++i) + { + Vector2 vector2_2 = npc.oldPos[i]; + Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; + color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); + color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); + color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); + color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), + npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); + } + } + return true; + } + } +} diff --git a/NPCs/CalamityBiomeNPCs/CultistAssassin.cs b/NPCs/CalamityBiomeNPCs/CultistAssassin.cs index 9a1ab91eaf..43d9e4d633 100644 --- a/NPCs/CalamityBiomeNPCs/CultistAssassin.cs +++ b/NPCs/CalamityBiomeNPCs/CultistAssassin.cs @@ -1,88 +1,88 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CalamityBiomeNPCs -{ - public class CultistAssassin : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cultist Assassin"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = 3; - npc.damage = 50; - npc.width = 18; //324 - npc.height = 40; //216 - npc.defense = 25; - npc.lifeMax = 80; - npc.knockBackResist = 0.5f; - animationType = 331; - aiType = NPCID.ChaosElemental; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath50; - if (CalamityWorld.downedProvidence) - { - npc.damage = 250; - npc.defense = 130; - npc.lifeMax = 5000; - npc.value = Item.buyPrice(0, 0, 50, 0); - } - banner = npc.type; - bannerItem = mod.ItemType("CultistAssassinBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - return (spawnInfo.player.GetModPlayer(mod).ZoneCalamity || spawnInfo.player.ZoneDungeon) && Main.hardMode ? 0.04f : 0f; - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - - public override void NPCLoot() - { - if (CalamityWorld.downedProvidence && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CalamityBiomeNPCs +{ + public class CultistAssassin : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cultist Assassin"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = 3; + npc.damage = 50; + npc.width = 18; //324 + npc.height = 40; //216 + npc.defense = 25; + npc.lifeMax = 80; + npc.knockBackResist = 0.5f; + animationType = 331; + aiType = NPCID.ChaosElemental; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath50; + if (CalamityWorld.downedProvidence) + { + npc.damage = 250; + npc.defense = 130; + npc.lifeMax = 5000; + npc.value = Item.buyPrice(0, 0, 50, 0); + } + banner = npc.type; + bannerItem = mod.ItemType("CultistAssassinBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return (spawnInfo.player.GetModPlayer(mod).ZoneCalamity || spawnInfo.player.ZoneDungeon) && Main.hardMode ? 0.04f : 0f; + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override void NPCLoot() + { + if (CalamityWorld.downedProvidence && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + } +} diff --git a/NPCs/CalamityBiomeNPCs/DespairStone.cs b/NPCs/CalamityBiomeNPCs/DespairStone.cs index c148b847b1..93e79d27d6 100644 --- a/NPCs/CalamityBiomeNPCs/DespairStone.cs +++ b/NPCs/CalamityBiomeNPCs/DespairStone.cs @@ -1,374 +1,374 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CalamityBiomeNPCs -{ - public class DespairStone : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Despair Stone"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 40; - npc.width = 72; //324 - npc.height = 72; //216 - npc.defense = 38; - npc.lifeMax = 120; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - npc.behindTiles = true; - npc.lavaImmune = true; - if (CalamityWorld.downedProvidence) - { - npc.damage = 190; - npc.defense = 185; - npc.lifeMax = 5000; - npc.value = Item.buyPrice(0, 0, 50, 0); - } - banner = npc.type; - bannerItem = mod.ItemType("DespairStoneBanner"); - } - - public override void AI() - { - int num = 30; - int num2 = 10; - bool flag = false; - bool flag2 = false; - bool flag3 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag2 = true; - npc.ai[3] += 1f; - } - num2 = 4; - bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - } - } - if (flag4) - { - npc.velocity.Y = 0f; - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) - { - npc.ai[3] += 1f; - flag3 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num * num2)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num) - { - npc.netUpdate = true; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num4 = Main.player[npc.target].position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - if (num5 < 200f && !flag3) - { - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - 4f; - Main.PlaySound(2, npc.Center, 14); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, -1f, 0, default(Color), 1f); - } - } - if (npc.ai[3] < (float)num) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num7 = 6f; - float num8 = 0.07f; - if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) - { - if (Math.Sign(npc.velocity.X) != npc.direction) - { - npc.velocity.X = npc.velocity.X * 0.92f; - } - float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); - if (!Main.player[npc.target].ZoneSandstorm) - { - num9 = 0f; - } - num7 = 5f + num9 * (float)npc.direction * 4f; - num8 = 0.2f; - if (npc.velocity.X < -num7 || npc.velocity.X > num7) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num7 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X > num7) - { - npc.velocity.X = num7; - } - } - else if (npc.velocity.X > -num7 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X < -num7) - { - npc.velocity.X = -num7; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num10 = 0; - if (npc.velocity.X < 0f) - { - num10 = -1; - } - if (npc.velocity.X > 0f) - { - num10 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); - int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num11, num12] == null) - { - Main.tile[num11, num12] = new Tile(); - } - if (Main.tile[num11, num12 - 1] == null) - { - Main.tile[num11, num12 - 1] = new Tile(); - } - if (Main.tile[num11, num12 - 2] == null) - { - Main.tile[num11, num12 - 2] = new Tile(); - } - if (Main.tile[num11, num12 - 3] == null) - { - Main.tile[num11, num12 - 3] = new Tile(); - } - if (Main.tile[num11, num12 + 1] == null) - { - Main.tile[num11, num12 + 1] = new Tile(); - } - if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) - { - float num13 = (float)(num12 * 16); - if (Main.tile[num11, num12].halfBrick()) - { - num13 += 8f; - } - if (Main.tile[num11, num12 - 1].halfBrick()) - { - num13 -= 8f; - } - if (num13 < position.Y + (float)npc.height) - { - float num14 = position.Y + (float)npc.height - num13; - if ((double)num14 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num13; - npc.position.Y = num13 - (float)npc.height; - if (num14 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num15, num16] == null) - { - Main.tile[num15, num16] = new Tile(); - } - if (Main.tile[num15, num16 - 1] == null) - { - Main.tile[num15, num16 - 1] = new Tile(); - } - if (Main.tile[num15, num16 - 2] == null) - { - Main.tile[num15, num16 - 2] = new Tile(); - } - if (Main.tile[num15, num16 - 3] == null) - { - Main.tile[num15, num16 - 3] = new Tile(); - } - if (Main.tile[num15, num16 + 1] == null) - { - Main.tile[num15, num16 + 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 - 1] == null) - { - Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 + 1] == null) - { - Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); - } - if (Main.tile[num15 - npc.direction, num16 + 1] == null) - { - Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); - } - int num17 = npc.spriteDirection; - num17 *= -1; - if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) - { - bool flag6 = npc.type == 410 || npc.type == 423; - float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) - { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) - { - npc.velocity.Y = -8.5f; - npc.netUpdate = true; - } - else - { - npc.velocity.Y = -7.5f; - npc.netUpdate = true; - } - } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) - { - npc.velocity.Y = -7f; - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) - { - npc.velocity.Y = -6f; - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!flag6 || !Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) - { - npc.velocity.Y = -8f; - npc.netUpdate = true; - } - } - } - npc.rotation += npc.velocity.X * 0.05f; - npc.spriteDirection = -npc.direction; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - return spawnInfo.player.GetModPlayer(mod).ZoneCalamity ? 0.25f : 0f; - } - - public override void NPCLoot() - { - if (CalamityWorld.downedProvidence && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); - } - if (Main.hardMode && Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CalamityBiomeNPCs +{ + public class DespairStone : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Despair Stone"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 40; + npc.width = 72; //324 + npc.height = 72; //216 + npc.defense = 38; + npc.lifeMax = 120; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + npc.behindTiles = true; + npc.lavaImmune = true; + if (CalamityWorld.downedProvidence) + { + npc.damage = 190; + npc.defense = 185; + npc.lifeMax = 5000; + npc.value = Item.buyPrice(0, 0, 50, 0); + } + banner = npc.type; + bannerItem = mod.ItemType("DespairStoneBanner"); + } + + public override void AI() + { + int num = 30; + int num2 = 10; + bool flag = false; + bool flag2 = false; + bool flag3 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag2 = true; + npc.ai[3] += 1f; + } + num2 = 4; + bool flag4 = npc.velocity.Y == 0f; + for (int i = 0; i < 200; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + } + } + if (flag4) + { + npc.velocity.Y = 0f; + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) + { + npc.ai[3] += 1f; + flag3 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num * num2)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num) + { + npc.netUpdate = true; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num4 = Main.player[npc.target].position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + if (num5 < 200f && !flag3) + { + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - 4f; + Main.PlaySound(2, npc.Center, 14); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, -1f, 0, default(Color), 1f); + } + } + if (npc.ai[3] < (float)num) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num7 = 6f; + float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) + { + if (Math.Sign(npc.velocity.X) != npc.direction) + { + npc.velocity.X = npc.velocity.X * 0.92f; + } + float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); + if (!Main.player[npc.target].ZoneSandstorm) + { + num9 = 0f; + } + num7 = 5f + num9 * (float)npc.direction * 4f; + num8 = 0.2f; + if (npc.velocity.X < -num7 || npc.velocity.X > num7) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num7 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X > num7) + { + npc.velocity.X = num7; + } + } + else if (npc.velocity.X > -num7 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X < -num7) + { + npc.velocity.X = -num7; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num10 = 0; + if (npc.velocity.X < 0f) + { + num10 = -1; + } + if (npc.velocity.X > 0f) + { + num10 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); + int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num11, num12] == null) + { + Main.tile[num11, num12] = new Tile(); + } + if (Main.tile[num11, num12 - 1] == null) + { + Main.tile[num11, num12 - 1] = new Tile(); + } + if (Main.tile[num11, num12 - 2] == null) + { + Main.tile[num11, num12 - 2] = new Tile(); + } + if (Main.tile[num11, num12 - 3] == null) + { + Main.tile[num11, num12 - 3] = new Tile(); + } + if (Main.tile[num11, num12 + 1] == null) + { + Main.tile[num11, num12 + 1] = new Tile(); + } + if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) + { + float num13 = (float)(num12 * 16); + if (Main.tile[num11, num12].halfBrick()) + { + num13 += 8f; + } + if (Main.tile[num11, num12 - 1].halfBrick()) + { + num13 -= 8f; + } + if (num13 < position.Y + (float)npc.height) + { + float num14 = position.Y + (float)npc.height - num13; + if ((double)num14 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num13; + npc.position.Y = num13 - (float)npc.height; + if (num14 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num15, num16] == null) + { + Main.tile[num15, num16] = new Tile(); + } + if (Main.tile[num15, num16 - 1] == null) + { + Main.tile[num15, num16 - 1] = new Tile(); + } + if (Main.tile[num15, num16 - 2] == null) + { + Main.tile[num15, num16 - 2] = new Tile(); + } + if (Main.tile[num15, num16 - 3] == null) + { + Main.tile[num15, num16 - 3] = new Tile(); + } + if (Main.tile[num15, num16 + 1] == null) + { + Main.tile[num15, num16 + 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 - 1] == null) + { + Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 + 1] == null) + { + Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); + } + if (Main.tile[num15 - npc.direction, num16 + 1] == null) + { + Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); + } + int num17 = npc.spriteDirection; + num17 *= -1; + if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) + { + bool flag6 = npc.type == 410 || npc.type == 423; + float num18 = 3f; + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + { + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + { + npc.velocity.Y = -8.5f; + npc.netUpdate = true; + } + else + { + npc.velocity.Y = -7.5f; + npc.netUpdate = true; + } + } + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + { + npc.velocity.Y = -7f; + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + { + npc.velocity.Y = -6f; + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!flag6 || !Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + { + npc.velocity.Y = -8f; + npc.netUpdate = true; + } + } + } + npc.rotation += npc.velocity.X * 0.05f; + npc.spriteDirection = -npc.direction; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.GetModPlayer(mod).ZoneCalamity ? 0.25f : 0f; + } + + public override void NPCLoot() + { + if (CalamityWorld.downedProvidence && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); + } + if (Main.hardMode && Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/CalamityBiomeNPCs/Scryllar.cs b/NPCs/CalamityBiomeNPCs/Scryllar.cs index 24721e5446..eb93459af1 100644 --- a/NPCs/CalamityBiomeNPCs/Scryllar.cs +++ b/NPCs/CalamityBiomeNPCs/Scryllar.cs @@ -1,292 +1,292 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CalamityBiomeNPCs -{ - public class Scryllar : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scryllar"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 50; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 18; - npc.lifeMax = 90; - npc.alpha = 100; - npc.knockBackResist = 0.7f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit49; - npc.DeathSound = SoundID.NPCDeath51; - npc.noGravity = true; - npc.noTileCollide = true; - npc.lavaImmune = true; - if (CalamityWorld.downedProvidence) - { - npc.damage = 260; - npc.defense = 90; - npc.lifeMax = 4000; - npc.value = Item.buyPrice(0, 0, 50, 0); - } - banner = npc.type; - bannerItem = mod.ItemType("ScryllarBanner"); - } - - public override void AI() - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - bool flag19 = false; - if (npc.justHit) - { - npc.ai[2] = 0f; - } - if (npc.ai[2] >= 0f) - { - int num282 = 16; - bool flag21 = false; - bool flag22 = false; - if (npc.position.X > npc.ai[0] - (float)num282 && npc.position.X < npc.ai[0] + (float)num282) - { - flag21 = true; - } - else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) - { - flag21 = true; - } - num282 += 24; - if (npc.position.Y > npc.ai[1] - (float)num282 && npc.position.Y < npc.ai[1] + (float)num282) - { - flag22 = true; - } - if (flag21 && flag22) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 30f && num282 == 16) - { - flag19 = true; - } - if (npc.ai[2] >= 60f) - { - npc.ai[2] = -200f; - npc.direction *= -1; - npc.velocity.X = npc.velocity.X * -1f; - npc.collideX = false; - } - } - else - { - npc.ai[0] = npc.position.X; - npc.ai[1] = npc.position.Y; - npc.ai[2] = 0f; - } - npc.TargetClosest(true); - } - else - { - npc.TargetClosest(true); - npc.ai[2] += 2f; - } - int num283 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; - int num284 = (int)((npc.position.Y + (float)npc.height) / 16f); - bool flag23 = true; - int num285 = 3; - for (int num308 = num284; num308 < num284 + num285; num308++) - { - if (Main.tile[num283, num308] == null) - { - Main.tile[num283, num308] = new Tile(); - } - if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].type]) || Main.tile[num283, num308].liquid > 0) - { - flag23 = false; - break; - } - } - if (Main.player[npc.target].npcTypeNoAggro[npc.type]) - { - bool flag25 = false; - for (int num309 = num284; num309 < num284 + num285 - 2; num309++) - { - if (Main.tile[num283, num309] == null) - { - Main.tile[num283, num309] = new Tile(); - } - if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].type]) || Main.tile[num283, num309].liquid > 0) - { - flag25 = true; - break; - } - } - npc.directionY = (!flag25).ToDirectionInt(); - } - if (flag19) - { - flag23 = true; - } - if (flag23) - { - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - } - else - { - if (npc.directionY < 0 && npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y - 0.1f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - if (npc.collideX) - { - npc.velocity.X = npc.oldVelocity.X * -0.4f; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) - { - npc.velocity.X = 1f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) - { - npc.velocity.X = -1f; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.oldVelocity.Y * -0.25f; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) - { - npc.velocity.Y = 1f; - } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) - { - npc.velocity.Y = -1f; - } - } - float num311 = 4f; - if (npc.direction == -1 && npc.velocity.X > -num311) - { - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > num311) - { - npc.velocity.X = npc.velocity.X - 0.1f; - } - else if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.velocity.X < -num311) - { - npc.velocity.X = -num311; - } - } - else if (npc.direction == 1 && npc.velocity.X < num311) - { - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -num311) - { - npc.velocity.X = npc.velocity.X + 0.1f; - } - else if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - if (npc.velocity.X > num311) - { - npc.velocity.X = num311; - } - } - num311 = 1.5f; - if (npc.directionY == -1 && npc.velocity.Y > -num311) - { - npc.velocity.Y = npc.velocity.Y - 0.04f; - if (npc.velocity.Y > num311) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.03f; - } - if (npc.velocity.Y < -num311) - { - npc.velocity.Y = -num311; - } - } - else if (npc.directionY == 1 && npc.velocity.Y < num311) - { - npc.velocity.Y = npc.velocity.Y + 0.04f; - if (npc.velocity.Y < -num311) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - 0.03f; - } - if (npc.velocity.Y > num311) - { - npc.velocity.Y = num311; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - return spawnInfo.player.GetModPlayer(mod).ZoneCalamity ? 0.25f : 0f; - } - - public override void NPCLoot() - { - if (CalamityWorld.downedProvidence && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); - } - if (Main.hardMode && Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CalamityBiomeNPCs +{ + public class Scryllar : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scryllar"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 50; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 18; + npc.lifeMax = 90; + npc.alpha = 100; + npc.knockBackResist = 0.7f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit49; + npc.DeathSound = SoundID.NPCDeath51; + npc.noGravity = true; + npc.noTileCollide = true; + npc.lavaImmune = true; + if (CalamityWorld.downedProvidence) + { + npc.damage = 260; + npc.defense = 90; + npc.lifeMax = 4000; + npc.value = Item.buyPrice(0, 0, 50, 0); + } + banner = npc.type; + bannerItem = mod.ItemType("ScryllarBanner"); + } + + public override void AI() + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + bool flag19 = false; + if (npc.justHit) + { + npc.ai[2] = 0f; + } + if (npc.ai[2] >= 0f) + { + int num282 = 16; + bool flag21 = false; + bool flag22 = false; + if (npc.position.X > npc.ai[0] - (float)num282 && npc.position.X < npc.ai[0] + (float)num282) + { + flag21 = true; + } + else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) + { + flag21 = true; + } + num282 += 24; + if (npc.position.Y > npc.ai[1] - (float)num282 && npc.position.Y < npc.ai[1] + (float)num282) + { + flag22 = true; + } + if (flag21 && flag22) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 30f && num282 == 16) + { + flag19 = true; + } + if (npc.ai[2] >= 60f) + { + npc.ai[2] = -200f; + npc.direction *= -1; + npc.velocity.X = npc.velocity.X * -1f; + npc.collideX = false; + } + } + else + { + npc.ai[0] = npc.position.X; + npc.ai[1] = npc.position.Y; + npc.ai[2] = 0f; + } + npc.TargetClosest(true); + } + else + { + npc.TargetClosest(true); + npc.ai[2] += 2f; + } + int num283 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; + int num284 = (int)((npc.position.Y + (float)npc.height) / 16f); + bool flag23 = true; + int num285 = 3; + for (int num308 = num284; num308 < num284 + num285; num308++) + { + if (Main.tile[num283, num308] == null) + { + Main.tile[num283, num308] = new Tile(); + } + if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].type]) || Main.tile[num283, num308].liquid > 0) + { + flag23 = false; + break; + } + } + if (Main.player[npc.target].npcTypeNoAggro[npc.type]) + { + bool flag25 = false; + for (int num309 = num284; num309 < num284 + num285 - 2; num309++) + { + if (Main.tile[num283, num309] == null) + { + Main.tile[num283, num309] = new Tile(); + } + if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].type]) || Main.tile[num283, num309].liquid > 0) + { + flag25 = true; + break; + } + } + npc.directionY = (!flag25).ToDirectionInt(); + } + if (flag19) + { + flag23 = true; + } + if (flag23) + { + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + } + else + { + if (npc.directionY < 0 && npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y - 0.1f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + if (npc.collideX) + { + npc.velocity.X = npc.oldVelocity.X * -0.4f; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) + { + npc.velocity.X = 1f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) + { + npc.velocity.X = -1f; + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.oldVelocity.Y * -0.25f; + if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) + { + npc.velocity.Y = 1f; + } + if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) + { + npc.velocity.Y = -1f; + } + } + float num311 = 4f; + if (npc.direction == -1 && npc.velocity.X > -num311) + { + npc.velocity.X = npc.velocity.X - 0.1f; + if (npc.velocity.X > num311) + { + npc.velocity.X = npc.velocity.X - 0.1f; + } + else if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.velocity.X < -num311) + { + npc.velocity.X = -num311; + } + } + else if (npc.direction == 1 && npc.velocity.X < num311) + { + npc.velocity.X = npc.velocity.X + 0.1f; + if (npc.velocity.X < -num311) + { + npc.velocity.X = npc.velocity.X + 0.1f; + } + else if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + if (npc.velocity.X > num311) + { + npc.velocity.X = num311; + } + } + num311 = 1.5f; + if (npc.directionY == -1 && npc.velocity.Y > -num311) + { + npc.velocity.Y = npc.velocity.Y - 0.04f; + if (npc.velocity.Y > num311) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.03f; + } + if (npc.velocity.Y < -num311) + { + npc.velocity.Y = -num311; + } + } + else if (npc.directionY == 1 && npc.velocity.Y < num311) + { + npc.velocity.Y = npc.velocity.Y + 0.04f; + if (npc.velocity.Y < -num311) + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - 0.03f; + } + if (npc.velocity.Y > num311) + { + npc.velocity.Y = num311; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.GetModPlayer(mod).ZoneCalamity ? 0.25f : 0f; + } + + public override void NPCLoot() + { + if (CalamityWorld.downedProvidence && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); + } + if (Main.hardMode && Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/CalamityBiomeNPCs/ScryllarRage.cs b/NPCs/CalamityBiomeNPCs/ScryllarRage.cs index 88e160e930..3d2a16b19e 100644 --- a/NPCs/CalamityBiomeNPCs/ScryllarRage.cs +++ b/NPCs/CalamityBiomeNPCs/ScryllarRage.cs @@ -1,292 +1,292 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CalamityBiomeNPCs -{ - public class ScryllarRage : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scryllar"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 65; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 10; - npc.lifeMax = 50; - npc.alpha = 100; - npc.knockBackResist = 0.9f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit49; - npc.DeathSound = SoundID.NPCDeath51; - npc.noGravity = true; - npc.noTileCollide = true; - npc.lavaImmune = true; - if (CalamityWorld.downedProvidence) - { - npc.damage = 320; - npc.defense = 80; - npc.lifeMax = 2300; - npc.value = Item.buyPrice(0, 0, 50, 0); - } - banner = mod.NPCType("Scryllar"); - bannerItem = mod.ItemType("ScryllarBanner"); - } - - public override void AI() - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - bool flag19 = false; - if (npc.justHit) - { - npc.ai[2] = 0f; - } - if (npc.ai[2] >= 0f) - { - int num282 = 16; - bool flag21 = false; - bool flag22 = false; - if (npc.position.X > npc.ai[0] - (float)num282 && npc.position.X < npc.ai[0] + (float)num282) - { - flag21 = true; - } - else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) - { - flag21 = true; - } - num282 += 24; - if (npc.position.Y > npc.ai[1] - (float)num282 && npc.position.Y < npc.ai[1] + (float)num282) - { - flag22 = true; - } - if (flag21 && flag22) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 30f && num282 == 16) - { - flag19 = true; - } - if (npc.ai[2] >= 60f) - { - npc.ai[2] = -200f; - npc.direction *= -1; - npc.velocity.X = npc.velocity.X * -1f; - npc.collideX = false; - } - } - else - { - npc.ai[0] = npc.position.X; - npc.ai[1] = npc.position.Y; - npc.ai[2] = 0f; - } - npc.TargetClosest(true); - } - else - { - npc.TargetClosest(true); - npc.ai[2] += 2f; - } - int num283 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; - int num284 = (int)((npc.position.Y + (float)npc.height) / 16f); - bool flag23 = true; - int num285 = 3; - for (int num308 = num284; num308 < num284 + num285; num308++) - { - if (Main.tile[num283, num308] == null) - { - Main.tile[num283, num308] = new Tile(); - } - if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].type]) || Main.tile[num283, num308].liquid > 0) - { - flag23 = false; - break; - } - } - if (Main.player[npc.target].npcTypeNoAggro[npc.type]) - { - bool flag25 = false; - for (int num309 = num284; num309 < num284 + num285 - 2; num309++) - { - if (Main.tile[num283, num309] == null) - { - Main.tile[num283, num309] = new Tile(); - } - if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].type]) || Main.tile[num283, num309].liquid > 0) - { - flag25 = true; - break; - } - } - npc.directionY = (!flag25).ToDirectionInt(); - } - if (flag19) - { - flag23 = true; - } - if (flag23) - { - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - } - else - { - if (npc.directionY < 0 && npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y - 0.1f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - if (npc.collideX) - { - npc.velocity.X = npc.oldVelocity.X * -0.4f; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) - { - npc.velocity.X = 1f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) - { - npc.velocity.X = -1f; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.oldVelocity.Y * -0.25f; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) - { - npc.velocity.Y = 1f; - } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) - { - npc.velocity.Y = -1f; - } - } - float num311 = 7f; - if (npc.direction == -1 && npc.velocity.X > -num311) - { - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > num311) - { - npc.velocity.X = npc.velocity.X - 0.1f; - } - else if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.velocity.X < -num311) - { - npc.velocity.X = -num311; - } - } - else if (npc.direction == 1 && npc.velocity.X < num311) - { - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -num311) - { - npc.velocity.X = npc.velocity.X + 0.1f; - } - else if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - if (npc.velocity.X > num311) - { - npc.velocity.X = num311; - } - } - num311 = 1.5f; - if (npc.directionY == -1 && npc.velocity.Y > -num311) - { - npc.velocity.Y = npc.velocity.Y - 0.04f; - if (npc.velocity.Y > num311) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.03f; - } - if (npc.velocity.Y < -num311) - { - npc.velocity.Y = -num311; - } - } - else if (npc.directionY == 1 && npc.velocity.Y < num311) - { - npc.velocity.Y = npc.velocity.Y + 0.04f; - if (npc.velocity.Y < -num311) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - 0.03f; - } - if (npc.velocity.Y > num311) - { - npc.velocity.Y = num311; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - return spawnInfo.player.GetModPlayer(mod).ZoneCalamity ? 0.125f : 0f; - } - - public override void NPCLoot() - { - if (CalamityWorld.downedProvidence && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); - } - if (Main.hardMode && Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CalamityBiomeNPCs +{ + public class ScryllarRage : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scryllar"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 65; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 10; + npc.lifeMax = 50; + npc.alpha = 100; + npc.knockBackResist = 0.9f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit49; + npc.DeathSound = SoundID.NPCDeath51; + npc.noGravity = true; + npc.noTileCollide = true; + npc.lavaImmune = true; + if (CalamityWorld.downedProvidence) + { + npc.damage = 320; + npc.defense = 80; + npc.lifeMax = 2300; + npc.value = Item.buyPrice(0, 0, 50, 0); + } + banner = mod.NPCType("Scryllar"); + bannerItem = mod.ItemType("ScryllarBanner"); + } + + public override void AI() + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + bool flag19 = false; + if (npc.justHit) + { + npc.ai[2] = 0f; + } + if (npc.ai[2] >= 0f) + { + int num282 = 16; + bool flag21 = false; + bool flag22 = false; + if (npc.position.X > npc.ai[0] - (float)num282 && npc.position.X < npc.ai[0] + (float)num282) + { + flag21 = true; + } + else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) + { + flag21 = true; + } + num282 += 24; + if (npc.position.Y > npc.ai[1] - (float)num282 && npc.position.Y < npc.ai[1] + (float)num282) + { + flag22 = true; + } + if (flag21 && flag22) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 30f && num282 == 16) + { + flag19 = true; + } + if (npc.ai[2] >= 60f) + { + npc.ai[2] = -200f; + npc.direction *= -1; + npc.velocity.X = npc.velocity.X * -1f; + npc.collideX = false; + } + } + else + { + npc.ai[0] = npc.position.X; + npc.ai[1] = npc.position.Y; + npc.ai[2] = 0f; + } + npc.TargetClosest(true); + } + else + { + npc.TargetClosest(true); + npc.ai[2] += 2f; + } + int num283 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; + int num284 = (int)((npc.position.Y + (float)npc.height) / 16f); + bool flag23 = true; + int num285 = 3; + for (int num308 = num284; num308 < num284 + num285; num308++) + { + if (Main.tile[num283, num308] == null) + { + Main.tile[num283, num308] = new Tile(); + } + if ((Main.tile[num283, num308].nactive() && Main.tileSolid[(int)Main.tile[num283, num308].type]) || Main.tile[num283, num308].liquid > 0) + { + flag23 = false; + break; + } + } + if (Main.player[npc.target].npcTypeNoAggro[npc.type]) + { + bool flag25 = false; + for (int num309 = num284; num309 < num284 + num285 - 2; num309++) + { + if (Main.tile[num283, num309] == null) + { + Main.tile[num283, num309] = new Tile(); + } + if ((Main.tile[num283, num309].nactive() && Main.tileSolid[(int)Main.tile[num283, num309].type]) || Main.tile[num283, num309].liquid > 0) + { + flag25 = true; + break; + } + } + npc.directionY = (!flag25).ToDirectionInt(); + } + if (flag19) + { + flag23 = true; + } + if (flag23) + { + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + } + else + { + if (npc.directionY < 0 && npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y - 0.1f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + if (npc.collideX) + { + npc.velocity.X = npc.oldVelocity.X * -0.4f; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) + { + npc.velocity.X = 1f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) + { + npc.velocity.X = -1f; + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.oldVelocity.Y * -0.25f; + if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) + { + npc.velocity.Y = 1f; + } + if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) + { + npc.velocity.Y = -1f; + } + } + float num311 = 7f; + if (npc.direction == -1 && npc.velocity.X > -num311) + { + npc.velocity.X = npc.velocity.X - 0.1f; + if (npc.velocity.X > num311) + { + npc.velocity.X = npc.velocity.X - 0.1f; + } + else if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.velocity.X < -num311) + { + npc.velocity.X = -num311; + } + } + else if (npc.direction == 1 && npc.velocity.X < num311) + { + npc.velocity.X = npc.velocity.X + 0.1f; + if (npc.velocity.X < -num311) + { + npc.velocity.X = npc.velocity.X + 0.1f; + } + else if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + if (npc.velocity.X > num311) + { + npc.velocity.X = num311; + } + } + num311 = 1.5f; + if (npc.directionY == -1 && npc.velocity.Y > -num311) + { + npc.velocity.Y = npc.velocity.Y - 0.04f; + if (npc.velocity.Y > num311) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + 0.03f; + } + if (npc.velocity.Y < -num311) + { + npc.velocity.Y = -num311; + } + } + else if (npc.directionY == 1 && npc.velocity.Y < num311) + { + npc.velocity.Y = npc.velocity.Y + 0.04f; + if (npc.velocity.Y < -num311) + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - 0.03f; + } + if (npc.velocity.Y > num311) + { + npc.velocity.Y = num311; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.GetModPlayer(mod).ZoneCalamity ? 0.125f : 0f; + } + + public override void NPCLoot() + { + if (CalamityWorld.downedProvidence && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); + } + if (Main.hardMode && Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs index ca1798a483..c1e42b50a2 100644 --- a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs +++ b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs @@ -1,277 +1,277 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CalamityBiomeNPCs -{ - public class SoulSlurper : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Slurper"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.npcSlots = 1f; - npc.damage = 30; - npc.width = 60; //324 - npc.height = 40; //216 - npc.defense = 40; - npc.lifeMax = 60; - npc.knockBackResist = 0.65f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.noGravity = true; - npc.lavaImmune = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.damage = 170; - npc.defense = 200; - npc.lifeMax = 3000; - npc.value = Item.buyPrice(0, 0, 50, 0); - } - banner = npc.type; - bannerItem = mod.ItemType("SoulSlurperBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - return spawnInfo.player.GetModPlayer(mod).ZoneCalamity ? 0.25f : 0f; - } - - public override void AI() - { - bool provy = CalamityWorld.downedProvidence; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = 5f; - float num2 = 0.07f; - 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 (npc.justHit) - { - npc.localAI[0] = 0f; - } - if (Main.netMode != 1 && npc.localAI[0] >= 120f) - { - 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)) - { - int num8 = 30; - if (Main.expertMode) - { - num8 = 22; - } - int num9 = mod.ProjectileType("BrimstoneLaser"); - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 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.75f, 0f, 0f); - } - 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 void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - - public override void NPCLoot() - { - if (CalamityWorld.downedProvidence && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); - } - if (Main.hardMode && Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper4"), 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; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CalamityBiomeNPCs +{ + public class SoulSlurper : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Slurper"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.npcSlots = 1f; + npc.damage = 30; + npc.width = 60; //324 + npc.height = 40; //216 + npc.defense = 40; + npc.lifeMax = 60; + npc.knockBackResist = 0.65f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.noGravity = true; + npc.lavaImmune = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.damage = 170; + npc.defense = 200; + npc.lifeMax = 3000; + npc.value = Item.buyPrice(0, 0, 50, 0); + } + banner = npc.type; + bannerItem = mod.ItemType("SoulSlurperBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.GetModPlayer(mod).ZoneCalamity ? 0.25f : 0f; + } + + public override void AI() + { + bool provy = CalamityWorld.downedProvidence; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = 5f; + float num2 = 0.07f; + 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 (npc.justHit) + { + npc.localAI[0] = 0f; + } + if (Main.netMode != 1 && npc.localAI[0] >= 120f) + { + 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)) + { + int num8 = 30; + if (Main.expertMode) + { + num8 = 22; + } + int num9 = mod.ProjectileType("BrimstoneLaser"); + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 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.75f, 0f, 0f); + } + 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 void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + + public override void NPCLoot() + { + if (CalamityWorld.downedProvidence && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone")); + } + if (Main.hardMode && Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper4"), 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; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index b2d730089e..56d5a2c67d 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1,9829 +1,9829 @@ -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 CalamityGlobalNPC : GlobalNPC - { - #region InstancePerEntity - public override bool InstancePerEntity - { - get - { - return true; - } - } - #endregion - - #region InstanceVars - //Damage reduction - private float protection = 0f; - private float defProtection = 0f; - - //NewAI - private const int maxAIMod = 4; - private float[] newAI = new float[maxAIMod]; - - //Town NPC Patreon - private bool setNewName = true; - - //Draedons Remote - public static bool DraedonMayhem = false; - - //Lunatic Cultist Rev+ attack - private int CultProjectiles = 2; - private const float CultAngleSpread = 170; - private int CultCountdown = 0; - - //Debuffs - public bool wCleave = false; - public bool bBlood = false; - public bool dFlames = false; - public bool marked = false; - public bool irradiated = false; - public bool bFlames = false; - public bool hFlames = false; - public bool pFlames = false; - public bool gState = false; - public bool aCrunch = false; - public bool tSad = false; - public bool pShred = false; - public bool cDepth = false; - public bool gsInferno = false; - public bool aFlames = false; - public bool eFreeze = false; - public bool wDeath = false; - public bool nightwither = false; - public bool silvaStun = false; - public bool enraged = false; - public bool yellowCandle = false; - public bool pearlAura = false; - public bool shellfishVore = false; - public bool clamDebuff = false; - - //whoAmI Variables - public static int bobbitWormBottom = -1; - public static int hiveMind = -1; - public static int perfHive = -1; - public static int slimeGodPurple = -1; - public static int slimeGodRed = -1; - public static int slimeGod = -1; - public static int laserEye = -1; - public static int fireEye = -1; - public static int brimstoneElemental = -1; - public static int cataclysm = -1; - public static int catastrophe = -1; - public static int calamitas = -1; - public static int leviathan = -1; - public static int siren = -1; - public static int scavenger = -1; - public static int astrumDeusHeadMain = -1; - public static int energyFlame = -1; - public static int doughnutBoss = -1; - public static int holyBossAttacker = -1; - public static int holyBossDefender = -1; - public static int holyBossHealer = -1; - public static int holyBoss = -1; - public static int voidBoss = -1; - public static int ghostBossClone = -1; - public static int ghostBoss = -1; - public static int DoGHead = -1; - public static int SCalCataclysm = -1; - public static int SCalCatastrophe = -1; - public static int SCal = -1; - public static int SCalWorm = -1; - #endregion - - #region ResetEffects - public override void ResetEffects(NPC npc) - { - if (bobbitWormBottom >= 0 && !Main.npc[bobbitWormBottom].active) - bobbitWormBottom = -1; - if (hiveMind >= 0 && !Main.npc[hiveMind].active) - hiveMind = -1; - if (perfHive >= 0 && !Main.npc[perfHive].active) - perfHive = -1; - if (slimeGodPurple >= 0 && !Main.npc[slimeGodPurple].active) - slimeGodPurple = -1; - if (slimeGodRed >= 0 && !Main.npc[slimeGodRed].active) - slimeGodRed = -1; - if (slimeGod >= 0 && !Main.npc[slimeGod].active) - slimeGod = -1; - if (laserEye >= 0 && !Main.npc[laserEye].active) - laserEye = -1; - if (fireEye >= 0 && !Main.npc[fireEye].active) - fireEye = -1; - if (brimstoneElemental >= 0 && !Main.npc[brimstoneElemental].active) - brimstoneElemental = -1; - if (cataclysm >= 0 && !Main.npc[cataclysm].active) - cataclysm = -1; - if (catastrophe >= 0 && !Main.npc[catastrophe].active) - catastrophe = -1; - if (calamitas >= 0 && !Main.npc[calamitas].active) - calamitas = -1; - if (leviathan >= 0 && !Main.npc[leviathan].active) - leviathan = -1; - if (siren >= 0 && !Main.npc[siren].active) - siren = -1; - if (scavenger >= 0 && !Main.npc[scavenger].active) - scavenger = -1; - if (astrumDeusHeadMain >= 0 && !Main.npc[astrumDeusHeadMain].active) - astrumDeusHeadMain = -1; - if (energyFlame >= 0 && !Main.npc[energyFlame].active) - energyFlame = -1; - if (doughnutBoss >= 0 && !Main.npc[doughnutBoss].active) - doughnutBoss = -1; - if (holyBossAttacker >= 0 && !Main.npc[holyBossAttacker].active) - holyBossAttacker = -1; - if (holyBossDefender >= 0 && !Main.npc[holyBossDefender].active) - holyBossDefender = -1; - if (holyBossHealer >= 0 && !Main.npc[holyBossHealer].active) - holyBossHealer = -1; - if (holyBoss >= 0 && !Main.npc[holyBoss].active) - holyBoss = -1; - if (voidBoss >= 0 && !Main.npc[voidBoss].active) - voidBoss = -1; - if (ghostBossClone >= 0 && !Main.npc[ghostBossClone].active) - ghostBossClone = -1; - if (ghostBoss >= 0 && !Main.npc[ghostBoss].active) - ghostBoss = -1; - if (DoGHead >= 0 && !Main.npc[DoGHead].active) - DoGHead = -1; - if (SCalCataclysm >= 0 && !Main.npc[SCalCataclysm].active) - SCalCataclysm = -1; - if (SCalCatastrophe >= 0 && !Main.npc[SCalCatastrophe].active) - SCalCatastrophe = -1; - if (SCal >= 0 && !Main.npc[SCal].active) - SCal = -1; - if (SCalWorm >= 0 && !Main.npc[SCalWorm].active) - SCalWorm = -1; - - wCleave = false; - bBlood = false; - dFlames = false; - marked = false; - irradiated = false; - bFlames = false; - hFlames = false; - pFlames = false; - gState = false; - aCrunch = false; - tSad = false; - pShred = false; - cDepth = false; - gsInferno = false; - aFlames = false; - eFreeze = false; - wDeath = false; - nightwither = false; - silvaStun = false; - enraged = false; - yellowCandle = false; - pearlAura = false; - shellfishVore = false; - clamDebuff = false; - } - #endregion - - #region LifeRegen - public override void UpdateLifeRegen(NPC npc, ref int damage) - { - bool hardMode = Main.hardMode; - int npcDefense = npc.defense; - 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) - { - npc.AddBuff(mod.BuffType("CrushDepth"), 2); - if (npc.DeathSound != null) - { - npc.DeathSound = null; - } - if (npc.HitSound != null) - { - npc.HitSound = null; - } - } - bool hurtByPiss = (npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && CalamityWorld.sulphurTiles > 30 && - !npc.buffImmune[BuffID.Poisoned] && !npc.buffImmune[mod.BuffType("CrushDepth")]); - if (hurtByPiss) - { - npc.AddBuff(BuffID.Poisoned, 2); - } - if (Main.raining && npc.damage > 0 && !npc.boss && - !npc.friendly && !npc.dontTakeDamage && CalamityWorld.sulphurTiles > 30 && - !npc.buffImmune[BuffID.Poisoned] && !npc.buffImmune[mod.BuffType("CrushDepth")]) - { - npc.AddBuff(mod.BuffType("Irradiated"), 2); - } - if (npc.venom) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - int num7 = 0; - for (int j = 0; j < 1000; j++) - { - if (Main.projectile[j].active && - (Main.projectile[j].type == mod.ProjectileType("Lionfish") || Main.projectile[j].type == mod.ProjectileType("SulphuricAcidCannon2")) && - Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == (float)npc.whoAmI) - { - num7++; - } - } - if (num7 > 0) - { - npc.lifeRegen -= num7 * 30; - if (damage < num7 * 6) - { - damage = num7 * 6; - } - } - } - if (shellfishVore) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - int amount = 0; - for (int j = 0; j < 1000; j++) - { - if (Main.projectile[j].active && - (Main.projectile[j].type == mod.ProjectileType("Shellfish")) && - Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == (float)npc.whoAmI && - amount < 5) - { - amount++; - } - } - npc.lifeRegen -= amount * 350; - if (damage < amount * 35) - { - damage = amount * 35; - } - } - if (clamDebuff) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - int amount = 0; - for (int j = 0; j < 1000; j++) - { - if (Main.projectile[j].active && - (Main.projectile[j].type == mod.ProjectileType("SnapClamProj")) && - Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == (float)npc.whoAmI && - amount < 2) - { - amount++; - } - } - npc.lifeRegen -= amount * 25; - if (damage < amount * 5) - { - damage = amount * 5; - } - } - if (irradiated) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= 20; - if (damage < 4) - { - damage = 4; - } - } - if (cDepth) - { - if (npcDefense < 0) - { - npcDefense = 0; - } - int depthDamage = hardMode ? 80 : 12; - if (hurtByAbyss) - { - depthDamage = 300; - } - int calcDepthDamage = depthDamage - npcDefense; - if (calcDepthDamage < 0) - { - calcDepthDamage = 0; - } - int calcDepthRegenDown = calcDepthDamage * 5; - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= calcDepthRegenDown; - if (damage < calcDepthDamage) - { - damage = calcDepthDamage; - } - } - if (bFlames) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= 40; - if (damage < 8) - { - damage = 8; - } - } - if (hFlames) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= 50; - if (damage < 10) - { - damage = 10; - } - } - if (pFlames) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= 100; - if (damage < 20) - { - damage = 20; - } - } - if (gsInferno) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= 250; - if (damage < 50) - { - damage = 50; - } - } - if (aFlames) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= 125; - if (damage < 25) - { - damage = 25; - } - } - if (pShred) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= 1500; - if (damage < 300) - { - damage = 300; - } - } - if (gState) - { - npc.velocity.X = 0f; - npc.velocity.Y = npc.velocity.Y + 0.05f; - if (npc.velocity.Y > 15f) - { - npc.velocity.Y = 15f; - } - } - if (eFreeze && !CalamityWorld.bossRushActive) - { - npc.velocity.X = 0f; - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y > 15f) - { - npc.velocity.Y = 15f; - } - } - if (tSad) - { - npc.velocity.Y /= 2; - npc.velocity.X /= 2; - } - if (nightwither) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= 200; - if (damage < 40) - { - damage = 40; - } - } - if (dFlames) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= 2500; - if (damage < 500) - { - damage = 500; - } - } - if (bBlood) - { - if (npc.lifeRegen > 0) - { - npc.lifeRegen = 0; - } - npc.lifeRegen -= 50; - if (damage < 10) - { - damage = 10; - } - } - } - #endregion - - #region SetDefaults - public override void SetDefaults(NPC npc) - { - for (int m = 0; m < maxAIMod; m++) - { - newAI[m] = 0f; - } - - if (npc.boss && CalamityWorld.revenge) - { - if (npc.type != mod.NPCType("HiveMindP2") && npc.type != mod.NPCType("Leviathan") && npc.type != mod.NPCType("StormWeaverHeadNaked") && - npc.type != mod.NPCType("StormWeaverBodyNaked") && npc.type != mod.NPCType("StormWeaverTailNaked") && - npc.type != mod.NPCType("DevourerofGodsHeadS") && npc.type != mod.NPCType("DevourerofGodsBodyS") && - npc.type != mod.NPCType("DevourerofGodsTailS")) - { - if (Main.netMode != 2) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.player[Main.myPlayer].GetModPlayer(mod).adrenaline = 0; - } - } - } - } - - if (CalamityWorld.bossRushActive) - { - if (!npc.friendly) - { - 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; - } - } - else - { - if (CalamityMod.enemyImmunityList.Contains(npc.type)) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - } - if (npc.type == NPCID.TheDestroyer || - npc.type == NPCID.TheDestroyerBody || - npc.type == NPCID.TheDestroyerTail || - npc.type == NPCID.DD2EterniaCrystal || - npc.townNPC) - { - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - if (npc.townNPC) - { - 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")]) - { - npc.buffImmune[mod.BuffType("Enraged")] = false; - } - } - - if (npc.type == NPCID.QueenBee) - { - npc.value = Item.buyPrice(0, 5, 0, 0); - } - else if (npc.type == NPCID.SkeletronHead) - { - npc.value = Item.buyPrice(0, 7, 0, 0); - } - else if (npc.type == NPCID.DukeFishron) - { - npc.value = Item.buyPrice(0, 25, 0, 0); - } - else if (npc.type == NPCID.CultistBoss) - { - npc.value = Item.buyPrice(0, 25, 0, 0); - } - else if (npc.type == NPCID.MoonLordCore) - { - npc.value = Item.buyPrice(0, 30, 0, 0); - } - if (CalamityWorld.defiled) - { - npc.value = (float)((int)((double)npc.value * 1.5)); - } - - if (CalamityWorld.bossRushActive) - { - switch (npc.type) - { - case NPCID.QueenBee: //Tier 1 - npc.lifeMax = 420000; - break; - case NPCID.BrainofCthulhu: - npc.lifeMax = 200000; - break; - case NPCID.Creeper: - npc.lifeMax = 20000; - break; - case NPCID.KingSlime: - npc.lifeMax = 500000; - break; - case NPCID.BlueSlime: - npc.lifeMax = 12000; - break; - case NPCID.SlimeSpiked: - npc.lifeMax = 24000; - break; - case NPCID.EyeofCthulhu: - npc.lifeMax = 600000; - break; - case NPCID.ServantofCthulhu: - npc.lifeMax = 60000; - break; - case NPCID.SkeletronPrime: - npc.lifeMax = 780000; - break; - case NPCID.PrimeCannon: - npc.lifeMax = 350000; - break; - case NPCID.PrimeVice: - npc.lifeMax = 440000; - break; - case NPCID.PrimeSaw: - npc.lifeMax = 450000; - break; - case NPCID.PrimeLaser: - npc.lifeMax = 280000; - break; - case NPCID.Golem: - npc.lifeMax = 450000; - break; - case NPCID.GolemHead: - npc.lifeMax = 300000; - break; - case NPCID.GolemFistLeft: - npc.lifeMax = 250000; - break; - case NPCID.GolemFistRight: - npc.lifeMax = 250000; - break; - case NPCID.EaterofWorldsHead: - npc.lifeMax = 20000; - break; - case NPCID.EaterofWorldsBody: - npc.lifeMax = 30000; - break; - case NPCID.EaterofWorldsTail: - npc.lifeMax = 40000; - break; - case NPCID.TheDestroyer: //Tier 2 - npc.lifeMax = 2500000; - break; - case NPCID.TheDestroyerBody: - npc.lifeMax = 2500000; - break; - case NPCID.TheDestroyerTail: - npc.lifeMax = 2500000; - break; - case NPCID.Probe: - npc.lifeMax = 50000; - break; - case NPCID.Spazmatism: - npc.lifeMax = 1000000; - break; - case NPCID.Retinazer: - npc.lifeMax = 700000; - break; - case NPCID.WallofFlesh: - npc.lifeMax = 2400000; - break; - case NPCID.WallofFleshEye: - npc.lifeMax = 2400000; - break; - case NPCID.SkeletronHead: - npc.lifeMax = 1300000; - break; - case NPCID.SkeletronHand: - npc.lifeMax = 500000; - break; - case NPCID.CultistBoss: //Tier 3 - npc.lifeMax = 1100000; - break; - case NPCID.CultistDragonHead: - npc.lifeMax = 400000; - break; - case NPCID.CultistDragonBody1: - npc.lifeMax = 400000; - break; - case NPCID.CultistDragonBody2: - npc.lifeMax = 400000; - break; - case NPCID.CultistDragonBody3: - npc.lifeMax = 400000; - break; - case NPCID.CultistDragonBody4: - npc.lifeMax = 400000; - break; - case NPCID.CultistDragonTail: - npc.lifeMax = 400000; - break; - case NPCID.AncientCultistSquidhead: - npc.lifeMax = 300000; - break; - case NPCID.Plantera: - npc.lifeMax = 2100000; - break; - case NPCID.PlanterasTentacle: - npc.lifeMax = 90000; - break; - case NPCID.DukeFishron: //Tier 4 - npc.lifeMax = 2500000; - break; - case NPCID.MoonLordCore: - npc.lifeMax = 1400000; - break; - case NPCID.MoonLordHand: - npc.lifeMax = 450000; - break; - case NPCID.MoonLordHead: - npc.lifeMax = 600000; - break; - case NPCID.MoonLordFreeEye: - npc.lifeMax = 1000; - break; - } - } - - if (npc.type == NPCID.CultistBoss) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.25); - else - npc.lifeMax = (int)((double)npc.lifeMax * (CalamityWorld.revenge ? 1.55 : 1.15)); - 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) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 2.7); - npc.scale *= 1.25f; - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.8); - npc.scale *= 1.2f; - } - npc.npcSlots = 10f; - } - else if (npc.type == NPCID.Probe) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.9); - npc.scale *= 1.25f; - } - else - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.6); - npc.scale *= 1.2f; - } - } - else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeCannon || npc.type == NPCID.PrimeSaw || npc.type == NPCID.PrimeLaser) - { - if (npc.type == NPCID.SkeletronPrime) - npc.npcSlots = 12f; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.9); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.6); - } - else if (npc.type == NPCID.Retinazer) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 3.0); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.8); - npc.npcSlots = 10f; - } - else if (npc.type == NPCID.Spazmatism) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 3.0); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.8); - npc.npcSlots = 10f; - } - } - - if (CalamityWorld.revenge) - { - npc.value = (float)((int)((double)npc.value * 1.5)); - - if (npc.type == NPCID.MoonLordFreeEye) - { - npc.lifeMax = (int)((double)npc.lifeMax * 150.0); - } - else if (npc.type == NPCID.Mothron) - { - npc.scale = 1.25f; - } - else if (npc.type == NPCID.MoonLordCore) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.4); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.9); - npc.npcSlots = 12f; - } - else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.2); - npc.npcSlots = 12f; - } - else if (npc.type >= 454 && npc.type <= 459) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 10.0); - else - npc.lifeMax = (int)((double)npc.lifeMax * 5.0); - } - else if (npc.type == NPCID.DukeFishron) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 3.525); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.85); - npc.npcSlots = 20f; - } - else if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) - { - npc.lifeMax = (int)((double)npc.lifeMax * 30.0); - } - else if (npc.type == NPCID.Golem) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 8.5); - else - npc.lifeMax = (int)((double)npc.lifeMax * 3.5); - npc.npcSlots = 64f; - } - else if (npc.type == NPCID.Plantera) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.9); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.9); - npc.npcSlots = 32f; - } - else if (npc.type == NPCID.PlanterasTentacle) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); - } - else if (npc.type == NPCID.WallofFlesh || npc.type == NPCID.WallofFleshEye) - { - if (npc.type == NPCID.WallofFlesh) - npc.npcSlots = 20f; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.6); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.9); - } - else if (npc.type == NPCID.TheHungryII) - { - if (CalamityWorld.death) - { - npc.noTileCollide = true; - npc.lifeMax = (int)((double)npc.lifeMax * 1.5); - } - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); - } - else if (npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody || npc.type == NPCID.LeechTail) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.5); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); - } - else if (npc.type == NPCID.SkeletronHead) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); - npc.npcSlots = 12f; - } - else if (npc.type == NPCID.SkeletronHand) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.3); - } - else if (npc.type == NPCID.QueenBee) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.65); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.15); - npc.npcSlots = 14f; - } - else if (npc.type == NPCID.BrainofCthulhu) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.9); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); - npc.npcSlots = 12f; - } - else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - if (npc.type == NPCID.EaterofWorldsHead) - { - npc.npcSlots = 10f; - if (CalamityWorld.death) - npc.reflectingProjectiles = true; - } - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.3); - } - else if (npc.type == NPCID.EyeofCthulhu) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.3); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); - npc.npcSlots = 10f; - } - else if (npc.type == NPCID.KingSlime) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.85); - } - 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) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.6); - npc.scale *= 1.2f; - } - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); - npc.npcSlots = 10f; - } - else if (npc.type == NPCID.Probe) - { - if (CalamityWorld.death) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.9); - npc.scale *= 1.2f; - } - } - else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeCannon || npc.type == NPCID.PrimeSaw || npc.type == NPCID.PrimeLaser) - { - if (npc.type == NPCID.SkeletronPrime) - npc.npcSlots = 12f; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.9); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); - } - else if (npc.type == NPCID.Retinazer) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.7); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.45); - npc.npcSlots = 10f; - } - else if (npc.type == NPCID.Spazmatism) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.8); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.55); - 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 || - npc.type == NPCID.LeechBody || npc.type == NPCID.LeechTail || npc.type == NPCID.TheDestroyerBody || - npc.type == NPCID.TheDestroyerTail || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail || - npc.type == NPCID.GolemHead || npc.type == NPCID.GolemFistRight || npc.type == NPCID.GolemFistLeft || - npc.type == NPCID.MoonLordCore) - { - npc.canGhostHeal = false; - } - - if (Config.RevengeanceAndDeathThoriumBossBuff) - { - Mod thorium = ModLoader.GetMod("ThoriumMod"); - if (thorium != null) - { - if (npc.type == thorium.NPCType("Viscount") || npc.type == thorium.NPCType("BoreanStrider") || npc.type == thorium.NPCType("FallenDeathBeholder") || - npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("AbyssionReleased")) - { - protection = 0.05f; - } - else if (npc.type == thorium.NPCType("CryoCore") || npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore") || - npc.type == thorium.NPCType("Aquaius")) - { - protection = 0.1f; - } - else if (npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("FallenDeathBeholder2") || npc.type == thorium.NPCType("SlagFury") || - npc.type == thorium.NPCType("Aquaius2") || npc.type == thorium.NPCType("GraniteEnergyStorm")) - { - protection = 0.2f; - } - else if (npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || npc.type == thorium.NPCType("TheBuriedWarrior2") || - npc.type == thorium.NPCType("LichHeadless") || npc.type == thorium.NPCType("AbyssionCracked")) - { - protection = 0.25f; - } - else if (npc.type == thorium.NPCType("Omnicide")) - { - protection = 0.3f; - } - else if (npc.type == thorium.NPCType("Abyssion")) - { - protection = 0.35f; - } - } - } - - 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("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("AstrumDeusHead") || npc.type == mod.NPCType("AquaticScourgeHead") || - npc.type == mod.NPCType("Cryon") || npc.type == mod.NPCType("Cryogen")) - { - protection = 0.1f; - } - else if (npc.type == mod.NPCType("ArmoredDiggerHead") || npc.type == mod.NPCType("AstralProbe") || npc.type == mod.NPCType("Calamitas") || - npc.type == mod.NPCType("CalamitasRun") || npc.type == mod.NPCType("CalamitasRun2") || npc.type == mod.NPCType("CalamitasRun3") || - 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("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") || 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") || - npc.type == mod.NPCType("Clam") || npc.type == mod.NPCType("PrismTurtle")) - { - protection = 0.25f; - } - else if (npc.type == mod.NPCType("ProvSpawnOffense") || npc.type == mod.NPCType("GiantClam")) - { - protection = 0.3f; - } - else if (npc.type == mod.NPCType("ArmoredDiggerBody") || npc.type == mod.NPCType("AstrumDeusTail") || npc.type == mod.NPCType("DespairStone") || - npc.type == mod.NPCType("SoulSeekerSupreme") || npc.type == mod.NPCType("Leviathan")) - { - protection = 0.35f; - } - else if (npc.type == mod.NPCType("CryogenIce") || npc.type == mod.NPCType("ProfanedGuardianBoss") || npc.type == mod.NPCType("ProvSpawnDefense") || - npc.type == mod.NPCType("ScavengerBody")) - { - protection = 0.4f; - } - else if (npc.type == mod.NPCType("ArmoredDiggerTail")) - { - protection = 0.45f; - } - else if (npc.type == mod.NPCType("SirenIce")) - { - protection = 0.5f; - } - else - { - switch (npc.type) - { - case NPCID.SkeletronHand: - case NPCID.SkeletronHead: - case NPCID.QueenBee: - case NPCID.HeadlessHorseman: - case NPCID.FlyingAntlion: - case NPCID.PirateCaptain: - case NPCID.MoonLordHead: - case NPCID.MoonLordHand: - case NPCID.MoonLordCore: - case NPCID.MoonLordFreeEye: - case NPCID.CultistBoss: - case NPCID.Mothron: - case NPCID.Crab: - case NPCID.SeaSnail: - protection = 0.05f; - break; - case NPCID.Antlion: - case NPCID.TheHungry: - case NPCID.TheDestroyer: - case NPCID.UndeadViking: - case NPCID.MourningWood: - case NPCID.Everscream: - case NPCID.GreekSkeleton: - case NPCID.GraniteFlyer: - case NPCID.WalkingAntlion: - case NPCID.Pumpking: - case NPCID.IceQueen: - case NPCID.IceGolem: - case NPCID.AnomuraFungus: - case NPCID.SkeletonArcher: - case NPCID.SandElemental: - case NPCID.Arapaima: - case NPCID.ArmoredViking: - case NPCID.DD2Betsy: - case NPCID.DD2OgreT2: - 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; - case NPCID.Retinazer: - case NPCID.Spazmatism: - case NPCID.PrimeCannon: - case NPCID.PrimeLaser: - case NPCID.TheDestroyerBody: - case 269: - case 270: - case 271: - case 272: - case 273: - case 274: - case 275: - case 276: - case 277: - case 278: - case 279: - case 280: - case 281: - case 282: - case 283: - case 284: - case 285: - case 286: - case 287: - case 288: - case 289: - case 291: - case 292: - case 293: - case 294: - case 295: - case 296: - case NPCID.MartianSaucerTurret: - case NPCID.MartianSaucerCannon: - case NPCID.MartianTurret: - case NPCID.MartianDrone: - case NPCID.MartianSaucer: - case NPCID.MartianSaucerCore: - case 494: - case 495: - case 496: - case 497: - protection = 0.2f; - break; - case NPCID.PrimeSaw: - case NPCID.PrimeVice: - case NPCID.SkeletronPrime: - case NPCID.Probe: - case NPCID.PossessedArmor: - protection = 0.25f; - break; - case NPCID.Mimic: - case NPCID.PresentMimic: - case 473: - case 474: - case 475: - case 476: - protection = 0.3f; - break; - case NPCID.GiantTortoise: - case NPCID.IceTortoise: - case NPCID.SantaNK1: - case NPCID.MartianWalker: - case NPCID.TheDestroyerTail: - protection = 0.35f; - break; - case NPCID.DeadlySphere: - protection = 0.4f; - break; - case NPCID.Paladin: - protection = 0.45f; - break; - case NPCID.WallofFlesh: - case NPCID.MothronEgg: - protection = 0.5f; - break; - case NPCID.DungeonGuardian: - protection = 0.999999f; - break; - } - } - } - if (npc.type == mod.NPCType("SCalWormBody") || npc.type == mod.NPCType("SCalWormHead") || npc.type == mod.NPCType("SCalWormBodyWeak") || - npc.type == mod.NPCType("SCalWormTail") || npc.type == mod.NPCType("EidolonWyrmHeadHuge")) - { - protection = 0.999999f; - } - if (protection > 0f) - { - defProtection = protection; - } - - if (Main.bloodMoon && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000) - { - npc.lifeMax = (int)((double)npc.lifeMax * 3.5); - npc.damage += 100; - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } - if (CalamityWorld.downedDoG) - { - if (CalamityMod.pumpkinMoonBuffList.Contains(npc.type)) - { - npc.lifeMax = (int)((double)npc.lifeMax * 7.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 += 200; - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } - } - if (CalamityMod.eclipseBuffList.Contains(npc.type) && CalamityWorld.buffedEclipse) - { - npc.lifeMax = (int)((double)npc.lifeMax * 32.5); - npc.damage += 250; - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } - if (NPC.downedMoonlord) - { - if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type)) - { - npc.lifeMax = (int)((double)npc.lifeMax * 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 - - #region ScaleExpertMultiplayerStats - public override void ScaleExpertStats(NPC npc, int numPlayers, float bossLifeScale) - { - if (CalamityWorld.revenge) - { - if (Config.RevengeanceAndDeathThoriumBossBuff) - { - Mod thorium = ModLoader.GetMod("ThoriumMod"); - if (thorium != null) - { - if (npc.type == thorium.NPCType("Hatchling") || npc.type == thorium.NPCType("DistractJelly") || npc.type == thorium.NPCType("ViscountBaby") || - npc.type == thorium.NPCType("BoreanHopper") || npc.type == thorium.NPCType("BoreanMyte1") || npc.type == thorium.NPCType("EnemyBeholder") || - npc.type == thorium.NPCType("ThousandSoulPhalactry") || npc.type == thorium.NPCType("AbyssalSpawn")) - { - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.3); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.5); - } - else if (npc.type == thorium.NPCType("TheGrandThunderBirdv2")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.3); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.5); - } - else if (npc.type == thorium.NPCType("QueenJelly")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.9); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.35); - } - else if (npc.type == thorium.NPCType("Viscount")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.65); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); - } - else if (npc.type == thorium.NPCType("GraniteEnergyStorm")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.25); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.1); - } - else if (npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || npc.type == thorium.NPCType("TheBuriedWarrior2")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.5); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.2); - } - else if (npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") || npc.type == thorium.NPCType("BioCore") || - npc.type == thorium.NPCType("PyroCore")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.75); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.3); - } - else if (npc.type == thorium.NPCType("BoreanStrider") || npc.type == thorium.NPCType("BoreanStriderPopped")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.0); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.4); - } - else if (npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.5); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.6); - } - else if (npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.5); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.6); - } - else if (npc.type == thorium.NPCType("Abyssion") || npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 2.3); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.5); - } - else if (npc.type == thorium.NPCType("SlagFury") || npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") || - npc.type == thorium.NPCType("Aquaius") || npc.type == thorium.NPCType("Aquaius2")) - { - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - if (CalamityWorld.death) - npc.lifeMax = (int)((double)npc.lifeMax * 1.75); - else - npc.lifeMax = (int)((double)npc.lifeMax * 1.3); - } - } - } - } - - if (Main.netMode != 0) - { - if (numPlayers > 1) - { - if (((npc.boss || CalamityMod.bossScaleList.Contains(npc.type)) && npc.type < NPCID.Count) || - (npc.modNPC != null && npc.modNPC.mod.Name.Equals("CalamityMod"))) - { - double scalar = 1.0; - switch (numPlayers) //Decrease HP in multiplayer before vanilla scaling - { - case 2: - scalar = 0.76; - break; - case 3: - scalar = 0.63; - break; - case 4: - scalar = 0.525; - break; - case 5: - scalar = 0.43; - break; - case 6: - scalar = 0.36; - break; - default: - scalar = 0.295; - break; - } - npc.lifeMax = (int)((double)npc.lifeMax * scalar); - } - } - } - } - #endregion - - #region CanBeHitBy - public override bool? CanBeHitByItem(NPC npc, Player player, Item item) - { - if (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) - { - return !CalamityPlayer.areThereAnyDamnBosses; - } - return null; - } - - public override bool? CanBeHitByProjectile(NPC npc, Projectile projectile) - { - if (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) - { - return !CalamityPlayer.areThereAnyDamnBosses; - } - return null; - } - #endregion - - #region CanHitPlayer - public override bool CanHitPlayer(NPC npc, Player target, ref int cooldownSlot) - { - if (Main.pumpkinMoon && CalamityWorld.downedDoG && !npc.boss && !npc.friendly && !npc.dontTakeDamage) - cooldownSlot = 1; - else if (Main.snowMoon && CalamityWorld.downedDoG && !npc.boss && !npc.friendly && !npc.dontTakeDamage) - cooldownSlot = 1; - else if (Main.eclipse && CalamityWorld.buffedEclipse && !npc.boss && !npc.friendly && !npc.dontTakeDamage) - cooldownSlot = 1; - if (npc.type == NPCID.BrainofCthulhu && npc.alpha > 0) - return false; - return true; - } - #endregion - - #region ModifyHitPlayer - public override void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit) - { - if (tSad) - { - damage /= 2; - } - if (target.GetModPlayer(mod).beeResist) - { - if (CalamityMod.beeEnemyList.Contains(npc.type)) - { - damage = (int)((double)damage * 0.75); - } - } - } - #endregion - - #region StrikeNPC - public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail || - npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - if (newAI[1] < 480f || newAI[2] > 0f) - damage *= 0.01; - } - - 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) - { - 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.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 - - #region PreAI - public override bool PreAI(NPC npc) - { - if (setNewName) - { - setNewName = false; - switch (npc.type) - { - case NPCID.Guide: - switch (Main.rand.Next(36)) //34 guide names - { - case 0: - npc.GivenName = "Lapp"; - break; - case 1: - npc.GivenName = "Ben Shapiro"; - break; - default: - break; - } - break; - case NPCID.Wizard: - switch (Main.rand.Next(24)) //23 wizard names - { - case 0: - npc.GivenName = "Mage One-Trick"; - break; - default: - break; - } - break; - case NPCID.Steampunker: - switch (Main.rand.Next(22)) //21 steampunker names - { - case 0: - npc.GivenName = "Vorbis"; - break; - default: - break; - } - break; - case NPCID.Stylist: - switch (Main.rand.Next(21)) //20 stylist names - { - case 0: - npc.GivenName = "Amber"; - break; - default: - break; - } - break; - case NPCID.WitchDoctor: - switch (Main.rand.Next(11)) //10 witch doctor names - { - case 0: - npc.GivenName = "Sok'ar"; - break; - default: - break; - } - break; - default: - break; - } - } - - /*Main.player[npc.target].GetModPlayer(mod).distanceFromBoss = -1; //Important - if (CalamityWorld.revenge) - { - if (npc.type != NPCID.MartianSaucerCore && - (npc.boss || npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsTail || npc.type == mod.NPCType("SlimeGodRun") || - npc.type == mod.NPCType("SlimeGodRunSplit") || npc.type == mod.NPCType("SlimeGod") || npc.type == mod.NPCType("SlimeGodSplit"))) - { - Main.player[npc.target].GetModPlayer(mod).distanceFromBoss = (int)Vector2.Distance(Main.player[npc.target].Center, npc.Center); - } - }*/ - - if (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) - { - npc.chaseable = !CalamityPlayer.areThereAnyDamnBosses; - } - if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail || - npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - if (npc.buffImmune[mod.BuffType("Enraged")]) - { - npc.buffImmune[mod.BuffType("Enraged")] = false; - } - if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - if (newAI[3] == 0f) - { - newAI[3] = 1f; - newAI[1] = 300f; - } - } - if (newAI[1] < 480f) - { - 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) - { - switch (CalamityWorld.bossRushStage) - { - case 0: - if (npc.type != NPCID.QueenBee && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 1: - if (npc.type != NPCID.BrainofCthulhu && npc.type != NPCID.Creeper) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 2: - if (npc.type != NPCID.KingSlime && npc.type != NPCID.BlueSlime && npc.type != NPCID.SlimeSpiked) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 3: - if (npc.type != NPCID.EyeofCthulhu && npc.type != NPCID.ServantofCthulhu) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 4: - if (npc.type != NPCID.SkeletronPrime && npc.type != NPCID.PrimeSaw && npc.type != NPCID.PrimeVice && - npc.type != NPCID.PrimeCannon && npc.type != NPCID.PrimeLaser) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 5: - if (npc.type != NPCID.Golem && npc.type != NPCID.GolemFistLeft && npc.type != NPCID.GolemFistRight && - npc.type != NPCID.GolemHead && npc.type != NPCID.GolemHeadFree) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 6: - if (npc.type != mod.NPCType("ProfanedGuardianBoss") && npc.type != mod.NPCType("ProfanedGuardianBoss2") && - npc.type != mod.NPCType("ProfanedGuardianBoss3")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 7: - if (npc.type != NPCID.EaterofWorldsHead && npc.type != NPCID.EaterofWorldsBody && npc.type != NPCID.EaterofWorldsTail && - npc.type != NPCID.VileSpit) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 8: - if (npc.type != mod.NPCType("Astrageldon") && npc.type != mod.NPCType("AstralSlime")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 9: - if (npc.type != NPCID.TheDestroyer && npc.type != NPCID.TheDestroyerBody && npc.type != NPCID.TheDestroyerTail && - npc.type != NPCID.Probe) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 10: - if (npc.type != NPCID.Spazmatism && npc.type != NPCID.Retinazer) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 11: - if (npc.type != mod.NPCType("Bumblefuck") && npc.type != mod.NPCType("Bumblefuck2") && - npc.type != NPCID.Spazmatism && npc.type != NPCID.Retinazer) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 12: - if (npc.type != NPCID.WallofFlesh && npc.type != NPCID.WallofFleshEye && npc.type != NPCID.TheHungry && - npc.type != NPCID.TheHungryII && npc.type != NPCID.LeechHead && npc.type != NPCID.LeechBody && - npc.type != NPCID.LeechTail) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 13: - if (npc.type != mod.NPCType("HiveMind") && npc.type != mod.NPCType("HiveMindP2") && - npc.type != mod.NPCType("DarkHeart") && npc.type != mod.NPCType("HiveBlob") && - npc.type != mod.NPCType("DankCreeper") && npc.type != mod.NPCType("HiveBlob2")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 14: - if (npc.type != NPCID.SkeletronHead && npc.type != NPCID.SkeletronHand) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 15: - if (npc.type != mod.NPCType("StormWeaverHead") && npc.type != mod.NPCType("StormWeaverBody") && - npc.type != mod.NPCType("StormWeaverTail") && npc.type != mod.NPCType("StormWeaverHeadNaked") && - npc.type != mod.NPCType("StormWeaverBodyNaked") && npc.type != mod.NPCType("StormWeaverTailNaked") && - npc.type != mod.NPCType("StasisProbe") && npc.type != mod.NPCType("StasisProbeNaked")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 16: - if (npc.type != mod.NPCType("AquaticScourgeHead") && npc.type != mod.NPCType("AquaticScourgeBody") && - npc.type != mod.NPCType("AquaticScourgeBodyAlt") && npc.type != mod.NPCType("AquaticScourgeTail") && - npc.type != mod.NPCType("AquaticParasite") && npc.type != mod.NPCType("AquaticUrchin") && - npc.type != mod.NPCType("AquaticSeekerHead") && npc.type != mod.NPCType("AquaticSeekerBody") && - npc.type != mod.NPCType("AquaticSeekerTail")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 17: - if (npc.type != mod.NPCType("DesertScourgeHead") && npc.type != mod.NPCType("DesertScourgeBody") && - npc.type != mod.NPCType("DesertScourgeTail") && npc.type != mod.NPCType("DesertScourgeHeadSmall") && - npc.type != mod.NPCType("DesertScourgeBodySmall") && npc.type != mod.NPCType("DesertScourgeTailSmall") && - npc.type != mod.NPCType("DriedSeekerHead") && npc.type != mod.NPCType("DriedSeekerBody") && - npc.type != mod.NPCType("DriedSeekerTail")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 18: - if (npc.type != NPCID.CultistBoss && npc.type != NPCID.CultistBossClone && npc.type != NPCID.CultistDragonHead && - npc.type != NPCID.CultistDragonBody1 && npc.type != NPCID.CultistDragonBody2 && npc.type != NPCID.CultistDragonBody3 && - npc.type != NPCID.CultistDragonBody4 && npc.type != NPCID.CultistDragonTail && npc.type != NPCID.AncientCultistSquidhead && - npc.type != NPCID.AncientLight && npc.type != NPCID.AncientDoom && npc.type != mod.NPCType("Eidolist")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 19: - if (npc.type != mod.NPCType("CrabulonIdle") && npc.type != mod.NPCType("CrabShroom")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 20: - if (npc.type != NPCID.Plantera && npc.type != NPCID.PlanterasTentacle && npc.type != NPCID.PlanterasHook && - npc.type != NPCID.Spore) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 21: - if (npc.type != mod.NPCType("CeaselessVoid") && npc.type != mod.NPCType("DarkEnergy") && - npc.type != mod.NPCType("DarkEnergy2") && npc.type != mod.NPCType("DarkEnergy3")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 22: - if (npc.type != mod.NPCType("PerforatorHive") && npc.type != mod.NPCType("PerforatorHeadLarge") && - npc.type != mod.NPCType("PerforatorBodyLarge") && npc.type != mod.NPCType("PerforatorTailLarge") && - npc.type != mod.NPCType("PerforatorHeadMedium") && npc.type != mod.NPCType("PerforatorBodyMedium") && - npc.type != mod.NPCType("PerforatorTailMedium") && npc.type != mod.NPCType("PerforatorHeadSmall") && - npc.type != mod.NPCType("PerforatorBodySmall") && npc.type != mod.NPCType("PerforatorTailSmall")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 23: - if (npc.type != mod.NPCType("Cryogen") && npc.type != mod.NPCType("CryogenIce") && - npc.type != mod.NPCType("IceMass") && npc.type != mod.NPCType("Cryocore") && - npc.type != mod.NPCType("Cryocore2")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 24: - if (npc.type != mod.NPCType("BrimstoneElemental") && npc.type != mod.NPCType("Brimling")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 25: - if (npc.type != mod.NPCType("CosmicWraith") && npc.type != mod.NPCType("SignusBomb") && - npc.type != mod.NPCType("CosmicLantern")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 26: - if (npc.type != mod.NPCType("ScavengerBody") && npc.type != mod.NPCType("ScavengerHead") && - npc.type != mod.NPCType("ScavengerClawLeft") && npc.type != mod.NPCType("ScavengerClawRight") && - npc.type != mod.NPCType("ScavengerLegLeft") && npc.type != mod.NPCType("ScavengerLegRight") && - npc.type != mod.NPCType("ScavengerHead2") && npc.type != mod.NPCType("RockPillar") && - npc.type != mod.NPCType("FlamePillar")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 27: - if (npc.type != NPCID.DukeFishron && npc.type != NPCID.DetonatingBubble && npc.type != NPCID.Sharkron && - npc.type != NPCID.Sharkron2) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 28: - if (npc.type != NPCID.MoonLordCore && npc.type != NPCID.MoonLordHead && npc.type != NPCID.MoonLordHand && - npc.type != NPCID.MoonLordFreeEye && npc.type != mod.NPCType("Eidolist")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 29: - if (npc.type != mod.NPCType("AstrumDeusHead") && npc.type != mod.NPCType("AstrumDeusBody") && - npc.type != mod.NPCType("AstrumDeusTail") && npc.type != mod.NPCType("AstrumDeusHeadSpectral") && - npc.type != mod.NPCType("AstrumDeusBodySpectral") && npc.type != mod.NPCType("AstrumDeusTailSpectral") && - npc.type != mod.NPCType("AstrumDeusProbe") && npc.type != mod.NPCType("AstrumDeusProbe2") && - npc.type != mod.NPCType("AstrumDeusProbe3")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 30: - if (npc.type != mod.NPCType("Polterghast") && npc.type != mod.NPCType("PhantomFuckYou") && - npc.type != mod.NPCType("PolterghastHook") && npc.type != mod.NPCType("PolterPhantom")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 31: - if (npc.type != mod.NPCType("PlaguebringerGoliath") && npc.type != mod.NPCType("PlagueBeeG") && - npc.type != mod.NPCType("PlagueBeeLargeG") && npc.type != mod.NPCType("PlagueHomingMissile") && - npc.type != mod.NPCType("PlagueMine") && npc.type != mod.NPCType("PlaguebringerShade")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 32: - if (npc.type != mod.NPCType("Calamitas") && npc.type != mod.NPCType("CalamitasRun") && - npc.type != mod.NPCType("CalamitasRun2") && npc.type != mod.NPCType("CalamitasRun3") && - npc.type != mod.NPCType("LifeSeeker") && npc.type != mod.NPCType("SoulSeeker")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 33: - if (npc.type != mod.NPCType("Siren") && npc.type != mod.NPCType("Leviathan") && - npc.type != mod.NPCType("AquaticAberration") && npc.type != mod.NPCType("Parasea") && - npc.type != mod.NPCType("SirenClone") && npc.type != mod.NPCType("SirenIce")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 34: - if (npc.type != mod.NPCType("SlimeGod") && npc.type != mod.NPCType("SlimeGodRun") && - npc.type != mod.NPCType("SlimeGodCore") && npc.type != mod.NPCType("SlimeGodSplit") && - npc.type != mod.NPCType("SlimeGodRunSplit") && npc.type != mod.NPCType("SlimeSpawnCorrupt") && - npc.type != mod.NPCType("SlimeSpawnCorrupt2") && npc.type != mod.NPCType("SlimeSpawnCrimson") && - npc.type != mod.NPCType("SlimeSpawnCrimson2")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 35: - if (npc.type != mod.NPCType("Providence") && npc.type != mod.NPCType("ProvSpawnDefense") && - npc.type != mod.NPCType("ProvSpawnOffense") && npc.type != mod.NPCType("ProvSpawnHealer")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 36: - if (npc.type != mod.NPCType("SupremeCalamitas") && npc.type != mod.NPCType("SCalWormBody") && - npc.type != mod.NPCType("SCalWormBodyWeak") && npc.type != mod.NPCType("SCalWormHead") && - npc.type != mod.NPCType("SCalWormTail") && npc.type != mod.NPCType("SoulSeekerSupreme") && - npc.type != mod.NPCType("SCalWormHeart") && npc.type != mod.NPCType("SupremeCataclysm") && - npc.type != mod.NPCType("SupremeCatastrophe")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 37: - if (npc.type != mod.NPCType("Yharon") && npc.type != mod.NPCType("DetonatingFlare") && - npc.type != mod.NPCType("DetonatingFlare2") && npc.type != mod.NPCType("DetonatingFlare3") && - npc.type != mod.NPCType("Bumblefuck3") && npc.type != mod.NPCType("Bumblefuck4")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - case 38: - if (npc.type != mod.NPCType("DevourerofGodsHeadS") && npc.type != mod.NPCType("DevourerofGodsBodyS") && - npc.type != mod.NPCType("DevourerofGodsTailS")) - { - npc.active = false; - npc.netUpdate = true; - } - break; - } - #region KSRush - if (npc.type == NPCID.KingSlime) - { - float num234 = 1f; - bool flag8 = false; - bool flag9 = false; - npc.aiAction = 0; - if (npc.ai[3] == 0f && npc.life > 0) - { - npc.ai[3] = (float)npc.lifeMax; - } - if (npc.localAI[3] == 0f && Main.netMode != 1) - { - npc.ai[0] = -100f; - npc.localAI[3] = 1f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead) - { - npc.timeLeft = 0; - if (Main.player[npc.target].Center.X < npc.Center.X) - { - npc.direction = 1; - } - else - { - npc.direction = -1; - } - } - } - if (!Main.player[npc.target].dead && npc.ai[2] >= 300f && npc.ai[1] < 5f && npc.velocity.Y == 0f) - { - npc.ai[2] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 5f; - if (Main.netMode != 1) - { - npc.TargetClosest(false); - Point point3 = npc.Center.ToTileCoordinates(); - Point point4 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector30 = Main.player[npc.target].Center - npc.Center; - int num235 = 10; - int num236 = 0; - int num237 = 7; - int num238 = 0; - bool flag10 = false; - if (vector30.Length() > ((enraged || Config.BossRushXerocCurse) ? 1000f : 2000f)) - { - flag10 = true; - num238 = 100; - } - while (!flag10 && num238 < 100) - { - num238++; - int num239 = Main.rand.Next(point4.X - num235, point4.X + num235 + 1); - int num240 = Main.rand.Next(point4.Y - num235, point4.Y + 1); - if ((num240 < point4.Y - num237 || num240 > point4.Y + num237 || num239 < point4.X - num237 || num239 > point4.X + num237) && (num240 < point3.Y - num236 || num240 > point3.Y + num236 || num239 < point3.X - num236 || num239 > point3.X + num236) && !Main.tile[num239, num240].nactive()) - { - int num241 = num240; - int num242 = 0; - bool flag11 = Main.tile[num239, num241].nactive() && Main.tileSolid[(int)Main.tile[num239, num241].type] && !Main.tileSolidTop[(int)Main.tile[num239, num241].type]; - if (flag11) - { - num242 = 1; - } - else - { - while (num242 < 150 && num241 + num242 < Main.maxTilesY) - { - int num243 = num241 + num242; - bool flag12 = Main.tile[num239, num243].nactive() && Main.tileSolid[(int)Main.tile[num239, num243].type] && !Main.tileSolidTop[(int)Main.tile[num239, num243].type]; - if (flag12) - { - num242--; - break; - } - int num = num242; - num242 = num + 1; - } - } - num240 += num242; - bool flag13 = true; - if (flag13 && Main.tile[num239, num240].lava()) - { - flag13 = false; - } - if (flag13 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) - { - flag13 = false; - } - if (flag13) - { - npc.localAI[1] = (float)(num239 * 16 + 8); - npc.localAI[2] = (float)(num240 * 16 + 16); - break; - } - } - } - if (num238 >= 100) - { - Vector2 bottom = Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.localAI[1] = bottom.X; - npc.localAI[2] = bottom.Y; - } - } - } - if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) - { - float[] var_9_AE8B_cp_0 = npc.ai; - int var_9_AE8B_cp_1 = 2; - float num244 = var_9_AE8B_cp_0[var_9_AE8B_cp_1]; - var_9_AE8B_cp_0[var_9_AE8B_cp_1] = num244 + 1f; - } - if (Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) - { - float[] var_9_AEDF_cp_0 = npc.ai; - int var_9_AEDF_cp_1 = 2; - float num244 = var_9_AEDF_cp_0[var_9_AEDF_cp_1]; - var_9_AEDF_cp_0[var_9_AEDF_cp_1] = num244 + 1f; - } - Dust dust; - if (npc.ai[1] == 5f) - { - flag8 = true; - npc.aiAction = 1; - 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 || 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) - { - flag9 = true; - } - if (npc.ai[0] == 60f) - { - Gore.NewGore(npc.Center + new Vector2(-40f, (float)(-(float)npc.height / 2)), npc.velocity, 734, 1f); - } - if (npc.ai[0] >= 60f && Main.netMode != 1) - { - npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); - npc.ai[1] = 6f; - npc.ai[0] = 0f; - npc.netUpdate = true; - } - if (Main.netMode == 1 && npc.ai[0] >= 120f) - { - npc.ai[1] = 6f; - npc.ai[0] = 0f; - } - if (!flag9) - { - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) - { - int num246 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[num246].noGravity = true; - dust = Main.dust[num246]; - dust.velocity *= 0.5f; - num = num245; - } - } - } - else if (npc.ai[1] == 6f) - { - flag8 = true; - npc.aiAction = 0; - 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 || 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) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - npc.netUpdate = true; - npc.TargetClosest(true); - } - if (Main.netMode == 1 && npc.ai[0] >= 60f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - npc.TargetClosest(true); - } - int num; - for (int num247 = 0; num247 < 10; num247 = num + 1) - { - int num248 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[num248].noGravity = true; - dust = Main.dust[num248]; - dust.velocity *= 2f; - num = num247; - } - } - npc.dontTakeDamage = (npc.hide = flag9); - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.8f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if (!flag8) - { - npc.ai[0] += (enraged || Config.BossRushXerocCurse) ? 4f : 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.8) - { - npc.ai[0] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.6) - { - npc.ai[0] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.4) - { - npc.ai[0] += 2f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.2) - { - npc.ai[0] += 3f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - npc.ai[0] += 4f; - } - if (npc.ai[0] >= 0f) - { - npc.netUpdate = true; - npc.TargetClosest(true); - if (npc.ai[1] == 3f) - { - npc.velocity.Y = -26f; - npc.velocity.X = npc.velocity.X + 7f * (float)npc.direction; - npc.ai[0] = -200f; - npc.ai[1] = 0f; - } - else if (npc.ai[1] == 2f) - { - npc.velocity.Y = -12f; - npc.velocity.X = npc.velocity.X + 9f * (float)npc.direction; - npc.ai[0] = -120f; - npc.ai[1] += 1f; - } - else - { - npc.velocity.Y = -16f; - npc.velocity.X = npc.velocity.X + 8f * (float)npc.direction; - npc.ai[0] = -120f; - npc.ai[1] += 1f; - } - } - else if (npc.ai[0] >= -30f) - { - npc.aiAction = 1; - } - } - } - else if (npc.target < 255 && ((npc.direction == 1 && npc.velocity.X < 3f) || (npc.direction == -1 && npc.velocity.X > -3f))) - { - if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) - { - npc.velocity.X = npc.velocity.X + 0.2f * (float)npc.direction; - } - else - { - npc.velocity.X = npc.velocity.X * 0.93f; - } - } - int num249 = Dust.NewDust(npc.position, npc.width, npc.height, 4, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); - Main.dust[num249].noGravity = true; - dust = Main.dust[num249]; - dust.velocity *= 0.5f; - if (npc.life > 0) - { - float num250 = (float)npc.life / (float)npc.lifeMax; - num250 = num250 * 0.5f + 0.75f; - num250 *= num234; - if (num250 != npc.scale) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num250; - npc.width = (int)(98f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; - } - if (Main.netMode != 1) - { - int num251 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num251) < npc.ai[3]) - { - npc.ai[3] = (float)npc.life; - int num252 = Main.rand.Next(1, 4); - int num; - for (int num253 = 0; num253 < num252; num253 = num + 1) - { - 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 num254 = 1; - if (Main.rand.Next(4) == 0) - { - num254 = 535; - } - int num255 = NPC.NewNPC(x, y, num254, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num255].SetDefaults(num254, -1f); - Main.npc[num255].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num255].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num255].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num255].ai[1] = 0f; - if (Main.netMode == 2 && num255 < 200) - { - NetMessage.SendData(23, -1, -1, null, num255, 0f, 0f, 0f, 0, 0, 0); - } - num = num253; - } - return false; - } - } - } - return false; - } - #endregion - #region BoCRush - else if (npc.type == NPCID.BrainofCthulhu) - { - NPC.crimsonBoss = npc.whoAmI; - npc.dontTakeDamage = false; - if (Main.netMode != 1 && npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - int num; - for (int num789 = 0; num789 < 20; num789 = num + 1) - { - float num790 = npc.Center.X; - float num791 = npc.Center.Y; - num790 += (float)Main.rand.Next(-npc.width, npc.width); - num791 += (float)Main.rand.Next(-npc.height, npc.height); - int num792 = NPC.NewNPC((int)num790, (int)num791, 267, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num792].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f); - Main.npc[num792].netUpdate = true; - num = num789; - } - } - if (npc.ai[0] < 0f) - { - if (npc.localAI[2] == 0f) - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - npc.localAI[2] = 1f; - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 392, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 393, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 394, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 395, 1f); - int num; - for (int num794 = 0; num794 < 20; num794 = num + 1) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f); - num = num794; - } - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - } - newAI[0] += 1f; - if (newAI[0] >= 60f) - { - newAI[0] = 0f; - if (Main.netMode != 1 && NPC.CountNPCS(NPCID.Creeper) < 15) - { - int creeper = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), 267, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[creeper].netUpdate = true; - } - npc.netUpdate = true; - } - npc.knockBackResist = 0f; - npc.TargetClosest(true); - Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); - 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 || Config.BossRushXerocCurse) ? 21f : 14f); - num797 = num798 / num797; - num795 *= num797; - num796 *= num797; - npc.velocity.X = (npc.velocity.X * 50f + num795) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; - if (npc.ai[0] == -1f) - { - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (npc.justHit) - { - npc.localAI[1] -= (float)Main.rand.Next(5); - } - int num799 = 60 + Main.rand.Next(120); - if (Main.netMode != 0) - { - num799 += Main.rand.Next(30, 90); - } - if (npc.localAI[1] >= (float)num799) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int num800 = 0; - int num801; - int num802; - while (true) - { - num800++; - num801 = (int)Main.player[npc.target].Center.X / 16; - num802 = (int)Main.player[npc.target].Center.Y / 16; - if (Main.rand.Next(2) == 0) - { - num801 += Main.rand.Next(7, 13); - } - else - { - num801 -= Main.rand.Next(7, 13); - } - if (Main.rand.Next(2) == 0) - { - num802 += Main.rand.Next(7, 13); - } - else - { - num802 -= Main.rand.Next(7, 13); - } - if (!WorldGen.SolidTile(num801, num802)) - { - break; - } - if (num800 > 100) - { - goto Block_2784; - } - } - npc.ai[3] = 0f; - npc.ai[0] = -2f; - npc.ai[1] = (float)num801; - npc.ai[2] = (float)num802; - npc.netUpdate = true; - npc.netSpam = 0; - Block_2784:; - } - } - } - else if (npc.ai[0] == -2f) - { - npc.velocity *= 0.9f; - if (Main.netMode != 0) - { - npc.ai[3] += 15f; - } - else - { - npc.ai[3] += 25f; - } - if (npc.ai[3] >= 255f) - { - npc.ai[3] = 255f; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - Main.PlaySound(SoundID.Item8, npc.Center); - npc.ai[0] = -3f; - npc.netUpdate = true; - npc.netSpam = 0; - } - npc.alpha = (int)npc.ai[3]; - } - else if (npc.ai[0] == -3f) - { - if (Main.netMode != 0) - { - npc.ai[3] -= 15f; - } - else - { - npc.ai[3] -= 25f; - } - if (npc.ai[3] <= 0f) - { - npc.ai[3] = 0f; - npc.ai[0] = -1f; - npc.netUpdate = true; - npc.netSpam = 0; - } - npc.alpha = (int)npc.ai[3]; - } - } - else - { - npc.TargetClosest(true); - Vector2 vector99 = new Vector2(npc.Center.X, npc.Center.Y); - 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 || Config.BossRushXerocCurse) ? 3f : 2f); - if (num805 < num806) - { - npc.velocity.X = num803; - npc.velocity.Y = num804; - } - else - { - num805 = num806 / num805; - npc.velocity.X = num803 * num805; - npc.velocity.Y = num804 * num805; - } - if (npc.ai[0] == 0f) - { - if (Main.netMode != 1) - { - int num807 = 0; - int num; - for (int num808 = 0; num808 < 200; num808 = num + 1) - { - if (Main.npc[num808].active && Main.npc[num808].type == 267) - { - num807++; - } - num = num808; - } - if (num807 == 0) - { - npc.ai[0] = -1f; - npc.localAI[1] = 0f; - npc.alpha = 0; - npc.netUpdate = true; - } - npc.localAI[1] += 1f; - if (npc.localAI[1] >= (float)(120 + Main.rand.Next(120))) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int num809 = 0; - int num810; - int num811; - while (true) - { - num809++; - num810 = (int)Main.player[npc.target].Center.X / 16; - num811 = (int)Main.player[npc.target].Center.Y / 16; - num810 += Main.rand.Next(-50, 51); - num811 += Main.rand.Next(-50, 51); - if (!WorldGen.SolidTile(num810, num811) && Collision.CanHit(new Vector2((float)(num810 * 16), (float)(num811 * 16)), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - break; - } - if (num809 > 100) - { - goto Block_2801; - } - } - npc.ai[0] = 1f; - npc.ai[1] = (float)num810; - npc.ai[2] = (float)num811; - npc.netUpdate = true; - Block_2801:; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.alpha += 5; - if (npc.alpha >= 255) - { - Main.PlaySound(SoundID.Item8, npc.Center); - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= 5; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[0] = 0f; - } - } - } - if (Main.player[npc.target].dead) - { - if (npc.localAI[3] < 120f) - { - float[] var_9_29972_cp_0 = npc.localAI; - int var_9_29972_cp_1 = 3; - float num244 = var_9_29972_cp_0[var_9_29972_cp_1]; - var_9_29972_cp_0[var_9_29972_cp_1] = num244 + 1f; - } - if (npc.localAI[3] > 60f) - { - npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.25f; - } - npc.ai[0] = 2f; - npc.alpha = 10; - return false; - } - if (npc.localAI[3] > 0f) - { - float[] var_9_299F7_cp_0 = npc.localAI; - int var_9_299F7_cp_1 = 3; - float num244 = var_9_299F7_cp_0[var_9_299F7_cp_1]; - var_9_299F7_cp_0[var_9_299F7_cp_1] = num244 - 1f; - return false; - } - return false; - } - #endregion - #region EoWRush - else if (npc.type == NPCID.EaterofWorldsHead) - { - Main.player[npc.target].ZoneCorrupt = true; - npc.reflectingProjectiles = true; - if (!Main.player[npc.target].dead) - { - newAI[0] += ((enraged || Config.BossRushXerocCurse) ? 6f : 3f); - } - if (newAI[0] >= 180f) - { - 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)) - { - Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; - if (Main.netMode != 1) - { - float num418 = ((enraged || Config.BossRushXerocCurse) ? 18f : 12f); - int num419 = 12; - int num420 = 96; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num351 = num418 / num351; - num349 *= num351; - num350 *= num351; - num349 += (float)Main.rand.Next(-40, 41) * 0.05f; - num350 += (float)Main.rand.Next(-40, 41) * 0.05f; - vector34.X += num349 * 4f; - vector34.Y += num350 * 4f; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - #endregion - #region QBRush - else if (npc.type == NPCID.QueenBee) - { - int num592 = 0; - int variable; - for (int num593 = 0; num593 < 255; num593 = variable + 1) - { - if (Main.player[num593].active && !Main.player[num593].dead && (npc.Center - Main.player[num593].Center).Length() < 1000f) - { - num592++; - } - variable = num593; - } - int num594 = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense + num594; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - } - bool dead4 = Main.player[npc.target].dead; - if (dead4) - { - if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) - { - npc.velocity.Y = npc.velocity.Y + 0.04f; - } - if (npc.position.X < (float)(Main.maxTilesX * 8)) - { - npc.velocity.X = npc.velocity.X - 0.04f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.04f; - } - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - return false; - } - } - else if (npc.ai[0] == -1f) - { - if (Main.netMode != 1) - { - float num595 = npc.ai[1]; - int num596; - do - { - num596 = Main.rand.Next(3); - if (num596 == 1) - { - num596 = 2; - } - else if (num596 == 2) - { - num596 = 3; - } - } - while ((float)num596 == num595); - npc.ai[0] = (float)num596; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - return false; - } - } - else if (npc.ai[0] == 0f) - { - int num597 = 5; - if (npc.ai[1] > (float)(2 * num597) && npc.ai[1] % 2f == 0f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } - if (npc.ai[1] % 2f == 0f) - { - npc.TargetClosest(true); - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) - { - npc.localAI[0] = 1f; - npc.ai[1] += 1f; - npc.ai[2] = 0f; - float num598 = 24f; - Vector2 vector74 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num599 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector74.X; - float num600 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector74.Y; - float num601 = (float)Math.Sqrt((double)(num599 * num599 + num600 * num600)); - num601 = num598 / num601; - npc.velocity.X = num599 * num601; - npc.velocity.Y = num600 * num601; - npc.spriteDirection = npc.direction; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - return false; - } - npc.localAI[0] = 0f; - float num602 = 18f; - float num603 = 0.4f; - if (npc.position.Y + (float)(npc.height / 2) < Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2)) - { - npc.velocity.Y = npc.velocity.Y + num603; - } - else - { - npc.velocity.Y = npc.velocity.Y - num603; - } - if (npc.velocity.Y < -12f) - { - npc.velocity.Y = -num602; - } - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = num602; - } - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - { - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; - } - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - { - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; - } - else - { - npc.velocity.X = npc.velocity.X * 0.8f; - } - if (npc.velocity.X < -16f) - { - npc.velocity.X = -16f; - } - if (npc.velocity.X > 16f) - { - npc.velocity.X = 16f; - } - npc.spriteDirection = npc.direction; - return false; - } - else - { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - 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)) - { - num605 = -1; - } - if (npc.direction == num605 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num604) - { - npc.ai[2] = 1f; - } - if (npc.ai[2] != 1f) - { - npc.localAI[0] = 1f; - return false; - } - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.localAI[0] = 0f; - npc.velocity *= 0.9f; - float num606 = 0.25f; - if (npc.life < npc.lifeMax / 2) - { - npc.velocity *= 0.9f; - } - if (npc.life < npc.lifeMax / 3) - { - npc.velocity *= 0.9f; - } - if (npc.life < npc.lifeMax / 5) - { - npc.velocity *= 0.9f; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num606) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - return false; - } - } - } - else if (npc.ai[0] == 2f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - float num607 = 12f; - float num608 = 0.1f; - Vector2 vector75 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num609 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector75.X; - float num610 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector75.Y; - float num611 = (float)Math.Sqrt((double)(num609 * num609 + num610 * num610)); - if (num611 < 200f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return false; - } - num611 = num607 / num611; - if (npc.velocity.X < num609) - { - npc.velocity.X = npc.velocity.X + num608; - if (npc.velocity.X < 0f && num609 > 0f) - { - npc.velocity.X = npc.velocity.X + num608; - } - } - else if (npc.velocity.X > num609) - { - npc.velocity.X = npc.velocity.X - num608; - if (npc.velocity.X > 0f && num609 < 0f) - { - npc.velocity.X = npc.velocity.X - num608; - } - } - if (npc.velocity.Y < num610) - { - npc.velocity.Y = npc.velocity.Y + num608; - if (npc.velocity.Y < 0f && num610 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num608; - return false; - } - } - else if (npc.velocity.Y > num610) - { - npc.velocity.Y = npc.velocity.Y - num608; - if (npc.velocity.Y > 0f && num610 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num608; - return false; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - Vector2 vector76 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector77 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num612 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector77.X; - float num613 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector77.Y; - float num614 = (float)Math.Sqrt((double)(num612 * num612 + num613 * num613)); - npc.ai[1] += 1f; - npc.ai[1] += (float)(num592 / 2); - bool flag38 = false; - if (npc.ai[1] > 10f) - { - npc.ai[1] = 0f; - float[] var_9_2174E_cp_0 = npc.ai; - int var_9_2174E_cp_1 = 2; - float num244 = var_9_2174E_cp_0[var_9_2174E_cp_1]; - var_9_2174E_cp_0[var_9_2174E_cp_1] = num244 + 1f; - flag38 = true; - } - if (Collision.CanHit(vector76, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag38) - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - if (Main.netMode != 1) - { - int num615 = Main.rand.Next(210, 212); - int num616 = NPC.NewNPC((int)vector76.X, (int)vector76.Y, num615, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num616].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f; - Main.npc[num616].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f; - Main.npc[num616].localAI[0] = 60f; - Main.npc[num616].netUpdate = true; - } - } - if (num614 > 400f || !Collision.CanHit(new Vector2(vector76.X, vector76.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num617 = 14f; - float num618 = 0.1f; - vector77 = vector76; - num612 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector77.X; - num613 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector77.Y; - num614 = (float)Math.Sqrt((double)(num612 * num612 + num613 * num613)); - num614 = num617 / num614; - if (npc.velocity.X < num612) - { - npc.velocity.X = npc.velocity.X + num618; - if (npc.velocity.X < 0f && num612 > 0f) - { - npc.velocity.X = npc.velocity.X + num618; - } - } - else if (npc.velocity.X > num612) - { - npc.velocity.X = npc.velocity.X - num618; - if (npc.velocity.X > 0f && num612 < 0f) - { - npc.velocity.X = npc.velocity.X - num618; - } - } - if (npc.velocity.Y < num613) - { - npc.velocity.Y = npc.velocity.Y + num618; - if (npc.velocity.Y < 0f && num613 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num618; - } - } - else if (npc.velocity.Y > num613) - { - npc.velocity.Y = npc.velocity.Y - num618; - if (npc.velocity.Y > 0f && num613 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num618; - } - } - } - else - { - npc.velocity *= 0.9f; - } - npc.spriteDirection = npc.direction; - if (npc.ai[2] > 5f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 3f) - { - float num619 = 6f; - float num620 = 0.075f; - Vector2 vector78 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector79 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num621 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector79.X; - float num622 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector79.Y; - float num623 = (float)Math.Sqrt((double)(num621 * num621 + num622 * num622)); - npc.ai[1] += 1f; - bool flag39 = false; - if (npc.ai[1] % 15f == 14f) - { - flag39 = true; - } - if (flag39 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector78, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Main.PlaySound(SoundID.Item17, npc.position); - if (Main.netMode != 1) - { - 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)); - num627 = num624 / num627; - num625 *= num627; - num626 *= num627; - int num628 = 11; - int num629 = 55; - int num630 = Projectile.NewProjectile(vector78.X, vector78.Y, num625, num626, num629, num628, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num630].timeLeft = 300; - } - } - if (!Collision.CanHit(new Vector2(vector78.X, vector78.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - num619 = 14f; - num620 = 0.1f; - vector79 = vector78; - num621 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector79.X; - num622 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector79.Y; - num623 = (float)Math.Sqrt((double)(num621 * num621 + num622 * num622)); - num623 = num619 / num623; - if (npc.velocity.X < num621) - { - npc.velocity.X = npc.velocity.X + num620; - if (npc.velocity.X < 0f && num621 > 0f) - { - npc.velocity.X = npc.velocity.X + num620; - } - } - else if (npc.velocity.X > num621) - { - npc.velocity.X = npc.velocity.X - num620; - if (npc.velocity.X > 0f && num621 < 0f) - { - npc.velocity.X = npc.velocity.X - num620; - } - } - if (npc.velocity.Y < num622) - { - npc.velocity.Y = npc.velocity.Y + num620; - if (npc.velocity.Y < 0f && num622 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num620; - } - } - else if (npc.velocity.Y > num622) - { - npc.velocity.Y = npc.velocity.Y - num620; - if (npc.velocity.Y > 0f && num622 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num620; - } - } - } - else if (num623 > 100f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - num623 = num619 / num623; - if (npc.velocity.X < num621) - { - npc.velocity.X = npc.velocity.X + num620; - if (npc.velocity.X < 0f && num621 > 0f) - { - npc.velocity.X = npc.velocity.X + num620 * 2f; - } - } - else if (npc.velocity.X > num621) - { - npc.velocity.X = npc.velocity.X - num620; - if (npc.velocity.X > 0f && num621 < 0f) - { - npc.velocity.X = npc.velocity.X - num620 * 2f; - } - } - if (npc.velocity.Y < num622) - { - npc.velocity.Y = npc.velocity.Y + num620; - if (npc.velocity.Y < 0f && num622 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num620 * 2f; - } - } - else if (npc.velocity.Y > num622) - { - npc.velocity.Y = npc.velocity.Y - num620; - if (npc.velocity.Y > 0f && num622 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num620 * 2f; - } - } - } - if (npc.ai[1] > 400f) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - return false; - } - } - return false; - } - #endregion - #region DFRush - else if (npc.type == NPCID.DukeFishron) - { - if (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) - { - npc.dontTakeDamage = true; - } - else if (npc.ai[0] <= 8f) - { - npc.dontTakeDamage = false; - } - float newDamage = (0.6f * Main.damageMultiplier); - bool flag = (double)npc.life <= (double)npc.lifeMax * 0.99; - bool flag2 = (double)npc.life <= (double)npc.lifeMax * 0.15; - bool flag3 = npc.ai[0] > 4f; - bool flag4 = npc.ai[0] > 9f; - bool flag5 = npc.ai[3] < 10f; - Vector2 vector = npc.Center; - if (flag4) - { - newAI[0] += 1f; - if (newAI[0] >= 480f) - { - newAI[0] = 0f; - if (Main.netMode != 1) - { - Projectile.NewProjectile(vector.X, vector.Y, 0f, 0f, 385, 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - npc.netUpdate = true; - } - npc.damage = (int)((float)npc.defDamage * 1.5f * newDamage); - npc.defense = 38; - } - else if (flag3) - { - npc.damage = (int)((float)npc.defDamage * 2.2f * newDamage); - npc.defense = (int)((float)npc.defDefense * 0.8f); - } - else - { - npc.damage = npc.defDamage; - npc.defense = npc.defDefense; - } - int num2 = 35; - float num3 = 0.65f; - float scaleFactor = 9.5f; - if (flag4) - { - 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 || Config.BossRushXerocCurse) ? 0.8f : 0.7f); - scaleFactor = ((enraged || Config.BossRushXerocCurse) ? 13f : 11f); - num2 = ((enraged || Config.BossRushXerocCurse) ? 30 : 35); - } - else if (flag5 && !flag3 && !flag4) - { - num2 = 25; - } - int num4 = 24; - float num5 = 18f; - if (flag4) - { - num4 = ((enraged || Config.BossRushXerocCurse) ? 18 : 20); - num5 = ((enraged || Config.BossRushXerocCurse) ? 30f : 28f); - } - else if (flag5 & flag3) - { - num4 = ((enraged || Config.BossRushXerocCurse) ? 21 : 23); - num5 = ((enraged || Config.BossRushXerocCurse) ? 25f : 22f); - } - int num6 = 80; - int num7 = 4; - float num8 = 0.3f; - float scaleFactor2 = 5f; - int num9 = 90; - int num10 = 180; - int num11 = 180; - int num12 = 30; - int num13 = 120; - int num14 = 4; - float scaleFactor3 = 6f; - float scaleFactor4 = 20f; - float num15 = 6.28318548f / (float)(num13 / 2); - int num16 = 75; - 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; - } - if (npc.ai[0] > 4f) - { - npc.ai[0] = 5f; - } - else - { - npc.ai[0] = 0f; - } - npc.ai[2] = 0f; - } - if (player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400))) - { - num2 = 20; - num5 += 6f; - } - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != 1) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - 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; - } - if (npc.ai[0] == -1f) - { - num17 = 0f; - } - if (npc.ai[0] == 3f) - { - num17 = 0f; - } - if (npc.ai[0] == 4f) - { - num17 = 0f; - } - if (npc.ai[0] == 8f) - { - num17 = 0f; - } - float num18 = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f) - { - num18 = 0f; - } - if (npc.ai[0] == 7f) - { - num18 = 0f; - } - if (npc.ai[0] == 3f) - { - num18 = 0.01f; - } - if (npc.ai[0] == 4f) - { - num18 = 0.01f; - } - if (npc.ai[0] == 8f) - { - num18 = 0.01f; - } - 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] != -1f && npc.ai[0] < 9f) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.alpha += 15; - } - else - { - npc.alpha -= 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - if (npc.ai[0] == -1f) - { - npc.velocity *= 0.98f; - int num19 = Math.Sign(player.Center.X - vector.X); - if (num19 != 0) - { - npc.direction = num19; - npc.spriteDirection = -npc.direction; - } - if (npc.ai[2] > 20f) - { - npc.velocity.Y = -2f; - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.alpha += 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - if (npc.ai[2] == (float)(num9 - 30)) - { - int num20 = 36; - for (int i = 0; i < num20; i++) - { - Vector2 expr_80F = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + npc.Center; - Vector2 vector2 = expr_80F - npc.Center; - int num21 = Dust.NewDust(expr_80F + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num21].noGravity = true; - Main.dust[num21].noLight = true; - Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; - } - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num16) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } - } - else 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) - { - int num23 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - num23 = 1; - break; - case 10: - npc.ai[3] = 1f; - num23 = 2; - break; - case 11: - npc.ai[3] = 0f; - num23 = 3; - break; - } - if (flag) - { - num23 = 4; - } - if (num23 == 1) - { - 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; - } - } - else if (num23 == 2) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (num23 == 3) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (num23 == 4) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 1f) - { - int num24 = 7; - for (int j = 0; j < num24; j++) - { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default(Vector2)) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num4) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 2f) - { - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - } - Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor2; - if (npc.velocity.X < vector5.X) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X < 0f && vector5.X > 0f) - { - npc.velocity.X = npc.velocity.X + num8; - } - } - else if (npc.velocity.X > vector5.X) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X > 0f && vector5.X < 0f) - { - npc.velocity.X = npc.velocity.X - num8; - } - } - if (npc.velocity.Y < vector5.Y) - { - npc.velocity.Y = npc.velocity.Y + num8; - if (npc.velocity.Y < 0f && vector5.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num8; - } - } - else if (npc.velocity.Y > vector5.Y) - { - npc.velocity.Y = npc.velocity.Y - num8; - if (npc.velocity.Y > 0f && vector5.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - num8; - } - } - if (npc.ai[2] == 0f) - { - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - } - if (npc.ai[2] % (float)num7 == 0f) - { - Main.PlaySound(4, (int)npc.Center.X, (int)npc.Center.Y, 19, 1f, 0f); - if (Main.netMode != 1) - { - Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (float)(npc.width + 20) / 2f + vector; - NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, 371, 0, 0f, 0f, 0f, 0f, 255); - } - } - int num26 = Math.Sign(player.Center.X - vector.X); - if (num26 != 0) - { - npc.direction = num26; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num6) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 3f) - { - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num9 - 30)) - { - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 9, 1f, 0f); - } - if (Main.netMode != 1 && npc.ai[2] == (float)(num9 - 30)) - { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * (float)npc.direction) * (float)(npc.width + 20) / 2f + vector; - Projectile.NewProjectile(vector7.X, vector7.Y, (float)(npc.direction * 2), 8f, 385, 0, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(vector7.X, vector7.Y, (float)(-(float)npc.direction * 2), 8f, 385, 0, 0f, Main.myPlayer, 0f, 0f); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num9) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 4f) - { - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num10 - 60)) - { - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num10) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 5f && !player.dead) - { - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - } - Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector8.X) - { - npc.velocity.X = npc.velocity.X + num3; - if (npc.velocity.X < 0f && vector8.X > 0f) - { - npc.velocity.X = npc.velocity.X + num3; - } - } - else if (npc.velocity.X > vector8.X) - { - npc.velocity.X = npc.velocity.X - num3; - if (npc.velocity.X > 0f && vector8.X < 0f) - { - npc.velocity.X = npc.velocity.X - num3; - } - } - if (npc.velocity.Y < vector8.Y) - { - npc.velocity.Y = npc.velocity.Y + num3; - if (npc.velocity.Y < 0f && vector8.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num3; - } - } - else if (npc.velocity.Y > vector8.Y) - { - npc.velocity.Y = npc.velocity.Y - num3; - if (npc.velocity.Y > 0f && vector8.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - num3; - } - } - int num27 = Math.Sign(player.Center.X - vector.X); - if (num27 != 0) - { - if (npc.ai[2] == 0f && num27 != npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.direction = num27; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num28 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - num28 = 1; - break; - case 6: - npc.ai[3] = 1f; - num28 = 2; - break; - case 7: - npc.ai[3] = 0f; - num28 = 3; - break; - } - if (flag2) - { - num28 = 4; - } - if (num28 == 1) - { - npc.ai[0] = 6f; - 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 (num27 != 0) - { - npc.direction = num27; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (num28 == 2) - { - npc.velocity = Vector2.Normalize(player.Center - vector) * scaleFactor4; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num27 != 0) - { - npc.direction = num27; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (num28 == 3) - { - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (num28 == 4) - { - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 6f) - { - int num29 = 7; - for (int k = 0; k < num29; k++) - { - Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(k - (num29 / 2 - 1)) * 3.1415926535897931 / (double)((float)num29), default(Vector2)) + vector; - Vector2 vector9 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num30 = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, 172, vector9.X * 2f, vector9.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num30].noGravity = true; - Main.dust[num30].noLight = true; - Main.dust[num30].velocity /= 4f; - Main.dust[num30].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num4) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 7f) - { - if (npc.ai[2] == 0f) - { - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - } - if (npc.ai[2] % (float)num14 == 0f) - { - Main.PlaySound(4, (int)npc.Center.X, (int)npc.Center.Y, 19, 1f, 0f); - if (Main.netMode != 1) - { - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (float)(npc.width + 20) / 2f + vector; - int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, 371, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy((double)(1.57079637f * (float)npc.direction), default(Vector2)) * scaleFactor3; - Main.npc[num31].netUpdate = true; - Main.npc[num31].ai[3] = (float)Main.rand.Next(80, 121) / 100f; - } - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num15 * (float)npc.direction), default(Vector2)); - npc.rotation -= num15 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num13) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 8f) - { - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num9 - 30)) - { - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - } - if (Main.netMode != 1 && npc.ai[2] == (float)(num9 - 30)) - { - Projectile.NewProjectile(vector.X, vector.Y, 0f, 0f, 385, 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num9) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 9f) - { - if (npc.ai[2] < (float)(num11 - 90)) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.alpha += 15; - } - else - { - npc.alpha -= 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - else if (npc.alpha < 255) - { - npc.alpha += 4; - 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] == (float)(num11 - 60)) - { - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num11) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 10f && !player.dead) - { - npc.dontTakeDamage = false; - npc.chaseable = false; - if (npc.alpha < 255) - { - npc.alpha += 25; - if (npc.alpha > 255) - { - npc.alpha = 255; - } - } - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(360 * Math.Sign((vector - player.Center).X)); - } - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - npc.SimpleFlyMovement(desiredVelocity, num3); - int num32 = Math.Sign(player.Center.X - vector.X); - if (num32 != 0) - { - if (npc.ai[2] == 0f && num32 != npc.direction) - { - npc.rotation += 3.14159274f; - for (int l = 0; l < npc.oldPos.Length; l++) - { - npc.oldPos[l] = Vector2.Zero; - } - } - npc.direction = num32; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num33 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 2: - case 3: - case 5: - case 6: - case 7: - num33 = 1; - break; - case 1: - case 4: - case 8: - num33 = 2; - break; - } - if (num33 == 1) - { - npc.ai[0] = 11f; - 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 (num32 != 0) - { - npc.direction = num32; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (num33 == 2) - { - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (num33 == 3) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 11f) - { - npc.dontTakeDamage = false; - npc.chaseable = true; - npc.alpha -= 25; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - int num34 = 7; - for (int m = 0; m < num34; m++) - { - Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(m - (num34 / 2 - 1)) * 3.1415926535897931 / (double)((float)num34), default(Vector2)) + vector; - Vector2 vector11 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num35 = Dust.NewDust(arg_2444_0 + vector11, 0, 0, 172, vector11.X * 2f, vector11.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num35].noGravity = true; - Main.dust[num35].noLight = true; - Main.dust[num35].velocity /= 4f; - Main.dust[num35].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num4) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 12f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - 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] == (float)(num12 / 2)) - { - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - } - if (Main.netMode != 1 && npc.ai[2] == (float)(num12 / 2)) - { - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - } - Vector2 center = player.Center + new Vector2(-npc.ai[1], -200f); - vector = (npc.Center = center); - int num36 = Math.Sign(player.Center.X - vector.X); - if (num36 != 0) - { - if (npc.ai[2] == 0f && num36 != npc.direction) - { - npc.rotation += 3.14159274f; - for (int n = 0; n < npc.oldPos.Length; n++) - { - npc.oldPos[n] = Vector2.Zero; - } - } - npc.direction = num36; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num12) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - if (npc.ai[3] >= 9f) - { - npc.ai[3] = 0f; - } - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[0] == 13f) - { - if (npc.ai[2] == 0f) - { - Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num15 * (float)npc.direction), default(Vector2)); - npc.rotation -= num15 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num13) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - return false; - } - #endregion - } - #endregion - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - #region Mothron - if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) - { - int num1353 = 3; - npc.noTileCollide = false; - npc.noGravity = true; - npc.knockBackResist = 0.2f * Main.expertKnockBack; - npc.damage = npc.defDamage; - if (!Main.eclipse) - { - npc.ai[0] = -1f; - } - else if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - Vector2 vector235 = Main.player[npc.target].Center - npc.Center; - if (Main.player[npc.target].dead || vector235.Length() > 3000f) - { - npc.ai[0] = -1f; - } - } - else - { - Vector2 vector236 = Main.player[npc.target].Center - npc.Center; - if (npc.ai[0] > 1f && vector236.Length() > 1000f) - { - npc.ai[0] = 1f; - } - } - if (npc.ai[0] == -1f) - { - Vector2 value37 = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * 22f + value37) / 10f; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - return false; - } - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - if (npc.Center.X < Main.player[npc.target].Center.X - 2f) - { - npc.direction = 1; - } - if (npc.Center.X > Main.player[npc.target].Center.X + 2f) - { - npc.direction = -1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > 30f) - { - npc.velocity.X = 30f; - } - if (npc.velocity.X < -30f) - { - npc.velocity.X = -30f; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > 30f) - { - npc.velocity.Y = 30f; - } - if (npc.velocity.Y < -30f) - { - npc.velocity.Y = -30f; - } - } - Vector2 value38 = Main.player[npc.target].Center - npc.Center; - value38.Y -= 200f; - if (value38.Length() > 2000f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (value38.Length() > 80f) - { - float scaleFactor15 = 13f; - float num1354 = 30f; - value38.Normalize(); - value38 *= scaleFactor15; - npc.velocity = (npc.velocity * (num1354 - 1f) + value38) / num1354; - } - else if (npc.velocity.Length() > 2f) - { - npc.velocity *= 0.95f; - } - else if (npc.velocity.Length() < 1f) - { - 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 num1355 = Main.rand.Next(3); - if (num1355 == 0 && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 2f; - } - else if (num1355 == 1) - { - npc.ai[0] = 3f; - } - else if (num1355 == 2 && NPC.CountNPCS(478) + NPC.CountNPCS(479) < num1353) - { - npc.ai[0] = 4f; - } - } - return false; - } - } - else - { - if (npc.ai[0] == 1f) - { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - npc.knockBackResist = 0f; - if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].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.02f) / 10f; - Vector2 value39 = Main.player[npc.target].Center - npc.Center; - if (value39.Length() < 300f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - float scaleFactor16 = 14f + value39.Length() / 100f; - float num1356 = 25f; - value39.Normalize(); - value39 *= scaleFactor16; - npc.velocity = (npc.velocity * (num1356 - 1f) + value39) / num1356; - return false; - } - if (npc.ai[0] == 2f) - { - npc.damage = (int)((double)npc.defDamage * 0.75); - npc.knockBackResist = 0f; - if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (Main.player[npc.target].Center.X - 10f < npc.Center.X) - { - npc.direction = -1; - } - else if (Main.player[npc.target].Center.X + 10f > npc.Center.X) - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.025f) / 5f; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > 30f) - { - npc.velocity.X = 30f; - } - if (npc.velocity.X < -30f) - { - npc.velocity.X = -30f; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > 30f) - { - npc.velocity.Y = 30f; - } - if (npc.velocity.Y < -30f) - { - npc.velocity.Y = -30f; - } - } - Vector2 value40 = Main.player[npc.target].Center - npc.Center; - value40.Y -= 20f; - npc.ai[2] += 0.0222222228f; - if (Main.expertMode) - { - npc.ai[2] += 0.0166666675f; - } - float scaleFactor17 = 13f + npc.ai[2] + value40.Length() / 120f; - float num1357 = 20f; - value40.Normalize(); - value40 *= scaleFactor17; - npc.velocity = (npc.velocity * (num1357 - 1f) + value40) / num1357; - npc.ai[1] += 1f; - if (npc.ai[1] > 240f || !Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return false; - } - } - else - { - if (npc.ai[0] == 3f) - { - npc.knockBackResist = 0f; - 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.0175f) / 5f; - Vector2 value41 = Main.player[npc.target].Center - npc.Center; - value41.Y -= 12f; - if (npc.Center.X > Main.player[npc.target].Center.X) - { - value41.X += 400f; - } - else - { - value41.X -= 400f; - } - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 350f && Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) < 20f) - { - npc.ai[0] = 3.1f; - npc.ai[1] = 0f; - } - npc.ai[1] += 0.0333333351f; - float scaleFactor18 = 20f + npc.ai[1]; - float num1358 = 4f; - value41.Normalize(); - value41 *= scaleFactor18; - npc.velocity = (npc.velocity * (num1358 - 1f) + value41) / num1358; - return false; - } - if (npc.ai[0] == 3.1f) - { - npc.knockBackResist = 0f; - npc.noTileCollide = true; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; - Vector2 vector237 = Main.player[npc.target].Center - npc.Center; - vector237.Y -= 12f; - float scaleFactor19 = 30f; - float num1359 = 8f; - vector237.Normalize(); - vector237 *= scaleFactor19; - npc.velocity = (npc.velocity * (num1359 - 1f) + vector237) / num1359; - 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 = vector237; - 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 false; - } - } - else - { - if (npc.ai[0] == 3.2f) - { - npc.damage = (int)((double)npc.defDamage * 1.5); - npc.collideX = false; - npc.collideY = false; - npc.knockBackResist = 0f; - npc.noTileCollide = true; - npc.ai[2] += 0.0333333351f; - npc.velocity.X = (20f + npc.ai[2]) * npc.ai[1]; - if ((npc.ai[1] > 0f && npc.Center.X > Main.player[npc.target].Center.X + 260f) || (npc.ai[1] < 0f && npc.Center.X < Main.player[npc.target].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 - Main.player[npc.target].Center.X) > 1600f) - { - 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.0175f) / 5f; - return false; - } - if (npc.ai[0] == 4f) - { - npc.ai[0] = 0f; - npc.TargetClosest(true); - if (Main.netMode != 1) - { - npc.ai[1] = -1f; - npc.ai[2] = -1f; - int num; - for (int num1360 = 0; num1360 < 1000; num1360 = num + 1) - { - int num1361 = (int)Main.player[npc.target].Center.X / 16; - int num1362 = (int)Main.player[npc.target].Center.Y / 16; - int num1363 = 30 + num1360 / 50; - int num1364 = 20 + num1360 / 75; - num1361 += Main.rand.Next(-num1363, num1363 + 1); - num1362 += Main.rand.Next(-num1364, num1364 + 1); - if (!WorldGen.SolidTile(num1361, num1362)) - { - while (!WorldGen.SolidTile(num1361, num1362) && (double)num1362 < Main.worldSurface) - { - num1362++; - } - if ((new Vector2((float)(num1361 * 16 + 8), (float)(num1362 * 16 + 8)) - Main.player[npc.target].Center).Length() < 2100f) - { - npc.ai[0] = 4.1f; - npc.ai[1] = (float)num1361; - npc.ai[2] = (float)num1362; - break; - } - } - num = num1360; - } - } - npc.netUpdate = true; - return false; - } - if (npc.ai[0] == 4.1f) - { - if (npc.velocity.X < -2f) - { - npc.direction = -1; - } - else if (npc.velocity.X > 2f) - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; - npc.noTileCollide = true; - int num1365 = (int)npc.ai[1]; - int num1366 = (int)npc.ai[2]; - float x2 = (float)(num1365 * 16 + 8); - float y2 = (float)(num1366 * 16 - 20); - Vector2 vector238 = new Vector2(x2, y2); - vector238 -= npc.Center; - float num1367 = 6f + vector238.Length() / 150f; - if (num1367 > 10f) - { - num1367 = 10f; - } - float num1368 = 10f; - if (vector238.Length() < 10f) - { - npc.ai[0] = 4.2f; - } - vector238.Normalize(); - vector238 *= num1367; - npc.velocity = (npc.velocity * (num1368 - 1f) + vector238) / num1368; - return false; - } - if (npc.ai[0] == 4.2f) - { - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; - npc.knockBackResist = 0f; - npc.noTileCollide = true; - int num1369 = (int)npc.ai[1]; - int num1370 = (int)npc.ai[2]; - float x3 = (float)(num1369 * 16 + 8); - float y3 = (float)(num1370 * 16 - 20); - Vector2 vector239 = new Vector2(x3, y3); - vector239 -= npc.Center; - float num1371 = 4f; - float num1372 = 2f; - if (Main.netMode != 1 && vector239.Length() < 4f) - { - int num1373 = 70; - if (Main.expertMode) - { - num1373 = (int)((double)num1373 * 0.75); - } - npc.ai[3] += 1f; - if (npc.ai[3] == (float)num1373) - { - NPC.NewNPC(num1369 * 16 + 8, num1370 * 16, 478, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - else if (npc.ai[3] == (float)(num1373 * 2)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (NPC.CountNPCS(478) + NPC.CountNPCS(479) < num1353 && Main.rand.Next(3) != 0) - { - npc.ai[0] = 4f; - } - else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 1f; - } - } - } - if (vector239.Length() > num1371) - { - vector239.Normalize(); - vector239 *= num1371; - } - npc.velocity = (npc.velocity * (num1372 - 1f) + vector239) / num1372; - return false; - } - } - } - } - return false; - } - #endregion - #region Pumpking - else if (npc.type == NPCID.Pumpking && CalamityWorld.downedDoG) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > 6f) - { - npc.localAI[0] = 0f; - npc.localAI[1] += 1f; - if (npc.localAI[1] > 4f) - { - npc.localAI[1] = 0f; - } - } - if (Main.netMode != 1) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 300f) - { - npc.ai[3] = (float)Main.rand.Next(3); - npc.localAI[2] = 0f; - } - else if (npc.ai[3] == 0f && npc.localAI[2] % 30f == 0f && npc.localAI[2] > 30f) - { - float num856 = 10f; - Vector2 vector109 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - if (!WorldGen.SolidTile((int)vector109.X / 16, (int)vector109.Y / 16)) - { - float num857 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector109.X; - float num858 = Main.player[npc.target].position.Y - vector109.Y; - num857 += (float)Main.rand.Next(-50, 51); - num858 += (float)Main.rand.Next(50, 201); - num858 *= 0.2f; - float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); - num859 = num856 / num859; - num857 *= num859; - num858 *= num859; - num857 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; - num858 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; - Projectile.NewProjectile(vector109.X, vector109.Y, num857, num858, Main.rand.Next(326, 329), 60, 0f, Main.myPlayer, 0f, 0f); - } - } - } - if (npc.ai[0] == 0f && Main.netMode != 1) - { - npc.TargetClosest(true); - npc.ai[0] = 1f; - int num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, 328, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num861].ai[0] = -1f; - Main.npc[num861].ai[1] = (float)npc.whoAmI; - Main.npc[num861].target = npc.target; - Main.npc[num861].netUpdate = true; - num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, 328, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num861].ai[0] = 1f; - Main.npc[num861].ai[1] = (float)npc.whoAmI; - Main.npc[num861].ai[3] = 150f; - Main.npc[num861].target = npc.target; - Main.npc[num861].netUpdate = true; - } - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) - { - npc.ai[1] = 2f; - } - } - if (Main.dayTime) - { - npc.velocity.Y = npc.velocity.Y + 0.3f; - npc.velocity.X = npc.velocity.X * 0.9f; - } - else if (npc.ai[1] == 0f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - if (npc.ai[3] != 1f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else - { - npc.ai[2] = 0f; - npc.ai[1] = 1f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - } - Vector2 vector110 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num862 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector110.X; - float num863 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector110.Y; - float num864 = (float)Math.Sqrt((double)(num862 * num862 + num863 * num863)); - float num865 = 8f; - if (npc.ai[3] == 1f) - { - if (num864 > 900f) - { - num865 = 14f; - } - else if (num864 > 600f) - { - num865 = 12f; - } - else if (num864 > 300f) - { - num865 = 10f; - } - } - if (num864 > 50f) - { - num864 = num865 / num864; - npc.velocity.X = (npc.velocity.X * 14f + num862 * num864) / 15f; - npc.velocity.Y = (npc.velocity.Y * 14f + num863 * num864) / 15f; - } - } - else if (npc.ai[1] == 1f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 600f || npc.ai[3] != 1f) - { - npc.ai[2] = 0f; - npc.ai[1] = 0f; - } - Vector2 vector111 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num866 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector111.X; - float num867 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector111.Y; - float num868 = (float)Math.Sqrt((double)(num866 * num866 + num867 * num867)); - num868 = 20f / num868; - npc.velocity.X = (npc.velocity.X * 49f + num866 * num868) / 50f; - npc.velocity.Y = (npc.velocity.Y * 49f + num867 * num868) / 50f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[1] = 3f; - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.X = npc.velocity.X * 0.95f; - if (npc.timeLeft > 500) - { - npc.timeLeft = 500; - } - } - npc.rotation = npc.velocity.X * -0.02f; - return false; - } - else if (npc.type == NPCID.PumpkingBlade && CalamityWorld.downedDoG) - { - npc.spriteDirection = -(int)npc.ai[0]; - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 58) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != 2) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - if (Main.netMode != 1 && Main.npc[(int)npc.ai[1]].ai[3] == 2f) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] > 30f) - { - npc.localAI[1] = 0f; - float num869 = 0.01f; - Vector2 vector112 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float num870 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector112.X; - float num871 = Main.player[npc.target].position.Y - vector112.Y; - float num872 = (float)Math.Sqrt((double)(num870 * num870 + num871 * num871)); - num872 = num869 / num872; - num870 *= num872; - num871 *= num872; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num870, num871, 329, 70, 0f, Main.myPlayer, npc.rotation, (float)npc.spriteDirection); - } - } - if (Main.dayTime) - { - npc.velocity.Y = npc.velocity.Y + 0.3f; - npc.velocity.X = npc.velocity.X * 0.9f; - return false; - } - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - npc.ai[3] += 1f; - if (npc.ai[3] >= 180f) - { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - Vector2 vector113 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num874 = (Main.player[npc.target].Center.X + Main.npc[(int)npc.ai[1]].Center.X) / 2f; - float num875 = (Main.player[npc.target].Center.Y + Main.npc[(int)npc.ai[1]].Center.Y) / 2f; - num874 += -170f * npc.ai[0] - vector113.X; - num875 += 90f - vector113.Y; - float num876 = Math.Abs(Main.player[npc.target].Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(Main.player[npc.target].Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); - if (num876 > 700f) - { - num874 = Main.npc[(int)npc.ai[1]].Center.X - 170f * npc.ai[0] - vector113.X; - num875 = Main.npc[(int)npc.ai[1]].Center.Y + 90f - vector113.Y; - } - float num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); - float num878 = 8f; - if (num877 > 1000f) - { - num878 = 23f; - } - else if (num877 > 800f) - { - num878 = 20f; - } - else if (num877 > 600f) - { - num878 = 17f; - } - else if (num877 > 400f) - { - num878 = 14f; - } - else if (num877 > 200f) - { - num878 = 11f; - } - if (npc.ai[0] < 0f && npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) - { - num874 -= 4f; - } - if (npc.ai[0] > 0f && npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) - { - num874 += 4f; - } - num877 = num878 / num877; - npc.velocity.X = (npc.velocity.X * 14f + num874 * num877) / 15f; - npc.velocity.Y = (npc.velocity.Y * 14f + num875 * num877) / 15f; - num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); - if (num877 > 20f) - { - npc.rotation = (float)Math.Atan2((double)num875, (double)num874) + 1.57f; - return false; - } - } - else if (npc.ai[2] == 1f) - { - Vector2 vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num879 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector114.X; - float num880 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector114.Y; - float num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); - npc.rotation = (float)Math.Atan2((double)num880, (double)num879) + 1.57f; - npc.velocity.X = npc.velocity.X * 0.95f; - npc.velocity.Y = npc.velocity.Y - 0.3f; - if (npc.velocity.Y < -18f) - { - npc.velocity.Y = -18f; - } - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - npc.TargetClosest(true); - npc.ai[2] = 2f; - vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num879 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector114.X; - num880 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector114.Y; - num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); - num881 = 24f / num881; - npc.velocity.X = num879 * num881; - npc.velocity.Y = num880 * num881; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[2] == 2f) - { - float num882 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || num882 > 800f) - { - npc.ai[2] = 3f; - return false; - } - } - else if (npc.ai[2] == 4f) - { - Vector2 vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num883 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector115.X; - float num884 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector115.Y; - float num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); - npc.rotation = (float)Math.Atan2((double)num884, (double)num883) + 1.57f; - npc.velocity.Y = npc.velocity.Y * 0.95f; - npc.velocity.X = npc.velocity.X + 0.3f * -npc.ai[0]; - if (npc.velocity.X < -18f) - { - npc.velocity.X = -18f; - } - if (npc.velocity.X > 18f) - { - npc.velocity.X = 18f; - } - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) - { - npc.TargetClosest(true); - npc.ai[2] = 5f; - vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num883 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector115.X; - num884 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector115.Y; - num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); - num885 = 17f / num885; - npc.velocity.X = num883 * num885; - npc.velocity.Y = num884 * num885; - npc.netUpdate = true; - return false; - } - } - else if (npc.ai[2] == 5f) - { - float num886 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); - if ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || num886 > 800f) - { - npc.ai[2] = 0f; - return false; - } - } - return false; - } - #endregion - #region IceQueen - else if (npc.type == NPCID.IceQueen && CalamityWorld.downedDoG) - { - if (Main.dayTime) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + 0.25f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.25f; - } - npc.velocity.Y = npc.velocity.Y - 0.1f; - npc.rotation = npc.velocity.X * 0.05f; - } - else if (npc.ai[0] == 0f) - { - if (npc.ai[2] == 0f) - { - npc.TargetClosest(true); - if (npc.Center.X < Main.player[npc.target].Center.X) - { - npc.ai[2] = 1f; - } - else - { - npc.ai[2] = -1f; - } - } - npc.TargetClosest(true); - int num887 = 800; - float num888 = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); - if (npc.Center.X < Main.player[npc.target].Center.X && npc.ai[2] < 0f && num888 > (float)num887) - { - npc.ai[2] = 0f; - } - if (npc.Center.X > Main.player[npc.target].Center.X && npc.ai[2] > 0f && num888 > (float)num887) - { - npc.ai[2] = 0f; - } - float num889 = 0.6f; - float num890 = 10f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num889 = 0.7f; - num890 = 12f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num889 = 0.8f; - num890 = 14f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num889 = 0.95f; - num890 = 16f; - } - npc.velocity.X = npc.velocity.X + npc.ai[2] * num889; - if (npc.velocity.X > num890) - { - npc.velocity.X = num890; - } - if (npc.velocity.X < -num890) - { - npc.velocity.X = -num890; - } - float num891 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); - if (num891 < 150f) - { - npc.velocity.Y = npc.velocity.Y - 0.2f; - } - if (num891 > 200f) - { - npc.velocity.Y = npc.velocity.Y + 0.2f; - } - if (npc.velocity.Y > 9f) - { - npc.velocity.Y = 9f; - } - if (npc.velocity.Y < -9f) - { - npc.velocity.Y = -9f; - } - npc.rotation = npc.velocity.X * 0.05f; - if ((num888 < 500f || npc.ai[3] < 0f) && npc.position.Y < Main.player[npc.target].position.Y) - { - npc.ai[3] += 1f; - int num892 = 8; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num892 = 7; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num892 = 6; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num892 = 5; - } - num892++; - if (npc.ai[3] > (float)num892) - { - npc.ai[3] = (float)(-(float)num892); - } - if (npc.ai[3] == 0f && Main.netMode != 1) - { - Vector2 vector116 = new Vector2(npc.Center.X, npc.Center.Y); - vector116.X += npc.velocity.X * 7f; - float num893 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector116.X; - float num894 = Main.player[npc.target].Center.Y - vector116.Y; - float num895 = (float)Math.Sqrt((double)(num893 * num893 + num894 * num894)); - float num896 = 8f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num896 = 9f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num896 = 10f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num896 = 11f; - } - num895 = num896 / num895; - num893 *= num895; - num894 *= num895; - Projectile.NewProjectile(vector116.X, vector116.Y, num893, num894, 348, 50, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (npc.ai[3] < 0f) - { - npc.ai[3] += 1f; - } - if (Main.netMode != 1) - { - npc.ai[1] += (float)Main.rand.Next(1, 4); - if (npc.ai[1] > 600f && num888 < 600f) - { - npc.ai[0] = -1f; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.TargetClosest(true); - float num898 = 0.2f; - float num899 = 10f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num898 = 0.24f; - num899 = 12f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num898 = 0.28f; - num899 = 14f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num898 = 0.32f; - num899 = 16f; - } - num898 -= 0.05f; - num899 -= 1f; - if (npc.Center.X < Main.player[npc.target].Center.X) - { - npc.velocity.X = npc.velocity.X + num898; - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - } - if (npc.Center.X > Main.player[npc.target].Center.X) - { - npc.velocity.X = npc.velocity.X - num898; - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - } - if (npc.velocity.X > num899 || npc.velocity.X < -num899) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - float num900 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); - if (num900 < 180f) - { - npc.velocity.Y = npc.velocity.Y - 0.1f; - } - if (num900 > 200f) - { - npc.velocity.Y = npc.velocity.Y + 0.1f; - } - if (npc.velocity.Y > 7f) - { - npc.velocity.Y = 7f; - } - if (npc.velocity.Y < -7f) - { - npc.velocity.Y = -7f; - } - npc.rotation = npc.velocity.X * 0.01f; - if (Main.netMode != 1) - { - npc.ai[3] += 1f; - int num901 = 10; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num901 = 8; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num901 = 6; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num901 = 4; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num901 = 2; - } - num901 += 3; - if (npc.ai[3] >= (float)num901) - { - npc.ai[3] = 0f; - Vector2 vector117 = new Vector2(npc.Center.X, npc.position.Y + (float)npc.height - 14f); - int i2 = (int)(vector117.X / 16f); - int j2 = (int)(vector117.Y / 16f); - if (!WorldGen.SolidTile(i2, j2)) - { - float num902 = npc.velocity.Y; - if (num902 < 0f) - { - num902 = 0f; - } - num902 += 3f; - float speedX2 = npc.velocity.X * 0.25f; - int num903 = Projectile.NewProjectile(vector117.X, vector117.Y, speedX2, num902, 349, 44, 0f, Main.myPlayer, (float)Main.rand.Next(5), 0f); - } - } - } - if (Main.netMode != 1) - { - npc.ai[1] += (float)Main.rand.Next(1, 4); - if (npc.ai[1] > 450f) - { - npc.ai[0] = -1f; - } - } - } - else if (npc.ai[0] == 2f) - { - npc.TargetClosest(true); - Vector2 vector118 = new Vector2(npc.Center.X, npc.Center.Y - 20f); - float num904 = (float)Main.rand.Next(-1000, 1001); - float num905 = (float)Main.rand.Next(-1000, 1001); - float num906 = (float)Math.Sqrt((double)(num904 * num904 + num905 * num905)); - float num907 = 20f; - npc.velocity *= 0.95f; - num906 = num907 / num906; - num904 *= num906; - num905 *= num906; - npc.rotation += 0.2f; - vector118.X += num904 * 4f; - vector118.Y += num905 * 4f; - npc.ai[3] += 1f; - int num908 = 7; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num908--; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num908 -= 2; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num908 -= 3; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num908 -= 4; - } - if (npc.ai[3] > (float)num908) - { - npc.ai[3] = 0f; - int num909 = Projectile.NewProjectile(vector118.X, vector118.Y, num904, num905, 349, 40, 0f, Main.myPlayer, 0f, 0f); - } - if (Main.netMode != 1) - { - npc.ai[1] += (float)Main.rand.Next(1, 4); - if (npc.ai[1] > 300f) - { - npc.ai[0] = -1f; - } - } - } - if (npc.ai[0] == -1f) - { - int num910 = Main.rand.Next(3); - npc.TargetClosest(true); - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 1000f) - { - num910 = 0; - } - npc.ai[0] = (float)num910; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return false; - } - return false; - } - #endregion - #region EyeofCthulhu - else if (npc.type == NPCID.EyeofCthulhu && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - double getMad = 0.5; //0.5 - bool flag2 = false; - if ((double)npc.life < (double)npc.lifeMax * getMad) - { - flag2 = true; - } - float num5 = 20f; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - } - bool dead = Main.player[npc.target].dead; - float num6 = npc.position.X + (float)(npc.width / 2) - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); - float num7 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); - float num8 = (float)Math.Atan2((double)num7, (double)num6) + 1.57f; - if (num8 < 0f) - { - num8 += 6.283f; - } - else if ((double)num8 > 6.283) - { - num8 -= 6.283f; - } - float num9 = 0f; - if (npc.ai[0] == 0f && npc.ai[1] == 0f) - { - num9 = 0.02f; - } - if (npc.ai[0] == 0f && npc.ai[1] == 2f && npc.ai[2] > 40f) - { - num9 = 0.05f; - } - if (npc.ai[0] == 3f && npc.ai[1] == 0f) - { - num9 = 0.05f; - } - if (npc.ai[0] == 3f && npc.ai[1] == 2f && npc.ai[2] > 40f) - { - num9 = 0.08f; - } - if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > num5) - { - num9 = 0.15f; - } - if (npc.ai[0] == 3f && npc.ai[1] == 5f) - { - num9 = 0.05f; - } - num9 *= 1.5f; - if (npc.rotation < num8) - { - if ((double)(num8 - npc.rotation) > 3.1415) - { - npc.rotation -= num9; - } - else - { - npc.rotation += num9; - } - } - else if (npc.rotation > num8) - { - if ((double)(npc.rotation - num8) > 3.1415) - { - npc.rotation += num9; - } - else - { - npc.rotation -= num9; - } - } - if (npc.rotation > num8 - num9 && npc.rotation < num8 + num9) - { - npc.rotation = num8; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.283f; - } - else if ((double)npc.rotation > 6.283) - { - npc.rotation -= 6.283f; - } - if (npc.rotation > num8 - num9 && npc.rotation < num8 + num9) - { - npc.rotation = num8; - } - if (Main.rand.Next(5) == 0) - { - int num10 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default(Color), 1f); - Dust var_9_825_cp_0_cp_0 = Main.dust[num10]; - var_9_825_cp_0_cp_0.velocity.X = var_9_825_cp_0_cp_0.velocity.X * 0.5f; - Dust var_9_845_cp_0_cp_0 = Main.dust[num10]; - var_9_845_cp_0_cp_0.velocity.Y = var_9_845_cp_0_cp_0.velocity.Y * 0.1f; - } - if (Main.dayTime | dead) - { - npc.velocity.Y = npc.velocity.Y - 0.04f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - return false; - } - } - else if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - 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; - float num15 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - float num16 = num15; - num15 = num11 / num15; - num13 *= num15; - num14 *= num15; - if (npc.velocity.X < num13) - { - npc.velocity.X = npc.velocity.X + num12; - if (npc.velocity.X < 0f && num13 > 0f) - { - npc.velocity.X = npc.velocity.X + num12; - } - } - else if (npc.velocity.X > num13) - { - npc.velocity.X = npc.velocity.X - num12; - if (npc.velocity.X > 0f && num13 < 0f) - { - npc.velocity.X = npc.velocity.X - num12; - } - } - if (npc.velocity.Y < num14) - { - npc.velocity.Y = npc.velocity.Y + num12; - if (npc.velocity.Y < 0f && num14 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num12; - } - } - else if (npc.velocity.Y > num14) - { - npc.velocity.Y = npc.velocity.Y - num12; - if (npc.velocity.Y > 0f && num14 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num12; - } - } - npc.ai[2] += 1f; - float num17 = 180f; - if (npc.ai[2] >= num17) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - else if (num16 < 500f) - { - if (!Main.player[npc.target].dead) - { - npc.ai[3] += 1f; - } - float num18 = 44f; - if (npc.ai[3] >= num18) - { - npc.ai[3] = 0f; - npc.rotation = num8; - float num19 = 5f; - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector.X; - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - num22 = num19 / num22; - Vector2 vector2 = vector; - Vector2 vector3; - vector3.X = num20 * num22; - vector3.Y = num21 * num22; - vector2.X += vector3.X * 10f; - vector2.Y += vector3.Y * 10f; - if (Main.netMode != 1) - { - int num23 = NPC.NewNPC((int)vector2.X, (int)vector2.Y, 5, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num23].velocity.X = vector3.X; - Main.npc[num23].velocity.Y = vector3.Y; - if (Main.netMode == 2 && num23 < 200) - { - NetMessage.SendData(23, -1, -1, null, num23, 0f, 0f, 0f, 0, 0, 0); - } - } - Main.PlaySound(3, (int)vector2.X, (int)vector2.Y, 1, 1f, 0f); - int num; - for (int m = 0; m < 10; m = num + 1) - { - Dust.NewDust(vector2, 20, 20, 5, vector3.X * 0.4f, vector3.Y * 0.4f, 0, default(Color), 1f); - num = m; - } - } - } - } - else if (npc.ai[1] == 1f) - { - npc.rotation = num8; - 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; - float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); - num27 = num24 / num27; - npc.velocity.X = num25 * num27; - npc.velocity.Y = num26 * num27; - npc.ai[1] = 2f; - npc.netUpdate = true; - if (npc.netSpam > 10) - { - npc.netSpam = 10; - } - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 40f) - { - npc.velocity *= 0.975f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - int num28 = 90; - if (npc.ai[2] >= (float)num28) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num8; - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - { - npc.ai[1] = 1f; - } - } - } - float num29 = 0.9f; - if (((float)npc.life < (float)npc.lifeMax * num29) || CalamityWorld.death) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - if (npc.netSpam > 10) - { - npc.netSpam = 10; - return false; - } - } - } - else if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - { - npc.ai[2] = 0.5f; - } - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - { - npc.ai[2] = 0f; - } - } - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (npc.ai[1] % 20f == 0f) - { - float num30 = 5f; - Vector2 vector5 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num31 = (float)Main.rand.Next(-200, 200); - float num32 = (float)Main.rand.Next(-200, 200); - float num33 = (float)Math.Sqrt((double)(num31 * num31 + num32 * num32)); - num33 = num30 / num33; - Vector2 vector6 = vector5; - Vector2 vector7; - vector7.X = num31 * num33; - vector7.Y = num32 * num33; - vector6.X += vector7.X * 10f; - vector6.Y += vector7.Y * 10f; - if (Main.netMode != 1) - { - int num34 = NPC.NewNPC((int)vector6.X, (int)vector6.Y, 5, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num34].velocity.X = vector7.X; - Main.npc[num34].velocity.Y = vector7.Y; - if (Main.netMode == 2 && num34 < 200) - { - NetMessage.SendData(23, -1, -1, null, num34, 0f, 0f, 0f, 0, 0, 0); - } - } - int num; - for (int n = 0; n < 10; n = num + 1) - { - Dust.NewDust(vector6, 20, 20, 5, vector7.X * 0.4f, vector7.Y * 0.4f, 0, default(Color), 1f); - num = n; - } - } - if (npc.ai[1] == 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - { - npc.ai[2] = 0f; - } - else - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - int num; - for (int num35 = 0; num35 < 2; num35 = num + 1) - { - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 8, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f); - Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f); - num = num35; - } - for (int num36 = 0; num36 < 20; num36 = num + 1) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f); - num = num36; - } - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - } - } - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f); - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.Y = npc.velocity.Y * 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - return false; - } - } - else - { - if (flag2) - { - npc.defense = -5; - } - else - { - npc.damage = (int)(20f * Main.expertDamage); - } - if (npc.ai[1] == 0f & flag2) - { - npc.ai[1] = 5f; - } - if (npc.ai[1] == 0f) - { - 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; - float num41 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); - if (num41 > 400f) - { - num37 += 1.25f; - num38 += 0.075f; - if (num41 > 600f) - { - num37 += 1.25f; - num38 += 0.075f; - if (num41 > 800f) - { - num37 += 1.25f; - num38 += 0.075f; - } - } - } - num41 = num37 / num41; - num39 *= num41; - num40 *= num41; - if (npc.velocity.X < num39) - { - npc.velocity.X = npc.velocity.X + num38; - if (npc.velocity.X < 0f && num39 > 0f) - { - npc.velocity.X = npc.velocity.X + num38; - } - } - else if (npc.velocity.X > num39) - { - npc.velocity.X = npc.velocity.X - num38; - if (npc.velocity.X > 0f && num39 < 0f) - { - npc.velocity.X = npc.velocity.X - num38; - } - } - if (npc.velocity.Y < num40) - { - npc.velocity.Y = npc.velocity.Y + num38; - if (npc.velocity.Y < 0f && num40 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num38; - } - } - else if (npc.velocity.Y > num40) - { - npc.velocity.Y = npc.velocity.Y - num38; - if (npc.velocity.Y > 0f && num40 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num38; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 200f) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if ((double)npc.life < (double)npc.lifeMax * 0.4) - { - npc.ai[1] = 3f; - } - npc.target = 255; - npc.netUpdate = true; - } - } - else if (npc.ai[1] == 1f) - { - Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - npc.rotation = num8; - float num42 = ((enraged || configBossRushBoost) ? 9.5f : 6.2f); - if (npc.ai[3] == 1f) - { - num42 *= 1.15f; - } - if (npc.ai[3] == 2f) - { - num42 *= 1.3f; - } - Vector2 vector9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num43 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector9.X; - float num44 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector9.Y; - float num45 = (float)Math.Sqrt((double)(num43 * num43 + num44 * num44)); - num45 = num42 / num45; - npc.velocity.X = num43 * num45; - npc.velocity.Y = num44 * num45; - npc.ai[1] = 2f; - npc.netUpdate = true; - if (npc.netSpam > 10) - { - npc.netSpam = 10; - } - } - else if (npc.ai[1] == 2f) - { - float num46 = CalamityWorld.death ? 70f : 60f; - npc.ai[2] += 1f; - if (npc.ai[2] >= num46) - { - npc.velocity *= 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - int num47 = CalamityWorld.death ? 70 : 80; - if (npc.ai[2] >= (float)num47) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num8; - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - if (Main.netMode != 1 && (double)npc.life < (double)npc.lifeMax * 0.6) - { - npc.ai[1] = 3f; - npc.ai[3] += (float)Main.rand.Next(1, 4); - } - npc.netUpdate = true; - if (npc.netSpam > 10) - { - npc.netSpam = 10; - } - } - else - { - npc.ai[1] = 1f; - } - } - } - else if (npc.ai[1] == 3f) - { - if ((npc.ai[3] == 4f & flag2) && npc.Center.Y > Main.player[npc.target].Center.Y) - { - npc.TargetClosest(true); - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - if (npc.netSpam > 10) - { - npc.netSpam = 10; - } - } - else if (Main.netMode != 1) - { - npc.TargetClosest(true); - 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; - float num51 = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; - num51 += 10f - num51; - if (num51 < 5f) - { - num51 = 5f; - } - if (num51 > 15f) - { - num51 = 15f; - } - if (npc.ai[2] == -1f) - { - num51 *= 4f; - num48 *= 1.3f; - } - num49 -= Main.player[npc.target].velocity.X * num51; - num50 -= Main.player[npc.target].velocity.Y * num51 / 4f; - num49 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - num50 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - float num52 = (float)Math.Sqrt((double)(num49 * num49 + num50 * num50)); - float num53 = num52; - num52 = num48 / num52; - npc.velocity.X = num49 * num52; - npc.velocity.Y = num50 * num52; - npc.velocity.X = npc.velocity.X + (float)Main.rand.Next(-20, 21) * 0.1f; - npc.velocity.Y = npc.velocity.Y + (float)Main.rand.Next(-20, 21) * 0.1f; - if (num53 < 100f) - { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float num56 = Math.Abs(npc.velocity.X); - float num57 = Math.Abs(npc.velocity.Y); - if (npc.Center.X > Main.player[npc.target].Center.X) - { - num57 *= -1f; - } - if (npc.Center.Y > Main.player[npc.target].Center.Y) - { - num56 *= -1f; - } - npc.velocity.X = num57; - npc.velocity.Y = num56; - } - } - else if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float num58 = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; - float num59 = num58; - if (npc.Center.X > Main.player[npc.target].Center.X) - { - num59 *= -1f; - } - if (npc.Center.Y > Main.player[npc.target].Center.Y) - { - num58 *= -1f; - } - npc.velocity.X = num59; - npc.velocity.Y = num58; - } - npc.ai[1] = 4f; - npc.netUpdate = true; - if (npc.netSpam > 10) - { - npc.netSpam = 10; - } - } - } - else if (npc.ai[1] == 4f) - { - if (npc.ai[2] == 0f) - { - Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); - } - float num60 = num5; - npc.ai[2] += 1f; - if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) - { - npc.ai[2] -= 1f; - } - if (npc.ai[2] >= num60) - { - npc.velocity *= 0.95f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - float num61 = num60 + 13f; - if (npc.ai[2] >= num61) - { - npc.netUpdate = true; - if (npc.netSpam > 10) - { - npc.netSpam = 10; - } - npc.ai[3] += 1f; - npc.ai[2] = 0f; - if (npc.ai[3] >= 5f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - { - npc.ai[1] = 3f; - } - } - } - else if (npc.ai[1] == 5f) - { - float num62 = 600f; - 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; - float num67 = (float)Math.Sqrt((double)(num65 * num65 + num66 * num66)); - num67 = num63 / num67; - num65 *= num67; - num66 *= num67; - if (npc.velocity.X < num65) - { - npc.velocity.X = npc.velocity.X + num64; - if (npc.velocity.X < 0f && num65 > 0f) - { - npc.velocity.X = npc.velocity.X + num64; - } - } - else if (npc.velocity.X > num65) - { - npc.velocity.X = npc.velocity.X - num64; - if (npc.velocity.X > 0f && num65 < 0f) - { - npc.velocity.X = npc.velocity.X - num64; - } - } - if (npc.velocity.Y < num66) - { - npc.velocity.Y = npc.velocity.Y + num64; - if (npc.velocity.Y < 0f && num66 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num64; - } - } - else if (npc.velocity.Y > num66) - { - npc.velocity.Y = npc.velocity.Y - num64; - if (npc.velocity.Y > 0f && num66 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num64; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 70f) - { - npc.TargetClosest(true); - npc.ai[1] = 3f; - npc.ai[2] = -1f; - npc.ai[3] = (float)Main.rand.Next(-3, 1); - npc.netUpdate = true; - } - } - } - return false; - } - #endregion - } - return true; - } - #endregion - - #region AI - public override void AI(NPC npc) - { - if (!CalamityWorld.spawnedHardBoss) - { - if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCID.SkeletronPrime || - npc.type == NPCID.Plantera || npc.type == mod.NPCType("Cryogen") || npc.type == mod.NPCType("AquaticScourgeHead") || - npc.type == mod.NPCType("BrimstoneElemental") || npc.type == mod.NPCType("Astrageldon") || npc.type == mod.NPCType("AstrumDeusHeadSpectral") || - npc.type == mod.NPCType("Calamitas") || npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("PlaguebringerGoliath") || - npc.type == mod.NPCType("ScavengerBody") || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.Golem) - { - CalamityWorld.spawnedHardBoss = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - } - #region RevengeanceAIChanges - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; - - #region MoonLord - if (npc.type == NPCID.MoonLordFreeEye) - { - if (NPC.CountNPCS(NPCID.MoonLordFreeEye) > 3) - { - npc.dontTakeDamage = false; - } - else - { - npc.dontTakeDamage = true; - } - } - 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; - } - } - else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) - { - if (npc.ai[0] == -2f) - { - if ((double)Main.npc[(int)npc.ai[3]].life <= (double)Main.npc[(int)npc.ai[3]].lifeMax * 0.75) - { - if (newAI[2] < 90f) - { - newAI[2] += 1f; - } - if ((int)newAI[2] % 60 == 0) - { - npc.netUpdate = true; - if (Main.netMode != 1) - { - int num = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, 400, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num].ai[3] = npc.ai[3]; - Main.npc[num].netUpdate = true; - } - } - } - if ((CalamityWorld.death || CalamityWorld.bossRushActive) && npc.type == NPCID.MoonLordHead) - { - if ((double)Main.npc[(int)npc.ai[3]].life <= (double)Main.npc[(int)npc.ai[3]].lifeMax * 0.5) - { - if (newAI[2] < 150f) - { - newAI[2] += 1f; - } - if ((int)newAI[2] % 60 == 0) - { - npc.netUpdate = true; - if (Main.netMode != 1) - { - int num = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, 400, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num].ai[3] = npc.ai[3]; - Main.npc[num].netUpdate = true; - } - } - } - } - } - } - #endregion - #region LunaticCultist - else if (npc.type == NPCID.CultistBoss) - { - if (npc.buffImmune[mod.BuffType("Enraged")]) - { - npc.buffImmune[mod.BuffType("Enraged")] = false; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.5 || enraged || configBossRushBoost) - { - if (!NPC.AnyNPCs(mod.NPCType("Eidolist"))) - { - if (newAI[0] < 120f) - { - newAI[0] += 1f; - } - if (newAI[0] >= 120f) - { - newAI[0] = 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); - } - newAI[0] = -360f; - } - } - } - else - { - if (CultCountdown == 0) - { - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - CultCountdown = 75; - } - else if ((double)npc.life <= (double)npc.lifeMax * 0.5) - { - CultCountdown = 150; - } - else - { - CultCountdown = 200; - } - } - if (CultCountdown > 0) - { - CultCountdown--; - if (CultCountdown == 0) - { - if (Main.netMode != 1) - { - Player player2 = Main.player[npc.target]; - int speed2 = 8; - float spawnX = Main.rand.Next(1000) - 500 + player2.Center.X; - float spawnY = -1000 + player2.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = player2.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; - int damage = 25; //100 - for (int i = 0; i < CultProjectiles; i++) - { - Vector2 spawn2 = baseSpawn; - spawn2.X = spawn2.X + i * 30 - (CultProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-CultAngleSpread / 2 + (CultAngleSpread * i / (float)CultProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = 467; - } - else if (projectileType == 1) - { - projectileType = 348; - } - else - { - projectileType = 593; - } - int projectileI = Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[projectileI].tileCollide = false; - } - } - } - } - } - } - #endregion - #region DukeFishron - else if (npc.type == NPCID.DukeFishron) - { - Vector2 vector = npc.Center; - bool murderMode = (double)npc.life <= (double)npc.lifeMax * 0.75; - bool murderMode2 = (double)npc.life <= (double)npc.lifeMax * ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.3 : 0.2); - float num = 0.6f * Main.damageMultiplier; //1.2 - bool flag3 = npc.ai[0] > 4f; - bool flag4 = npc.ai[0] > 9f; - if (flag4) - { - npc.damage = (int)((float)npc.defDamage * 1.1f * num); - npc.defense = 38; - newAI[0] += 1f; - if (newAI[0] >= 600f) - { - newAI[0] = 0f; - if (Main.netMode != 1) - { - Projectile.NewProjectile(vector.X, vector.Y, 0f, 0f, 385, 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - npc.netUpdate = true; - } - } - else if (flag3) - { - npc.damage = (int)((float)npc.defDamage * 1.2f * num); - npc.defense = (int)((float)npc.defDefense * 1.1f); - } - else - { - npc.damage = npc.defDamage; - npc.defense = npc.defDefense; - } - if (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f || (Main.player[npc.target].position.Y < 800f || (double)Main.player[npc.target].position.Y > Main.worldSurface * 16.0 || (Main.player[npc.target].position.X > 6400f && Main.player[npc.target].position.X < (float)(Main.maxTilesX * 16 - 6400)))) - { - npc.dontTakeDamage = true; - } - else if (npc.ai[0] <= 8f) - { - npc.dontTakeDamage = false; - } - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 11f) - { - npc.velocity *= 1.01f; //20, 24, 30 - } - if (npc.ai[0] == 0f && !Main.player[npc.target].dead) - { - if (murderMode) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 5f && !Main.player[npc.target].dead) - { - if (murderMode2) - { - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - } - #endregion - #region Golem - else if (npc.type == NPCID.GolemHeadFree && !CalamityWorld.bossRushActive) - { - bool enrage = true; - if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; - Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == 87) - { - enrage = false; - } - } - if (NPC.CountNPCS(NPCID.Golem) > 0) - { - if (enrage) - { - npc.ai[1] += 3f; - } - npc.ai[1] -= 0.25f; //0.75 - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.8) - { - npc.ai[1] -= 0.75f; //1 - } - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.6) - { - npc.ai[1] -= 0.75f; //1.25 - } - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) - { - npc.ai[1] -= 0.75f; //1.5 - } - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) - { - npc.ai[1] -= 0.75f; //1.75 - } - if (enrage) - { - npc.ai[2] += 3f; - } - npc.ai[2] -= 0.25f; //0.75 - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 2) - { - npc.ai[2] -= 0.75f; //1 - } - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 3) - { - npc.ai[2] -= 0.75f; //1.25 - } - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 4) - { - npc.ai[2] -= 0.5f; //1.75 - } - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 5) - { - npc.ai[2] -= 0.5f; //1.25 - } - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 6) - { - npc.ai[2] -= 0.25f; //2 - } - } - } - else if (npc.type == NPCID.GolemHead && !CalamityWorld.bossRushActive) - { - bool enrage = true; - if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; - Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == 87) - { - enrage = false; - } - } - if (npc.ai[0] == 1f) - { - if (enrage) - { - npc.ai[1] += 3f; - } - npc.ai[1] -= 0.25f; //0.75 - if ((double)npc.life < (double)npc.lifeMax * 0.4) - { - npc.ai[1] -= 0.75f; //1 - } - if ((double)npc.life < (double)npc.lifeMax * 0.2) - { - npc.ai[1] -= 0.75f; //1.25 - } - if (enrage) - { - npc.ai[2] += 3f; - } - npc.ai[2] -= 0.25f; //0.75 - if (npc.life < npc.lifeMax / 3) - { - npc.ai[2] -= 0.75f; //1 - } - if (npc.life < npc.lifeMax / 4) - { - npc.ai[2] -= 0.75f; //1.25 - } - if (npc.life < npc.lifeMax / 5) - { - npc.ai[2] -= 0.75f; //1.5 - } - } - } - #endregion - #region Plantera - else if (npc.type == NPCID.Plantera) - { - bool jungle = Main.player[npc.target].ZoneJungle; - if (npc.life < npc.lifeMax / 8 || CalamityWorld.bossRushActive) - { - npc.velocity.X *= 1.003f; - npc.velocity.Y *= 1.003f; - } - else if (npc.life < npc.lifeMax / 4) - { - npc.velocity.X *= 1.001f; - npc.velocity.Y *= 1.001f; - } - else if (npc.life < npc.lifeMax / 2) - { - npc.velocity.X *= 1.0005f; - npc.velocity.Y *= 1.0005f; - } - if (npc.life > npc.lifeMax / 2) - { - npc.defense = 42; - if (!jungle && !CalamityWorld.bossRushActive) - { - npc.defense = 200; - npc.damage = (int)(120f * Main.damageMultiplier); - } - if (Main.netMode != 1) - { - npc.localAI[1] += ((enraged || configBossRushBoost) ? 3f : 1.5f); - } - } - else - { - npc.defense = 22; - if (!jungle && !CalamityWorld.bossRushActive) - { - npc.defense = 400; - npc.damage = (int)(200f * Main.damageMultiplier); - } - newAI[0] += 1f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - newAI[0] += 0.5f; - } - if (newAI[0] >= ((enraged || configBossRushBoost) ? 150f : 270f)) - { - newAI[0] = 0f; - if (Main.netMode != 1 && NPC.CountNPCS(NPCID.PlanterasTentacle) < 20) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - if (CalamityWorld.death || (double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) - { - newAI[1] += 1f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - newAI[1] += 0.5f; - } - if (!jungle) - { - newAI[1] += 2f; - } - 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)) - { - Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; - if (Main.netMode != 1) - { - float num418 = (!jungle ? 24f : 12f); - int num419 = 32; - int num420 = 277; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num351 = num418 / num351; - num349 *= num351; - num350 *= num351; - num349 += (float)Main.rand.Next(-10, 11) * 0.05f; - num350 += (float)Main.rand.Next(-10, 11) * 0.05f; - vector34.X += num349 * 4f; - vector34.Y += num350 * 4f; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - npc.localAI[1] += 1f; - } - } - if (npc.type == NPCID.PlanterasTentacle) - { - bool jungle = Main.player[npc.target].ZoneJungle; - newAI[0] += 1f; - if (CalamityWorld.death || !jungle) - { - newAI[0] += 1f; - } - if (newAI[0] >= 480f) - { - newAI[0] = 0f; - if (Main.netMode != 1 && NPC.CountNPCS(NPCID.Spore) < 20) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } - #endregion - #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 || targetFloatingUp) - { - npc.localAI[0] += 1f; - if ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[0] += 1f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[0] += 1f; - } - if (npc.localAI[0] >= ((enraged || configBossRushBoost) ? 90f : 120f)) - { - npc.localAI[0] = 0f; - Vector2 vector16 = npc.Center; - float num157 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector16.X; - float num158 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector16.Y; - Math.Sqrt((double)(num157 * num157 + num158 * num158)); - if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num159 = 7f; - float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; - Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= num159; - value += npc.velocity; - num160 = value.X; - num161 = value.Y; - int num163 = 27; - int num164 = 270; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 300; - } - } - } - 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 || 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); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = 30; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int projectile = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 6f), (float)(Math.Cos(offsetAngle) * 6f), 100, damage, 0f, Main.myPlayer, 0f, 0f); - int projectile2 = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 6f), (float)(-Math.Cos(offsetAngle) * 6f), 100, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].timeLeft = 300; - Main.projectile[projectile2].timeLeft = 300; - Main.projectile[projectile].tileCollide = false; - Main.projectile[projectile2].tileCollide = false; - } - } - } - } - if (npc.ai[1] == 1f) - { - int speed = CalamityWorld.bossRushActive ? 7 : 3; - if ((double)npc.life <= (double)npc.lifeMax * 0.7) - { - speed++; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.3) - { - speed++; - } - if (enraged || configBossRushBoost) - { - speed += 3; - } - float speed2 = (float)speed; - float speedBuff = 3f + (3f * (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; - float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445)); - speed2 += num446 / 100f; - if (speed2 < speedBuff) - { - speed2 = speedBuff; - } - if (speed2 > speedBuff2) - { - speed2 = speedBuff2; - } - if (targetFloatingUp) - { - speed2 += 5f; - } - num446 = speed2 / num446; - npc.velocity.X = num444 * num446; - npc.velocity.Y = num445 * num446; - } - } - else if (npc.type == NPCID.PrimeLaser) - { - if (Main.netMode != 1) - { - npc.localAI[0] += 2f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.localAI[0] += 2f; - } - } - } - else if (npc.type == NPCID.PrimeCannon) - { - npc.TargetClosest(true); - Vector2 vector61 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num499 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector61.X; - float num500 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector61.Y; - npc.rotation = (float)Math.Atan2((double)num500, (double)num499) - 1.57f; - if (Main.netMode != 1) - { - npc.localAI[0] = 0f; - npc.localAI[1] += 1f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 1f; - } - if (npc.ai[2] == 1f) - { - npc.localAI[1] += 2f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 2f; - } - } - if (npc.localAI[1] > ((enraged || configBossRushBoost) ? 90f : 120f)) - { - npc.localAI[1] = 0f; - 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 num941 = 9f; //speed - 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; - int num945 = 27; - int num946 = 303; - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num947].timeLeft = 180; - npc.netUpdate = true; - } - } - } - } - #endregion - #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) - { - spazAlive = Main.npc[fireEye].active; - } - if (npc.ai[0] == 0f) - { - double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8 : 0.6); - if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) - { - if (spazAlive) - { - if (Main.npc[fireEye].ai[0] == 1f || Main.npc[fireEye].ai[0] == 2f || Main.npc[fireEye].ai[0] == 0f) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - } - else - { - npc.dontTakeDamage = false; - } - npc.defense = npc.defDefense + 20; - if (npc.ai[1] == 0f) - { - npc.ai[2] += (spazAlive ? 0.25f : 0.5f); - npc.localAI[1] += (spazAlive ? 0.5f : 1f); - } - else - { - 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 || 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); - float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; - if (Main.netMode != 1) - { - float num353 = 8f; - int num354 = 29; - int num355 = mod.ProjectileType("ScavengerLaser"); - vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num349 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector34.X; - num350 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector34.Y; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num351 = num353 / num351; - num349 *= num351; - num350 *= num351; - vector34.X += num349; - vector34.Y += num350; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num355, num354, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else if (npc.type == NPCID.Spazmatism) - { - bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; - fireEye = npc.whoAmI; - bool retAlive = false; - if (laserEye != -1) - { - retAlive = Main.npc[laserEye].active; - } - if (npc.ai[0] == 0f) - { - double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8 : 0.6); - if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) - { - if (retAlive) - { - if (Main.npc[laserEye].ai[0] == 1f || Main.npc[laserEye].ai[0] == 2f || Main.npc[laserEye].ai[0] == 0f) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - } - else - { - npc.dontTakeDamage = false; - } - npc.defense = npc.defDefense + 30; - if (npc.ai[1] == 0f) - { - if (!Main.player[npc.target].dead) - { - newAI[0] += 1f; - } - 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)) - { - Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; - if (Main.netMode != 1) - { - float num418 = ((enraged || configBossRushBoost) ? 25f : 18f); - int num419 = 30; - int num420 = 96; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num351 = num418 / num351; - num349 *= num351; - num350 *= num351; - num349 += (float)Main.rand.Next(-30, 31) * 0.05f; - num350 += (float)Main.rand.Next(-30, 31) * 0.05f; - vector34.X += num349 * 4f; - vector34.Y += num350 * 4f; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - 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 || configBossRushBoost) - { - npc.velocity.X *= 1.01f; - npc.velocity.Y *= 1.01f; - } - } - else - { - 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 ? 1f : 1.001f); - npc.velocity.Y *= (retAlive ? 1f : 1.001f); - } - if (enraged || configBossRushBoost) - { - npc.velocity.X *= 1.003f; - npc.velocity.Y *= 1.003f; - } - } - } - } - #endregion - #region TheDestroyer - else if (npc.type == NPCID.TheDestroyerBody) - { - bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; - int defenseUp = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); - if (targetFloatingUp) - { - if (newAI[2] < 480f) //8 seconds - newAI[2] += 1f; - } - else - { - if (newAI[2] > 0f) - newAI[2] -= 1f; - } - npc.defense = npc.defDefense + defenseUp; - npc.localAI[0] = 0f; - int shootTime = ((enraged || configBossRushBoost) ? 8 : 4); - if (CalamityWorld.bossRushActive) - { - shootTime += 1; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - shootTime += 1; - } - if (Main.netMode != 1) - { - newAI[0] += (float)Main.rand.Next(shootTime); - if (newAI[0] >= (float)Main.rand.Next(1400, 26000)) - { - newAI[0] = 0f; - 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 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)) - { - laserSpeedBoost = System.Math.Abs(Main.player[npc.target].velocity.Y); - } - float speed = 2f + laserSpeedBoost; - if (speed < 7f) - { - speed = 7f; - } - if (speed > 10f) - { - speed = 10f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.7) - { - speed += 0.25f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.4 || CalamityWorld.bossRushActive) - { - speed += CalamityWorld.death ? 0.33f : 0.25f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - speed += CalamityWorld.death ? 0.33f : 0.25f; - } - int num9 = 28; - int num10 = 100; - int value = (CalamityWorld.bossRushActive ? 3 : 4); - 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); - num9 = 31; - } - 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 num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y; - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - vector.X += num6 * 5f; - vector.Y += num7 * 5f; - int num11 = Projectile.NewProjectile(vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f); - if (num10 != mod.ProjectileType("DestroyerHomingLaser")) - { - Main.projectile[num11].timeLeft = 300; - } - npc.netUpdate = true; - } - } - } - } - #endregion - #region WallofFlesh - else if (npc.type == NPCID.WallofFlesh) - { - if (enraged || configBossRushBoost) - { - npc.velocity.X *= 1.7f; - } - else if (CalamityWorld.bossRushActive) - { - npc.velocity.X *= 1.3f; - } - else if (CalamityWorld.death) - { - npc.velocity.X *= 1.18f; - } - else - { - npc.velocity.X *= 1.12f; - } - } - else if (npc.type == NPCID.WallofFleshEye) - { - if (NPC.CountNPCS(NPCID.WallofFlesh) > 0) - { - Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; - bool flag30 = true; - if (npc.direction > 0) - { - if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) < npc.position.X + (float)(npc.width / 2)) - { - flag30 = false; - } - } - else if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) > npc.position.X + (float)(npc.width / 2)) - { - flag30 = false; - } - if (Main.netMode != 1) - { - int num352 = ((enraged || configBossRushBoost) ? 7 : 4); - npc.localAI[1] = 0f; - 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; - num352++; - } - if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5) - { - npc.localAI[3] += 1f; - num352++; - } - if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25) - { - npc.localAI[3] += 1f; - num352 += 2; - } - if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[3] += 2f; - num352 += 3; - } - if (newAI[0] == 0f) - { - if (npc.localAI[3] > 600f) - { - newAI[0] = 1f; - npc.localAI[3] = 0f; - return; - } - } - else if (npc.localAI[3] > 45f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[3] = 0f; - newAI[0] += 1f; - if (newAI[0] >= (float)num352) - { - newAI[0] = 0f; - } - if (flag30) - { - 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) - { - num354++; - num353 += 1f; - } - if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25) - { - num354++; - num353 += 1f; - } - if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num354 += 2; - num353 += 2f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num353 += 1f; - } - vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num349 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector34.X; - num350 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector34.Y; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num351 = num353 / num351; - num349 *= num351; - num350 *= num351; - vector34.X += num349; - vector34.Y += num350; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num355, num354, 0f, Main.myPlayer, 0f, 0f); - return; - } - } - } - } - } - #endregion - #region Skeletron - else if (npc.type == NPCID.SkeletronHand) - { - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 0f) - { - npc.ai[3] += ((enraged || configBossRushBoost) ? 1.5f : 0.5f); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.ai[3] += 1f; - } - } - } - } - else if (npc.type == NPCID.SkeletronHead || npc.type == NPCID.DungeonGuardian) - { - if (npc.ai[1] == 1f) - { - if (Main.netMode != 1) - { - npc.localAI[1] += ((enraged || configBossRushBoost) ? 6f : 3f); - if ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 3f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.15 || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 3f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.localAI[1] += 3f; - } - if (npc.localAI[1] >= 500f) - { - npc.localAI[1] = 0f; - Vector2 vector16 = npc.Center; - if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num159 = 5f; - float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; - Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= num159; - value += npc.velocity; - num160 = value.X; - num161 = value.Y; - int num163 = 20; - int num164 = 270; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 300; - } - } - } - Vector2 vector20 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num173 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector20.X; - 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 || configBossRushBoost) { num176 += 3f; } - if (num175 > 150f) - { - num176 *= 1.05f; - } - if (num175 > 200f) - { - num176 *= 1.1f; - } - if (num175 > 250f) - { - num176 *= 1.1f; - } - if (num175 > 300f) - { - num176 *= 1.1f; - } - if (num175 > 350f) - { - num176 *= 1.1f; - } - if (num175 > 400f) - { - num176 *= 1.1f; - } - if (num175 > 450f) - { - num176 *= 1.1f; - } - if (num175 > 500f) - { - num176 *= 1.1f; - } - if (num175 > 550f) - { - num176 *= 1.1f; - } - if (num175 > 600f) - { - num176 *= 1.1f; - } - num175 = num176 / num175; - npc.velocity.X = num173 * num175; - npc.velocity.Y = num174 * num175; - } - else if (npc.ai[1] == 2f) - { - Vector2 vector21 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num177 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector21.X; - float num178 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector21.Y; - float num179 = (float)Math.Sqrt((double)(num177 * num177 + num178 * num178)); - num179 = 12f / num179; - npc.velocity.X = num177 * num179; - npc.velocity.Y = num178 * num179; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 60f) - { - npc.localAI[1] = 0f; - Vector2 vector16 = npc.Center; - if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num159 = 5f; - float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; - Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= num159; - value += npc.velocity; - num160 = value.X; - num161 = value.Y; - int num163 = 2500; - int num164 = 270; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 300; - } - } - } - } - } - #endregion - #region QueenBee - else if (npc.type == NPCID.QueenBee) - { - Vector2 vector74 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - if (npc.ai[0] == 1f) - { - npc.ai[1] += 1f; - } - else if (npc.ai[0] == 3f) - { - newAI[0] += 1f; - bool flag39 = false; - if (CalamityWorld.death) - { - if (newAI[0] % 10f == 9f) - { - flag39 = true; - } - } - else if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - if (newAI[0] % 20f == 19f) - { - flag39 = true; - } - } - else if (npc.life < npc.lifeMax / 3) - { - if (newAI[0] % 35f == 34f) - { - flag39 = true; - } - } - else if (npc.life < npc.lifeMax / 2) - { - if (newAI[0] % 50f == 49f) - { - flag39 = true; - } - } - else if (newAI[0] % 55f == 54f) - { - flag39 = true; - } - if (flag39 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector74, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Main.PlaySound(SoundID.Item17, npc.position); - if (Main.netMode != 1) - { - float num602 = 13f; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num602 += 3f; - } - if (CalamityWorld.death) - { - num602 += 2f; - } - float num603 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector74.X + (float)Main.rand.Next(-80, 81); - float num604 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector74.Y + (float)Main.rand.Next(-40, 41); - float num605 = (float)Math.Sqrt((double)(num603 * num603 + num604 * num604)); - num605 = num602 / num605; - num603 *= num605; - num604 *= num605; - int num606 = 13; - int num607 = 55; - int num608 = Projectile.NewProjectile(vector74.X, vector74.Y, num603, num604, num607, num606, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num608].timeLeft = 300; - } - } - } - } - #endregion - #region BrainofCthulhu - else if (npc.type == NPCID.BrainofCthulhu) - { - if (CalamityWorld.death) - { - if (npc.ai[0] < 0f) - { - newAI[0] += 1f; - if (newAI[0] >= 480f) - { - newAI[0] = 0f; - if (Main.netMode != 1 && NPC.CountNPCS(NPCID.Creeper) < 15) - { - int creeper = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), 267, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[creeper].netUpdate = true; - } - npc.netUpdate = true; - } - } - } - else - { - newAI[0] += 1f; - if (newAI[0] >= 600f) - { - newAI[0] = 0f; - if (Main.netMode != 1 && NPC.CountNPCS(NPCID.Creeper) < 10) - { - int creeper = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), 267, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[creeper].netUpdate = true; - } - npc.netUpdate = true; - } - } - if (npc.ai[0] < 0f) - { - npc.knockBackResist = (CalamityWorld.death ? 0.05f : 0.1f) * Main.expertKnockBack; - npc.velocity.X *= 1.006f; - npc.velocity.Y *= 1.006f; - if (CalamityWorld.death) - { - npc.velocity.X *= 1.003f; - npc.velocity.Y *= 1.003f; - } - } - } - else if (npc.type == NPCID.Creeper) - { - if (npc.ai[0] != 0f) - { - Vector2 value = Main.player[npc.target].Center - npc.Center; - value.Normalize(); - value *= 9f; - npc.velocity = (npc.velocity * 99f + value) / 98f; //100 - } - } - #endregion - #region EaterofWorlds - else if (npc.type == NPCID.EaterofWorldsHead && !CalamityWorld.bossRushActive) - { - if (!Main.player[npc.target].dead) - { - newAI[0] += 1f; - if (CalamityWorld.death) - { - newAI[0] += 2f; - } - } - if (newAI[0] >= 180f) - { - 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)) - { - Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; - if (Main.netMode != 1) - { - float num418 = 12f; - int num419 = 12; - int num420 = 96; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num351 = num418 / num351; - num349 *= num351; - num350 *= num351; - num349 += (float)Main.rand.Next(-40, 41) * 0.05f; - num350 += (float)Main.rand.Next(-40, 41) * 0.05f; - vector34.X += num349 * 4f; - vector34.Y += num350 * 4f; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - #endregion - #region KingSlime - else if (npc.type == NPCID.KingSlime) - { - bool move = false; - if (npc.ai[1] == 5f) - { - move = true; - npc.ai[0] += 3f; - if (CalamityWorld.death) - { - npc.ai[0] += 2f; - } - } - else if (npc.ai[1] == 6f) - { - move = true; - npc.ai[0] += 3f; - if (CalamityWorld.death) - { - npc.ai[0] += 2f; - } - } - if (npc.velocity.Y == 0f) - { - if (!move) - { - npc.ai[0] += 4f; - if (CalamityWorld.death) - { - npc.ai[0] += 4f; - } - } - } - } - #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 - } - #endregion - - #region PostAI - public override void PostAI(NPC npc) - { - if (pearlAura && !CalamityPlayer.areThereAnyDamnBosses) - { - npc.velocity.X *= 0.95f; - npc.velocity.Y *= 0.95f; - } - if (silvaStun && !CalamityWorld.bossRushActive) - { - npc.velocity.X = 0f; - npc.velocity.Y = 0f; - } - } - #endregion - - #region OnHitPlayer - public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit) - { - if (target.GetModPlayer(mod).snowman) - { - if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil) - { - target.AddBuff(mod.BuffType("PopoNoseless"), 36000); - } - } - if (npc.type == NPCID.GolemHead) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 300); - } - else if (npc.type == NPCID.GolemHeadFree) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 300); - } - else if (npc.type == NPCID.Golem) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 300); - } - else if (npc.type == NPCID.GolemFistRight) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 300); - } - else if (npc.type == NPCID.GolemFistLeft) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 300); - } - if (CalamityWorld.revenge) - { - if (Config.RevengeanceAndDeathThoriumBossBuff) - { - Mod thorium = ModLoader.GetMod("ThoriumMod"); - if (thorium != null) - { - if (npc.type == thorium.NPCType("GraniteEnergyStorm") || npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || - npc.type == thorium.NPCType("TheBuriedWarrior2") || npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") || - npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore") || npc.type == thorium.NPCType("SlagFury") || - npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") || npc.type == thorium.NPCType("Aquaius") || - npc.type == thorium.NPCType("Aquaius2")) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == thorium.NPCType("ViscountBaby") || npc.type == thorium.NPCType("EnemyBeholder") || npc.type == thorium.NPCType("AbyssalSpawn") || - npc.type == thorium.NPCType("Viscount") || npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2") || - npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless") || npc.type == thorium.NPCType("Abyssion") || - npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased")) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - target.AddBuff(mod.BuffType("Horror"), 180); - } - } - } - - if (npc.type == NPCID.DemonEye) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.EyeofCthulhu) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.ServantofCthulhu) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.EaterofSouls) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.DevourerHead) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.EaterofWorldsHead) - { - target.AddBuff(mod.BuffType("Horror"), 180); - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.EaterofWorldsBody) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.EaterofWorldsTail) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.BurningSphere) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.ChaosBall) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.CursedSkull) - { - target.AddBuff(mod.BuffType("Horror"), 120); - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.SkeletronHead) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.SkeletronHand) - { - target.AddBuff(mod.BuffType("Horror"), 120); - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.ManEater) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.Snatcher) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 60); - } - else if (npc.type == NPCID.CorruptBunny) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.CorruptGoldfish) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.Demon) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.VoodooDemon) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.DungeonGuardian) - { - target.AddBuff(mod.BuffType("Horror"), 1200); - } - else if (npc.type == NPCID.Mummy) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.DarkMummy) - { - target.AddBuff(mod.BuffType("Horror"), 180); - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.CorruptSlime) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.Wraith) - { - target.AddBuff(mod.BuffType("Horror"), 240); - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.EnchantedSword) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.Mimic) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 240); - } - else if (npc.type == NPCID.Werewolf) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.CursedHammer) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.Corruptor) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.SeekerHead) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.Clinger) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.VileSpit) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.WallofFlesh) - { - target.AddBuff(mod.BuffType("Horror"), 300); - } - else if (npc.type == NPCID.TheHungry) - { - target.AddBuff(mod.BuffType("Horror"), 120); - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.TheHungryII) - { - target.AddBuff(mod.BuffType("Horror"), 120); - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.LeechHead) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.Slimer) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.WanderingEye) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.Spazmatism) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.PrimeSaw) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.PrimeVice) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.Probe) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.RedDevil) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.VampireBat) - { - target.AddBuff(mod.BuffType("Horror"), 240); - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.Vampire) - { - target.AddBuff(mod.BuffType("Horror"), 240); - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.Frankenstein) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.BlackRecluse) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.WallCreeper) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.WallCreeperWall) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.SwampThing) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.AngryTrapper) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 240); - } - else if (npc.type == NPCID.CorruptPenguin) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.Crimera) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.Herpling) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.CrimsonAxe) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.FaceMonster) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.FloatyGross) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.Crimslime) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type >= 190 && npc.type <= 194) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.Nymph) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.BlackRecluseWall) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.BloodCrawler) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.BloodCrawlerWall) - { - target.AddBuff(mod.BuffType("Horror"), 60); - } - else if (npc.type == NPCID.BloodFeeder) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.QueenBee) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.GolemFistLeft) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.GolemFistRight) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.BloodJelly) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.Eyezor) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.Reaper) - { - target.AddBuff(mod.BuffType("Horror"), 240); - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.BrainofCthulhu) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.Creeper) - { - target.AddBuff(mod.BuffType("Horror"), 60); - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.IchorSticker) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.DungeonSpirit) - { - target.AddBuff(mod.BuffType("Horror"), 300); - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.GiantCursedSkull) - { - target.AddBuff(mod.BuffType("Horror"), 180); - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type >= 305 && npc.type <= 314) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.Spore) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.BoneLee) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.HeadlessHorseman) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.Ghost) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.MourningWood) - { - target.AddBuff(mod.BuffType("Horror"), 240); - } - else if (npc.type == NPCID.Splinterling) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.Pumpking) - { - target.AddBuff(mod.BuffType("Horror"), 240); - } - else if (npc.type == NPCID.PumpkingBlade) - { - target.AddBuff(mod.BuffType("Horror"), 120); - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.Hellhound) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.Poltergeist) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.Krampus) - { - target.AddBuff(mod.BuffType("Horror"), 300); - } - else if (npc.type == NPCID.Flocko) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.DetonatingBubble) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 360); - } - else if (npc.type == NPCID.DukeFishron) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.Sharkron) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.Sharkron2) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.Butcher) - { - target.AddBuff(mod.BuffType("Horror"), 180); - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.CreatureFromTheDeep) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.Fritz) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.Nailhead) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.CrimsonBunny) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.CrimsonGoldfish) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.Psycho) - { - target.AddBuff(mod.BuffType("Horror"), 180); - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.DrManFly) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.ThePossessed) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.CrimsonPenguin) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.Mothron) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.ShadowFlameApparition) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.BoneLee) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.MartianDrone) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - else if (npc.type == NPCID.MoonLordFreeEye) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 300); - } - else if (npc.type == NPCID.Medusa) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.BloodZombie) - { - target.AddBuff(mod.BuffType("Horror"), 120); - target.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - else if (npc.type == NPCID.Drippler) - { - target.AddBuff(mod.BuffType("Horror"), 120); - } - else if (npc.type == NPCID.AncientCultistSquidhead) - { - target.AddBuff(mod.BuffType("Horror"), 240); - target.AddBuff(mod.BuffType("MarkedforDeath"), 240); - } - else if (npc.type == NPCID.AncientDoom) - { - target.AddBuff(mod.BuffType("Horror"), 300); - target.AddBuff(mod.BuffType("MarkedforDeath"), 300); - } - else if (npc.type == NPCID.SandsharkCorrupt) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - else if (npc.type == NPCID.SandsharkCrimson) - { - target.AddBuff(mod.BuffType("Horror"), 180); - } - } - } - #endregion - - #region ModifyHitByProjectile - public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (npc.type == NPCID.TheDestroyerBody || npc.type == mod.NPCType("AquaticScourgeBody") || npc.type == mod.NPCType("AquaticScourgeBodyAlt")) - { - if (projectile.type == ProjectileID.RainFriendly || projectile.type == ProjectileID.BloodRain || - projectile.type == mod.ProjectileType("Shaderain") || projectile.aiStyle == 4 || - projectile.type == ProjectileID.CrystalPulse2 || projectile.type == ProjectileID.HallowStar || - projectile.type == mod.ProjectileType("FossilShardThrown")) - damage = (int)((double)damage * 0.65); - } - if (Main.player[projectile.owner].GetModPlayer(mod).eGauntlet) - { - if (projectile.melee && ShouldAffectNPC(npc) && Main.rand.Next(15) == 0) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - damage = npc.lifeMax * 3; - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).eTalisman) - { - if (projectile.magic && ShouldAffectNPC(npc) && Main.rand.Next(15) == 0) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - damage = npc.lifeMax * 3; - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).nanotech) - { - if (projectile.GetGlobalProjectile(mod).rogue && ShouldAffectNPC(npc) && Main.rand.Next(15) == 0) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - damage = npc.lifeMax * 3; - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).eQuiver) - { - if (projectile.ranged && ShouldAffectNPC(npc) && Main.rand.Next(15) == 0) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - damage = npc.lifeMax * 3; - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).statisBeltOfCurses) - { - if ((projectile.minion || CalamityMod.projectileMinionList.Contains(projectile.type)) && ShouldAffectNPC(npc) && Main.rand.Next(15) == 0) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - damage = npc.lifeMax * 3; - } - } - } - #endregion - - #region OnHitByItem - public override void OnHitByItem(NPC npc, Player player, Item item, int damage, float knockback, bool crit) - { - if (player.GetModPlayer(mod).bloodflareSet) - { - if (!npc.SpawnedFromStatue && npc.damage > 0 && ((double)npc.life < (double)npc.lifeMax * 0.5) && - player.GetModPlayer(mod).bloodflareHeartTimer <= 0) - { - player.GetModPlayer(mod).bloodflareHeartTimer = 180; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 58, 1, false, 0, false, false); - } - else if (!npc.SpawnedFromStatue && npc.damage > 0 && ((double)npc.life > (double)npc.lifeMax * 0.5) && - player.GetModPlayer(mod).bloodflareManaTimer <= 0) - { - player.GetModPlayer(mod).bloodflareManaTimer = 180; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 184, 1, false, 0, false, false); - } - } - } - #endregion - - #region OnHitByProjectile - public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit) - { - if (Main.player[projectile.owner].GetModPlayer(mod).sGenerator) - { - if (projectile.minion && npc.damage > 0) - { - switch (Main.rand.Next(3)) - { - case 0: Main.player[projectile.owner].AddBuff(mod.BuffType("SpiritGeneratorAtkBuff"), 120); break; - case 1: Main.player[projectile.owner].AddBuff(mod.BuffType("SpiritGeneratorRegenBuff"), 120); break; - case 2: Main.player[projectile.owner].AddBuff(mod.BuffType("SpiritGeneratorDefBuff"), 120); break; - } - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).bloodflareSet) - { - if (!npc.SpawnedFromStatue && npc.damage > 0 && ((double)npc.life < (double)npc.lifeMax * 0.5) && - Main.player[projectile.owner].GetModPlayer(mod).bloodflareHeartTimer <= 0) - { - Main.player[projectile.owner].GetModPlayer(mod).bloodflareHeartTimer = 180; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 58, 1, false, 0, false, false); - } - else if (!npc.SpawnedFromStatue && npc.damage > 0 && ((double)npc.life > (double)npc.lifeMax * 0.5) && - Main.player[projectile.owner].GetModPlayer(mod).bloodflareManaTimer <= 0) - { - Main.player[projectile.owner].GetModPlayer(mod).bloodflareManaTimer = 180; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 184, 1, false, 0, false, false); - } - } - } - #endregion - - #region CheckDead - public override bool CheckDead(NPC npc) - { - if (npc.lifeMax > 1000 && npc.type != 288 && - npc.type != mod.NPCType("PhantomSpirit") && - npc.type != mod.NPCType("PhantomSpiritS") && - npc.type != mod.NPCType("PhantomSpiritM") && - npc.type != mod.NPCType("PhantomSpiritL") && - npc.value > 0f && npc.HasPlayerTarget && - NPC.downedMoonlord && - Main.player[npc.target].ZoneDungeon) - { - int maxValue = 6; - if (Main.expertMode) - { - maxValue = 4; - } - if (Main.rand.Next(maxValue) == 0 && Main.wallDungeon[(int)Main.tile[(int)npc.Center.X / 16, (int)npc.Center.Y / 16].wall]) - { - int randomType = Main.rand.Next(4); - if (randomType == 0) - { - randomType = mod.NPCType("PhantomSpirit"); - } - else if (randomType == 1) - { - randomType = mod.NPCType("PhantomSpiritS"); - } - else if (randomType == 2) - { - randomType = mod.NPCType("PhantomSpiritM"); - } - else - { - randomType = mod.NPCType("PhantomSpiritL"); - } - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, randomType, 0, 0f, 0f, 0f, 0f, 255); - } - } - return true; - } - #endregion - - #region HitEffect - public override void HitEffect(NPC npc, int hitDirection, double damage) - { - if (CalamityWorld.revenge) - { - switch (npc.type) - { - case NPCID.MotherSlime: - if (npc.life <= 0) - { - if (Main.netMode != 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; - } - } - } - #endregion - - #region EditSpawnRate - public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns) - { - if (player.GetModPlayer(mod).ZoneSulphur) - { - spawnRate = (int)((double)spawnRate * 1.1); - maxSpawns = (int)((float)maxSpawns * 0.8f); - if (Main.raining) - { - spawnRate = (int)((double)spawnRate * 0.7); - maxSpawns = (int)((float)maxSpawns * 1.2f); - } - } - else if (player.GetModPlayer(mod).ZoneAbyss) - { - spawnRate = (int)((double)spawnRate * 0.7); - maxSpawns = (int)((float)maxSpawns * 1.1f); - } - else if (player.GetModPlayer(mod).ZoneCalamity) - { - spawnRate = (int)((double)spawnRate * 0.9); - maxSpawns = (int)((float)maxSpawns * 1.1f); - } - else if (player.GetModPlayer(mod).ZoneAstral) - { - spawnRate = (int)((double)spawnRate * 0.6); - maxSpawns = (int)((float)maxSpawns * 1.2f); - } - else if (player.GetModPlayer(mod).ZoneSunkenSea) - { - spawnRate = (int)((double)spawnRate * 0.9); - maxSpawns = (int)((float)maxSpawns * 1.1f); - } - if (CalamityWorld.revenge) - { - spawnRate = (int)((double)spawnRate * 0.85); - } - if (CalamityWorld.death) - { - spawnRate = (int)((double)spawnRate * 0.75); - } - if (CalamityWorld.demonMode) - { - spawnRate = (int)((double)spawnRate * 0.75); - } - if (player.GetModPlayer(mod).clamity) - { - spawnRate = (int)((double)spawnRate * 0.02); - maxSpawns = (int)((float)maxSpawns * 1.5f); - } - if (player.GetModPlayer(mod).zerg && player.GetModPlayer(mod).chaosCandle) - { - spawnRate = (int)((double)spawnRate * 0.005); - maxSpawns = (int)((float)maxSpawns * 7.5f); - } - else if (player.GetModPlayer(mod).zerg) - { - spawnRate = (int)((double)spawnRate * 0.01); - maxSpawns = (int)((float)maxSpawns * 5f); - } - else if (player.GetModPlayer(mod).chaosCandle) - { - spawnRate = (int)((double)spawnRate * 0.02); - maxSpawns = (int)((float)maxSpawns * 2.5f); - } - if (player.GetModPlayer(mod).zen && player.GetModPlayer(mod).tranquilityCandle) - { - 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 && 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)); - } - else if (player.GetModPlayer(mod).tranquilityCandle) - { - spawnRate = (int)((double)spawnRate * (player.GetModPlayer(mod).ZoneAbyss ? 1.25 : 25)); - maxSpawns = (int)((float)maxSpawns * (player.GetModPlayer(mod).ZoneAbyss ? 0.875f : 0.02f)); - } - } - #endregion - - #region EditSpawnRange - public override void EditSpawnRange(Player player, ref int spawnRangeX, ref int spawnRangeY, ref int safeRangeX, ref int safeRangeY) - { - if (player.GetModPlayer(mod).ZoneAbyss) - { - spawnRangeX = (int)((double)(1920 / 16) * 0.5); //0.7 - safeRangeX = (int)((double)(1920 / 16) * 0.32); //0.52 - } - } - #endregion - - #region EditSpawnPool - public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyss || - spawnInfo.player.GetModPlayer(mod).ZoneCalamity || - spawnInfo.player.GetModPlayer(mod).ZoneSulphur || - spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea || - (spawnInfo.player.GetModPlayer(mod).ZoneAstral && !NPC.LunarApocalypseIsUp)) - { - pool[0] = 0f; - } - } - #endregion - - #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) - { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, mod.DustType("BrimstoneFlame"), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3.5f); - 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.05f, 0.01f, 0.01f); - } - if (aFlames) - { - if (Main.rand.Next(5) < 4) - { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, mod.DustType("BrimstoneFlame"), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.25f; - if (Main.rand.Next(4) == 0) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.35f; - } - } - Lighting.AddLight(npc.position, 0.025f, 0f, 0f); - } - if (pShred) - { - 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), 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.1f; - Main.dust[dust].velocity.Y += 0.25f; - if (Main.rand.Next(2) == 0) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - } - } - if (hFlames) - { - if (Main.rand.Next(5) < 4) - { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, mod.DustType("HolyFlame"), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3.5f); - 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.25f, 0.25f, 0.1f); - } - if (pFlames) - { - if (Main.rand.Next(5) < 4) - { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 89, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.15f; - if (Main.rand.Next(4) == 0) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - } - Lighting.AddLight(npc.position, 0.07f, 0.15f, 0.01f); - } - if (gsInferno) - { - if (Main.rand.Next(5) < 4) - { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 173, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.15f; - if (Main.rand.Next(4) == 0) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - } - Lighting.AddLight(npc.position, 0.1f, 0f, 0.135f); - } - if (nightwither) - { - Rectangle hitbox = npc.Hitbox; - if (Main.rand.Next(5) < 4) - { - int num3 = Utils.SelectRandom(Main.rand, new int[] - { - 173, - 27, - 234 - }); - int num4 = Dust.NewDust(hitbox.TopLeft(), npc.width, npc.height, num3, 0f, -2.5f, 0, default(Color), 1f); - Main.dust[num4].noGravity = true; - Main.dust[num4].alpha = 200; - Main.dust[num4].velocity.Y -= 0.2f; - Dust dust = Main.dust[num4]; - dust.velocity *= 1.2f; - dust = Main.dust[num4]; - dust.scale += Main.rand.NextFloat(); - } - } - if (tSad || cDepth) - { - if (Main.rand.Next(6) < 3) - { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 33, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3.5f); - Main.dust[dust].noGravity = false; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y += 0.15f; - if (Main.rand.Next(4) == 0) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - } - } - if (dFlames) - { - if (Main.rand.Next(5) < 4) - { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 173, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.15f; - if (Main.rand.Next(4) == 0) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - } - Lighting.AddLight(npc.position, 0.1f, 0f, 0.135f); - } - if (gState || eFreeze) - { - drawColor = Color.Cyan; - } - if (marked) - { - drawColor = Color.Fuchsia; - } - if (pearlAura) - { - drawColor = Color.White; - } - } - - public override Color? GetAlpha(NPC npc, Color drawColor) - { - if (Main.player[Main.myPlayer].GetModPlayer(mod).trippy) - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, npc.alpha); - if (enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - return new Color(200, 50, 50, npc.alpha); - return null; - } - - public override bool PreDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor) - { - if (Main.player[Main.myPlayer].GetModPlayer(mod).trippy) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - float num66 = 0f; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Microsoft.Xna.Framework.Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - Microsoft.Xna.Framework.Color alpha15 = npc.GetAlpha(color9); - float num212 = 0.99f; - alpha15.R = (byte)((float)alpha15.R * num212); - alpha15.G = (byte)((float)alpha15.G * num212); - alpha15.B = (byte)((float)alpha15.B * num212); - alpha15.A = (byte)((float)alpha15.A * num212); - for (int num213 = 0; num213 < 4; num213++) - { - Vector2 position9 = npc.position; - float num214 = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); - float num215 = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); - if (num213 == 0 || num213 == 2) - { - position9.X = Main.player[Main.myPlayer].Center.X + num214; - } - else - { - position9.X = Main.player[Main.myPlayer].Center.X - num214; - } - position9.X -= (float)(npc.width / 2); - if (num213 == 0 || num213 == 1) - { - position9.Y = Main.player[Main.myPlayer].Center.Y + num215; - } - else - { - position9.Y = Main.player[Main.myPlayer].Center.Y - num215; - } - position9.Y -= (float)(npc.height / 2); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(position9.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, position9.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + num66 + npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - } - return true; - } - #endregion - - #region GetChat - public override void GetChat(NPC npc, ref string chat) - { - switch (npc.type) - { - case NPCID.Guide: - if (Main.rand.Next(20) == 0 && Main.hardMode) - chat = "Could you be so kind as to, ah...check hell for me...? I left someone I kind of care about down there."; - if (Main.rand.Next(20) == 0 && CalamityWorld.spawnAstralMeteor) - chat = "I have this sudden shiver up my spine, like a meteor just fell and thousands of innocent creatures turned into monsters from the stars."; - if (Main.rand.Next(20) == 0 && NPC.downedMoonlord) - chat = "The dungeon seems even more restless than usual, watch out for the powerful abominations stirring up in there."; - if (Main.rand.Next(20) == 0 && CalamityWorld.downedProvidence) - chat = "Seems like extinguishing that butterfly caused its life to seep into the hallowed areas, try taking a peek there and see what you can find!"; - if (Main.rand.Next(20) == 0 && CalamityWorld.downedProvidence) - chat = "I've heard there is a portal of antimatter absorbing everything it can see in the dungeon, try using the Rune of Kos there!"; - break; - case NPCID.PartyGirl: - int fapsol = NPC.FindFirstNPC(mod.NPCType("FAP")); - if (Main.rand.Next(10) == 0 && fapsol != -1) - chat = "I have a feeling we're going to have absolutely fantastic parties with " + Main.npc[fapsol].GivenName + " around!"; - if (Main.rand.Next(5) == 0 && Main.eclipse) - chat = "I think my light display is turning into an accidental bug zapper. At least the monsters are enjoying it."; - if (Main.rand.Next(5) == 0 && Main.eclipse) - chat = "Ooh! I love parties where everyone wears a scary costume!"; - break; - case NPCID.Wizard: - int permadong = NPC.FindFirstNPC(mod.NPCType("DILF")); - if (Main.rand.Next(10) == 0 && permadong != -1) - chat = "I'd let " + Main.npc[permadong].GivenName + " coldheart MY icicle."; - if (Main.rand.Next(10) == 0 && CalamityWorld.spawnAstralMeteor) - chat = "Space just got way too close for comfort."; - break; - case NPCID.Dryad: - if (Main.rand.Next(5) == 0 && CalamityWorld.buffedEclipse && Main.eclipse) - chat = "There's a dark solar energy emanating from the moths that appear during this time. Ah, the moths as you progress further get more powerful...hmm...what power was Yharon holding back?"; - if (Main.rand.Next(10) == 0 && CalamityWorld.spawnAstralMeteor) - chat = "That starborne illness sits upon this land like a blister. Do even more vile forces of corruption exist in worlds beyond?"; - break; - case NPCID.Stylist: - int fapsol2 = NPC.FindFirstNPC(mod.NPCType("FAP")); - 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; - case NPCID.GoblinTinkerer: - if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) - chat = "You know...we haven't had an invasion in a while..."; - break; - case NPCID.ArmsDealer: - if (Main.rand.Next(5) == 0 && Main.eclipse) - chat = "That's the biggest moth I've ever seen for sure. You'd need one big gun to take one of those down."; - if (Main.rand.Next(10) == 0 && CalamityWorld.downedDoG) - chat = "Is it me or are your weapons getting bigger and bigger?"; - break; - case NPCID.Merchant: - if (Main.rand.Next(5) == 0 && NPC.downedMoonlord) - chat = "Each night seems only more foreboding than the last. I feel unthinkable terrors are watching your every move."; - if (Main.rand.Next(5) == 0 && Main.eclipse) - chat = "Are you daft?! Turn off those lamps!"; - if (Main.rand.Next(5) == 0 && Main.raining && CalamityWorld.sulphurTiles > 30) - chat = "If this acid rain keeps up, there'll be a shortage of Dirt Blocks soon enough!"; - break; - case NPCID.Mechanic: - int fapsol3 = NPC.FindFirstNPC(mod.NPCType("FAP")); - if (Main.rand.Next(5) == 0 && NPC.downedMoonlord) - chat = "What do you mean your traps aren't making the cut? Don't look at me!"; - if (Main.rand.Next(5) == 0 && Main.eclipse) - chat = "Um...should my nightlight be on?"; - if (Main.rand.Next(5) == 0 && fapsol3 != -1) - chat = "Well, I like " + Main.npc[fapsol3].GivenName + ", but I, ah...I have my eyes on someone else."; - break; - case NPCID.DD2Bartender: - int fapsol4 = NPC.FindFirstNPC(mod.NPCType("FAP")); - if (Main.rand.Next(5) == 0 && !Main.dayTime && Main.moonPhase == 0) - chat = "Care for a little Moonshine?"; - if (Main.rand.Next(10) == 0 && fapsol4 != -1) - chat = "Sheesh, " + Main.npc[fapsol4].GivenName + " is a little cruel, isn't she? I never claimed to be an expert on anything but ale!"; - break; - case NPCID.Pirate: - if (Main.rand.Next(5) == 0 && !CalamityWorld.downedLeviathan) - chat = "Aye, I’ve heard of a mythical creature in the oceans, singing with an alluring voice. Careful when yer fishin out there."; - if (Main.rand.Next(5) == 0 && CalamityWorld.downedAquaticScourge) - chat = "I have to thank ye again for takin' care of that sea serpent. Or was that another one..."; - break; - case NPCID.Cyborg: - if (Main.rand.Next(10) == 0 && Main.raining) - chat = "All these moments will be lost in time. Like tears...in the rain."; - if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) - chat = "Always shoot for the moon! It has clearly worked before."; - if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) - chat = "Draedon? He's...a little 'high octane' if you know what I mean."; - if (Main.rand.Next(10) == 0 && !CalamityWorld.downedPlaguebringer && NPC.downedGolemBoss) - chat = "Those oversized bugs terrorizing the jungle... Surely you of all people could shut them down!"; - break; - case NPCID.Clothier: - if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) - chat = "Who you gonna call?"; - if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) - chat = "Those screams...I’m not sure why, but I feel like a nameless fear has awoken in my heart."; - if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) - chat = "I can faintly hear ghostly shrieks from the dungeon...and not ones I’m familiar with at all. Just what is going on in there?"; - if (Main.rand.Next(10) == 0 && CalamityWorld.downedPolterghast) - chat = "Whatever that thing was, I’m glad it’s gone now."; - if (Main.rand.Next(5) == 0 && NPC.AnyNPCs(NPCID.MoonLordCore)) - chat = "Houston, we've had a problem."; - break; - case NPCID.Steampunker: - bool hasPortalGun = false; - for (int k = 0; k < 255; k++) - { - Player player = Main.player[k]; - if (player.active) - { - for (int j = 0; j < player.inventory.Length; j++) - { - if (player.inventory[j].type == ItemID.PortalGun) - { - hasPortalGun = true; - } - } - } - } - if (Main.rand.Next(5) == 0 && NPC.downedMoonlord) - chat = "Yep! I'm also considering being a space pirate now."; - if (Main.rand.Next(5) == 0 && hasPortalGun) - chat = "Just what is that contraption? It makes my Teleporters look like child's play!"; - break; - case NPCID.DyeTrader: - int permadong2 = NPC.FindFirstNPC(mod.NPCType("DILF")); - if (Main.rand.Next(5) == 0) - chat = "Have you seen those gemstone creatures in the caverns? Their colors are simply breathtaking!"; - if (Main.rand.Next(5) == 0 && permadong2 != -1) - chat = "Do you think " + Main.npc[permadong2].GivenName + " knows how to 'let it go?'"; - break; - case NPCID.TaxCollector: - int platinumCoins = 0; - for (int k = 0; k < 255; k++) - { - Player player = Main.player[k]; - if (player.active) - { - for (int j = 0; j < player.inventory.Length; j++) - { - if (player.inventory[j].type == ItemID.PlatinumCoin) - { - platinumCoins = player.inventory[j].stack; - } - } - } - } - if (Main.rand.Next(5) == 0 && platinumCoins >= 100) - chat = "BAH! Doesn't seem like I'll ever be able to quarrel with the debts of the town again!"; - if (Main.rand.Next(5) == 0 && platinumCoins >= 500) - chat = "Where and how are you getting all of this money?"; - if (Main.rand.Next(5) == 0 && !CalamityWorld.downedBrimstoneElemental) - chat = "Perhaps with all that time you've got you could check those old ruins? Certainly something of value in it for you!"; - if (Main.rand.Next(10) == 0 && CalamityWorld.downedDoG) - chat = "Devourer of what, you said? Devourer of Funds, if its payroll is anything to go by!"; - break; - case NPCID.Demolitionist: - if (Main.rand.Next(5) == 0 && CalamityWorld.downedDoG) - chat = "God Slayer Dynamite? Boy do I like the sound of that!"; - break; - } - } - #endregion - - #region ShopStuff - public override void SetupShop(int type, Chest shop, ref int nextSlot) - { - if (type == NPCID.Merchant && (Main.player[Main.myPlayer].HasItem(mod.ItemType("FirestormCannon")) || Main.player[Main.myPlayer].HasItem(mod.ItemType("SpectralstormCannon")))) - { - shop.item[nextSlot].SetDefaults(ItemID.Flare); - nextSlot++; - } - if (type == NPCID.Merchant) - { - if (NPC.downedBoss1) - { - shop.item[nextSlot].SetDefaults(ItemID.ApprenticeBait); - nextSlot++; - } - if (NPC.downedBoss2) - { - shop.item[nextSlot].SetDefaults(ItemID.JourneymanBait); - nextSlot++; - if (WorldGen.crimson) - { - shop.item[nextSlot].SetDefaults(ItemID.Vilethorn); - nextSlot++; - } - else - { - shop.item[nextSlot].SetDefaults(ItemID.TheRottedFork); - nextSlot++; - } - } - if (NPC.downedBoss3) - { - shop.item[nextSlot].SetDefaults(ItemID.MasterBait); - nextSlot++; - } - } - if (type == NPCID.ArmsDealer && (Main.player[Main.myPlayer].HasItem(mod.ItemType("Impaler")))) - { - shop.item[nextSlot].SetDefaults(ItemID.Stake); - nextSlot++; - } - if (type == NPCID.ArmsDealer) - { - if (NPC.downedBoss2) - { - if (WorldGen.crimson) - { - shop.item[nextSlot].SetDefaults(ItemID.Musket); - nextSlot++; - } - else - { - shop.item[nextSlot].SetDefaults(ItemID.TheUndertaker); - nextSlot++; - } - } - } - if (type == NPCID.Dryad) - { - shop.item[nextSlot].SetDefaults(ItemID.JungleRose); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.NaturesGift); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.GoblinBattleStandard); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); - nextSlot++; - if (NPC.downedSlimeKing) - { - shop.item[nextSlot].SetDefaults(ItemID.SlimeCrown); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedDesertScourge) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("DriedSeafood")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); - nextSlot++; - } - if (NPC.downedBoss1) - { - shop.item[nextSlot].SetDefaults(ItemID.SuspiciousLookingEye); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 3, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedCrabulon) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("DecapoditaSprout")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 4, 0, 0); - nextSlot++; - } - if (NPC.downedBoss2) - { - shop.item[nextSlot].SetDefaults(ItemID.BloodySpine); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 6, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.WormFood); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 6, 0, 0); - nextSlot++; - if (WorldGen.crimson) - { - if (Main.expertMode) - { - shop.item[nextSlot].SetDefaults(ItemID.WormScarf); - nextSlot++; - } - shop.item[nextSlot].SetDefaults(ItemID.BandofStarpower); - nextSlot++; - } - else - { - if (Main.expertMode) - { - shop.item[nextSlot].SetDefaults(ItemID.BrainOfConfusion); - nextSlot++; - } - shop.item[nextSlot].SetDefaults(ItemID.PanicNecklace); - nextSlot++; - } - } - if (CalamityWorld.downedPerforator) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("BloodyWormFood")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); - nextSlot++; - if (Main.expertMode) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("RottenBrain")); - nextSlot++; - } - } - if (CalamityWorld.downedHiveMind) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("Teratoma")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); - nextSlot++; - if (Main.expertMode) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("BloodyWormTooth")); - nextSlot++; - } - } - if (CalamityWorld.downedSlimeGod) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("OverloadedSludge")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedAquaticScourge) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("Seafood")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); - nextSlot++; - } - if (NPC.downedHalloweenKing) - { - shop.item[nextSlot].SetDefaults(ItemID.PumpkinMoonMedallion); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - } - if (NPC.downedChristmasIceQueen) - { - shop.item[nextSlot].SetDefaults(ItemID.NaughtyPresent); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - } - shop.item[nextSlot].SetDefaults(mod.ItemType("RomajedaOrchid")); - nextSlot++; - } - if (type == NPCID.GoblinTinkerer) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("MeleeLevelMeter")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("RangedLevelMeter")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("MagicLevelMeter")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("SummonLevelMeter")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("RogueLevelMeter")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); - nextSlot++; - } - if (type == NPCID.Clothier) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("BlueBrickWallUnsafe")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("BlueSlabWallUnsafe")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("BlueTiledWallUnsafe")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("GreenBrickWallUnsafe")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("GreenSlabWallUnsafe")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("GreenTiledWallUnsafe")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("PinkBrickWallUnsafe")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("PinkSlabWallUnsafe")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("PinkTiledWallUnsafe")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); - nextSlot++; - if (Main.hardMode) - { - shop.item[nextSlot].SetDefaults(ItemID.GoldenKey); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); - nextSlot++; - } - } - if (type == NPCID.Steampunker) - { - if (NPC.downedMechBoss1) - { - shop.item[nextSlot].SetDefaults(ItemID.MechanicalWorm); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); - nextSlot++; - } - if (NPC.downedMechBoss2) - { - shop.item[nextSlot].SetDefaults(ItemID.MechanicalEye); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); - nextSlot++; - } - if (NPC.downedMechBoss3) - { - shop.item[nextSlot].SetDefaults(ItemID.MechanicalSkull); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); - nextSlot++; - } - if (Main.player[Main.myPlayer].GetModPlayer(mod).ZoneAstral && CalamityWorld.spawnAstralMeteor) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("AstralSolution")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 5, 0); - nextSlot++; - } - } - if (type == NPCID.Wizard) - { - if (CalamityWorld.downedCryogen) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("CryoKey")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedBrimstoneElemental) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("CharredIdol")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedAstrageldon) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("AstralChunk")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - } - if (NPC.downedGolemBoss) - { - shop.item[nextSlot].SetDefaults(ItemID.SpectreStaff); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.InfernoFork); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.ShadowbeamStaff); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - } - if (NPC.downedMoonlord) - { - shop.item[nextSlot].SetDefaults(ItemID.CelestialSigil); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(3, 0, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedGuardians) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("ProfanedShard")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(10, 0, 0, 0); - nextSlot++; - } - } - if (type == NPCID.WitchDoctor) - { - shop.item[nextSlot].SetDefaults(ItemID.Abeemination); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 8, 0, 0); - nextSlot++; - if (NPC.downedPlantBoss) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("BulbofDoom")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); - nextSlot++; - } - if (NPC.downedGolemBoss) - { - shop.item[nextSlot].SetDefaults(ItemID.SolarTablet); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.LihzahrdPowerCell); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedScavenger) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("AncientMedallion")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 50, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedPlaguebringer) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("Abomination")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 50, 0, 0); - nextSlot++; - } - if (CalamityWorld.downedBumble) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("BirbPheromones")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(5, 0, 0, 0); - nextSlot++; - } - } - if (type == NPCID.TravellingMerchant && Main.moonPhase == 0) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("FrostBarrier")); - nextSlot++; - } - } - #endregion - - #region AnyBossNPCS - public static bool AnyBossNPCS() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - for (int i = 0; i < 200; i++) - { - 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; - } - } - return false; - } - #endregion - - #region AnyLivingPlayers - public static bool AnyLivingPlayers() - { - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && !Main.player[i].ghost) - return true; - } - return false; - } - #endregion - - #region StopRain - public static void StopRain() - { - Main.raining = false; - if (Main.netMode == 2) - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - #endregion - - #region ShouldAffectNPC - public static bool ShouldAffectNPC(NPC target) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Mothron && - target.type != NPCID.Pumpking && target.type != NPCID.TheDestroyerBody && target.type != NPCID.TheDestroyerTail && - target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCID.IceQueen && - 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) - { - return true; - } - return false; - } - #endregion - - #region OldDukeSpawn - public static void OldDukeSpawn(int plr, int Type) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Player player = Main.player[plr]; - if (!player.active || player.dead) - { - return; - } - int m = 0; - while (m < 1000) - { - Projectile projectile = Main.projectile[m]; - if (projectile.active && projectile.bobber && projectile.owner == plr) - { - int num8 = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 100, mod.NPCType("OldDuke"), 0, 0f, 0f, 0f, 0f, 255); - string typeName2 = Main.npc[num8].TypeName; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName2), 175, 75, 255, false); - return; - } - if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[] - { - Main.npc[num8].GetTypeNetName() - }), new Color(175, 75, 255), -1); - return; - } - break; - } - else - { - m++; - } - } - } - #endregion - - #region Astral things - public static void DoHitDust(NPC npc, int hitDirection, int dustType = 5, float xSpeedMult = 1f, int numHitDust = 5, int numDeathDust = 20) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection * xSpeedMult, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection * xSpeedMult, -1f, 0, default(Color), 1f); - } - } - } - - public static void DoFlyingAI(NPC npc, float maxSpeed, float acceleration, float circleTime, float minDistanceTarget = 150f, bool shouldAttackTarget = true) - { - //Pick a new target. - if (npc.target < 0 || npc.target >= 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - Player myTarget = Main.player[npc.target]; - Vector2 toTarget = (myTarget.Center - npc.Center); - float distanceToTarget = toTarget.Length(); - Vector2 maxVelocity = toTarget; - if (distanceToTarget < 3f) - { - maxVelocity = npc.velocity; - } - else - { - float magnitude = maxSpeed / distanceToTarget; - maxVelocity *= magnitude; - } - //Circular motion - npc.ai[0]++; - //y motion - if (npc.ai[0] > circleTime * 0.5f) - { - npc.velocity.Y += acceleration; - } - else - { - npc.velocity.Y -= acceleration; - } - //x motion - if (npc.ai[0] < circleTime * 0.25f || npc.ai[0] > circleTime * 0.75f) - { - npc.velocity.X += acceleration; - } - else - { - npc.velocity.X -= acceleration; - } - //reset - if (npc.ai[0] > circleTime) - { - npc.ai[0] = 0f; - } - //if close enough - if (shouldAttackTarget && distanceToTarget < minDistanceTarget) - { - npc.velocity += maxVelocity * 0.007f; - } - if (myTarget.dead) - { - maxVelocity.X = npc.direction * maxSpeed / 2f; - maxVelocity.Y = -maxSpeed / 2f; - } - //maximise velocity - if (npc.velocity.X < maxVelocity.X) - { - npc.velocity.X += acceleration; - } - if (npc.velocity.X > maxVelocity.X) - { - npc.velocity.X -= acceleration; - } - if (npc.velocity.Y < maxVelocity.Y) - { - npc.velocity.Y += acceleration; - } - if (npc.velocity.Y > maxVelocity.Y) - { - npc.velocity.Y -= acceleration; - } - //rotate towards player if alive - if (!myTarget.dead) - { - npc.rotation = toTarget.ToRotation(); - } - else //don't, do velocity instead - { - npc.rotation = npc.velocity.ToRotation(); - } - npc.rotation += MathHelper.Pi; - //tile collision - float collisionDamp = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -collisionDamp; - 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 * -collisionDamp; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5f) - { - npc.velocity.Y = 1.5f; - } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5f) - { - npc.velocity.Y = -1.5f; - } - } - //water collision - if (npc.wet) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y *= 0.95f; - } - npc.velocity.Y -= 0.3f; - if (npc.velocity.Y < -2f) npc.velocity.Y = -2f; - } - //Taken from source. Important for net? - 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 static void DoSpiderWallAI(NPC npc, int transformType, float chaseMaxSpeed = 2f, float chaseAcceleration = 0.08f) - { - //GET NEW TARGET - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(); - } - Vector2 between = Main.player[npc.target].Center - npc.Center; - float distance = between.Length(); - //modify vector depending on distance and speed. - if (distance == 0f) - { - between.X = npc.velocity.X; - between.Y = npc.velocity.Y; - } - else - { - distance = chaseMaxSpeed / distance; - between.X *= distance; - between.Y *= distance; - } - //update if target dead. - if (Main.player[npc.target].dead) - { - between.X = (float)npc.direction * chaseMaxSpeed / 2f; - between.Y = -chaseMaxSpeed / 2f; - } - npc.spriteDirection = -1; - //If spider can't see target, circle around to attempt to find the target. - if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - //CIRCULAR MOTION, SIMILAR TO FLYING AI (Eater of Souls etc.) - npc.ai[0]++; - if (npc.ai[0] > 0f) - { - npc.velocity.Y += 0.023f; - } - else - { - npc.velocity.Y -= 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X += 0.023f; - } - else - { - npc.velocity.X -= 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - npc.velocity.X += between.X * 0.007f; - npc.velocity.Y += between.Y * 0.007f; - npc.rotation = npc.velocity.ToRotation(); - if (npc.velocity.X > 1.5f) - { - npc.velocity.X *= 0.9f; - } - if (npc.velocity.X < -1.5f) - { - npc.velocity.X *= 0.9f; - } - if (npc.velocity.Y > 1.5f) - { - npc.velocity.Y *= 0.9f; - } - if (npc.velocity.Y < -1.5f) - { - npc.velocity.Y *= 0.9f; - } - npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -3f, 3f); - npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -3f, 3f); - } - else //CHASE TARGET - { - if (npc.velocity.X < between.X) - { - npc.velocity.X = npc.velocity.X + chaseAcceleration; - if (npc.velocity.X < 0f && between.X > 0f) - { - npc.velocity.X = npc.velocity.X + chaseAcceleration; - } - } - else if (npc.velocity.X > between.X) - { - npc.velocity.X = npc.velocity.X - chaseAcceleration; - if (npc.velocity.X > 0f && between.X < 0f) - { - npc.velocity.X = npc.velocity.X - chaseAcceleration; - } - } - if (npc.velocity.Y < between.Y) - { - npc.velocity.Y = npc.velocity.Y + chaseAcceleration; - if (npc.velocity.Y < 0f && between.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + chaseAcceleration; - } - } - else if (npc.velocity.Y > between.Y) - { - npc.velocity.Y = npc.velocity.Y - chaseAcceleration; - if (npc.velocity.Y > 0f && between.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - chaseAcceleration; - } - } - npc.rotation = between.ToRotation(); - } - //DAMP COLLISIONS OFF OF WALLS - float collisionDamp = 0.5f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -collisionDamp; - 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 * -collisionDamp; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5f) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5f) - { - 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; - } - if (Main.netMode != 1) - { - int x = (int)npc.Center.X / 16; - int y = (int)npc.Center.Y / 16; - bool flag = false; - for (int i = x - 1; i <= x + 1; i++) - { - for (int j = y - 1; j <= y + 1; j++) - { - if (Main.tile[i, j] == null) - { - return; - } - if (Main.tile[i, j].wall > 0) - { - flag = true; - } - } - } - if (!flag) - { - npc.Transform(transformType); - return; - } - } - } - - public static void DoVultureAI(NPC npc, float acceleration = 0.1f, float maxSpeed = 3f, int sitWidth = 30, int flyWidth = 50, int rangeX = 100, int rangeY = 100) - { - npc.localAI[0]++; - npc.noGravity = true; - npc.TargetClosest(true); - if (npc.ai[0] == 0f) - { - npc.width = sitWidth; - npc.noGravity = false; - if (Main.netMode != 1) - { - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.3) - { - npc.ai[0] = 1f; - npc.netUpdate = true; - } - else - { - Rectangle playerRect = Main.player[npc.target].getRect(); - Rectangle rangeRect = new Rectangle((int)npc.Center.X - rangeX, (int)npc.Center.Y - rangeY, rangeX * 2, rangeY * 2); - if (npc.localAI[0] > 20f && (rangeRect.Intersects(playerRect) || npc.life < npc.lifeMax)) - { - npc.ai[0] = 1f; - npc.velocity.Y -= 6f; - npc.netUpdate = true; - } - } - } - } - else if (!Main.player[npc.target].dead) - { - npc.width = flyWidth; - //Collision damping - if (npc.collideX) - { - npc.velocity.X = npc.oldVelocity.X * -0.5f; - 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.velocity.Y = npc.oldVelocity.Y * -0.5f; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) - { - npc.velocity.Y = 1f; - } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) - { - npc.velocity.Y = -1f; - } - } - if (npc.direction == -1 && npc.velocity.X > -maxSpeed) - { - npc.velocity.X -= acceleration; - if (npc.velocity.X > maxSpeed) - { - npc.velocity.X = npc.velocity.X - acceleration; - } - else if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X - acceleration * 0.5f; - } - if (npc.velocity.X < -maxSpeed) - { - npc.velocity.X = -maxSpeed; - } - } - else if (npc.direction == 1 && npc.velocity.X < maxSpeed) - { - npc.velocity.X = npc.velocity.X + acceleration; - if (npc.velocity.X < -maxSpeed) - { - npc.velocity.X = npc.velocity.X + acceleration; - } - else if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + acceleration * 0.5f; - } - if (npc.velocity.X > maxSpeed) - { - npc.velocity.X = maxSpeed; - } - } - float xDistance = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); - float yLimiter = Main.player[npc.target].position.Y - (npc.height / 2f); - if (xDistance > 50f) - { - yLimiter -= 100f; - } - if (npc.position.Y < yLimiter) - { - npc.velocity.Y = npc.velocity.Y + acceleration * 0.5f; - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y + acceleration * 0.1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y - acceleration * 0.5f; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y - acceleration * 0.1f; - } - } - if (npc.velocity.Y < -maxSpeed) - { - npc.velocity.Y = -maxSpeed; - } - if (npc.velocity.Y > maxSpeed) - { - npc.velocity.Y = maxSpeed; - } - } - //Change velocity if wet. - if (npc.wet) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.Y = npc.velocity.Y - 0.5f; - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - } - /// - /// Allows you to spawn dust on the NPC in a certain place. Uses the npc.position value as the base point for the rectangle. - /// Takes direction and rotation into account. - /// - /// The width of the sheet for the NPC. - /// The place to put a dust. - /// The chance to spawn a dust (0.3 = 30%) - public static Dust SpawnDustOnNPC(NPC npc, int frameWidth, int frameHeight, int dustType, Rectangle rect, Vector2 velocity = default(Vector2), float chance = 0.5f, bool useSpriteDirection = false) - { - Vector2 half = new Vector2(frameWidth / 2f, frameHeight / 2f); - //"flip" the rectangle's position x-wise. - if ((!useSpriteDirection && npc.direction == 1) || (useSpriteDirection && npc.spriteDirection == 1)) - { - rect.X = frameWidth - rect.Right; - } - if (Main.rand.NextFloat(1f) < chance) - { - Vector2 offset = (npc.Center - half + new Vector2(Main.rand.NextFloat(rect.Left, rect.Right), Main.rand.NextFloat(rect.Top, rect.Bottom))) - npc.Center; - offset = offset.RotatedBy(npc.rotation); - Dust d = Dust.NewDustPerfect(npc.Center + offset, dustType, velocity); - return d; - } - return null; - } - #endregion - } -} \ No newline at end of file +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 CalamityGlobalNPC : GlobalNPC + { + #region InstancePerEntity + public override bool InstancePerEntity + { + get + { + return true; + } + } + #endregion + + #region InstanceVars + //Damage reduction + private float protection = 0f; + private float defProtection = 0f; + + //NewAI + private const int maxAIMod = 4; + private float[] newAI = new float[maxAIMod]; + + //Town NPC Patreon + private bool setNewName = true; + + //Draedons Remote + public static bool DraedonMayhem = false; + + //Lunatic Cultist Rev+ attack + private int CultProjectiles = 2; + private const float CultAngleSpread = 170; + private int CultCountdown = 0; + + //Debuffs + public bool wCleave = false; + public bool bBlood = false; + public bool dFlames = false; + public bool marked = false; + public bool irradiated = false; + public bool bFlames = false; + public bool hFlames = false; + public bool pFlames = false; + public bool gState = false; + public bool aCrunch = false; + public bool tSad = false; + public bool pShred = false; + public bool cDepth = false; + public bool gsInferno = false; + public bool aFlames = false; + public bool eFreeze = false; + public bool wDeath = false; + public bool nightwither = false; + public bool silvaStun = false; + public bool enraged = false; + public bool yellowCandle = false; + public bool pearlAura = false; + public bool shellfishVore = false; + public bool clamDebuff = false; + + //whoAmI Variables + public static int bobbitWormBottom = -1; + public static int hiveMind = -1; + public static int perfHive = -1; + public static int slimeGodPurple = -1; + public static int slimeGodRed = -1; + public static int slimeGod = -1; + public static int laserEye = -1; + public static int fireEye = -1; + public static int brimstoneElemental = -1; + public static int cataclysm = -1; + public static int catastrophe = -1; + public static int calamitas = -1; + public static int leviathan = -1; + public static int siren = -1; + public static int scavenger = -1; + public static int astrumDeusHeadMain = -1; + public static int energyFlame = -1; + public static int doughnutBoss = -1; + public static int holyBossAttacker = -1; + public static int holyBossDefender = -1; + public static int holyBossHealer = -1; + public static int holyBoss = -1; + public static int voidBoss = -1; + public static int ghostBossClone = -1; + public static int ghostBoss = -1; + public static int DoGHead = -1; + public static int SCalCataclysm = -1; + public static int SCalCatastrophe = -1; + public static int SCal = -1; + public static int SCalWorm = -1; + #endregion + + #region ResetEffects + public override void ResetEffects(NPC npc) + { + if (bobbitWormBottom >= 0 && !Main.npc[bobbitWormBottom].active) + bobbitWormBottom = -1; + if (hiveMind >= 0 && !Main.npc[hiveMind].active) + hiveMind = -1; + if (perfHive >= 0 && !Main.npc[perfHive].active) + perfHive = -1; + if (slimeGodPurple >= 0 && !Main.npc[slimeGodPurple].active) + slimeGodPurple = -1; + if (slimeGodRed >= 0 && !Main.npc[slimeGodRed].active) + slimeGodRed = -1; + if (slimeGod >= 0 && !Main.npc[slimeGod].active) + slimeGod = -1; + if (laserEye >= 0 && !Main.npc[laserEye].active) + laserEye = -1; + if (fireEye >= 0 && !Main.npc[fireEye].active) + fireEye = -1; + if (brimstoneElemental >= 0 && !Main.npc[brimstoneElemental].active) + brimstoneElemental = -1; + if (cataclysm >= 0 && !Main.npc[cataclysm].active) + cataclysm = -1; + if (catastrophe >= 0 && !Main.npc[catastrophe].active) + catastrophe = -1; + if (calamitas >= 0 && !Main.npc[calamitas].active) + calamitas = -1; + if (leviathan >= 0 && !Main.npc[leviathan].active) + leviathan = -1; + if (siren >= 0 && !Main.npc[siren].active) + siren = -1; + if (scavenger >= 0 && !Main.npc[scavenger].active) + scavenger = -1; + if (astrumDeusHeadMain >= 0 && !Main.npc[astrumDeusHeadMain].active) + astrumDeusHeadMain = -1; + if (energyFlame >= 0 && !Main.npc[energyFlame].active) + energyFlame = -1; + if (doughnutBoss >= 0 && !Main.npc[doughnutBoss].active) + doughnutBoss = -1; + if (holyBossAttacker >= 0 && !Main.npc[holyBossAttacker].active) + holyBossAttacker = -1; + if (holyBossDefender >= 0 && !Main.npc[holyBossDefender].active) + holyBossDefender = -1; + if (holyBossHealer >= 0 && !Main.npc[holyBossHealer].active) + holyBossHealer = -1; + if (holyBoss >= 0 && !Main.npc[holyBoss].active) + holyBoss = -1; + if (voidBoss >= 0 && !Main.npc[voidBoss].active) + voidBoss = -1; + if (ghostBossClone >= 0 && !Main.npc[ghostBossClone].active) + ghostBossClone = -1; + if (ghostBoss >= 0 && !Main.npc[ghostBoss].active) + ghostBoss = -1; + if (DoGHead >= 0 && !Main.npc[DoGHead].active) + DoGHead = -1; + if (SCalCataclysm >= 0 && !Main.npc[SCalCataclysm].active) + SCalCataclysm = -1; + if (SCalCatastrophe >= 0 && !Main.npc[SCalCatastrophe].active) + SCalCatastrophe = -1; + if (SCal >= 0 && !Main.npc[SCal].active) + SCal = -1; + if (SCalWorm >= 0 && !Main.npc[SCalWorm].active) + SCalWorm = -1; + + wCleave = false; + bBlood = false; + dFlames = false; + marked = false; + irradiated = false; + bFlames = false; + hFlames = false; + pFlames = false; + gState = false; + aCrunch = false; + tSad = false; + pShred = false; + cDepth = false; + gsInferno = false; + aFlames = false; + eFreeze = false; + wDeath = false; + nightwither = false; + silvaStun = false; + enraged = false; + yellowCandle = false; + pearlAura = false; + shellfishVore = false; + clamDebuff = false; + } + #endregion + + #region LifeRegen + public override void UpdateLifeRegen(NPC npc, ref int damage) + { + bool hardMode = Main.hardMode; + int npcDefense = npc.defense; + 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) + { + npc.AddBuff(mod.BuffType("CrushDepth"), 2); + if (npc.DeathSound != null) + { + npc.DeathSound = null; + } + if (npc.HitSound != null) + { + npc.HitSound = null; + } + } + bool hurtByPiss = (npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && CalamityWorld.sulphurTiles > 30 && + !npc.buffImmune[BuffID.Poisoned] && !npc.buffImmune[mod.BuffType("CrushDepth")]); + if (hurtByPiss) + { + npc.AddBuff(BuffID.Poisoned, 2); + } + if (Main.raining && npc.damage > 0 && !npc.boss && + !npc.friendly && !npc.dontTakeDamage && CalamityWorld.sulphurTiles > 30 && + !npc.buffImmune[BuffID.Poisoned] && !npc.buffImmune[mod.BuffType("CrushDepth")]) + { + npc.AddBuff(mod.BuffType("Irradiated"), 2); + } + if (npc.venom) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + int num7 = 0; + for (int j = 0; j < 1000; j++) + { + if (Main.projectile[j].active && + (Main.projectile[j].type == mod.ProjectileType("Lionfish") || Main.projectile[j].type == mod.ProjectileType("SulphuricAcidCannon2")) && + Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == (float)npc.whoAmI) + { + num7++; + } + } + if (num7 > 0) + { + npc.lifeRegen -= num7 * 30; + if (damage < num7 * 6) + { + damage = num7 * 6; + } + } + } + if (shellfishVore) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + int amount = 0; + for (int j = 0; j < 1000; j++) + { + if (Main.projectile[j].active && + (Main.projectile[j].type == mod.ProjectileType("Shellfish")) && + Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == (float)npc.whoAmI && + amount < 5) + { + amount++; + } + } + npc.lifeRegen -= amount * 350; + if (damage < amount * 35) + { + damage = amount * 35; + } + } + if (clamDebuff) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + int amount = 0; + for (int j = 0; j < 1000; j++) + { + if (Main.projectile[j].active && + (Main.projectile[j].type == mod.ProjectileType("SnapClamProj")) && + Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == (float)npc.whoAmI && + amount < 2) + { + amount++; + } + } + npc.lifeRegen -= amount * 25; + if (damage < amount * 5) + { + damage = amount * 5; + } + } + if (irradiated) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 20; + if (damage < 4) + { + damage = 4; + } + } + if (cDepth) + { + if (npcDefense < 0) + { + npcDefense = 0; + } + int depthDamage = hardMode ? 80 : 12; + if (hurtByAbyss) + { + depthDamage = 300; + } + int calcDepthDamage = depthDamage - npcDefense; + if (calcDepthDamage < 0) + { + calcDepthDamage = 0; + } + int calcDepthRegenDown = calcDepthDamage * 5; + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= calcDepthRegenDown; + if (damage < calcDepthDamage) + { + damage = calcDepthDamage; + } + } + if (bFlames) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 40; + if (damage < 8) + { + damage = 8; + } + } + if (hFlames) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 50; + if (damage < 10) + { + damage = 10; + } + } + if (pFlames) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 100; + if (damage < 20) + { + damage = 20; + } + } + if (gsInferno) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 250; + if (damage < 50) + { + damage = 50; + } + } + if (aFlames) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 125; + if (damage < 25) + { + damage = 25; + } + } + if (pShred) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 1500; + if (damage < 300) + { + damage = 300; + } + } + if (gState) + { + npc.velocity.X = 0f; + npc.velocity.Y = npc.velocity.Y + 0.05f; + if (npc.velocity.Y > 15f) + { + npc.velocity.Y = 15f; + } + } + if (eFreeze && !CalamityWorld.bossRushActive) + { + npc.velocity.X = 0f; + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y > 15f) + { + npc.velocity.Y = 15f; + } + } + if (tSad) + { + npc.velocity.Y /= 2; + npc.velocity.X /= 2; + } + if (nightwither) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 200; + if (damage < 40) + { + damage = 40; + } + } + if (dFlames) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 2500; + if (damage < 500) + { + damage = 500; + } + } + if (bBlood) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 50; + if (damage < 10) + { + damage = 10; + } + } + } + #endregion + + #region SetDefaults + public override void SetDefaults(NPC npc) + { + for (int m = 0; m < maxAIMod; m++) + { + newAI[m] = 0f; + } + + if (npc.boss && CalamityWorld.revenge) + { + if (npc.type != mod.NPCType("HiveMindP2") && npc.type != mod.NPCType("Leviathan") && npc.type != mod.NPCType("StormWeaverHeadNaked") && + npc.type != mod.NPCType("StormWeaverBodyNaked") && npc.type != mod.NPCType("StormWeaverTailNaked") && + npc.type != mod.NPCType("DevourerofGodsHeadS") && npc.type != mod.NPCType("DevourerofGodsBodyS") && + npc.type != mod.NPCType("DevourerofGodsTailS")) + { + if (Main.netMode != 2) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.player[Main.myPlayer].GetModPlayer(mod).adrenaline = 0; + } + } + } + } + + if (CalamityWorld.bossRushActive) + { + if (!npc.friendly) + { + 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; + } + } + else + { + if (CalamityMod.enemyImmunityList.Contains(npc.type)) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + } + if (npc.type == NPCID.TheDestroyer || + npc.type == NPCID.TheDestroyerBody || + npc.type == NPCID.TheDestroyerTail || + npc.type == NPCID.DD2EterniaCrystal || + npc.townNPC) + { + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + if (npc.townNPC) + { + 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")]) + { + npc.buffImmune[mod.BuffType("Enraged")] = false; + } + } + + if (npc.type == NPCID.QueenBee) + { + npc.value = Item.buyPrice(0, 5, 0, 0); + } + else if (npc.type == NPCID.SkeletronHead) + { + npc.value = Item.buyPrice(0, 7, 0, 0); + } + else if (npc.type == NPCID.DukeFishron) + { + npc.value = Item.buyPrice(0, 25, 0, 0); + } + else if (npc.type == NPCID.CultistBoss) + { + npc.value = Item.buyPrice(0, 25, 0, 0); + } + else if (npc.type == NPCID.MoonLordCore) + { + npc.value = Item.buyPrice(0, 30, 0, 0); + } + if (CalamityWorld.defiled) + { + npc.value = (float)((int)((double)npc.value * 1.5)); + } + + if (CalamityWorld.bossRushActive) + { + switch (npc.type) + { + case NPCID.QueenBee: //Tier 1 + npc.lifeMax = 420000; + break; + case NPCID.BrainofCthulhu: + npc.lifeMax = 200000; + break; + case NPCID.Creeper: + npc.lifeMax = 20000; + break; + case NPCID.KingSlime: + npc.lifeMax = 500000; + break; + case NPCID.BlueSlime: + npc.lifeMax = 12000; + break; + case NPCID.SlimeSpiked: + npc.lifeMax = 24000; + break; + case NPCID.EyeofCthulhu: + npc.lifeMax = 600000; + break; + case NPCID.ServantofCthulhu: + npc.lifeMax = 60000; + break; + case NPCID.SkeletronPrime: + npc.lifeMax = 780000; + break; + case NPCID.PrimeCannon: + npc.lifeMax = 350000; + break; + case NPCID.PrimeVice: + npc.lifeMax = 440000; + break; + case NPCID.PrimeSaw: + npc.lifeMax = 450000; + break; + case NPCID.PrimeLaser: + npc.lifeMax = 280000; + break; + case NPCID.Golem: + npc.lifeMax = 450000; + break; + case NPCID.GolemHead: + npc.lifeMax = 300000; + break; + case NPCID.GolemFistLeft: + npc.lifeMax = 250000; + break; + case NPCID.GolemFistRight: + npc.lifeMax = 250000; + break; + case NPCID.EaterofWorldsHead: + npc.lifeMax = 20000; + break; + case NPCID.EaterofWorldsBody: + npc.lifeMax = 30000; + break; + case NPCID.EaterofWorldsTail: + npc.lifeMax = 40000; + break; + case NPCID.TheDestroyer: //Tier 2 + npc.lifeMax = 2500000; + break; + case NPCID.TheDestroyerBody: + npc.lifeMax = 2500000; + break; + case NPCID.TheDestroyerTail: + npc.lifeMax = 2500000; + break; + case NPCID.Probe: + npc.lifeMax = 50000; + break; + case NPCID.Spazmatism: + npc.lifeMax = 1000000; + break; + case NPCID.Retinazer: + npc.lifeMax = 700000; + break; + case NPCID.WallofFlesh: + npc.lifeMax = 2400000; + break; + case NPCID.WallofFleshEye: + npc.lifeMax = 2400000; + break; + case NPCID.SkeletronHead: + npc.lifeMax = 1300000; + break; + case NPCID.SkeletronHand: + npc.lifeMax = 500000; + break; + case NPCID.CultistBoss: //Tier 3 + npc.lifeMax = 1100000; + break; + case NPCID.CultistDragonHead: + npc.lifeMax = 400000; + break; + case NPCID.CultistDragonBody1: + npc.lifeMax = 400000; + break; + case NPCID.CultistDragonBody2: + npc.lifeMax = 400000; + break; + case NPCID.CultistDragonBody3: + npc.lifeMax = 400000; + break; + case NPCID.CultistDragonBody4: + npc.lifeMax = 400000; + break; + case NPCID.CultistDragonTail: + npc.lifeMax = 400000; + break; + case NPCID.AncientCultistSquidhead: + npc.lifeMax = 300000; + break; + case NPCID.Plantera: + npc.lifeMax = 2100000; + break; + case NPCID.PlanterasTentacle: + npc.lifeMax = 90000; + break; + case NPCID.DukeFishron: //Tier 4 + npc.lifeMax = 2500000; + break; + case NPCID.MoonLordCore: + npc.lifeMax = 1400000; + break; + case NPCID.MoonLordHand: + npc.lifeMax = 450000; + break; + case NPCID.MoonLordHead: + npc.lifeMax = 600000; + break; + case NPCID.MoonLordFreeEye: + npc.lifeMax = 1000; + break; + } + } + + if (npc.type == NPCID.CultistBoss) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.25); + else + npc.lifeMax = (int)((double)npc.lifeMax * (CalamityWorld.revenge ? 1.55 : 1.15)); + 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) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 2.7); + npc.scale *= 1.25f; + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.8); + npc.scale *= 1.2f; + } + npc.npcSlots = 10f; + } + else if (npc.type == NPCID.Probe) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); + npc.scale *= 1.25f; + } + else + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.6); + npc.scale *= 1.2f; + } + } + else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeCannon || npc.type == NPCID.PrimeSaw || npc.type == NPCID.PrimeLaser) + { + if (npc.type == NPCID.SkeletronPrime) + npc.npcSlots = 12f; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.9); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.6); + } + else if (npc.type == NPCID.Retinazer) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 3.0); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.8); + npc.npcSlots = 10f; + } + else if (npc.type == NPCID.Spazmatism) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 3.0); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.8); + npc.npcSlots = 10f; + } + } + + if (CalamityWorld.revenge) + { + npc.value = (float)((int)((double)npc.value * 1.5)); + + if (npc.type == NPCID.MoonLordFreeEye) + { + npc.lifeMax = (int)((double)npc.lifeMax * 150.0); + } + else if (npc.type == NPCID.Mothron) + { + npc.scale = 1.25f; + } + else if (npc.type == NPCID.MoonLordCore) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.4); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); + npc.npcSlots = 12f; + } + else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.4); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.2); + npc.npcSlots = 12f; + } + else if (npc.type >= 454 && npc.type <= 459) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 10.0); + else + npc.lifeMax = (int)((double)npc.lifeMax * 5.0); + } + else if (npc.type == NPCID.DukeFishron) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 3.525); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.85); + npc.npcSlots = 20f; + } + else if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) + { + npc.lifeMax = (int)((double)npc.lifeMax * 30.0); + } + else if (npc.type == NPCID.Golem) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 8.5); + else + npc.lifeMax = (int)((double)npc.lifeMax * 3.5); + npc.npcSlots = 64f; + } + else if (npc.type == NPCID.Plantera) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.9); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); + npc.npcSlots = 32f; + } + else if (npc.type == NPCID.PlanterasTentacle) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); + } + else if (npc.type == NPCID.WallofFlesh || npc.type == NPCID.WallofFleshEye) + { + if (npc.type == NPCID.WallofFlesh) + npc.npcSlots = 20f; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.6); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); + } + else if (npc.type == NPCID.TheHungryII) + { + if (CalamityWorld.death) + { + npc.noTileCollide = true; + npc.lifeMax = (int)((double)npc.lifeMax * 1.5); + } + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); + } + else if (npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody || npc.type == NPCID.LeechTail) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.5); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); + } + else if (npc.type == NPCID.SkeletronHead) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.4); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); + npc.npcSlots = 12f; + } + else if (npc.type == NPCID.SkeletronHand) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.4); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.3); + } + else if (npc.type == NPCID.QueenBee) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.65); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.15); + npc.npcSlots = 14f; + } + else if (npc.type == NPCID.BrainofCthulhu) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.4); + npc.npcSlots = 12f; + } + else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + if (npc.type == NPCID.EaterofWorldsHead) + { + npc.npcSlots = 10f; + if (CalamityWorld.death) + npc.reflectingProjectiles = true; + } + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.4); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.3); + } + else if (npc.type == NPCID.EyeofCthulhu) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.3); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); + npc.npcSlots = 10f; + } + else if (npc.type == NPCID.KingSlime) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.85); + } + 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) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.6); + npc.scale *= 1.2f; + } + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); + npc.npcSlots = 10f; + } + else if (npc.type == NPCID.Probe) + { + if (CalamityWorld.death) + { + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); + npc.scale *= 1.2f; + } + } + else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeCannon || npc.type == NPCID.PrimeSaw || npc.type == NPCID.PrimeLaser) + { + if (npc.type == NPCID.SkeletronPrime) + npc.npcSlots = 12f; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); + } + else if (npc.type == NPCID.Retinazer) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.7); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.45); + npc.npcSlots = 10f; + } + else if (npc.type == NPCID.Spazmatism) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.8); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.55); + 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 || + npc.type == NPCID.LeechBody || npc.type == NPCID.LeechTail || npc.type == NPCID.TheDestroyerBody || + npc.type == NPCID.TheDestroyerTail || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail || + npc.type == NPCID.GolemHead || npc.type == NPCID.GolemFistRight || npc.type == NPCID.GolemFistLeft || + npc.type == NPCID.MoonLordCore) + { + npc.canGhostHeal = false; + } + + if (Config.RevengeanceAndDeathThoriumBossBuff) + { + Mod thorium = ModLoader.GetMod("ThoriumMod"); + if (thorium != null) + { + if (npc.type == thorium.NPCType("Viscount") || npc.type == thorium.NPCType("BoreanStrider") || npc.type == thorium.NPCType("FallenDeathBeholder") || + npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("AbyssionReleased")) + { + protection = 0.05f; + } + else if (npc.type == thorium.NPCType("CryoCore") || npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore") || + npc.type == thorium.NPCType("Aquaius")) + { + protection = 0.1f; + } + else if (npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("FallenDeathBeholder2") || npc.type == thorium.NPCType("SlagFury") || + npc.type == thorium.NPCType("Aquaius2") || npc.type == thorium.NPCType("GraniteEnergyStorm")) + { + protection = 0.2f; + } + else if (npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || npc.type == thorium.NPCType("TheBuriedWarrior2") || + npc.type == thorium.NPCType("LichHeadless") || npc.type == thorium.NPCType("AbyssionCracked")) + { + protection = 0.25f; + } + else if (npc.type == thorium.NPCType("Omnicide")) + { + protection = 0.3f; + } + else if (npc.type == thorium.NPCType("Abyssion")) + { + protection = 0.35f; + } + } + } + + 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("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("AstrumDeusHead") || npc.type == mod.NPCType("AquaticScourgeHead") || + npc.type == mod.NPCType("Cryon") || npc.type == mod.NPCType("Cryogen")) + { + protection = 0.1f; + } + else if (npc.type == mod.NPCType("ArmoredDiggerHead") || npc.type == mod.NPCType("AstralProbe") || npc.type == mod.NPCType("Calamitas") || + npc.type == mod.NPCType("CalamitasRun") || npc.type == mod.NPCType("CalamitasRun2") || npc.type == mod.NPCType("CalamitasRun3") || + 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("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") || 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") || + npc.type == mod.NPCType("Clam") || npc.type == mod.NPCType("PrismTurtle")) + { + protection = 0.25f; + } + else if (npc.type == mod.NPCType("ProvSpawnOffense") || npc.type == mod.NPCType("GiantClam")) + { + protection = 0.3f; + } + else if (npc.type == mod.NPCType("ArmoredDiggerBody") || npc.type == mod.NPCType("AstrumDeusTail") || npc.type == mod.NPCType("DespairStone") || + npc.type == mod.NPCType("SoulSeekerSupreme") || npc.type == mod.NPCType("Leviathan")) + { + protection = 0.35f; + } + else if (npc.type == mod.NPCType("CryogenIce") || npc.type == mod.NPCType("ProfanedGuardianBoss") || npc.type == mod.NPCType("ProvSpawnDefense") || + npc.type == mod.NPCType("ScavengerBody")) + { + protection = 0.4f; + } + else if (npc.type == mod.NPCType("ArmoredDiggerTail")) + { + protection = 0.45f; + } + else if (npc.type == mod.NPCType("SirenIce")) + { + protection = 0.5f; + } + else + { + switch (npc.type) + { + case NPCID.SkeletronHand: + case NPCID.SkeletronHead: + case NPCID.QueenBee: + case NPCID.HeadlessHorseman: + case NPCID.FlyingAntlion: + case NPCID.PirateCaptain: + case NPCID.MoonLordHead: + case NPCID.MoonLordHand: + case NPCID.MoonLordCore: + case NPCID.MoonLordFreeEye: + case NPCID.CultistBoss: + case NPCID.Mothron: + case NPCID.Crab: + case NPCID.SeaSnail: + protection = 0.05f; + break; + case NPCID.Antlion: + case NPCID.TheHungry: + case NPCID.TheDestroyer: + case NPCID.UndeadViking: + case NPCID.MourningWood: + case NPCID.Everscream: + case NPCID.GreekSkeleton: + case NPCID.GraniteFlyer: + case NPCID.WalkingAntlion: + case NPCID.Pumpking: + case NPCID.IceQueen: + case NPCID.IceGolem: + case NPCID.AnomuraFungus: + case NPCID.SkeletonArcher: + case NPCID.SandElemental: + case NPCID.Arapaima: + case NPCID.ArmoredViking: + case NPCID.DD2Betsy: + case NPCID.DD2OgreT2: + 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; + case NPCID.Retinazer: + case NPCID.Spazmatism: + case NPCID.PrimeCannon: + case NPCID.PrimeLaser: + case NPCID.TheDestroyerBody: + case 269: + case 270: + case 271: + case 272: + case 273: + case 274: + case 275: + case 276: + case 277: + case 278: + case 279: + case 280: + case 281: + case 282: + case 283: + case 284: + case 285: + case 286: + case 287: + case 288: + case 289: + case 291: + case 292: + case 293: + case 294: + case 295: + case 296: + case NPCID.MartianSaucerTurret: + case NPCID.MartianSaucerCannon: + case NPCID.MartianTurret: + case NPCID.MartianDrone: + case NPCID.MartianSaucer: + case NPCID.MartianSaucerCore: + case 494: + case 495: + case 496: + case 497: + protection = 0.2f; + break; + case NPCID.PrimeSaw: + case NPCID.PrimeVice: + case NPCID.SkeletronPrime: + case NPCID.Probe: + case NPCID.PossessedArmor: + protection = 0.25f; + break; + case NPCID.Mimic: + case NPCID.PresentMimic: + case 473: + case 474: + case 475: + case 476: + protection = 0.3f; + break; + case NPCID.GiantTortoise: + case NPCID.IceTortoise: + case NPCID.SantaNK1: + case NPCID.MartianWalker: + case NPCID.TheDestroyerTail: + protection = 0.35f; + break; + case NPCID.DeadlySphere: + protection = 0.4f; + break; + case NPCID.Paladin: + protection = 0.45f; + break; + case NPCID.WallofFlesh: + case NPCID.MothronEgg: + protection = 0.5f; + break; + case NPCID.DungeonGuardian: + protection = 0.999999f; + break; + } + } + } + if (npc.type == mod.NPCType("SCalWormBody") || npc.type == mod.NPCType("SCalWormHead") || npc.type == mod.NPCType("SCalWormBodyWeak") || + npc.type == mod.NPCType("SCalWormTail") || npc.type == mod.NPCType("EidolonWyrmHeadHuge")) + { + protection = 0.999999f; + } + if (protection > 0f) + { + defProtection = protection; + } + + if (Main.bloodMoon && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000) + { + npc.lifeMax = (int)((double)npc.lifeMax * 3.5); + npc.damage += 100; + npc.life = npc.lifeMax; + npc.defDamage = npc.damage; + } + if (CalamityWorld.downedDoG) + { + if (CalamityMod.pumpkinMoonBuffList.Contains(npc.type)) + { + npc.lifeMax = (int)((double)npc.lifeMax * 7.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 += 200; + npc.life = npc.lifeMax; + npc.defDamage = npc.damage; + } + } + if (CalamityMod.eclipseBuffList.Contains(npc.type) && CalamityWorld.buffedEclipse) + { + npc.lifeMax = (int)((double)npc.lifeMax * 32.5); + npc.damage += 250; + npc.life = npc.lifeMax; + npc.defDamage = npc.damage; + } + if (NPC.downedMoonlord) + { + if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type)) + { + npc.lifeMax = (int)((double)npc.lifeMax * 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 + + #region ScaleExpertMultiplayerStats + public override void ScaleExpertStats(NPC npc, int numPlayers, float bossLifeScale) + { + if (CalamityWorld.revenge) + { + if (Config.RevengeanceAndDeathThoriumBossBuff) + { + Mod thorium = ModLoader.GetMod("ThoriumMod"); + if (thorium != null) + { + if (npc.type == thorium.NPCType("Hatchling") || npc.type == thorium.NPCType("DistractJelly") || npc.type == thorium.NPCType("ViscountBaby") || + npc.type == thorium.NPCType("BoreanHopper") || npc.type == thorium.NPCType("BoreanMyte1") || npc.type == thorium.NPCType("EnemyBeholder") || + npc.type == thorium.NPCType("ThousandSoulPhalactry") || npc.type == thorium.NPCType("AbyssalSpawn")) + { + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.3); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.5); + } + else if (npc.type == thorium.NPCType("TheGrandThunderBirdv2")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.3); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.5); + } + else if (npc.type == thorium.NPCType("QueenJelly")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.35); + } + else if (npc.type == thorium.NPCType("Viscount")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.65); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); + } + else if (npc.type == thorium.NPCType("GraniteEnergyStorm")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.25); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.1); + } + else if (npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || npc.type == thorium.NPCType("TheBuriedWarrior2")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.5); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.2); + } + else if (npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") || npc.type == thorium.NPCType("BioCore") || + npc.type == thorium.NPCType("PyroCore")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.75); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.3); + } + else if (npc.type == thorium.NPCType("BoreanStrider") || npc.type == thorium.NPCType("BoreanStriderPopped")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.0); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.4); + } + else if (npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.5); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.6); + } + else if (npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.5); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.6); + } + else if (npc.type == thorium.NPCType("Abyssion") || npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 2.3); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.5); + } + else if (npc.type == thorium.NPCType("SlagFury") || npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") || + npc.type == thorium.NPCType("Aquaius") || npc.type == thorium.NPCType("Aquaius2")) + { + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + if (CalamityWorld.death) + npc.lifeMax = (int)((double)npc.lifeMax * 1.75); + else + npc.lifeMax = (int)((double)npc.lifeMax * 1.3); + } + } + } + } + + if (Main.netMode != 0) + { + if (numPlayers > 1) + { + if (((npc.boss || CalamityMod.bossScaleList.Contains(npc.type)) && npc.type < NPCID.Count) || + (npc.modNPC != null && npc.modNPC.mod.Name.Equals("CalamityMod"))) + { + double scalar = 1.0; + switch (numPlayers) //Decrease HP in multiplayer before vanilla scaling + { + case 2: + scalar = 0.76; + break; + case 3: + scalar = 0.63; + break; + case 4: + scalar = 0.525; + break; + case 5: + scalar = 0.43; + break; + case 6: + scalar = 0.36; + break; + default: + scalar = 0.295; + break; + } + npc.lifeMax = (int)((double)npc.lifeMax * scalar); + } + } + } + } + #endregion + + #region CanBeHitBy + public override bool? CanBeHitByItem(NPC npc, Player player, Item item) + { + if (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) + { + return !CalamityPlayer.areThereAnyDamnBosses; + } + return null; + } + + public override bool? CanBeHitByProjectile(NPC npc, Projectile projectile) + { + if (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) + { + return !CalamityPlayer.areThereAnyDamnBosses; + } + return null; + } + #endregion + + #region CanHitPlayer + public override bool CanHitPlayer(NPC npc, Player target, ref int cooldownSlot) + { + if (Main.pumpkinMoon && CalamityWorld.downedDoG && !npc.boss && !npc.friendly && !npc.dontTakeDamage) + cooldownSlot = 1; + else if (Main.snowMoon && CalamityWorld.downedDoG && !npc.boss && !npc.friendly && !npc.dontTakeDamage) + cooldownSlot = 1; + else if (Main.eclipse && CalamityWorld.buffedEclipse && !npc.boss && !npc.friendly && !npc.dontTakeDamage) + cooldownSlot = 1; + if (npc.type == NPCID.BrainofCthulhu && npc.alpha > 0) + return false; + return true; + } + #endregion + + #region ModifyHitPlayer + public override void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit) + { + if (tSad) + { + damage /= 2; + } + if (target.GetModPlayer(mod).beeResist) + { + if (CalamityMod.beeEnemyList.Contains(npc.type)) + { + damage = (int)((double)damage * 0.75); + } + } + } + #endregion + + #region StrikeNPC + public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail || + npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + if (newAI[1] < 480f || newAI[2] > 0f) + damage *= 0.01; + } + + 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) + { + 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.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 + + #region PreAI + public override bool PreAI(NPC npc) + { + if (setNewName) + { + setNewName = false; + switch (npc.type) + { + case NPCID.Guide: + switch (Main.rand.Next(36)) //34 guide names + { + case 0: + npc.GivenName = "Lapp"; + break; + case 1: + npc.GivenName = "Ben Shapiro"; + break; + default: + break; + } + break; + case NPCID.Wizard: + switch (Main.rand.Next(24)) //23 wizard names + { + case 0: + npc.GivenName = "Mage One-Trick"; + break; + default: + break; + } + break; + case NPCID.Steampunker: + switch (Main.rand.Next(22)) //21 steampunker names + { + case 0: + npc.GivenName = "Vorbis"; + break; + default: + break; + } + break; + case NPCID.Stylist: + switch (Main.rand.Next(21)) //20 stylist names + { + case 0: + npc.GivenName = "Amber"; + break; + default: + break; + } + break; + case NPCID.WitchDoctor: + switch (Main.rand.Next(11)) //10 witch doctor names + { + case 0: + npc.GivenName = "Sok'ar"; + break; + default: + break; + } + break; + default: + break; + } + } + + /*Main.player[npc.target].GetModPlayer(mod).distanceFromBoss = -1; //Important + if (CalamityWorld.revenge) + { + if (npc.type != NPCID.MartianSaucerCore && + (npc.boss || npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsTail || npc.type == mod.NPCType("SlimeGodRun") || + npc.type == mod.NPCType("SlimeGodRunSplit") || npc.type == mod.NPCType("SlimeGod") || npc.type == mod.NPCType("SlimeGodSplit"))) + { + Main.player[npc.target].GetModPlayer(mod).distanceFromBoss = (int)Vector2.Distance(Main.player[npc.target].Center, npc.Center); + } + }*/ + + if (npc.type == NPCID.TargetDummy || npc.type == mod.NPCType("SuperDummy")) + { + npc.chaseable = !CalamityPlayer.areThereAnyDamnBosses; + } + if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail || + npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + if (npc.buffImmune[mod.BuffType("Enraged")]) + { + npc.buffImmune[mod.BuffType("Enraged")] = false; + } + if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + if (newAI[3] == 0f) + { + newAI[3] = 1f; + newAI[1] = 300f; + } + } + if (newAI[1] < 480f) + { + 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) + { + switch (CalamityWorld.bossRushStage) + { + case 0: + if (npc.type != NPCID.QueenBee && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 1: + if (npc.type != NPCID.BrainofCthulhu && npc.type != NPCID.Creeper) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 2: + if (npc.type != NPCID.KingSlime && npc.type != NPCID.BlueSlime && npc.type != NPCID.SlimeSpiked) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 3: + if (npc.type != NPCID.EyeofCthulhu && npc.type != NPCID.ServantofCthulhu) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 4: + if (npc.type != NPCID.SkeletronPrime && npc.type != NPCID.PrimeSaw && npc.type != NPCID.PrimeVice && + npc.type != NPCID.PrimeCannon && npc.type != NPCID.PrimeLaser) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 5: + if (npc.type != NPCID.Golem && npc.type != NPCID.GolemFistLeft && npc.type != NPCID.GolemFistRight && + npc.type != NPCID.GolemHead && npc.type != NPCID.GolemHeadFree) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 6: + if (npc.type != mod.NPCType("ProfanedGuardianBoss") && npc.type != mod.NPCType("ProfanedGuardianBoss2") && + npc.type != mod.NPCType("ProfanedGuardianBoss3")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 7: + if (npc.type != NPCID.EaterofWorldsHead && npc.type != NPCID.EaterofWorldsBody && npc.type != NPCID.EaterofWorldsTail && + npc.type != NPCID.VileSpit) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 8: + if (npc.type != mod.NPCType("Astrageldon") && npc.type != mod.NPCType("AstralSlime")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 9: + if (npc.type != NPCID.TheDestroyer && npc.type != NPCID.TheDestroyerBody && npc.type != NPCID.TheDestroyerTail && + npc.type != NPCID.Probe) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 10: + if (npc.type != NPCID.Spazmatism && npc.type != NPCID.Retinazer) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 11: + if (npc.type != mod.NPCType("Bumblefuck") && npc.type != mod.NPCType("Bumblefuck2") && + npc.type != NPCID.Spazmatism && npc.type != NPCID.Retinazer) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 12: + if (npc.type != NPCID.WallofFlesh && npc.type != NPCID.WallofFleshEye && npc.type != NPCID.TheHungry && + npc.type != NPCID.TheHungryII && npc.type != NPCID.LeechHead && npc.type != NPCID.LeechBody && + npc.type != NPCID.LeechTail) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 13: + if (npc.type != mod.NPCType("HiveMind") && npc.type != mod.NPCType("HiveMindP2") && + npc.type != mod.NPCType("DarkHeart") && npc.type != mod.NPCType("HiveBlob") && + npc.type != mod.NPCType("DankCreeper") && npc.type != mod.NPCType("HiveBlob2")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 14: + if (npc.type != NPCID.SkeletronHead && npc.type != NPCID.SkeletronHand) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 15: + if (npc.type != mod.NPCType("StormWeaverHead") && npc.type != mod.NPCType("StormWeaverBody") && + npc.type != mod.NPCType("StormWeaverTail") && npc.type != mod.NPCType("StormWeaverHeadNaked") && + npc.type != mod.NPCType("StormWeaverBodyNaked") && npc.type != mod.NPCType("StormWeaverTailNaked") && + npc.type != mod.NPCType("StasisProbe") && npc.type != mod.NPCType("StasisProbeNaked")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 16: + if (npc.type != mod.NPCType("AquaticScourgeHead") && npc.type != mod.NPCType("AquaticScourgeBody") && + npc.type != mod.NPCType("AquaticScourgeBodyAlt") && npc.type != mod.NPCType("AquaticScourgeTail") && + npc.type != mod.NPCType("AquaticParasite") && npc.type != mod.NPCType("AquaticUrchin") && + npc.type != mod.NPCType("AquaticSeekerHead") && npc.type != mod.NPCType("AquaticSeekerBody") && + npc.type != mod.NPCType("AquaticSeekerTail")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 17: + if (npc.type != mod.NPCType("DesertScourgeHead") && npc.type != mod.NPCType("DesertScourgeBody") && + npc.type != mod.NPCType("DesertScourgeTail") && npc.type != mod.NPCType("DesertScourgeHeadSmall") && + npc.type != mod.NPCType("DesertScourgeBodySmall") && npc.type != mod.NPCType("DesertScourgeTailSmall") && + npc.type != mod.NPCType("DriedSeekerHead") && npc.type != mod.NPCType("DriedSeekerBody") && + npc.type != mod.NPCType("DriedSeekerTail")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 18: + if (npc.type != NPCID.CultistBoss && npc.type != NPCID.CultistBossClone && npc.type != NPCID.CultistDragonHead && + npc.type != NPCID.CultistDragonBody1 && npc.type != NPCID.CultistDragonBody2 && npc.type != NPCID.CultistDragonBody3 && + npc.type != NPCID.CultistDragonBody4 && npc.type != NPCID.CultistDragonTail && npc.type != NPCID.AncientCultistSquidhead && + npc.type != NPCID.AncientLight && npc.type != NPCID.AncientDoom && npc.type != mod.NPCType("Eidolist")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 19: + if (npc.type != mod.NPCType("CrabulonIdle") && npc.type != mod.NPCType("CrabShroom")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 20: + if (npc.type != NPCID.Plantera && npc.type != NPCID.PlanterasTentacle && npc.type != NPCID.PlanterasHook && + npc.type != NPCID.Spore) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 21: + if (npc.type != mod.NPCType("CeaselessVoid") && npc.type != mod.NPCType("DarkEnergy") && + npc.type != mod.NPCType("DarkEnergy2") && npc.type != mod.NPCType("DarkEnergy3")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 22: + if (npc.type != mod.NPCType("PerforatorHive") && npc.type != mod.NPCType("PerforatorHeadLarge") && + npc.type != mod.NPCType("PerforatorBodyLarge") && npc.type != mod.NPCType("PerforatorTailLarge") && + npc.type != mod.NPCType("PerforatorHeadMedium") && npc.type != mod.NPCType("PerforatorBodyMedium") && + npc.type != mod.NPCType("PerforatorTailMedium") && npc.type != mod.NPCType("PerforatorHeadSmall") && + npc.type != mod.NPCType("PerforatorBodySmall") && npc.type != mod.NPCType("PerforatorTailSmall")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 23: + if (npc.type != mod.NPCType("Cryogen") && npc.type != mod.NPCType("CryogenIce") && + npc.type != mod.NPCType("IceMass") && npc.type != mod.NPCType("Cryocore") && + npc.type != mod.NPCType("Cryocore2")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 24: + if (npc.type != mod.NPCType("BrimstoneElemental") && npc.type != mod.NPCType("Brimling")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 25: + if (npc.type != mod.NPCType("CosmicWraith") && npc.type != mod.NPCType("SignusBomb") && + npc.type != mod.NPCType("CosmicLantern")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 26: + if (npc.type != mod.NPCType("ScavengerBody") && npc.type != mod.NPCType("ScavengerHead") && + npc.type != mod.NPCType("ScavengerClawLeft") && npc.type != mod.NPCType("ScavengerClawRight") && + npc.type != mod.NPCType("ScavengerLegLeft") && npc.type != mod.NPCType("ScavengerLegRight") && + npc.type != mod.NPCType("ScavengerHead2") && npc.type != mod.NPCType("RockPillar") && + npc.type != mod.NPCType("FlamePillar")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 27: + if (npc.type != NPCID.DukeFishron && npc.type != NPCID.DetonatingBubble && npc.type != NPCID.Sharkron && + npc.type != NPCID.Sharkron2) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 28: + if (npc.type != NPCID.MoonLordCore && npc.type != NPCID.MoonLordHead && npc.type != NPCID.MoonLordHand && + npc.type != NPCID.MoonLordFreeEye && npc.type != mod.NPCType("Eidolist")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 29: + if (npc.type != mod.NPCType("AstrumDeusHead") && npc.type != mod.NPCType("AstrumDeusBody") && + npc.type != mod.NPCType("AstrumDeusTail") && npc.type != mod.NPCType("AstrumDeusHeadSpectral") && + npc.type != mod.NPCType("AstrumDeusBodySpectral") && npc.type != mod.NPCType("AstrumDeusTailSpectral") && + npc.type != mod.NPCType("AstrumDeusProbe") && npc.type != mod.NPCType("AstrumDeusProbe2") && + npc.type != mod.NPCType("AstrumDeusProbe3")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 30: + if (npc.type != mod.NPCType("Polterghast") && npc.type != mod.NPCType("PhantomFuckYou") && + npc.type != mod.NPCType("PolterghastHook") && npc.type != mod.NPCType("PolterPhantom")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 31: + if (npc.type != mod.NPCType("PlaguebringerGoliath") && npc.type != mod.NPCType("PlagueBeeG") && + npc.type != mod.NPCType("PlagueBeeLargeG") && npc.type != mod.NPCType("PlagueHomingMissile") && + npc.type != mod.NPCType("PlagueMine") && npc.type != mod.NPCType("PlaguebringerShade")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 32: + if (npc.type != mod.NPCType("Calamitas") && npc.type != mod.NPCType("CalamitasRun") && + npc.type != mod.NPCType("CalamitasRun2") && npc.type != mod.NPCType("CalamitasRun3") && + npc.type != mod.NPCType("LifeSeeker") && npc.type != mod.NPCType("SoulSeeker")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 33: + if (npc.type != mod.NPCType("Siren") && npc.type != mod.NPCType("Leviathan") && + npc.type != mod.NPCType("AquaticAberration") && npc.type != mod.NPCType("Parasea") && + npc.type != mod.NPCType("SirenClone") && npc.type != mod.NPCType("SirenIce")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 34: + if (npc.type != mod.NPCType("SlimeGod") && npc.type != mod.NPCType("SlimeGodRun") && + npc.type != mod.NPCType("SlimeGodCore") && npc.type != mod.NPCType("SlimeGodSplit") && + npc.type != mod.NPCType("SlimeGodRunSplit") && npc.type != mod.NPCType("SlimeSpawnCorrupt") && + npc.type != mod.NPCType("SlimeSpawnCorrupt2") && npc.type != mod.NPCType("SlimeSpawnCrimson") && + npc.type != mod.NPCType("SlimeSpawnCrimson2")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 35: + if (npc.type != mod.NPCType("Providence") && npc.type != mod.NPCType("ProvSpawnDefense") && + npc.type != mod.NPCType("ProvSpawnOffense") && npc.type != mod.NPCType("ProvSpawnHealer")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 36: + if (npc.type != mod.NPCType("SupremeCalamitas") && npc.type != mod.NPCType("SCalWormBody") && + npc.type != mod.NPCType("SCalWormBodyWeak") && npc.type != mod.NPCType("SCalWormHead") && + npc.type != mod.NPCType("SCalWormTail") && npc.type != mod.NPCType("SoulSeekerSupreme") && + npc.type != mod.NPCType("SCalWormHeart") && npc.type != mod.NPCType("SupremeCataclysm") && + npc.type != mod.NPCType("SupremeCatastrophe")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 37: + if (npc.type != mod.NPCType("Yharon") && npc.type != mod.NPCType("DetonatingFlare") && + npc.type != mod.NPCType("DetonatingFlare2") && npc.type != mod.NPCType("DetonatingFlare3") && + npc.type != mod.NPCType("Bumblefuck3") && npc.type != mod.NPCType("Bumblefuck4")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 38: + if (npc.type != mod.NPCType("DevourerofGodsHeadS") && npc.type != mod.NPCType("DevourerofGodsBodyS") && + npc.type != mod.NPCType("DevourerofGodsTailS")) + { + npc.active = false; + npc.netUpdate = true; + } + break; + } + #region KSRush + if (npc.type == NPCID.KingSlime) + { + float num234 = 1f; + bool flag8 = false; + bool flag9 = false; + npc.aiAction = 0; + if (npc.ai[3] == 0f && npc.life > 0) + { + npc.ai[3] = (float)npc.lifeMax; + } + if (npc.localAI[3] == 0f && Main.netMode != 1) + { + npc.ai[0] = -100f; + npc.localAI[3] = 1f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead) + { + npc.timeLeft = 0; + if (Main.player[npc.target].Center.X < npc.Center.X) + { + npc.direction = 1; + } + else + { + npc.direction = -1; + } + } + } + if (!Main.player[npc.target].dead && npc.ai[2] >= 300f && npc.ai[1] < 5f && npc.velocity.Y == 0f) + { + npc.ai[2] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 5f; + if (Main.netMode != 1) + { + npc.TargetClosest(false); + Point point3 = npc.Center.ToTileCoordinates(); + Point point4 = Main.player[npc.target].Center.ToTileCoordinates(); + Vector2 vector30 = Main.player[npc.target].Center - npc.Center; + int num235 = 10; + int num236 = 0; + int num237 = 7; + int num238 = 0; + bool flag10 = false; + if (vector30.Length() > ((enraged || Config.BossRushXerocCurse) ? 1000f : 2000f)) + { + flag10 = true; + num238 = 100; + } + while (!flag10 && num238 < 100) + { + num238++; + int num239 = Main.rand.Next(point4.X - num235, point4.X + num235 + 1); + int num240 = Main.rand.Next(point4.Y - num235, point4.Y + 1); + if ((num240 < point4.Y - num237 || num240 > point4.Y + num237 || num239 < point4.X - num237 || num239 > point4.X + num237) && (num240 < point3.Y - num236 || num240 > point3.Y + num236 || num239 < point3.X - num236 || num239 > point3.X + num236) && !Main.tile[num239, num240].nactive()) + { + int num241 = num240; + int num242 = 0; + bool flag11 = Main.tile[num239, num241].nactive() && Main.tileSolid[(int)Main.tile[num239, num241].type] && !Main.tileSolidTop[(int)Main.tile[num239, num241].type]; + if (flag11) + { + num242 = 1; + } + else + { + while (num242 < 150 && num241 + num242 < Main.maxTilesY) + { + int num243 = num241 + num242; + bool flag12 = Main.tile[num239, num243].nactive() && Main.tileSolid[(int)Main.tile[num239, num243].type] && !Main.tileSolidTop[(int)Main.tile[num239, num243].type]; + if (flag12) + { + num242--; + break; + } + int num = num242; + num242 = num + 1; + } + } + num240 += num242; + bool flag13 = true; + if (flag13 && Main.tile[num239, num240].lava()) + { + flag13 = false; + } + if (flag13 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + { + flag13 = false; + } + if (flag13) + { + npc.localAI[1] = (float)(num239 * 16 + 8); + npc.localAI[2] = (float)(num240 * 16 + 16); + break; + } + } + } + if (num238 >= 100) + { + Vector2 bottom = Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; + npc.localAI[1] = bottom.X; + npc.localAI[2] = bottom.Y; + } + } + } + if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + { + float[] var_9_AE8B_cp_0 = npc.ai; + int var_9_AE8B_cp_1 = 2; + float num244 = var_9_AE8B_cp_0[var_9_AE8B_cp_1]; + var_9_AE8B_cp_0[var_9_AE8B_cp_1] = num244 + 1f; + } + if (Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) + { + float[] var_9_AEDF_cp_0 = npc.ai; + int var_9_AEDF_cp_1 = 2; + float num244 = var_9_AEDF_cp_0[var_9_AEDF_cp_1]; + var_9_AEDF_cp_0[var_9_AEDF_cp_1] = num244 + 1f; + } + Dust dust; + if (npc.ai[1] == 5f) + { + flag8 = true; + npc.aiAction = 1; + 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 || 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) + { + flag9 = true; + } + if (npc.ai[0] == 60f) + { + Gore.NewGore(npc.Center + new Vector2(-40f, (float)(-(float)npc.height / 2)), npc.velocity, 734, 1f); + } + if (npc.ai[0] >= 60f && Main.netMode != 1) + { + npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); + npc.ai[1] = 6f; + npc.ai[0] = 0f; + npc.netUpdate = true; + } + if (Main.netMode == 1 && npc.ai[0] >= 120f) + { + npc.ai[1] = 6f; + npc.ai[0] = 0f; + } + if (!flag9) + { + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int num246 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); + Main.dust[num246].noGravity = true; + dust = Main.dust[num246]; + dust.velocity *= 0.5f; + num = num245; + } + } + } + else if (npc.ai[1] == 6f) + { + flag8 = true; + npc.aiAction = 0; + 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 || 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) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + npc.netUpdate = true; + npc.TargetClosest(true); + } + if (Main.netMode == 1 && npc.ai[0] >= 60f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + npc.TargetClosest(true); + } + int num; + for (int num247 = 0; num247 < 10; num247 = num + 1) + { + int num248 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); + Main.dust[num248].noGravity = true; + dust = Main.dust[num248]; + dust.velocity *= 2f; + num = num247; + } + } + npc.dontTakeDamage = (npc.hide = flag9); + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.8f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if (!flag8) + { + npc.ai[0] += (enraged || Config.BossRushXerocCurse) ? 4f : 2f; + if ((double)npc.life < (double)npc.lifeMax * 0.8) + { + npc.ai[0] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.6) + { + npc.ai[0] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.4) + { + npc.ai[0] += 2f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.2) + { + npc.ai[0] += 3f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + npc.ai[0] += 4f; + } + if (npc.ai[0] >= 0f) + { + npc.netUpdate = true; + npc.TargetClosest(true); + if (npc.ai[1] == 3f) + { + npc.velocity.Y = -26f; + npc.velocity.X = npc.velocity.X + 7f * (float)npc.direction; + npc.ai[0] = -200f; + npc.ai[1] = 0f; + } + else if (npc.ai[1] == 2f) + { + npc.velocity.Y = -12f; + npc.velocity.X = npc.velocity.X + 9f * (float)npc.direction; + npc.ai[0] = -120f; + npc.ai[1] += 1f; + } + else + { + npc.velocity.Y = -16f; + npc.velocity.X = npc.velocity.X + 8f * (float)npc.direction; + npc.ai[0] = -120f; + npc.ai[1] += 1f; + } + } + else if (npc.ai[0] >= -30f) + { + npc.aiAction = 1; + } + } + } + else if (npc.target < 255 && ((npc.direction == 1 && npc.velocity.X < 3f) || (npc.direction == -1 && npc.velocity.X > -3f))) + { + if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) + { + npc.velocity.X = npc.velocity.X + 0.2f * (float)npc.direction; + } + else + { + npc.velocity.X = npc.velocity.X * 0.93f; + } + } + int num249 = Dust.NewDust(npc.position, npc.width, npc.height, 4, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); + Main.dust[num249].noGravity = true; + dust = Main.dust[num249]; + dust.velocity *= 0.5f; + if (npc.life > 0) + { + float num250 = (float)npc.life / (float)npc.lifeMax; + num250 = num250 * 0.5f + 0.75f; + num250 *= num234; + if (num250 != npc.scale) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)npc.height; + npc.scale = num250; + npc.width = (int)(98f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)npc.height; + } + if (Main.netMode != 1) + { + int num251 = (int)((double)npc.lifeMax * 0.05); + if ((float)(npc.life + num251) < npc.ai[3]) + { + npc.ai[3] = (float)npc.life; + int num252 = Main.rand.Next(1, 4); + int num; + for (int num253 = 0; num253 < num252; num253 = num + 1) + { + 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 num254 = 1; + if (Main.rand.Next(4) == 0) + { + num254 = 535; + } + int num255 = NPC.NewNPC(x, y, num254, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num255].SetDefaults(num254, -1f); + Main.npc[num255].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[num255].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + Main.npc[num255].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[num255].ai[1] = 0f; + if (Main.netMode == 2 && num255 < 200) + { + NetMessage.SendData(23, -1, -1, null, num255, 0f, 0f, 0f, 0, 0, 0); + } + num = num253; + } + return false; + } + } + } + return false; + } + #endregion + #region BoCRush + else if (npc.type == NPCID.BrainofCthulhu) + { + NPC.crimsonBoss = npc.whoAmI; + npc.dontTakeDamage = false; + if (Main.netMode != 1 && npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + int num; + for (int num789 = 0; num789 < 20; num789 = num + 1) + { + float num790 = npc.Center.X; + float num791 = npc.Center.Y; + num790 += (float)Main.rand.Next(-npc.width, npc.width); + num791 += (float)Main.rand.Next(-npc.height, npc.height); + int num792 = NPC.NewNPC((int)num790, (int)num791, 267, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num792].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f); + Main.npc[num792].netUpdate = true; + num = num789; + } + } + if (npc.ai[0] < 0f) + { + if (npc.localAI[2] == 0f) + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + npc.localAI[2] = 1f; + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 392, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 393, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 394, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 395, 1f); + int num; + for (int num794 = 0; num794 < 20; num794 = num + 1) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f); + num = num794; + } + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + } + newAI[0] += 1f; + if (newAI[0] >= 60f) + { + newAI[0] = 0f; + if (Main.netMode != 1 && NPC.CountNPCS(NPCID.Creeper) < 15) + { + int creeper = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), 267, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[creeper].netUpdate = true; + } + npc.netUpdate = true; + } + npc.knockBackResist = 0f; + npc.TargetClosest(true); + Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); + 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 || Config.BossRushXerocCurse) ? 21f : 14f); + num797 = num798 / num797; + num795 *= num797; + num796 *= num797; + npc.velocity.X = (npc.velocity.X * 50f + num795) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; + if (npc.ai[0] == -1f) + { + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (npc.justHit) + { + npc.localAI[1] -= (float)Main.rand.Next(5); + } + int num799 = 60 + Main.rand.Next(120); + if (Main.netMode != 0) + { + num799 += Main.rand.Next(30, 90); + } + if (npc.localAI[1] >= (float)num799) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int num800 = 0; + int num801; + int num802; + while (true) + { + num800++; + num801 = (int)Main.player[npc.target].Center.X / 16; + num802 = (int)Main.player[npc.target].Center.Y / 16; + if (Main.rand.Next(2) == 0) + { + num801 += Main.rand.Next(7, 13); + } + else + { + num801 -= Main.rand.Next(7, 13); + } + if (Main.rand.Next(2) == 0) + { + num802 += Main.rand.Next(7, 13); + } + else + { + num802 -= Main.rand.Next(7, 13); + } + if (!WorldGen.SolidTile(num801, num802)) + { + break; + } + if (num800 > 100) + { + goto Block_2784; + } + } + npc.ai[3] = 0f; + npc.ai[0] = -2f; + npc.ai[1] = (float)num801; + npc.ai[2] = (float)num802; + npc.netUpdate = true; + npc.netSpam = 0; + Block_2784:; + } + } + } + else if (npc.ai[0] == -2f) + { + npc.velocity *= 0.9f; + if (Main.netMode != 0) + { + npc.ai[3] += 15f; + } + else + { + npc.ai[3] += 25f; + } + if (npc.ai[3] >= 255f) + { + npc.ai[3] = 255f; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + Main.PlaySound(SoundID.Item8, npc.Center); + npc.ai[0] = -3f; + npc.netUpdate = true; + npc.netSpam = 0; + } + npc.alpha = (int)npc.ai[3]; + } + else if (npc.ai[0] == -3f) + { + if (Main.netMode != 0) + { + npc.ai[3] -= 15f; + } + else + { + npc.ai[3] -= 25f; + } + if (npc.ai[3] <= 0f) + { + npc.ai[3] = 0f; + npc.ai[0] = -1f; + npc.netUpdate = true; + npc.netSpam = 0; + } + npc.alpha = (int)npc.ai[3]; + } + } + else + { + npc.TargetClosest(true); + Vector2 vector99 = new Vector2(npc.Center.X, npc.Center.Y); + 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 || Config.BossRushXerocCurse) ? 3f : 2f); + if (num805 < num806) + { + npc.velocity.X = num803; + npc.velocity.Y = num804; + } + else + { + num805 = num806 / num805; + npc.velocity.X = num803 * num805; + npc.velocity.Y = num804 * num805; + } + if (npc.ai[0] == 0f) + { + if (Main.netMode != 1) + { + int num807 = 0; + int num; + for (int num808 = 0; num808 < 200; num808 = num + 1) + { + if (Main.npc[num808].active && Main.npc[num808].type == 267) + { + num807++; + } + num = num808; + } + if (num807 == 0) + { + npc.ai[0] = -1f; + npc.localAI[1] = 0f; + npc.alpha = 0; + npc.netUpdate = true; + } + npc.localAI[1] += 1f; + if (npc.localAI[1] >= (float)(120 + Main.rand.Next(120))) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int num809 = 0; + int num810; + int num811; + while (true) + { + num809++; + num810 = (int)Main.player[npc.target].Center.X / 16; + num811 = (int)Main.player[npc.target].Center.Y / 16; + num810 += Main.rand.Next(-50, 51); + num811 += Main.rand.Next(-50, 51); + if (!WorldGen.SolidTile(num810, num811) && Collision.CanHit(new Vector2((float)(num810 * 16), (float)(num811 * 16)), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + break; + } + if (num809 > 100) + { + goto Block_2801; + } + } + npc.ai[0] = 1f; + npc.ai[1] = (float)num810; + npc.ai[2] = (float)num811; + npc.netUpdate = true; + Block_2801:; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.alpha += 5; + if (npc.alpha >= 255) + { + Main.PlaySound(SoundID.Item8, npc.Center); + npc.alpha = 255; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 2f; + } + } + else if (npc.ai[0] == 2f) + { + npc.alpha -= 5; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[0] = 0f; + } + } + } + if (Main.player[npc.target].dead) + { + if (npc.localAI[3] < 120f) + { + float[] var_9_29972_cp_0 = npc.localAI; + int var_9_29972_cp_1 = 3; + float num244 = var_9_29972_cp_0[var_9_29972_cp_1]; + var_9_29972_cp_0[var_9_29972_cp_1] = num244 + 1f; + } + if (npc.localAI[3] > 60f) + { + npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.25f; + } + npc.ai[0] = 2f; + npc.alpha = 10; + return false; + } + if (npc.localAI[3] > 0f) + { + float[] var_9_299F7_cp_0 = npc.localAI; + int var_9_299F7_cp_1 = 3; + float num244 = var_9_299F7_cp_0[var_9_299F7_cp_1]; + var_9_299F7_cp_0[var_9_299F7_cp_1] = num244 - 1f; + return false; + } + return false; + } + #endregion + #region EoWRush + else if (npc.type == NPCID.EaterofWorldsHead) + { + Main.player[npc.target].ZoneCorrupt = true; + npc.reflectingProjectiles = true; + if (!Main.player[npc.target].dead) + { + newAI[0] += ((enraged || Config.BossRushXerocCurse) ? 6f : 3f); + } + if (newAI[0] >= 180f) + { + 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)) + { + Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num349 *= num351; + num350 *= num351; + if (Main.netMode != 1) + { + float num418 = ((enraged || Config.BossRushXerocCurse) ? 18f : 12f); + int num419 = 12; + int num420 = 96; + num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = num418 / num351; + num349 *= num351; + num350 *= num351; + num349 += (float)Main.rand.Next(-40, 41) * 0.05f; + num350 += (float)Main.rand.Next(-40, 41) * 0.05f; + vector34.X += num349 * 4f; + vector34.Y += num350 * 4f; + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + #endregion + #region QBRush + else if (npc.type == NPCID.QueenBee) + { + int num592 = 0; + int variable; + for (int num593 = 0; num593 < 255; num593 = variable + 1) + { + if (Main.player[num593].active && !Main.player[num593].dead && (npc.Center - Main.player[num593].Center).Length() < 1000f) + { + num592++; + } + variable = num593; + } + int num594 = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.defense = npc.defDefense + num594; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + } + bool dead4 = Main.player[npc.target].dead; + if (dead4) + { + if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) + { + npc.velocity.Y = npc.velocity.Y + 0.04f; + } + if (npc.position.X < (float)(Main.maxTilesX * 8)) + { + npc.velocity.X = npc.velocity.X - 0.04f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.04f; + } + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + return false; + } + } + else if (npc.ai[0] == -1f) + { + if (Main.netMode != 1) + { + float num595 = npc.ai[1]; + int num596; + do + { + num596 = Main.rand.Next(3); + if (num596 == 1) + { + num596 = 2; + } + else if (num596 == 2) + { + num596 = 3; + } + } + while ((float)num596 == num595); + npc.ai[0] = (float)num596; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + return false; + } + } + else if (npc.ai[0] == 0f) + { + int num597 = 5; + if (npc.ai[1] > (float)(2 * num597) && npc.ai[1] % 2f == 0f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return false; + } + if (npc.ai[1] % 2f == 0f) + { + npc.TargetClosest(true); + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) + { + npc.localAI[0] = 1f; + npc.ai[1] += 1f; + npc.ai[2] = 0f; + float num598 = 24f; + Vector2 vector74 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num599 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector74.X; + float num600 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector74.Y; + float num601 = (float)Math.Sqrt((double)(num599 * num599 + num600 * num600)); + num601 = num598 / num601; + npc.velocity.X = num599 * num601; + npc.velocity.Y = num600 * num601; + npc.spriteDirection = npc.direction; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + return false; + } + npc.localAI[0] = 0f; + float num602 = 18f; + float num603 = 0.4f; + if (npc.position.Y + (float)(npc.height / 2) < Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2)) + { + npc.velocity.Y = npc.velocity.Y + num603; + } + else + { + npc.velocity.Y = npc.velocity.Y - num603; + } + if (npc.velocity.Y < -12f) + { + npc.velocity.Y = -num602; + } + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = num602; + } + if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + { + npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + } + else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + { + npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + } + else + { + npc.velocity.X = npc.velocity.X * 0.8f; + } + if (npc.velocity.X < -16f) + { + npc.velocity.X = -16f; + } + if (npc.velocity.X > 16f) + { + npc.velocity.X = 16f; + } + npc.spriteDirection = npc.direction; + return false; + } + else + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + 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)) + { + num605 = -1; + } + if (npc.direction == num605 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num604) + { + npc.ai[2] = 1f; + } + if (npc.ai[2] != 1f) + { + npc.localAI[0] = 1f; + return false; + } + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + npc.localAI[0] = 0f; + npc.velocity *= 0.9f; + float num606 = 0.25f; + if (npc.life < npc.lifeMax / 2) + { + npc.velocity *= 0.9f; + } + if (npc.life < npc.lifeMax / 3) + { + npc.velocity *= 0.9f; + } + if (npc.life < npc.lifeMax / 5) + { + npc.velocity *= 0.9f; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num606) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + return false; + } + } + } + else if (npc.ai[0] == 2f) + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + float num607 = 12f; + float num608 = 0.1f; + Vector2 vector75 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num609 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector75.X; + float num610 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector75.Y; + float num611 = (float)Math.Sqrt((double)(num609 * num609 + num610 * num610)); + if (num611 < 200f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + return false; + } + num611 = num607 / num611; + if (npc.velocity.X < num609) + { + npc.velocity.X = npc.velocity.X + num608; + if (npc.velocity.X < 0f && num609 > 0f) + { + npc.velocity.X = npc.velocity.X + num608; + } + } + else if (npc.velocity.X > num609) + { + npc.velocity.X = npc.velocity.X - num608; + if (npc.velocity.X > 0f && num609 < 0f) + { + npc.velocity.X = npc.velocity.X - num608; + } + } + if (npc.velocity.Y < num610) + { + npc.velocity.Y = npc.velocity.Y + num608; + if (npc.velocity.Y < 0f && num610 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num608; + return false; + } + } + else if (npc.velocity.Y > num610) + { + npc.velocity.Y = npc.velocity.Y - num608; + if (npc.velocity.Y > 0f && num610 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num608; + return false; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + Vector2 vector76 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector77 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num612 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector77.X; + float num613 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector77.Y; + float num614 = (float)Math.Sqrt((double)(num612 * num612 + num613 * num613)); + npc.ai[1] += 1f; + npc.ai[1] += (float)(num592 / 2); + bool flag38 = false; + if (npc.ai[1] > 10f) + { + npc.ai[1] = 0f; + float[] var_9_2174E_cp_0 = npc.ai; + int var_9_2174E_cp_1 = 2; + float num244 = var_9_2174E_cp_0[var_9_2174E_cp_1]; + var_9_2174E_cp_0[var_9_2174E_cp_1] = num244 + 1f; + flag38 = true; + } + if (Collision.CanHit(vector76, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag38) + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + if (Main.netMode != 1) + { + int num615 = Main.rand.Next(210, 212); + int num616 = NPC.NewNPC((int)vector76.X, (int)vector76.Y, num615, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num616].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f; + Main.npc[num616].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f; + Main.npc[num616].localAI[0] = 60f; + Main.npc[num616].netUpdate = true; + } + } + if (num614 > 400f || !Collision.CanHit(new Vector2(vector76.X, vector76.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num617 = 14f; + float num618 = 0.1f; + vector77 = vector76; + num612 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector77.X; + num613 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector77.Y; + num614 = (float)Math.Sqrt((double)(num612 * num612 + num613 * num613)); + num614 = num617 / num614; + if (npc.velocity.X < num612) + { + npc.velocity.X = npc.velocity.X + num618; + if (npc.velocity.X < 0f && num612 > 0f) + { + npc.velocity.X = npc.velocity.X + num618; + } + } + else if (npc.velocity.X > num612) + { + npc.velocity.X = npc.velocity.X - num618; + if (npc.velocity.X > 0f && num612 < 0f) + { + npc.velocity.X = npc.velocity.X - num618; + } + } + if (npc.velocity.Y < num613) + { + npc.velocity.Y = npc.velocity.Y + num618; + if (npc.velocity.Y < 0f && num613 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num618; + } + } + else if (npc.velocity.Y > num613) + { + npc.velocity.Y = npc.velocity.Y - num618; + if (npc.velocity.Y > 0f && num613 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num618; + } + } + } + else + { + npc.velocity *= 0.9f; + } + npc.spriteDirection = npc.direction; + if (npc.ai[2] > 5f) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 3f) + { + float num619 = 6f; + float num620 = 0.075f; + Vector2 vector78 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector79 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num621 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector79.X; + float num622 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector79.Y; + float num623 = (float)Math.Sqrt((double)(num621 * num621 + num622 * num622)); + npc.ai[1] += 1f; + bool flag39 = false; + if (npc.ai[1] % 15f == 14f) + { + flag39 = true; + } + if (flag39 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector78, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Main.PlaySound(SoundID.Item17, npc.position); + if (Main.netMode != 1) + { + 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)); + num627 = num624 / num627; + num625 *= num627; + num626 *= num627; + int num628 = 11; + int num629 = 55; + int num630 = Projectile.NewProjectile(vector78.X, vector78.Y, num625, num626, num629, num628, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num630].timeLeft = 300; + } + } + if (!Collision.CanHit(new Vector2(vector78.X, vector78.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + num619 = 14f; + num620 = 0.1f; + vector79 = vector78; + num621 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector79.X; + num622 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector79.Y; + num623 = (float)Math.Sqrt((double)(num621 * num621 + num622 * num622)); + num623 = num619 / num623; + if (npc.velocity.X < num621) + { + npc.velocity.X = npc.velocity.X + num620; + if (npc.velocity.X < 0f && num621 > 0f) + { + npc.velocity.X = npc.velocity.X + num620; + } + } + else if (npc.velocity.X > num621) + { + npc.velocity.X = npc.velocity.X - num620; + if (npc.velocity.X > 0f && num621 < 0f) + { + npc.velocity.X = npc.velocity.X - num620; + } + } + if (npc.velocity.Y < num622) + { + npc.velocity.Y = npc.velocity.Y + num620; + if (npc.velocity.Y < 0f && num622 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num620; + } + } + else if (npc.velocity.Y > num622) + { + npc.velocity.Y = npc.velocity.Y - num620; + if (npc.velocity.Y > 0f && num622 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num620; + } + } + } + else if (num623 > 100f) + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + num623 = num619 / num623; + if (npc.velocity.X < num621) + { + npc.velocity.X = npc.velocity.X + num620; + if (npc.velocity.X < 0f && num621 > 0f) + { + npc.velocity.X = npc.velocity.X + num620 * 2f; + } + } + else if (npc.velocity.X > num621) + { + npc.velocity.X = npc.velocity.X - num620; + if (npc.velocity.X > 0f && num621 < 0f) + { + npc.velocity.X = npc.velocity.X - num620 * 2f; + } + } + if (npc.velocity.Y < num622) + { + npc.velocity.Y = npc.velocity.Y + num620; + if (npc.velocity.Y < 0f && num622 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num620 * 2f; + } + } + else if (npc.velocity.Y > num622) + { + npc.velocity.Y = npc.velocity.Y - num620; + if (npc.velocity.Y > 0f && num622 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num620 * 2f; + } + } + } + if (npc.ai[1] > 400f) + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + return false; + } + } + return false; + } + #endregion + #region DFRush + else if (npc.type == NPCID.DukeFishron) + { + if (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) + { + npc.dontTakeDamage = true; + } + else if (npc.ai[0] <= 8f) + { + npc.dontTakeDamage = false; + } + float newDamage = (0.6f * Main.damageMultiplier); + bool flag = (double)npc.life <= (double)npc.lifeMax * 0.99; + bool flag2 = (double)npc.life <= (double)npc.lifeMax * 0.15; + bool flag3 = npc.ai[0] > 4f; + bool flag4 = npc.ai[0] > 9f; + bool flag5 = npc.ai[3] < 10f; + Vector2 vector = npc.Center; + if (flag4) + { + newAI[0] += 1f; + if (newAI[0] >= 480f) + { + newAI[0] = 0f; + if (Main.netMode != 1) + { + Projectile.NewProjectile(vector.X, vector.Y, 0f, 0f, 385, 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + npc.netUpdate = true; + } + npc.damage = (int)((float)npc.defDamage * 1.5f * newDamage); + npc.defense = 38; + } + else if (flag3) + { + npc.damage = (int)((float)npc.defDamage * 2.2f * newDamage); + npc.defense = (int)((float)npc.defDefense * 0.8f); + } + else + { + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + } + int num2 = 35; + float num3 = 0.65f; + float scaleFactor = 9.5f; + if (flag4) + { + 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 || Config.BossRushXerocCurse) ? 0.8f : 0.7f); + scaleFactor = ((enraged || Config.BossRushXerocCurse) ? 13f : 11f); + num2 = ((enraged || Config.BossRushXerocCurse) ? 30 : 35); + } + else if (flag5 && !flag3 && !flag4) + { + num2 = 25; + } + int num4 = 24; + float num5 = 18f; + if (flag4) + { + num4 = ((enraged || Config.BossRushXerocCurse) ? 18 : 20); + num5 = ((enraged || Config.BossRushXerocCurse) ? 30f : 28f); + } + else if (flag5 & flag3) + { + num4 = ((enraged || Config.BossRushXerocCurse) ? 21 : 23); + num5 = ((enraged || Config.BossRushXerocCurse) ? 25f : 22f); + } + int num6 = 80; + int num7 = 4; + float num8 = 0.3f; + float scaleFactor2 = 5f; + int num9 = 90; + int num10 = 180; + int num11 = 180; + int num12 = 30; + int num13 = 120; + int num14 = 4; + float scaleFactor3 = 6f; + float scaleFactor4 = 20f; + float num15 = 6.28318548f / (float)(num13 / 2); + int num16 = 75; + 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; + } + if (npc.ai[0] > 4f) + { + npc.ai[0] = 5f; + } + else + { + npc.ai[0] = 0f; + } + npc.ai[2] = 0f; + } + if (player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400))) + { + num2 = 20; + num5 += 6f; + } + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != 1) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + 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; + } + if (npc.ai[0] == -1f) + { + num17 = 0f; + } + if (npc.ai[0] == 3f) + { + num17 = 0f; + } + if (npc.ai[0] == 4f) + { + num17 = 0f; + } + if (npc.ai[0] == 8f) + { + num17 = 0f; + } + float num18 = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 6f) + { + num18 = 0f; + } + if (npc.ai[0] == 7f) + { + num18 = 0f; + } + if (npc.ai[0] == 3f) + { + num18 = 0.01f; + } + if (npc.ai[0] == 4f) + { + num18 = 0.01f; + } + if (npc.ai[0] == 8f) + { + num18 = 0.01f; + } + 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] != -1f && npc.ai[0] < 9f) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.alpha += 15; + } + else + { + npc.alpha -= 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + if (npc.ai[0] == -1f) + { + npc.velocity *= 0.98f; + int num19 = Math.Sign(player.Center.X - vector.X); + if (num19 != 0) + { + npc.direction = num19; + npc.spriteDirection = -npc.direction; + } + if (npc.ai[2] > 20f) + { + npc.velocity.Y = -2f; + npc.alpha -= 5; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.alpha += 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + if (npc.ai[2] == (float)(num9 - 30)) + { + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 expr_80F = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + npc.Center; + Vector2 vector2 = expr_80F - npc.Center; + int num21 = Dust.NewDust(expr_80F + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num21].noGravity = true; + Main.dust[num21].noLight = true; + Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; + } + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num16) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return false; + } + } + else 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) + { + int num23 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + num23 = 1; + break; + case 10: + npc.ai[3] = 1f; + num23 = 2; + break; + case 11: + npc.ai[3] = 0f; + num23 = 3; + break; + } + if (flag) + { + num23 = 4; + } + if (num23 == 1) + { + 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; + } + } + else if (num23 == 2) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (num23 == 3) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (num23 == 4) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 1f) + { + int num24 = 7; + for (int j = 0; j < num24; j++) + { + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default(Vector2)) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num25].noGravity = true; + Main.dust[num25].noLight = true; + Main.dust[num25].velocity /= 4f; + Main.dust[num25].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num4) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 2f) + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + } + Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor2; + if (npc.velocity.X < vector5.X) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X < 0f && vector5.X > 0f) + { + npc.velocity.X = npc.velocity.X + num8; + } + } + else if (npc.velocity.X > vector5.X) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X > 0f && vector5.X < 0f) + { + npc.velocity.X = npc.velocity.X - num8; + } + } + if (npc.velocity.Y < vector5.Y) + { + npc.velocity.Y = npc.velocity.Y + num8; + if (npc.velocity.Y < 0f && vector5.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num8; + } + } + else if (npc.velocity.Y > vector5.Y) + { + npc.velocity.Y = npc.velocity.Y - num8; + if (npc.velocity.Y > 0f && vector5.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - num8; + } + } + if (npc.ai[2] == 0f) + { + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + } + if (npc.ai[2] % (float)num7 == 0f) + { + Main.PlaySound(4, (int)npc.Center.X, (int)npc.Center.Y, 19, 1f, 0f); + if (Main.netMode != 1) + { + Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (float)(npc.width + 20) / 2f + vector; + NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, 371, 0, 0f, 0f, 0f, 0f, 255); + } + } + int num26 = Math.Sign(player.Center.X - vector.X); + if (num26 != 0) + { + npc.direction = num26; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num6) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 3f) + { + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num9 - 30)) + { + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 9, 1f, 0f); + } + if (Main.netMode != 1 && npc.ai[2] == (float)(num9 - 30)) + { + Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * (float)npc.direction) * (float)(npc.width + 20) / 2f + vector; + Projectile.NewProjectile(vector7.X, vector7.Y, (float)(npc.direction * 2), 8f, 385, 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector7.X, vector7.Y, (float)(-(float)npc.direction * 2), 8f, 385, 0, 0f, Main.myPlayer, 0f, 0f); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num9) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 4f) + { + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num10 - 60)) + { + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num10) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 5f && !player.dead) + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + } + Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector8.X) + { + npc.velocity.X = npc.velocity.X + num3; + if (npc.velocity.X < 0f && vector8.X > 0f) + { + npc.velocity.X = npc.velocity.X + num3; + } + } + else if (npc.velocity.X > vector8.X) + { + npc.velocity.X = npc.velocity.X - num3; + if (npc.velocity.X > 0f && vector8.X < 0f) + { + npc.velocity.X = npc.velocity.X - num3; + } + } + if (npc.velocity.Y < vector8.Y) + { + npc.velocity.Y = npc.velocity.Y + num3; + if (npc.velocity.Y < 0f && vector8.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num3; + } + } + else if (npc.velocity.Y > vector8.Y) + { + npc.velocity.Y = npc.velocity.Y - num3; + if (npc.velocity.Y > 0f && vector8.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - num3; + } + } + int num27 = Math.Sign(player.Center.X - vector.X); + if (num27 != 0) + { + if (npc.ai[2] == 0f && num27 != npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.direction = num27; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num28 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + num28 = 1; + break; + case 6: + npc.ai[3] = 1f; + num28 = 2; + break; + case 7: + npc.ai[3] = 0f; + num28 = 3; + break; + } + if (flag2) + { + num28 = 4; + } + if (num28 == 1) + { + npc.ai[0] = 6f; + 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 (num27 != 0) + { + npc.direction = num27; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (num28 == 2) + { + npc.velocity = Vector2.Normalize(player.Center - vector) * scaleFactor4; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num27 != 0) + { + npc.direction = num27; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (num28 == 3) + { + npc.ai[0] = 8f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (num28 == 4) + { + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 6f) + { + int num29 = 7; + for (int k = 0; k < num29; k++) + { + Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(k - (num29 / 2 - 1)) * 3.1415926535897931 / (double)((float)num29), default(Vector2)) + vector; + Vector2 vector9 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num30 = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, 172, vector9.X * 2f, vector9.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num30].noGravity = true; + Main.dust[num30].noLight = true; + Main.dust[num30].velocity /= 4f; + Main.dust[num30].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num4) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 7f) + { + if (npc.ai[2] == 0f) + { + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + } + if (npc.ai[2] % (float)num14 == 0f) + { + Main.PlaySound(4, (int)npc.Center.X, (int)npc.Center.Y, 19, 1f, 0f); + if (Main.netMode != 1) + { + Vector2 vector10 = Vector2.Normalize(npc.velocity) * (float)(npc.width + 20) / 2f + vector; + int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, 371, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num31].target = npc.target; + Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy((double)(1.57079637f * (float)npc.direction), default(Vector2)) * scaleFactor3; + Main.npc[num31].netUpdate = true; + Main.npc[num31].ai[3] = (float)Main.rand.Next(80, 121) / 100f; + } + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num15 * (float)npc.direction), default(Vector2)); + npc.rotation -= num15 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num13) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 8f) + { + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num9 - 30)) + { + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + } + if (Main.netMode != 1 && npc.ai[2] == (float)(num9 - 30)) + { + Projectile.NewProjectile(vector.X, vector.Y, 0f, 0f, 385, 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num9) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 9f) + { + if (npc.ai[2] < (float)(num11 - 90)) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.alpha += 15; + } + else + { + npc.alpha -= 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + else if (npc.alpha < 255) + { + npc.alpha += 4; + 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] == (float)(num11 - 60)) + { + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num11) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 10f && !player.dead) + { + npc.dontTakeDamage = false; + npc.chaseable = false; + if (npc.alpha < 255) + { + npc.alpha += 25; + if (npc.alpha > 255) + { + npc.alpha = 255; + } + } + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(360 * Math.Sign((vector - player.Center).X)); + } + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; + npc.SimpleFlyMovement(desiredVelocity, num3); + int num32 = Math.Sign(player.Center.X - vector.X); + if (num32 != 0) + { + if (npc.ai[2] == 0f && num32 != npc.direction) + { + npc.rotation += 3.14159274f; + for (int l = 0; l < npc.oldPos.Length; l++) + { + npc.oldPos[l] = Vector2.Zero; + } + } + npc.direction = num32; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num33 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + num33 = 1; + break; + case 1: + case 4: + case 8: + num33 = 2; + break; + } + if (num33 == 1) + { + npc.ai[0] = 11f; + 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 (num32 != 0) + { + npc.direction = num32; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (num33 == 2) + { + npc.ai[0] = 12f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (num33 == 3) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 11f) + { + npc.dontTakeDamage = false; + npc.chaseable = true; + npc.alpha -= 25; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + int num34 = 7; + for (int m = 0; m < num34; m++) + { + Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(m - (num34 / 2 - 1)) * 3.1415926535897931 / (double)((float)num34), default(Vector2)) + vector; + Vector2 vector11 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num35 = Dust.NewDust(arg_2444_0 + vector11, 0, 0, 172, vector11.X * 2f, vector11.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num35].noGravity = true; + Main.dust[num35].noLight = true; + Main.dust[num35].velocity /= 4f; + Main.dust[num35].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num4) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 12f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + 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] == (float)(num12 / 2)) + { + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + } + if (Main.netMode != 1 && npc.ai[2] == (float)(num12 / 2)) + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + } + Vector2 center = player.Center + new Vector2(-npc.ai[1], -200f); + vector = (npc.Center = center); + int num36 = Math.Sign(player.Center.X - vector.X); + if (num36 != 0) + { + if (npc.ai[2] == 0f && num36 != npc.direction) + { + npc.rotation += 3.14159274f; + for (int n = 0; n < npc.oldPos.Length; n++) + { + npc.oldPos[n] = Vector2.Zero; + } + } + npc.direction = num36; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num12) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + if (npc.ai[3] >= 9f) + { + npc.ai[3] = 0f; + } + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[0] == 13f) + { + if (npc.ai[2] == 0f) + { + Main.PlaySound(29, (int)vector.X, (int)vector.Y, 20, 1f, 0f); + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num15 * (float)npc.direction), default(Vector2)); + npc.rotation -= num15 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num13) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + return false; + } + #endregion + } + #endregion + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + #region Mothron + if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) + { + int num1353 = 3; + npc.noTileCollide = false; + npc.noGravity = true; + npc.knockBackResist = 0.2f * Main.expertKnockBack; + npc.damage = npc.defDamage; + if (!Main.eclipse) + { + npc.ai[0] = -1f; + } + else if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + Vector2 vector235 = Main.player[npc.target].Center - npc.Center; + if (Main.player[npc.target].dead || vector235.Length() > 3000f) + { + npc.ai[0] = -1f; + } + } + else + { + Vector2 vector236 = Main.player[npc.target].Center - npc.Center; + if (npc.ai[0] > 1f && vector236.Length() > 1000f) + { + npc.ai[0] = 1f; + } + } + if (npc.ai[0] == -1f) + { + Vector2 value37 = new Vector2(0f, -8f); + npc.velocity = (npc.velocity * 22f + value37) / 10f; + npc.noTileCollide = true; + npc.dontTakeDamage = true; + return false; + } + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + if (npc.Center.X < Main.player[npc.target].Center.X - 2f) + { + npc.direction = 1; + } + if (npc.Center.X > Main.player[npc.target].Center.X + 2f) + { + npc.direction = -1; + } + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); + if (npc.velocity.X > 30f) + { + npc.velocity.X = 30f; + } + if (npc.velocity.X < -30f) + { + npc.velocity.X = -30f; + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + if (npc.velocity.Y > 30f) + { + npc.velocity.Y = 30f; + } + if (npc.velocity.Y < -30f) + { + npc.velocity.Y = -30f; + } + } + Vector2 value38 = Main.player[npc.target].Center - npc.Center; + value38.Y -= 200f; + if (value38.Length() > 2000f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (value38.Length() > 80f) + { + float scaleFactor15 = 13f; + float num1354 = 30f; + value38.Normalize(); + value38 *= scaleFactor15; + npc.velocity = (npc.velocity * (num1354 - 1f) + value38) / num1354; + } + else if (npc.velocity.Length() > 2f) + { + npc.velocity *= 0.95f; + } + else if (npc.velocity.Length() < 1f) + { + 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 num1355 = Main.rand.Next(3); + if (num1355 == 0 && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 2f; + } + else if (num1355 == 1) + { + npc.ai[0] = 3f; + } + else if (num1355 == 2 && NPC.CountNPCS(478) + NPC.CountNPCS(479) < num1353) + { + npc.ai[0] = 4f; + } + } + return false; + } + } + else + { + if (npc.ai[0] == 1f) + { + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + npc.knockBackResist = 0f; + if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].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.02f) / 10f; + Vector2 value39 = Main.player[npc.target].Center - npc.Center; + if (value39.Length() < 300f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + float scaleFactor16 = 14f + value39.Length() / 100f; + float num1356 = 25f; + value39.Normalize(); + value39 *= scaleFactor16; + npc.velocity = (npc.velocity * (num1356 - 1f) + value39) / num1356; + return false; + } + if (npc.ai[0] == 2f) + { + npc.damage = (int)((double)npc.defDamage * 0.75); + npc.knockBackResist = 0f; + if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + if (Main.player[npc.target].Center.X - 10f < npc.Center.X) + { + npc.direction = -1; + } + else if (Main.player[npc.target].Center.X + 10f > npc.Center.X) + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.025f) / 5f; + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); + if (npc.velocity.X > 30f) + { + npc.velocity.X = 30f; + } + if (npc.velocity.X < -30f) + { + npc.velocity.X = -30f; + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); + if (npc.velocity.Y > 30f) + { + npc.velocity.Y = 30f; + } + if (npc.velocity.Y < -30f) + { + npc.velocity.Y = -30f; + } + } + Vector2 value40 = Main.player[npc.target].Center - npc.Center; + value40.Y -= 20f; + npc.ai[2] += 0.0222222228f; + if (Main.expertMode) + { + npc.ai[2] += 0.0166666675f; + } + float scaleFactor17 = 13f + npc.ai[2] + value40.Length() / 120f; + float num1357 = 20f; + value40.Normalize(); + value40 *= scaleFactor17; + npc.velocity = (npc.velocity * (num1357 - 1f) + value40) / num1357; + npc.ai[1] += 1f; + if (npc.ai[1] > 240f || !Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return false; + } + } + else + { + if (npc.ai[0] == 3f) + { + npc.knockBackResist = 0f; + 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.0175f) / 5f; + Vector2 value41 = Main.player[npc.target].Center - npc.Center; + value41.Y -= 12f; + if (npc.Center.X > Main.player[npc.target].Center.X) + { + value41.X += 400f; + } + else + { + value41.X -= 400f; + } + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 350f && Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) < 20f) + { + npc.ai[0] = 3.1f; + npc.ai[1] = 0f; + } + npc.ai[1] += 0.0333333351f; + float scaleFactor18 = 20f + npc.ai[1]; + float num1358 = 4f; + value41.Normalize(); + value41 *= scaleFactor18; + npc.velocity = (npc.velocity * (num1358 - 1f) + value41) / num1358; + return false; + } + if (npc.ai[0] == 3.1f) + { + npc.knockBackResist = 0f; + npc.noTileCollide = true; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; + Vector2 vector237 = Main.player[npc.target].Center - npc.Center; + vector237.Y -= 12f; + float scaleFactor19 = 30f; + float num1359 = 8f; + vector237.Normalize(); + vector237 *= scaleFactor19; + npc.velocity = (npc.velocity * (num1359 - 1f) + vector237) / num1359; + 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 = vector237; + 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 false; + } + } + else + { + if (npc.ai[0] == 3.2f) + { + npc.damage = (int)((double)npc.defDamage * 1.5); + npc.collideX = false; + npc.collideY = false; + npc.knockBackResist = 0f; + npc.noTileCollide = true; + npc.ai[2] += 0.0333333351f; + npc.velocity.X = (20f + npc.ai[2]) * npc.ai[1]; + if ((npc.ai[1] > 0f && npc.Center.X > Main.player[npc.target].Center.X + 260f) || (npc.ai[1] < 0f && npc.Center.X < Main.player[npc.target].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 - Main.player[npc.target].Center.X) > 1600f) + { + 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.0175f) / 5f; + return false; + } + if (npc.ai[0] == 4f) + { + npc.ai[0] = 0f; + npc.TargetClosest(true); + if (Main.netMode != 1) + { + npc.ai[1] = -1f; + npc.ai[2] = -1f; + int num; + for (int num1360 = 0; num1360 < 1000; num1360 = num + 1) + { + int num1361 = (int)Main.player[npc.target].Center.X / 16; + int num1362 = (int)Main.player[npc.target].Center.Y / 16; + int num1363 = 30 + num1360 / 50; + int num1364 = 20 + num1360 / 75; + num1361 += Main.rand.Next(-num1363, num1363 + 1); + num1362 += Main.rand.Next(-num1364, num1364 + 1); + if (!WorldGen.SolidTile(num1361, num1362)) + { + while (!WorldGen.SolidTile(num1361, num1362) && (double)num1362 < Main.worldSurface) + { + num1362++; + } + if ((new Vector2((float)(num1361 * 16 + 8), (float)(num1362 * 16 + 8)) - Main.player[npc.target].Center).Length() < 2100f) + { + npc.ai[0] = 4.1f; + npc.ai[1] = (float)num1361; + npc.ai[2] = (float)num1362; + break; + } + } + num = num1360; + } + } + npc.netUpdate = true; + return false; + } + if (npc.ai[0] == 4.1f) + { + if (npc.velocity.X < -2f) + { + npc.direction = -1; + } + else if (npc.velocity.X > 2f) + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; + npc.noTileCollide = true; + int num1365 = (int)npc.ai[1]; + int num1366 = (int)npc.ai[2]; + float x2 = (float)(num1365 * 16 + 8); + float y2 = (float)(num1366 * 16 - 20); + Vector2 vector238 = new Vector2(x2, y2); + vector238 -= npc.Center; + float num1367 = 6f + vector238.Length() / 150f; + if (num1367 > 10f) + { + num1367 = 10f; + } + float num1368 = 10f; + if (vector238.Length() < 10f) + { + npc.ai[0] = 4.2f; + } + vector238.Normalize(); + vector238 *= num1367; + npc.velocity = (npc.velocity * (num1368 - 1f) + vector238) / num1368; + return false; + } + if (npc.ai[0] == 4.2f) + { + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; + npc.knockBackResist = 0f; + npc.noTileCollide = true; + int num1369 = (int)npc.ai[1]; + int num1370 = (int)npc.ai[2]; + float x3 = (float)(num1369 * 16 + 8); + float y3 = (float)(num1370 * 16 - 20); + Vector2 vector239 = new Vector2(x3, y3); + vector239 -= npc.Center; + float num1371 = 4f; + float num1372 = 2f; + if (Main.netMode != 1 && vector239.Length() < 4f) + { + int num1373 = 70; + if (Main.expertMode) + { + num1373 = (int)((double)num1373 * 0.75); + } + npc.ai[3] += 1f; + if (npc.ai[3] == (float)num1373) + { + NPC.NewNPC(num1369 * 16 + 8, num1370 * 16, 478, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + else if (npc.ai[3] == (float)(num1373 * 2)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + if (NPC.CountNPCS(478) + NPC.CountNPCS(479) < num1353 && Main.rand.Next(3) != 0) + { + npc.ai[0] = 4f; + } + else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 1f; + } + } + } + if (vector239.Length() > num1371) + { + vector239.Normalize(); + vector239 *= num1371; + } + npc.velocity = (npc.velocity * (num1372 - 1f) + vector239) / num1372; + return false; + } + } + } + } + return false; + } + #endregion + #region Pumpking + else if (npc.type == NPCID.Pumpking && CalamityWorld.downedDoG) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] > 6f) + { + npc.localAI[0] = 0f; + npc.localAI[1] += 1f; + if (npc.localAI[1] > 4f) + { + npc.localAI[1] = 0f; + } + } + if (Main.netMode != 1) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] > 300f) + { + npc.ai[3] = (float)Main.rand.Next(3); + npc.localAI[2] = 0f; + } + else if (npc.ai[3] == 0f && npc.localAI[2] % 30f == 0f && npc.localAI[2] > 30f) + { + float num856 = 10f; + Vector2 vector109 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + if (!WorldGen.SolidTile((int)vector109.X / 16, (int)vector109.Y / 16)) + { + float num857 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector109.X; + float num858 = Main.player[npc.target].position.Y - vector109.Y; + num857 += (float)Main.rand.Next(-50, 51); + num858 += (float)Main.rand.Next(50, 201); + num858 *= 0.2f; + float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); + num859 = num856 / num859; + num857 *= num859; + num858 *= num859; + num857 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; + num858 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; + Projectile.NewProjectile(vector109.X, vector109.Y, num857, num858, Main.rand.Next(326, 329), 60, 0f, Main.myPlayer, 0f, 0f); + } + } + } + if (npc.ai[0] == 0f && Main.netMode != 1) + { + npc.TargetClosest(true); + npc.ai[0] = 1f; + int num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, 328, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num861].ai[0] = -1f; + Main.npc[num861].ai[1] = (float)npc.whoAmI; + Main.npc[num861].target = npc.target; + Main.npc[num861].netUpdate = true; + num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, 328, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num861].ai[0] = 1f; + Main.npc[num861].ai[1] = (float)npc.whoAmI; + Main.npc[num861].ai[3] = 150f; + Main.npc[num861].target = npc.target; + Main.npc[num861].netUpdate = true; + } + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + { + npc.ai[1] = 2f; + } + } + if (Main.dayTime) + { + npc.velocity.Y = npc.velocity.Y + 0.3f; + npc.velocity.X = npc.velocity.X * 0.9f; + } + else if (npc.ai[1] == 0f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + if (npc.ai[3] != 1f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else + { + npc.ai[2] = 0f; + npc.ai[1] = 1f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + } + Vector2 vector110 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num862 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector110.X; + float num863 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector110.Y; + float num864 = (float)Math.Sqrt((double)(num862 * num862 + num863 * num863)); + float num865 = 8f; + if (npc.ai[3] == 1f) + { + if (num864 > 900f) + { + num865 = 14f; + } + else if (num864 > 600f) + { + num865 = 12f; + } + else if (num864 > 300f) + { + num865 = 10f; + } + } + if (num864 > 50f) + { + num864 = num865 / num864; + npc.velocity.X = (npc.velocity.X * 14f + num862 * num864) / 15f; + npc.velocity.Y = (npc.velocity.Y * 14f + num863 * num864) / 15f; + } + } + else if (npc.ai[1] == 1f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 600f || npc.ai[3] != 1f) + { + npc.ai[2] = 0f; + npc.ai[1] = 0f; + } + Vector2 vector111 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num866 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector111.X; + float num867 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector111.Y; + float num868 = (float)Math.Sqrt((double)(num866 * num866 + num867 * num867)); + num868 = 20f / num868; + npc.velocity.X = (npc.velocity.X * 49f + num866 * num868) / 50f; + npc.velocity.Y = (npc.velocity.Y * 49f + num867 * num868) / 50f; + } + else if (npc.ai[1] == 2f) + { + npc.ai[1] = 3f; + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + npc.velocity.X = npc.velocity.X * 0.95f; + if (npc.timeLeft > 500) + { + npc.timeLeft = 500; + } + } + npc.rotation = npc.velocity.X * -0.02f; + return false; + } + else if (npc.type == NPCID.PumpkingBlade && CalamityWorld.downedDoG) + { + npc.spriteDirection = -(int)npc.ai[0]; + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 58) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != 2) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + if (Main.netMode != 1 && Main.npc[(int)npc.ai[1]].ai[3] == 2f) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] > 30f) + { + npc.localAI[1] = 0f; + float num869 = 0.01f; + Vector2 vector112 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + float num870 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector112.X; + float num871 = Main.player[npc.target].position.Y - vector112.Y; + float num872 = (float)Math.Sqrt((double)(num870 * num870 + num871 * num871)); + num872 = num869 / num872; + num870 *= num872; + num871 *= num872; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num870, num871, 329, 70, 0f, Main.myPlayer, npc.rotation, (float)npc.spriteDirection); + } + } + if (Main.dayTime) + { + npc.velocity.Y = npc.velocity.Y + 0.3f; + npc.velocity.X = npc.velocity.X * 0.9f; + return false; + } + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + npc.ai[3] += 1f; + if (npc.ai[3] >= 180f) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + Vector2 vector113 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num874 = (Main.player[npc.target].Center.X + Main.npc[(int)npc.ai[1]].Center.X) / 2f; + float num875 = (Main.player[npc.target].Center.Y + Main.npc[(int)npc.ai[1]].Center.Y) / 2f; + num874 += -170f * npc.ai[0] - vector113.X; + num875 += 90f - vector113.Y; + float num876 = Math.Abs(Main.player[npc.target].Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(Main.player[npc.target].Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); + if (num876 > 700f) + { + num874 = Main.npc[(int)npc.ai[1]].Center.X - 170f * npc.ai[0] - vector113.X; + num875 = Main.npc[(int)npc.ai[1]].Center.Y + 90f - vector113.Y; + } + float num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); + float num878 = 8f; + if (num877 > 1000f) + { + num878 = 23f; + } + else if (num877 > 800f) + { + num878 = 20f; + } + else if (num877 > 600f) + { + num878 = 17f; + } + else if (num877 > 400f) + { + num878 = 14f; + } + else if (num877 > 200f) + { + num878 = 11f; + } + if (npc.ai[0] < 0f && npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) + { + num874 -= 4f; + } + if (npc.ai[0] > 0f && npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) + { + num874 += 4f; + } + num877 = num878 / num877; + npc.velocity.X = (npc.velocity.X * 14f + num874 * num877) / 15f; + npc.velocity.Y = (npc.velocity.Y * 14f + num875 * num877) / 15f; + num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); + if (num877 > 20f) + { + npc.rotation = (float)Math.Atan2((double)num875, (double)num874) + 1.57f; + return false; + } + } + else if (npc.ai[2] == 1f) + { + Vector2 vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num879 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector114.X; + float num880 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector114.Y; + float num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); + npc.rotation = (float)Math.Atan2((double)num880, (double)num879) + 1.57f; + npc.velocity.X = npc.velocity.X * 0.95f; + npc.velocity.Y = npc.velocity.Y - 0.3f; + if (npc.velocity.Y < -18f) + { + npc.velocity.Y = -18f; + } + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) + { + npc.TargetClosest(true); + npc.ai[2] = 2f; + vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num879 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector114.X; + num880 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector114.Y; + num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); + num881 = 24f / num881; + npc.velocity.X = num879 * num881; + npc.velocity.Y = num880 * num881; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[2] == 2f) + { + float num882 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || num882 > 800f) + { + npc.ai[2] = 3f; + return false; + } + } + else if (npc.ai[2] == 4f) + { + Vector2 vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num883 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector115.X; + float num884 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector115.Y; + float num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); + npc.rotation = (float)Math.Atan2((double)num884, (double)num883) + 1.57f; + npc.velocity.Y = npc.velocity.Y * 0.95f; + npc.velocity.X = npc.velocity.X + 0.3f * -npc.ai[0]; + if (npc.velocity.X < -18f) + { + npc.velocity.X = -18f; + } + if (npc.velocity.X > 18f) + { + npc.velocity.X = 18f; + } + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) + { + npc.TargetClosest(true); + npc.ai[2] = 5f; + vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num883 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector115.X; + num884 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector115.Y; + num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); + num885 = 17f / num885; + npc.velocity.X = num883 * num885; + npc.velocity.Y = num884 * num885; + npc.netUpdate = true; + return false; + } + } + else if (npc.ai[2] == 5f) + { + float num886 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); + if ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || num886 > 800f) + { + npc.ai[2] = 0f; + return false; + } + } + return false; + } + #endregion + #region IceQueen + else if (npc.type == NPCID.IceQueen && CalamityWorld.downedDoG) + { + if (Main.dayTime) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + 0.25f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.25f; + } + npc.velocity.Y = npc.velocity.Y - 0.1f; + npc.rotation = npc.velocity.X * 0.05f; + } + else if (npc.ai[0] == 0f) + { + if (npc.ai[2] == 0f) + { + npc.TargetClosest(true); + if (npc.Center.X < Main.player[npc.target].Center.X) + { + npc.ai[2] = 1f; + } + else + { + npc.ai[2] = -1f; + } + } + npc.TargetClosest(true); + int num887 = 800; + float num888 = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + if (npc.Center.X < Main.player[npc.target].Center.X && npc.ai[2] < 0f && num888 > (float)num887) + { + npc.ai[2] = 0f; + } + if (npc.Center.X > Main.player[npc.target].Center.X && npc.ai[2] > 0f && num888 > (float)num887) + { + npc.ai[2] = 0f; + } + float num889 = 0.6f; + float num890 = 10f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num889 = 0.7f; + num890 = 12f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num889 = 0.8f; + num890 = 14f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num889 = 0.95f; + num890 = 16f; + } + npc.velocity.X = npc.velocity.X + npc.ai[2] * num889; + if (npc.velocity.X > num890) + { + npc.velocity.X = num890; + } + if (npc.velocity.X < -num890) + { + npc.velocity.X = -num890; + } + float num891 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); + if (num891 < 150f) + { + npc.velocity.Y = npc.velocity.Y - 0.2f; + } + if (num891 > 200f) + { + npc.velocity.Y = npc.velocity.Y + 0.2f; + } + if (npc.velocity.Y > 9f) + { + npc.velocity.Y = 9f; + } + if (npc.velocity.Y < -9f) + { + npc.velocity.Y = -9f; + } + npc.rotation = npc.velocity.X * 0.05f; + if ((num888 < 500f || npc.ai[3] < 0f) && npc.position.Y < Main.player[npc.target].position.Y) + { + npc.ai[3] += 1f; + int num892 = 8; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num892 = 7; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num892 = 6; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num892 = 5; + } + num892++; + if (npc.ai[3] > (float)num892) + { + npc.ai[3] = (float)(-(float)num892); + } + if (npc.ai[3] == 0f && Main.netMode != 1) + { + Vector2 vector116 = new Vector2(npc.Center.X, npc.Center.Y); + vector116.X += npc.velocity.X * 7f; + float num893 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector116.X; + float num894 = Main.player[npc.target].Center.Y - vector116.Y; + float num895 = (float)Math.Sqrt((double)(num893 * num893 + num894 * num894)); + float num896 = 8f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num896 = 9f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num896 = 10f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num896 = 11f; + } + num895 = num896 / num895; + num893 *= num895; + num894 *= num895; + Projectile.NewProjectile(vector116.X, vector116.Y, num893, num894, 348, 50, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (npc.ai[3] < 0f) + { + npc.ai[3] += 1f; + } + if (Main.netMode != 1) + { + npc.ai[1] += (float)Main.rand.Next(1, 4); + if (npc.ai[1] > 600f && num888 < 600f) + { + npc.ai[0] = -1f; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.TargetClosest(true); + float num898 = 0.2f; + float num899 = 10f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num898 = 0.24f; + num899 = 12f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num898 = 0.28f; + num899 = 14f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num898 = 0.32f; + num899 = 16f; + } + num898 -= 0.05f; + num899 -= 1f; + if (npc.Center.X < Main.player[npc.target].Center.X) + { + npc.velocity.X = npc.velocity.X + num898; + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + } + if (npc.Center.X > Main.player[npc.target].Center.X) + { + npc.velocity.X = npc.velocity.X - num898; + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + } + if (npc.velocity.X > num899 || npc.velocity.X < -num899) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + float num900 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); + if (num900 < 180f) + { + npc.velocity.Y = npc.velocity.Y - 0.1f; + } + if (num900 > 200f) + { + npc.velocity.Y = npc.velocity.Y + 0.1f; + } + if (npc.velocity.Y > 7f) + { + npc.velocity.Y = 7f; + } + if (npc.velocity.Y < -7f) + { + npc.velocity.Y = -7f; + } + npc.rotation = npc.velocity.X * 0.01f; + if (Main.netMode != 1) + { + npc.ai[3] += 1f; + int num901 = 10; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num901 = 8; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num901 = 6; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num901 = 4; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num901 = 2; + } + num901 += 3; + if (npc.ai[3] >= (float)num901) + { + npc.ai[3] = 0f; + Vector2 vector117 = new Vector2(npc.Center.X, npc.position.Y + (float)npc.height - 14f); + int i2 = (int)(vector117.X / 16f); + int j2 = (int)(vector117.Y / 16f); + if (!WorldGen.SolidTile(i2, j2)) + { + float num902 = npc.velocity.Y; + if (num902 < 0f) + { + num902 = 0f; + } + num902 += 3f; + float speedX2 = npc.velocity.X * 0.25f; + int num903 = Projectile.NewProjectile(vector117.X, vector117.Y, speedX2, num902, 349, 44, 0f, Main.myPlayer, (float)Main.rand.Next(5), 0f); + } + } + } + if (Main.netMode != 1) + { + npc.ai[1] += (float)Main.rand.Next(1, 4); + if (npc.ai[1] > 450f) + { + npc.ai[0] = -1f; + } + } + } + else if (npc.ai[0] == 2f) + { + npc.TargetClosest(true); + Vector2 vector118 = new Vector2(npc.Center.X, npc.Center.Y - 20f); + float num904 = (float)Main.rand.Next(-1000, 1001); + float num905 = (float)Main.rand.Next(-1000, 1001); + float num906 = (float)Math.Sqrt((double)(num904 * num904 + num905 * num905)); + float num907 = 20f; + npc.velocity *= 0.95f; + num906 = num907 / num906; + num904 *= num906; + num905 *= num906; + npc.rotation += 0.2f; + vector118.X += num904 * 4f; + vector118.Y += num905 * 4f; + npc.ai[3] += 1f; + int num908 = 7; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num908--; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num908 -= 2; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num908 -= 3; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num908 -= 4; + } + if (npc.ai[3] > (float)num908) + { + npc.ai[3] = 0f; + int num909 = Projectile.NewProjectile(vector118.X, vector118.Y, num904, num905, 349, 40, 0f, Main.myPlayer, 0f, 0f); + } + if (Main.netMode != 1) + { + npc.ai[1] += (float)Main.rand.Next(1, 4); + if (npc.ai[1] > 300f) + { + npc.ai[0] = -1f; + } + } + } + if (npc.ai[0] == -1f) + { + int num910 = Main.rand.Next(3); + npc.TargetClosest(true); + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 1000f) + { + num910 = 0; + } + npc.ai[0] = (float)num910; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return false; + } + return false; + } + #endregion + #region EyeofCthulhu + else if (npc.type == NPCID.EyeofCthulhu && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + double getMad = 0.5; //0.5 + bool flag2 = false; + if ((double)npc.life < (double)npc.lifeMax * getMad) + { + flag2 = true; + } + float num5 = 20f; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + } + bool dead = Main.player[npc.target].dead; + float num6 = npc.position.X + (float)(npc.width / 2) - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); + float num7 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); + float num8 = (float)Math.Atan2((double)num7, (double)num6) + 1.57f; + if (num8 < 0f) + { + num8 += 6.283f; + } + else if ((double)num8 > 6.283) + { + num8 -= 6.283f; + } + float num9 = 0f; + if (npc.ai[0] == 0f && npc.ai[1] == 0f) + { + num9 = 0.02f; + } + if (npc.ai[0] == 0f && npc.ai[1] == 2f && npc.ai[2] > 40f) + { + num9 = 0.05f; + } + if (npc.ai[0] == 3f && npc.ai[1] == 0f) + { + num9 = 0.05f; + } + if (npc.ai[0] == 3f && npc.ai[1] == 2f && npc.ai[2] > 40f) + { + num9 = 0.08f; + } + if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > num5) + { + num9 = 0.15f; + } + if (npc.ai[0] == 3f && npc.ai[1] == 5f) + { + num9 = 0.05f; + } + num9 *= 1.5f; + if (npc.rotation < num8) + { + if ((double)(num8 - npc.rotation) > 3.1415) + { + npc.rotation -= num9; + } + else + { + npc.rotation += num9; + } + } + else if (npc.rotation > num8) + { + if ((double)(npc.rotation - num8) > 3.1415) + { + npc.rotation += num9; + } + else + { + npc.rotation -= num9; + } + } + if (npc.rotation > num8 - num9 && npc.rotation < num8 + num9) + { + npc.rotation = num8; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.283f; + } + else if ((double)npc.rotation > 6.283) + { + npc.rotation -= 6.283f; + } + if (npc.rotation > num8 - num9 && npc.rotation < num8 + num9) + { + npc.rotation = num8; + } + if (Main.rand.Next(5) == 0) + { + int num10 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default(Color), 1f); + Dust var_9_825_cp_0_cp_0 = Main.dust[num10]; + var_9_825_cp_0_cp_0.velocity.X = var_9_825_cp_0_cp_0.velocity.X * 0.5f; + Dust var_9_845_cp_0_cp_0 = Main.dust[num10]; + var_9_845_cp_0_cp_0.velocity.Y = var_9_845_cp_0_cp_0.velocity.Y * 0.1f; + } + if (Main.dayTime | dead) + { + npc.velocity.Y = npc.velocity.Y - 0.04f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + return false; + } + } + else if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + { + 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; + float num15 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + float num16 = num15; + num15 = num11 / num15; + num13 *= num15; + num14 *= num15; + if (npc.velocity.X < num13) + { + npc.velocity.X = npc.velocity.X + num12; + if (npc.velocity.X < 0f && num13 > 0f) + { + npc.velocity.X = npc.velocity.X + num12; + } + } + else if (npc.velocity.X > num13) + { + npc.velocity.X = npc.velocity.X - num12; + if (npc.velocity.X > 0f && num13 < 0f) + { + npc.velocity.X = npc.velocity.X - num12; + } + } + if (npc.velocity.Y < num14) + { + npc.velocity.Y = npc.velocity.Y + num12; + if (npc.velocity.Y < 0f && num14 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num12; + } + } + else if (npc.velocity.Y > num14) + { + npc.velocity.Y = npc.velocity.Y - num12; + if (npc.velocity.Y > 0f && num14 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num12; + } + } + npc.ai[2] += 1f; + float num17 = 180f; + if (npc.ai[2] >= num17) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.target = 255; + npc.netUpdate = true; + } + else if (num16 < 500f) + { + if (!Main.player[npc.target].dead) + { + npc.ai[3] += 1f; + } + float num18 = 44f; + if (npc.ai[3] >= num18) + { + npc.ai[3] = 0f; + npc.rotation = num8; + float num19 = 5f; + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector.X; + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + num22 = num19 / num22; + Vector2 vector2 = vector; + Vector2 vector3; + vector3.X = num20 * num22; + vector3.Y = num21 * num22; + vector2.X += vector3.X * 10f; + vector2.Y += vector3.Y * 10f; + if (Main.netMode != 1) + { + int num23 = NPC.NewNPC((int)vector2.X, (int)vector2.Y, 5, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num23].velocity.X = vector3.X; + Main.npc[num23].velocity.Y = vector3.Y; + if (Main.netMode == 2 && num23 < 200) + { + NetMessage.SendData(23, -1, -1, null, num23, 0f, 0f, 0f, 0, 0, 0); + } + } + Main.PlaySound(3, (int)vector2.X, (int)vector2.Y, 1, 1f, 0f); + int num; + for (int m = 0; m < 10; m = num + 1) + { + Dust.NewDust(vector2, 20, 20, 5, vector3.X * 0.4f, vector3.Y * 0.4f, 0, default(Color), 1f); + num = m; + } + } + } + } + else if (npc.ai[1] == 1f) + { + npc.rotation = num8; + 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; + float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); + num27 = num24 / num27; + npc.velocity.X = num25 * num27; + npc.velocity.Y = num26 * num27; + npc.ai[1] = 2f; + npc.netUpdate = true; + if (npc.netSpam > 10) + { + npc.netSpam = 10; + } + } + else if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 40f) + { + npc.velocity *= 0.975f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + int num28 = 90; + if (npc.ai[2] >= (float)num28) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num8; + if (npc.ai[3] >= 3f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + { + npc.ai[1] = 1f; + } + } + } + float num29 = 0.9f; + if (((float)npc.life < (float)npc.lifeMax * num29) || CalamityWorld.death) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + if (npc.netSpam > 10) + { + npc.netSpam = 10; + return false; + } + } + } + else if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if ((double)npc.ai[2] > 0.5) + { + npc.ai[2] = 0.5f; + } + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + { + npc.ai[2] = 0f; + } + } + npc.rotation += npc.ai[2]; + npc.ai[1] += 1f; + if (npc.ai[1] % 20f == 0f) + { + float num30 = 5f; + Vector2 vector5 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num31 = (float)Main.rand.Next(-200, 200); + float num32 = (float)Main.rand.Next(-200, 200); + float num33 = (float)Math.Sqrt((double)(num31 * num31 + num32 * num32)); + num33 = num30 / num33; + Vector2 vector6 = vector5; + Vector2 vector7; + vector7.X = num31 * num33; + vector7.Y = num32 * num33; + vector6.X += vector7.X * 10f; + vector6.Y += vector7.Y * 10f; + if (Main.netMode != 1) + { + int num34 = NPC.NewNPC((int)vector6.X, (int)vector6.Y, 5, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num34].velocity.X = vector7.X; + Main.npc[num34].velocity.Y = vector7.Y; + if (Main.netMode == 2 && num34 < 200) + { + NetMessage.SendData(23, -1, -1, null, num34, 0f, 0f, 0f, 0, 0, 0); + } + } + int num; + for (int n = 0; n < 10; n = num + 1) + { + Dust.NewDust(vector6, 20, 20, 5, vector7.X * 0.4f, vector7.Y * 0.4f, 0, default(Color), 1f); + num = n; + } + } + if (npc.ai[1] == 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + if (npc.ai[0] == 3f) + { + npc.ai[2] = 0f; + } + else + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + int num; + for (int num35 = 0; num35 < 2; num35 = num + 1) + { + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 8, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f); + Gore.NewGore(npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f); + num = num35; + } + for (int num36 = 0; num36 < 20; num36 = num + 1) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f); + num = num36; + } + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + } + } + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f); + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.Y = npc.velocity.Y * 0.98f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + return false; + } + } + else + { + if (flag2) + { + npc.defense = -5; + } + else + { + npc.damage = (int)(20f * Main.expertDamage); + } + if (npc.ai[1] == 0f & flag2) + { + npc.ai[1] = 5f; + } + if (npc.ai[1] == 0f) + { + 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; + float num41 = (float)Math.Sqrt((double)(num39 * num39 + num40 * num40)); + if (num41 > 400f) + { + num37 += 1.25f; + num38 += 0.075f; + if (num41 > 600f) + { + num37 += 1.25f; + num38 += 0.075f; + if (num41 > 800f) + { + num37 += 1.25f; + num38 += 0.075f; + } + } + } + num41 = num37 / num41; + num39 *= num41; + num40 *= num41; + if (npc.velocity.X < num39) + { + npc.velocity.X = npc.velocity.X + num38; + if (npc.velocity.X < 0f && num39 > 0f) + { + npc.velocity.X = npc.velocity.X + num38; + } + } + else if (npc.velocity.X > num39) + { + npc.velocity.X = npc.velocity.X - num38; + if (npc.velocity.X > 0f && num39 < 0f) + { + npc.velocity.X = npc.velocity.X - num38; + } + } + if (npc.velocity.Y < num40) + { + npc.velocity.Y = npc.velocity.Y + num38; + if (npc.velocity.Y < 0f && num40 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num38; + } + } + else if (npc.velocity.Y > num40) + { + npc.velocity.Y = npc.velocity.Y - num38; + if (npc.velocity.Y > 0f && num40 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num38; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 200f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + if ((double)npc.life < (double)npc.lifeMax * 0.4) + { + npc.ai[1] = 3f; + } + npc.target = 255; + npc.netUpdate = true; + } + } + else if (npc.ai[1] == 1f) + { + Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + npc.rotation = num8; + float num42 = ((enraged || configBossRushBoost) ? 9.5f : 6.2f); + if (npc.ai[3] == 1f) + { + num42 *= 1.15f; + } + if (npc.ai[3] == 2f) + { + num42 *= 1.3f; + } + Vector2 vector9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num43 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector9.X; + float num44 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector9.Y; + float num45 = (float)Math.Sqrt((double)(num43 * num43 + num44 * num44)); + num45 = num42 / num45; + npc.velocity.X = num43 * num45; + npc.velocity.Y = num44 * num45; + npc.ai[1] = 2f; + npc.netUpdate = true; + if (npc.netSpam > 10) + { + npc.netSpam = 10; + } + } + else if (npc.ai[1] == 2f) + { + float num46 = CalamityWorld.death ? 70f : 60f; + npc.ai[2] += 1f; + if (npc.ai[2] >= num46) + { + npc.velocity *= 0.96f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + int num47 = CalamityWorld.death ? 70 : 80; + if (npc.ai[2] >= (float)num47) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num8; + if (npc.ai[3] >= 3f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + if (Main.netMode != 1 && (double)npc.life < (double)npc.lifeMax * 0.6) + { + npc.ai[1] = 3f; + npc.ai[3] += (float)Main.rand.Next(1, 4); + } + npc.netUpdate = true; + if (npc.netSpam > 10) + { + npc.netSpam = 10; + } + } + else + { + npc.ai[1] = 1f; + } + } + } + else if (npc.ai[1] == 3f) + { + if ((npc.ai[3] == 4f & flag2) && npc.Center.Y > Main.player[npc.target].Center.Y) + { + npc.TargetClosest(true); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + if (npc.netSpam > 10) + { + npc.netSpam = 10; + } + } + else if (Main.netMode != 1) + { + npc.TargetClosest(true); + 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; + float num51 = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; + num51 += 10f - num51; + if (num51 < 5f) + { + num51 = 5f; + } + if (num51 > 15f) + { + num51 = 15f; + } + if (npc.ai[2] == -1f) + { + num51 *= 4f; + num48 *= 1.3f; + } + num49 -= Main.player[npc.target].velocity.X * num51; + num50 -= Main.player[npc.target].velocity.Y * num51 / 4f; + num49 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + num50 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + float num52 = (float)Math.Sqrt((double)(num49 * num49 + num50 * num50)); + float num53 = num52; + num52 = num48 / num52; + npc.velocity.X = num49 * num52; + npc.velocity.Y = num50 * num52; + npc.velocity.X = npc.velocity.X + (float)Main.rand.Next(-20, 21) * 0.1f; + npc.velocity.Y = npc.velocity.Y + (float)Main.rand.Next(-20, 21) * 0.1f; + if (num53 < 100f) + { + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + float num56 = Math.Abs(npc.velocity.X); + float num57 = Math.Abs(npc.velocity.Y); + if (npc.Center.X > Main.player[npc.target].Center.X) + { + num57 *= -1f; + } + if (npc.Center.Y > Main.player[npc.target].Center.Y) + { + num56 *= -1f; + } + npc.velocity.X = num57; + npc.velocity.Y = num56; + } + } + else if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + { + float num58 = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; + float num59 = num58; + if (npc.Center.X > Main.player[npc.target].Center.X) + { + num59 *= -1f; + } + if (npc.Center.Y > Main.player[npc.target].Center.Y) + { + num58 *= -1f; + } + npc.velocity.X = num59; + npc.velocity.Y = num58; + } + npc.ai[1] = 4f; + npc.netUpdate = true; + if (npc.netSpam > 10) + { + npc.netSpam = 10; + } + } + } + else if (npc.ai[1] == 4f) + { + if (npc.ai[2] == 0f) + { + Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); + } + float num60 = num5; + npc.ai[2] += 1f; + if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) + { + npc.ai[2] -= 1f; + } + if (npc.ai[2] >= num60) + { + npc.velocity *= 0.95f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + float num61 = num60 + 13f; + if (npc.ai[2] >= num61) + { + npc.netUpdate = true; + if (npc.netSpam > 10) + { + npc.netSpam = 10; + } + npc.ai[3] += 1f; + npc.ai[2] = 0f; + if (npc.ai[3] >= 5f) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + { + npc.ai[1] = 3f; + } + } + } + else if (npc.ai[1] == 5f) + { + float num62 = 600f; + 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; + float num67 = (float)Math.Sqrt((double)(num65 * num65 + num66 * num66)); + num67 = num63 / num67; + num65 *= num67; + num66 *= num67; + if (npc.velocity.X < num65) + { + npc.velocity.X = npc.velocity.X + num64; + if (npc.velocity.X < 0f && num65 > 0f) + { + npc.velocity.X = npc.velocity.X + num64; + } + } + else if (npc.velocity.X > num65) + { + npc.velocity.X = npc.velocity.X - num64; + if (npc.velocity.X > 0f && num65 < 0f) + { + npc.velocity.X = npc.velocity.X - num64; + } + } + if (npc.velocity.Y < num66) + { + npc.velocity.Y = npc.velocity.Y + num64; + if (npc.velocity.Y < 0f && num66 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num64; + } + } + else if (npc.velocity.Y > num66) + { + npc.velocity.Y = npc.velocity.Y - num64; + if (npc.velocity.Y > 0f && num66 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num64; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 70f) + { + npc.TargetClosest(true); + npc.ai[1] = 3f; + npc.ai[2] = -1f; + npc.ai[3] = (float)Main.rand.Next(-3, 1); + npc.netUpdate = true; + } + } + } + return false; + } + #endregion + } + return true; + } + #endregion + + #region AI + public override void AI(NPC npc) + { + if (!CalamityWorld.spawnedHardBoss) + { + if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCID.SkeletronPrime || + npc.type == NPCID.Plantera || npc.type == mod.NPCType("Cryogen") || npc.type == mod.NPCType("AquaticScourgeHead") || + npc.type == mod.NPCType("BrimstoneElemental") || npc.type == mod.NPCType("Astrageldon") || npc.type == mod.NPCType("AstrumDeusHeadSpectral") || + npc.type == mod.NPCType("Calamitas") || npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("PlaguebringerGoliath") || + npc.type == mod.NPCType("ScavengerBody") || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.Golem) + { + CalamityWorld.spawnedHardBoss = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + } + #region RevengeanceAIChanges + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + + #region MoonLord + if (npc.type == NPCID.MoonLordFreeEye) + { + if (NPC.CountNPCS(NPCID.MoonLordFreeEye) > 3) + { + npc.dontTakeDamage = false; + } + else + { + npc.dontTakeDamage = true; + } + } + 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; + } + } + else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) + { + if (npc.ai[0] == -2f) + { + if ((double)Main.npc[(int)npc.ai[3]].life <= (double)Main.npc[(int)npc.ai[3]].lifeMax * 0.75) + { + if (newAI[2] < 90f) + { + newAI[2] += 1f; + } + if ((int)newAI[2] % 60 == 0) + { + npc.netUpdate = true; + if (Main.netMode != 1) + { + int num = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, 400, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num].ai[3] = npc.ai[3]; + Main.npc[num].netUpdate = true; + } + } + } + if ((CalamityWorld.death || CalamityWorld.bossRushActive) && npc.type == NPCID.MoonLordHead) + { + if ((double)Main.npc[(int)npc.ai[3]].life <= (double)Main.npc[(int)npc.ai[3]].lifeMax * 0.5) + { + if (newAI[2] < 150f) + { + newAI[2] += 1f; + } + if ((int)newAI[2] % 60 == 0) + { + npc.netUpdate = true; + if (Main.netMode != 1) + { + int num = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, 400, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num].ai[3] = npc.ai[3]; + Main.npc[num].netUpdate = true; + } + } + } + } + } + } + #endregion + #region LunaticCultist + else if (npc.type == NPCID.CultistBoss) + { + if (npc.buffImmune[mod.BuffType("Enraged")]) + { + npc.buffImmune[mod.BuffType("Enraged")] = false; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.5 || enraged || configBossRushBoost) + { + if (!NPC.AnyNPCs(mod.NPCType("Eidolist"))) + { + if (newAI[0] < 120f) + { + newAI[0] += 1f; + } + if (newAI[0] >= 120f) + { + newAI[0] = 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); + } + newAI[0] = -360f; + } + } + } + else + { + if (CultCountdown == 0) + { + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + CultCountdown = 75; + } + else if ((double)npc.life <= (double)npc.lifeMax * 0.5) + { + CultCountdown = 150; + } + else + { + CultCountdown = 200; + } + } + if (CultCountdown > 0) + { + CultCountdown--; + if (CultCountdown == 0) + { + if (Main.netMode != 1) + { + Player player2 = Main.player[npc.target]; + int speed2 = 8; + float spawnX = Main.rand.Next(1000) - 500 + player2.Center.X; + float spawnY = -1000 + player2.Center.Y; + Vector2 baseSpawn = new Vector2(spawnX, spawnY); + Vector2 baseVelocity = player2.Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity = baseVelocity * speed2; + int damage = 25; //100 + for (int i = 0; i < CultProjectiles; i++) + { + Vector2 spawn2 = baseSpawn; + spawn2.X = spawn2.X + i * 30 - (CultProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-CultAngleSpread / 2 + (CultAngleSpread * i / (float)CultProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + int projectileType = Main.rand.Next(3); + if (projectileType == 0) + { + projectileType = 467; + } + else if (projectileType == 1) + { + projectileType = 348; + } + else + { + projectileType = 593; + } + int projectileI = Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[projectileI].tileCollide = false; + } + } + } + } + } + } + #endregion + #region DukeFishron + else if (npc.type == NPCID.DukeFishron) + { + Vector2 vector = npc.Center; + bool murderMode = (double)npc.life <= (double)npc.lifeMax * 0.75; + bool murderMode2 = (double)npc.life <= (double)npc.lifeMax * ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.3 : 0.2); + float num = 0.6f * Main.damageMultiplier; //1.2 + bool flag3 = npc.ai[0] > 4f; + bool flag4 = npc.ai[0] > 9f; + if (flag4) + { + npc.damage = (int)((float)npc.defDamage * 1.1f * num); + npc.defense = 38; + newAI[0] += 1f; + if (newAI[0] >= 600f) + { + newAI[0] = 0f; + if (Main.netMode != 1) + { + Projectile.NewProjectile(vector.X, vector.Y, 0f, 0f, 385, 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + npc.netUpdate = true; + } + } + else if (flag3) + { + npc.damage = (int)((float)npc.defDamage * 1.2f * num); + npc.defense = (int)((float)npc.defDefense * 1.1f); + } + else + { + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + } + if (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f || (Main.player[npc.target].position.Y < 800f || (double)Main.player[npc.target].position.Y > Main.worldSurface * 16.0 || (Main.player[npc.target].position.X > 6400f && Main.player[npc.target].position.X < (float)(Main.maxTilesX * 16 - 6400)))) + { + npc.dontTakeDamage = true; + } + else if (npc.ai[0] <= 8f) + { + npc.dontTakeDamage = false; + } + if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 11f) + { + npc.velocity *= 1.01f; //20, 24, 30 + } + if (npc.ai[0] == 0f && !Main.player[npc.target].dead) + { + if (murderMode) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 5f && !Main.player[npc.target].dead) + { + if (murderMode2) + { + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + } + #endregion + #region Golem + else if (npc.type == NPCID.GolemHeadFree && !CalamityWorld.bossRushActive) + { + bool enrage = true; + if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int num = (int)Main.player[npc.target].Center.X / 16; + int num2 = (int)Main.player[npc.target].Center.Y / 16; + Tile tile = Framing.GetTileSafely(num, num2); + if (tile.wall == 87) + { + enrage = false; + } + } + if (NPC.CountNPCS(NPCID.Golem) > 0) + { + if (enrage) + { + npc.ai[1] += 3f; + } + npc.ai[1] -= 0.25f; //0.75 + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.8) + { + npc.ai[1] -= 0.75f; //1 + } + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.6) + { + npc.ai[1] -= 0.75f; //1.25 + } + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) + { + npc.ai[1] -= 0.75f; //1.5 + } + if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) + { + npc.ai[1] -= 0.75f; //1.75 + } + if (enrage) + { + npc.ai[2] += 3f; + } + npc.ai[2] -= 0.25f; //0.75 + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 2) + { + npc.ai[2] -= 0.75f; //1 + } + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 3) + { + npc.ai[2] -= 0.75f; //1.25 + } + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 4) + { + npc.ai[2] -= 0.5f; //1.75 + } + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 5) + { + npc.ai[2] -= 0.5f; //1.25 + } + if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 6) + { + npc.ai[2] -= 0.25f; //2 + } + } + } + else if (npc.type == NPCID.GolemHead && !CalamityWorld.bossRushActive) + { + bool enrage = true; + if ((double)Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int num = (int)Main.player[npc.target].Center.X / 16; + int num2 = (int)Main.player[npc.target].Center.Y / 16; + Tile tile = Framing.GetTileSafely(num, num2); + if (tile.wall == 87) + { + enrage = false; + } + } + if (npc.ai[0] == 1f) + { + if (enrage) + { + npc.ai[1] += 3f; + } + npc.ai[1] -= 0.25f; //0.75 + if ((double)npc.life < (double)npc.lifeMax * 0.4) + { + npc.ai[1] -= 0.75f; //1 + } + if ((double)npc.life < (double)npc.lifeMax * 0.2) + { + npc.ai[1] -= 0.75f; //1.25 + } + if (enrage) + { + npc.ai[2] += 3f; + } + npc.ai[2] -= 0.25f; //0.75 + if (npc.life < npc.lifeMax / 3) + { + npc.ai[2] -= 0.75f; //1 + } + if (npc.life < npc.lifeMax / 4) + { + npc.ai[2] -= 0.75f; //1.25 + } + if (npc.life < npc.lifeMax / 5) + { + npc.ai[2] -= 0.75f; //1.5 + } + } + } + #endregion + #region Plantera + else if (npc.type == NPCID.Plantera) + { + bool jungle = Main.player[npc.target].ZoneJungle; + if (npc.life < npc.lifeMax / 8 || CalamityWorld.bossRushActive) + { + npc.velocity.X *= 1.003f; + npc.velocity.Y *= 1.003f; + } + else if (npc.life < npc.lifeMax / 4) + { + npc.velocity.X *= 1.001f; + npc.velocity.Y *= 1.001f; + } + else if (npc.life < npc.lifeMax / 2) + { + npc.velocity.X *= 1.0005f; + npc.velocity.Y *= 1.0005f; + } + if (npc.life > npc.lifeMax / 2) + { + npc.defense = 42; + if (!jungle && !CalamityWorld.bossRushActive) + { + npc.defense = 200; + npc.damage = (int)(120f * Main.damageMultiplier); + } + if (Main.netMode != 1) + { + npc.localAI[1] += ((enraged || configBossRushBoost) ? 3f : 1.5f); + } + } + else + { + npc.defense = 22; + if (!jungle && !CalamityWorld.bossRushActive) + { + npc.defense = 400; + npc.damage = (int)(200f * Main.damageMultiplier); + } + newAI[0] += 1f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + newAI[0] += 0.5f; + } + if (newAI[0] >= ((enraged || configBossRushBoost) ? 150f : 270f)) + { + newAI[0] = 0f; + if (Main.netMode != 1 && NPC.CountNPCS(NPCID.PlanterasTentacle) < 20) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + if (CalamityWorld.death || (double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) + { + newAI[1] += 1f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + newAI[1] += 0.5f; + } + if (!jungle) + { + newAI[1] += 2f; + } + 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)) + { + Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num349 *= num351; + num350 *= num351; + if (Main.netMode != 1) + { + float num418 = (!jungle ? 24f : 12f); + int num419 = 32; + int num420 = 277; + num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = num418 / num351; + num349 *= num351; + num350 *= num351; + num349 += (float)Main.rand.Next(-10, 11) * 0.05f; + num350 += (float)Main.rand.Next(-10, 11) * 0.05f; + vector34.X += num349 * 4f; + vector34.Y += num350 * 4f; + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + npc.localAI[1] += 1f; + } + } + if (npc.type == NPCID.PlanterasTentacle) + { + bool jungle = Main.player[npc.target].ZoneJungle; + newAI[0] += 1f; + if (CalamityWorld.death || !jungle) + { + newAI[0] += 1f; + } + if (newAI[0] >= 480f) + { + newAI[0] = 0f; + if (Main.netMode != 1 && NPC.CountNPCS(NPCID.Spore) < 20) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } + #endregion + #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 || targetFloatingUp) + { + npc.localAI[0] += 1f; + if ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[0] += 1f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[0] += 1f; + } + if (npc.localAI[0] >= ((enraged || configBossRushBoost) ? 90f : 120f)) + { + npc.localAI[0] = 0f; + Vector2 vector16 = npc.Center; + float num157 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector16.X; + float num158 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector16.Y; + Math.Sqrt((double)(num157 * num157 + num158 * num158)); + if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num159 = 7f; + float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); + num162 = num159 / num162; + num160 *= num162; + num161 *= num162; + Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); + value.Normalize(); + value *= num159; + value += npc.velocity; + num160 = value.X; + num161 = value.Y; + int num163 = 27; + int num164 = 270; + vector16 += value * 5f; + int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[num165].timeLeft = 300; + } + } + } + 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 || 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); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int damage = 30; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int projectile = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 6f), (float)(Math.Cos(offsetAngle) * 6f), 100, damage, 0f, Main.myPlayer, 0f, 0f); + int projectile2 = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 6f), (float)(-Math.Cos(offsetAngle) * 6f), 100, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].timeLeft = 300; + Main.projectile[projectile2].timeLeft = 300; + Main.projectile[projectile].tileCollide = false; + Main.projectile[projectile2].tileCollide = false; + } + } + } + } + if (npc.ai[1] == 1f) + { + int speed = CalamityWorld.bossRushActive ? 7 : 3; + if ((double)npc.life <= (double)npc.lifeMax * 0.7) + { + speed++; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.3) + { + speed++; + } + if (enraged || configBossRushBoost) + { + speed += 3; + } + float speed2 = (float)speed; + float speedBuff = 3f + (3f * (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; + float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445)); + speed2 += num446 / 100f; + if (speed2 < speedBuff) + { + speed2 = speedBuff; + } + if (speed2 > speedBuff2) + { + speed2 = speedBuff2; + } + if (targetFloatingUp) + { + speed2 += 5f; + } + num446 = speed2 / num446; + npc.velocity.X = num444 * num446; + npc.velocity.Y = num445 * num446; + } + } + else if (npc.type == NPCID.PrimeLaser) + { + if (Main.netMode != 1) + { + npc.localAI[0] += 2f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.localAI[0] += 2f; + } + } + } + else if (npc.type == NPCID.PrimeCannon) + { + npc.TargetClosest(true); + Vector2 vector61 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num499 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector61.X; + float num500 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector61.Y; + npc.rotation = (float)Math.Atan2((double)num500, (double)num499) - 1.57f; + if (Main.netMode != 1) + { + npc.localAI[0] = 0f; + npc.localAI[1] += 1f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 1f; + } + if (npc.ai[2] == 1f) + { + npc.localAI[1] += 2f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 2f; + } + } + if (npc.localAI[1] > ((enraged || configBossRushBoost) ? 90f : 120f)) + { + npc.localAI[1] = 0f; + 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 num941 = 9f; //speed + 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; + int num945 = 27; + int num946 = 303; + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num947].timeLeft = 180; + npc.netUpdate = true; + } + } + } + } + #endregion + #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) + { + spazAlive = Main.npc[fireEye].active; + } + if (npc.ai[0] == 0f) + { + double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8 : 0.6); + if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) + { + if (spazAlive) + { + if (Main.npc[fireEye].ai[0] == 1f || Main.npc[fireEye].ai[0] == 2f || Main.npc[fireEye].ai[0] == 0f) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + } + else + { + npc.dontTakeDamage = false; + } + npc.defense = npc.defDefense + 20; + if (npc.ai[1] == 0f) + { + npc.ai[2] += (spazAlive ? 0.25f : 0.5f); + npc.localAI[1] += (spazAlive ? 0.5f : 1f); + } + else + { + 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 || 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); + float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num349 *= num351; + num350 *= num351; + if (Main.netMode != 1) + { + float num353 = 8f; + int num354 = 29; + int num355 = mod.ProjectileType("ScavengerLaser"); + vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num349 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector34.X; + num350 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector34.Y; + num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = num353 / num351; + num349 *= num351; + num350 *= num351; + vector34.X += num349; + vector34.Y += num350; + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num355, num354, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else if (npc.type == NPCID.Spazmatism) + { + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + fireEye = npc.whoAmI; + bool retAlive = false; + if (laserEye != -1) + { + retAlive = Main.npc[laserEye].active; + } + if (npc.ai[0] == 0f) + { + double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8 : 0.6); + if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) + { + if (retAlive) + { + if (Main.npc[laserEye].ai[0] == 1f || Main.npc[laserEye].ai[0] == 2f || Main.npc[laserEye].ai[0] == 0f) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + } + else + { + npc.dontTakeDamage = false; + } + npc.defense = npc.defDefense + 30; + if (npc.ai[1] == 0f) + { + if (!Main.player[npc.target].dead) + { + newAI[0] += 1f; + } + 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)) + { + Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num349 *= num351; + num350 *= num351; + if (Main.netMode != 1) + { + float num418 = ((enraged || configBossRushBoost) ? 25f : 18f); + int num419 = 30; + int num420 = 96; + num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = num418 / num351; + num349 *= num351; + num350 *= num351; + num349 += (float)Main.rand.Next(-30, 31) * 0.05f; + num350 += (float)Main.rand.Next(-30, 31) * 0.05f; + vector34.X += num349 * 4f; + vector34.Y += num350 * 4f; + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + 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 || configBossRushBoost) + { + npc.velocity.X *= 1.01f; + npc.velocity.Y *= 1.01f; + } + } + else + { + 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 ? 1f : 1.001f); + npc.velocity.Y *= (retAlive ? 1f : 1.001f); + } + if (enraged || configBossRushBoost) + { + npc.velocity.X *= 1.003f; + npc.velocity.Y *= 1.003f; + } + } + } + } + #endregion + #region TheDestroyer + else if (npc.type == NPCID.TheDestroyerBody) + { + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + int defenseUp = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); + if (targetFloatingUp) + { + if (newAI[2] < 480f) //8 seconds + newAI[2] += 1f; + } + else + { + if (newAI[2] > 0f) + newAI[2] -= 1f; + } + npc.defense = npc.defDefense + defenseUp; + npc.localAI[0] = 0f; + int shootTime = ((enraged || configBossRushBoost) ? 8 : 4); + if (CalamityWorld.bossRushActive) + { + shootTime += 1; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + shootTime += 1; + } + if (Main.netMode != 1) + { + newAI[0] += (float)Main.rand.Next(shootTime); + if (newAI[0] >= (float)Main.rand.Next(1400, 26000)) + { + newAI[0] = 0f; + 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 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)) + { + laserSpeedBoost = System.Math.Abs(Main.player[npc.target].velocity.Y); + } + float speed = 2f + laserSpeedBoost; + if (speed < 7f) + { + speed = 7f; + } + if (speed > 10f) + { + speed = 10f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.7) + { + speed += 0.25f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.4 || CalamityWorld.bossRushActive) + { + speed += CalamityWorld.death ? 0.33f : 0.25f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + speed += CalamityWorld.death ? 0.33f : 0.25f; + } + int num9 = 28; + int num10 = 100; + int value = (CalamityWorld.bossRushActive ? 3 : 4); + 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); + num9 = 31; + } + 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 num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y; + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + vector.X += num6 * 5f; + vector.Y += num7 * 5f; + int num11 = Projectile.NewProjectile(vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f); + if (num10 != mod.ProjectileType("DestroyerHomingLaser")) + { + Main.projectile[num11].timeLeft = 300; + } + npc.netUpdate = true; + } + } + } + } + #endregion + #region WallofFlesh + else if (npc.type == NPCID.WallofFlesh) + { + if (enraged || configBossRushBoost) + { + npc.velocity.X *= 1.7f; + } + else if (CalamityWorld.bossRushActive) + { + npc.velocity.X *= 1.3f; + } + else if (CalamityWorld.death) + { + npc.velocity.X *= 1.18f; + } + else + { + npc.velocity.X *= 1.12f; + } + } + else if (npc.type == NPCID.WallofFleshEye) + { + if (NPC.CountNPCS(NPCID.WallofFlesh) > 0) + { + Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num349 *= num351; + num350 *= num351; + bool flag30 = true; + if (npc.direction > 0) + { + if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) < npc.position.X + (float)(npc.width / 2)) + { + flag30 = false; + } + } + else if (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) > npc.position.X + (float)(npc.width / 2)) + { + flag30 = false; + } + if (Main.netMode != 1) + { + int num352 = ((enraged || configBossRushBoost) ? 7 : 4); + npc.localAI[1] = 0f; + 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; + num352++; + } + if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5) + { + npc.localAI[3] += 1f; + num352++; + } + if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25) + { + npc.localAI[3] += 1f; + num352 += 2; + } + if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[3] += 2f; + num352 += 3; + } + if (newAI[0] == 0f) + { + if (npc.localAI[3] > 600f) + { + newAI[0] = 1f; + npc.localAI[3] = 0f; + return; + } + } + else if (npc.localAI[3] > 45f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.localAI[3] = 0f; + newAI[0] += 1f; + if (newAI[0] >= (float)num352) + { + newAI[0] = 0f; + } + if (flag30) + { + 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) + { + num354++; + num353 += 1f; + } + if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25) + { + num354++; + num353 += 1f; + } + if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num354 += 2; + num353 += 2f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num353 += 1f; + } + vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num349 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector34.X; + num350 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector34.Y; + num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = num353 / num351; + num349 *= num351; + num350 *= num351; + vector34.X += num349; + vector34.Y += num350; + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num355, num354, 0f, Main.myPlayer, 0f, 0f); + return; + } + } + } + } + } + #endregion + #region Skeletron + else if (npc.type == NPCID.SkeletronHand) + { + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 0f) + { + npc.ai[3] += ((enraged || configBossRushBoost) ? 1.5f : 0.5f); + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.ai[3] += 1f; + } + } + } + } + else if (npc.type == NPCID.SkeletronHead || npc.type == NPCID.DungeonGuardian) + { + if (npc.ai[1] == 1f) + { + if (Main.netMode != 1) + { + npc.localAI[1] += ((enraged || configBossRushBoost) ? 6f : 3f); + if ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 3f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.15 || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 3f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.localAI[1] += 3f; + } + if (npc.localAI[1] >= 500f) + { + npc.localAI[1] = 0f; + Vector2 vector16 = npc.Center; + if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num159 = 5f; + float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); + num162 = num159 / num162; + num160 *= num162; + num161 *= num162; + Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); + value.Normalize(); + value *= num159; + value += npc.velocity; + num160 = value.X; + num161 = value.Y; + int num163 = 20; + int num164 = 270; + vector16 += value * 5f; + int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[num165].timeLeft = 300; + } + } + } + Vector2 vector20 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num173 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector20.X; + 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 || configBossRushBoost) { num176 += 3f; } + if (num175 > 150f) + { + num176 *= 1.05f; + } + if (num175 > 200f) + { + num176 *= 1.1f; + } + if (num175 > 250f) + { + num176 *= 1.1f; + } + if (num175 > 300f) + { + num176 *= 1.1f; + } + if (num175 > 350f) + { + num176 *= 1.1f; + } + if (num175 > 400f) + { + num176 *= 1.1f; + } + if (num175 > 450f) + { + num176 *= 1.1f; + } + if (num175 > 500f) + { + num176 *= 1.1f; + } + if (num175 > 550f) + { + num176 *= 1.1f; + } + if (num175 > 600f) + { + num176 *= 1.1f; + } + num175 = num176 / num175; + npc.velocity.X = num173 * num175; + npc.velocity.Y = num174 * num175; + } + else if (npc.ai[1] == 2f) + { + Vector2 vector21 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num177 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector21.X; + float num178 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector21.Y; + float num179 = (float)Math.Sqrt((double)(num177 * num177 + num178 * num178)); + num179 = 12f / num179; + npc.velocity.X = num177 * num179; + npc.velocity.Y = num178 * num179; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 60f) + { + npc.localAI[1] = 0f; + Vector2 vector16 = npc.Center; + if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num159 = 5f; + float num160 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector16.X + (float)Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector16.Y + (float)Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt((double)(num160 * num160 + num161 * num161)); + num162 = num159 / num162; + num160 *= num162; + num161 *= num162; + Vector2 value = new Vector2(num160 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); + value.Normalize(); + value *= num159; + value += npc.velocity; + num160 = value.X; + num161 = value.Y; + int num163 = 2500; + int num164 = 270; + vector16 += value * 5f; + int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[num165].timeLeft = 300; + } + } + } + } + } + #endregion + #region QueenBee + else if (npc.type == NPCID.QueenBee) + { + Vector2 vector74 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + if (npc.ai[0] == 1f) + { + npc.ai[1] += 1f; + } + else if (npc.ai[0] == 3f) + { + newAI[0] += 1f; + bool flag39 = false; + if (CalamityWorld.death) + { + if (newAI[0] % 10f == 9f) + { + flag39 = true; + } + } + else if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + if (newAI[0] % 20f == 19f) + { + flag39 = true; + } + } + else if (npc.life < npc.lifeMax / 3) + { + if (newAI[0] % 35f == 34f) + { + flag39 = true; + } + } + else if (npc.life < npc.lifeMax / 2) + { + if (newAI[0] % 50f == 49f) + { + flag39 = true; + } + } + else if (newAI[0] % 55f == 54f) + { + flag39 = true; + } + if (flag39 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector74, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Main.PlaySound(SoundID.Item17, npc.position); + if (Main.netMode != 1) + { + float num602 = 13f; + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num602 += 3f; + } + if (CalamityWorld.death) + { + num602 += 2f; + } + float num603 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector74.X + (float)Main.rand.Next(-80, 81); + float num604 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector74.Y + (float)Main.rand.Next(-40, 41); + float num605 = (float)Math.Sqrt((double)(num603 * num603 + num604 * num604)); + num605 = num602 / num605; + num603 *= num605; + num604 *= num605; + int num606 = 13; + int num607 = 55; + int num608 = Projectile.NewProjectile(vector74.X, vector74.Y, num603, num604, num607, num606, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num608].timeLeft = 300; + } + } + } + } + #endregion + #region BrainofCthulhu + else if (npc.type == NPCID.BrainofCthulhu) + { + if (CalamityWorld.death) + { + if (npc.ai[0] < 0f) + { + newAI[0] += 1f; + if (newAI[0] >= 480f) + { + newAI[0] = 0f; + if (Main.netMode != 1 && NPC.CountNPCS(NPCID.Creeper) < 15) + { + int creeper = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), 267, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[creeper].netUpdate = true; + } + npc.netUpdate = true; + } + } + } + else + { + newAI[0] += 1f; + if (newAI[0] >= 600f) + { + newAI[0] = 0f; + if (Main.netMode != 1 && NPC.CountNPCS(NPCID.Creeper) < 10) + { + int creeper = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), 267, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[creeper].netUpdate = true; + } + npc.netUpdate = true; + } + } + if (npc.ai[0] < 0f) + { + npc.knockBackResist = (CalamityWorld.death ? 0.05f : 0.1f) * Main.expertKnockBack; + npc.velocity.X *= 1.006f; + npc.velocity.Y *= 1.006f; + if (CalamityWorld.death) + { + npc.velocity.X *= 1.003f; + npc.velocity.Y *= 1.003f; + } + } + } + else if (npc.type == NPCID.Creeper) + { + if (npc.ai[0] != 0f) + { + Vector2 value = Main.player[npc.target].Center - npc.Center; + value.Normalize(); + value *= 9f; + npc.velocity = (npc.velocity * 99f + value) / 98f; //100 + } + } + #endregion + #region EaterofWorlds + else if (npc.type == NPCID.EaterofWorldsHead && !CalamityWorld.bossRushActive) + { + if (!Main.player[npc.target].dead) + { + newAI[0] += 1f; + if (CalamityWorld.death) + { + newAI[0] += 2f; + } + } + if (newAI[0] >= 180f) + { + 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)) + { + Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num349 *= num351; + num350 *= num351; + if (Main.netMode != 1) + { + float num418 = 12f; + int num419 = 12; + int num420 = 96; + num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = num418 / num351; + num349 *= num351; + num350 *= num351; + num349 += (float)Main.rand.Next(-40, 41) * 0.05f; + num350 += (float)Main.rand.Next(-40, 41) * 0.05f; + vector34.X += num349 * 4f; + vector34.Y += num350 * 4f; + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + #endregion + #region KingSlime + else if (npc.type == NPCID.KingSlime) + { + bool move = false; + if (npc.ai[1] == 5f) + { + move = true; + npc.ai[0] += 3f; + if (CalamityWorld.death) + { + npc.ai[0] += 2f; + } + } + else if (npc.ai[1] == 6f) + { + move = true; + npc.ai[0] += 3f; + if (CalamityWorld.death) + { + npc.ai[0] += 2f; + } + } + if (npc.velocity.Y == 0f) + { + if (!move) + { + npc.ai[0] += 4f; + if (CalamityWorld.death) + { + npc.ai[0] += 4f; + } + } + } + } + #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 + } + #endregion + + #region PostAI + public override void PostAI(NPC npc) + { + if (pearlAura && !CalamityPlayer.areThereAnyDamnBosses) + { + npc.velocity.X *= 0.95f; + npc.velocity.Y *= 0.95f; + } + if (silvaStun && !CalamityWorld.bossRushActive) + { + npc.velocity.X = 0f; + npc.velocity.Y = 0f; + } + } + #endregion + + #region OnHitPlayer + public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit) + { + if (target.GetModPlayer(mod).snowman) + { + if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil) + { + target.AddBuff(mod.BuffType("PopoNoseless"), 36000); + } + } + if (npc.type == NPCID.GolemHead) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 300); + } + else if (npc.type == NPCID.GolemHeadFree) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 300); + } + else if (npc.type == NPCID.Golem) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 300); + } + else if (npc.type == NPCID.GolemFistRight) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 300); + } + else if (npc.type == NPCID.GolemFistLeft) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 300); + } + if (CalamityWorld.revenge) + { + if (Config.RevengeanceAndDeathThoriumBossBuff) + { + Mod thorium = ModLoader.GetMod("ThoriumMod"); + if (thorium != null) + { + if (npc.type == thorium.NPCType("GraniteEnergyStorm") || npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || + npc.type == thorium.NPCType("TheBuriedWarrior2") || npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") || + npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore") || npc.type == thorium.NPCType("SlagFury") || + npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") || npc.type == thorium.NPCType("Aquaius") || + npc.type == thorium.NPCType("Aquaius2")) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == thorium.NPCType("ViscountBaby") || npc.type == thorium.NPCType("EnemyBeholder") || npc.type == thorium.NPCType("AbyssalSpawn") || + npc.type == thorium.NPCType("Viscount") || npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2") || + npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless") || npc.type == thorium.NPCType("Abyssion") || + npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased")) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + target.AddBuff(mod.BuffType("Horror"), 180); + } + } + } + + if (npc.type == NPCID.DemonEye) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.EyeofCthulhu) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.ServantofCthulhu) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.EaterofSouls) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.DevourerHead) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.EaterofWorldsHead) + { + target.AddBuff(mod.BuffType("Horror"), 180); + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.EaterofWorldsBody) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.EaterofWorldsTail) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.BurningSphere) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.ChaosBall) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.CursedSkull) + { + target.AddBuff(mod.BuffType("Horror"), 120); + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.SkeletronHead) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.SkeletronHand) + { + target.AddBuff(mod.BuffType("Horror"), 120); + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.ManEater) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.Snatcher) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 60); + } + else if (npc.type == NPCID.CorruptBunny) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.CorruptGoldfish) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.Demon) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.VoodooDemon) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.DungeonGuardian) + { + target.AddBuff(mod.BuffType("Horror"), 1200); + } + else if (npc.type == NPCID.Mummy) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.DarkMummy) + { + target.AddBuff(mod.BuffType("Horror"), 180); + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.CorruptSlime) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.Wraith) + { + target.AddBuff(mod.BuffType("Horror"), 240); + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.EnchantedSword) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.Mimic) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 240); + } + else if (npc.type == NPCID.Werewolf) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.CursedHammer) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.Corruptor) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.SeekerHead) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.Clinger) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.VileSpit) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.WallofFlesh) + { + target.AddBuff(mod.BuffType("Horror"), 300); + } + else if (npc.type == NPCID.TheHungry) + { + target.AddBuff(mod.BuffType("Horror"), 120); + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.TheHungryII) + { + target.AddBuff(mod.BuffType("Horror"), 120); + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.LeechHead) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.Slimer) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.WanderingEye) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.Spazmatism) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.PrimeSaw) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.PrimeVice) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.Probe) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.RedDevil) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.VampireBat) + { + target.AddBuff(mod.BuffType("Horror"), 240); + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.Vampire) + { + target.AddBuff(mod.BuffType("Horror"), 240); + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.Frankenstein) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.BlackRecluse) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.WallCreeper) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.WallCreeperWall) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.SwampThing) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.AngryTrapper) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 240); + } + else if (npc.type == NPCID.CorruptPenguin) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.Crimera) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.Herpling) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.CrimsonAxe) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.FaceMonster) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.FloatyGross) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.Crimslime) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type >= 190 && npc.type <= 194) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.Nymph) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.BlackRecluseWall) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.BloodCrawler) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.BloodCrawlerWall) + { + target.AddBuff(mod.BuffType("Horror"), 60); + } + else if (npc.type == NPCID.BloodFeeder) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.QueenBee) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.GolemFistLeft) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.GolemFistRight) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.BloodJelly) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.Eyezor) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.Reaper) + { + target.AddBuff(mod.BuffType("Horror"), 240); + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.BrainofCthulhu) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.Creeper) + { + target.AddBuff(mod.BuffType("Horror"), 60); + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.IchorSticker) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.DungeonSpirit) + { + target.AddBuff(mod.BuffType("Horror"), 300); + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.GiantCursedSkull) + { + target.AddBuff(mod.BuffType("Horror"), 180); + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type >= 305 && npc.type <= 314) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.Spore) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.BoneLee) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.HeadlessHorseman) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.Ghost) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.MourningWood) + { + target.AddBuff(mod.BuffType("Horror"), 240); + } + else if (npc.type == NPCID.Splinterling) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.Pumpking) + { + target.AddBuff(mod.BuffType("Horror"), 240); + } + else if (npc.type == NPCID.PumpkingBlade) + { + target.AddBuff(mod.BuffType("Horror"), 120); + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.Hellhound) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.Poltergeist) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.Krampus) + { + target.AddBuff(mod.BuffType("Horror"), 300); + } + else if (npc.type == NPCID.Flocko) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.DetonatingBubble) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 360); + } + else if (npc.type == NPCID.DukeFishron) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.Sharkron) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.Sharkron2) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.Butcher) + { + target.AddBuff(mod.BuffType("Horror"), 180); + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.CreatureFromTheDeep) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.Fritz) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.Nailhead) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.CrimsonBunny) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.CrimsonGoldfish) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.Psycho) + { + target.AddBuff(mod.BuffType("Horror"), 180); + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.DrManFly) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.ThePossessed) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.CrimsonPenguin) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.Mothron) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.ShadowFlameApparition) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.BoneLee) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.MartianDrone) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + else if (npc.type == NPCID.MoonLordFreeEye) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 300); + } + else if (npc.type == NPCID.Medusa) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.BloodZombie) + { + target.AddBuff(mod.BuffType("Horror"), 120); + target.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + else if (npc.type == NPCID.Drippler) + { + target.AddBuff(mod.BuffType("Horror"), 120); + } + else if (npc.type == NPCID.AncientCultistSquidhead) + { + target.AddBuff(mod.BuffType("Horror"), 240); + target.AddBuff(mod.BuffType("MarkedforDeath"), 240); + } + else if (npc.type == NPCID.AncientDoom) + { + target.AddBuff(mod.BuffType("Horror"), 300); + target.AddBuff(mod.BuffType("MarkedforDeath"), 300); + } + else if (npc.type == NPCID.SandsharkCorrupt) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + else if (npc.type == NPCID.SandsharkCrimson) + { + target.AddBuff(mod.BuffType("Horror"), 180); + } + } + } + #endregion + + #region ModifyHitByProjectile + public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (npc.type == NPCID.TheDestroyerBody || npc.type == mod.NPCType("AquaticScourgeBody") || npc.type == mod.NPCType("AquaticScourgeBodyAlt")) + { + if (projectile.type == ProjectileID.RainFriendly || projectile.type == ProjectileID.BloodRain || + projectile.type == mod.ProjectileType("Shaderain") || projectile.aiStyle == 4 || + projectile.type == ProjectileID.CrystalPulse2 || projectile.type == ProjectileID.HallowStar || + projectile.type == mod.ProjectileType("FossilShardThrown")) + damage = (int)((double)damage * 0.65); + } + if (Main.player[projectile.owner].GetModPlayer(mod).eGauntlet) + { + if (projectile.melee && ShouldAffectNPC(npc) && Main.rand.Next(15) == 0) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + damage = npc.lifeMax * 3; + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).eTalisman) + { + if (projectile.magic && ShouldAffectNPC(npc) && Main.rand.Next(15) == 0) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + damage = npc.lifeMax * 3; + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).nanotech) + { + if (projectile.GetGlobalProjectile(mod).rogue && ShouldAffectNPC(npc) && Main.rand.Next(15) == 0) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + damage = npc.lifeMax * 3; + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).eQuiver) + { + if (projectile.ranged && ShouldAffectNPC(npc) && Main.rand.Next(15) == 0) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + damage = npc.lifeMax * 3; + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).statisBeltOfCurses) + { + if ((projectile.minion || CalamityMod.projectileMinionList.Contains(projectile.type)) && ShouldAffectNPC(npc) && Main.rand.Next(15) == 0) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + damage = npc.lifeMax * 3; + } + } + } + #endregion + + #region OnHitByItem + public override void OnHitByItem(NPC npc, Player player, Item item, int damage, float knockback, bool crit) + { + if (player.GetModPlayer(mod).bloodflareSet) + { + if (!npc.SpawnedFromStatue && npc.damage > 0 && ((double)npc.life < (double)npc.lifeMax * 0.5) && + player.GetModPlayer(mod).bloodflareHeartTimer <= 0) + { + player.GetModPlayer(mod).bloodflareHeartTimer = 180; + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 58, 1, false, 0, false, false); + } + else if (!npc.SpawnedFromStatue && npc.damage > 0 && ((double)npc.life > (double)npc.lifeMax * 0.5) && + player.GetModPlayer(mod).bloodflareManaTimer <= 0) + { + player.GetModPlayer(mod).bloodflareManaTimer = 180; + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 184, 1, false, 0, false, false); + } + } + } + #endregion + + #region OnHitByProjectile + public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit) + { + if (Main.player[projectile.owner].GetModPlayer(mod).sGenerator) + { + if (projectile.minion && npc.damage > 0) + { + switch (Main.rand.Next(3)) + { + case 0: Main.player[projectile.owner].AddBuff(mod.BuffType("SpiritGeneratorAtkBuff"), 120); break; + case 1: Main.player[projectile.owner].AddBuff(mod.BuffType("SpiritGeneratorRegenBuff"), 120); break; + case 2: Main.player[projectile.owner].AddBuff(mod.BuffType("SpiritGeneratorDefBuff"), 120); break; + } + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).bloodflareSet) + { + if (!npc.SpawnedFromStatue && npc.damage > 0 && ((double)npc.life < (double)npc.lifeMax * 0.5) && + Main.player[projectile.owner].GetModPlayer(mod).bloodflareHeartTimer <= 0) + { + Main.player[projectile.owner].GetModPlayer(mod).bloodflareHeartTimer = 180; + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 58, 1, false, 0, false, false); + } + else if (!npc.SpawnedFromStatue && npc.damage > 0 && ((double)npc.life > (double)npc.lifeMax * 0.5) && + Main.player[projectile.owner].GetModPlayer(mod).bloodflareManaTimer <= 0) + { + Main.player[projectile.owner].GetModPlayer(mod).bloodflareManaTimer = 180; + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 184, 1, false, 0, false, false); + } + } + } + #endregion + + #region CheckDead + public override bool CheckDead(NPC npc) + { + if (npc.lifeMax > 1000 && npc.type != 288 && + npc.type != mod.NPCType("PhantomSpirit") && + npc.type != mod.NPCType("PhantomSpiritS") && + npc.type != mod.NPCType("PhantomSpiritM") && + npc.type != mod.NPCType("PhantomSpiritL") && + npc.value > 0f && npc.HasPlayerTarget && + NPC.downedMoonlord && + Main.player[npc.target].ZoneDungeon) + { + int maxValue = 6; + if (Main.expertMode) + { + maxValue = 4; + } + if (Main.rand.Next(maxValue) == 0 && Main.wallDungeon[(int)Main.tile[(int)npc.Center.X / 16, (int)npc.Center.Y / 16].wall]) + { + int randomType = Main.rand.Next(4); + if (randomType == 0) + { + randomType = mod.NPCType("PhantomSpirit"); + } + else if (randomType == 1) + { + randomType = mod.NPCType("PhantomSpiritS"); + } + else if (randomType == 2) + { + randomType = mod.NPCType("PhantomSpiritM"); + } + else + { + randomType = mod.NPCType("PhantomSpiritL"); + } + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, randomType, 0, 0f, 0f, 0f, 0f, 255); + } + } + return true; + } + #endregion + + #region HitEffect + public override void HitEffect(NPC npc, int hitDirection, double damage) + { + if (CalamityWorld.revenge) + { + switch (npc.type) + { + case NPCID.MotherSlime: + if (npc.life <= 0) + { + if (Main.netMode != 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; + } + } + } + #endregion + + #region EditSpawnRate + public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns) + { + if (player.GetModPlayer(mod).ZoneSulphur) + { + spawnRate = (int)((double)spawnRate * 1.1); + maxSpawns = (int)((float)maxSpawns * 0.8f); + if (Main.raining) + { + spawnRate = (int)((double)spawnRate * 0.7); + maxSpawns = (int)((float)maxSpawns * 1.2f); + } + } + else if (player.GetModPlayer(mod).ZoneAbyss) + { + spawnRate = (int)((double)spawnRate * 0.7); + maxSpawns = (int)((float)maxSpawns * 1.1f); + } + else if (player.GetModPlayer(mod).ZoneCalamity) + { + spawnRate = (int)((double)spawnRate * 0.9); + maxSpawns = (int)((float)maxSpawns * 1.1f); + } + else if (player.GetModPlayer(mod).ZoneAstral) + { + spawnRate = (int)((double)spawnRate * 0.6); + maxSpawns = (int)((float)maxSpawns * 1.2f); + } + else if (player.GetModPlayer(mod).ZoneSunkenSea) + { + spawnRate = (int)((double)spawnRate * 0.9); + maxSpawns = (int)((float)maxSpawns * 1.1f); + } + if (CalamityWorld.revenge) + { + spawnRate = (int)((double)spawnRate * 0.85); + } + if (CalamityWorld.death) + { + spawnRate = (int)((double)spawnRate * 0.75); + } + if (CalamityWorld.demonMode) + { + spawnRate = (int)((double)spawnRate * 0.75); + } + if (player.GetModPlayer(mod).clamity) + { + spawnRate = (int)((double)spawnRate * 0.02); + maxSpawns = (int)((float)maxSpawns * 1.5f); + } + if (player.GetModPlayer(mod).zerg && player.GetModPlayer(mod).chaosCandle) + { + spawnRate = (int)((double)spawnRate * 0.005); + maxSpawns = (int)((float)maxSpawns * 7.5f); + } + else if (player.GetModPlayer(mod).zerg) + { + spawnRate = (int)((double)spawnRate * 0.01); + maxSpawns = (int)((float)maxSpawns * 5f); + } + else if (player.GetModPlayer(mod).chaosCandle) + { + spawnRate = (int)((double)spawnRate * 0.02); + maxSpawns = (int)((float)maxSpawns * 2.5f); + } + if (player.GetModPlayer(mod).zen && player.GetModPlayer(mod).tranquilityCandle) + { + 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 && 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)); + } + else if (player.GetModPlayer(mod).tranquilityCandle) + { + spawnRate = (int)((double)spawnRate * (player.GetModPlayer(mod).ZoneAbyss ? 1.25 : 25)); + maxSpawns = (int)((float)maxSpawns * (player.GetModPlayer(mod).ZoneAbyss ? 0.875f : 0.02f)); + } + } + #endregion + + #region EditSpawnRange + public override void EditSpawnRange(Player player, ref int spawnRangeX, ref int spawnRangeY, ref int safeRangeX, ref int safeRangeY) + { + if (player.GetModPlayer(mod).ZoneAbyss) + { + spawnRangeX = (int)((double)(1920 / 16) * 0.5); //0.7 + safeRangeX = (int)((double)(1920 / 16) * 0.32); //0.52 + } + } + #endregion + + #region EditSpawnPool + public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyss || + spawnInfo.player.GetModPlayer(mod).ZoneCalamity || + spawnInfo.player.GetModPlayer(mod).ZoneSulphur || + spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea || + (spawnInfo.player.GetModPlayer(mod).ZoneAstral && !NPC.LunarApocalypseIsUp)) + { + pool[0] = 0f; + } + } + #endregion + + #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) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, mod.DustType("BrimstoneFlame"), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3.5f); + 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.05f, 0.01f, 0.01f); + } + if (aFlames) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, mod.DustType("BrimstoneFlame"), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.25f; + if (Main.rand.Next(4) == 0) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.35f; + } + } + Lighting.AddLight(npc.position, 0.025f, 0f, 0f); + } + if (pShred) + { + 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), 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.1f; + Main.dust[dust].velocity.Y += 0.25f; + if (Main.rand.Next(2) == 0) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + } + if (hFlames) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, mod.DustType("HolyFlame"), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3.5f); + 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.25f, 0.25f, 0.1f); + } + if (pFlames) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 89, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + if (Main.rand.Next(4) == 0) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + Lighting.AddLight(npc.position, 0.07f, 0.15f, 0.01f); + } + if (gsInferno) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 173, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + if (Main.rand.Next(4) == 0) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + Lighting.AddLight(npc.position, 0.1f, 0f, 0.135f); + } + if (nightwither) + { + Rectangle hitbox = npc.Hitbox; + if (Main.rand.Next(5) < 4) + { + int num3 = Utils.SelectRandom(Main.rand, new int[] + { + 173, + 27, + 234 + }); + int num4 = Dust.NewDust(hitbox.TopLeft(), npc.width, npc.height, num3, 0f, -2.5f, 0, default(Color), 1f); + Main.dust[num4].noGravity = true; + Main.dust[num4].alpha = 200; + Main.dust[num4].velocity.Y -= 0.2f; + Dust dust = Main.dust[num4]; + dust.velocity *= 1.2f; + dust = Main.dust[num4]; + dust.scale += Main.rand.NextFloat(); + } + } + if (tSad || cDepth) + { + if (Main.rand.Next(6) < 3) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 33, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3.5f); + Main.dust[dust].noGravity = false; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y += 0.15f; + if (Main.rand.Next(4) == 0) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + } + if (dFlames) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 173, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + if (Main.rand.Next(4) == 0) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + Lighting.AddLight(npc.position, 0.1f, 0f, 0.135f); + } + if (gState || eFreeze) + { + drawColor = Color.Cyan; + } + if (marked) + { + drawColor = Color.Fuchsia; + } + if (pearlAura) + { + drawColor = Color.White; + } + } + + public override Color? GetAlpha(NPC npc, Color drawColor) + { + if (Main.player[Main.myPlayer].GetModPlayer(mod).trippy) + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, npc.alpha); + if (enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + return new Color(200, 50, 50, npc.alpha); + return null; + } + + public override bool PreDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor) + { + if (Main.player[Main.myPlayer].GetModPlayer(mod).trippy) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + float num66 = 0f; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Microsoft.Xna.Framework.Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + Microsoft.Xna.Framework.Color alpha15 = npc.GetAlpha(color9); + float num212 = 0.99f; + alpha15.R = (byte)((float)alpha15.R * num212); + alpha15.G = (byte)((float)alpha15.G * num212); + alpha15.B = (byte)((float)alpha15.B * num212); + alpha15.A = (byte)((float)alpha15.A * num212); + for (int num213 = 0; num213 < 4; num213++) + { + Vector2 position9 = npc.position; + float num214 = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); + float num215 = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + if (num213 == 0 || num213 == 2) + { + position9.X = Main.player[Main.myPlayer].Center.X + num214; + } + else + { + position9.X = Main.player[Main.myPlayer].Center.X - num214; + } + position9.X -= (float)(npc.width / 2); + if (num213 == 0 || num213 == 1) + { + position9.Y = Main.player[Main.myPlayer].Center.Y + num215; + } + else + { + position9.Y = Main.player[Main.myPlayer].Center.Y - num215; + } + position9.Y -= (float)(npc.height / 2); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(position9.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, position9.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + num66 + npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + } + return true; + } + #endregion + + #region GetChat + public override void GetChat(NPC npc, ref string chat) + { + switch (npc.type) + { + case NPCID.Guide: + if (Main.rand.Next(20) == 0 && Main.hardMode) + chat = "Could you be so kind as to, ah...check hell for me...? I left someone I kind of care about down there."; + if (Main.rand.Next(20) == 0 && CalamityWorld.spawnAstralMeteor) + chat = "I have this sudden shiver up my spine, like a meteor just fell and thousands of innocent creatures turned into monsters from the stars."; + if (Main.rand.Next(20) == 0 && NPC.downedMoonlord) + chat = "The dungeon seems even more restless than usual, watch out for the powerful abominations stirring up in there."; + if (Main.rand.Next(20) == 0 && CalamityWorld.downedProvidence) + chat = "Seems like extinguishing that butterfly caused its life to seep into the hallowed areas, try taking a peek there and see what you can find!"; + if (Main.rand.Next(20) == 0 && CalamityWorld.downedProvidence) + chat = "I've heard there is a portal of antimatter absorbing everything it can see in the dungeon, try using the Rune of Kos there!"; + break; + case NPCID.PartyGirl: + int fapsol = NPC.FindFirstNPC(mod.NPCType("FAP")); + if (Main.rand.Next(10) == 0 && fapsol != -1) + chat = "I have a feeling we're going to have absolutely fantastic parties with " + Main.npc[fapsol].GivenName + " around!"; + if (Main.rand.Next(5) == 0 && Main.eclipse) + chat = "I think my light display is turning into an accidental bug zapper. At least the monsters are enjoying it."; + if (Main.rand.Next(5) == 0 && Main.eclipse) + chat = "Ooh! I love parties where everyone wears a scary costume!"; + break; + case NPCID.Wizard: + int permadong = NPC.FindFirstNPC(mod.NPCType("DILF")); + if (Main.rand.Next(10) == 0 && permadong != -1) + chat = "I'd let " + Main.npc[permadong].GivenName + " coldheart MY icicle."; + if (Main.rand.Next(10) == 0 && CalamityWorld.spawnAstralMeteor) + chat = "Space just got way too close for comfort."; + break; + case NPCID.Dryad: + if (Main.rand.Next(5) == 0 && CalamityWorld.buffedEclipse && Main.eclipse) + chat = "There's a dark solar energy emanating from the moths that appear during this time. Ah, the moths as you progress further get more powerful...hmm...what power was Yharon holding back?"; + if (Main.rand.Next(10) == 0 && CalamityWorld.spawnAstralMeteor) + chat = "That starborne illness sits upon this land like a blister. Do even more vile forces of corruption exist in worlds beyond?"; + break; + case NPCID.Stylist: + int fapsol2 = NPC.FindFirstNPC(mod.NPCType("FAP")); + 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; + case NPCID.GoblinTinkerer: + if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) + chat = "You know...we haven't had an invasion in a while..."; + break; + case NPCID.ArmsDealer: + if (Main.rand.Next(5) == 0 && Main.eclipse) + chat = "That's the biggest moth I've ever seen for sure. You'd need one big gun to take one of those down."; + if (Main.rand.Next(10) == 0 && CalamityWorld.downedDoG) + chat = "Is it me or are your weapons getting bigger and bigger?"; + break; + case NPCID.Merchant: + if (Main.rand.Next(5) == 0 && NPC.downedMoonlord) + chat = "Each night seems only more foreboding than the last. I feel unthinkable terrors are watching your every move."; + if (Main.rand.Next(5) == 0 && Main.eclipse) + chat = "Are you daft?! Turn off those lamps!"; + if (Main.rand.Next(5) == 0 && Main.raining && CalamityWorld.sulphurTiles > 30) + chat = "If this acid rain keeps up, there'll be a shortage of Dirt Blocks soon enough!"; + break; + case NPCID.Mechanic: + int fapsol3 = NPC.FindFirstNPC(mod.NPCType("FAP")); + if (Main.rand.Next(5) == 0 && NPC.downedMoonlord) + chat = "What do you mean your traps aren't making the cut? Don't look at me!"; + if (Main.rand.Next(5) == 0 && Main.eclipse) + chat = "Um...should my nightlight be on?"; + if (Main.rand.Next(5) == 0 && fapsol3 != -1) + chat = "Well, I like " + Main.npc[fapsol3].GivenName + ", but I, ah...I have my eyes on someone else."; + break; + case NPCID.DD2Bartender: + int fapsol4 = NPC.FindFirstNPC(mod.NPCType("FAP")); + if (Main.rand.Next(5) == 0 && !Main.dayTime && Main.moonPhase == 0) + chat = "Care for a little Moonshine?"; + if (Main.rand.Next(10) == 0 && fapsol4 != -1) + chat = "Sheesh, " + Main.npc[fapsol4].GivenName + " is a little cruel, isn't she? I never claimed to be an expert on anything but ale!"; + break; + case NPCID.Pirate: + if (Main.rand.Next(5) == 0 && !CalamityWorld.downedLeviathan) + chat = "Aye, I’ve heard of a mythical creature in the oceans, singing with an alluring voice. Careful when yer fishin out there."; + if (Main.rand.Next(5) == 0 && CalamityWorld.downedAquaticScourge) + chat = "I have to thank ye again for takin' care of that sea serpent. Or was that another one..."; + break; + case NPCID.Cyborg: + if (Main.rand.Next(10) == 0 && Main.raining) + chat = "All these moments will be lost in time. Like tears...in the rain."; + if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) + chat = "Always shoot for the moon! It has clearly worked before."; + if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) + chat = "Draedon? He's...a little 'high octane' if you know what I mean."; + if (Main.rand.Next(10) == 0 && !CalamityWorld.downedPlaguebringer && NPC.downedGolemBoss) + chat = "Those oversized bugs terrorizing the jungle... Surely you of all people could shut them down!"; + break; + case NPCID.Clothier: + if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) + chat = "Who you gonna call?"; + if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) + chat = "Those screams...I’m not sure why, but I feel like a nameless fear has awoken in my heart."; + if (Main.rand.Next(10) == 0 && NPC.downedMoonlord) + chat = "I can faintly hear ghostly shrieks from the dungeon...and not ones I’m familiar with at all. Just what is going on in there?"; + if (Main.rand.Next(10) == 0 && CalamityWorld.downedPolterghast) + chat = "Whatever that thing was, I’m glad it’s gone now."; + if (Main.rand.Next(5) == 0 && NPC.AnyNPCs(NPCID.MoonLordCore)) + chat = "Houston, we've had a problem."; + break; + case NPCID.Steampunker: + bool hasPortalGun = false; + for (int k = 0; k < 255; k++) + { + Player player = Main.player[k]; + if (player.active) + { + for (int j = 0; j < player.inventory.Length; j++) + { + if (player.inventory[j].type == ItemID.PortalGun) + { + hasPortalGun = true; + } + } + } + } + if (Main.rand.Next(5) == 0 && NPC.downedMoonlord) + chat = "Yep! I'm also considering being a space pirate now."; + if (Main.rand.Next(5) == 0 && hasPortalGun) + chat = "Just what is that contraption? It makes my Teleporters look like child's play!"; + break; + case NPCID.DyeTrader: + int permadong2 = NPC.FindFirstNPC(mod.NPCType("DILF")); + if (Main.rand.Next(5) == 0) + chat = "Have you seen those gemstone creatures in the caverns? Their colors are simply breathtaking!"; + if (Main.rand.Next(5) == 0 && permadong2 != -1) + chat = "Do you think " + Main.npc[permadong2].GivenName + " knows how to 'let it go?'"; + break; + case NPCID.TaxCollector: + int platinumCoins = 0; + for (int k = 0; k < 255; k++) + { + Player player = Main.player[k]; + if (player.active) + { + for (int j = 0; j < player.inventory.Length; j++) + { + if (player.inventory[j].type == ItemID.PlatinumCoin) + { + platinumCoins = player.inventory[j].stack; + } + } + } + } + if (Main.rand.Next(5) == 0 && platinumCoins >= 100) + chat = "BAH! Doesn't seem like I'll ever be able to quarrel with the debts of the town again!"; + if (Main.rand.Next(5) == 0 && platinumCoins >= 500) + chat = "Where and how are you getting all of this money?"; + if (Main.rand.Next(5) == 0 && !CalamityWorld.downedBrimstoneElemental) + chat = "Perhaps with all that time you've got you could check those old ruins? Certainly something of value in it for you!"; + if (Main.rand.Next(10) == 0 && CalamityWorld.downedDoG) + chat = "Devourer of what, you said? Devourer of Funds, if its payroll is anything to go by!"; + break; + case NPCID.Demolitionist: + if (Main.rand.Next(5) == 0 && CalamityWorld.downedDoG) + chat = "God Slayer Dynamite? Boy do I like the sound of that!"; + break; + } + } + #endregion + + #region ShopStuff + public override void SetupShop(int type, Chest shop, ref int nextSlot) + { + if (type == NPCID.Merchant && (Main.player[Main.myPlayer].HasItem(mod.ItemType("FirestormCannon")) || Main.player[Main.myPlayer].HasItem(mod.ItemType("SpectralstormCannon")))) + { + shop.item[nextSlot].SetDefaults(ItemID.Flare); + nextSlot++; + } + if (type == NPCID.Merchant) + { + if (NPC.downedBoss1) + { + shop.item[nextSlot].SetDefaults(ItemID.ApprenticeBait); + nextSlot++; + } + if (NPC.downedBoss2) + { + shop.item[nextSlot].SetDefaults(ItemID.JourneymanBait); + nextSlot++; + if (WorldGen.crimson) + { + shop.item[nextSlot].SetDefaults(ItemID.Vilethorn); + nextSlot++; + } + else + { + shop.item[nextSlot].SetDefaults(ItemID.TheRottedFork); + nextSlot++; + } + } + if (NPC.downedBoss3) + { + shop.item[nextSlot].SetDefaults(ItemID.MasterBait); + nextSlot++; + } + } + if (type == NPCID.ArmsDealer && (Main.player[Main.myPlayer].HasItem(mod.ItemType("Impaler")))) + { + shop.item[nextSlot].SetDefaults(ItemID.Stake); + nextSlot++; + } + if (type == NPCID.ArmsDealer) + { + if (NPC.downedBoss2) + { + if (WorldGen.crimson) + { + shop.item[nextSlot].SetDefaults(ItemID.Musket); + nextSlot++; + } + else + { + shop.item[nextSlot].SetDefaults(ItemID.TheUndertaker); + nextSlot++; + } + } + } + if (type == NPCID.Dryad) + { + shop.item[nextSlot].SetDefaults(ItemID.JungleRose); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.NaturesGift); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.GoblinBattleStandard); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + if (NPC.downedSlimeKing) + { + shop.item[nextSlot].SetDefaults(ItemID.SlimeCrown); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedDesertScourge) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("DriedSeafood")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); + nextSlot++; + } + if (NPC.downedBoss1) + { + shop.item[nextSlot].SetDefaults(ItemID.SuspiciousLookingEye); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 3, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedCrabulon) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("DecapoditaSprout")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 4, 0, 0); + nextSlot++; + } + if (NPC.downedBoss2) + { + shop.item[nextSlot].SetDefaults(ItemID.BloodySpine); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 6, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.WormFood); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 6, 0, 0); + nextSlot++; + if (WorldGen.crimson) + { + if (Main.expertMode) + { + shop.item[nextSlot].SetDefaults(ItemID.WormScarf); + nextSlot++; + } + shop.item[nextSlot].SetDefaults(ItemID.BandofStarpower); + nextSlot++; + } + else + { + if (Main.expertMode) + { + shop.item[nextSlot].SetDefaults(ItemID.BrainOfConfusion); + nextSlot++; + } + shop.item[nextSlot].SetDefaults(ItemID.PanicNecklace); + nextSlot++; + } + } + if (CalamityWorld.downedPerforator) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("BloodyWormFood")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); + nextSlot++; + if (Main.expertMode) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("RottenBrain")); + nextSlot++; + } + } + if (CalamityWorld.downedHiveMind) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("Teratoma")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); + nextSlot++; + if (Main.expertMode) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("BloodyWormTooth")); + nextSlot++; + } + } + if (CalamityWorld.downedSlimeGod) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("OverloadedSludge")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedAquaticScourge) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("Seafood")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); + nextSlot++; + } + if (NPC.downedHalloweenKing) + { + shop.item[nextSlot].SetDefaults(ItemID.PumpkinMoonMedallion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + } + if (NPC.downedChristmasIceQueen) + { + shop.item[nextSlot].SetDefaults(ItemID.NaughtyPresent); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + } + shop.item[nextSlot].SetDefaults(mod.ItemType("RomajedaOrchid")); + nextSlot++; + } + if (type == NPCID.GoblinTinkerer) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("MeleeLevelMeter")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("RangedLevelMeter")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("MagicLevelMeter")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("SummonLevelMeter")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("RogueLevelMeter")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + nextSlot++; + } + if (type == NPCID.Clothier) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("BlueBrickWallUnsafe")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("BlueSlabWallUnsafe")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("BlueTiledWallUnsafe")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("GreenBrickWallUnsafe")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("GreenSlabWallUnsafe")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("GreenTiledWallUnsafe")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("PinkBrickWallUnsafe")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("PinkSlabWallUnsafe")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("PinkTiledWallUnsafe")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 0, 10); + nextSlot++; + if (Main.hardMode) + { + shop.item[nextSlot].SetDefaults(ItemID.GoldenKey); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + nextSlot++; + } + } + if (type == NPCID.Steampunker) + { + if (NPC.downedMechBoss1) + { + shop.item[nextSlot].SetDefaults(ItemID.MechanicalWorm); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); + nextSlot++; + } + if (NPC.downedMechBoss2) + { + shop.item[nextSlot].SetDefaults(ItemID.MechanicalEye); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); + nextSlot++; + } + if (NPC.downedMechBoss3) + { + shop.item[nextSlot].SetDefaults(ItemID.MechanicalSkull); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); + nextSlot++; + } + if (Main.player[Main.myPlayer].GetModPlayer(mod).ZoneAstral && CalamityWorld.spawnAstralMeteor) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("AstralSolution")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 5, 0); + nextSlot++; + } + } + if (type == NPCID.Wizard) + { + if (CalamityWorld.downedCryogen) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("CryoKey")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedBrimstoneElemental) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("CharredIdol")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedAstrageldon) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("AstralChunk")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + } + if (NPC.downedGolemBoss) + { + shop.item[nextSlot].SetDefaults(ItemID.SpectreStaff); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.InfernoFork); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.ShadowbeamStaff); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + } + if (NPC.downedMoonlord) + { + shop.item[nextSlot].SetDefaults(ItemID.CelestialSigil); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(3, 0, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedGuardians) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("ProfanedShard")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(10, 0, 0, 0); + nextSlot++; + } + } + if (type == NPCID.WitchDoctor) + { + shop.item[nextSlot].SetDefaults(ItemID.Abeemination); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 8, 0, 0); + nextSlot++; + if (NPC.downedPlantBoss) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("BulbofDoom")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); + nextSlot++; + } + if (NPC.downedGolemBoss) + { + shop.item[nextSlot].SetDefaults(ItemID.SolarTablet); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.LihzahrdPowerCell); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedScavenger) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("AncientMedallion")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 50, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedPlaguebringer) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("Abomination")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 50, 0, 0); + nextSlot++; + } + if (CalamityWorld.downedBumble) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("BirbPheromones")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(5, 0, 0, 0); + nextSlot++; + } + } + if (type == NPCID.TravellingMerchant && Main.moonPhase == 0) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("FrostBarrier")); + nextSlot++; + } + } + #endregion + + #region AnyBossNPCS + public static bool AnyBossNPCS() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + for (int i = 0; i < 200; i++) + { + 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; + } + } + return false; + } + #endregion + + #region AnyLivingPlayers + public static bool AnyLivingPlayers() + { + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && !Main.player[i].ghost) + return true; + } + return false; + } + #endregion + + #region StopRain + public static void StopRain() + { + Main.raining = false; + if (Main.netMode == 2) + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + #endregion + + #region ShouldAffectNPC + public static bool ShouldAffectNPC(NPC target) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Mothron && + target.type != NPCID.Pumpking && target.type != NPCID.TheDestroyerBody && target.type != NPCID.TheDestroyerTail && + target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCID.IceQueen && + 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) + { + return true; + } + return false; + } + #endregion + + #region OldDukeSpawn + public static void OldDukeSpawn(int plr, int Type) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Player player = Main.player[plr]; + if (!player.active || player.dead) + { + return; + } + int m = 0; + while (m < 1000) + { + Projectile projectile = Main.projectile[m]; + if (projectile.active && projectile.bobber && projectile.owner == plr) + { + int num8 = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 100, mod.NPCType("OldDuke"), 0, 0f, 0f, 0f, 0f, 255); + string typeName2 = Main.npc[num8].TypeName; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName2), 175, 75, 255, false); + return; + } + if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[] + { + Main.npc[num8].GetTypeNetName() + }), new Color(175, 75, 255), -1); + return; + } + break; + } + else + { + m++; + } + } + } + #endregion + + #region Astral things + public static void DoHitDust(NPC npc, int hitDirection, int dustType = 5, float xSpeedMult = 1f, int numHitDust = 5, int numDeathDust = 20) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection * xSpeedMult, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection * xSpeedMult, -1f, 0, default(Color), 1f); + } + } + } + + public static void DoFlyingAI(NPC npc, float maxSpeed, float acceleration, float circleTime, float minDistanceTarget = 150f, bool shouldAttackTarget = true) + { + //Pick a new target. + if (npc.target < 0 || npc.target >= 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + Player myTarget = Main.player[npc.target]; + Vector2 toTarget = (myTarget.Center - npc.Center); + float distanceToTarget = toTarget.Length(); + Vector2 maxVelocity = toTarget; + if (distanceToTarget < 3f) + { + maxVelocity = npc.velocity; + } + else + { + float magnitude = maxSpeed / distanceToTarget; + maxVelocity *= magnitude; + } + //Circular motion + npc.ai[0]++; + //y motion + if (npc.ai[0] > circleTime * 0.5f) + { + npc.velocity.Y += acceleration; + } + else + { + npc.velocity.Y -= acceleration; + } + //x motion + if (npc.ai[0] < circleTime * 0.25f || npc.ai[0] > circleTime * 0.75f) + { + npc.velocity.X += acceleration; + } + else + { + npc.velocity.X -= acceleration; + } + //reset + if (npc.ai[0] > circleTime) + { + npc.ai[0] = 0f; + } + //if close enough + if (shouldAttackTarget && distanceToTarget < minDistanceTarget) + { + npc.velocity += maxVelocity * 0.007f; + } + if (myTarget.dead) + { + maxVelocity.X = npc.direction * maxSpeed / 2f; + maxVelocity.Y = -maxSpeed / 2f; + } + //maximise velocity + if (npc.velocity.X < maxVelocity.X) + { + npc.velocity.X += acceleration; + } + if (npc.velocity.X > maxVelocity.X) + { + npc.velocity.X -= acceleration; + } + if (npc.velocity.Y < maxVelocity.Y) + { + npc.velocity.Y += acceleration; + } + if (npc.velocity.Y > maxVelocity.Y) + { + npc.velocity.Y -= acceleration; + } + //rotate towards player if alive + if (!myTarget.dead) + { + npc.rotation = toTarget.ToRotation(); + } + else //don't, do velocity instead + { + npc.rotation = npc.velocity.ToRotation(); + } + npc.rotation += MathHelper.Pi; + //tile collision + float collisionDamp = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -collisionDamp; + 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 * -collisionDamp; + if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5f) + { + npc.velocity.Y = 1.5f; + } + if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5f) + { + npc.velocity.Y = -1.5f; + } + } + //water collision + if (npc.wet) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y *= 0.95f; + } + npc.velocity.Y -= 0.3f; + if (npc.velocity.Y < -2f) npc.velocity.Y = -2f; + } + //Taken from source. Important for net? + 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 static void DoSpiderWallAI(NPC npc, int transformType, float chaseMaxSpeed = 2f, float chaseAcceleration = 0.08f) + { + //GET NEW TARGET + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(); + } + Vector2 between = Main.player[npc.target].Center - npc.Center; + float distance = between.Length(); + //modify vector depending on distance and speed. + if (distance == 0f) + { + between.X = npc.velocity.X; + between.Y = npc.velocity.Y; + } + else + { + distance = chaseMaxSpeed / distance; + between.X *= distance; + between.Y *= distance; + } + //update if target dead. + if (Main.player[npc.target].dead) + { + between.X = (float)npc.direction * chaseMaxSpeed / 2f; + between.Y = -chaseMaxSpeed / 2f; + } + npc.spriteDirection = -1; + //If spider can't see target, circle around to attempt to find the target. + if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + //CIRCULAR MOTION, SIMILAR TO FLYING AI (Eater of Souls etc.) + npc.ai[0]++; + if (npc.ai[0] > 0f) + { + npc.velocity.Y += 0.023f; + } + else + { + npc.velocity.Y -= 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X += 0.023f; + } + else + { + npc.velocity.X -= 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + npc.velocity.X += between.X * 0.007f; + npc.velocity.Y += between.Y * 0.007f; + npc.rotation = npc.velocity.ToRotation(); + if (npc.velocity.X > 1.5f) + { + npc.velocity.X *= 0.9f; + } + if (npc.velocity.X < -1.5f) + { + npc.velocity.X *= 0.9f; + } + if (npc.velocity.Y > 1.5f) + { + npc.velocity.Y *= 0.9f; + } + if (npc.velocity.Y < -1.5f) + { + npc.velocity.Y *= 0.9f; + } + npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -3f, 3f); + npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -3f, 3f); + } + else //CHASE TARGET + { + if (npc.velocity.X < between.X) + { + npc.velocity.X = npc.velocity.X + chaseAcceleration; + if (npc.velocity.X < 0f && between.X > 0f) + { + npc.velocity.X = npc.velocity.X + chaseAcceleration; + } + } + else if (npc.velocity.X > between.X) + { + npc.velocity.X = npc.velocity.X - chaseAcceleration; + if (npc.velocity.X > 0f && between.X < 0f) + { + npc.velocity.X = npc.velocity.X - chaseAcceleration; + } + } + if (npc.velocity.Y < between.Y) + { + npc.velocity.Y = npc.velocity.Y + chaseAcceleration; + if (npc.velocity.Y < 0f && between.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + chaseAcceleration; + } + } + else if (npc.velocity.Y > between.Y) + { + npc.velocity.Y = npc.velocity.Y - chaseAcceleration; + if (npc.velocity.Y > 0f && between.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - chaseAcceleration; + } + } + npc.rotation = between.ToRotation(); + } + //DAMP COLLISIONS OFF OF WALLS + float collisionDamp = 0.5f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -collisionDamp; + 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 * -collisionDamp; + if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5f) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5f) + { + 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; + } + if (Main.netMode != 1) + { + int x = (int)npc.Center.X / 16; + int y = (int)npc.Center.Y / 16; + bool flag = false; + for (int i = x - 1; i <= x + 1; i++) + { + for (int j = y - 1; j <= y + 1; j++) + { + if (Main.tile[i, j] == null) + { + return; + } + if (Main.tile[i, j].wall > 0) + { + flag = true; + } + } + } + if (!flag) + { + npc.Transform(transformType); + return; + } + } + } + + public static void DoVultureAI(NPC npc, float acceleration = 0.1f, float maxSpeed = 3f, int sitWidth = 30, int flyWidth = 50, int rangeX = 100, int rangeY = 100) + { + npc.localAI[0]++; + npc.noGravity = true; + npc.TargetClosest(true); + if (npc.ai[0] == 0f) + { + npc.width = sitWidth; + npc.noGravity = false; + if (Main.netMode != 1) + { + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.3) + { + npc.ai[0] = 1f; + npc.netUpdate = true; + } + else + { + Rectangle playerRect = Main.player[npc.target].getRect(); + Rectangle rangeRect = new Rectangle((int)npc.Center.X - rangeX, (int)npc.Center.Y - rangeY, rangeX * 2, rangeY * 2); + if (npc.localAI[0] > 20f && (rangeRect.Intersects(playerRect) || npc.life < npc.lifeMax)) + { + npc.ai[0] = 1f; + npc.velocity.Y -= 6f; + npc.netUpdate = true; + } + } + } + } + else if (!Main.player[npc.target].dead) + { + npc.width = flyWidth; + //Collision damping + if (npc.collideX) + { + npc.velocity.X = npc.oldVelocity.X * -0.5f; + 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.velocity.Y = npc.oldVelocity.Y * -0.5f; + if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) + { + npc.velocity.Y = 1f; + } + if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) + { + npc.velocity.Y = -1f; + } + } + if (npc.direction == -1 && npc.velocity.X > -maxSpeed) + { + npc.velocity.X -= acceleration; + if (npc.velocity.X > maxSpeed) + { + npc.velocity.X = npc.velocity.X - acceleration; + } + else if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X - acceleration * 0.5f; + } + if (npc.velocity.X < -maxSpeed) + { + npc.velocity.X = -maxSpeed; + } + } + else if (npc.direction == 1 && npc.velocity.X < maxSpeed) + { + npc.velocity.X = npc.velocity.X + acceleration; + if (npc.velocity.X < -maxSpeed) + { + npc.velocity.X = npc.velocity.X + acceleration; + } + else if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + acceleration * 0.5f; + } + if (npc.velocity.X > maxSpeed) + { + npc.velocity.X = maxSpeed; + } + } + float xDistance = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + float yLimiter = Main.player[npc.target].position.Y - (npc.height / 2f); + if (xDistance > 50f) + { + yLimiter -= 100f; + } + if (npc.position.Y < yLimiter) + { + npc.velocity.Y = npc.velocity.Y + acceleration * 0.5f; + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y + acceleration * 0.1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y - acceleration * 0.5f; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y - acceleration * 0.1f; + } + } + if (npc.velocity.Y < -maxSpeed) + { + npc.velocity.Y = -maxSpeed; + } + if (npc.velocity.Y > maxSpeed) + { + npc.velocity.Y = maxSpeed; + } + } + //Change velocity if wet. + if (npc.wet) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + npc.velocity.Y = npc.velocity.Y - 0.5f; + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + } + /// + /// Allows you to spawn dust on the NPC in a certain place. Uses the npc.position value as the base point for the rectangle. + /// Takes direction and rotation into account. + /// + /// The width of the sheet for the NPC. + /// The place to put a dust. + /// The chance to spawn a dust (0.3 = 30%) + public static Dust SpawnDustOnNPC(NPC npc, int frameWidth, int frameHeight, int dustType, Rectangle rect, Vector2 velocity = default(Vector2), float chance = 0.5f, bool useSpriteDirection = false) + { + Vector2 half = new Vector2(frameWidth / 2f, frameHeight / 2f); + //"flip" the rectangle's position x-wise. + if ((!useSpriteDirection && npc.direction == 1) || (useSpriteDirection && npc.spriteDirection == 1)) + { + rect.X = frameWidth - rect.Right; + } + if (Main.rand.NextFloat(1f) < chance) + { + Vector2 offset = (npc.Center - half + new Vector2(Main.rand.NextFloat(rect.Left, rect.Right), Main.rand.NextFloat(rect.Top, rect.Bottom))) - npc.Center; + offset = offset.RotatedBy(npc.rotation); + Dust d = Dust.NewDustPerfect(npc.Center + offset, dustType, velocity); + return d; + } + return null; + } + #endregion + } +} diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 90b5849fa9..f2bbe12af5 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -3808,4 +3808,4 @@ namespace CalamityMod.NPCs } #endregion } -} \ No newline at end of file +} diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 848dfd4c90..fcec7ee810 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -1,399 +1,399 @@ -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.DataStructures; -using Terraria.ModLoader; -using CalamityMod.Items; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CeaselessVoid -{ - [AutoloadBossHead] - public class CeaselessVoid : ModNPC - { - private float bossLife; - private int beamPortal = 0; - private int shootBoost = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ceaseless Void"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 150; - npc.npcSlots = 36f; - npc.width = 100; //324 - npc.height = 100; //216 - npc.defense = 0; - npc.lifeMax = 200; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.value = Item.buyPrice(0, 35, 0, 0); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Void"); - else - music = MusicID.Boss3; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.noGravity = true; - npc.noTileCollide = true; - npc.boss = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(beamPortal); - writer.Write(shootBoost); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - beamPortal = reader.ReadInt32(); - shootBoost = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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 PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Texture2D texture = Main.npcTexture[npc.type]; - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); - return false; - } - - public override void AI() - { - double lifeRatio = (double)npc.life / (double)npc.lifeMax; - int lifePercentage = (int)(100.0 * lifeRatio); - Player player = Main.player[npc.target]; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - CalamityGlobalNPC.voidBoss = npc.whoAmI; - Vector2 vector = npc.Center; - npc.TargetClosest(true); - if (NPC.CountNPCS(mod.NPCType("DarkEnergy")) > 0 || - NPC.CountNPCS(mod.NPCType("DarkEnergy2")) > 0 || - NPC.CountNPCS(mod.NPCType("DarkEnergy3")) > 0) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 2400) - { - npc.timeLeft = 2400; - } - if (lifePercentage < 90) - { - float num472 = npc.Center.X; - float num473 = npc.Center.Y; - float num474 = (float)(500.0 * (1.0 - lifeRatio)); - if (!player.ZoneDungeon) - { - num474 *= 1.5f; - } - npc.ai[0] += 1f; - if (npc.ai[0] == 60f) - { - npc.ai[0] = 0f; - int numDust = (int)(0.2f * MathHelper.TwoPi * num474); - float angleIncrement = MathHelper.TwoPi / (float)numDust; - Vector2 dustOffset = new Vector2(num474, 0f); - dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - for (int i = 0; i < numDust; i++) - { - dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(npc.Center, 1, 1, 173); - Main.dust[dust].position = npc.Center + dustOffset; - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].scale = 0.5f; - } - for (int num475 = 0; num475 < 255; num475++) - { - if (Collision.CanHit(npc.Center, 1, 1, Main.player[num475].Center, 1, 1)) - { - float num476 = Main.player[num475].position.X + (float)(Main.player[num475].width / 2); - float num477 = Main.player[num475].position.Y + (float)(Main.player[num475].height / 2); - float num478 = Math.Abs(npc.position.X + (float)(npc.width / 2) - num476) + Math.Abs(npc.position.Y + (float)(npc.height / 2) - num477); - if (num478 < num474) - { - if (Main.player[num475].position.X < num472) - { - Main.player[num475].velocity.X += 15f; - } - else - { - Main.player[num475].velocity.X -= 15f; - } - if (Main.player[num475].position.Y < num473) - { - Main.player[num475].velocity.Y += 15f; - } - else - { - Main.player[num475].velocity.Y -= 15f; - } - } - } - } - } - } - if (Main.netMode != 1) - { - beamPortal += expertMode ? 2 : 1; - beamPortal += shootBoost; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - beamPortal += 4; - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - beamPortal += 2; - } - if (beamPortal >= 1200) - { - beamPortal = 0; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num941 = 3f; //speed - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = player.position.X + (float)player.width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); - float num943 = player.position.Y + (float)player.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; - int num945 = expertMode ? 42 : 58; - int num946 = mod.ProjectileType("DoGBeamPortal"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num947].timeLeft = 300; - npc.netUpdate = true; - } - if (lifePercentage < 50 && revenge) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - 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; - } - } - } - } - float num823 = 7.5f; - float num824 = 0.1f; - if (!player.ZoneDungeon) - { - num823 = 15f; - } - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; - if (npc.velocity.X < num825) - { - npc.velocity.X = npc.velocity.X + num824; - if (npc.velocity.X < 0f && num825 > 0f) - { - npc.velocity.X = npc.velocity.X + num824; - } - } - else if (npc.velocity.X > num825) - { - npc.velocity.X = npc.velocity.X - num824; - if (npc.velocity.X > 0f && num825 < 0f) - { - npc.velocity.X = npc.velocity.X - num824; - } - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y = npc.velocity.Y + num824; - if (npc.velocity.Y < 0f && num826 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num824; - } - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y = npc.velocity.Y - num824; - if (npc.velocity.Y > 0f && num826 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num824; - } - } - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.26); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - shootBoost += 1; - int glob = revenge ? 8 : 4; - if (bossLife <= 0.5f) - { - glob = revenge ? 16 : 8; - } - for (int num662 = 0; num662 < glob; num662++) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("DarkEnergySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - - 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 NPCLoot() - { - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("DarkPlasma"), Main.rand.Next(2, 4), true); - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CeaselessVoidTrophy")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MirrorBlade")); - } - if (Main.rand.Next(5) == 0) - { - 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); - } - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SuperHealingPotion; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid5"), 1f); - } - } - } -} \ No newline at end of file +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.DataStructures; +using Terraria.ModLoader; +using CalamityMod.Items; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CeaselessVoid +{ + [AutoloadBossHead] + public class CeaselessVoid : ModNPC + { + private float bossLife; + private int beamPortal = 0; + private int shootBoost = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ceaseless Void"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 150; + npc.npcSlots = 36f; + npc.width = 100; //324 + npc.height = 100; //216 + npc.defense = 0; + npc.lifeMax = 200; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.value = Item.buyPrice(0, 35, 0, 0); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Void"); + else + music = MusicID.Boss3; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.noGravity = true; + npc.noTileCollide = true; + npc.boss = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(beamPortal); + writer.Write(shootBoost); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + beamPortal = reader.ReadInt32(); + shootBoost = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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 PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Texture2D texture = Main.npcTexture[npc.type]; + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); + return false; + } + + public override void AI() + { + double lifeRatio = (double)npc.life / (double)npc.lifeMax; + int lifePercentage = (int)(100.0 * lifeRatio); + Player player = Main.player[npc.target]; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + CalamityGlobalNPC.voidBoss = npc.whoAmI; + Vector2 vector = npc.Center; + npc.TargetClosest(true); + if (NPC.CountNPCS(mod.NPCType("DarkEnergy")) > 0 || + NPC.CountNPCS(mod.NPCType("DarkEnergy2")) > 0 || + NPC.CountNPCS(mod.NPCType("DarkEnergy3")) > 0) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 2400) + { + npc.timeLeft = 2400; + } + if (lifePercentage < 90) + { + float num472 = npc.Center.X; + float num473 = npc.Center.Y; + float num474 = (float)(500.0 * (1.0 - lifeRatio)); + if (!player.ZoneDungeon) + { + num474 *= 1.5f; + } + npc.ai[0] += 1f; + if (npc.ai[0] == 60f) + { + npc.ai[0] = 0f; + int numDust = (int)(0.2f * MathHelper.TwoPi * num474); + float angleIncrement = MathHelper.TwoPi / (float)numDust; + Vector2 dustOffset = new Vector2(num474, 0f); + dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); + for (int i = 0; i < numDust; i++) + { + dustOffset = dustOffset.RotatedBy(angleIncrement); + int dust = Dust.NewDust(npc.Center, 1, 1, 173); + Main.dust[dust].position = npc.Center + dustOffset; + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + Main.dust[dust].velocity *= 0f; + Main.dust[dust].scale = 0.5f; + } + for (int num475 = 0; num475 < 255; num475++) + { + if (Collision.CanHit(npc.Center, 1, 1, Main.player[num475].Center, 1, 1)) + { + float num476 = Main.player[num475].position.X + (float)(Main.player[num475].width / 2); + float num477 = Main.player[num475].position.Y + (float)(Main.player[num475].height / 2); + float num478 = Math.Abs(npc.position.X + (float)(npc.width / 2) - num476) + Math.Abs(npc.position.Y + (float)(npc.height / 2) - num477); + if (num478 < num474) + { + if (Main.player[num475].position.X < num472) + { + Main.player[num475].velocity.X += 15f; + } + else + { + Main.player[num475].velocity.X -= 15f; + } + if (Main.player[num475].position.Y < num473) + { + Main.player[num475].velocity.Y += 15f; + } + else + { + Main.player[num475].velocity.Y -= 15f; + } + } + } + } + } + } + if (Main.netMode != 1) + { + beamPortal += expertMode ? 2 : 1; + beamPortal += shootBoost; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + beamPortal += 4; + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + beamPortal += 2; + } + if (beamPortal >= 1200) + { + beamPortal = 0; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + float num941 = 3f; //speed + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = player.position.X + (float)player.width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); + float num943 = player.position.Y + (float)player.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; + int num945 = expertMode ? 42 : 58; + int num946 = mod.ProjectileType("DoGBeamPortal"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num947].timeLeft = 300; + npc.netUpdate = true; + } + if (lifePercentage < 50 && revenge) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + 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; + } + } + } + } + float num823 = 7.5f; + float num824 = 0.1f; + if (!player.ZoneDungeon) + { + num823 = 15f; + } + Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num825 = player.position.X + (float)(player.width / 2) - vector82.X; + float num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; + if (npc.velocity.X < num825) + { + npc.velocity.X = npc.velocity.X + num824; + if (npc.velocity.X < 0f && num825 > 0f) + { + npc.velocity.X = npc.velocity.X + num824; + } + } + else if (npc.velocity.X > num825) + { + npc.velocity.X = npc.velocity.X - num824; + if (npc.velocity.X > 0f && num825 < 0f) + { + npc.velocity.X = npc.velocity.X - num824; + } + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y = npc.velocity.Y + num824; + if (npc.velocity.Y < 0f && num826 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num824; + } + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y = npc.velocity.Y - num824; + if (npc.velocity.Y > 0f && num826 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num824; + } + } + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.26); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + shootBoost += 1; + int glob = revenge ? 8 : 4; + if (bossLife <= 0.5f) + { + glob = revenge ? 16 : 8; + } + for (int num662 = 0; num662 < glob; num662++) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("DarkEnergySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + + 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 NPCLoot() + { + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("DarkPlasma"), Main.rand.Next(2, 4), true); + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CeaselessVoidTrophy")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MirrorBlade")); + } + if (Main.rand.Next(5) == 0) + { + 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); + } + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SuperHealingPotion; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CeaselessVoid5"), 1f); + } + } + } +} diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 6100aeb3f0..fec7568d1b 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -1,209 +1,209 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CeaselessVoid -{ - public class DarkEnergy : ModNPC - { - public int invinceTime = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.dontTakeDamage = true; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 68; - npc.lifeMax = 6000; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.lifeMax = 24000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 44000; - } - 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; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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() - { - bool expertMode = Main.expertMode; - if (invinceTime > 0) - { - invinceTime--; - } - else - { - npc.damage = expertMode ? 240 : 120; - npc.dontTakeDamage = false; - } - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(true); - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - npc.knockBackResist = 0f; - } - if (npc.ai[1] == 0f) - { - npc.scale -= 0.01f; - npc.alpha += 15; - if (npc.alpha >= 125) - { - npc.alpha = 130; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.01f; - npc.alpha -= 15; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } - if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 2400) - { - npc.timeLeft = 2400; - } - if (npc.ai[0] == 0f) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.voidBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.voidBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - if (num786 > 90f) - { - num786 = 8f / num786; //8f - num784 *= num786; - num785 *= num786; - npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; - return; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 8f) //8f - { - npc.velocity.Y = npc.velocity.Y * 1.05f; //1.05f - npc.velocity.X = npc.velocity.X * 1.05f; //1.05f - } - if (Main.netMode != 1 && ((expertMode && Main.rand.Next(50) == 0) || Main.rand.Next(100) == 0)) - { - npc.TargetClosest(true); - vector96 = new Vector2(npc.Center.X, npc.Center.Y); - num784 = player.Center.X - vector96.X; - num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - num786 = 8f / num786; //8f - npc.velocity.X = num784 * num786; - npc.velocity.Y = num785 * num786; - npc.ai[0] = 1f; - npc.netUpdate = true; - } - } - else - { - Vector2 value4 = player.Center - npc.Center; - value4.Normalize(); - value4 *= 9f; //9f - npc.velocity = (npc.velocity * 99f + value4) / 100f; - Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); - float num787 = Main.npc[CalamityGlobalNPC.voidBoss].Center.X - vector97.X; - float num788 = Main.npc[CalamityGlobalNPC.voidBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); - if (num789 > 1400f) - { - npc.ai[0] = 0f; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CeaselessVoid +{ + public class DarkEnergy : ModNPC + { + public int invinceTime = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Energy"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.dontTakeDamage = true; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 68; + npc.lifeMax = 6000; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.lifeMax = 24000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 44000; + } + 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; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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() + { + bool expertMode = Main.expertMode; + if (invinceTime > 0) + { + invinceTime--; + } + else + { + npc.damage = expertMode ? 240 : 120; + npc.dontTakeDamage = false; + } + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(true); + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + npc.knockBackResist = 0f; + } + if (npc.ai[1] == 0f) + { + npc.scale -= 0.01f; + npc.alpha += 15; + if (npc.alpha >= 125) + { + npc.alpha = 130; + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 1f) + { + npc.scale += 0.01f; + npc.alpha -= 15; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + } + } + if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 2400) + { + npc.timeLeft = 2400; + } + if (npc.ai[0] == 0f) + { + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num784 = Main.npc[CalamityGlobalNPC.voidBoss].Center.X - vector96.X; + float num785 = Main.npc[CalamityGlobalNPC.voidBoss].Center.Y - vector96.Y; + float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + if (num786 > 90f) + { + num786 = 8f / num786; //8f + num784 *= num786; + num785 *= num786; + npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; + return; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 8f) //8f + { + npc.velocity.Y = npc.velocity.Y * 1.05f; //1.05f + npc.velocity.X = npc.velocity.X * 1.05f; //1.05f + } + if (Main.netMode != 1 && ((expertMode && Main.rand.Next(50) == 0) || Main.rand.Next(100) == 0)) + { + npc.TargetClosest(true); + vector96 = new Vector2(npc.Center.X, npc.Center.Y); + num784 = player.Center.X - vector96.X; + num785 = player.Center.Y - vector96.Y; + num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + num786 = 8f / num786; //8f + npc.velocity.X = num784 * num786; + npc.velocity.Y = num785 * num786; + npc.ai[0] = 1f; + npc.netUpdate = true; + } + } + else + { + Vector2 value4 = player.Center - npc.Center; + value4.Normalize(); + value4 *= 9f; //9f + npc.velocity = (npc.velocity * 99f + value4) / 100f; + Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); + float num787 = Main.npc[CalamityGlobalNPC.voidBoss].Center.X - vector97.X; + float num788 = Main.npc[CalamityGlobalNPC.voidBoss].Center.Y - vector97.Y; + float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); + if (num789 > 1400f) + { + npc.ai[0] = 0f; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/CeaselessVoid/DarkEnergy2.cs b/NPCs/CeaselessVoid/DarkEnergy2.cs index 17143a8a56..aa2783f99c 100644 --- a/NPCs/CeaselessVoid/DarkEnergy2.cs +++ b/NPCs/CeaselessVoid/DarkEnergy2.cs @@ -1,169 +1,169 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CeaselessVoid -{ - public class DarkEnergy2 : ModNPC - { - public int invinceTime = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.dontTakeDamage = true; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 68; - npc.lifeMax = 6000; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.lifeMax = 24000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 44000; - } - 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; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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() - { - bool expertMode = Main.expertMode; - if (invinceTime > 0) - { - invinceTime--; - } - else - { - npc.damage = expertMode ? 240 : 120; - npc.dontTakeDamage = false; - } - Player player = Main.player[npc.target]; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - npc.knockBackResist = 0f; - } - if (npc.ai[1] == 0f) - { - npc.scale -= 0.01f; - npc.alpha += 15; - if (npc.alpha >= 125) - { - npc.alpha = 130; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.01f; - npc.alpha -= 15; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } - npc.TargetClosest(true); - if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 2400) - { - npc.timeLeft = 2400; - } - Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); - 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 = expertMode ? 18f : 15f; - num1260 = num1261 / num1260; - num1258 *= num1260; - num1259 *= num1260; - 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) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CeaselessVoid +{ + public class DarkEnergy2 : ModNPC + { + public int invinceTime = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Energy"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.dontTakeDamage = true; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 68; + npc.lifeMax = 6000; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.lifeMax = 24000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 44000; + } + 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; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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() + { + bool expertMode = Main.expertMode; + if (invinceTime > 0) + { + invinceTime--; + } + else + { + npc.damage = expertMode ? 240 : 120; + npc.dontTakeDamage = false; + } + Player player = Main.player[npc.target]; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + npc.knockBackResist = 0f; + } + if (npc.ai[1] == 0f) + { + npc.scale -= 0.01f; + npc.alpha += 15; + if (npc.alpha >= 125) + { + npc.alpha = 130; + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 1f) + { + npc.scale += 0.01f; + npc.alpha -= 15; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + } + } + npc.TargetClosest(true); + if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 2400) + { + npc.timeLeft = 2400; + } + Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); + 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 = expertMode ? 18f : 15f; + num1260 = num1261 / num1260; + num1258 *= num1260; + num1259 *= num1260; + 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) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/CeaselessVoid/DarkEnergy3.cs b/NPCs/CeaselessVoid/DarkEnergy3.cs index a1e69a8c49..80c391995c 100644 --- a/NPCs/CeaselessVoid/DarkEnergy3.cs +++ b/NPCs/CeaselessVoid/DarkEnergy3.cs @@ -1,196 +1,196 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CeaselessVoid -{ - public class DarkEnergy3 : ModNPC - { - public int invinceTime = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.dontTakeDamage = true; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 68; - npc.lifeMax = 6000; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.lifeMax = 24000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 44000; - } - 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; - npc.noTileCollide = true; - npc.canGhostHeal = false; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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() - { - bool expertMode = Main.expertMode; - if (invinceTime > 0) - { - invinceTime--; - } - else - { - npc.damage = expertMode ? 240 : 120; - npc.dontTakeDamage = false; - } - Player player = Main.player[npc.target]; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - npc.knockBackResist = 0f; - } - if (npc.ai[1] == 0f) - { - npc.scale -= 0.01f; - npc.alpha += 15; - if (npc.alpha >= 125) - { - npc.alpha = 130; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.01f; - npc.alpha -= 15; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } - npc.TargetClosest(true); - if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 2400) - { - npc.timeLeft = 2400; - } - float num1372 = expertMode ? 12f : 10f; - 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.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CeaselessVoid +{ + public class DarkEnergy3 : ModNPC + { + public int invinceTime = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Energy"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.dontTakeDamage = true; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 68; + npc.lifeMax = 6000; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.lifeMax = 24000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 44000; + } + 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; + npc.noTileCollide = true; + npc.canGhostHeal = false; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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() + { + bool expertMode = Main.expertMode; + if (invinceTime > 0) + { + invinceTime--; + } + else + { + npc.damage = expertMode ? 240 : 120; + npc.dontTakeDamage = false; + } + Player player = Main.player[npc.target]; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + npc.knockBackResist = 0f; + } + if (npc.ai[1] == 0f) + { + npc.scale -= 0.01f; + npc.alpha += 15; + if (npc.alpha >= 125) + { + npc.alpha = 130; + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 1f) + { + npc.scale += 0.01f; + npc.alpha -= 15; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + } + } + npc.TargetClosest(true); + if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 2400) + { + npc.timeLeft = 2400; + } + float num1372 = expertMode ? 12f : 10f; + 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.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/CosmicWraith/CosmicLantern.cs b/NPCs/CosmicWraith/CosmicLantern.cs index 042b6dd0bb..f932879859 100644 --- a/NPCs/CosmicWraith/CosmicLantern.cs +++ b/NPCs/CosmicWraith/CosmicLantern.cs @@ -1,132 +1,132 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CosmicWraith -{ - public class CosmicLantern : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Lantern"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 110; - npc.width = 25; //324 - npc.height = 25; //216 - npc.defense = 85; - npc.lifeMax = 25; - npc.alpha = 255; - npc.knockBackResist = 0.85f; - npc.noGravity = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.canGhostHeal = false; - npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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() - { - npc.alpha -= 3; - 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); - Main.dust[num1262].velocity *= 0.1f; - Main.dust[num1262].noGravity = true; - } - npc.rotation = npc.velocity.X * 0.08f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.TargetClosest(true); - Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); - 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)); - bool revenge = CalamityWorld.revenge; - float num1261 = revenge ? 27f : 25f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num1261 = 30f; - } - if (npc.localAI[0] < 85f) - { - num1261 = 0.1f; - num1260 = num1261 / num1260; - num1258 *= num1260; - num1259 *= num1260; - npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; - npc.localAI[0] += 1f; - return; - } - npc.dontTakeDamage = false; - npc.chaseable = true; - num1260 = num1261 / num1260; - num1258 *= num1260; - num1259 *= num1260; - 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) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - } - - 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) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 204, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CosmicWraith +{ + public class CosmicLantern : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Lantern"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 110; + npc.width = 25; //324 + npc.height = 25; //216 + npc.defense = 85; + npc.lifeMax = 25; + npc.alpha = 255; + npc.knockBackResist = 0.85f; + npc.noGravity = true; + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.canGhostHeal = false; + npc.noTileCollide = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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() + { + npc.alpha -= 3; + 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); + Main.dust[num1262].velocity *= 0.1f; + Main.dust[num1262].noGravity = true; + } + npc.rotation = npc.velocity.X * 0.08f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.TargetClosest(true); + Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); + 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)); + bool revenge = CalamityWorld.revenge; + float num1261 = revenge ? 27f : 25f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num1261 = 30f; + } + if (npc.localAI[0] < 85f) + { + num1261 = 0.1f; + num1260 = num1261 / num1260; + num1258 *= num1260; + num1259 *= num1260; + npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; + npc.localAI[0] += 1f; + return; + } + npc.dontTakeDamage = false; + npc.chaseable = true; + num1260 = num1261 / num1260; + num1258 *= num1260; + num1259 *= num1260; + 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) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + } + + 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) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 204, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/CosmicWraith/CosmicWraith.cs b/NPCs/CosmicWraith/CosmicWraith.cs index b8ea8153c7..ec5934cea4 100644 --- a/NPCs/CosmicWraith/CosmicWraith.cs +++ b/NPCs/CosmicWraith/CosmicWraith.cs @@ -1,847 +1,847 @@ -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; -using CalamityMod.NPCs; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CosmicWraith -{ - [AutoloadBossHead] - public class CosmicWraith : ModNPC - { - private const int CosmicProjectiles = 3; - private const float CosmicAngleSpread = 170; - private int CosmicCountdown = 0; - private int phaseSwitch = 0; - private int chargeSwitch = 0; - private int dustTimer = 3; - private int spawnX = 750; - private int spawnY = 120; - private int lifeToAlpha = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Signus, Envoy of the Devourer"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 32f; - npc.damage = 175; - npc.width = 130; - npc.height = 130; - npc.defense = 70; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss4; - npc.lifeMax = CalamityWorld.revenge ? 109500 : 70000; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.value = Item.buyPrice(0, 35, 0, 0); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Signus"); - else - music = MusicID.Boss4; - npc.lifeMax = CalamityWorld.revenge ? 445500 : 280000; - if (CalamityWorld.death) - { - npc.lifeMax = 722250; - } - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.boss = true; - 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.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit49; - npc.DeathSound = SoundID.NPCDeath51; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(CosmicCountdown); - writer.Write(phaseSwitch); - writer.Write(chargeSwitch); - writer.Write(dustTimer); - writer.Write(spawnX); - writer.Write(spawnY); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - writer.Write(lifeToAlpha); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - CosmicCountdown = reader.ReadInt32(); - phaseSwitch = reader.ReadInt32(); - chargeSwitch = reader.ReadInt32(); - dustTimer = reader.ReadInt32(); - spawnX = reader.ReadInt32(); - spawnY = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - lifeToAlpha = reader.ReadInt32(); - } - - public override void AI() - { - double lifeRatio = (double)npc.life / (double)npc.lifeMax; - lifeToAlpha = (int)(100.0 * (1.0 - lifeRatio)); - bool cosmicDust = lifeToAlpha > 15; - bool speedBoost = lifeToAlpha > 25; - bool cosmicRain = lifeToAlpha > 35; - bool cosmicSpeed = lifeToAlpha > 50; - bool cosmicTeleport = lifeToAlpha > 67; - Player player = Main.player[npc.target]; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - npc.TargetClosest(true); - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vectorCenter = npc.Center; - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); - float num998 = 8f; - float scaleFactor3 = 300f; - float num999 = 800f; - float num1000 = cosmicSpeed ? 12f : 15f; - float num1001 = 5f; - float scaleFactor4 = 0.75f; - int num1002 = 0; - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1005 = cosmicSpeed ? 12f : 15f; - float num1006 = 0.333333343f; - float num1007 = 10f; - float chargeSpeedDivisor = cosmicSpeed ? 11.85f : 14.85f; - num1006 *= num1005; - if (lifeToAlpha < 50) - { - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < 1) - { - int num1012 = Dust.NewDust(npc.Center - new Vector2(70f), 70 * 2, 70 * 2, 173, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - } - if (Vector2.Distance(player.Center, vectorCenter) > 6400f) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (cosmicRain && CosmicCountdown == 0) - { - CosmicCountdown = 300; - } - if (CosmicCountdown > 0) - { - CosmicCountdown--; - if (CosmicCountdown == 0) - { - if (Main.netMode != 1) - { - int speed2 = revenge ? 13 : 12; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed2 += 3; - } - float spawnX2 = Main.rand.Next(1000) - 500 + player.Center.X; - float spawnY2 = -1000 + player.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); - Vector2 baseVelocity = player.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; - int damage = expertMode ? 49 : 62; //360 300 - for (int i = 0; i < CosmicProjectiles; i++) - { - Vector2 spawn2 = baseSpawn; - spawn2.X = spawn2.X + i * 30 - (CosmicProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-CosmicAngleSpread / 2 + (CosmicAngleSpread * i / (float)CosmicProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int projectile = Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, mod.ProjectileType("CosmicFlameBurst"), damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].tileCollide = false; - } - } - } - } - if (npc.ai[0] <= 2f) - { - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.knockBackResist = 0.05f; - if (expertMode) - { - npc.knockBackResist *= Main.expertKnockBack; - } - if (cosmicSpeed) - { - npc.knockBackResist = 0f; - } - float speed = expertMode ? 14f : 12f; - if (speedBoost) - { - speed = expertMode ? 16f : 14f; - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed += 3f; - } - Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); - float num795 = player.Center.X - vector98.X; - float num796 = player.Center.Y - vector98.Y; - float num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796)); - num797 = speed / num797; - num795 *= num797; - num796 *= num797; - npc.velocity.X = (npc.velocity.X * 50f + num795) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; - } - else - { - npc.knockBackResist = 0f; - } - if (npc.ai[0] == 0f) - { - npc.chaseable = true; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 150f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int num1249 = 0; - int num1250; - int num1251; - while (true) - { - num1249++; - num1250 = (int)player.Center.X / 16; - num1251 = (int)player.Center.Y / 16; - num1250 += Main.rand.Next(-15, 16); - num1251 += Main.rand.Next(-15, 16); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height)) - { - break; - } - if (num1249 > 100) - { - return; - } - } - npc.ai[0] = 1f; - npc.ai[1] = (float)num1250; - npc.ai[2] = (float)num1251; - npc.netUpdate = true; - return; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.alpha += (cosmicTeleport ? 5 : 4); - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - float distanceX = player.position.X - npc.position.X; - if (player.velocity.X >= 0f) - { - if (npc.position.X < player.position.X) - npc.position.X += distanceX * 2f; - } - else - { - if (npc.position.X > player.position.X) - npc.position.X += distanceX * 2f; - } - if (Vector2.Distance(player.Center, vectorCenter) > 4800f) - { - npc.position.X = player.position.X; - } - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= (cosmicTeleport ? 5 : 4); - if (npc.alpha <= lifeToAlpha) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); - if (Main.netMode != 1 && revenge) - { - int num660 = NPC.NewNPC((int)(Main.player[npc.target].position.X + 750f), (int)(Main.player[npc.target].position.Y), mod.NPCType("SignusBomb"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - int num661 = NPC.NewNPC((int)(Main.player[npc.target].position.X - 750f), (int)(Main.player[npc.target].position.Y), mod.NPCType("SignusBomb"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); - } - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - int num623 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num623].velocity *= 3f; - Main.dust[num623].noGravity = true; - if (Main.rand.Next(2) == 0) - { - Main.dust[num623].scale = 0.5f; - Main.dust[num623].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - int num625 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - Main.dust[num625].noGravity = true; - Main.dust[num625].velocity *= 5f; - num625 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num625].velocity *= 2f; - } - } - npc.dontTakeDamage = false; - npc.chaseable = true; - npc.ai[3] += 1f; - npc.alpha = lifeToAlpha; - if (npc.ai[3] >= 2f) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else - { - npc.ai[0] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - npc.dontTakeDamage = false; - npc.chaseable = true; - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - 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.life < npc.lifeMax / 4 || CalamityWorld.death || CalamityWorld.bossRushActive) - { - if (npc.ai[1] % 30f == 29f) - { - flag104 = true; - } - } - else if (npc.life < npc.lifeMax / 2) - { - if (npc.ai[1] % 35f == 34f) - { - flag104 = true; - } - } - else if (npc.ai[1] % 40f == 39f) - { - flag104 = true; - } - if (flag104 && npc.position.Y + (float)npc.height < player.position.Y) - { - if (Main.netMode != 1) - { - float num1070 = 15f; //changed from 10 - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1070 += 3f; - } - if (cosmicRain) - { - num1070 += 1f; //changed from 3 not a prob - } - if (cosmicSpeed) - { - num1070 += 1f; - } - if (revenge) - { - num1070 += 1f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num1070 += 1f; - } - float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X + (float)Main.rand.Next(-80, 81); - float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y + (float)Main.rand.Next(-40, 41); - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); - num1073 = num1070 / num1073; - num1071 *= num1073; - num1072 *= num1073; - int num1074 = expertMode ? 49 : 62; //projectile damage - int num1075 = mod.ProjectileType("SignusScythe"); //projectile type - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, (float)(npc.target + 1)); - } - } - if (npc.position.Y > player.position.Y - 150f) //200 - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.975f; - } - npc.velocity.Y = npc.velocity.Y - 0.1f; - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - } - else if (npc.position.Y < player.position.Y - 400f) //500 - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.975f; - } - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y < -3f) - { - npc.velocity.Y = -3f; - } - } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 500f) //100 - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > 15f) - { - npc.velocity.X = 15f; - } - } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 500f) //100 - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -15f) - { - npc.velocity.X = -15f; - } - } - if (npc.ai[1] > 300f) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - npc.dontTakeDamage = false; - npc.chaseable = true; - if (Main.netMode != 1) - { - if (NPC.CountNPCS(mod.NPCType("CosmicLantern")) < 5) - { - for (int x = 0; x < 5; x++) - { - int num660 = NPC.NewNPC((int)(Main.player[npc.target].position.X + (float)spawnX), (int)(Main.player[npc.target].position.Y + (float)spawnY), mod.NPCType("CosmicLantern"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - int num661 = NPC.NewNPC((int)(Main.player[npc.target].position.X - (float)spawnX), (int)(Main.player[npc.target].position.Y + (float)spawnY), mod.NPCType("CosmicLantern"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); - } - spawnY -= 60; - } - spawnY = 120; - } - } - npc.TargetClosest(false); - npc.rotation = npc.velocity.ToRotation(); - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - if (npc.rotation < -1.57079637f) - { - npc.rotation += 3.14159274f; - } - if (npc.rotation > 1.57079637f) - { - npc.rotation -= 3.14159274f; - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - phaseSwitch += 1; - if (chargeSwitch == 0) //line up the charge - { - float scaleFactor6 = num998; - Vector2 center4 = npc.Center; - Vector2 center5 = player.Center; - Vector2 vector126 = center5 - center4; - Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; - float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); - if (npc.ai[3] >= 120f) - { - flag64 = true; - } - float num1014 = 8f; - 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) / chargeSpeedDivisor; - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / chargeSpeedDivisor; - if (!flag64) - { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) - { - npc.netUpdate = true; - } - } - else - { - npc.ai[3] = 0f; - } - } - else - { - chargeSwitch = 1; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; - } - } - else if (chargeSwitch == 1) //pause before charge - { - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - chargeSwitch = 2; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; - velocity.Normalize(); - velocity *= scaleFactor5; - npc.velocity = velocity; - } - } - else if (chargeSwitch == 2) //charging - { - if (Main.netMode != 1) - { - dustTimer--; - if (cosmicDust && dustTimer <= 0) - { - 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); - Main.projectile[projectile].timeLeft = 60; - Main.projectile[projectile].velocity.X = 0f; - Main.projectile[projectile].velocity.Y = 0f; - dustTimer = 3; - } - } - float num1016 = num1003; - npc.ai[1] += 1f; - bool flag65 = Vector2.Distance(npc.Center, player.Center) > num1004 && npc.Center.Y > player.Center.Y; - if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - chargeSwitch = 3; - } - else - { - Vector2 center6 = npc.Center; - Vector2 center7 = player.Center; - Vector2 vec2 = center7 - center6; - vec2.Normalize(); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / chargeSpeedDivisor; - } - } - else if (chargeSwitch == 3) //slow down after charging and reset - { - npc.ai[1] -= 2f; - if (npc.ai[1] <= 0f) - { - chargeSwitch = 0; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.97f; - } - if (phaseSwitch > 300) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - chargeSwitch = 0; - phaseSwitch = 0; - npc.netUpdate = true; - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return npc.alpha == lifeToAlpha; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.ai[0] == 4f) - { - if (npc.frameCounter > 72.0) //12 - { - npc.frameCounter = 0.0; - } - } - else - { - int frameY = 196; - if (npc.frameCounter > 72.0) - { - npc.frameCounter = 0.0; - } - npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); //1 to 6 - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D NPCTexture = Main.npcTexture[npc.type]; - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - int frameCount = Main.npcFrameCount[npc.type]; - float scale = npc.scale; - float rotation = npc.rotation; - float offsetY = npc.gfxOffY; - if (npc.ai[0] == 4f) - { - NPCTexture = mod.GetTexture("NPCs/CosmicWraith/CosmicWraithAlt2"); - int height = 564; - int width = 176; - Vector2 vector = new Vector2((float)(width / 2), (float)(height / frameCount / 2)); - Microsoft.Xna.Framework.Rectangle frame = new Rectangle(0, 0, width, height / frameCount); - frame.Y = 94 * (int)(npc.frameCounter / 12.0); //1 to 6 - if (frame.Y >= 94 * 6) - { - frame.Y = 0; - } - Main.spriteBatch.Draw(NPCTexture, - 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(drawColor), - rotation, - vector, - scale, - spriteEffects, - 0f); - return false; - } - else if (npc.ai[0] == 3f) - { - NPCTexture = mod.GetTexture("NPCs/CosmicWraith/CosmicWraithAlt"); - } - else - { - NPCTexture = Main.npcTexture[npc.type]; - } - Microsoft.Xna.Framework.Rectangle frame2 = npc.frame; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / frameCount / 2)); - 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)frameCount + 4f + vector11.Y * scale + 0f + offsetY), - new Microsoft.Xna.Framework.Rectangle?(frame2), - npc.GetAlpha(drawColor), - rotation, - vector11, - scale, - spriteEffects, - 0f); - return false; - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SuperHealingPotion; - } - - public override void NPCLoot() - { - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("TwistingNether"), Main.rand.Next(2, 4), true); - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SignusTrophy")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CosmicKunai")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Cosmilamp")); - } - } - } - - 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 HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 200; - npc.height = 150; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus5"), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.NPCs; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CosmicWraith +{ + [AutoloadBossHead] + public class CosmicWraith : ModNPC + { + private const int CosmicProjectiles = 3; + private const float CosmicAngleSpread = 170; + private int CosmicCountdown = 0; + private int phaseSwitch = 0; + private int chargeSwitch = 0; + private int dustTimer = 3; + private int spawnX = 750; + private int spawnY = 120; + private int lifeToAlpha = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Signus, Envoy of the Devourer"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 32f; + npc.damage = 175; + npc.width = 130; + npc.height = 130; + npc.defense = 70; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss4; + npc.lifeMax = CalamityWorld.revenge ? 109500 : 70000; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.value = Item.buyPrice(0, 35, 0, 0); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Signus"); + else + music = MusicID.Boss4; + npc.lifeMax = CalamityWorld.revenge ? 445500 : 280000; + if (CalamityWorld.death) + { + npc.lifeMax = 722250; + } + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.boss = true; + 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.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + npc.HitSound = SoundID.NPCHit49; + npc.DeathSound = SoundID.NPCDeath51; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(CosmicCountdown); + writer.Write(phaseSwitch); + writer.Write(chargeSwitch); + writer.Write(dustTimer); + writer.Write(spawnX); + writer.Write(spawnY); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + writer.Write(lifeToAlpha); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + CosmicCountdown = reader.ReadInt32(); + phaseSwitch = reader.ReadInt32(); + chargeSwitch = reader.ReadInt32(); + dustTimer = reader.ReadInt32(); + spawnX = reader.ReadInt32(); + spawnY = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + lifeToAlpha = reader.ReadInt32(); + } + + public override void AI() + { + double lifeRatio = (double)npc.life / (double)npc.lifeMax; + lifeToAlpha = (int)(100.0 * (1.0 - lifeRatio)); + bool cosmicDust = lifeToAlpha > 15; + bool speedBoost = lifeToAlpha > 25; + bool cosmicRain = lifeToAlpha > 35; + bool cosmicSpeed = lifeToAlpha > 50; + bool cosmicTeleport = lifeToAlpha > 67; + Player player = Main.player[npc.target]; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + npc.TargetClosest(true); + Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vectorCenter = npc.Center; + float num1243 = player.Center.X - vector142.X; + float num1244 = player.Center.Y - vector142.Y; + float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); + float num998 = 8f; + float scaleFactor3 = 300f; + float num999 = 800f; + float num1000 = cosmicSpeed ? 12f : 15f; + float num1001 = 5f; + float scaleFactor4 = 0.75f; + int num1002 = 0; + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1005 = cosmicSpeed ? 12f : 15f; + float num1006 = 0.333333343f; + float num1007 = 10f; + float chargeSpeedDivisor = cosmicSpeed ? 11.85f : 14.85f; + num1006 *= num1005; + if (lifeToAlpha < 50) + { + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < 1) + { + int num1012 = Dust.NewDust(npc.Center - new Vector2(70f), 70 * 2, 70 * 2, 173, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + } + if (Vector2.Distance(player.Center, vectorCenter) > 6400f) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + if (cosmicRain && CosmicCountdown == 0) + { + CosmicCountdown = 300; + } + if (CosmicCountdown > 0) + { + CosmicCountdown--; + if (CosmicCountdown == 0) + { + if (Main.netMode != 1) + { + int speed2 = revenge ? 13 : 12; + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed2 += 3; + } + float spawnX2 = Main.rand.Next(1000) - 500 + player.Center.X; + float spawnY2 = -1000 + player.Center.Y; + Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); + Vector2 baseVelocity = player.Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity = baseVelocity * speed2; + int damage = expertMode ? 49 : 62; //360 300 + for (int i = 0; i < CosmicProjectiles; i++) + { + Vector2 spawn2 = baseSpawn; + spawn2.X = spawn2.X + i * 30 - (CosmicProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-CosmicAngleSpread / 2 + (CosmicAngleSpread * i / (float)CosmicProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + int projectile = Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, mod.ProjectileType("CosmicFlameBurst"), damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].tileCollide = false; + } + } + } + } + if (npc.ai[0] <= 2f) + { + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.knockBackResist = 0.05f; + if (expertMode) + { + npc.knockBackResist *= Main.expertKnockBack; + } + if (cosmicSpeed) + { + npc.knockBackResist = 0f; + } + float speed = expertMode ? 14f : 12f; + if (speedBoost) + { + speed = expertMode ? 16f : 14f; + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed += 3f; + } + Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); + float num795 = player.Center.X - vector98.X; + float num796 = player.Center.Y - vector98.Y; + float num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796)); + num797 = speed / num797; + num795 *= num797; + num796 *= num797; + npc.velocity.X = (npc.velocity.X * 50f + num795) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; + } + else + { + npc.knockBackResist = 0f; + } + if (npc.ai[0] == 0f) + { + npc.chaseable = true; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 150f) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int num1249 = 0; + int num1250; + int num1251; + while (true) + { + num1249++; + num1250 = (int)player.Center.X / 16; + num1251 = (int)player.Center.Y / 16; + num1250 += Main.rand.Next(-15, 16); + num1251 += Main.rand.Next(-15, 16); + if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height)) + { + break; + } + if (num1249 > 100) + { + return; + } + } + npc.ai[0] = 1f; + npc.ai[1] = (float)num1250; + npc.ai[2] = (float)num1251; + npc.netUpdate = true; + return; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.alpha += (cosmicTeleport ? 5 : 4); + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); + float distanceX = player.position.X - npc.position.X; + if (player.velocity.X >= 0f) + { + if (npc.position.X < player.position.X) + npc.position.X += distanceX * 2f; + } + else + { + if (npc.position.X > player.position.X) + npc.position.X += distanceX * 2f; + } + if (Vector2.Distance(player.Center, vectorCenter) > 4800f) + { + npc.position.X = player.position.X; + } + npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.alpha -= (cosmicTeleport ? 5 : 4); + if (npc.alpha <= lifeToAlpha) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); + if (Main.netMode != 1 && revenge) + { + int num660 = NPC.NewNPC((int)(Main.player[npc.target].position.X + 750f), (int)(Main.player[npc.target].position.Y), mod.NPCType("SignusBomb"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + int num661 = NPC.NewNPC((int)(Main.player[npc.target].position.X - 750f), (int)(Main.player[npc.target].position.Y), mod.NPCType("SignusBomb"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + } + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + int num623 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num623].velocity *= 3f; + Main.dust[num623].noGravity = true; + if (Main.rand.Next(2) == 0) + { + Main.dust[num623].scale = 0.5f; + Main.dust[num623].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X + 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + int num625 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + Main.dust[num625].noGravity = true; + Main.dust[num625].velocity *= 5f; + num625 = Dust.NewDust(new Vector2(Main.player[npc.target].position.X - 750f, Main.player[npc.target].position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num625].velocity *= 2f; + } + } + npc.dontTakeDamage = false; + npc.chaseable = true; + npc.ai[3] += 1f; + npc.alpha = lifeToAlpha; + if (npc.ai[3] >= 2f) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else + { + npc.ai[0] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + npc.dontTakeDamage = false; + npc.chaseable = true; + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + 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.life < npc.lifeMax / 4 || CalamityWorld.death || CalamityWorld.bossRushActive) + { + if (npc.ai[1] % 30f == 29f) + { + flag104 = true; + } + } + else if (npc.life < npc.lifeMax / 2) + { + if (npc.ai[1] % 35f == 34f) + { + flag104 = true; + } + } + else if (npc.ai[1] % 40f == 39f) + { + flag104 = true; + } + if (flag104 && npc.position.Y + (float)npc.height < player.position.Y) + { + if (Main.netMode != 1) + { + float num1070 = 15f; //changed from 10 + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1070 += 3f; + } + if (cosmicRain) + { + num1070 += 1f; //changed from 3 not a prob + } + if (cosmicSpeed) + { + num1070 += 1f; + } + if (revenge) + { + num1070 += 1f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num1070 += 1f; + } + float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X + (float)Main.rand.Next(-80, 81); + float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y + (float)Main.rand.Next(-40, 41); + float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + num1073 = num1070 / num1073; + num1071 *= num1073; + num1072 *= num1073; + int num1074 = expertMode ? 49 : 62; //projectile damage + int num1075 = mod.ProjectileType("SignusScythe"); //projectile type + Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, (float)(npc.target + 1)); + } + } + if (npc.position.Y > player.position.Y - 150f) //200 + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.975f; + } + npc.velocity.Y = npc.velocity.Y - 0.1f; + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + } + else if (npc.position.Y < player.position.Y - 400f) //500 + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.975f; + } + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y < -3f) + { + npc.velocity.Y = -3f; + } + } + if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 500f) //100 + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X - 0.1f; + if (npc.velocity.X > 15f) + { + npc.velocity.X = 15f; + } + } + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 500f) //100 + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X + 0.1f; + if (npc.velocity.X < -15f) + { + npc.velocity.X = -15f; + } + } + if (npc.ai[1] > 300f) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + npc.dontTakeDamage = false; + npc.chaseable = true; + if (Main.netMode != 1) + { + if (NPC.CountNPCS(mod.NPCType("CosmicLantern")) < 5) + { + for (int x = 0; x < 5; x++) + { + int num660 = NPC.NewNPC((int)(Main.player[npc.target].position.X + (float)spawnX), (int)(Main.player[npc.target].position.Y + (float)spawnY), mod.NPCType("CosmicLantern"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + int num661 = NPC.NewNPC((int)(Main.player[npc.target].position.X - (float)spawnX), (int)(Main.player[npc.target].position.Y + (float)spawnY), mod.NPCType("CosmicLantern"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + } + spawnY -= 60; + } + spawnY = 120; + } + } + npc.TargetClosest(false); + npc.rotation = npc.velocity.ToRotation(); + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + if (npc.rotation < -1.57079637f) + { + npc.rotation += 3.14159274f; + } + if (npc.rotation > 1.57079637f) + { + npc.rotation -= 3.14159274f; + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + phaseSwitch += 1; + if (chargeSwitch == 0) //line up the charge + { + float scaleFactor6 = num998; + Vector2 center4 = npc.Center; + Vector2 center5 = player.Center; + Vector2 vector126 = center5 - center4; + Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; + float num1013 = vector126.Length(); + vector126 = Vector2.Normalize(vector126) * scaleFactor6; + vector127 = Vector2.Normalize(vector127) * scaleFactor6; + bool flag64 = Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); + if (npc.ai[3] >= 120f) + { + flag64 = true; + } + float num1014 = 8f; + 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) / chargeSpeedDivisor; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / chargeSpeedDivisor; + if (!flag64) + { + npc.ai[3] += 1f; + if (npc.ai[3] == 120f) + { + npc.netUpdate = true; + } + } + else + { + npc.ai[3] = 0f; + } + } + else + { + chargeSwitch = 1; + npc.ai[2] = vector126.X; + npc.ai[3] = vector126.Y; + npc.netUpdate = true; + } + } + else if (chargeSwitch == 1) //pause before charge + { + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + chargeSwitch = 2; + npc.ai[1] = 0f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; + velocity.Normalize(); + velocity *= scaleFactor5; + npc.velocity = velocity; + } + } + else if (chargeSwitch == 2) //charging + { + if (Main.netMode != 1) + { + dustTimer--; + if (cosmicDust && dustTimer <= 0) + { + 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); + Main.projectile[projectile].timeLeft = 60; + Main.projectile[projectile].velocity.X = 0f; + Main.projectile[projectile].velocity.Y = 0f; + dustTimer = 3; + } + } + float num1016 = num1003; + npc.ai[1] += 1f; + bool flag65 = Vector2.Distance(npc.Center, player.Center) > num1004 && npc.Center.Y > player.Center.Y; + if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + chargeSwitch = 3; + } + else + { + Vector2 center6 = npc.Center; + Vector2 center7 = player.Center; + Vector2 vec2 = center7 - center6; + vec2.Normalize(); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / chargeSpeedDivisor; + } + } + else if (chargeSwitch == 3) //slow down after charging and reset + { + npc.ai[1] -= 2f; + if (npc.ai[1] <= 0f) + { + chargeSwitch = 0; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.97f; + } + if (phaseSwitch > 300) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + chargeSwitch = 0; + phaseSwitch = 0; + npc.netUpdate = true; + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return npc.alpha == lifeToAlpha; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.ai[0] == 4f) + { + if (npc.frameCounter > 72.0) //12 + { + npc.frameCounter = 0.0; + } + } + else + { + int frameY = 196; + if (npc.frameCounter > 72.0) + { + npc.frameCounter = 0.0; + } + npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); //1 to 6 + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D NPCTexture = Main.npcTexture[npc.type]; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + int frameCount = Main.npcFrameCount[npc.type]; + float scale = npc.scale; + float rotation = npc.rotation; + float offsetY = npc.gfxOffY; + if (npc.ai[0] == 4f) + { + NPCTexture = mod.GetTexture("NPCs/CosmicWraith/CosmicWraithAlt2"); + int height = 564; + int width = 176; + Vector2 vector = new Vector2((float)(width / 2), (float)(height / frameCount / 2)); + Microsoft.Xna.Framework.Rectangle frame = new Rectangle(0, 0, width, height / frameCount); + frame.Y = 94 * (int)(npc.frameCounter / 12.0); //1 to 6 + if (frame.Y >= 94 * 6) + { + frame.Y = 0; + } + Main.spriteBatch.Draw(NPCTexture, + 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(drawColor), + rotation, + vector, + scale, + spriteEffects, + 0f); + return false; + } + else if (npc.ai[0] == 3f) + { + NPCTexture = mod.GetTexture("NPCs/CosmicWraith/CosmicWraithAlt"); + } + else + { + NPCTexture = Main.npcTexture[npc.type]; + } + Microsoft.Xna.Framework.Rectangle frame2 = npc.frame; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / frameCount / 2)); + 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)frameCount + 4f + vector11.Y * scale + 0f + offsetY), + new Microsoft.Xna.Framework.Rectangle?(frame2), + npc.GetAlpha(drawColor), + rotation, + vector11, + scale, + spriteEffects, + 0f); + return false; + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SuperHealingPotion; + } + + public override void NPCLoot() + { + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("TwistingNether"), Main.rand.Next(2, 4), true); + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SignusTrophy")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CosmicKunai")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Cosmilamp")); + } + } + } + + 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 HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 200; + npc.height = 150; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus5"), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + } +} diff --git a/NPCs/CosmicWraith/SignusBomb.cs b/NPCs/CosmicWraith/SignusBomb.cs index 1ee502b8ac..d5e9cb4c1e 100644 --- a/NPCs/CosmicWraith/SignusBomb.cs +++ b/NPCs/CosmicWraith/SignusBomb.cs @@ -1,187 +1,187 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.CosmicWraith -{ - public class SignusBomb : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Mine"); - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 0; - npc.lifeMax = 100; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override void AI() - { - npc.rotation = npc.velocity.X * 0.04f; - if (npc.ai[1] == 0f) - { - npc.scale -= 0.02f; - npc.alpha += 30; - if (npc.alpha >= 250) - { - npc.alpha = 255; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.02f; - npc.alpha -= 30; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } - Player player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - return; - } - } - else if (npc.timeLeft > 600) - { - npc.timeLeft = 600; - } - Vector2 vector = Main.player[npc.target].Center - npc.Center; - if (vector.Length() < 90f || npc.ai[3] >= 300f) - { - npc.dontTakeDamage = false; - CheckDead(); - npc.life = 0; - return; - } - npc.ai[3] += 1f; - npc.dontTakeDamage = (npc.ai[3] >= 240f ? false : true); - if (npc.ai[3] >= 180f) - { - npc.velocity.Y *= 0.985f; - npc.velocity.X *= 0.985f; - return; - } - npc.TargetClosest(true); - float num1372 = 14f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, Main.DiscoG, 255, 0); - } - - 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 ? 400 : 250; - npc.width = (npc.height = 256); - 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, 173, 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; - } - 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), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - return true; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 100; - npc.damage = 0; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.CosmicWraith +{ + public class SignusBomb : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Mine"); + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 0; + npc.lifeMax = 100; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit53; + npc.DeathSound = SoundID.NPCDeath44; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void AI() + { + npc.rotation = npc.velocity.X * 0.04f; + if (npc.ai[1] == 0f) + { + npc.scale -= 0.02f; + npc.alpha += 30; + if (npc.alpha >= 250) + { + npc.alpha = 255; + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 1f) + { + npc.scale += 0.02f; + npc.alpha -= 30; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + } + } + Player player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + return; + } + } + else if (npc.timeLeft > 600) + { + npc.timeLeft = 600; + } + Vector2 vector = Main.player[npc.target].Center - npc.Center; + if (vector.Length() < 90f || npc.ai[3] >= 300f) + { + npc.dontTakeDamage = false; + CheckDead(); + npc.life = 0; + return; + } + npc.ai[3] += 1f; + npc.dontTakeDamage = (npc.ai[3] >= 240f ? false : true); + if (npc.ai[3] >= 180f) + { + npc.velocity.Y *= 0.985f; + npc.velocity.X *= 0.985f; + return; + } + npc.TargetClosest(true); + float num1372 = 14f; + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + float num1374 = player.Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, Main.DiscoG, 255, 0); + } + + 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 ? 400 : 250; + npc.width = (npc.height = 256); + 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, 173, 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; + } + 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), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + return true; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 100; + npc.damage = 0; + } + } +} diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index 67eb97507e..8e1fa4069e 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -1,100 +1,100 @@ -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.World; - -namespace CalamityMod.NPCs.Crabulon -{ - public class CrabShroom : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crab Shroom"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 25; - npc.width = 14; //324 - npc.height = 14; //216 - npc.lifeMax = 25; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 90000; - } - aiType = -1; - npc.knockBackResist = 0.75f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - 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() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.2f, 0.4f); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - float speed = revenge ? 1.5f : 1f; - Player player = Main.player[npc.target]; - npc.velocity.Y = npc.velocity.Y + 0.02f; - if (npc.velocity.Y > speed) - { - npc.velocity.Y = speed; - } - npc.TargetClosest(true); - if (npc.position.X + (float)npc.width < player.position.X) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X + 0.1f; - } - else if (npc.position.X > player.position.X + (float)player.width) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X - 0.1f; - } - if (npc.velocity.X > 5f || npc.velocity.X < -5f) - { - npc.velocity.X = npc.velocity.X * 0.97f; - } - npc.rotation = npc.velocity.X * 0.1f; - return; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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.World; + +namespace CalamityMod.NPCs.Crabulon +{ + public class CrabShroom : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crab Shroom"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 25; + npc.width = 14; //324 + npc.height = 14; //216 + npc.lifeMax = 25; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 90000; + } + aiType = -1; + npc.knockBackResist = 0.75f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + 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() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.2f, 0.4f); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + float speed = revenge ? 1.5f : 1f; + Player player = Main.player[npc.target]; + npc.velocity.Y = npc.velocity.Y + 0.02f; + if (npc.velocity.Y > speed) + { + npc.velocity.Y = speed; + } + npc.TargetClosest(true); + if (npc.position.X + (float)npc.width < player.position.X) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X + 0.1f; + } + else if (npc.position.X > player.position.X + (float)player.width) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X - 0.1f; + } + if (npc.velocity.X > 5f || npc.velocity.X < -5f) + { + npc.velocity.X = npc.velocity.X * 0.97f; + } + npc.rotation = npc.velocity.X * 0.1f; + return; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index 2c774a7594..14006c0108 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -1,590 +1,590 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Crabulon -{ - [AutoloadBossHead] - public class CrabulonIdle : ModNPC - { - private int shotSpacing = 1000; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crabulon"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 14f; - npc.damage = 40; - npc.width = 280; //324 - npc.height = 160; //216 - npc.defense = 8; - npc.lifeMax = CalamityWorld.revenge ? 4000 : 3000; - if (CalamityWorld.death) - { - npc.lifeMax = 6930; - } - if (CalamityWorld.bossRushActive) - { - 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; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.noGravity = false; - npc.noTileCollide = false; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon"); - else - music = MusicID.Boss4; - npc.boss = true; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 4, 0, 0); - npc.HitSound = SoundID.NPCHit45; - npc.DeathSound = SoundID.NPCDeath1; - bossBag = mod.ItemType("CrabulonBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(shotSpacing); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - shotSpacing = reader.ReadInt32(); - } - - 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.5f, 1f); - Player player = Main.player[npc.target]; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (!player.active || player.dead) - { - 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] != 0f && npc.ai[0] < 3f) - { - Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num349 = player.position.X + (float)(player.width / 2) - vector34.X; - float num350 = player.position.Y + (float)(player.height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; - if (Main.netMode != 1) - { - int num352 = 1; - npc.localAI[3] += 2f; - if (CalamityWorld.bossRushActive) - { - npc.localAI[3] += 2f; - num352 += 3; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.localAI[3] += 1f; - num352 += 2; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.localAI[3] += 2f; - num352 += 3; - } - if (npc.ai[3] == 0f) - { - if (npc.localAI[3] > 600f) - { - npc.ai[3] = 1f; - npc.localAI[3] = 0f; - } - } - else if (npc.localAI[3] > 45f) - { - npc.localAI[3] = 0f; - npc.ai[3] += 1f; - if (npc.ai[3] >= (float)num352) - { - npc.ai[3] = 0f; - } - float num353 = 10f; - int num354 = expertMode ? 11 : 14; - int num355 = mod.ProjectileType("MushBomb"); - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); - if (CalamityWorld.bossRushActive) - { - num354 += 3; - num353 += 3f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - num354++; - num353 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num354++; - num353 += 1f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num354 += 3; - num353 += 1f; - } - vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num349 = player.position.X + (float)player.width * 0.5f - vector34.X; - num350 = player.position.Y + (float)player.height * 0.5f - vector34.Y; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num351 = num353 / num351; - num349 *= num351; - num350 *= num351; - vector34.X += num349; - vector34.Y += num350; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350 - 5f, num355, num354, 0f, Main.myPlayer, 0f, 0f); - } - } - } - if (npc.ai[0] == 0f) - { - if (Main.netMode != 2) - { - if (!player.dead && player.active && (player.Center - npc.Center).Length() < 800f) - { - player.AddBuff(mod.BuffType("Mushy"), 2); - } - } - int sporeDust = Dust.NewDust(npc.position, npc.width, npc.height, 56, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), 1.2f); - Main.dust[sporeDust].noGravity = true; - Main.dust[sporeDust].velocity *= 0.5f; - npc.ai[1] += 1f; - if (npc.justHit || npc.ai[1] >= 420f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - npc.velocity.X *= 0.98f; - npc.velocity.Y *= 0.98f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f) - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - float num823 = 1.25f; - bool flag51 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - num823 = 1.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num823 = 2f; - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num823 = 8f; - } - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 50f) - { - 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 - { - npc.direction = -Main.player[npc.target].direction; - 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) - { - 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) - { - if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 4f; - } - if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 8f; - } - } - if (npc.ai[1] >= 300f) - { - npc.ai[1] = -20f; - npc.frameCounter = 0.0; - } - else if (npc.ai[1] == -1f) - { - npc.TargetClosest(true); - npc.velocity.X = (float)(4 * npc.direction); - npc.velocity.Y = -12.1f; - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - } - } - else - { - if (npc.velocity.Y == 0f) - { - Main.PlaySound(SoundID.Item14, npc.position); - if (Main.netMode != 1) - { - Projectile.NewProjectile((int)npc.Center.X, (int)npc.Center.Y + 20, 0f, 0f, mod.ProjectileType("Mushmash"), 20, 0f, Main.myPlayer, 0f, 0f); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 3f) - { - if (Main.netMode != 1 && revenge) - { - for (int x = 0; x < 20; x++) - { - int num354 = expertMode ? 11 : 14; - Projectile.NewProjectile(npc.Center.X + (float)shotSpacing, npc.Center.Y - 1000f, 0f, 0f, mod.ProjectileType("MushBombFall"), num354, 0f, Main.myPlayer, 0f, 0f); - shotSpacing -= 100; - } - shotSpacing = 1000; - } - npc.ai[0] = 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, 56, 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.15f; //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 = 2.5f; //4 - if (revenge) - { - num626 += 1f; - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num626 += 3f; - } - 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; - } - } - } - } - if (npc.localAI[0] == 0f && npc.life > 0) - { - npc.localAI[0] = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num660) < npc.localAI[0]) - { - npc.localAI[0] = (float)npc.life; - int num661 = (expertMode ? Main.rand.Next(2, 4) : Main.rand.Next(1, 3)); - 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("CrabShroom"); - 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(-50, 51) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-50, -31) * 0.1f; - if (Main.netMode == 2 && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return npc.ai[0] > 1f; - } - - 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 PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = mod.GetTexture("NPCs/Crabulon/CrabulonIdleAlt"); - Texture2D textureAttack = mod.GetTexture("NPCs/Crabulon/CrabulonAttack"); - if (npc.ai[0] > 2f) - { - CalamityMod.DrawTexture(spriteBatch, textureAttack, 0, npc, drawColor, true); - } - else - { - CalamityMod.DrawTexture(spriteBatch, (npc.ai[0] == 2f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor, true); - } - return false; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrabulonTrophy")); - } - 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, ItemID.GlowingMushroom, Main.rand.Next(20, 31)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MushroomGrassSeeds, Main.rand.Next(3, 7)); - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrabulonMask")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HyphaeRod")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MycelialClaws")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Mycoroot")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Fungicide")); - } - } - } - - 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 HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 200; - npc.height = 100; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default(Color), 3f); - 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, 56, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon5"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon6"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon7"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Crabulon +{ + [AutoloadBossHead] + public class CrabulonIdle : ModNPC + { + private int shotSpacing = 1000; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 14f; + npc.damage = 40; + npc.width = 280; //324 + npc.height = 160; //216 + npc.defense = 8; + npc.lifeMax = CalamityWorld.revenge ? 4000 : 3000; + if (CalamityWorld.death) + { + npc.lifeMax = 6930; + } + if (CalamityWorld.bossRushActive) + { + 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; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.noGravity = false; + npc.noTileCollide = false; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon"); + else + music = MusicID.Boss4; + npc.boss = true; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 4, 0, 0); + npc.HitSound = SoundID.NPCHit45; + npc.DeathSound = SoundID.NPCDeath1; + bossBag = mod.ItemType("CrabulonBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(shotSpacing); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + shotSpacing = reader.ReadInt32(); + } + + 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.5f, 1f); + Player player = Main.player[npc.target]; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (!player.active || player.dead) + { + 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] != 0f && npc.ai[0] < 3f) + { + Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num349 = player.position.X + (float)(player.width / 2) - vector34.X; + float num350 = player.position.Y + (float)(player.height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num349 *= num351; + num350 *= num351; + if (Main.netMode != 1) + { + int num352 = 1; + npc.localAI[3] += 2f; + if (CalamityWorld.bossRushActive) + { + npc.localAI[3] += 2f; + num352 += 3; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.localAI[3] += 1f; + num352 += 2; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.localAI[3] += 2f; + num352 += 3; + } + if (npc.ai[3] == 0f) + { + if (npc.localAI[3] > 600f) + { + npc.ai[3] = 1f; + npc.localAI[3] = 0f; + } + } + else if (npc.localAI[3] > 45f) + { + npc.localAI[3] = 0f; + npc.ai[3] += 1f; + if (npc.ai[3] >= (float)num352) + { + npc.ai[3] = 0f; + } + float num353 = 10f; + int num354 = expertMode ? 11 : 14; + int num355 = mod.ProjectileType("MushBomb"); + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); + if (CalamityWorld.bossRushActive) + { + num354 += 3; + num353 += 3f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + num354++; + num353 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num354++; + num353 += 1f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num354 += 3; + num353 += 1f; + } + vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num349 = player.position.X + (float)player.width * 0.5f - vector34.X; + num350 = player.position.Y + (float)player.height * 0.5f - vector34.Y; + num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + num351 = num353 / num351; + num349 *= num351; + num350 *= num351; + vector34.X += num349; + vector34.Y += num350; + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350 - 5f, num355, num354, 0f, Main.myPlayer, 0f, 0f); + } + } + } + if (npc.ai[0] == 0f) + { + if (Main.netMode != 2) + { + if (!player.dead && player.active && (player.Center - npc.Center).Length() < 800f) + { + player.AddBuff(mod.BuffType("Mushy"), 2); + } + } + int sporeDust = Dust.NewDust(npc.position, npc.width, npc.height, 56, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), 1.2f); + Main.dust[sporeDust].noGravity = true; + Main.dust[sporeDust].velocity *= 0.5f; + npc.ai[1] += 1f; + if (npc.justHit || npc.ai[1] >= 420f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; + npc.ai[1] += 1f; + if (npc.ai[1] >= 60f) + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + float num823 = 1.25f; + bool flag51 = false; + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + num823 = 1.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num823 = 2f; + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num823 = 8f; + } + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 50f) + { + 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 + { + npc.direction = -Main.player[npc.target].direction; + 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) + { + 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) + { + if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 4f; + } + if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 8f; + } + } + if (npc.ai[1] >= 300f) + { + npc.ai[1] = -20f; + npc.frameCounter = 0.0; + } + else if (npc.ai[1] == -1f) + { + npc.TargetClosest(true); + npc.velocity.X = (float)(4 * npc.direction); + npc.velocity.Y = -12.1f; + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + } + } + else + { + if (npc.velocity.Y == 0f) + { + Main.PlaySound(SoundID.Item14, npc.position); + if (Main.netMode != 1) + { + Projectile.NewProjectile((int)npc.Center.X, (int)npc.Center.Y + 20, 0f, 0f, mod.ProjectileType("Mushmash"), 20, 0f, Main.myPlayer, 0f, 0f); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 3f) + { + if (Main.netMode != 1 && revenge) + { + for (int x = 0; x < 20; x++) + { + int num354 = expertMode ? 11 : 14; + Projectile.NewProjectile(npc.Center.X + (float)shotSpacing, npc.Center.Y - 1000f, 0f, 0f, mod.ProjectileType("MushBombFall"), num354, 0f, Main.myPlayer, 0f, 0f); + shotSpacing -= 100; + } + shotSpacing = 1000; + } + npc.ai[0] = 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, 56, 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.15f; //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 = 2.5f; //4 + if (revenge) + { + num626 += 1f; + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num626 += 3f; + } + 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; + } + } + } + } + if (npc.localAI[0] == 0f && npc.life > 0) + { + npc.localAI[0] = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.05); + if ((float)(npc.life + num660) < npc.localAI[0]) + { + npc.localAI[0] = (float)npc.life; + int num661 = (expertMode ? Main.rand.Next(2, 4) : Main.rand.Next(1, 3)); + 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("CrabShroom"); + 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(-50, 51) * 0.1f; + Main.npc[num664].velocity.Y = (float)Main.rand.Next(-50, -31) * 0.1f; + if (Main.netMode == 2 && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return npc.ai[0] > 1f; + } + + 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 PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = mod.GetTexture("NPCs/Crabulon/CrabulonIdleAlt"); + Texture2D textureAttack = mod.GetTexture("NPCs/Crabulon/CrabulonAttack"); + if (npc.ai[0] > 2f) + { + CalamityMod.DrawTexture(spriteBatch, textureAttack, 0, npc, drawColor, true); + } + else + { + CalamityMod.DrawTexture(spriteBatch, (npc.ai[0] == 2f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor, true); + } + return false; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrabulonTrophy")); + } + 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, ItemID.GlowingMushroom, Main.rand.Next(20, 31)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MushroomGrassSeeds, Main.rand.Next(3, 7)); + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrabulonMask")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HyphaeRod")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MycelialClaws")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Mycoroot")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Fungicide")); + } + } + } + + 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 HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 56, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 200; + npc.height = 100; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default(Color), 3f); + 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, 56, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon5"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon6"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon7"), 1f); + } + } + } +} diff --git a/NPCs/Cryogen/Cryocore.cs b/NPCs/Cryogen/Cryocore.cs index 6bd5642387..9173aecb2b 100644 --- a/NPCs/Cryogen/Cryocore.cs +++ b/NPCs/Cryogen/Cryocore.cs @@ -1,125 +1,125 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Cryogen -{ - public class Cryocore : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryocore"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.damage = 35; - npc.width = 40; //324 - npc.height = 40; //216 - npc.defense = 5; - npc.lifeMax = 220; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 30000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0.75f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - } - - 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() - { - bool revenge = CalamityWorld.revenge; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); - npc.TargetClosest(true); - float num1372 = revenge ? 12f : 11f; - 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.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.rotation += (float)npc.direction * 0.3f; - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - npc.rotation = npc.velocity.X * 0.15f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Frostburn, 90, true); - player.AddBuff(BuffID.Chilled, 60, true); - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Cryocore"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Cryogen +{ + public class Cryocore : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryocore"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.damage = 35; + npc.width = 40; //324 + npc.height = 40; //216 + npc.defense = 5; + npc.lifeMax = 220; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 30000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0.75f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath15; + } + + 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() + { + bool revenge = CalamityWorld.revenge; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); + npc.TargetClosest(true); + float num1372 = revenge ? 12f : 11f; + 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.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.rotation += (float)npc.direction * 0.3f; + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + npc.rotation = npc.velocity.X * 0.15f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 90, true); + player.AddBuff(BuffID.Chilled, 60, true); + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Cryocore"), 1f); + } + } + } +} diff --git a/NPCs/Cryogen/Cryocore2.cs b/NPCs/Cryogen/Cryocore2.cs index a95f202360..486ff66e55 100644 --- a/NPCs/Cryogen/Cryocore2.cs +++ b/NPCs/Cryogen/Cryocore2.cs @@ -1,125 +1,125 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Cryogen -{ - public class Cryocore2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryocore"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 37; - npc.width = 66; //324 - npc.height = 66; //216 - npc.defense = 10; - npc.lifeMax = 300; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 40000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0.5f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - } - - 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() - { - bool revenge = CalamityWorld.revenge; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); - npc.TargetClosest(true); - float num1372 = revenge ? 14f : 12f; - 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.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.rotation += (float)npc.direction * 0.3f; - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - npc.rotation = npc.velocity.X * 0.15f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Frostburn, 90, true); - player.AddBuff(BuffID.Chilled, 60, true); - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Cryocore2"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Cryogen +{ + public class Cryocore2 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryocore"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 37; + npc.width = 66; //324 + npc.height = 66; //216 + npc.defense = 10; + npc.lifeMax = 300; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 40000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0.5f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath15; + } + + 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() + { + bool revenge = CalamityWorld.revenge; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); + npc.TargetClosest(true); + float num1372 = revenge ? 14f : 12f; + 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.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.rotation += (float)npc.direction * 0.3f; + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + npc.rotation = npc.velocity.X * 0.15f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 90, true); + player.AddBuff(BuffID.Chilled, 60, true); + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Cryocore2"), 1f); + } + } + } +} diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 6b0b8092a6..f89fcec7dc 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1,1033 +1,1033 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Cryogen -{ - [AutoloadBossHead] - public class Cryogen : ModNPC - { - private int time = 0; - private int iceShard = 0; - private bool drawAltTexture = false; - private int teleportLocationX = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen"); - } - - public override void SetDefaults() - { - npc.npcSlots = 24f; - npc.damage = 60; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 10; - npc.lifeMax = CalamityWorld.revenge ? 26300 : 17900; - if (CalamityWorld.death) - { - npc.lifeMax = 39900; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 12, 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.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; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"); - else - music = MusicID.FrostMoon; - bossBag = mod.ItemType("CryogenBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(drawAltTexture); - writer.Write(time); - writer.Write(iceShard); - writer.Write(teleportLocationX); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - drawAltTexture = reader.ReadBoolean(); - time = reader.ReadInt32(); - iceShard = reader.ReadInt32(); - teleportLocationX = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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, 1f, 1f); - Player player = Main.player[npc.target]; - bool isChill = player.ZoneSnow; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - npc.TargetClosest(true); - if (npc.ai[2] == 0f && npc.localAI[1] == 0f && Main.netMode != 1 && npc.ai[0] < 4f) //spawn shield for phase 0 1 2 3, not 4 5 - { - int num6 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("CryogenIce"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - npc.ai[2] = (float)(num6 + 1); - npc.localAI[1] = -1f; - npc.netUpdate = true; - Main.npc[num6].ai[0] = (float)npc.whoAmI; - Main.npc[num6].netUpdate = true; - } - int num7 = (int)npc.ai[2] - 1; - if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == mod.NPCType("CryogenIce")) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - npc.ai[2] = 0f; - if (npc.localAI[1] == -1f) - { - npc.localAI[1] = expertMode ? 720f : 1080f; - } - if (npc.localAI[1] > 0f) - { - 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 (!Main.raining && !CalamityWorld.bossRushActive) - { - RainStart(); - } - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 2400) - { - npc.timeLeft = 2400; - } - if (Main.netMode != 1 && expertMode) - { - time++; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - time++; - } - if (time >= 600) - { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 4f; - double offsetAngle; - int i; - int num184 = 22; - for (i = 0; i < 2; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBomb"), num184, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBomb"), num184, 0f, Main.myPlayer, 0f, 0f); - } - time = 0; - } - } - if (npc.ai[0] == 0f) - { - if (Main.netMode != 1) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - int i; - for (i = 0; i < 8; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); - float num1246 = isChill ? 3f : 5f; - if (CalamityWorld.death) - { - num1246 = isChill ? 4f : 6f; - } - if (CalamityWorld.bossRushActive) - { - num1246 = 10f; - } - 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; - npc.localAI[0] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - if (Main.netMode != 1) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } - } - } - } - float num1164 = isChill ? 4f : 6f; - float num1165 = isChill ? 1f : 1.2f; - if (CalamityWorld.death) - { - num1164 = isChill ? 5f : 7f; - } - if (CalamityWorld.bossRushActive) - { - num1164 = 12f; - } - Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); - float num1166 = player.Center.X - vector133.X; - float num1167 = player.Center.Y - vector133.Y - 400f; - float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); - if (num1168 < 20f) - { - num1166 = npc.velocity.X; - num1167 = npc.velocity.Y; - } - else - { - num1168 = num1164 / num1168; - num1166 *= num1168; - num1167 *= num1168; - } - if (npc.velocity.X < num1166) - { - npc.velocity.X = npc.velocity.X + num1165; - if (npc.velocity.X < 0f && num1166 > 0f) - { - npc.velocity.X = npc.velocity.X + num1165 * 2f; - } - } - else if (npc.velocity.X > num1166) - { - npc.velocity.X = npc.velocity.X - num1165; - if (npc.velocity.X > 0f && num1166 < 0f) - { - npc.velocity.X = npc.velocity.X - num1165 * 2f; - } - } - if (npc.velocity.Y < num1167) - { - npc.velocity.Y = npc.velocity.Y + num1165; - if (npc.velocity.Y < 0f && num1167 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1165 * 2f; - } - } - else if (npc.velocity.Y > num1167) - { - npc.velocity.Y = npc.velocity.Y - num1165; - if (npc.velocity.Y > 0f && num1167 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1165 * 2f; - } - } - if (npc.position.X + (float)npc.width > player.position.X && npc.position.X < player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && Main.netMode != 1) - { - iceShard += 4; - if (iceShard > 8) - { - iceShard = 0; - int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); - int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); - int damage = expertMode ? 23 : 26; - Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, mod.ProjectileType("IceRain"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - if ((double)npc.life < (double)npc.lifeMax * 0.66) - { - npc.ai[0] = 2f; - npc.localAI[0] = 0f; - iceShard = 0; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - if (Main.netMode != 1) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - if (Main.rand.Next(2) == 0) - { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } - } - else - { - float num179 = revenge ? 9f : 7f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 23 : 26; - int num185 = mod.ProjectileType("IceRain"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 15; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-100, 101); - num182 += (float)Main.rand.Next(-100, 101); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -10f, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); - float num1246 = isChill ? 5f : 7f; - if (CalamityWorld.death) - { - num1246 = isChill ? 6f : 8f; - } - if (CalamityWorld.bossRushActive) - { - num1246 = 14f; - } - 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; - npc.localAI[0] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - if (Main.netMode != 1) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num179 = revenge ? 9f : 7f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.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 = expertMode ? 23 : 26; - int num185 = mod.ProjectileType("IceRain"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 15; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-100, 101); - num182 += (float)Main.rand.Next(-100, 101); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -10f, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - float num1164 = isChill ? 4.5f : 6.5f; - float num1165 = isChill ? 1.1f : 1.3f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num1164 = isChill ? 5.5f : 7.5f; - } - Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); - float num1166 = player.Center.X - vector133.X; - float num1167 = player.Center.Y - vector133.Y - 300f; - float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); - if (num1168 < 20f) - { - num1166 = npc.velocity.X; - num1167 = npc.velocity.Y; - } - else - { - num1168 = num1164 / num1168; - num1166 *= num1168; - num1167 *= num1168; - } - if (npc.velocity.X < num1166) - { - npc.velocity.X = npc.velocity.X + num1165; - if (npc.velocity.X < 0f && num1166 > 0f) - { - npc.velocity.X = npc.velocity.X + num1165 * 2f; - } - } - else if (npc.velocity.X > num1166) - { - npc.velocity.X = npc.velocity.X - num1165; - if (npc.velocity.X > 0f && num1166 < 0f) - { - npc.velocity.X = npc.velocity.X - num1165 * 2f; - } - } - if (npc.velocity.Y < num1167) - { - npc.velocity.Y = npc.velocity.Y + num1165; - if (npc.velocity.Y < 0f && num1167 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1165 * 2f; - } - } - else if (npc.velocity.Y > num1167) - { - npc.velocity.Y = npc.velocity.Y - num1165; - if (npc.velocity.Y > 0f && num1167 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1165 * 2f; - } - } - if (npc.position.X + (float)npc.width > player.position.X && npc.position.X < player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && Main.netMode != 1) - { - iceShard += 4; - if (iceShard > 8) - { - iceShard = 0; - int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); - int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); - int damage = expertMode ? 23 : 26; - Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, mod.ProjectileType("IceRain"), damage, 0f, Main.myPlayer, 0f, 0f); - return; - } - } - if ((double)npc.life < (double)npc.lifeMax * 0.32) - { - npc.ai[0] = 4f; - npc.localAI[0] = 0f; - iceShard = 0; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - if (Main.netMode != 1) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 60f && npc.alpha == 0) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int num184 = expertMode ? 20 : 23; - int i; - for (i = 0; i < 6; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } - } - } - } - npc.TargetClosest(true); - Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); - float num1243 = player.Center.X - vector142.X; - float num1244 = player.Center.Y - vector142.Y; - float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); - float speed = revenge ? 4.5f : 4f; - if (CalamityWorld.bossRushActive) - { - speed = 9f; - } - 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; - npc.dontTakeDamage = false; - if (Main.netMode != 1) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= (float)(120 + Main.rand.Next(200))) - { - npc.localAI[2] = 0f; - npc.TargetClosest(true); - int num1249 = 0; - int num1250; - int num1251; - while (true) - { - num1249++; - num1250 = (int)player.Center.X / 16; - num1251 = (int)player.Center.Y / 16; - num1250 += Main.rand.Next(-50, 51); - num1251 += Main.rand.Next(-50, 51); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height)) - { - break; - } - if (num1249 > 100) - { - goto Block; - } - } - npc.ai[1] = 1f; - teleportLocationX = num1250; - iceShard = num1251; - npc.netUpdate = true; - Block:; - } - } - } - else if (npc.ai[1] == 1f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.alpha += 4; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.position.X = (float)teleportLocationX * 16f - (float)(npc.width / 2); - npc.position.Y = (float)iceShard * 16f - (float)(npc.height / 2); - npc.ai[1] = 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[1] == 2f) - { - npc.alpha -= 4; - if (npc.alpha <= 0) - { - npc.dontTakeDamage = false; - npc.chaseable = true; - npc.alpha = 0; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - if ((double)npc.life < (double)npc.lifeMax * 0.15) - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 15); - drawAltTexture = true; - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default(Color), 3f); - 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, 67, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore3"), 1f); - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.localAI[0] = 0f; - npc.localAI[2] = 0f; - teleportLocationX = 0; - iceShard = 0; - npc.netUpdate = true; - string key = "Mods.CalamityMod.CryogenBossText"; - Color messageColor = Color.Cyan; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - else - { - npc.dontTakeDamage = false; - npc.chaseable = true; - float num1372 = isChill ? 16f : 22f; - if (CalamityWorld.bossRushActive) - { - num1372 = 24f; - } - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - iceShard--; - if ((double)npc.life < (double)npc.lifeMax * 0.05 || CalamityWorld.death || CalamityWorld.bossRushActive) - { - if (num1375 < 170f || iceShard > 0) - { - if (num1375 < 170f) - { - iceShard = 17; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.rotation += (float)npc.direction * 0.5f; - return; - } - } - else if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - if (num1375 < 190f || iceShard > 0) - { - if (num1375 < 190f) - { - iceShard = 19; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.rotation += (float)npc.direction * 0.35f; - return; - } - } - else - { - if (num1375 < 200f || iceShard > 0) - { - if (num1375 < 200f) - { - iceShard = 20; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.rotation += (float)npc.direction * 0.3f; - return; - } - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - npc.rotation = npc.velocity.X * 0.15f; - } - if (npc.ai[3] == 0f && npc.life > 0) - { - npc.ai[3] = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num660) < npc.ai[3]) - { - npc.ai[3] = (float)npc.life; - for (int num662 = 0; num662 < 2; 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 randomSpawn = Main.rand.Next(3); - if (randomSpawn == 0) - { - randomSpawn = mod.NPCType("Cryocore"); - } - else if (randomSpawn == 1) - { - randomSpawn = mod.NPCType("IceMass"); - } - else - { - randomSpawn = mod.NPCType("Cryocore2"); - } - int num664 = NPC.NewNPC(x, y, randomSpawn, 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == 2 && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) //for alt textures - { - if (drawAltTexture) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = mod.GetTexture("NPCs/Cryogen/Cryogen2"); - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); - return false; - } - return true; - } - - 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 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++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default(Color), 3f); - 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, 67, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore8"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore9"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore10"), 1f); - } - } - - private void RainStart() - { - int num = 86400; - int num2 = num / 24; - Main.rainTime = Main.rand.Next(num2 * 8, num); - if (Main.rand.Next(3) == 0) - { - Main.rainTime += Main.rand.Next(0, num2); - } - if (Main.rand.Next(4) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.Next(5) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.Next(6) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 3); - } - if (Main.rand.Next(7) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 4); - } - if (Main.rand.Next(8) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 5); - } - float num3 = 1f; - if (Main.rand.Next(2) == 0) - { - num3 += 0.05f; - } - if (Main.rand.Next(3) == 0) - { - num3 += 0.1f; - } - if (Main.rand.Next(4) == 0) - { - num3 += 0.15f; - } - if (Main.rand.Next(5) == 0) - { - num3 += 0.2f; - } - Main.rainTime = (int)((float)Main.rainTime * num3); - Main.raining = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } - - public override void NPCLoot() - { - int permadongo = NPC.FindFirstNPC(mod.NPCType("DILF")); - if (permadongo == -1 && Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("DILF"), 0, 0f, 0f, 0f, 0f, 255); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CryogenTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrozenKey); - } - if (Main.rand.Next(10) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("CryoStone"), 1, true); - } - if (Main.rand.Next(7) == 0) - { - 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")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EffluviumBow")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GlacialCrusher")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Icebreaker")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("IceStar"), Main.rand.Next(100, 151)); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Avalanche")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SnowstormStaff")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SoulofMight, Main.rand.Next(20, 41)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CryoBar"), Main.rand.Next(15, 26)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum"), Main.rand.Next(4, 9)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrostCore); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Frostburn, 120, true); - player.AddBuff(BuffID.Chilled, 90, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Cryogen +{ + [AutoloadBossHead] + public class Cryogen : ModNPC + { + private int time = 0; + private int iceShard = 0; + private bool drawAltTexture = false; + private int teleportLocationX = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen"); + } + + public override void SetDefaults() + { + npc.npcSlots = 24f; + npc.damage = 60; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 10; + npc.lifeMax = CalamityWorld.revenge ? 26300 : 17900; + if (CalamityWorld.death) + { + npc.lifeMax = 39900; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 12, 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.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; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath15; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"); + else + music = MusicID.FrostMoon; + bossBag = mod.ItemType("CryogenBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(drawAltTexture); + writer.Write(time); + writer.Write(iceShard); + writer.Write(teleportLocationX); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + drawAltTexture = reader.ReadBoolean(); + time = reader.ReadInt32(); + iceShard = reader.ReadInt32(); + teleportLocationX = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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, 1f, 1f); + Player player = Main.player[npc.target]; + bool isChill = player.ZoneSnow; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + npc.TargetClosest(true); + if (npc.ai[2] == 0f && npc.localAI[1] == 0f && Main.netMode != 1 && npc.ai[0] < 4f) //spawn shield for phase 0 1 2 3, not 4 5 + { + int num6 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("CryogenIce"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + npc.ai[2] = (float)(num6 + 1); + npc.localAI[1] = -1f; + npc.netUpdate = true; + Main.npc[num6].ai[0] = (float)npc.whoAmI; + Main.npc[num6].netUpdate = true; + } + int num7 = (int)npc.ai[2] - 1; + if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == mod.NPCType("CryogenIce")) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + npc.ai[2] = 0f; + if (npc.localAI[1] == -1f) + { + npc.localAI[1] = expertMode ? 720f : 1080f; + } + if (npc.localAI[1] > 0f) + { + 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 (!Main.raining && !CalamityWorld.bossRushActive) + { + RainStart(); + } + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 2400) + { + npc.timeLeft = 2400; + } + if (Main.netMode != 1 && expertMode) + { + time++; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + time++; + } + if (time >= 600) + { + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 4f; + double offsetAngle; + int i; + int num184 = 22; + for (i = 0; i < 2; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBomb"), num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBomb"), num184, 0f, Main.myPlayer, 0f, 0f); + } + time = 0; + } + } + if (npc.ai[0] == 0f) + { + if (Main.netMode != 1) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int num184 = expertMode ? 20 : 23; + int i; + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + float num1243 = player.Center.X - vector142.X; + float num1244 = player.Center.Y - vector142.Y; + float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); + float num1246 = isChill ? 3f : 5f; + if (CalamityWorld.death) + { + num1246 = isChill ? 4f : 6f; + } + if (CalamityWorld.bossRushActive) + { + num1246 = 10f; + } + 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; + npc.localAI[0] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + if (Main.netMode != 1) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int num184 = expertMode ? 20 : 23; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[ice].timeLeft = 300; + Main.projectile[ice2].timeLeft = 300; + } + } + } + } + float num1164 = isChill ? 4f : 6f; + float num1165 = isChill ? 1f : 1.2f; + if (CalamityWorld.death) + { + num1164 = isChill ? 5f : 7f; + } + if (CalamityWorld.bossRushActive) + { + num1164 = 12f; + } + Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); + float num1166 = player.Center.X - vector133.X; + float num1167 = player.Center.Y - vector133.Y - 400f; + float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); + if (num1168 < 20f) + { + num1166 = npc.velocity.X; + num1167 = npc.velocity.Y; + } + else + { + num1168 = num1164 / num1168; + num1166 *= num1168; + num1167 *= num1168; + } + if (npc.velocity.X < num1166) + { + npc.velocity.X = npc.velocity.X + num1165; + if (npc.velocity.X < 0f && num1166 > 0f) + { + npc.velocity.X = npc.velocity.X + num1165 * 2f; + } + } + else if (npc.velocity.X > num1166) + { + npc.velocity.X = npc.velocity.X - num1165; + if (npc.velocity.X > 0f && num1166 < 0f) + { + npc.velocity.X = npc.velocity.X - num1165 * 2f; + } + } + if (npc.velocity.Y < num1167) + { + npc.velocity.Y = npc.velocity.Y + num1165; + if (npc.velocity.Y < 0f && num1167 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1165 * 2f; + } + } + else if (npc.velocity.Y > num1167) + { + npc.velocity.Y = npc.velocity.Y - num1165; + if (npc.velocity.Y > 0f && num1167 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1165 * 2f; + } + } + if (npc.position.X + (float)npc.width > player.position.X && npc.position.X < player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && Main.netMode != 1) + { + iceShard += 4; + if (iceShard > 8) + { + iceShard = 0; + int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); + int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); + int damage = expertMode ? 23 : 26; + Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, mod.ProjectileType("IceRain"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if ((double)npc.life < (double)npc.lifeMax * 0.66) + { + npc.ai[0] = 2f; + npc.localAI[0] = 0f; + iceShard = 0; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + if (Main.netMode != 1) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + if (Main.rand.Next(2) == 0) + { + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int num184 = expertMode ? 20 : 23; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[ice].timeLeft = 300; + Main.projectile[ice2].timeLeft = 300; + } + } + else + { + float num179 = revenge ? 9f : 7f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = expertMode ? 23 : 26; + int num185 = mod.ProjectileType("IceRain"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 15; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-100, 101); + num182 += (float)Main.rand.Next(-100, 101); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, -10f, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + float num1243 = player.Center.X - vector142.X; + float num1244 = player.Center.Y - vector142.Y; + float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); + float num1246 = isChill ? 5f : 7f; + if (CalamityWorld.death) + { + num1246 = isChill ? 6f : 8f; + } + if (CalamityWorld.bossRushActive) + { + num1246 = 14f; + } + 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; + npc.localAI[0] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + if (Main.netMode != 1) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 120f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + float num179 = revenge ? 9f : 7f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.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 = expertMode ? 23 : 26; + int num185 = mod.ProjectileType("IceRain"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 15; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-100, 101); + num182 += (float)Main.rand.Next(-100, 101); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, -10f, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + float num1164 = isChill ? 4.5f : 6.5f; + float num1165 = isChill ? 1.1f : 1.3f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num1164 = isChill ? 5.5f : 7.5f; + } + Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); + float num1166 = player.Center.X - vector133.X; + float num1167 = player.Center.Y - vector133.Y - 300f; + float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); + if (num1168 < 20f) + { + num1166 = npc.velocity.X; + num1167 = npc.velocity.Y; + } + else + { + num1168 = num1164 / num1168; + num1166 *= num1168; + num1167 *= num1168; + } + if (npc.velocity.X < num1166) + { + npc.velocity.X = npc.velocity.X + num1165; + if (npc.velocity.X < 0f && num1166 > 0f) + { + npc.velocity.X = npc.velocity.X + num1165 * 2f; + } + } + else if (npc.velocity.X > num1166) + { + npc.velocity.X = npc.velocity.X - num1165; + if (npc.velocity.X > 0f && num1166 < 0f) + { + npc.velocity.X = npc.velocity.X - num1165 * 2f; + } + } + if (npc.velocity.Y < num1167) + { + npc.velocity.Y = npc.velocity.Y + num1165; + if (npc.velocity.Y < 0f && num1167 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1165 * 2f; + } + } + else if (npc.velocity.Y > num1167) + { + npc.velocity.Y = npc.velocity.Y - num1165; + if (npc.velocity.Y > 0f && num1167 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1165 * 2f; + } + } + if (npc.position.X + (float)npc.width > player.position.X && npc.position.X < player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && Main.netMode != 1) + { + iceShard += 4; + if (iceShard > 8) + { + iceShard = 0; + int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); + int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); + int damage = expertMode ? 23 : 26; + Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, mod.ProjectileType("IceRain"), damage, 0f, Main.myPlayer, 0f, 0f); + return; + } + } + if ((double)npc.life < (double)npc.lifeMax * 0.32) + { + npc.ai[0] = 4f; + npc.localAI[0] = 0f; + iceShard = 0; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + if (Main.netMode != 1) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 60f && npc.alpha == 0) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int num184 = expertMode ? 20 : 23; + int i; + for (i = 0; i < 6; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[ice].timeLeft = 300; + Main.projectile[ice2].timeLeft = 300; + } + } + } + } + npc.TargetClosest(true); + Vector2 vector142 = new Vector2(npc.Center.X, npc.Center.Y); + float num1243 = player.Center.X - vector142.X; + float num1244 = player.Center.Y - vector142.Y; + float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); + float speed = revenge ? 4.5f : 4f; + if (CalamityWorld.bossRushActive) + { + speed = 9f; + } + 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; + npc.dontTakeDamage = false; + if (Main.netMode != 1) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] >= (float)(120 + Main.rand.Next(200))) + { + npc.localAI[2] = 0f; + npc.TargetClosest(true); + int num1249 = 0; + int num1250; + int num1251; + while (true) + { + num1249++; + num1250 = (int)player.Center.X / 16; + num1251 = (int)player.Center.Y / 16; + num1250 += Main.rand.Next(-50, 51); + num1251 += Main.rand.Next(-50, 51); + if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, player.position, player.width, player.height)) + { + break; + } + if (num1249 > 100) + { + goto Block; + } + } + npc.ai[1] = 1f; + teleportLocationX = num1250; + iceShard = num1251; + npc.netUpdate = true; + Block:; + } + } + } + else if (npc.ai[1] == 1f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.alpha += 4; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.position.X = (float)teleportLocationX * 16f - (float)(npc.width / 2); + npc.position.Y = (float)iceShard * 16f - (float)(npc.height / 2); + npc.ai[1] = 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[1] == 2f) + { + npc.alpha -= 4; + if (npc.alpha <= 0) + { + npc.dontTakeDamage = false; + npc.chaseable = true; + npc.alpha = 0; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + if ((double)npc.life < (double)npc.lifeMax * 0.15) + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 15); + drawAltTexture = true; + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default(Color), 3f); + 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, 67, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore3"), 1f); + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + teleportLocationX = 0; + iceShard = 0; + npc.netUpdate = true; + string key = "Mods.CalamityMod.CryogenBossText"; + Color messageColor = Color.Cyan; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + } + else + { + npc.dontTakeDamage = false; + npc.chaseable = true; + float num1372 = isChill ? 16f : 22f; + if (CalamityWorld.bossRushActive) + { + num1372 = 24f; + } + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + float num1374 = player.Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + iceShard--; + if ((double)npc.life < (double)npc.lifeMax * 0.05 || CalamityWorld.death || CalamityWorld.bossRushActive) + { + if (num1375 < 170f || iceShard > 0) + { + if (num1375 < 170f) + { + iceShard = 17; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.rotation += (float)npc.direction * 0.5f; + return; + } + } + else if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + if (num1375 < 190f || iceShard > 0) + { + if (num1375 < 190f) + { + iceShard = 19; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.rotation += (float)npc.direction * 0.35f; + return; + } + } + else + { + if (num1375 < 200f || iceShard > 0) + { + if (num1375 < 200f) + { + iceShard = 20; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.rotation += (float)npc.direction * 0.3f; + return; + } + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + npc.rotation = npc.velocity.X * 0.15f; + } + if (npc.ai[3] == 0f && npc.life > 0) + { + npc.ai[3] = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.05); + if ((float)(npc.life + num660) < npc.ai[3]) + { + npc.ai[3] = (float)npc.life; + for (int num662 = 0; num662 < 2; 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 randomSpawn = Main.rand.Next(3); + if (randomSpawn == 0) + { + randomSpawn = mod.NPCType("Cryocore"); + } + else if (randomSpawn == 1) + { + randomSpawn = mod.NPCType("IceMass"); + } + else + { + randomSpawn = mod.NPCType("Cryocore2"); + } + int num664 = NPC.NewNPC(x, y, randomSpawn, 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == 2 && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) //for alt textures + { + if (drawAltTexture) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = mod.GetTexture("NPCs/Cryogen/Cryogen2"); + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); + return false; + } + return true; + } + + 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 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++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default(Color), 3f); + 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, 67, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore8"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore9"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore10"), 1f); + } + } + + private void RainStart() + { + int num = 86400; + int num2 = num / 24; + Main.rainTime = Main.rand.Next(num2 * 8, num); + if (Main.rand.Next(3) == 0) + { + Main.rainTime += Main.rand.Next(0, num2); + } + if (Main.rand.Next(4) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.Next(5) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.Next(6) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 3); + } + if (Main.rand.Next(7) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 4); + } + if (Main.rand.Next(8) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 5); + } + float num3 = 1f; + if (Main.rand.Next(2) == 0) + { + num3 += 0.05f; + } + if (Main.rand.Next(3) == 0) + { + num3 += 0.1f; + } + if (Main.rand.Next(4) == 0) + { + num3 += 0.15f; + } + if (Main.rand.Next(5) == 0) + { + num3 += 0.2f; + } + Main.rainTime = (int)((float)Main.rainTime * num3); + Main.raining = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } + + public override void NPCLoot() + { + int permadongo = NPC.FindFirstNPC(mod.NPCType("DILF")); + if (permadongo == -1 && Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("DILF"), 0, 0f, 0f, 0f, 0f, 255); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CryogenTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrozenKey); + } + if (Main.rand.Next(10) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("CryoStone"), 1, true); + } + if (Main.rand.Next(7) == 0) + { + 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")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EffluviumBow")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GlacialCrusher")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Icebreaker")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("IceStar"), Main.rand.Next(100, 151)); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Avalanche")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SnowstormStaff")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SoulofMight, Main.rand.Next(20, 41)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CryoBar"), Main.rand.Next(15, 26)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum"), Main.rand.Next(4, 9)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrostCore); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 120, true); + player.AddBuff(BuffID.Chilled, 90, true); + } + } +} diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index 8d3b735618..e828a4ea5d 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -1,137 +1,137 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Cryogen -{ - public class CryogenIce : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen's Shield"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.damage = 25; - npc.width = 240; //324 - npc.height = 240; //216 - npc.defense = 0; - npc.lifeMax = 1400; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 100000; - } - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - } - - public override void AI() - { - npc.alpha -= 3; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.rotation += 0.15f; - if (npc.type == mod.NPCType("CryogenIce")) - { - int num989 = (int)npc.ai[0]; - if (Main.npc[num989].active && Main.npc[num989].type == mod.NPCType("Cryogen")) - { - npc.velocity = Vector2.Zero; - npc.position = Main.npc[num989].Center; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - npc.gfxOffY = Main.npc[num989].gfxOffY; - return; - } - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - 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); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); - npc.damage *= 2; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int num621 = 0; num621 < 25; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default(Color), 3f); - 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, 67, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 4f; - double offsetAngle; - int num184 = Main.expertMode ? 20 : 23; - int i; - for (i = 0; i < 2; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[ice].timeLeft = 300; - Main.projectile[ice2].timeLeft = 300; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - for (int spike = 0; spike < 4; spike++) - { - randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore5"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore6"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore7"), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Cryogen +{ + public class CryogenIce : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen's Shield"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.damage = 25; + npc.width = 240; //324 + npc.height = 240; //216 + npc.defense = 0; + npc.lifeMax = 1400; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 100000; + } + npc.alpha = 255; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + } + + public override void AI() + { + npc.alpha -= 3; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.rotation += 0.15f; + if (npc.type == mod.NPCType("CryogenIce")) + { + int num989 = (int)npc.ai[0]; + if (Main.npc[num989].active && Main.npc[num989].type == mod.NPCType("Cryogen")) + { + npc.velocity = Vector2.Zero; + npc.position = Main.npc[num989].Center; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.gfxOffY = Main.npc[num989].gfxOffY; + return; + } + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + 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); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); + npc.damage *= 2; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int num621 = 0; num621 < 25; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default(Color), 3f); + 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, 67, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 4f; + double offsetAngle; + int num184 = Main.expertMode ? 20 : 23; + int i; + for (i = 0; i < 2; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int ice = Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + int ice2 = Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), mod.ProjectileType("IceBlast"), num184, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[ice].timeLeft = 300; + Main.projectile[ice2].timeLeft = 300; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + for (int spike = 0; spike < 4; spike++) + { + randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore5"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore6"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore7"), 1f); + } + } + } + } +} diff --git a/NPCs/Cryogen/IceMass.cs b/NPCs/Cryogen/IceMass.cs index 6141e3e4a5..f4b778d9a0 100644 --- a/NPCs/Cryogen/IceMass.cs +++ b/NPCs/Cryogen/IceMass.cs @@ -1,74 +1,74 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Cryogen -{ - public class IceMass : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aurora Spirit"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.aiStyle = 86; - npc.damage = 40; - npc.width = 40; //324 - npc.height = 24; //216 - npc.defense = 5; - npc.alpha = 100; - npc.lifeMax = 220; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 30000; - } - npc.knockBackResist = 0f; - animationType = 472; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath15; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Frostburn, 90, true); - player.AddBuff(BuffID.Chilled, 60, 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.01f, 0.35f, 0.35f); - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CryoSpirit"), 1f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Cryogen +{ + public class IceMass : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aurora Spirit"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.aiStyle = 86; + npc.damage = 40; + npc.width = 40; //324 + npc.height = 24; //216 + npc.defense = 5; + npc.alpha = 100; + npc.lifeMax = 220; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 30000; + } + npc.knockBackResist = 0f; + animationType = 472; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath15; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 90, true); + player.AddBuff(BuffID.Chilled, 60, 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.01f, 0.35f, 0.35f); + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CryoSpirit"), 1f); + } + } + } +} diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 541eb6c2f3..d7496e2ebb 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -1,192 +1,192 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DesertScourgeBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 16; //70 - npc.npcSlots = 5f; - npc.width = 32; //324 - npc.height = 36; //216 - npc.defense = 8; - npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; - if (CalamityWorld.death) - { - npc.lifeMax = 5100; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - else - music = MusicID.Boss1; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - Player player = Main.player[npc.target]; - npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.netMode != 1 && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.localAI[0] += 4f; - } - if (npc.localAI[0] >= (float)Main.rand.Next(1400, 26000)) - { - npc.localAI[0] = 0f; - 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)) - { - 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)); - int projectileType = mod.ProjectileType("SandBlast"); - int damage = 15; - float num941 = (npc.GetGlobalNPC(mod).enraged ? 15f : 6f); - 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; - if (Main.rand.Next(2) == 0) - { - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - } - npc.netUpdate = true; - } - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - int wormCount = 5; - if (npc.life <= (npc.lifeMax * 0.75f) && NPC.CountNPCS(mod.NPCType("DriedSeekerHead")) < wormCount) - { - if (Main.rand.Next(10) == 0 && Main.netMode != 1) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - int seeker = NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("DriedSeekerHead")); - if (Main.netMode == 2 && seeker < 200) - { - NetMessage.SendData(23, -1, -1, null, seeker, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 1f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - 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.Bleeding, 120, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertScourgeBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 16; //70 + npc.npcSlots = 5f; + npc.width = 32; //324 + npc.height = 36; //216 + npc.defense = 8; + npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; + if (CalamityWorld.death) + { + npc.lifeMax = 5100; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); + else + music = MusicID.Boss1; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + Player player = Main.player[npc.target]; + npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.netMode != 1 && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + npc.localAI[0] += (float)Main.rand.Next(4); + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npc.localAI[0] += 4f; + } + if (npc.localAI[0] >= (float)Main.rand.Next(1400, 26000)) + { + npc.localAI[0] = 0f; + 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)) + { + 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)); + int projectileType = mod.ProjectileType("SandBlast"); + int damage = 15; + float num941 = (npc.GetGlobalNPC(mod).enraged ? 15f : 6f); + 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; + if (Main.rand.Next(2) == 0) + { + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + } + npc.netUpdate = true; + } + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + int wormCount = 5; + if (npc.life <= (npc.lifeMax * 0.75f) && NPC.CountNPCS(mod.NPCType("DriedSeekerHead")) < wormCount) + { + if (Main.rand.Next(10) == 0 && Main.netMode != 1) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + int seeker = NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("DriedSeekerHead")); + if (Main.netMode == 2 && seeker < 200) + { + NetMessage.SendData(23, -1, -1, null, seeker, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + } + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 1f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + 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.Bleeding, 120, true); + } + } +} diff --git a/NPCs/DesertScourge/DesertScourgeBodySmall.cs b/NPCs/DesertScourge/DesertScourgeBodySmall.cs index 75d38f2c53..8768f0c523 100644 --- a/NPCs/DesertScourge/DesertScourgeBodySmall.cs +++ b/NPCs/DesertScourge/DesertScourgeBodySmall.cs @@ -1,113 +1,113 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DesertScourgeBodySmall : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 10; //70 - npc.npcSlots = 5f; - npc.width = 32; //324 - npc.height = 36; //216 - npc.defense = 5; - npc.lifeMax = 800; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 350000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.scale = 0.75f; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - Player player = Main.player[npc.target]; - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody"), 0.65f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), 0.65f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 0.65f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertScourgeBodySmall : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 10; //70 + npc.npcSlots = 5f; + npc.width = 32; //324 + npc.height = 36; //216 + npc.defense = 5; + npc.lifeMax = 800; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 350000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.scale = 0.75f; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + Player player = Main.player[npc.target]; + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody"), 0.65f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), 0.65f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 0.65f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 60, true); + } + } +} diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index ffe8d3c5e8..4b9a4d8143 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -1,494 +1,494 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.DesertScourge -{ - [AutoloadBossHead] - public class DesertScourgeHead : ModNPC - { - private bool flies = false; - private float speed = 15f; - private float turnSpeed = 0.15f; - private const int minLength = 30; - private const int maxLength = 31; - private bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 20; //66 - npc.npcSlots = 12f; - npc.width = 32; //324 - npc.height = 80; //216 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; - if (CalamityWorld.death) - { - npc.damage = 50; - npc.lifeMax = 5100; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.knockBackResist = 0f; - npc.boss = true; - npc.value = Item.buyPrice(0, 2, 0, 0); - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - bossBag = mod.ItemType("DesertScourgeBag"); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - else - music = MusicID.Boss1; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override void AI() - { - Player player = Main.player[npc.target]; - npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - float speedMult = expertMode ? 1.5f : 1.45f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - speedMult = 1.6f; - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speedMult = 2f; - } - float life = (float)npc.life; - float totalLife = (float)npc.lifeMax; - speed = (NPC.downedBoss3 ? 16f : 13f) * (speedMult - (life / totalLife)); - turnSpeed = (NPC.downedBoss3 ? 0.16f : 0.13f) * (speedMult - (life / totalLife)); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || player.dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != 1) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeTail"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - } - 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; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 500 : 1000); - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (player.dead) - { - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 1f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = 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 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - 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; - } - else - { - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.75f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - 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 == num188) - { - 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; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - 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; - bool flag21 = false; - if (!flag21) - { - 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; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - 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; - } - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - 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; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SandBlock; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 1f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 1.8f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 300, true); - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.DesertScourge +{ + [AutoloadBossHead] + public class DesertScourgeHead : ModNPC + { + private bool flies = false; + private float speed = 15f; + private float turnSpeed = 0.15f; + private const int minLength = 30; + private const int maxLength = 31; + private bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 20; //66 + npc.npcSlots = 12f; + npc.width = 32; //324 + npc.height = 80; //216 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; + if (CalamityWorld.death) + { + npc.damage = 50; + npc.lifeMax = 5100; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.knockBackResist = 0f; + npc.boss = true; + npc.value = Item.buyPrice(0, 2, 0, 0); + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + bossBag = mod.ItemType("DesertScourgeBag"); + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); + else + music = MusicID.Boss1; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void AI() + { + Player player = Main.player[npc.target]; + npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + float speedMult = expertMode ? 1.5f : 1.45f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + speedMult = 1.6f; + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speedMult = 2f; + } + float life = (float)npc.life; + float totalLife = (float)npc.lifeMax; + speed = (NPC.downedBoss3 ? 16f : 13f) * (speedMult - (life / totalLife)); + turnSpeed = (NPC.downedBoss3 ? 0.16f : 0.13f) * (speedMult - (life / totalLife)); + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || player.dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != 1) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeTail"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + 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; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 500 : 1000); + bool flag95 = true; + if (npc.position.Y > player.position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + if (player.dead) + { + flag94 = false; + npc.velocity.Y = npc.velocity.Y + 1f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 1f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = 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 = player.position.X + (float)(player.width / 2); + float num192 = player.position.Y + (float)(player.height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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; + } + else + { + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.75f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + 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 == num188) + { + 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; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + 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; + bool flag21 = false; + if (!flag21) + { + 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; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + 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; + } + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + 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; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SandBlock; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 1f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 1.8f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 300, true); + } + } +} diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs index 6e9881c8a5..e84ac11b22 100644 --- a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs @@ -1,447 +1,447 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DesertScourgeHeadSmall : ModNPC - { - public bool flies = false; - public float speed = 12.5f; - public float turnSpeed = 0.125f; - public int minLength = NPC.downedBoss3 ? 20 : 12; - public int maxLength = NPC.downedBoss3 ? 21 : 13; - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 18; //150 - npc.npcSlots = 2f; - npc.width = 32; //324 - npc.height = 80; //216 - npc.defense = 0; - npc.lifeMax = 800; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 350000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.scale = 0.75f; - } - - public override void AI() - { - Player player = Main.player[npc.target]; - bool expertMode = Main.expertMode; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || player.dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeBodySmall"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeTailSmall"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - 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; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = CalamityWorld.death ? 300 : 1000; - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (player.dead) - { - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 1f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = 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 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - 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; - } - else - { - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.75f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - 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 == num188) - { - 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; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - 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; - bool flag21 = false; - if (!flag21) - { - 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; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - 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; - } - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - 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; - } - } - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead"), 0.65f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 0.65f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertScourgeHeadSmall : ModNPC + { + public bool flies = false; + public float speed = 12.5f; + public float turnSpeed = 0.125f; + public int minLength = NPC.downedBoss3 ? 20 : 12; + public int maxLength = NPC.downedBoss3 ? 21 : 13; + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 18; //150 + npc.npcSlots = 2f; + npc.width = 32; //324 + npc.height = 80; //216 + npc.defense = 0; + npc.lifeMax = 800; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 350000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.scale = 0.75f; + } + + public override void AI() + { + Player player = Main.player[npc.target]; + bool expertMode = Main.expertMode; + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || player.dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (!TailSpawned) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeBodySmall"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeTailSmall"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + 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; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = CalamityWorld.death ? 300 : 1000; + bool flag95 = true; + if (npc.position.Y > player.position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + if (player.dead) + { + flag94 = false; + npc.velocity.Y = npc.velocity.Y + 1f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 1f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = 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 = player.position.X + (float)(player.width / 2); + float num192 = player.position.Y + (float)(player.height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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; + } + else + { + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.75f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + 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 == num188) + { + 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; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + 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; + bool flag21 = false; + if (!flag21) + { + 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; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + 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; + } + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + 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; + } + } + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead"), 0.65f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 0.65f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + } + } +} diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 9a7c9ce76d..8fadbfbcc0 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -1,140 +1,140 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DesertScourgeTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 12; - npc.npcSlots = 5f; - npc.width = 32; //324 - npc.height = 48; //216 - npc.defense = 12; - npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; - if (CalamityWorld.death) - { - npc.lifeMax = 5100; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - else - music = MusicID.Boss1; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - Player player = Main.player[npc.target]; - npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 1f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - 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.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 90, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertScourgeTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 12; + npc.npcSlots = 5f; + npc.width = 32; //324 + npc.height = 48; //216 + npc.defense = 12; + npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; + if (CalamityWorld.death) + { + npc.lifeMax = 5100; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); + else + music = MusicID.Boss1; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + if (Main.expertMode) + { + npc.scale = 1.15f; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + Player player = Main.player[npc.target]; + npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 1f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + 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.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 90, true); + } + } +} diff --git a/NPCs/DesertScourge/DesertScourgeTailSmall.cs b/NPCs/DesertScourge/DesertScourgeTailSmall.cs index 14cd0a1cea..a39b869931 100644 --- a/NPCs/DesertScourge/DesertScourgeTailSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeTailSmall.cs @@ -1,110 +1,110 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DesertScourgeTailSmall : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Desert Scourge"); - } - - public override void SetDefaults() - { - npc.damage = 8; - npc.npcSlots = 5f; - npc.width = 32; //324 - npc.height = 48; //216 - npc.defense = 8; - npc.lifeMax = 800; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 350000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.scale = 0.75f; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - Player player = Main.player[npc.target]; - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 0.65f); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - 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.7f * bossLifeScale); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 30, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DesertScourgeTailSmall : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + npc.damage = 8; + npc.npcSlots = 5f; + npc.width = 32; //324 + npc.height = 48; //216 + npc.defense = 8; + npc.lifeMax = 800; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 350000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.scale = 0.75f; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + Player player = Main.player[npc.target]; + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 0.65f); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + 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.7f * bossLifeScale); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 30, true); + } + } +} diff --git a/NPCs/DesertScourge/DriedSeekerBody.cs b/NPCs/DesertScourge/DriedSeekerBody.cs index f945abdfbe..2c8da4420c 100644 --- a/NPCs/DesertScourge/DriedSeekerBody.cs +++ b/NPCs/DesertScourge/DriedSeekerBody.cs @@ -1,82 +1,82 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DriedSeekerBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dried Seeker"); - } - - public override void SetDefaults() - { - npc.damage = 8; //70 - npc.npcSlots = 5f; - npc.width = 18; //324 - npc.height = 18; //216 - npc.defense = 4; - npc.lifeMax = 100; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } - npc.knockBackResist = 0f; - npc.aiStyle = 6; - aiType = -1; - animationType = 10; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DriedSeekerBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dried Seeker"); + } + + public override void SetDefaults() + { + npc.damage = 8; //70 + npc.npcSlots = 5f; + npc.width = 18; //324 + npc.height = 18; //216 + npc.defense = 4; + npc.lifeMax = 100; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 50000; + } + npc.knockBackResist = 0f; + npc.aiStyle = 6; + aiType = -1; + animationType = 10; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if (!Main.npc[(int)npc.ai[1]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/DesertScourge/DriedSeekerHead.cs b/NPCs/DesertScourge/DriedSeekerHead.cs index 57b9216e15..06ef27c8b8 100644 --- a/NPCs/DesertScourge/DriedSeekerHead.cs +++ b/NPCs/DesertScourge/DriedSeekerHead.cs @@ -1,116 +1,116 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DriedSeekerHead : ModNPC - { - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dried Seeker"); - } - - public override void SetDefaults() - { - npc.damage = 14; //150 - npc.npcSlots = 5f; - npc.width = 18; //324 - npc.height = 18; //216 - npc.defense = 0; - npc.lifeMax = 100; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } - npc.aiStyle = 6; - aiType = -1; - animationType = 10; - npc.knockBackResist = 0f; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - } - - public override void AI() - { - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < 4; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < 3) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DriedSeekerBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DriedSeekerTail"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - if (Main.player[npc.target].dead) - { - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 1f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override bool PreNPCLoot() - { - return false; - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DriedSeekerHead : ModNPC + { + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dried Seeker"); + } + + public override void SetDefaults() + { + npc.damage = 14; //150 + npc.npcSlots = 5f; + npc.width = 18; //324 + npc.height = 18; //216 + npc.defense = 0; + npc.lifeMax = 100; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 50000; + } + npc.aiStyle = 6; + aiType = -1; + animationType = 10; + npc.knockBackResist = 0f; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + } + + public override void AI() + { + if (!TailSpawned) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < 4; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < 3) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DriedSeekerBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DriedSeekerTail"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + if (Main.player[npc.target].dead) + { + npc.velocity.Y = npc.velocity.Y + 1f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 1f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override bool PreNPCLoot() + { + return false; + } + } +} diff --git a/NPCs/DesertScourge/DriedSeekerTail.cs b/NPCs/DesertScourge/DriedSeekerTail.cs index 69cee591e9..4c26d39f14 100644 --- a/NPCs/DesertScourge/DriedSeekerTail.cs +++ b/NPCs/DesertScourge/DriedSeekerTail.cs @@ -1,82 +1,82 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.DesertScourge -{ - public class DriedSeekerTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dried Seeker"); - } - - public override void SetDefaults() - { - npc.damage = 6; - npc.npcSlots = 5f; - npc.width = 18; //324 - npc.height = 18; //216 - npc.defense = 6; - npc.lifeMax = 100; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } - npc.knockBackResist = 0f; - npc.aiStyle = 6; - aiType = -1; - animationType = 10; - npc.behindTiles = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override bool CheckActive() - { - return false; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.DesertScourge +{ + public class DriedSeekerTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dried Seeker"); + } + + public override void SetDefaults() + { + npc.damage = 6; + npc.npcSlots = 5f; + npc.width = 18; //324 + npc.height = 18; //216 + npc.defense = 6; + npc.lifeMax = 100; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 50000; + } + npc.knockBackResist = 0f; + npc.aiStyle = 6; + aiType = -1; + animationType = 10; + npc.behindTiles = true; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if (!Main.npc[(int)npc.ai[1]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override bool CheckActive() + { + return false; + } + } +} diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index ad84326d6c..81065303d5 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -1,691 +1,691 @@ -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; -using Terraria.GameContent.Events; -using CalamityMod.World; - -namespace CalamityMod.NPCs.GreatSandShark -{ - public class GreatSandShark : ModNPC - { - private bool resetAI = false; - - 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.width = 300; - npc.height = 120; - npc.defense = 60; - npc.lifeMax = CalamityWorld.revenge ? 11000 : 8000; - if (CalamityWorld.death) - { - npc.lifeMax = 16000; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 10, 0, 0); - 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("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; - banner = npc.type; - bannerItem = mod.ItemType("GreatSandSharkBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(resetAI); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - resetAI = reader.ReadBoolean(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); - } - - 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; - } - } - } - - 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) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - 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 num621 = 0; num621 < 50; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.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 < 100; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 3f); - 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, 5, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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) - { - 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); - } - } -} \ No newline at end of file +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; +using Terraria.GameContent.Events; +using CalamityMod.World; + +namespace CalamityMod.NPCs.GreatSandShark +{ + public class GreatSandShark : ModNPC + { + private bool resetAI = false; + + 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.width = 300; + npc.height = 120; + npc.defense = 60; + npc.lifeMax = CalamityWorld.revenge ? 11000 : 8000; + if (CalamityWorld.death) + { + npc.lifeMax = 16000; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 10, 0, 0); + 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("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; + banner = npc.type; + bannerItem = mod.ItemType("GreatSandSharkBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(resetAI); + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); + writer.Write(npc.localAI[3]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + resetAI = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); + npc.localAI[3] = reader.ReadSingle(); + } + + 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; + } + } + } + + 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) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + 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 num621 = 0; num621 < 50; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.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 < 100; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 3f); + 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, 5, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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) + { + 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); + } + } +} diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 97083a64c3..686e6aae43 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -1,120 +1,120 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.HiveMind -{ - public class DankCreeper : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dank Creeper"); - } - - public override void SetDefaults() - { - npc.damage = 24; - npc.width = 74; //324 - npc.height = 74; //216 - npc.defense = 5; - npc.lifeMax = 45; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 10000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0.3f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - npc.TargetClosest(true); - float num1372 = revenge ? 12f : 11f; - 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.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 13, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 13, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore3"), 1f); - } - } - - public override void NPCLoot() - { - if (Main.expertMode && Main.netMode != 1) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("ShadeNimbusHostile"), 14, 0f, Main.myPlayer, 0f, 0f); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.HiveMind +{ + public class DankCreeper : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dank Creeper"); + } + + public override void SetDefaults() + { + npc.damage = 24; + npc.width = 74; //324 + npc.height = 74; //216 + npc.defense = 5; + npc.lifeMax = 45; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 10000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0.3f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + npc.TargetClosest(true); + float num1372 = revenge ? 12f : 11f; + 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.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 13, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 13, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/DankCreeperGore3"), 1f); + } + } + + public override void NPCLoot() + { + if (Main.expertMode && Main.netMode != 1) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("ShadeNimbusHostile"), 14, 0f, Main.myPlayer, 0f, 0f); + } + } + } +} diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 1e52fcec50..301252d169 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -1,142 +1,142 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.HiveMind -{ - public class DarkHeart : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Heart"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 10; - npc.width = 32; //324 - npc.height = 32; //216 - npc.defense = 7; - npc.lifeMax = 65; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 12000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0.4f; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath21; - } - - 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() - { - bool revenge = CalamityWorld.revenge; - npc.TargetClosest(true); - float num1164 = revenge ? 4.5f : 4f; - float num1165 = revenge ? 0.8f : 0.75f; - Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); - float num1166 = Main.player[npc.target].Center.X - vector133.X; - float num1167 = Main.player[npc.target].Center.Y - vector133.Y - 300f; - float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); - if (num1168 < 20f) - { - num1166 = npc.velocity.X; - num1167 = npc.velocity.Y; - } - else - { - num1168 = num1164 / num1168; - num1166 *= num1168; - num1167 *= num1168; - } - if (npc.velocity.X < num1166) - { - npc.velocity.X = npc.velocity.X + num1165; - if (npc.velocity.X < 0f && num1166 > 0f) - { - npc.velocity.X = npc.velocity.X + num1165 * 2f; - } - } - else if (npc.velocity.X > num1166) - { - npc.velocity.X = npc.velocity.X - num1165; - if (npc.velocity.X > 0f && num1166 < 0f) - { - npc.velocity.X = npc.velocity.X - num1165 * 2f; - } - } - if (npc.velocity.Y < num1167) - { - npc.velocity.Y = npc.velocity.Y + num1165; - if (npc.velocity.Y < 0f && num1167 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1165 * 2f; - } - } - else if (npc.velocity.Y > num1167) - { - npc.velocity.Y = npc.velocity.Y - num1165; - if (npc.velocity.Y > 0f && num1167 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1165 * 2f; - } - } - if (npc.position.X + (float)npc.width > Main.player[npc.target].position.X && npc.position.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && Main.netMode != 1) - { - npc.ai[0] += 4f; - if (npc.ai[0] > 16f) - { - npc.ai[0] = 0f; - int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); - int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); - int num184 = 18; - if (Main.expertMode) - { - num184 = 14; - } - Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, mod.ProjectileType("ShaderainHostile"), num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.HiveMind +{ + public class DarkHeart : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Heart"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 10; + npc.width = 32; //324 + npc.height = 32; //216 + npc.defense = 7; + npc.lifeMax = 65; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 12000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0.4f; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath21; + } + + 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() + { + bool revenge = CalamityWorld.revenge; + npc.TargetClosest(true); + float num1164 = revenge ? 4.5f : 4f; + float num1165 = revenge ? 0.8f : 0.75f; + Vector2 vector133 = new Vector2(npc.Center.X, npc.Center.Y); + float num1166 = Main.player[npc.target].Center.X - vector133.X; + float num1167 = Main.player[npc.target].Center.Y - vector133.Y - 300f; + float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); + if (num1168 < 20f) + { + num1166 = npc.velocity.X; + num1167 = npc.velocity.Y; + } + else + { + num1168 = num1164 / num1168; + num1166 *= num1168; + num1167 *= num1168; + } + if (npc.velocity.X < num1166) + { + npc.velocity.X = npc.velocity.X + num1165; + if (npc.velocity.X < 0f && num1166 > 0f) + { + npc.velocity.X = npc.velocity.X + num1165 * 2f; + } + } + else if (npc.velocity.X > num1166) + { + npc.velocity.X = npc.velocity.X - num1165; + if (npc.velocity.X > 0f && num1166 < 0f) + { + npc.velocity.X = npc.velocity.X - num1165 * 2f; + } + } + if (npc.velocity.Y < num1167) + { + npc.velocity.Y = npc.velocity.Y + num1165; + if (npc.velocity.Y < 0f && num1167 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1165 * 2f; + } + } + else if (npc.velocity.Y > num1167) + { + npc.velocity.Y = npc.velocity.Y - num1165; + if (npc.velocity.Y > 0f && num1167 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1165 * 2f; + } + } + if (npc.position.X + (float)npc.width > Main.player[npc.target].position.X && npc.position.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && Main.netMode != 1) + { + npc.ai[0] += 4f; + if (npc.ai[0] > 16f) + { + npc.ai[0] = 0f; + int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); + int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); + int num184 = 18; + if (Main.expertMode) + { + num184 = 14; + } + Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, mod.ProjectileType("ShaderainHostile"), num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 9d19e9e88f..86cb612808 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -1,222 +1,222 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.HiveMind -{ - public class HiveBlob : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Blob"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.1f; - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 25; //324 - npc.height = 25; //216 - npc.lifeMax = 75; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 13000; - } - aiType = -1; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.hiveMind < 0 || !Main.npc[CalamityGlobalNPC.hiveMind].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - int num750 = CalamityGlobalNPC.hiveMind; - if (npc.ai[3] > 0f) - { - num750 = (int)npc.ai[3] - 1; - } - if (Main.netMode != 1) - { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(120, 480); - npc.ai[0] = (float)Main.rand.Next(-100, 101); - npc.ai[1] = (float)Main.rand.Next(-100, 101); - npc.netUpdate = true; - } - } - npc.TargetClosest(true); - float num751 = 0.01f; - float num752 = 400f; - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.5) - { - num752 += 60f; - } - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.15) - { - num752 += 120f; - } - if (expertMode) - { - float num753 = 1f - (float)npc.life / (float)npc.lifeMax; - num752 += num753 * 100f; - num751 += 0.02f; - } - if (revenge) - { - num751 += 0.1f; - } - if (!Main.npc[num750].active || CalamityGlobalNPC.hiveMind < 0) - { - npc.active = false; - return; - } - Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; - float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); - float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); - float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); - Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + npc.ai[0]; - float num757 = num755 + npc.ai[1]; - float num758 = num756 - vector93.X; - float num759 = num757 - vector93.Y; - float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); - num760 = num752 / num760; - num758 *= num760; - num759 *= num760; - if (npc.position.X < num754 + num758) - { - npc.velocity.X = npc.velocity.X + num751; - if (npc.velocity.X < 0f && num758 > 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - else if (npc.position.X > num754 + num758) - { - npc.velocity.X = npc.velocity.X - num751; - if (npc.velocity.X > 0f && num758 < 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (npc.position.Y < num755 + num759) - { - npc.velocity.Y = npc.velocity.Y + num751; - if (npc.velocity.Y < 0f && num759 > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - else if (npc.position.Y > num755 + num759) - { - npc.velocity.Y = npc.velocity.Y - num751; - if (npc.velocity.Y > 0f && num759 < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - if (npc.velocity.X > 4f) - { - npc.velocity.X = 4f; - } - if (npc.velocity.X < -4f) - { - npc.velocity.X = -4f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - if (Main.netMode != 1) - { - 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] = 180f; - } - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 600f) - { - npc.localAI[1] = 0f; - 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 num941 = revenge ? 6f : 5f; //speed - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num941 = 7f; - } - 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 num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num945 = expertMode ? 12 : 15; - int num946 = mod.ProjectileType("VileClot"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - 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 < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.HiveMind +{ + public class HiveBlob : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Blob"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.1f; + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 25; //324 + npc.height = 25; //216 + npc.lifeMax = 75; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 13000; + } + aiType = -1; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.hiveMind < 0 || !Main.npc[CalamityGlobalNPC.hiveMind].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + int num750 = CalamityGlobalNPC.hiveMind; + if (npc.ai[3] > 0f) + { + num750 = (int)npc.ai[3] - 1; + } + if (Main.netMode != 1) + { + npc.localAI[0] -= 1f; + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = (float)Main.rand.Next(120, 480); + npc.ai[0] = (float)Main.rand.Next(-100, 101); + npc.ai[1] = (float)Main.rand.Next(-100, 101); + npc.netUpdate = true; + } + } + npc.TargetClosest(true); + float num751 = 0.01f; + float num752 = 400f; + if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.5) + { + num752 += 60f; + } + if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.15) + { + num752 += 120f; + } + if (expertMode) + { + float num753 = 1f - (float)npc.life / (float)npc.lifeMax; + num752 += num753 * 100f; + num751 += 0.02f; + } + if (revenge) + { + num751 += 0.1f; + } + if (!Main.npc[num750].active || CalamityGlobalNPC.hiveMind < 0) + { + npc.active = false; + return; + } + Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); + float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; + float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; + float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); + float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); + float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); + Vector2 vector93 = new Vector2(num754, num755); + float num756 = num754 + npc.ai[0]; + float num757 = num755 + npc.ai[1]; + float num758 = num756 - vector93.X; + float num759 = num757 - vector93.Y; + float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); + num760 = num752 / num760; + num758 *= num760; + num759 *= num760; + if (npc.position.X < num754 + num758) + { + npc.velocity.X = npc.velocity.X + num751; + if (npc.velocity.X < 0f && num758 > 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + else if (npc.position.X > num754 + num758) + { + npc.velocity.X = npc.velocity.X - num751; + if (npc.velocity.X > 0f && num758 < 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (npc.position.Y < num755 + num759) + { + npc.velocity.Y = npc.velocity.Y + num751; + if (npc.velocity.Y < 0f && num759 > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + else if (npc.position.Y > num755 + num759) + { + npc.velocity.Y = npc.velocity.Y - num751; + if (npc.velocity.Y > 0f && num759 < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + if (npc.velocity.X > 4f) + { + npc.velocity.X = 4f; + } + if (npc.velocity.X < -4f) + { + npc.velocity.X = -4f; + } + if (npc.velocity.Y > 4f) + { + npc.velocity.Y = 4f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + if (Main.netMode != 1) + { + 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] = 180f; + } + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 600f) + { + npc.localAI[1] = 0f; + 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 num941 = revenge ? 6f : 5f; //speed + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num941 = 7f; + } + 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 num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + int num945 = expertMode ? 12 : 15; + int num946 = mod.ProjectileType("VileClot"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.1f; + 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 < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index 43f743d604..7aeda09fed 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -1,222 +1,222 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.HiveMind -{ - public class HiveBlob2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Blob"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.1f; - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 25; //324 - npc.height = 25; //216 - npc.lifeMax = 75; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 13000; - } - aiType = -1; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.hiveMind < 0 || !Main.npc[CalamityGlobalNPC.hiveMind].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - int num750 = CalamityGlobalNPC.hiveMind; - if (npc.ai[3] > 0f) - { - num750 = (int)npc.ai[3] - 1; - } - if (Main.netMode != 1) - { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(120, 480); - npc.ai[0] = (float)Main.rand.Next(-100, 101); - npc.ai[1] = (float)Main.rand.Next(-100, 101); - npc.netUpdate = true; - } - } - npc.TargetClosest(true); - float num751 = 0.01f; - float num752 = 300f; - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.25) - { - num752 += 30f; - } - if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.1) - { - num752 += 60f; - } - if (expertMode) - { - float num753 = 1f - (float)npc.life / (float)npc.lifeMax; - num752 += num753 * 100f; - num751 += 0.02f; - } - if (revenge) - { - num751 += 0.1f; - } - if (!Main.npc[num750].active) - { - npc.active = false; - return; - } - Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; - float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); - float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); - float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); - Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + npc.ai[0]; - float num757 = num755 + npc.ai[1]; - float num758 = num756 - vector93.X; - float num759 = num757 - vector93.Y; - float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); - num760 = num752 / num760; - num758 *= num760; - num759 *= num760; - if (npc.position.X < num754 + num758) - { - npc.velocity.X = npc.velocity.X + num751; - if (npc.velocity.X < 0f && num758 > 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - else if (npc.position.X > num754 + num758) - { - npc.velocity.X = npc.velocity.X - num751; - if (npc.velocity.X > 0f && num758 < 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (npc.position.Y < num755 + num759) - { - npc.velocity.Y = npc.velocity.Y + num751; - if (npc.velocity.Y < 0f && num759 > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - else if (npc.position.Y > num755 + num759) - { - npc.velocity.Y = npc.velocity.Y - num751; - if (npc.velocity.Y > 0f && num759 < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - if (npc.velocity.X > 4f) - { - npc.velocity.X = 4f; - } - if (npc.velocity.X < -4f) - { - npc.velocity.X = -4f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - if (Main.netMode != 1) - { - 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] = 180f; - } - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 600f) - { - npc.localAI[1] = 0f; - 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 num941 = revenge ? 6f : 5f; //speed - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num941 = 7f; - } - 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 num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num945 = expertMode ? 12 : 15; - int num946 = mod.ProjectileType("VileClot"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - 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 < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.HiveMind +{ + public class HiveBlob2 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Blob"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.1f; + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 25; //324 + npc.height = 25; //216 + npc.lifeMax = 75; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 13000; + } + aiType = -1; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.hiveMind < 0 || !Main.npc[CalamityGlobalNPC.hiveMind].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + int num750 = CalamityGlobalNPC.hiveMind; + if (npc.ai[3] > 0f) + { + num750 = (int)npc.ai[3] - 1; + } + if (Main.netMode != 1) + { + npc.localAI[0] -= 1f; + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = (float)Main.rand.Next(120, 480); + npc.ai[0] = (float)Main.rand.Next(-100, 101); + npc.ai[1] = (float)Main.rand.Next(-100, 101); + npc.netUpdate = true; + } + } + npc.TargetClosest(true); + float num751 = 0.01f; + float num752 = 300f; + if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.25) + { + num752 += 30f; + } + if ((double)Main.npc[CalamityGlobalNPC.hiveMind].life < (double)Main.npc[CalamityGlobalNPC.hiveMind].lifeMax * 0.1) + { + num752 += 60f; + } + if (expertMode) + { + float num753 = 1f - (float)npc.life / (float)npc.lifeMax; + num752 += num753 * 100f; + num751 += 0.02f; + } + if (revenge) + { + num751 += 0.1f; + } + if (!Main.npc[num750].active) + { + npc.active = false; + return; + } + Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); + float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; + float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; + float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); + float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); + float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); + Vector2 vector93 = new Vector2(num754, num755); + float num756 = num754 + npc.ai[0]; + float num757 = num755 + npc.ai[1]; + float num758 = num756 - vector93.X; + float num759 = num757 - vector93.Y; + float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); + num760 = num752 / num760; + num758 *= num760; + num759 *= num760; + if (npc.position.X < num754 + num758) + { + npc.velocity.X = npc.velocity.X + num751; + if (npc.velocity.X < 0f && num758 > 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + else if (npc.position.X > num754 + num758) + { + npc.velocity.X = npc.velocity.X - num751; + if (npc.velocity.X > 0f && num758 < 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (npc.position.Y < num755 + num759) + { + npc.velocity.Y = npc.velocity.Y + num751; + if (npc.velocity.Y < 0f && num759 > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + else if (npc.position.Y > num755 + num759) + { + npc.velocity.Y = npc.velocity.Y - num751; + if (npc.velocity.Y > 0f && num759 < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + if (npc.velocity.X > 4f) + { + npc.velocity.X = 4f; + } + if (npc.velocity.X < -4f) + { + npc.velocity.X = -4f; + } + if (npc.velocity.Y > 4f) + { + npc.velocity.Y = 4f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + if (Main.netMode != 1) + { + 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] = 180f; + } + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 600f) + { + npc.localAI[1] = 0f; + 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 num941 = revenge ? 6f : 5f; //speed + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num941 = 7f; + } + 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 num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + int num945 = expertMode ? 12 : 15; + int num946 = mod.ProjectileType("VileClot"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.1f; + 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 < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/HiveMind/HiveCyst.cs b/NPCs/HiveMind/HiveCyst.cs index 829b1a0ddd..75f7ea757e 100644 --- a/NPCs/HiveMind/HiveCyst.cs +++ b/NPCs/HiveMind/HiveCyst.cs @@ -1,80 +1,80 @@ -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.HiveMind -{ - public class HiveCyst : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Cyst"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 0f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 0; - npc.lifeMax = 1000; - npc.knockBackResist = 0f; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.rarity = 2; - } - - 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 float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || NPC.AnyNPCs(mod.NPCType("HiveCyst")) || NPC.AnyNPCs(mod.NPCType("HiveMind")) || NPC.AnyNPCs(mod.NPCType("HiveMindP2"))) - { - return 0f; - } - return SpawnCondition.Corruption.Chance * (Main.hardMode ? 0.05f : 0.5f); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 2000; - npc.damage = 0; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - if (Main.netMode != 1 && NPC.CountNPCS(mod.NPCType("HiveMind")) < 1) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("HiveMind")); - } - } - } - } -} \ No newline at end of file +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.HiveMind +{ + public class HiveCyst : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Cyst"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 0f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 0; + npc.lifeMax = 1000; + npc.knockBackResist = 0f; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit1; + npc.rarity = 2; + } + + 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 float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || NPC.AnyNPCs(mod.NPCType("HiveCyst")) || NPC.AnyNPCs(mod.NPCType("HiveMind")) || NPC.AnyNPCs(mod.NPCType("HiveMindP2"))) + { + return 0f; + } + return SpawnCondition.Corruption.Chance * (Main.hardMode ? 0.05f : 0.5f); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 2000; + npc.damage = 0; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + if (Main.netMode != 1 && NPC.CountNPCS(mod.NPCType("HiveMind")) < 1) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("HiveMind")); + } + } + } + } +} diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 3b62578eed..ca6a5f5821 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1,346 +1,346 @@ -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.World; - -namespace CalamityMod.NPCs.HiveMind -{ - [AutoloadBossHead] - public class HiveMind : ModNPC - { - int burrowTimer = 720; - int oldDamage = 10; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Hive Mind"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 5f; - npc.damage = 10; - npc.width = 150; //324 - npc.height = 120; //216 - npc.defense = 10; - npc.lifeMax = CalamityWorld.revenge ? 1800 : 1200; - if (CalamityWorld.death) - { - npc.lifeMax = 3300; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 400000 : 350000; - } - 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; - npc.knockBackResist = 0f; - npc.boss = true; - npc.value = 0f; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); - else - music = MusicID.Boss2; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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() - { - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - if (!player.active || player.dead) - { +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.World; + +namespace CalamityMod.NPCs.HiveMind +{ + [AutoloadBossHead] + public class HiveMind : ModNPC + { + int burrowTimer = 720; + int oldDamage = 10; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Hive Mind"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 5f; + npc.damage = 10; + npc.width = 150; //324 + npc.height = 120; //216 + npc.defense = 10; + npc.lifeMax = CalamityWorld.revenge ? 1800 : 1200; + if (CalamityWorld.death) + { + npc.lifeMax = 3300; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 400000 : 350000; + } + 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; + npc.knockBackResist = 0f; + npc.boss = true; + npc.value = 0f; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); + else + music = MusicID.Boss2; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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() + { + npc.TargetClosest(true); + Player player = Main.player[npc.target]; + if (!player.active || player.dead) + { if (npc.timeLeft > 60) - npc.timeLeft = 60; - if (npc.localAI[3] < 120f) - { - float[] aiArray = npc.localAI; - int number = 3; - float num244 = aiArray[number]; - aiArray[number] = num244 + 1f; - } - if (npc.localAI[3] > 60f) - { - npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.5f; - npc.noGravity = true; - npc.noTileCollide = true; - if (burrowTimer > 30) - burrowTimer = 30; - } - return; - } - if (npc.localAI[3] > 0f) - { - float[] aiArray = npc.localAI; - int number = 3; - float num244 = aiArray[number]; - aiArray[number] = num244 - 1f; - return; - } - npc.noGravity = false; - npc.noTileCollide = false; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - CalamityGlobalNPC.hiveMind = npc.whoAmI; - if (Main.netMode != 1) - { - if (revenge) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 600f) - { - npc.localAI[1] = 0f; - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveBlob"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - for (int num723 = 0; num723 < 5; num723++) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveBlob"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } - bool flag100 = false; - int num568 = 0; - if (expertMode) - { - for (int num569 = 0; num569 < 200; num569++) - { - if (Main.npc[num569].active && Main.npc[num569].type == mod.NPCType("DankCreeper")) - { - flag100 = true; - num568++; - } - } - npc.defense += num568 * 25; - } - if (expertMode) - { - if (!flag100) - { - npc.defense = 10; - } - } - if (npc.ai[3] == 0f && npc.life > 0) - { - npc.ai[3] = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.25); - if ((float)(npc.life + num660) < npc.ai[3]) - { - npc.ai[3] = (float)npc.life; - int num661 = Main.rand.Next(3, 6); - 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("HiveBlob"); - if (Main.rand.Next(3) == 0 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num663 = mod.NPCType("DankCreeper"); - } - 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; - if (Main.netMode == 2 && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - return; - } - } - } - burrowTimer--; - if (burrowTimer < -120) - { - burrowTimer = 600; - npc.scale = 1f; - npc.alpha = 0; - npc.dontTakeDamage = false; - npc.damage = oldDamage; - } - else if (burrowTimer < -60) - { - npc.scale += 0.0165f; - npc.alpha -= 4; - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 2.5f * npc.scale); - Main.dust[num622].velocity *= 2f; - 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 i = 0; i < 2; i++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 3.5f * npc.scale); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 3.5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 2.5f * npc.scale); - Main.dust[num624].velocity *= 1f; - } - } - else if (burrowTimer == -60) - { - npc.scale = 0.01f; - if (Main.netMode != 1) - { - npc.Center = player.Center; - npc.position.Y = player.position.Y - npc.height; - int tilePosX = (int)npc.Center.X / 16; - int tilePosY = (int)(npc.position.Y + npc.height) / 16 + 1; - if (Main.tile[tilePosX, tilePosY] == null) - Main.tile[tilePosX, tilePosY] = new Tile(); - while (!(Main.tile[tilePosX, tilePosY].nactive() && Main.tileSolid[(int)Main.tile[tilePosX, tilePosY].type])) - { - tilePosY++; - npc.position.Y += 16; - if (Main.tile[tilePosX, tilePosY] == null) - Main.tile[tilePosX, tilePosY] = new Tile(); - } - } - npc.netUpdate = true; - } - else if (burrowTimer < 0) - { - npc.scale -= 0.0165f; - npc.alpha += 4; - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 2.5f * npc.scale); - Main.dust[num622].velocity *= 2f; - 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 i = 0; i < 2; i++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 3.5f * npc.scale); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 3.5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 2.5f * npc.scale); - Main.dust[num624].velocity *= 1f; - } - } - else if (burrowTimer == 0) - { - if (!player.active || player.dead) - { - burrowTimer = 30; - } - else - { - npc.dontTakeDamage = true; - oldDamage = npc.damage; - npc.damage = 0; - } - } - } - - 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 HitEffect(int hitDirection, double damage) - { - if (npc.life > 0) - { - if (NPC.CountNPCS(NPCID.EaterofSouls) < 3 && NPC.CountNPCS(NPCID.DevourerHead) < 1) - { - if (Main.rand.Next(60) == 0 && Main.netMode != 1) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, NPCID.EaterofSouls); - } - if (Main.rand.Next(150) == 0 && Main.netMode != 1) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, NPCID.DevourerHead); - } - } - int num285 = 0; - while ((double)num285 < damage / (double)npc.lifeMax * 100.0) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, (float)hitDirection, -1f, 0, default(Color), 1f); - num285++; - } - } - else - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore4"), 1f); - if (Main.netMode != 1) - { - if (NPC.CountNPCS(mod.NPCType("HiveMindP2")) < 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveMindP2"), npc.whoAmI, 0f, 0f, 0f, 0f, npc.target); - Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); - } - } - } - } - - public override bool CanHitPlayer (Player target, ref int cooldownSlot) - { - return npc.scale == 1f; //no damage when shrunk - } - - public override bool? DrawHealthBar (byte hbPosition, ref float scale, ref Vector2 position) - { - return npc.scale == 1f; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - } -} \ No newline at end of file + npc.timeLeft = 60; + if (npc.localAI[3] < 120f) + { + float[] aiArray = npc.localAI; + int number = 3; + float num244 = aiArray[number]; + aiArray[number] = num244 + 1f; + } + if (npc.localAI[3] > 60f) + { + npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.5f; + npc.noGravity = true; + npc.noTileCollide = true; + if (burrowTimer > 30) + burrowTimer = 30; + } + return; + } + if (npc.localAI[3] > 0f) + { + float[] aiArray = npc.localAI; + int number = 3; + float num244 = aiArray[number]; + aiArray[number] = num244 - 1f; + return; + } + npc.noGravity = false; + npc.noTileCollide = false; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + CalamityGlobalNPC.hiveMind = npc.whoAmI; + if (Main.netMode != 1) + { + if (revenge) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 600f) + { + npc.localAI[1] = 0f; + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveBlob"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + for (int num723 = 0; num723 < 5; num723++) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveBlob"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } + bool flag100 = false; + int num568 = 0; + if (expertMode) + { + for (int num569 = 0; num569 < 200; num569++) + { + if (Main.npc[num569].active && Main.npc[num569].type == mod.NPCType("DankCreeper")) + { + flag100 = true; + num568++; + } + } + npc.defense += num568 * 25; + } + if (expertMode) + { + if (!flag100) + { + npc.defense = 10; + } + } + if (npc.ai[3] == 0f && npc.life > 0) + { + npc.ai[3] = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.25); + if ((float)(npc.life + num660) < npc.ai[3]) + { + npc.ai[3] = (float)npc.life; + int num661 = Main.rand.Next(3, 6); + 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("HiveBlob"); + if (Main.rand.Next(3) == 0 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num663 = mod.NPCType("DankCreeper"); + } + 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; + if (Main.netMode == 2 && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + return; + } + } + } + burrowTimer--; + if (burrowTimer < -120) + { + burrowTimer = 600; + npc.scale = 1f; + npc.alpha = 0; + npc.dontTakeDamage = false; + npc.damage = oldDamage; + } + else if (burrowTimer < -60) + { + npc.scale += 0.0165f; + npc.alpha -= 4; + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 2.5f * npc.scale); + Main.dust[num622].velocity *= 2f; + 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 i = 0; i < 2; i++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 3.5f * npc.scale); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 3.5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 2.5f * npc.scale); + Main.dust[num624].velocity *= 1f; + } + } + else if (burrowTimer == -60) + { + npc.scale = 0.01f; + if (Main.netMode != 1) + { + npc.Center = player.Center; + npc.position.Y = player.position.Y - npc.height; + int tilePosX = (int)npc.Center.X / 16; + int tilePosY = (int)(npc.position.Y + npc.height) / 16 + 1; + if (Main.tile[tilePosX, tilePosY] == null) + Main.tile[tilePosX, tilePosY] = new Tile(); + while (!(Main.tile[tilePosX, tilePosY].nactive() && Main.tileSolid[(int)Main.tile[tilePosX, tilePosY].type])) + { + tilePosY++; + npc.position.Y += 16; + if (Main.tile[tilePosX, tilePosY] == null) + Main.tile[tilePosX, tilePosY] = new Tile(); + } + } + npc.netUpdate = true; + } + else if (burrowTimer < 0) + { + npc.scale -= 0.0165f; + npc.alpha += 4; + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 2.5f * npc.scale); + Main.dust[num622].velocity *= 2f; + 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 i = 0; i < 2; i++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 3.5f * npc.scale); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 3.5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.Center.Y), npc.width, npc.height / 2, 14, 0f, -3f, 100, default(Color), 2.5f * npc.scale); + Main.dust[num624].velocity *= 1f; + } + } + else if (burrowTimer == 0) + { + if (!player.active || player.dead) + { + burrowTimer = 30; + } + else + { + npc.dontTakeDamage = true; + oldDamage = npc.damage; + npc.damage = 0; + } + } + } + + 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 HitEffect(int hitDirection, double damage) + { + if (npc.life > 0) + { + if (NPC.CountNPCS(NPCID.EaterofSouls) < 3 && NPC.CountNPCS(NPCID.DevourerHead) < 1) + { + if (Main.rand.Next(60) == 0 && Main.netMode != 1) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, NPCID.EaterofSouls); + } + if (Main.rand.Next(150) == 0 && Main.netMode != 1) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, NPCID.DevourerHead); + } + } + int num285 = 0; + while ((double)num285 < damage / (double)npc.lifeMax * 100.0) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, (float)hitDirection, -1f, 0, default(Color), 1f); + num285++; + } + } + else + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindGore4"), 1f); + if (Main.netMode != 1) + { + if (NPC.CountNPCS(mod.NPCType("HiveMindP2")) < 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("HiveMindP2"), npc.whoAmI, 0f, 0f, 0f, 0f, npc.target); + Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); + } + } + } + } + + public override bool CanHitPlayer (Player target, ref int cooldownSlot) + { + return npc.scale == 1f; //no damage when shrunk + } + + public override bool? DrawHealthBar (byte hbPosition, ref float scale, ref Vector2 position) + { + return npc.scale == 1f; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + } +} diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index 94c6f7a838..3eb56f68ab 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -1,735 +1,735 @@ -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.World; - -/* states: - * 0 = slow drift - * 1 = reelback and teleport after spawn enemy - * 2 = reelback for spin lunge + death legacy - * 3 = spin lunge - * 4 = semicircle spawn arc - * 5 = raindash - * 6 = deceleration - */ - -namespace CalamityMod.NPCs.HiveMind -{ - [AutoloadBossHead] - public class HiveMindP2 : ModNPC - { - //this block of values can be modified in SetDefaults() based on difficulty mode or something - int minimumDriftTime = 300; - int teleportRadius = 300; - int decelerationTime = 30; - int reelbackFade = 3; //divide 255 by this for duration of reelback in ticks - float arcTime = 45f; //ticks needed to complete movement for spawn and rain attacks (DEATH ONLY) - float driftSpeed = 2f; //default speed when slowly floating at player - float driftBoost = 1f; //max speed added as health decreases - int lungeDelay = 90; //# of ticks long hive mind spends sliding to a stop before lunging - int lungeTime = 30; - int lungeFade = 15; //divide 255 by this for duration of hive mind spin before slowing for lunge - double lungeRots = 0.2; //number of revolutions made while spinning/fading in for lunge - bool dashStarted = false; - int phase2timer = 360; - int rotationDirection; - double rotation; - double rotationIncrement; - int state = 0; - int previousState = 0; - int nextState = 0; - int reelCount = 0; - int oldDamage = 40; - Vector2 deceleration; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Hive Mind"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 5f; - npc.damage = 40; - npc.width = 150; //324 - npc.height = 120; //216 - npc.defense = 5; - npc.lifeMax = CalamityWorld.revenge ? 7560 : 5800; - if (CalamityWorld.death) - { - npc.lifeMax = 12500; - } - if (CalamityWorld.bossRushActive) - { - 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; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 6, 0, 0); - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); - else - music = MusicID.Boss2; - bossBag = mod.ItemType("HiveMindBag"); - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; - if (Main.expertMode) - { - minimumDriftTime = 120; - reelbackFade = 5; - } - if (CalamityWorld.revenge) - { - lungeRots = 0.3; - minimumDriftTime = 90; - reelbackFade = 6; - lungeTime = 25; - driftSpeed = 3f; - driftBoost = 2f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - lungeRots = 0.4; - minimumDriftTime = 60; - reelbackFade = 7; - lungeTime = 20; - driftSpeed = 4f; - driftBoost = 1f; - } - phase2timer = minimumDriftTime; - rotationIncrement = 0.0246399424 * lungeRots * lungeFade; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(state); - writer.Write(nextState); - writer.Write(phase2timer); - writer.Write(dashStarted); - writer.Write(rotationDirection); - writer.Write(rotation); - writer.Write(previousState); - writer.Write(reelCount); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - state = reader.ReadInt32(); - nextState = reader.ReadInt32(); - phase2timer = reader.ReadInt32(); - dashStarted = reader.ReadBoolean(); - rotationDirection = reader.ReadInt32(); - rotation = reader.ReadDouble(); - previousState = reader.ReadInt32(); - reelCount = reader.ReadInt32(); - } - - 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 PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = lightColor; - color24 = npc.GetAlpha(color24); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = mod.GetTexture("NPCs/HiveMind/HiveMindP2"); - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (state != 0 && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = npc.GetAlpha(color26); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - SpriteEffects effects = spriteEffects; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, effects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(Main.npcTexture[npc.type], npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - private void SpawnStuff() - { - Player player = Main.player[npc.target]; - for (int i = 0; i < 5; i++) - { - bool spawnedSomething = false; - int type = NPCID.EaterofSouls; - int maxAmount = 0; - int random = !CalamityWorld.death && Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height) ? 5 : 3; - switch (Main.rand.Next(random)) - { - case 0: - type = NPCID.DevourerHead; - maxAmount = 1; - break; - case 1: - type = mod.NPCType("DankCreeper"); - maxAmount = 1; - break; - case 2: - type = mod.NPCType("DankCreeper"); - maxAmount = 2; - break; - case 3: - type = mod.NPCType("HiveBlob2"); - maxAmount = 2; - break; - case 4: - type = NPCID.EaterofSouls; - maxAmount = 2; - break; - case 5: - type = mod.NPCType("DarkHeart"); - maxAmount = 2; - break; - } - int numToSpawn = maxAmount - NPC.CountNPCS(type); - while (numToSpawn > 0) - { - numToSpawn--; - spawnedSomething = true; - int spawn = NPC.NewNPC((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), type); - Main.npc[spawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[spawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - } - if (spawnedSomething) - return; - } - } - - private void ReelBack() - { - npc.alpha = 0; - phase2timer = 0; - deceleration = npc.velocity / 255f * reelbackFade; - if (CalamityWorld.death) - { - state = 2; - Main.PlaySound(36, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); - } - else - { - if (Main.netMode != 1) - SpawnStuff(); - state = nextState; - nextState = 0; - if (state == 2) - { - Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); - } - else - { - Main.PlaySound(36, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); - } - } - } - - public override void AI() - { - Player player = Main.player[npc.target]; - npc.defense = (player.ZoneCorrupt || CalamityWorld.bossRushActive) ? 5 : 9999; - CalamityGlobalNPC.hiveMind = npc.whoAmI; - if (npc.alpha != 0) - { - if (npc.damage != 0) - { - oldDamage = npc.damage; - npc.damage = 0; - } - } - else - { - npc.damage = oldDamage; - } - switch (state) - { - case 0: //slowdrift - if (npc.alpha > 0) - npc.alpha -= 3; - if (nextState == 0) - { - npc.TargetClosest(true); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - do nextState = Main.rand.Next(3, 6); - while (nextState == previousState); - previousState = nextState; - } - else - { - if (CalamityWorld.revenge && (Main.rand.Next(4) == 0 || reelCount == 3)) - { - reelCount = 0; - nextState = 2; - } - else - { - reelCount++; - nextState = 1; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - if (nextState == 3) - rotation = MathHelper.ToRadians(Main.rand.Next(360)); - npc.netUpdate = true; - } - if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 5000f) - { - npc.TargetClosest(true); - if (npc.timeLeft > 60) - npc.timeLeft = 60; - if (npc.localAI[3] < 120f) - { - float[] aiArray = npc.localAI; - int number = 3; - float num244 = aiArray[number]; - aiArray[number] = num244 + 1f; - } - if (npc.localAI[3] > 60f) - { - npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.5f; - } - return; - } - if (npc.localAI[3] > 0f) - { - float[] aiArray = npc.localAI; - int number = 3; - float num244 = aiArray[number]; - aiArray[number] = num244 - 1f; - return; - } - npc.velocity = player.Center - npc.Center; - phase2timer--; - if (phase2timer <= -180) //no stalling drift mode forever - { - npc.velocity *= 2f / 255f * reelbackFade; - ReelBack(); - npc.netUpdate = true; - } - else - { - npc.velocity.Normalize(); - if (Main.expertMode || CalamityWorld.bossRushActive) //variable velocity in expert and up - { - npc.velocity *= driftSpeed + driftBoost * (npc.lifeMax - npc.life) / npc.lifeMax; - } - else - { - npc.velocity *= driftSpeed; - } - } - break; - case 1: //reelback and teleport - npc.alpha += reelbackFade; - npc.velocity -= deceleration; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.velocity = Vector2.Zero; - state = 0; - if (Main.netMode != 1 && npc.ai[1] != 0f && npc.ai[2] != 0f) - { - npc.position.X = npc.ai[1] * 16 - npc.width / 2; - npc.position.Y = npc.ai[2] * 16 - npc.height / 2; - } - phase2timer = minimumDriftTime + Main.rand.Next(121); - npc.netUpdate = true; - } - else if (npc.ai[1] == 0f && npc.ai[2] == 0f) - { - for (int i = 0; i < 10; i++) - { - int posX = (int)player.Center.X / 16 + Main.rand.Next(15, 46) * (Main.rand.Next(2) == 0 ? -1 : 1); - int posY = (int)player.Center.Y / 16 + Main.rand.Next(15, 46) * (Main.rand.Next(2) == 0 ? -1 : 1); - if (!WorldGen.SolidTile(posX, posY) && Collision.CanHit(new Vector2(posX * 16, posY * 16), 1, 1, player.position, player.width, player.height)) - { - npc.ai[1] = posX; - npc.ai[2] = posY; - npc.netUpdate = true; - break; - } - } - } - break; - case 2: //reelback for lunge + death legacy - npc.alpha += reelbackFade; - npc.velocity -= deceleration; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.velocity = Vector2.Zero; - dashStarted = false; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - state = nextState; - nextState = 0; - previousState = state; - } - else - { - state = 3; - } - if (player.velocity.X > 0) - rotationDirection = 1; - else if (player.velocity.X < 0) - rotationDirection = -1; - else - rotationDirection = player.direction; - } - break; - case 3: //rev lunge - npc.netUpdate = true; - if (npc.alpha > 0) - { - npc.alpha -= lungeFade; - if (Main.netMode != 1) - { - npc.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); - } - rotation += rotationIncrement * rotationDirection; - phase2timer = lungeDelay; - } - else - { - phase2timer--; - if (!dashStarted) - { - if (phase2timer <= 0) - { - phase2timer = lungeTime; - npc.velocity = player.Center - npc.Center; - npc.velocity.Normalize(); - npc.velocity *= teleportRadius / lungeTime; - dashStarted = true; - Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); - } - else - { - if (Main.netMode != 1) - { - npc.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); - } - rotation += rotationIncrement * rotationDirection * phase2timer / lungeDelay; - } - } - else - { - if (phase2timer <= 0) - { - state = 6; - phase2timer = 0; - deceleration = npc.velocity / decelerationTime; - } - } - } - break; - case 4: //enemy spawn arc (death mode) - if (npc.alpha > 0) - { - npc.alpha -= 5; - if (Main.netMode != 1) - { - npc.Center = player.Center; - npc.position.Y += teleportRadius; - } - npc.netUpdate = true; - } - else - { - if (!dashStarted) - { - dashStarted = true; - Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); - npc.velocity.X = 3.14159265f * teleportRadius / arcTime; - npc.velocity *= rotationDirection; - npc.netUpdate = true; - } - else - { - npc.velocity = npc.velocity.RotatedBy(3.14159265 / arcTime * -rotationDirection); - phase2timer++; - if (phase2timer == (int)arcTime / 6) - { - phase2timer = 0; - npc.ai[0]++; - if (Main.netMode != 1 && Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height)) //draw line of sight - { - if (npc.ai[0] == 2 || npc.ai[0] == 4) - { - if ((Main.expertMode || CalamityWorld.bossRushActive) && NPC.CountNPCS(mod.NPCType("DarkHeart")) < 2) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("DarkHeart")); - } - } - else if (NPC.CountNPCS(NPCID.EaterofSouls) < 2) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.EaterofSouls); - } - } - if (npc.ai[0] == 6) - { - npc.velocity = npc.velocity.RotatedBy(3.14159265 / arcTime * -rotationDirection); - SpawnStuff(); - state = 6; - npc.ai[0] = 0; - deceleration = npc.velocity / decelerationTime; - } - } - } - } - break; - case 5: //raindash (death mode) - if (npc.alpha > 0) - { - npc.alpha -= 5; - if (Main.netMode != 1) - { - npc.Center = player.Center; - npc.position.Y -= teleportRadius; - npc.position.X += teleportRadius * rotationDirection; - } - npc.netUpdate = true; - } - else - { - if (!dashStarted) - { - dashStarted = true; - Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); - npc.velocity.X = teleportRadius / arcTime * 3; - npc.velocity *= -rotationDirection; - npc.netUpdate = true; - } - else - { - phase2timer++; - if (phase2timer == (int)arcTime / 20) - { - phase2timer = 0; - npc.ai[0]++; - if (Main.netMode != 1) - { - int damage = Main.expertMode ? 14 : 18; - Projectile.NewProjectile(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height), 0, 0, mod.ProjectileType("ShadeNimbusHostile"), damage, 0, Main.myPlayer, 11, 0); - } - if (npc.ai[0] == 10) - { - state = 6; - npc.ai[0] = 0; - deceleration = npc.velocity / decelerationTime; - } - } - } - } - break; - case 6: //deceleration - npc.velocity -= deceleration; - phase2timer++; - if (phase2timer == decelerationTime) - { - phase2timer = minimumDriftTime + Main.rand.Next(121); - state = 0; - npc.netUpdate = true; - } - break; - } - } - - public override bool? CanHitNPC(NPC target) - { - if (npc.alpha > 0) - return false; - return null; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return npc.alpha <= 0; //no damage when not fully visible - } - - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - if (phase2timer < 0 && damage > 1) - { - npc.velocity *= -4f; - ReelBack(); - npc.netUpdate = true; - } - return true; - } - - 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 HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - if (Main.netMode != 1 && Main.rand.Next(15) == 0 && NPC.CountNPCS(mod.NPCType("HiveBlob2")) < 2) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("HiveBlob2")); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore6"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 200; - npc.height = 150; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default(Color), 3f); - 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, 14, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.HealingPotion; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HiveMindTrophy")); - } - 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("HiveMindMask")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ShaderainStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeechingDagger")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ShadowdropStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PerfectDark")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Shadethrower")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RotBall"), Main.rand.Next(25, 51)); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DankStaff")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrueShadowScale"), Main.rand.Next(25, 31)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DemoniteBar, Main.rand.Next(7, 11)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.RottenChunk, Main.rand.Next(9, 16)); - if (Main.hardMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CursedFlame, Main.rand.Next(10, 21)); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - } - } -} +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.World; + +/* states: + * 0 = slow drift + * 1 = reelback and teleport after spawn enemy + * 2 = reelback for spin lunge + death legacy + * 3 = spin lunge + * 4 = semicircle spawn arc + * 5 = raindash + * 6 = deceleration + */ + +namespace CalamityMod.NPCs.HiveMind +{ + [AutoloadBossHead] + public class HiveMindP2 : ModNPC + { + //this block of values can be modified in SetDefaults() based on difficulty mode or something + int minimumDriftTime = 300; + int teleportRadius = 300; + int decelerationTime = 30; + int reelbackFade = 3; //divide 255 by this for duration of reelback in ticks + float arcTime = 45f; //ticks needed to complete movement for spawn and rain attacks (DEATH ONLY) + float driftSpeed = 2f; //default speed when slowly floating at player + float driftBoost = 1f; //max speed added as health decreases + int lungeDelay = 90; //# of ticks long hive mind spends sliding to a stop before lunging + int lungeTime = 30; + int lungeFade = 15; //divide 255 by this for duration of hive mind spin before slowing for lunge + double lungeRots = 0.2; //number of revolutions made while spinning/fading in for lunge + bool dashStarted = false; + int phase2timer = 360; + int rotationDirection; + double rotation; + double rotationIncrement; + int state = 0; + int previousState = 0; + int nextState = 0; + int reelCount = 0; + int oldDamage = 40; + Vector2 deceleration; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Hive Mind"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 5f; + npc.damage = 40; + npc.width = 150; //324 + npc.height = 120; //216 + npc.defense = 5; + npc.lifeMax = CalamityWorld.revenge ? 7560 : 5800; + if (CalamityWorld.death) + { + npc.lifeMax = 12500; + } + if (CalamityWorld.bossRushActive) + { + 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; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 6, 0, 0); + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); + else + music = MusicID.Boss2; + bossBag = mod.ItemType("HiveMindBag"); + NPCID.Sets.TrailCacheLength[npc.type] = 8; + NPCID.Sets.TrailingMode[npc.type] = 1; + if (Main.expertMode) + { + minimumDriftTime = 120; + reelbackFade = 5; + } + if (CalamityWorld.revenge) + { + lungeRots = 0.3; + minimumDriftTime = 90; + reelbackFade = 6; + lungeTime = 25; + driftSpeed = 3f; + driftBoost = 2f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + lungeRots = 0.4; + minimumDriftTime = 60; + reelbackFade = 7; + lungeTime = 20; + driftSpeed = 4f; + driftBoost = 1f; + } + phase2timer = minimumDriftTime; + rotationIncrement = 0.0246399424 * lungeRots * lungeFade; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(state); + writer.Write(nextState); + writer.Write(phase2timer); + writer.Write(dashStarted); + writer.Write(rotationDirection); + writer.Write(rotation); + writer.Write(previousState); + writer.Write(reelCount); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + state = reader.ReadInt32(); + nextState = reader.ReadInt32(); + phase2timer = reader.ReadInt32(); + dashStarted = reader.ReadBoolean(); + rotationDirection = reader.ReadInt32(); + rotation = reader.ReadDouble(); + previousState = reader.ReadInt32(); + reelCount = reader.ReadInt32(); + } + + 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 PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = lightColor; + color24 = npc.GetAlpha(color24); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = mod.GetTexture("NPCs/HiveMind/HiveMindP2"); + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (state != 0 && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = npc.GetAlpha(color26); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + SpriteEffects effects = spriteEffects; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, effects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(Main.npcTexture[npc.type], npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + private void SpawnStuff() + { + Player player = Main.player[npc.target]; + for (int i = 0; i < 5; i++) + { + bool spawnedSomething = false; + int type = NPCID.EaterofSouls; + int maxAmount = 0; + int random = !CalamityWorld.death && Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height) ? 5 : 3; + switch (Main.rand.Next(random)) + { + case 0: + type = NPCID.DevourerHead; + maxAmount = 1; + break; + case 1: + type = mod.NPCType("DankCreeper"); + maxAmount = 1; + break; + case 2: + type = mod.NPCType("DankCreeper"); + maxAmount = 2; + break; + case 3: + type = mod.NPCType("HiveBlob2"); + maxAmount = 2; + break; + case 4: + type = NPCID.EaterofSouls; + maxAmount = 2; + break; + case 5: + type = mod.NPCType("DarkHeart"); + maxAmount = 2; + break; + } + int numToSpawn = maxAmount - NPC.CountNPCS(type); + while (numToSpawn > 0) + { + numToSpawn--; + spawnedSomething = true; + int spawn = NPC.NewNPC((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), type); + Main.npc[spawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; + Main.npc[spawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; + } + if (spawnedSomething) + return; + } + } + + private void ReelBack() + { + npc.alpha = 0; + phase2timer = 0; + deceleration = npc.velocity / 255f * reelbackFade; + if (CalamityWorld.death) + { + state = 2; + Main.PlaySound(36, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); + } + else + { + if (Main.netMode != 1) + SpawnStuff(); + state = nextState; + nextState = 0; + if (state == 2) + { + Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); + } + else + { + Main.PlaySound(36, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); + } + } + } + + public override void AI() + { + Player player = Main.player[npc.target]; + npc.defense = (player.ZoneCorrupt || CalamityWorld.bossRushActive) ? 5 : 9999; + CalamityGlobalNPC.hiveMind = npc.whoAmI; + if (npc.alpha != 0) + { + if (npc.damage != 0) + { + oldDamage = npc.damage; + npc.damage = 0; + } + } + else + { + npc.damage = oldDamage; + } + switch (state) + { + case 0: //slowdrift + if (npc.alpha > 0) + npc.alpha -= 3; + if (nextState == 0) + { + npc.TargetClosest(true); + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + do nextState = Main.rand.Next(3, 6); + while (nextState == previousState); + previousState = nextState; + } + else + { + if (CalamityWorld.revenge && (Main.rand.Next(4) == 0 || reelCount == 3)) + { + reelCount = 0; + nextState = 2; + } + else + { + reelCount++; + nextState = 1; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + if (nextState == 3) + rotation = MathHelper.ToRadians(Main.rand.Next(360)); + npc.netUpdate = true; + } + if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 5000f) + { + npc.TargetClosest(true); + if (npc.timeLeft > 60) + npc.timeLeft = 60; + if (npc.localAI[3] < 120f) + { + float[] aiArray = npc.localAI; + int number = 3; + float num244 = aiArray[number]; + aiArray[number] = num244 + 1f; + } + if (npc.localAI[3] > 60f) + { + npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.5f; + } + return; + } + if (npc.localAI[3] > 0f) + { + float[] aiArray = npc.localAI; + int number = 3; + float num244 = aiArray[number]; + aiArray[number] = num244 - 1f; + return; + } + npc.velocity = player.Center - npc.Center; + phase2timer--; + if (phase2timer <= -180) //no stalling drift mode forever + { + npc.velocity *= 2f / 255f * reelbackFade; + ReelBack(); + npc.netUpdate = true; + } + else + { + npc.velocity.Normalize(); + if (Main.expertMode || CalamityWorld.bossRushActive) //variable velocity in expert and up + { + npc.velocity *= driftSpeed + driftBoost * (npc.lifeMax - npc.life) / npc.lifeMax; + } + else + { + npc.velocity *= driftSpeed; + } + } + break; + case 1: //reelback and teleport + npc.alpha += reelbackFade; + npc.velocity -= deceleration; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.velocity = Vector2.Zero; + state = 0; + if (Main.netMode != 1 && npc.ai[1] != 0f && npc.ai[2] != 0f) + { + npc.position.X = npc.ai[1] * 16 - npc.width / 2; + npc.position.Y = npc.ai[2] * 16 - npc.height / 2; + } + phase2timer = minimumDriftTime + Main.rand.Next(121); + npc.netUpdate = true; + } + else if (npc.ai[1] == 0f && npc.ai[2] == 0f) + { + for (int i = 0; i < 10; i++) + { + int posX = (int)player.Center.X / 16 + Main.rand.Next(15, 46) * (Main.rand.Next(2) == 0 ? -1 : 1); + int posY = (int)player.Center.Y / 16 + Main.rand.Next(15, 46) * (Main.rand.Next(2) == 0 ? -1 : 1); + if (!WorldGen.SolidTile(posX, posY) && Collision.CanHit(new Vector2(posX * 16, posY * 16), 1, 1, player.position, player.width, player.height)) + { + npc.ai[1] = posX; + npc.ai[2] = posY; + npc.netUpdate = true; + break; + } + } + } + break; + case 2: //reelback for lunge + death legacy + npc.alpha += reelbackFade; + npc.velocity -= deceleration; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.velocity = Vector2.Zero; + dashStarted = false; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + state = nextState; + nextState = 0; + previousState = state; + } + else + { + state = 3; + } + if (player.velocity.X > 0) + rotationDirection = 1; + else if (player.velocity.X < 0) + rotationDirection = -1; + else + rotationDirection = player.direction; + } + break; + case 3: //rev lunge + npc.netUpdate = true; + if (npc.alpha > 0) + { + npc.alpha -= lungeFade; + if (Main.netMode != 1) + { + npc.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); + } + rotation += rotationIncrement * rotationDirection; + phase2timer = lungeDelay; + } + else + { + phase2timer--; + if (!dashStarted) + { + if (phase2timer <= 0) + { + phase2timer = lungeTime; + npc.velocity = player.Center - npc.Center; + npc.velocity.Normalize(); + npc.velocity *= teleportRadius / lungeTime; + dashStarted = true; + Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); + } + else + { + if (Main.netMode != 1) + { + npc.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); + } + rotation += rotationIncrement * rotationDirection * phase2timer / lungeDelay; + } + } + else + { + if (phase2timer <= 0) + { + state = 6; + phase2timer = 0; + deceleration = npc.velocity / decelerationTime; + } + } + } + break; + case 4: //enemy spawn arc (death mode) + if (npc.alpha > 0) + { + npc.alpha -= 5; + if (Main.netMode != 1) + { + npc.Center = player.Center; + npc.position.Y += teleportRadius; + } + npc.netUpdate = true; + } + else + { + if (!dashStarted) + { + dashStarted = true; + Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); + npc.velocity.X = 3.14159265f * teleportRadius / arcTime; + npc.velocity *= rotationDirection; + npc.netUpdate = true; + } + else + { + npc.velocity = npc.velocity.RotatedBy(3.14159265 / arcTime * -rotationDirection); + phase2timer++; + if (phase2timer == (int)arcTime / 6) + { + phase2timer = 0; + npc.ai[0]++; + if (Main.netMode != 1 && Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height)) //draw line of sight + { + if (npc.ai[0] == 2 || npc.ai[0] == 4) + { + if ((Main.expertMode || CalamityWorld.bossRushActive) && NPC.CountNPCS(mod.NPCType("DarkHeart")) < 2) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("DarkHeart")); + } + } + else if (NPC.CountNPCS(NPCID.EaterofSouls) < 2) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.EaterofSouls); + } + } + if (npc.ai[0] == 6) + { + npc.velocity = npc.velocity.RotatedBy(3.14159265 / arcTime * -rotationDirection); + SpawnStuff(); + state = 6; + npc.ai[0] = 0; + deceleration = npc.velocity / decelerationTime; + } + } + } + } + break; + case 5: //raindash (death mode) + if (npc.alpha > 0) + { + npc.alpha -= 5; + if (Main.netMode != 1) + { + npc.Center = player.Center; + npc.position.Y -= teleportRadius; + npc.position.X += teleportRadius * rotationDirection; + } + npc.netUpdate = true; + } + else + { + if (!dashStarted) + { + dashStarted = true; + Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 0); + npc.velocity.X = teleportRadius / arcTime * 3; + npc.velocity *= -rotationDirection; + npc.netUpdate = true; + } + else + { + phase2timer++; + if (phase2timer == (int)arcTime / 20) + { + phase2timer = 0; + npc.ai[0]++; + if (Main.netMode != 1) + { + int damage = Main.expertMode ? 14 : 18; + Projectile.NewProjectile(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height), 0, 0, mod.ProjectileType("ShadeNimbusHostile"), damage, 0, Main.myPlayer, 11, 0); + } + if (npc.ai[0] == 10) + { + state = 6; + npc.ai[0] = 0; + deceleration = npc.velocity / decelerationTime; + } + } + } + } + break; + case 6: //deceleration + npc.velocity -= deceleration; + phase2timer++; + if (phase2timer == decelerationTime) + { + phase2timer = minimumDriftTime + Main.rand.Next(121); + state = 0; + npc.netUpdate = true; + } + break; + } + } + + public override bool? CanHitNPC(NPC target) + { + if (npc.alpha > 0) + return false; + return null; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return npc.alpha <= 0; //no damage when not fully visible + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (phase2timer < 0 && damage > 1) + { + npc.velocity *= -4f; + ReelBack(); + npc.netUpdate = true; + } + return true; + } + + 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 HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + if (Main.netMode != 1 && Main.rand.Next(15) == 0 && NPC.CountNPCS(mod.NPCType("HiveBlob2")) < 2) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("HiveBlob2")); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore5"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/HiveMindGores/HiveMindP2Gore6"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 200; + npc.height = 150; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 14, 0f, 0f, 100, default(Color), 3f); + 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, 14, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.HealingPotion; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HiveMindTrophy")); + } + 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("HiveMindMask")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ShaderainStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeechingDagger")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ShadowdropStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PerfectDark")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Shadethrower")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RotBall"), Main.rand.Next(25, 51)); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DankStaff")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrueShadowScale"), Main.rand.Next(25, 31)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DemoniteBar, Main.rand.Next(7, 11)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.RottenChunk, Main.rand.Next(9, 16)); + if (Main.hardMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CursedFlame, Main.rand.Next(10, 21)); + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + } + } +} diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index a105b114bd..d6f22f3eb9 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -1,226 +1,226 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Leviathan -{ - public class AquaticAberration : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Aberration"); - Main.npcFrameCount[npc.type] = 9; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 60; - npc.width = 70; //324 - npc.height = 40; //216 - npc.defense = 18; - npc.lifeMax = CalamityWorld.death ? 2200 : 1100; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 100000; - } - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - aiType = -1; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("AquaticAberrationBanner"); - } - - 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() - { - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.leviathan < 0 || !Main.npc[CalamityGlobalNPC.leviathan].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.TargetClosest(false); - npc.rotation = npc.velocity.ToRotation(); - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - if (npc.rotation < -1.57079637f) - { - npc.rotation += 3.14159274f; - } - if (npc.rotation > 1.57079637f) - { - npc.rotation -= 3.14159274f; - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - float num998 = 8f; - float scaleFactor3 = 300f; - float num999 = 800f; - float num1000 = 60f; - float num1001 = 5f; - float scaleFactor4 = 0.8f; - int num1002 = 0; - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1005 = 60f; - float num1006 = 0.333333343f; - float num1007 = 8f; - num1006 *= num1005; - int num1009 = (npc.ai[0] == 2f) ? 2 : 1; - int num1010 = (npc.ai[0] == 2f) ? 30 : 20; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 33, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (npc.ai[0] == 0f) - { - float scaleFactor6 = num998; - Vector2 center4 = npc.Center; - Vector2 center5 = Main.player[npc.target].Center; - Vector2 vector126 = center5 - center4; - Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; - float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - if (npc.ai[3] >= 120f) - { - flag64 = true; - } - float num1014 = 8f; - 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) / num1000; - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; - if (!flag64) - { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) - { - npc.netUpdate = true; - } - } - else - { - npc.ai[3] = 0f; - } - } - else - { - npc.ai[0] = 1f; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; - velocity.Normalize(); - velocity *= scaleFactor5; - npc.velocity = velocity; - } - } - else if (npc.ai[0] == 2f) - { - float num1016 = num1003; - npc.ai[1] += 1f; - bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; - if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - npc.ai[0] = 4f; - } - else - { - Vector2 center6 = npc.Center; - Vector2 center7 = Main.player[npc.target].Center; - Vector2 vec2 = center7 - center6; - vec2.Normalize(); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; - } - } - else if (npc.ai[0] == 4f) - { - npc.ai[1] -= 3f; - if (npc.ai[1] <= 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.95f; - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Wet, 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Leviathan +{ + public class AquaticAberration : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Aberration"); + Main.npcFrameCount[npc.type] = 9; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 60; + npc.width = 70; //324 + npc.height = 40; //216 + npc.defense = 18; + npc.lifeMax = CalamityWorld.death ? 2200 : 1100; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 100000; + } + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + aiType = -1; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("AquaticAberrationBanner"); + } + + 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() + { + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.leviathan < 0 || !Main.npc[CalamityGlobalNPC.leviathan].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.TargetClosest(false); + npc.rotation = npc.velocity.ToRotation(); + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + if (npc.rotation < -1.57079637f) + { + npc.rotation += 3.14159274f; + } + if (npc.rotation > 1.57079637f) + { + npc.rotation -= 3.14159274f; + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + float num998 = 8f; + float scaleFactor3 = 300f; + float num999 = 800f; + float num1000 = 60f; + float num1001 = 5f; + float scaleFactor4 = 0.8f; + int num1002 = 0; + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1005 = 60f; + float num1006 = 0.333333343f; + float num1007 = 8f; + num1006 *= num1005; + int num1009 = (npc.ai[0] == 2f) ? 2 : 1; + int num1010 = (npc.ai[0] == 2f) ? 30 : 20; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 33, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (npc.ai[0] == 0f) + { + float scaleFactor6 = num998; + Vector2 center4 = npc.Center; + Vector2 center5 = Main.player[npc.target].Center; + Vector2 vector126 = center5 - center4; + Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; + float num1013 = vector126.Length(); + vector126 = Vector2.Normalize(vector126) * scaleFactor6; + vector127 = Vector2.Normalize(vector127) * scaleFactor6; + bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (npc.ai[3] >= 120f) + { + flag64 = true; + } + float num1014 = 8f; + 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) / num1000; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; + if (!flag64) + { + npc.ai[3] += 1f; + if (npc.ai[3] == 120f) + { + npc.netUpdate = true; + } + } + else + { + npc.ai[3] = 0f; + } + } + else + { + npc.ai[0] = 1f; + npc.ai[2] = vector126.X; + npc.ai[3] = vector126.Y; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; + velocity.Normalize(); + velocity *= scaleFactor5; + npc.velocity = velocity; + } + } + else if (npc.ai[0] == 2f) + { + float num1016 = num1003; + npc.ai[1] += 1f; + bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; + if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + npc.ai[0] = 4f; + } + else + { + Vector2 center6 = npc.Center; + Vector2 center7 = Main.player[npc.target].Center; + Vector2 vec2 = center7 - center6; + vec2.Normalize(); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; + } + } + else if (npc.ai[0] == 4f) + { + npc.ai[1] -= 3f; + if (npc.ai[1] <= 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.95f; + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Wet, 120, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/Leviathan/LevScreenShaderData.cs b/NPCs/Leviathan/LevScreenShaderData.cs index 3b125744d6..9a8bb7da45 100644 --- a/NPCs/Leviathan/LevScreenShaderData.cs +++ b/NPCs/Leviathan/LevScreenShaderData.cs @@ -1,44 +1,44 @@ -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Leviathan -{ - public class LevScreenShaderData : ScreenShaderData - { - private int LevIndex; - - public LevScreenShaderData(string passName) - : base(passName) - { - } - - private void UpdateLIndex() - { - int LevType = ModLoader.GetMod("CalamityMod").NPCType("Leviathan"); - if (LevIndex >= 0 && Main.npc[LevIndex].active && Main.npc[LevIndex].type == LevType) - { - return; - } - LevIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == LevType) - { - LevIndex = i; - break; - } - } - } - - public override void Apply() - { - UpdateLIndex(); - if (LevIndex != -1) - { - UseTargetPosition(Main.npc[LevIndex].Center); - } - base.Apply(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Leviathan +{ + public class LevScreenShaderData : ScreenShaderData + { + private int LevIndex; + + public LevScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateLIndex() + { + int LevType = ModLoader.GetMod("CalamityMod").NPCType("Leviathan"); + if (LevIndex >= 0 && Main.npc[LevIndex].active && Main.npc[LevIndex].type == LevType) + { + return; + } + LevIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == LevType) + { + LevIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateLIndex(); + if (LevIndex != -1) + { + UseTargetPosition(Main.npc[LevIndex].Center); + } + base.Apply(); + } + } +} diff --git a/NPCs/Leviathan/LevSky.cs b/NPCs/Leviathan/LevSky.cs index dda1fbd214..0a5cf6e5dd 100644 --- a/NPCs/Leviathan/LevSky.cs +++ b/NPCs/Leviathan/LevSky.cs @@ -1,101 +1,101 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Leviathan -{ - public class LevSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int LevIndex = -1; - - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } - - private float GetIntensity() - { - if (this.UpdateLIndex()) - { - float x = 0f; - if (this.LevIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.LevIndex].Center); - } - return 1f - Utils.SmoothStep(3000f, 6000f, x); - } - return 0f; - } - - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } - - private bool UpdateLIndex() - { - int LevType = ModLoader.GetMod("CalamityMod").NPCType("Leviathan"); - if (LevIndex >= 0 && Main.npc[LevIndex].active && Main.npc[LevIndex].type == LevType) - { - return true; - } - LevIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == LevType) - { - LevIndex = i; - break; - } - } - //this.DoGIndex = DoGIndex; - return LevIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity); - } - } - - public override float GetCloudAlpha() - { - return 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } - - public override void Deactivate(params object[] args) - { - isActive = false; - } - - public override void Reset() - { - isActive = false; - } - - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Leviathan +{ + public class LevSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int LevIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdateLIndex()) + { + float x = 0f; + if (this.LevIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.LevIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateLIndex() + { + int LevType = ModLoader.GetMod("CalamityMod").NPCType("Leviathan"); + if (LevIndex >= 0 && Main.npc[LevIndex].active && Main.npc[LevIndex].type == LevType) + { + return true; + } + LevIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == LevType) + { + LevIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return LevIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index cc8070f006..2128920e7e 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -1,737 +1,737 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Leviathan -{ - [AutoloadBossHead] - public class Leviathan : ModNPC - { - private bool altTextureSwap = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Leviathan"); - Main.npcFrameCount[npc.type] = 3; - } - - public override void SetDefaults() - { - npc.npcSlots = 20f; - npc.damage = 90; - npc.width = 850; - npc.height = 450; - npc.defense = 40; - npc.lifeMax = CalamityWorld.revenge ? 90700 : 69000; - if (CalamityWorld.death) - { - npc.lifeMax = 189750; - } - if (CalamityWorld.bossRushActive) - { - 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; - 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[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; - npc.noGravity = true; - npc.boss = true; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); - else - music = MusicID.Boss3; - bossBag = mod.ItemType("LeviathanBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(altTextureSwap); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - altTextureSwap = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override void AI() - { - CalamityGlobalNPC.leviathan = npc.whoAmI; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Vector2 vector = npc.Center; - Player player = Main.player[npc.target]; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - bool sirenAlive = false; - if (CalamityGlobalNPC.siren != -1) - { - sirenAlive = Main.npc[CalamityGlobalNPC.siren].active; - } - int soundChoice = Main.rand.Next(3); - int soundChoiceRage = 92; - if (soundChoice == 0) - { - soundChoice = 38; - } - else if (soundChoice == 1) - { - soundChoice = 39; - } - else - { - soundChoice = 40; - } - if (Main.rand.Next(600) == 0) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, - ((sirenAlive && !CalamityWorld.death && !CalamityWorld.bossRushActive) ? soundChoice : soundChoiceRage)); - } - 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 = 80; - } - else - { - npc.defense = 40; - } - npc.dontTakeDamage = flag6 && !CalamityWorld.bossRushActive; - int num1038 = 0; - for (int num1039 = 0; num1039 < 255; num1039++) - { - if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) - { - num1038++; - } - } - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) - { - npc.velocity = new Vector2(0f, 10f); - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int x = 0; x < 200; x++) - { - if (Main.npc[x].type == mod.NPCType("Siren")) - { - Main.npc[x].active = false; - Main.npc[x].netUpdate = true; - } - } - npc.active = false; - npc.netUpdate = true; - } - return; - } - } - else - { - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - float num412 = sirenAlive ? 3.5f : 7f; - float num413 = sirenAlive ? 0.1f : 0.2f; - if (CalamityWorld.bossRushActive) - { - num412 = 12f; - num413 = 0.4f; - } - int num414 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num414 = -1; - } - Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 800) - vector40.X; - float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num412 / num417; - num415 *= num417; - num416 *= num417; - if (npc.velocity.X < num415) - { - npc.velocity.X = npc.velocity.X + num413; - if (npc.velocity.X < 0f && num415 > 0f) - { - npc.velocity.X = npc.velocity.X + num413; - } - } - else if (npc.velocity.X > num415) - { - npc.velocity.X = npc.velocity.X - num413; - if (npc.velocity.X > 0f && num415 < 0f) - { - npc.velocity.X = npc.velocity.X - num413; - } - } - if (npc.velocity.Y < num416) - { - npc.velocity.Y = npc.velocity.Y + num413; - if (npc.velocity.Y < 0f && num416 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num413; - } - } - else if (npc.velocity.Y > num416) - { - npc.velocity.Y = npc.velocity.Y - num413; - if (npc.velocity.Y > 0f && num416 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num413; - } - } - npc.ai[1] += 1f; - if (npc.ai[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 120f : 240f)) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - else - { - if (!player.dead) - { - npc.ai[2] += 1.5f; - if (!sirenAlive) - npc.ai[2] += 2.5f; - } - if (npc.ai[2] >= 90f) - { - npc.ai[2] = 0f; - vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num415 = player.position.X + (float)(player.width / 2) - vector40.X; - num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - if (Main.netMode != 1) - { - float num418 = sirenAlive ? 13.5f : 16f; - int num419 = 48; - int num420 = mod.ProjectileType("LeviathanBomb"); - if (expertMode) - { - num418 = sirenAlive ? 14f : 17f; - num419 = 33; - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num418 = 22f; - } - num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num418 / num417; - num415 *= num417; - num416 *= num417; - num415 += (float)Main.rand.Next(-5, 6) * 0.05f; - num416 += (float)Main.rand.Next(-5, 6) * 0.05f; - vector40.X += num415 * 4f; - vector40.Y += num416 * 4f; - Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else if (npc.ai[0] == 1f) - { - npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - npc.ai[1] += (revenge ? 2f : 1f); - npc.ai[1] += (float)(num1038 / 2); - if (!sirenAlive || CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.ai[1] += 2.5f; - } - bool flag103 = false; - int spawnLimit = sirenAlive ? 2 : 4; - int spawnLimit2 = sirenAlive ? 5 : 10; - if (npc.ai[1] > 80f) //changed from 40 not a prob - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - flag103 = true; - } - if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoice); - if (Main.netMode != 1 && NPC.CountNPCS(mod.NPCType("Parasea")) < spawnLimit2 && NPC.CountNPCS(mod.NPCType("AquaticAberration")) < spawnLimit) - { - int num1061; - int value = CalamityWorld.death ? 2 : 3; - if (CalamityWorld.bossRushActive) - value++; - if (Main.rand.Next(value) == 0) - { - num1061 = mod.NPCType("AquaticAberration"); - } - else - { - num1061 = mod.NPCType("Parasea"); - } - 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.01f; - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.01f; - 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)) - { - float num1063 = sirenAlive ? 7f : 8f; //changed from 14 not a prob - float num1064 = sirenAlive ? 0.05f : 0.065f; //changed from 0.1 not a prob - if (CalamityWorld.bossRushActive) - { - num1063 = 10f; - num1064 = 0.075f; - } - vector120 = vector119; - num1058 = player.position.X + (float)(player.width / 2) - vector120.X; - num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; - num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - num1060 = num1063 / num1060; - if (npc.velocity.X < num1058) - { - npc.velocity.X = npc.velocity.X + num1064; - if (npc.velocity.X < 0f && num1058 > 0f) - { - npc.velocity.X = npc.velocity.X + num1064; - } - } - else if (npc.velocity.X > num1058) - { - npc.velocity.X = npc.velocity.X - num1064; - if (npc.velocity.X > 0f && num1058 < 0f) - { - npc.velocity.X = npc.velocity.X - num1064; - } - } - if (npc.velocity.Y < num1059) - { - npc.velocity.Y = npc.velocity.Y + num1064; - if (npc.velocity.Y < 0f && num1059 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1064; - } - } - else if (npc.velocity.Y > num1059) - { - npc.velocity.Y = npc.velocity.Y - num1064; - if (npc.velocity.Y > 0f && num1059 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1064; - } - } - } - else - { - npc.velocity *= 0.9f; - } - npc.spriteDirection = npc.direction; - if (npc.ai[2] > 3f) - { - npc.ai[0] = ((double)npc.life < (double)npc.lifeMax * 0.5 ? 2f : 0f); - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - Vector2 distFromPlayer = Main.player[npc.target].Center - npc.Center; - if (npc.ai[1] > 1f || distFromPlayer.Length() > 2400f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] % 2f == 0f) - { - int num24 = 7; - for (int j = 0; j < num24; j++) - { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default(Vector2)) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity /= 4f; - Main.dust[num25].velocity -= npc.velocity; - } - npc.TargetClosest(true); - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) - { - npc.ai[1] += 1f; - npc.ai[2] = 0f; - float num1044 = revenge ? 20f : 18f; //16 - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num1044 += 2f; //2 not a prob - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num1044 += 2f; //2 not a prob - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1044 += 4f; - } - Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; - float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); - num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - npc.spriteDirection = npc.direction; - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoiceRage); - return; - } - float num1048 = revenge ? 7.5f : 6.5f; //12 not a prob - float num1049 = revenge ? 0.12f : 0.11f; //0.15 not a prob - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num1048 += 2f; //2 not a prob - num1049 += 0.05f; //0.05 not a prob - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num1048 += 2f; //2 not a prob - num1049 += 0.1f; //0.1 not a prob - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1048 += 3f; - num1049 += 0.2f; - } - if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) - { - npc.velocity.Y = npc.velocity.Y + num1049; - } - else - { - npc.velocity.Y = npc.velocity.Y - num1049; - } - if (npc.velocity.Y < -12f) - { - npc.velocity.Y = -num1048; - } - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = num1048; - } - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - { - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; - } - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - { - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; - } - else - { - npc.velocity.X = npc.velocity.X * 0.8f; - } - if (npc.velocity.X < -16f) - { - npc.velocity.X = -16f; - } - if (npc.velocity.X > 16f) - { - npc.velocity.X = 16f; - } - npc.spriteDirection = npc.direction; - } - else - { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - int num1050 = sirenAlive ? 1100 : 900; //600 not a prob - int num1051 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - { - num1051 = -1; - } - if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) - { - npc.ai[2] = 1f; - } - if (npc.ai[2] != 1f) - { - return; - } - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.velocity *= 0.9f; - float num1052 = revenge ? 0.11f : 0.1f; //0.1 - if (npc.life < npc.lifeMax / 3 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; //0.05 - } - if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; //0.05 - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - } - } - } - } - } - - 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) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 3f); - 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, 5, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib1"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib3"), 1f); - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } - - public override void NPCLoot() - { - bool hardMode = Main.hardMode; - int bossAlive = mod.NPCType("Siren"); - if (!NPC.AnyNPCs(bossAlive)) - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeviathanTrophy")); //done - } - 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("EnchantedPearl")); //done - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HotlineFishingHook); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BottomlessBucket); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SuperAbsorbantSponge); - } - 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(5, 9)); - } - 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(5, 9)); - } - 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(5, 9)); - } - if (!hardMode) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("IOU"), 1, true); - } - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeviathanMask")); //done - } - if (hardMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Atlantis")); //done - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrackishFlask")); //done - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Leviatitan")); //done - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LureofEnthrallment")); //done - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SirensSong")); //done - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Greentide")); //done - } - } - } - } - else - { - npc.value = 0f; - npc.boss = false; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Wet, 240, true); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = Main.npcTexture[npc.type]; - Texture2D texture2 = mod.GetTexture("NPCs/Leviathan/LeviathanTexTwo"); - Texture2D texture3 = mod.GetTexture("NPCs/Leviathan/LeviathanAltTexOne"); - Texture2D texture4 = mod.GetTexture("NPCs/Leviathan/LeviathanAltTexTwo"); - if (npc.ai[0] == 1f) - { - if (!altTextureSwap) - { - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor, true); - } - } - else - { - if (!altTextureSwap) - { - CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor, true); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture4, 0, npc, drawColor, true); - } - } - return false; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - altTextureSwap = !altTextureSwap; - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Leviathan +{ + [AutoloadBossHead] + public class Leviathan : ModNPC + { + private bool altTextureSwap = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Leviathan"); + Main.npcFrameCount[npc.type] = 3; + } + + public override void SetDefaults() + { + npc.npcSlots = 20f; + npc.damage = 90; + npc.width = 850; + npc.height = 450; + npc.defense = 40; + npc.lifeMax = CalamityWorld.revenge ? 90700 : 69000; + if (CalamityWorld.death) + { + npc.lifeMax = 189750; + } + if (CalamityWorld.bossRushActive) + { + 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; + 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[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; + npc.noGravity = true; + npc.boss = true; + npc.netAlways = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); + else + music = MusicID.Boss3; + bossBag = mod.ItemType("LeviathanBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(altTextureSwap); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + altTextureSwap = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void AI() + { + CalamityGlobalNPC.leviathan = npc.whoAmI; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Vector2 vector = npc.Center; + Player player = Main.player[npc.target]; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + bool sirenAlive = false; + if (CalamityGlobalNPC.siren != -1) + { + sirenAlive = Main.npc[CalamityGlobalNPC.siren].active; + } + int soundChoice = Main.rand.Next(3); + int soundChoiceRage = 92; + if (soundChoice == 0) + { + soundChoice = 38; + } + else if (soundChoice == 1) + { + soundChoice = 39; + } + else + { + soundChoice = 40; + } + if (Main.rand.Next(600) == 0) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, + ((sirenAlive && !CalamityWorld.death && !CalamityWorld.bossRushActive) ? soundChoice : soundChoiceRage)); + } + 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 = 80; + } + else + { + npc.defense = 40; + } + npc.dontTakeDamage = flag6 && !CalamityWorld.bossRushActive; + int num1038 = 0; + for (int num1039 = 0; num1039 < 255; num1039++) + { + if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) + { + num1038++; + } + } + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + { + npc.velocity = new Vector2(0f, 10f); + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int x = 0; x < 200; x++) + { + if (Main.npc[x].type == mod.NPCType("Siren")) + { + Main.npc[x].active = false; + Main.npc[x].netUpdate = true; + } + } + npc.active = false; + npc.netUpdate = true; + } + return; + } + } + else + { + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + float num412 = sirenAlive ? 3.5f : 7f; + float num413 = sirenAlive ? 0.1f : 0.2f; + if (CalamityWorld.bossRushActive) + { + num412 = 12f; + num413 = 0.4f; + } + int num414 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num414 = -1; + } + Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 800) - vector40.X; + float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num412 / num417; + num415 *= num417; + num416 *= num417; + if (npc.velocity.X < num415) + { + npc.velocity.X = npc.velocity.X + num413; + if (npc.velocity.X < 0f && num415 > 0f) + { + npc.velocity.X = npc.velocity.X + num413; + } + } + else if (npc.velocity.X > num415) + { + npc.velocity.X = npc.velocity.X - num413; + if (npc.velocity.X > 0f && num415 < 0f) + { + npc.velocity.X = npc.velocity.X - num413; + } + } + if (npc.velocity.Y < num416) + { + npc.velocity.Y = npc.velocity.Y + num413; + if (npc.velocity.Y < 0f && num416 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num413; + } + } + else if (npc.velocity.Y > num416) + { + npc.velocity.Y = npc.velocity.Y - num413; + if (npc.velocity.Y > 0f && num416 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num413; + } + } + npc.ai[1] += 1f; + if (npc.ai[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 120f : 240f)) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.target = 255; + npc.netUpdate = true; + } + else + { + if (!player.dead) + { + npc.ai[2] += 1.5f; + if (!sirenAlive) + npc.ai[2] += 2.5f; + } + if (npc.ai[2] >= 90f) + { + npc.ai[2] = 0f; + vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num415 = player.position.X + (float)(player.width / 2) - vector40.X; + num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + if (Main.netMode != 1) + { + float num418 = sirenAlive ? 13.5f : 16f; + int num419 = 48; + int num420 = mod.ProjectileType("LeviathanBomb"); + if (expertMode) + { + num418 = sirenAlive ? 14f : 17f; + num419 = 33; + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num418 = 22f; + } + num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num418 / num417; + num415 *= num417; + num416 *= num417; + num415 += (float)Main.rand.Next(-5, 6) * 0.05f; + num416 += (float)Main.rand.Next(-5, 6) * 0.05f; + vector40.X += num415 * 4f; + vector40.Y += num416 * 4f; + Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else if (npc.ai[0] == 1f) + { + npc.TargetClosest(true); + Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + npc.ai[1] += (revenge ? 2f : 1f); + npc.ai[1] += (float)(num1038 / 2); + if (!sirenAlive || CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.ai[1] += 2.5f; + } + bool flag103 = false; + int spawnLimit = sirenAlive ? 2 : 4; + int spawnLimit2 = sirenAlive ? 5 : 10; + if (npc.ai[1] > 80f) //changed from 40 not a prob + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + flag103 = true; + } + if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoice); + if (Main.netMode != 1 && NPC.CountNPCS(mod.NPCType("Parasea")) < spawnLimit2 && NPC.CountNPCS(mod.NPCType("AquaticAberration")) < spawnLimit) + { + int num1061; + int value = CalamityWorld.death ? 2 : 3; + if (CalamityWorld.bossRushActive) + value++; + if (Main.rand.Next(value) == 0) + { + num1061 = mod.NPCType("AquaticAberration"); + } + else + { + num1061 = mod.NPCType("Parasea"); + } + 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.01f; + Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.01f; + 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)) + { + float num1063 = sirenAlive ? 7f : 8f; //changed from 14 not a prob + float num1064 = sirenAlive ? 0.05f : 0.065f; //changed from 0.1 not a prob + if (CalamityWorld.bossRushActive) + { + num1063 = 10f; + num1064 = 0.075f; + } + vector120 = vector119; + num1058 = player.position.X + (float)(player.width / 2) - vector120.X; + num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; + num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + num1060 = num1063 / num1060; + if (npc.velocity.X < num1058) + { + npc.velocity.X = npc.velocity.X + num1064; + if (npc.velocity.X < 0f && num1058 > 0f) + { + npc.velocity.X = npc.velocity.X + num1064; + } + } + else if (npc.velocity.X > num1058) + { + npc.velocity.X = npc.velocity.X - num1064; + if (npc.velocity.X > 0f && num1058 < 0f) + { + npc.velocity.X = npc.velocity.X - num1064; + } + } + if (npc.velocity.Y < num1059) + { + npc.velocity.Y = npc.velocity.Y + num1064; + if (npc.velocity.Y < 0f && num1059 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1064; + } + } + else if (npc.velocity.Y > num1059) + { + npc.velocity.Y = npc.velocity.Y - num1064; + if (npc.velocity.Y > 0f && num1059 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1064; + } + } + } + else + { + npc.velocity *= 0.9f; + } + npc.spriteDirection = npc.direction; + if (npc.ai[2] > 3f) + { + npc.ai[0] = ((double)npc.life < (double)npc.lifeMax * 0.5 ? 2f : 0f); + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + Vector2 distFromPlayer = Main.player[npc.target].Center - npc.Center; + if (npc.ai[1] > 1f || distFromPlayer.Length() > 2400f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + if (npc.ai[1] % 2f == 0f) + { + int num24 = 7; + for (int j = 0; j < num24; j++) + { + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)((float)num24), default(Vector2)) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num25].noGravity = true; + Main.dust[num25].noLight = true; + Main.dust[num25].velocity /= 4f; + Main.dust[num25].velocity -= npc.velocity; + } + npc.TargetClosest(true); + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) + { + npc.ai[1] += 1f; + npc.ai[2] = 0f; + float num1044 = revenge ? 20f : 18f; //16 + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num1044 += 2f; //2 not a prob + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num1044 += 2f; //2 not a prob + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1044 += 4f; + } + Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; + float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; + float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + num1047 = num1044 / num1047; + npc.velocity.X = num1045 * num1047; + npc.velocity.Y = num1046 * num1047; + npc.spriteDirection = npc.direction; + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoiceRage); + return; + } + float num1048 = revenge ? 7.5f : 6.5f; //12 not a prob + float num1049 = revenge ? 0.12f : 0.11f; //0.15 not a prob + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num1048 += 2f; //2 not a prob + num1049 += 0.05f; //0.05 not a prob + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num1048 += 2f; //2 not a prob + num1049 += 0.1f; //0.1 not a prob + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1048 += 3f; + num1049 += 0.2f; + } + if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) + { + npc.velocity.Y = npc.velocity.Y + num1049; + } + else + { + npc.velocity.Y = npc.velocity.Y - num1049; + } + if (npc.velocity.Y < -12f) + { + npc.velocity.Y = -num1048; + } + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = num1048; + } + if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + { + npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + } + else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + { + npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + } + else + { + npc.velocity.X = npc.velocity.X * 0.8f; + } + if (npc.velocity.X < -16f) + { + npc.velocity.X = -16f; + } + if (npc.velocity.X > 16f) + { + npc.velocity.X = 16f; + } + npc.spriteDirection = npc.direction; + } + else + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + int num1050 = sirenAlive ? 1100 : 900; //600 not a prob + int num1051 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + { + num1051 = -1; + } + if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) + { + npc.ai[2] = 1f; + } + if (npc.ai[2] != 1f) + { + return; + } + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + npc.velocity *= 0.9f; + float num1052 = revenge ? 0.11f : 0.1f; //0.1 + if (npc.life < npc.lifeMax / 3 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; //0.05 + } + if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; //0.05 + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + } + } + } + } + } + + 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) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 3f); + 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, 5, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib1"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib3"), 1f); + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } + + public override void NPCLoot() + { + bool hardMode = Main.hardMode; + int bossAlive = mod.NPCType("Siren"); + if (!NPC.AnyNPCs(bossAlive)) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeviathanTrophy")); //done + } + 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("EnchantedPearl")); //done + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HotlineFishingHook); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BottomlessBucket); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SuperAbsorbantSponge); + } + 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(5, 9)); + } + 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(5, 9)); + } + 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(5, 9)); + } + if (!hardMode) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("IOU"), 1, true); + } + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeviathanMask")); //done + } + if (hardMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Atlantis")); //done + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrackishFlask")); //done + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Leviatitan")); //done + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LureofEnthrallment")); //done + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SirensSong")); //done + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Greentide")); //done + } + } + } + } + else + { + npc.value = 0f; + npc.boss = false; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Wet, 240, true); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = Main.npcTexture[npc.type]; + Texture2D texture2 = mod.GetTexture("NPCs/Leviathan/LeviathanTexTwo"); + Texture2D texture3 = mod.GetTexture("NPCs/Leviathan/LeviathanAltTexOne"); + Texture2D texture4 = mod.GetTexture("NPCs/Leviathan/LeviathanAltTexTwo"); + if (npc.ai[0] == 1f) + { + if (!altTextureSwap) + { + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); + } + else + { + CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor, true); + } + } + else + { + if (!altTextureSwap) + { + CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor, true); + } + else + { + CalamityMod.DrawTexture(spriteBatch, texture4, 0, npc, drawColor, true); + } + } + return false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + altTextureSwap = !altTextureSwap; + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 4d08801066..1d4823cdcb 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -1,120 +1,120 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Leviathan -{ - public class LeviathanStart : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("???"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 70; //324 - npc.height = 70; //216 - npc.defense = 0; - npc.lifeMax = 3000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit1; - npc.rarity = 2; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SirenLure"); - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override void AI() - { - npc.TargetClosest(true); - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.55f, 0.25f, 0f); - for (int num569 = 0; num569 < 200; num569++) - { - if (Main.npc[num569].active && Main.npc[num569].boss) - { - npc.active = false; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || - NPC.AnyNPCs(NPCID.DukeFishron) || - NPC.AnyNPCs(mod.NPCType("LeviathanStart")) || - NPC.AnyNPCs(mod.NPCType("Siren")) || - NPC.AnyNPCs(mod.NPCType("Leviathan")) || - spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - if (!Main.hardMode) - { - return SpawnCondition.OceanMonster.Chance * 0.025f; - } - if (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas) - { - return SpawnCondition.OceanMonster.Chance * 0.1f; - } - return SpawnCondition.OceanMonster.Chance * 0.4f; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 3000; - npc.damage = 0; - } - - public override void NPCLoot() - { - if (CalamityWorld.revenge && Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, (Main.rand.Next(2) == 0 ? mod.ItemType("SirensHeart") : mod.ItemType("SirensHeartAlt"))); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life > 0) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - else - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - if (Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("Siren"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Leviathan +{ + public class LeviathanStart : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("???"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 70; //324 + npc.height = 70; //216 + npc.defense = 0; + npc.lifeMax = 3000; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit1; + npc.rarity = 2; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SirenLure"); + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.1f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override void AI() + { + npc.TargetClosest(true); + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.55f, 0.25f, 0f); + for (int num569 = 0; num569 < 200; num569++) + { + if (Main.npc[num569].active && Main.npc[num569].boss) + { + npc.active = false; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || + NPC.AnyNPCs(NPCID.DukeFishron) || + NPC.AnyNPCs(mod.NPCType("LeviathanStart")) || + NPC.AnyNPCs(mod.NPCType("Siren")) || + NPC.AnyNPCs(mod.NPCType("Leviathan")) || + spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + if (!Main.hardMode) + { + return SpawnCondition.OceanMonster.Chance * 0.025f; + } + if (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas) + { + return SpawnCondition.OceanMonster.Chance * 0.1f; + } + return SpawnCondition.OceanMonster.Chance * 0.4f; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 3000; + npc.damage = 0; + } + + public override void NPCLoot() + { + if (CalamityWorld.revenge && Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, (Main.rand.Next(2) == 0 ? mod.ItemType("SirensHeart") : mod.ItemType("SirensHeartAlt"))); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life > 0) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + else + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + if (Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("Siren"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } + } +} diff --git a/NPCs/Leviathan/Parasea.cs b/NPCs/Leviathan/Parasea.cs index 7cafd7b7a9..9a4bbdd1f9 100644 --- a/NPCs/Leviathan/Parasea.cs +++ b/NPCs/Leviathan/Parasea.cs @@ -1,96 +1,96 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Leviathan -{ - public class Parasea : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Parasea"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.damage = 45; - npc.width = 90; //324 - npc.height = 20; //216 - npc.defense = 9; - npc.lifeMax = 650; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } - npc.knockBackResist = 0f; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("ParaseaBanner"); - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - if (CalamityGlobalNPC.leviathan < 0 || !Main.npc[CalamityGlobalNPC.leviathan].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.TargetClosest(true); - Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); - 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 ? 16f : 13f; - num1260 = num1261 / num1260; - num1258 *= num1260; - num1259 *= num1260; - npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; - npc.rotation = (float)Math.Atan2((double)num1259, (double)num1258) + 3.14f; //1.57 - } - - 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 OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Wet, 60, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Leviathan +{ + public class Parasea : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Parasea"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.damage = 45; + npc.width = 90; //324 + npc.height = 20; //216 + npc.defense = 9; + npc.lifeMax = 650; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 50000; + } + npc.knockBackResist = 0f; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("ParaseaBanner"); + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.leviathan < 0 || !Main.npc[CalamityGlobalNPC.leviathan].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.TargetClosest(true); + Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); + 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 ? 16f : 13f; + num1260 = num1261 / num1260; + num1258 *= num1260; + num1259 *= num1260; + npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; + npc.rotation = (float)Math.Atan2((double)num1259, (double)num1258) + 3.14f; //1.57 + } + + 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 OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Wet, 60, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 33084e4736..b6f84804e0 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -1,957 +1,957 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Leviathan -{ - [AutoloadBossHead] - public class Siren : ModNPC - { - private bool spawnedLevi = false; - private bool secondClone = false; - private int phaseSwitch = 0; - private int chargeSwitch = 0; - private int frameUsed = 0; - private double anotherFloat = 0.0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Siren"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 70; //150 - npc.npcSlots = 16f; - npc.width = 100; //324 - npc.height = 100; //216 - npc.defense = 25; - npc.lifeMax = CalamityWorld.revenge ? 41600 : 27400; - if (CalamityWorld.death) - { - npc.lifeMax = 58650; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.boss = true; - 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("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; - npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Siren"); - else - music = MusicID.Boss3; - bossBag = mod.ItemType("LeviathanBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(spawnedLevi); - writer.Write(secondClone); - writer.Write(phaseSwitch); - writer.Write(chargeSwitch); - writer.Write(anotherFloat); - writer.Write(frameUsed); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - spawnedLevi = reader.ReadBoolean(); - secondClone = reader.ReadBoolean(); - phaseSwitch = reader.ReadInt32(); - chargeSwitch = reader.ReadInt32(); - anotherFloat = reader.ReadDouble(); - frameUsed = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override void AI() - { - CalamityGlobalNPC.siren = npc.whoAmI; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.3f); - Player player = Main.player[npc.target]; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool playerWet = player.wet; - float num998 = 8f; - float scaleFactor3 = 300f; - float num999 = 800f; - float num1001 = 5f; - float scaleFactor4 = 0.8f; - int num1002 = 0; - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1006 = 0.333333343f; - 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)); - bool halfLife = (double)npc.life <= (double)npc.lifeMax * 0.5; - bool leviAlive = false; - if (CalamityGlobalNPC.leviathan != -1) - { - leviAlive = Main.npc[CalamityGlobalNPC.leviathan].active; - } - 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) - { - if (!spawnedLevi) - { - if (revenge) - { - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, mod.NPCType("SirenClone")); - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); - else - music = MusicID.Boss3; - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Leviathan")); - spawnedLevi = true; - } - } - double defenseMult = halfLife ? 2.0 : 1.5; - if ((!leviAlive && halfLife) || CalamityWorld.death) - { - npc.defense = (int)(25.0 * defenseMult); - } - else - { - npc.defense = 25; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.25 && Main.netMode != 1) - { - if (!secondClone) - { - if (revenge) - { - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, mod.NPCType("SirenClone")); - } - secondClone = true; - } - } - if (npc.ai[3] == 0f && npc.localAI[1] == 0f && Main.netMode != 1) - { - int num6 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SirenIce"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - npc.ai[3] = (float)(num6 + 1); - npc.localAI[1] = -1f; - npc.netUpdate = true; - Main.npc[num6].ai[0] = (float)npc.whoAmI; - Main.npc[num6].netUpdate = true; - } - int num7 = (int)npc.ai[3] - 1; - if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == mod.NPCType("SirenIce")) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive; - npc.ai[3] = 0f; - if (npc.localAI[1] == -1f) - { - npc.localAI[1] = revenge ? 600f : 1200f; - } - if (npc.localAI[1] > 0f) - { - npc.localAI[1] -= 1f; - } - } - if (isNotOcean) - { - npc.alpha += 3; - if (npc.alpha >= 150) - { - npc.alpha = 150; - } - } - else - { - npc.alpha -= 5; - if (npc.alpha <= 0) - { - npc.alpha = 0; - } - } - if (Main.rand.Next(300) == 0) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 35); - } - int num1038 = 0; - for (int num1039 = 0; num1039 < 255; num1039++) - { - if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) - { - num1038++; - } - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - } - else if (npc.ai[0] == -1f) - { - int random = ((double)npc.life <= (double)npc.lifeMax * 0.5) ? 3 : 2; - int num871 = Main.rand.Next(random); - if (num871 == 0) - { - num871 = 0; - } - else if (num871 == 1) - { - num871 = 2; - } - else - { - num871 = 3; - } - npc.ai[0] = (float)num871; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - return; - } - else if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - npc.rotation = npc.velocity.X * 0.02f; - npc.spriteDirection = npc.direction; - float num1053 = 9f; - float num1054 = 0.15f; - float num10542 = 0.05f; - Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1055 = player.position.X + (float)(player.width / 2) - vector118.X; - float num1056 = player.position.Y + (float)(player.height / 2) - 200f - vector118.Y; - float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); - if (num1057 < 600f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return; - } - num1057 = num1053 / num1057; - if (npc.velocity.X < num1055) - { - npc.velocity.X = npc.velocity.X + num1054; - if (npc.velocity.X < 0f && num1055 > 0f) - { - npc.velocity.X = npc.velocity.X + num1054; - } - } - else if (npc.velocity.X > num1055) - { - npc.velocity.X = npc.velocity.X - num1054; - if (npc.velocity.X > 0f && num1055 < 0f) - { - npc.velocity.X = npc.velocity.X - num1054; - } - } - if (npc.velocity.Y < num1056) - { - npc.velocity.Y = npc.velocity.Y + num10542; - if (npc.velocity.Y < 0f && num1056 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10542; - } - } - else if (npc.velocity.Y > num1056) - { - npc.velocity.Y = npc.velocity.Y - num10542; - if (npc.velocity.Y > 0f && num1056 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10542; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.rotation = npc.velocity.X * 0.02f; - npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = player.position.X + (float)(player.width / 2) - vector120.X; - float num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - npc.ai[1] += 1f; - npc.ai[1] += (float)(num1038 / 2); - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 0.25f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 0.25f; - } - bool flag103 = false; - if (npc.ai[1] > 20f) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - flag103 = true; - } - if (Collision.CanHit(vector119, 1, 1, player.position, player.width, player.height) && flag103) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 85); - if (Main.netMode != 1) - { - int num1061 = 371; - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y - 30, num1061, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * 0.01f; - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.01f; - Main.npc[num1062].localAI[0] = 60f; - Main.npc[num1062].netUpdate = true; - Main.npc[num1062].damage = leviAlive ? 100 : 140; - } - } - if (num1060 > 600f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, player.position, player.width, player.height)) - { - float num1063 = 14f; - float num1064 = 0.15f; - float num10642 = 0.05f; - vector120 = vector119; - num1058 = player.position.X + (float)(player.width / 2) - vector120.X; - num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; - num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - num1060 = num1063 / num1060; - if (npc.velocity.X < num1058) - { - npc.velocity.X = npc.velocity.X + num1064; - if (npc.velocity.X < 0f && num1058 > 0f) - { - npc.velocity.X = npc.velocity.X + num1064; - } - } - else if (npc.velocity.X > num1058) - { - npc.velocity.X = npc.velocity.X - num1064; - if (npc.velocity.X > 0f && num1058 < 0f) - { - npc.velocity.X = npc.velocity.X - num1064; - } - } - if (npc.velocity.Y < num1059) - { - npc.velocity.Y = npc.velocity.Y + num10642; - if (npc.velocity.Y < 0f && num1059 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10642; - } - } - else if (npc.velocity.Y > num1059) - { - npc.velocity.Y = npc.velocity.Y - num10642; - if (npc.velocity.Y > 0f && num1059 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10642; - } - } - } - else - { - npc.velocity *= 0.9f; - } - npc.spriteDirection = npc.direction; - if (npc.ai[2] > 4f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.rotation = npc.velocity.X * 0.02f; - 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - if (npc.ai[1] % 10f == 9f) - { - flag104 = true; - } - } - else - { - if (((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.death) && !leviAlive) - { - if (npc.ai[1] % 20f == 19f) - { - flag104 = true; - } - } - else if (halfLife) - { - if (npc.ai[1] % 25f == 24f) - { - flag104 = true; - } - } - else if (npc.ai[1] % 30f == 29f) - { - flag104 = true; - } - } - if (flag104 && (npc.position.Y + (float)npc.height < player.position.Y || (!leviAlive && halfLife)) && Collision.CanHit(vector121, 1, 1, player.position, player.width, player.height)) - { - if (Main.netMode != 1) - { - float num1070 = revenge ? 13f : 11f; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1070 = 24f; - } - else if (isNotOcean || (!leviAlive && halfLife) || CalamityWorld.death || CalamityWorld.bossRushActive) - { - num1070 = revenge ? 19f : 18f; - } - else if (!playerWet) - { - num1070 = revenge ? 16f : 15f; - } - else - { - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num1070 += 2f; - } - } - float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X + (float)Main.rand.Next(-80, 81); - float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y + (float)Main.rand.Next(-40, 41); - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); - num1073 = num1070 / num1073; - num1071 *= num1073; - num1072 *= num1073; - int num1074 = expertMode ? 26 : 32; - int num1075 = mod.ProjectileType("WaterSpear"); - switch (Main.rand.Next(6)) - { - case 0: num1075 = mod.ProjectileType("SirenSong"); break; - case 1: num1075 = mod.ProjectileType("FrostMist"); break; - case 2: - case 3: - case 4: - case 5: num1075 = mod.ProjectileType("WaterSpear"); break; - } - if (isNotOcean) - { - num1074 *= 2; - } - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); - } - } - if (npc.position.Y > player.position.Y - 200f) //200 - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.985f; - } - npc.velocity.Y = npc.velocity.Y - 0.1f; - if (npc.velocity.Y > 2f) - { - npc.velocity.Y = 2f; - } - } - else if (npc.position.Y < player.position.Y - 500f) //500 - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.985f; - } - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y < -2f) - { - npc.velocity.Y = -2f; - } - } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > 8f) - { - npc.velocity.X = 8f; - } - } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -8f) - { - npc.velocity.X = -8f; - } - } - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - if (npc.ai[1] > 300f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - npc.TargetClosest(false); - npc.rotation = npc.velocity.ToRotation(); - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - if (npc.rotation < -1.57079637f) - { - npc.rotation += 3.14159274f; - } - if (npc.rotation > 1.57079637f) - { - npc.rotation -= 3.14159274f; - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - phaseSwitch += 1; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - phaseSwitch += 1; - } - if (chargeSwitch == 0) //line up the charge - { - float scaleFactor6 = num998; - Vector2 center4 = npc.Center; - Vector2 center5 = player.Center; - Vector2 vector126 = center5 - center4; - Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; - float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); - if (anotherFloat >= 120.0) - { - flag64 = true; - } - float num1014 = 8f; - 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) / chargeSpeedDivisor; - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / chargeSpeedDivisor; - if (!flag64) - { - anotherFloat += 1.0; - if (anotherFloat == 120.0) - { - npc.netUpdate = true; - } - } - else - { - anotherFloat = 0.0; - } - } - else - { - chargeSwitch = 1; - npc.ai[2] = vector126.X; - anotherFloat = (double)vector126.Y; - npc.netUpdate = true; - } - } - else if (chargeSwitch == 1) //pause before charging - { - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - chargeSwitch = 2; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], (float)anotherFloat) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; - velocity.Normalize(); - velocity *= scaleFactor5; - npc.velocity = velocity; - } - } - else if (chargeSwitch == 2) //charging - { - float num1016 = num1003; - npc.ai[1] += 1f; - bool flag65 = Vector2.Distance(npc.Center, player.Center) > num1004 && npc.Center.Y > player.Center.Y; - if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) - { - chargeSwitch = 0; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - anotherFloat = 0.0; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - chargeSwitch = 3; - } - else - { - Vector2 center6 = npc.Center; - Vector2 center7 = player.Center; - Vector2 vec2 = center7 - center6; - vec2.Normalize(); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; - } - } - else if (chargeSwitch == 3) //slow down after charging and reset - { - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) - { - chargeSwitch = 0; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.98f; - } - if (phaseSwitch > 300) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - anotherFloat = 0.0; - chargeSwitch = 0; - phaseSwitch = 0; - npc.netUpdate = true; - } - } - if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) - { - if (npc.localAI[3] < 120f) - { - npc.localAI[3] += 1f; - } - if (npc.localAI[3] > 60f) - { - npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.25f; - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int x = 0; x < 200; x++) - { - if (Main.npc[x].type == mod.NPCType("Leviathan")) - { - Main.npc[x].active = false; - Main.npc[x].netUpdate = true; - } - } - npc.active = false; - npc.netUpdate = true; - } - } - return; - } - if (npc.localAI[3] > 0f) - { - npc.localAI[3] -= 1f; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren5"), 1f); - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) //2 total states (ice shield or no ice shield) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = Main.npcTexture[npc.type]; - if (npc.dontTakeDamage) - { - switch (frameUsed) - { - case 0: - texture = mod.GetTexture("NPCs/Leviathan/SirenAlt"); - break; - case 1: - texture = mod.GetTexture("NPCs/Leviathan/SirenAltSinging"); - break; - case 2: - texture = mod.GetTexture("NPCs/Leviathan/SirenAltStabbing"); - break; - } - } - else - { - switch (frameUsed) - { - case 0: - texture = Main.npcTexture[npc.type]; - break; - case 1: - texture = mod.GetTexture("NPCs/Leviathan/SirenSinging"); - break; - case 2: - texture = mod.GetTexture("NPCs/Leviathan/SirenStabbing"); - break; - } - } - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - if (npc.ai[0] == 3f) - { - int width = 106; - Vector2 vector = new Vector2((float)(width / 2), (float)(texture.Height / Main.npcFrameCount[npc.type] / 2)); - Microsoft.Xna.Framework.Rectangle frame = new Rectangle(0, 0, width, texture.Height / Main.npcFrameCount[npc.type]); - frame.Y = 146 * (int)(npc.frameCounter / 12.0); //1 to 6 - if (frame.Y >= 146 * 6) - { - frame.Y = 0; - } - Main.spriteBatch.Draw(texture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + vector.X * npc.scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)texture.Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector.Y * npc.scale + 0f + npc.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(frame), - npc.GetAlpha(drawColor), - npc.rotation, - vector, - npc.scale, - spriteEffects, - 0f); - return false; - } - Microsoft.Xna.Framework.Rectangle frame2 = npc.frame; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Main.spriteBatch.Draw(texture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + 0f + npc.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(frame2), - npc.GetAlpha(drawColor), - npc.rotation, - vector11, - npc.scale, - spriteEffects, - 0f); - return false; - } - - public override void FindFrame(int frameHeight) //6 total frames, 3 total texture types - { - if (npc.ai[0] == 2f) - { - frameUsed = 0; - } - else if (npc.ai[0] <= 1f) - { - frameUsed = 1; - } - else - { - frameUsed = 2; - } - npc.frameCounter += 1.0; - if (npc.ai[0] == 4f) - { - if (npc.frameCounter > 72.0) - { - npc.frameCounter = 0.0; - } - } - else - { - int frameY = 146; - if (npc.frameCounter > 72.0) - { - npc.frameCounter = 0.0; - } - npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } - - public override void NPCLoot() - { - bool hardMode = Main.hardMode; - int bossAlive = mod.NPCType("Leviathan"); - if (!NPC.AnyNPCs(bossAlive)) - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeviathanTrophy")); //done - } - 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("EnchantedPearl")); //done - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HotlineFishingHook); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BottomlessBucket); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SuperAbsorbantSponge); - } - 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(5, 9)); - } - 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(5, 9)); - } - 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(5, 9)); - } - if (!hardMode) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("IOU"), 1, true); - } - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeviathanMask")); //done - } - if (hardMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Atlantis")); //done - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrackishFlask")); //done - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Leviatitan")); //done - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LureofEnthrallment")); //done - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SirensSong")); //done - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Greentide")); //done - } - } - } - } - else - { - npc.value = 0f; - npc.boss = false; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Wet, 120, true); - } - - public override bool CheckActive() - { - 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); - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Leviathan +{ + [AutoloadBossHead] + public class Siren : ModNPC + { + private bool spawnedLevi = false; + private bool secondClone = false; + private int phaseSwitch = 0; + private int chargeSwitch = 0; + private int frameUsed = 0; + private double anotherFloat = 0.0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Siren"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 70; //150 + npc.npcSlots = 16f; + npc.width = 100; //324 + npc.height = 100; //216 + npc.defense = 25; + npc.lifeMax = CalamityWorld.revenge ? 41600 : 27400; + if (CalamityWorld.death) + { + npc.lifeMax = 58650; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.boss = true; + 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("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; + npc.DeathSound = SoundID.NPCDeath1; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Siren"); + else + music = MusicID.Boss3; + bossBag = mod.ItemType("LeviathanBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(spawnedLevi); + writer.Write(secondClone); + writer.Write(phaseSwitch); + writer.Write(chargeSwitch); + writer.Write(anotherFloat); + writer.Write(frameUsed); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + spawnedLevi = reader.ReadBoolean(); + secondClone = reader.ReadBoolean(); + phaseSwitch = reader.ReadInt32(); + chargeSwitch = reader.ReadInt32(); + anotherFloat = reader.ReadDouble(); + frameUsed = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void AI() + { + CalamityGlobalNPC.siren = npc.whoAmI; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.3f); + Player player = Main.player[npc.target]; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool playerWet = player.wet; + float num998 = 8f; + float scaleFactor3 = 300f; + float num999 = 800f; + float num1001 = 5f; + float scaleFactor4 = 0.8f; + int num1002 = 0; + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1006 = 0.333333343f; + 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)); + bool halfLife = (double)npc.life <= (double)npc.lifeMax * 0.5; + bool leviAlive = false; + if (CalamityGlobalNPC.leviathan != -1) + { + leviAlive = Main.npc[CalamityGlobalNPC.leviathan].active; + } + 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) + { + if (!spawnedLevi) + { + if (revenge) + { + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, mod.NPCType("SirenClone")); + } + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); + else + music = MusicID.Boss3; + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Leviathan")); + spawnedLevi = true; + } + } + double defenseMult = halfLife ? 2.0 : 1.5; + if ((!leviAlive && halfLife) || CalamityWorld.death) + { + npc.defense = (int)(25.0 * defenseMult); + } + else + { + npc.defense = 25; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.25 && Main.netMode != 1) + { + if (!secondClone) + { + if (revenge) + { + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, mod.NPCType("SirenClone")); + } + secondClone = true; + } + } + if (npc.ai[3] == 0f && npc.localAI[1] == 0f && Main.netMode != 1) + { + int num6 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SirenIce"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + npc.ai[3] = (float)(num6 + 1); + npc.localAI[1] = -1f; + npc.netUpdate = true; + Main.npc[num6].ai[0] = (float)npc.whoAmI; + Main.npc[num6].netUpdate = true; + } + int num7 = (int)npc.ai[3] - 1; + if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == mod.NPCType("SirenIce")) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive; + npc.ai[3] = 0f; + if (npc.localAI[1] == -1f) + { + npc.localAI[1] = revenge ? 600f : 1200f; + } + if (npc.localAI[1] > 0f) + { + npc.localAI[1] -= 1f; + } + } + if (isNotOcean) + { + npc.alpha += 3; + if (npc.alpha >= 150) + { + npc.alpha = 150; + } + } + else + { + npc.alpha -= 5; + if (npc.alpha <= 0) + { + npc.alpha = 0; + } + } + if (Main.rand.Next(300) == 0) + { + Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 35); + } + int num1038 = 0; + for (int num1039 = 0; num1039 < 255; num1039++) + { + if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) + { + num1038++; + } + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + } + else if (npc.ai[0] == -1f) + { + int random = ((double)npc.life <= (double)npc.lifeMax * 0.5) ? 3 : 2; + int num871 = Main.rand.Next(random); + if (num871 == 0) + { + num871 = 0; + } + else if (num871 == 1) + { + num871 = 2; + } + else + { + num871 = 3; + } + npc.ai[0] = (float)num871; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + return; + } + else if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + npc.rotation = npc.velocity.X * 0.02f; + npc.spriteDirection = npc.direction; + float num1053 = 9f; + float num1054 = 0.15f; + float num10542 = 0.05f; + Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1055 = player.position.X + (float)(player.width / 2) - vector118.X; + float num1056 = player.position.Y + (float)(player.height / 2) - 200f - vector118.Y; + float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); + if (num1057 < 600f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + return; + } + num1057 = num1053 / num1057; + if (npc.velocity.X < num1055) + { + npc.velocity.X = npc.velocity.X + num1054; + if (npc.velocity.X < 0f && num1055 > 0f) + { + npc.velocity.X = npc.velocity.X + num1054; + } + } + else if (npc.velocity.X > num1055) + { + npc.velocity.X = npc.velocity.X - num1054; + if (npc.velocity.X > 0f && num1055 < 0f) + { + npc.velocity.X = npc.velocity.X - num1054; + } + } + if (npc.velocity.Y < num1056) + { + npc.velocity.Y = npc.velocity.Y + num10542; + if (npc.velocity.Y < 0f && num1056 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10542; + } + } + else if (npc.velocity.Y > num1056) + { + npc.velocity.Y = npc.velocity.Y - num10542; + if (npc.velocity.Y > 0f && num1056 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10542; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.rotation = npc.velocity.X * 0.02f; + npc.TargetClosest(true); + Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1058 = player.position.X + (float)(player.width / 2) - vector120.X; + float num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + npc.ai[1] += 1f; + npc.ai[1] += (float)(num1038 / 2); + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 0.25f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 0.25f; + } + bool flag103 = false; + if (npc.ai[1] > 20f) + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + flag103 = true; + } + if (Collision.CanHit(vector119, 1, 1, player.position, player.width, player.height) && flag103) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 85); + if (Main.netMode != 1) + { + int num1061 = 371; + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y - 30, num1061, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * 0.01f; + Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.01f; + Main.npc[num1062].localAI[0] = 60f; + Main.npc[num1062].netUpdate = true; + Main.npc[num1062].damage = leviAlive ? 100 : 140; + } + } + if (num1060 > 600f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, player.position, player.width, player.height)) + { + float num1063 = 14f; + float num1064 = 0.15f; + float num10642 = 0.05f; + vector120 = vector119; + num1058 = player.position.X + (float)(player.width / 2) - vector120.X; + num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; + num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + num1060 = num1063 / num1060; + if (npc.velocity.X < num1058) + { + npc.velocity.X = npc.velocity.X + num1064; + if (npc.velocity.X < 0f && num1058 > 0f) + { + npc.velocity.X = npc.velocity.X + num1064; + } + } + else if (npc.velocity.X > num1058) + { + npc.velocity.X = npc.velocity.X - num1064; + if (npc.velocity.X > 0f && num1058 < 0f) + { + npc.velocity.X = npc.velocity.X - num1064; + } + } + if (npc.velocity.Y < num1059) + { + npc.velocity.Y = npc.velocity.Y + num10642; + if (npc.velocity.Y < 0f && num1059 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10642; + } + } + else if (npc.velocity.Y > num1059) + { + npc.velocity.Y = npc.velocity.Y - num10642; + if (npc.velocity.Y > 0f && num1059 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10642; + } + } + } + else + { + npc.velocity *= 0.9f; + } + npc.spriteDirection = npc.direction; + if (npc.ai[2] > 4f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + npc.rotation = npc.velocity.X * 0.02f; + 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + if (npc.ai[1] % 10f == 9f) + { + flag104 = true; + } + } + else + { + if (((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.death) && !leviAlive) + { + if (npc.ai[1] % 20f == 19f) + { + flag104 = true; + } + } + else if (halfLife) + { + if (npc.ai[1] % 25f == 24f) + { + flag104 = true; + } + } + else if (npc.ai[1] % 30f == 29f) + { + flag104 = true; + } + } + if (flag104 && (npc.position.Y + (float)npc.height < player.position.Y || (!leviAlive && halfLife)) && Collision.CanHit(vector121, 1, 1, player.position, player.width, player.height)) + { + if (Main.netMode != 1) + { + float num1070 = revenge ? 13f : 11f; + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1070 = 24f; + } + else if (isNotOcean || (!leviAlive && halfLife) || CalamityWorld.death || CalamityWorld.bossRushActive) + { + num1070 = revenge ? 19f : 18f; + } + else if (!playerWet) + { + num1070 = revenge ? 16f : 15f; + } + else + { + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num1070 += 2f; + } + } + float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X + (float)Main.rand.Next(-80, 81); + float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y + (float)Main.rand.Next(-40, 41); + float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + num1073 = num1070 / num1073; + num1071 *= num1073; + num1072 *= num1073; + int num1074 = expertMode ? 26 : 32; + int num1075 = mod.ProjectileType("WaterSpear"); + switch (Main.rand.Next(6)) + { + case 0: num1075 = mod.ProjectileType("SirenSong"); break; + case 1: num1075 = mod.ProjectileType("FrostMist"); break; + case 2: + case 3: + case 4: + case 5: num1075 = mod.ProjectileType("WaterSpear"); break; + } + if (isNotOcean) + { + num1074 *= 2; + } + Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); + } + } + if (npc.position.Y > player.position.Y - 200f) //200 + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.985f; + } + npc.velocity.Y = npc.velocity.Y - 0.1f; + if (npc.velocity.Y > 2f) + { + npc.velocity.Y = 2f; + } + } + else if (npc.position.Y < player.position.Y - 500f) //500 + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.985f; + } + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y < -2f) + { + npc.velocity.Y = -2f; + } + } + if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X - 0.1f; + if (npc.velocity.X > 8f) + { + npc.velocity.X = 8f; + } + } + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X + 0.1f; + if (npc.velocity.X < -8f) + { + npc.velocity.X = -8f; + } + } + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + if (npc.ai[1] > 300f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + npc.TargetClosest(false); + npc.rotation = npc.velocity.ToRotation(); + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + if (npc.rotation < -1.57079637f) + { + npc.rotation += 3.14159274f; + } + if (npc.rotation > 1.57079637f) + { + npc.rotation -= 3.14159274f; + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + phaseSwitch += 1; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + phaseSwitch += 1; + } + if (chargeSwitch == 0) //line up the charge + { + float scaleFactor6 = num998; + Vector2 center4 = npc.Center; + Vector2 center5 = player.Center; + Vector2 vector126 = center5 - center4; + Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; + float num1013 = vector126.Length(); + vector126 = Vector2.Normalize(vector126) * scaleFactor6; + vector127 = Vector2.Normalize(vector127) * scaleFactor6; + bool flag64 = Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); + if (anotherFloat >= 120.0) + { + flag64 = true; + } + float num1014 = 8f; + 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) / chargeSpeedDivisor; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / chargeSpeedDivisor; + if (!flag64) + { + anotherFloat += 1.0; + if (anotherFloat == 120.0) + { + npc.netUpdate = true; + } + } + else + { + anotherFloat = 0.0; + } + } + else + { + chargeSwitch = 1; + npc.ai[2] = vector126.X; + anotherFloat = (double)vector126.Y; + npc.netUpdate = true; + } + } + else if (chargeSwitch == 1) //pause before charging + { + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + chargeSwitch = 2; + npc.ai[1] = 0f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], (float)anotherFloat) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; + velocity.Normalize(); + velocity *= scaleFactor5; + npc.velocity = velocity; + } + } + else if (chargeSwitch == 2) //charging + { + float num1016 = num1003; + npc.ai[1] += 1f; + bool flag65 = Vector2.Distance(npc.Center, player.Center) > num1004 && npc.Center.Y > player.Center.Y; + if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) + { + chargeSwitch = 0; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + anotherFloat = 0.0; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + chargeSwitch = 3; + } + else + { + Vector2 center6 = npc.Center; + Vector2 center7 = player.Center; + Vector2 vec2 = center7 - center6; + vec2.Normalize(); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; + } + } + else if (chargeSwitch == 3) //slow down after charging and reset + { + npc.ai[1] -= 1f; + if (npc.ai[1] <= 0f) + { + chargeSwitch = 0; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.98f; + } + if (phaseSwitch > 300) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + anotherFloat = 0.0; + chargeSwitch = 0; + phaseSwitch = 0; + npc.netUpdate = true; + } + } + if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) + { + if (npc.localAI[3] < 120f) + { + npc.localAI[3] += 1f; + } + if (npc.localAI[3] > 60f) + { + npc.velocity.Y = npc.velocity.Y + (npc.localAI[3] - 60f) * 0.25f; + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int x = 0; x < 200; x++) + { + if (Main.npc[x].type == mod.NPCType("Leviathan")) + { + Main.npc[x].active = false; + Main.npc[x].netUpdate = true; + } + } + npc.active = false; + npc.netUpdate = true; + } + } + return; + } + if (npc.localAI[3] > 0f) + { + npc.localAI[3] -= 1f; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren5"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) //2 total states (ice shield or no ice shield) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = Main.npcTexture[npc.type]; + if (npc.dontTakeDamage) + { + switch (frameUsed) + { + case 0: + texture = mod.GetTexture("NPCs/Leviathan/SirenAlt"); + break; + case 1: + texture = mod.GetTexture("NPCs/Leviathan/SirenAltSinging"); + break; + case 2: + texture = mod.GetTexture("NPCs/Leviathan/SirenAltStabbing"); + break; + } + } + else + { + switch (frameUsed) + { + case 0: + texture = Main.npcTexture[npc.type]; + break; + case 1: + texture = mod.GetTexture("NPCs/Leviathan/SirenSinging"); + break; + case 2: + texture = mod.GetTexture("NPCs/Leviathan/SirenStabbing"); + break; + } + } + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + if (npc.ai[0] == 3f) + { + int width = 106; + Vector2 vector = new Vector2((float)(width / 2), (float)(texture.Height / Main.npcFrameCount[npc.type] / 2)); + Microsoft.Xna.Framework.Rectangle frame = new Rectangle(0, 0, width, texture.Height / Main.npcFrameCount[npc.type]); + frame.Y = 146 * (int)(npc.frameCounter / 12.0); //1 to 6 + if (frame.Y >= 146 * 6) + { + frame.Y = 0; + } + Main.spriteBatch.Draw(texture, + new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + vector.X * npc.scale, + npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)texture.Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector.Y * npc.scale + 0f + npc.gfxOffY), + new Microsoft.Xna.Framework.Rectangle?(frame), + npc.GetAlpha(drawColor), + npc.rotation, + vector, + npc.scale, + spriteEffects, + 0f); + return false; + } + Microsoft.Xna.Framework.Rectangle frame2 = npc.frame; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Main.spriteBatch.Draw(texture, + new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, + npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + 0f + npc.gfxOffY), + new Microsoft.Xna.Framework.Rectangle?(frame2), + npc.GetAlpha(drawColor), + npc.rotation, + vector11, + npc.scale, + spriteEffects, + 0f); + return false; + } + + public override void FindFrame(int frameHeight) //6 total frames, 3 total texture types + { + if (npc.ai[0] == 2f) + { + frameUsed = 0; + } + else if (npc.ai[0] <= 1f) + { + frameUsed = 1; + } + else + { + frameUsed = 2; + } + npc.frameCounter += 1.0; + if (npc.ai[0] == 4f) + { + if (npc.frameCounter > 72.0) + { + npc.frameCounter = 0.0; + } + } + else + { + int frameY = 146; + if (npc.frameCounter > 72.0) + { + npc.frameCounter = 0.0; + } + npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } + + public override void NPCLoot() + { + bool hardMode = Main.hardMode; + int bossAlive = mod.NPCType("Leviathan"); + if (!NPC.AnyNPCs(bossAlive)) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeviathanTrophy")); //done + } + 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("EnchantedPearl")); //done + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HotlineFishingHook); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BottomlessBucket); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SuperAbsorbantSponge); + } + 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(5, 9)); + } + 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(5, 9)); + } + 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(5, 9)); + } + if (!hardMode) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("IOU"), 1, true); + } + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeviathanMask")); //done + } + if (hardMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Atlantis")); //done + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrackishFlask")); //done + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Leviatitan")); //done + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LureofEnthrallment")); //done + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SirensSong")); //done + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Greentide")); //done + } + } + } + } + else + { + npc.value = 0f; + npc.boss = false; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Wet, 120, true); + } + + public override bool CheckActive() + { + 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); + } + } +} diff --git a/NPCs/Leviathan/SirenClone.cs b/NPCs/Leviathan/SirenClone.cs index caab627402..5eddf3ccfe 100644 --- a/NPCs/Leviathan/SirenClone.cs +++ b/NPCs/Leviathan/SirenClone.cs @@ -1,108 +1,108 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Leviathan -{ - public class SirenClone : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren Clone"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 70; //324 - npc.height = 120; //216 - npc.defense = 0; - npc.lifeMax = 3000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit1; - npc.alpha = 255; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - 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.5f, 0.3f); - if (CalamityGlobalNPC.siren < 0 || !Main.npc[CalamityGlobalNPC.siren].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.alpha > 50) - { - npc.alpha -= 5; - } - npc.TargetClosest(true); - Vector2 center = npc.Center; - int num14 = Math.Sign(Main.player[npc.target].Center.X - center.X); - if (num14 != 0) - { - npc.direction = (npc.spriteDirection = num14); - } - Vector2 direction = Main.player[npc.target].Center - center; - direction.Normalize(); - direction *= 11f; - npc.ai[0] += 1f; - if (npc.ai[0] > 45f) - { - npc.ai[0] = 0f; - if (Main.netMode != 1) - { - int damage = Main.expertMode ? 26 : 32; - Projectile.NewProjectile(center.X, center.Y, direction.X, direction.Y, mod.ProjectileType("WaterSpear"), damage, 0f, npc.target); - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 3000; - npc.damage = 0; - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Leviathan +{ + public class SirenClone : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Siren Clone"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 70; //324 + npc.height = 120; //216 + npc.defense = 0; + npc.lifeMax = 3000; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.HitSound = SoundID.NPCHit1; + npc.alpha = 255; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.1f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + 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.5f, 0.3f); + if (CalamityGlobalNPC.siren < 0 || !Main.npc[CalamityGlobalNPC.siren].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.alpha > 50) + { + npc.alpha -= 5; + } + npc.TargetClosest(true); + Vector2 center = npc.Center; + int num14 = Math.Sign(Main.player[npc.target].Center.X - center.X); + if (num14 != 0) + { + npc.direction = (npc.spriteDirection = num14); + } + Vector2 direction = Main.player[npc.target].Center - center; + direction.Normalize(); + direction *= 11f; + npc.ai[0] += 1f; + if (npc.ai[0] > 45f) + { + npc.ai[0] = 0f; + if (Main.netMode != 1) + { + int damage = Main.expertMode ? 26 : 32; + Projectile.NewProjectile(center.X, center.Y, direction.X, direction.Y, mod.ProjectileType("WaterSpear"), damage, 0f, npc.target); + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 3000; + npc.damage = 0; + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs index 9dcfbab17d..b9a370341b 100644 --- a/NPCs/Leviathan/SirenIce.cs +++ b/NPCs/Leviathan/SirenIce.cs @@ -1,106 +1,106 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Leviathan -{ - public class SirenIce : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Shield"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.damage = 45; - npc.width = 100; - npc.height = 100; - npc.defense = 10; - npc.lifeMax = 650; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 400000; - } - npc.alpha = 255; - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - } - - public override void AI() - { - if (npc.alpha > 100) - { - npc.alpha -= 2; - } - Player player = Main.player[npc.target]; - int num989 = (int)npc.ai[0]; - if (Main.npc[num989].active && Main.npc[num989].type == mod.NPCType("Siren")) - { - npc.rotation = Main.npc[num989].rotation; - npc.spriteDirection = Main.npc[num989].direction; - npc.velocity = Vector2.Zero; - npc.position = Main.npc[num989].Center; - npc.position.X = npc.position.X - (float)(npc.width / 2) + ((npc.spriteDirection == 1) ? -20f : 20f); - npc.position.Y = npc.position.Y - (float)(npc.height / 2) - 30; - npc.gfxOffY = Main.npc[num989].gfxOffY; - Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0f, 0.8f, 1.1f); - return; - } - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type != mod.ProjectileType("FlakKraken")) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, npc.alpha); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Frostburn, 240, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Leviathan +{ + public class SirenIce : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Shield"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.damage = 45; + npc.width = 100; + npc.height = 100; + npc.defense = 10; + npc.lifeMax = 650; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 400000; + } + npc.alpha = 255; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + } + + public override void AI() + { + if (npc.alpha > 100) + { + npc.alpha -= 2; + } + Player player = Main.player[npc.target]; + int num989 = (int)npc.ai[0]; + if (Main.npc[num989].active && Main.npc[num989].type == mod.NPCType("Siren")) + { + npc.rotation = Main.npc[num989].rotation; + npc.spriteDirection = Main.npc[num989].direction; + npc.velocity = Vector2.Zero; + npc.position = Main.npc[num989].Center; + npc.position.X = npc.position.X - (float)(npc.width / 2) + ((npc.spriteDirection == 1) ? -20f : 20f); + npc.position.Y = npc.position.Y - (float)(npc.height / 2) - 30; + npc.gfxOffY = Main.npc[num989].gfxOffY; + Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0f, 0.8f, 1.1f); + return; + } + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type != mod.ProjectileType("FlakKraken")) + { + if (projectile.penetrate == -1 && !projectile.minion) + { + projectile.penetrate = 1; + } + else if (projectile.penetrate >= 1) + { + projectile.penetrate = 1; + } + } + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, npc.alpha); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 240, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 6ab8deeb15..2ebc8d409f 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -1,73 +1,73 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class AeroSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aero Slime"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = 14; - npc.damage = 18; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 10; - npc.lifeMax = 50; - npc.knockBackResist = 0f; - animationType = 121; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("AeroSlimeBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || - spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.05f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AerialiteOre"), Main.rand.Next(10, 27)); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class AeroSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aero Slime"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = 14; + npc.damage = 18; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 10; + npc.lifeMax = 50; + npc.knockBackResist = 0f; + animationType = 121; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("AeroSlimeBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || + spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.05f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AerialiteOre"), Main.rand.Next(10, 27)); + } + } +} diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index 60fec86d95..7c29e9bf36 100644 --- a/NPCs/NormalNPCs/AngryDog.cs +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -1,668 +1,668 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class AngryDog : ModNPC - { - private bool reset = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Angry Dog"); - Main.npcFrameCount[npc.type] = 10; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 10; - npc.width = 46; //324 - npc.height = 30; //216 - npc.defense = 4; - npc.lifeMax = 50; - if (CalamityWorld.downedCryogen) - { - npc.damage = 84; - npc.defense = 20; - npc.lifeMax = 1000; - } - npc.knockBackResist = 0.3f; - animationType = 329; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 3, 0); - npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AngryDogHit"); - npc.DeathSound = SoundID.NPCDeath5; - banner = npc.type; - bannerItem = mod.ItemType("AngryDogBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(reset); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - reset = reader.ReadBoolean(); - } - - public override void AI() - { - if (Main.rand.Next(900) == 0) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AngryDogGrowl"), (int)npc.position.X, (int)npc.position.Y); - } - bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.5; - if (phase2) - { - if (!reset) - { - npc.ai[0] = 0f; - npc.ai[3] = 0f; - reset = true; - npc.netUpdate = true; - } - if (npc.ai[1] < 7f) - { - npc.ai[1] += 1f; - } - int num = 30; - int num2 = 10; - bool flag = false; - bool flag2 = false; - bool flag3 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag2 = true; - npc.ai[3] += 1f; - } - num2 = 4; - bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - } - } - if (flag4) - { - npc.velocity.Y = 0f; - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) - { - npc.ai[3] += 1f; - flag3 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num * num2)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num) - { - npc.netUpdate = true; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num4 = Main.player[npc.target].position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - if (num5 < 200f && !flag3) - { - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - 4f; - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default(Color), 1f); - } - } - if (npc.ai[3] < (float)num) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num7 = 6f; - float num8 = 0.07f; - if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) - { - if (Math.Sign(npc.velocity.X) != npc.direction) - { - npc.velocity.X = npc.velocity.X * 0.92f; - } - num7 = 5f; - num8 = 0.2f; - if (npc.velocity.X < -num7 || npc.velocity.X > num7) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num7 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X > num7) - { - npc.velocity.X = num7; - } - } - else if (npc.velocity.X > -num7 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X < -num7) - { - npc.velocity.X = -num7; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num10 = 0; - if (npc.velocity.X < 0f) - { - num10 = -1; - } - if (npc.velocity.X > 0f) - { - num10 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); - int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num11, num12] == null) - { - Main.tile[num11, num12] = new Tile(); - } - if (Main.tile[num11, num12 - 1] == null) - { - Main.tile[num11, num12 - 1] = new Tile(); - } - if (Main.tile[num11, num12 - 2] == null) - { - Main.tile[num11, num12 - 2] = new Tile(); - } - if (Main.tile[num11, num12 - 3] == null) - { - Main.tile[num11, num12 - 3] = new Tile(); - } - if (Main.tile[num11, num12 + 1] == null) - { - Main.tile[num11, num12 + 1] = new Tile(); - } - if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) - { - float num13 = (float)(num12 * 16); - if (Main.tile[num11, num12].halfBrick()) - { - num13 += 8f; - } - if (Main.tile[num11, num12 - 1].halfBrick()) - { - num13 -= 8f; - } - if (num13 < position.Y + (float)npc.height) - { - float num14 = position.Y + (float)npc.height - num13; - if ((double)num14 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num13; - npc.position.Y = num13 - (float)npc.height; - if (num14 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num15, num16] == null) - { - Main.tile[num15, num16] = new Tile(); - } - if (Main.tile[num15, num16 - 1] == null) - { - Main.tile[num15, num16 - 1] = new Tile(); - } - if (Main.tile[num15, num16 - 2] == null) - { - Main.tile[num15, num16 - 2] = new Tile(); - } - if (Main.tile[num15, num16 - 3] == null) - { - Main.tile[num15, num16 - 3] = new Tile(); - } - if (Main.tile[num15, num16 + 1] == null) - { - Main.tile[num15, num16 + 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 - 1] == null) - { - Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 + 1] == null) - { - Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); - } - if (Main.tile[num15 - npc.direction, num16 + 1] == null) - { - Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); - } - int num17 = npc.spriteDirection; - num17 *= -1; - if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) - { - float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) - { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) - { - npc.velocity.Y = -8.5f; - npc.netUpdate = true; - } - else - { - npc.velocity.Y = -7.5f; - npc.netUpdate = true; - } - } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) - { - npc.velocity.Y = -7f; - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) - { - npc.velocity.Y = -6f; - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) - { - npc.velocity.Y = -8f; - npc.netUpdate = true; - } - } - } - npc.rotation += npc.velocity.X * 0.05f; - npc.spriteDirection = -npc.direction; - return; - } - int num19 = 30; - int num20 = 10; - bool flag19= false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 6f; - float num70 = 0.07f; - if (!flag19&& (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num14 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num15 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num14, num15] == null) - { - Main.tile[num14, num15] = new Tile(); - } - if (Main.tile[num14, num15 - 1] == null) - { - Main.tile[num14, num15 - 1] = new Tile(); - } - if (Main.tile[num14, num15 - 2] == null) - { - Main.tile[num14, num15 - 2] = new Tile(); - } - if (Main.tile[num14, num15 - 3] == null) - { - Main.tile[num14, num15 - 3] = new Tile(); - } - if (Main.tile[num14, num15 + 1] == null) - { - Main.tile[num14, num15 + 1] = new Tile(); - } - if (Main.tile[num14 + npc.direction, num15 - 1] == null) - { - Main.tile[num14 + npc.direction, num15 - 1] = new Tile(); - } - if (Main.tile[num14 + npc.direction, num15 + 1] == null) - { - Main.tile[num14 + npc.direction, num15 + 1] = new Tile(); - } - if (Main.tile[num14 - npc.direction, num15 + 1] == null) - { - Main.tile[num14 - npc.direction, num15 + 1] = new Tile(); - } - int num16 = npc.spriteDirection; - if ((npc.velocity.X < 0f && num16 == -1) || (npc.velocity.X > 0f && num16 == 1)) - { - float num17 = 3f; - if (Main.tile[num14, num15 - 2].nactive() && Main.tileSolid[(int)Main.tile[num14, num15 - 2].type]) - { - if (Main.tile[num14, num15 - 3].nactive() && Main.tileSolid[(int)Main.tile[num14, num15 - 3].type]) - { - npc.velocity.Y = -8.5f; - npc.netUpdate = true; - } - else - { - npc.velocity.Y = -7.5f; - npc.netUpdate = true; - } - } - else if (Main.tile[num14, num15 - 1].nactive() && !Main.tile[num14, num15 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num14, num15 - 1].type]) - { - npc.velocity.Y = -7f; - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num15 * 16) > 20f && Main.tile[num14, num15].nactive() && !Main.tile[num14, num15].topSlope() && Main.tileSolid[(int)Main.tile[num14, num15].type]) - { - npc.velocity.Y = -6f; - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num17) && (!Main.tile[num14, num15 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num14, num15 + 1].type]) && (!Main.tile[num14, num15 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num14, num15 + 2].type]) && (!Main.tile[num14 + npc.direction, num15 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num14 + npc.direction, num15 + 3].type])) - { - npc.velocity.Y = -8f; - npc.netUpdate = true; - } - } - } - } - - public override void FindFrame(int frameHeight) - { - if (npc.ai[1] < 7f && npc.ai[1] > 0f) - { - npc.frame.Y = frameHeight * 8; - npc.frameCounter = 0.0; - return; - } - if (npc.ai[1] >= 7f) - { - npc.frame.Y = frameHeight * 9; - npc.frameCounter = 0.0; - return; - } - if (npc.velocity.Y > 0f || npc.velocity.Y < 0f) - { - npc.frame.Y = frameHeight * 5; - npc.frameCounter = 0.0; - } - else - { - npc.spriteDirection = npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 7) - { - npc.frame.Y = 0; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - return spawnInfo.player.ZoneSnow && - !spawnInfo.player.ZoneTowerStardust && - !spawnInfo.player.ZoneTowerSolar && - !spawnInfo.player.ZoneTowerVortex && - !spawnInfo.player.ZoneTowerNebula && - !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && - !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.012f : 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - if (Main.rand.Next(2) == 0) - { - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class AngryDog : ModNPC + { + private bool reset = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Angry Dog"); + Main.npcFrameCount[npc.type] = 10; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 10; + npc.width = 46; //324 + npc.height = 30; //216 + npc.defense = 4; + npc.lifeMax = 50; + if (CalamityWorld.downedCryogen) + { + npc.damage = 84; + npc.defense = 20; + npc.lifeMax = 1000; + } + npc.knockBackResist = 0.3f; + animationType = 329; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 3, 0); + npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AngryDogHit"); + npc.DeathSound = SoundID.NPCDeath5; + banner = npc.type; + bannerItem = mod.ItemType("AngryDogBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(reset); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + reset = reader.ReadBoolean(); + } + + public override void AI() + { + if (Main.rand.Next(900) == 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AngryDogGrowl"), (int)npc.position.X, (int)npc.position.Y); + } + bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.5; + if (phase2) + { + if (!reset) + { + npc.ai[0] = 0f; + npc.ai[3] = 0f; + reset = true; + npc.netUpdate = true; + } + if (npc.ai[1] < 7f) + { + npc.ai[1] += 1f; + } + int num = 30; + int num2 = 10; + bool flag = false; + bool flag2 = false; + bool flag3 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag2 = true; + npc.ai[3] += 1f; + } + num2 = 4; + bool flag4 = npc.velocity.Y == 0f; + for (int i = 0; i < 200; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + } + } + if (flag4) + { + npc.velocity.Y = 0f; + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) + { + npc.ai[3] += 1f; + flag3 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num * num2)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num) + { + npc.netUpdate = true; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num4 = Main.player[npc.target].position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + if (num5 < 200f && !flag3) + { + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - 4f; + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 33, 0f, -1f, 0, default(Color), 1f); + } + } + if (npc.ai[3] < (float)num) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num7 = 6f; + float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) + { + if (Math.Sign(npc.velocity.X) != npc.direction) + { + npc.velocity.X = npc.velocity.X * 0.92f; + } + num7 = 5f; + num8 = 0.2f; + if (npc.velocity.X < -num7 || npc.velocity.X > num7) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num7 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X > num7) + { + npc.velocity.X = num7; + } + } + else if (npc.velocity.X > -num7 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X < -num7) + { + npc.velocity.X = -num7; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num10 = 0; + if (npc.velocity.X < 0f) + { + num10 = -1; + } + if (npc.velocity.X > 0f) + { + num10 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); + int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num11, num12] == null) + { + Main.tile[num11, num12] = new Tile(); + } + if (Main.tile[num11, num12 - 1] == null) + { + Main.tile[num11, num12 - 1] = new Tile(); + } + if (Main.tile[num11, num12 - 2] == null) + { + Main.tile[num11, num12 - 2] = new Tile(); + } + if (Main.tile[num11, num12 - 3] == null) + { + Main.tile[num11, num12 - 3] = new Tile(); + } + if (Main.tile[num11, num12 + 1] == null) + { + Main.tile[num11, num12 + 1] = new Tile(); + } + if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) + { + float num13 = (float)(num12 * 16); + if (Main.tile[num11, num12].halfBrick()) + { + num13 += 8f; + } + if (Main.tile[num11, num12 - 1].halfBrick()) + { + num13 -= 8f; + } + if (num13 < position.Y + (float)npc.height) + { + float num14 = position.Y + (float)npc.height - num13; + if ((double)num14 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num13; + npc.position.Y = num13 - (float)npc.height; + if (num14 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num15, num16] == null) + { + Main.tile[num15, num16] = new Tile(); + } + if (Main.tile[num15, num16 - 1] == null) + { + Main.tile[num15, num16 - 1] = new Tile(); + } + if (Main.tile[num15, num16 - 2] == null) + { + Main.tile[num15, num16 - 2] = new Tile(); + } + if (Main.tile[num15, num16 - 3] == null) + { + Main.tile[num15, num16 - 3] = new Tile(); + } + if (Main.tile[num15, num16 + 1] == null) + { + Main.tile[num15, num16 + 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 - 1] == null) + { + Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 + 1] == null) + { + Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); + } + if (Main.tile[num15 - npc.direction, num16 + 1] == null) + { + Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); + } + int num17 = npc.spriteDirection; + num17 *= -1; + if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) + { + float num18 = 3f; + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + { + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + { + npc.velocity.Y = -8.5f; + npc.netUpdate = true; + } + else + { + npc.velocity.Y = -7.5f; + npc.netUpdate = true; + } + } + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + { + npc.velocity.Y = -7f; + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + { + npc.velocity.Y = -6f; + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + { + npc.velocity.Y = -8f; + npc.netUpdate = true; + } + } + } + npc.rotation += npc.velocity.X * 0.05f; + npc.spriteDirection = -npc.direction; + return; + } + int num19 = 30; + int num20 = 10; + bool flag19= false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 6f; + float num70 = 0.07f; + if (!flag19&& (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num14 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num15 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num14, num15] == null) + { + Main.tile[num14, num15] = new Tile(); + } + if (Main.tile[num14, num15 - 1] == null) + { + Main.tile[num14, num15 - 1] = new Tile(); + } + if (Main.tile[num14, num15 - 2] == null) + { + Main.tile[num14, num15 - 2] = new Tile(); + } + if (Main.tile[num14, num15 - 3] == null) + { + Main.tile[num14, num15 - 3] = new Tile(); + } + if (Main.tile[num14, num15 + 1] == null) + { + Main.tile[num14, num15 + 1] = new Tile(); + } + if (Main.tile[num14 + npc.direction, num15 - 1] == null) + { + Main.tile[num14 + npc.direction, num15 - 1] = new Tile(); + } + if (Main.tile[num14 + npc.direction, num15 + 1] == null) + { + Main.tile[num14 + npc.direction, num15 + 1] = new Tile(); + } + if (Main.tile[num14 - npc.direction, num15 + 1] == null) + { + Main.tile[num14 - npc.direction, num15 + 1] = new Tile(); + } + int num16 = npc.spriteDirection; + if ((npc.velocity.X < 0f && num16 == -1) || (npc.velocity.X > 0f && num16 == 1)) + { + float num17 = 3f; + if (Main.tile[num14, num15 - 2].nactive() && Main.tileSolid[(int)Main.tile[num14, num15 - 2].type]) + { + if (Main.tile[num14, num15 - 3].nactive() && Main.tileSolid[(int)Main.tile[num14, num15 - 3].type]) + { + npc.velocity.Y = -8.5f; + npc.netUpdate = true; + } + else + { + npc.velocity.Y = -7.5f; + npc.netUpdate = true; + } + } + else if (Main.tile[num14, num15 - 1].nactive() && !Main.tile[num14, num15 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num14, num15 - 1].type]) + { + npc.velocity.Y = -7f; + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num15 * 16) > 20f && Main.tile[num14, num15].nactive() && !Main.tile[num14, num15].topSlope() && Main.tileSolid[(int)Main.tile[num14, num15].type]) + { + npc.velocity.Y = -6f; + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num17) && (!Main.tile[num14, num15 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num14, num15 + 1].type]) && (!Main.tile[num14, num15 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num14, num15 + 2].type]) && (!Main.tile[num14 + npc.direction, num15 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num14 + npc.direction, num15 + 3].type])) + { + npc.velocity.Y = -8f; + npc.netUpdate = true; + } + } + } + } + + public override void FindFrame(int frameHeight) + { + if (npc.ai[1] < 7f && npc.ai[1] > 0f) + { + npc.frame.Y = frameHeight * 8; + npc.frameCounter = 0.0; + return; + } + if (npc.ai[1] >= 7f) + { + npc.frame.Y = frameHeight * 9; + npc.frameCounter = 0.0; + return; + } + if (npc.velocity.Y > 0f || npc.velocity.Y < 0f) + { + npc.frame.Y = frameHeight * 5; + npc.frameCounter = 0.0; + } + else + { + npc.spriteDirection = npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 7) + { + npc.frame.Y = 0; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.ZoneSnow && + !spawnInfo.player.ZoneTowerStardust && + !spawnInfo.player.ZoneTowerSolar && + !spawnInfo.player.ZoneTowerVortex && + !spawnInfo.player.ZoneTowerNebula && + !spawnInfo.player.ZoneDungeon && + !spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && + !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.012f : 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + if (Main.rand.Next(2) == 0) + { + 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")); + } + } + } +} diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 9493d379a8..8ca4ad5d56 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -1,412 +1,412 @@ -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 ArmoredDiggerBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armored Digger"); - } - - public override void SetDefaults() - { - npc.damage = 70; - npc.width = 38; //324 - npc.height = 38; //216 - npc.defense = 40; - npc.lifeMax = 20000; - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - animationType = 10; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.netAlways = true; - npc.dontCountMe = true; - banner = mod.NPCType("ArmoredDiggerHead"); - bannerItem = mod.ItemType("ArmoredDiggerBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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(); - 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.netMode != 1) - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.localAI[0] >= (float)Main.rand.Next(1800, 26000)) - { - npc.localAI[0] = 0f; - 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 speed = 7f; - 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 num9 = 32; - int num10 = 450; - vector.X += num6 * 5f; - vector.Y += num7 * 5f; - Projectile.NewProjectile(vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } - } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num12 < 0) - { - num12 = 0; - } - if (num13 > Main.maxTilesX) - { - num13 = Main.maxTilesX; - } - if (num14 < 0) - { - num14 = 0; - } - if (num15 > Main.maxTilesY) - { - num15 = Main.maxTilesY; - } - bool flag2 = false; - if (!flag2) - { - for (int k = num12; k < num13; k++) - { - for (int l = num14; l < num15; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) - { - Vector2 vector2; - vector2.X = (float)(k * 16); - vector2.Y = (float)(l * 16); - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - flag2 = true; - break; - } - } - } - } - } - if (!flag2) - { - npc.localAI[1] = 1f; - } - else - { - npc.localAI[1] = 0f; - } - float num17 = 16f; - if (Main.player[npc.target].dead || (double)Main.player[npc.target].position.Y < Main.rockLayer) - { - flag2 = false; - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) - { - npc.velocity.Y = npc.velocity.Y + 1f; - num17 = 32f; - } - if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].type == mod.NPCType("ArmoredDiggerHead") || Main.npc[a].type == mod.NPCType("ArmoredDiggerBody") || - Main.npc[a].type == mod.NPCType("ArmoredDiggerTail")) - { - Main.npc[a].active = false; - } - } - } - } - float num18 = 0.1f; - float num19 = 0.15f; - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; - num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; - } - catch - { - } - npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - int num23 = (int)(44f * npc.scale); - num22 = (num22 - (float)num23) / num22; - num20 *= num22; - num21 *= num22; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num20; - npc.position.Y = npc.position.Y + num21; - return; - } - if (!flag2) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > num17) - { - npc.velocity.Y = num17; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; - } - } - else if (npc.velocity.Y == num17) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num18 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num18 * 0.9f; - } - } - } - else - { - if (npc.soundDelay == 0) - { - float num24 = num22 / 40f; - if (num24 < 10f) - { - num24 = 10f; - } - if (num24 > 20f) - { - num24 = 20f; - } - npc.soundDelay = (int)num24; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = num17 / num22; - num20 *= num27; - num21 *= num27; - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num19; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num19; - } - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num19; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num19; - } - } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18; - } - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num18; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num18; - } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num18 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num18 * 2f; - } - } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num18 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num18 * 2f; - } - } - } - else if (num25 > num26) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num18; - } - else - { - npc.velocity.Y = npc.velocity.Y - num18; - } - } - } - else - { - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num18; - } - else - { - npc.velocity.X = npc.velocity.X - num18; - } - } - } - } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 180, true); - player.AddBuff(BuffID.Electrified, 120, true); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - } -} \ No newline at end of file +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 ArmoredDiggerBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Armored Digger"); + } + + public override void SetDefaults() + { + npc.damage = 70; + npc.width = 38; //324 + npc.height = 38; //216 + npc.defense = 40; + npc.lifeMax = 20000; + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + animationType = 10; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.netAlways = true; + npc.dontCountMe = true; + banner = mod.NPCType("ArmoredDiggerHead"); + bannerItem = mod.ItemType("ArmoredDiggerBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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(); + 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.netMode != 1) + { + npc.localAI[0] += (float)Main.rand.Next(4); + if (npc.localAI[0] >= (float)Main.rand.Next(1800, 26000)) + { + npc.localAI[0] = 0f; + 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 speed = 7f; + 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 num9 = 32; + int num10 = 450; + vector.X += num6 * 5f; + vector.Y += num7 * 5f; + Projectile.NewProjectile(vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + } + int num12 = (int)(npc.position.X / 16f) - 1; + int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num14 = (int)(npc.position.Y / 16f) - 1; + int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num12 < 0) + { + num12 = 0; + } + if (num13 > Main.maxTilesX) + { + num13 = Main.maxTilesX; + } + if (num14 < 0) + { + num14 = 0; + } + if (num15 > Main.maxTilesY) + { + num15 = Main.maxTilesY; + } + bool flag2 = false; + if (!flag2) + { + for (int k = num12; k < num13; k++) + { + for (int l = num14; l < num15; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + { + Vector2 vector2; + vector2.X = (float)(k * 16); + vector2.Y = (float)(l * 16); + if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + { + flag2 = true; + break; + } + } + } + } + } + if (!flag2) + { + npc.localAI[1] = 1f; + } + else + { + npc.localAI[1] = 0f; + } + float num17 = 16f; + if (Main.player[npc.target].dead || (double)Main.player[npc.target].position.Y < Main.rockLayer) + { + flag2 = false; + npc.velocity.Y = npc.velocity.Y + 1f; + if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) + { + npc.velocity.Y = npc.velocity.Y + 1f; + num17 = 32f; + } + if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == mod.NPCType("ArmoredDiggerHead") || Main.npc[a].type == mod.NPCType("ArmoredDiggerBody") || + Main.npc[a].type == mod.NPCType("ArmoredDiggerTail")) + { + Main.npc[a].active = false; + } + } + } + } + float num18 = 0.1f; + float num19 = 0.15f; + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; + num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; + } + catch + { + } + npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + int num23 = (int)(44f * npc.scale); + num22 = (num22 - (float)num23) / num22; + num20 *= num22; + num21 *= num22; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num20; + npc.position.Y = npc.position.Y + num21; + return; + } + if (!flag2) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + 0.15f; + if (npc.velocity.Y > num17) + { + npc.velocity.Y = num17; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + } + else if (npc.velocity.Y == num17) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 0.9f; + } + } + } + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + { + num24 = 10f; + } + if (num24 > 20f) + { + num24 = 20f; + } + npc.soundDelay = (int)num24; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + } + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + float num25 = Math.Abs(num20); + float num26 = Math.Abs(num21); + float num27 = num17 / num22; + num20 *= num27; + num21 *= num27; + if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num19; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num19; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num19; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num19; + } + } + if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num18; + } + if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18 * 2f; + } + } + if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 2f; + } + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18; + } + } + } + else + { + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18; + } + else + { + npc.velocity.X = npc.velocity.X - num18; + } + } + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Chilled, 180, true); + player.AddBuff(BuffID.Electrified, 120, true); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + } +} diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 531932c2e6..5fa9e20b7a 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -1,449 +1,449 @@ -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 ArmoredDiggerHead : ModNPC - { - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armored Digger"); - } - - public override void SetDefaults() - { - npc.damage = 90; - npc.npcSlots = 10f; - npc.width = 54; //324 - npc.height = 54; //216 - npc.defense = 15; - npc.lifeMax = 20000; - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - animationType = 10; - npc.value = Item.buyPrice(0, 5, 0, 0); - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.netAlways = true; - banner = npc.type; - bannerItem = mod.ItemType("ArmoredDiggerBanner"); - } - - public override void AI() - { - 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 (Main.netMode != 1) - { - if (!TailSpawned) - { - npc.ai[3] = (float)npc.whoAmI; - npc.realLife = npc.whoAmI; - int num2 = npc.whoAmI; - int num3 = 40; - for (int j = 0; j <= num3; j++) - { - int num4 = mod.NPCType("ArmoredDiggerBody"); - if (j == num3) - { - num4 = mod.NPCType("ArmoredDiggerTail"); - } - int num5 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), num4, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num5].ai[3] = (float)npc.whoAmI; - Main.npc[num5].realLife = npc.whoAmI; - Main.npc[num5].ai[1] = (float)num2; - Main.npc[num2].ai[0] = (float)num5; - NetMessage.SendData(23, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); - num2 = num5; - } - TailSpawned = true; - } - } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num12 < 0) - { - num12 = 0; - } - if (num13 > Main.maxTilesX) - { - num13 = Main.maxTilesX; - } - if (num14 < 0) - { - num14 = 0; - } - if (num15 > Main.maxTilesY) - { - num15 = Main.maxTilesY; - } - bool flag2 = false; - if (!flag2) - { - for (int k = num12; k < num13; k++) - { - for (int l = num14; l < num15; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) - { - Vector2 vector2; - vector2.X = (float)(k * 16); - vector2.Y = (float)(l * 16); - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - flag2 = true; - break; - } - } - } - } - } - if (!flag2) - { - npc.localAI[1] = 1f; - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num16 = 1000; - bool flag3 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int m = 0; m < 255; m++) - { - if (Main.player[m].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); - if (rectangle.Intersects(rectangle2)) - { - flag3 = false; - break; - } - } - } - if (flag3) - { - flag2 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - float num17 = 16f; - if (Main.player[npc.target].dead || (double)Main.player[npc.target].position.Y < Main.rockLayer * 16.0) - { - flag2 = false; - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) - { - npc.velocity.Y = npc.velocity.Y + 1f; - num17 = 32f; - } - if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].type == mod.NPCType("ArmoredDiggerHead") || Main.npc[a].type == mod.NPCType("ArmoredDiggerBody") || - Main.npc[a].type == mod.NPCType("ArmoredDiggerTail")) - { - Main.npc[a].active = false; - } - } - } - } - float num18 = 0.1f; - float num19 = 0.15f; - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; - num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; - } - catch - { - } - npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - int num23 = (int)(44f * npc.scale); - num22 = (num22 - (float)num23) / num22; - num20 *= num22; - num21 *= num22; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num20; - npc.position.Y = npc.position.Y + num21; - return; - } - if (!flag2) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > num17) - { - npc.velocity.Y = num17; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; - } - } - else if (npc.velocity.Y == num17) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num18 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num18 * 0.9f; - } - } - } - else - { - if (npc.soundDelay == 0) - { - float num24 = num22 / 40f; - if (num24 < 10f) - { - num24 = 10f; - } - if (num24 > 20f) - { - num24 = 20f; - } - npc.soundDelay = (int)num24; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = num17 / num22; - num20 *= num27; - num21 *= num27; - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num19; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num19; - } - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num19; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num19; - } - } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18; - } - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num18; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num18; - } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num18 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num18 * 2f; - } - } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num18 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num18 * 2f; - } - } - } - else if (num25 > num26) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num18; - } - else - { - npc.velocity.Y = npc.velocity.Y - num18; - } - } - } - else - { - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num18; - } - else - { - npc.velocity.X = npc.velocity.X - num18; - } - } - } - } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag2) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - 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 void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } - - public override bool CheckActive() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 240, true); - player.AddBuff(BuffID.Electrified, 180, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - 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")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh"), Main.rand.Next(2, 5)); - } - } -} \ No newline at end of file +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 ArmoredDiggerHead : ModNPC + { + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Armored Digger"); + } + + public override void SetDefaults() + { + npc.damage = 90; + npc.npcSlots = 10f; + npc.width = 54; //324 + npc.height = 54; //216 + npc.defense = 15; + npc.lifeMax = 20000; + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + animationType = 10; + npc.value = Item.buyPrice(0, 5, 0, 0); + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.netAlways = true; + banner = npc.type; + bannerItem = mod.ItemType("ArmoredDiggerBanner"); + } + + public override void AI() + { + 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 (Main.netMode != 1) + { + if (!TailSpawned) + { + npc.ai[3] = (float)npc.whoAmI; + npc.realLife = npc.whoAmI; + int num2 = npc.whoAmI; + int num3 = 40; + for (int j = 0; j <= num3; j++) + { + int num4 = mod.NPCType("ArmoredDiggerBody"); + if (j == num3) + { + num4 = mod.NPCType("ArmoredDiggerTail"); + } + int num5 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), num4, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num5].ai[3] = (float)npc.whoAmI; + Main.npc[num5].realLife = npc.whoAmI; + Main.npc[num5].ai[1] = (float)num2; + Main.npc[num2].ai[0] = (float)num5; + NetMessage.SendData(23, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); + num2 = num5; + } + TailSpawned = true; + } + } + int num12 = (int)(npc.position.X / 16f) - 1; + int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num14 = (int)(npc.position.Y / 16f) - 1; + int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num12 < 0) + { + num12 = 0; + } + if (num13 > Main.maxTilesX) + { + num13 = Main.maxTilesX; + } + if (num14 < 0) + { + num14 = 0; + } + if (num15 > Main.maxTilesY) + { + num15 = Main.maxTilesY; + } + bool flag2 = false; + if (!flag2) + { + for (int k = num12; k < num13; k++) + { + for (int l = num14; l < num15; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + { + Vector2 vector2; + vector2.X = (float)(k * 16); + vector2.Y = (float)(l * 16); + if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + { + flag2 = true; + break; + } + } + } + } + } + if (!flag2) + { + npc.localAI[1] = 1f; + Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num16 = 1000; + bool flag3 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int m = 0; m < 255; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + if (flag3) + { + flag2 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + float num17 = 16f; + if (Main.player[npc.target].dead || (double)Main.player[npc.target].position.Y < Main.rockLayer * 16.0) + { + flag2 = false; + npc.velocity.Y = npc.velocity.Y + 1f; + if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) + { + npc.velocity.Y = npc.velocity.Y + 1f; + num17 = 32f; + } + if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == mod.NPCType("ArmoredDiggerHead") || Main.npc[a].type == mod.NPCType("ArmoredDiggerBody") || + Main.npc[a].type == mod.NPCType("ArmoredDiggerTail")) + { + Main.npc[a].active = false; + } + } + } + } + float num18 = 0.1f; + float num19 = 0.15f; + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; + num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; + } + catch + { + } + npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + int num23 = (int)(44f * npc.scale); + num22 = (num22 - (float)num23) / num22; + num20 *= num22; + num21 *= num22; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num20; + npc.position.Y = npc.position.Y + num21; + return; + } + if (!flag2) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + 0.15f; + if (npc.velocity.Y > num17) + { + npc.velocity.Y = num17; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + } + else if (npc.velocity.Y == num17) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 0.9f; + } + } + } + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + { + num24 = 10f; + } + if (num24 > 20f) + { + num24 = 20f; + } + npc.soundDelay = (int)num24; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + } + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + float num25 = Math.Abs(num20); + float num26 = Math.Abs(num21); + float num27 = num17 / num22; + num20 *= num27; + num21 *= num27; + if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num19; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num19; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num19; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num19; + } + } + if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num18; + } + if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18 * 2f; + } + } + if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 2f; + } + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18; + } + } + } + else + { + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18; + } + else + { + npc.velocity.X = npc.velocity.X - num18; + } + } + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag2) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + 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 void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } + + public override bool CheckActive() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Chilled, 240, true); + player.AddBuff(BuffID.Electrified, 180, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + 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")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh"), Main.rand.Next(2, 5)); + } + } +} diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 1ba3d4d52c..f78c756494 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -1,385 +1,385 @@ -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 ArmoredDiggerTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Armored Digger"); - } - - public override void SetDefaults() - { - npc.damage = 55; - npc.width = 34; //324 - npc.height = 34; //216 - npc.defense = 55; - npc.lifeMax = 20000; - npc.knockBackResist = 0f; - npc.aiStyle = -1; - aiType = -1; - animationType = 10; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.Item4; - npc.DeathSound = SoundID.Item14; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.netAlways = true; - npc.dontCountMe = true; - banner = mod.NPCType("ArmoredDiggerHead"); - bannerItem = mod.ItemType("ArmoredDiggerBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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(); - 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(); - } - int num12 = (int)(npc.position.X / 16f) - 1; - int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num14 = (int)(npc.position.Y / 16f) - 1; - int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num12 < 0) - { - num12 = 0; - } - if (num13 > Main.maxTilesX) - { - num13 = Main.maxTilesX; - } - if (num14 < 0) - { - num14 = 0; - } - if (num15 > Main.maxTilesY) - { - num15 = Main.maxTilesY; - } - bool flag2 = false; - if (!flag2) - { - for (int k = num12; k < num13; k++) - { - for (int l = num14; l < num15; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) - { - Vector2 vector2; - vector2.X = (float)(k * 16); - vector2.Y = (float)(l * 16); - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - flag2 = true; - break; - } - } - } - } - } - if (!flag2) - { - npc.localAI[1] = 1f; - } - else - { - npc.localAI[1] = 0f; - } - float num17 = 16f; - if (Main.player[npc.target].dead || (double)Main.player[npc.target].position.Y < Main.rockLayer) - { - flag2 = false; - npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) - { - npc.velocity.Y = npc.velocity.Y + 1f; - num17 = 32f; - } - if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].type == mod.NPCType("ArmoredDiggerHead") || Main.npc[a].type == mod.NPCType("ArmoredDiggerBody") || - Main.npc[a].type == mod.NPCType("ArmoredDiggerTail")) - { - Main.npc[a].active = false; - } - } - } - } - float num18 = 0.1f; - float num19 = 0.15f; - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; - num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; - } - catch - { - } - npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - int num23 = (int)(44f * npc.scale); - num22 = (num22 - (float)num23) / num22; - num20 *= num22; - num21 *= num22; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num20; - npc.position.Y = npc.position.Y + num21; - return; - } - if (!flag2) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + 0.15f; - if (npc.velocity.Y > num17) - { - npc.velocity.Y = num17; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; - } - } - else if (npc.velocity.Y == num17) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num18 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num18 * 0.9f; - } - } - } - else - { - if (npc.soundDelay == 0) - { - float num24 = num22 / 40f; - if (num24 < 10f) - { - num24 = 10f; - } - if (num24 > 20f) - { - num24 = 20f; - } - npc.soundDelay = (int)num24; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = num17 / num22; - num20 *= num27; - num21 *= num27; - if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num19; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num19; - } - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num19; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num19; - } - } - if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18; - } - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num18; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num18; - } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num18 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num18 * 2f; - } - } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num18 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num18 * 2f; - } - } - } - else if (num25 > num26) - { - if (npc.velocity.X < num20) - { - npc.velocity.X = npc.velocity.X + num18 * 1.1f; - } - else if (npc.velocity.X > num20) - { - npc.velocity.X = npc.velocity.X - num18 * 1.1f; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num18; - } - else - { - npc.velocity.Y = npc.velocity.Y - num18; - } - } - } - else - { - if (npc.velocity.Y < num21) - { - npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; - } - else if (npc.velocity.Y > num21) - { - npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num18; - } - else - { - npc.velocity.X = npc.velocity.X - num18; - } - } - } - } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 120, true); - player.AddBuff(BuffID.Electrified, 90, true); - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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 ArmoredDiggerTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Armored Digger"); + } + + public override void SetDefaults() + { + npc.damage = 55; + npc.width = 34; //324 + npc.height = 34; //216 + npc.defense = 55; + npc.lifeMax = 20000; + npc.knockBackResist = 0f; + npc.aiStyle = -1; + aiType = -1; + animationType = 10; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.Item4; + npc.DeathSound = SoundID.Item14; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.netAlways = true; + npc.dontCountMe = true; + banner = mod.NPCType("ArmoredDiggerHead"); + bannerItem = mod.ItemType("ArmoredDiggerBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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(); + 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(); + } + int num12 = (int)(npc.position.X / 16f) - 1; + int num13 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num14 = (int)(npc.position.Y / 16f) - 1; + int num15 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num12 < 0) + { + num12 = 0; + } + if (num13 > Main.maxTilesX) + { + num13 = Main.maxTilesX; + } + if (num14 < 0) + { + num14 = 0; + } + if (num15 > Main.maxTilesY) + { + num15 = Main.maxTilesY; + } + bool flag2 = false; + if (!flag2) + { + for (int k = num12; k < num13; k++) + { + for (int l = num14; l < num15; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[(int)Main.tile[k, l].type] || (Main.tileSolidTop[(int)Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) + { + Vector2 vector2; + vector2.X = (float)(k * 16); + vector2.Y = (float)(l * 16); + if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) + { + flag2 = true; + break; + } + } + } + } + } + if (!flag2) + { + npc.localAI[1] = 1f; + } + else + { + npc.localAI[1] = 0f; + } + float num17 = 16f; + if (Main.player[npc.target].dead || (double)Main.player[npc.target].position.Y < Main.rockLayer) + { + flag2 = false; + npc.velocity.Y = npc.velocity.Y + 1f; + if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) + { + npc.velocity.Y = npc.velocity.Y + 1f; + num17 = 32f; + } + if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == mod.NPCType("ArmoredDiggerHead") || Main.npc[a].type == mod.NPCType("ArmoredDiggerBody") || + Main.npc[a].type == mod.NPCType("ArmoredDiggerTail")) + { + Main.npc[a].active = false; + } + } + } + } + float num18 = 0.1f; + float num19 = 0.15f; + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num20 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num21 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num20 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector3.X; + num21 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector3.Y; + } + catch + { + } + npc.rotation = (float)Math.Atan2((double)num21, (double)num20) + 1.57f; + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + int num23 = (int)(44f * npc.scale); + num22 = (num22 - (float)num23) / num22; + num20 *= num22; + num21 *= num22; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num20; + npc.position.Y = npc.position.Y + num21; + return; + } + if (!flag2) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + 0.15f; + if (npc.velocity.Y > num17) + { + npc.velocity.Y = num17; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + } + else if (npc.velocity.Y == num17) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 0.9f; + } + } + } + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + { + num24 = 10f; + } + if (num24 > 20f) + { + num24 = 20f; + } + npc.soundDelay = (int)num24; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + } + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + float num25 = Math.Abs(num20); + float num26 = Math.Abs(num21); + float num27 = num17 / num22; + num20 *= num27; + num21 *= num27; + if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num19; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num19; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num19; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num19; + } + } + if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num18; + } + if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18 * 2f; + } + } + if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 2f; + } + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18; + } + } + } + else + { + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + } + else if (npc.velocity.Y > num21) + { + npc.velocity.Y = npc.velocity.Y - num18 * 1.1f; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18; + } + else + { + npc.velocity.X = npc.velocity.X - num18; + } + } + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Chilled, 120, true); + player.AddBuff(BuffID.Electrified, 90, true); + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/BlightedEye.cs b/NPCs/NormalNPCs/BlightedEye.cs index 2900f0434c..a17306aade 100644 --- a/NPCs/NormalNPCs/BlightedEye.cs +++ b/NPCs/NormalNPCs/BlightedEye.cs @@ -1,75 +1,75 @@ -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 BlightedEye : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blighted Eye"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 2; - npc.damage = 32; - npc.width = 30; //324 - npc.height = 32; //216 - npc.defense = 18; - npc.lifeMax = 120; - npc.knockBackResist = 0.6f; - animationType = 2; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("BlightedEyeBanner"); - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldNightMonster.Chance * 0.075f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Weak, 120, true); - } - - 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("BlightedLens")); - } - } - } -} \ No newline at end of file +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 BlightedEye : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blighted Eye"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 2; + npc.damage = 32; + npc.width = 30; //324 + npc.height = 32; //216 + npc.defense = 18; + npc.lifeMax = 120; + npc.knockBackResist = 0.6f; + animationType = 2; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("BlightedEyeBanner"); + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldNightMonster.Chance * 0.075f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Weak, 120, true); + } + + 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("BlightedLens")); + } + } + } +} diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index 005d69db3b..ad7433b78b 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -1,73 +1,73 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class BloomSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloom Slime"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 80; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 50; - npc.lifeMax = 1000; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("BloomSlimeBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || - spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.08f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UelibloomOre"), Main.rand.Next(10, 27)); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class BloomSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloom Slime"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 80; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 50; + npc.lifeMax = 1000; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 25, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("BloomSlimeBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || + spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.08f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UelibloomOre"), Main.rand.Next(10, 27)); + } + } +} diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index b4f6261db3..c5eeaf3657 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -1,354 +1,354 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class Bohldohr : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("BOHLDOHR"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 150; - npc.width = 40; //324 - npc.height = 40; //216 - npc.defense = 28; - npc.lifeMax = 300; - npc.knockBackResist = 0.9f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath35; - npc.behindTiles = true; - banner = npc.type; - bannerItem = mod.ItemType("BOHLDOHRBanner"); - } - - public override void AI() - { - int num = 30; - int num2 = 10; - bool flag = false; - bool flag2 = false; - bool flag3 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag2 = true; - npc.ai[3] += 1f; - } - num2 = 4; - bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - } - } - if (flag4) - { - npc.velocity.Y = 0f; - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) - { - npc.ai[3] += 1f; - flag3 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num * num2)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num) - { - npc.netUpdate = true; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num4 = Main.player[npc.target].position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - if (num5 < 200f && !flag3) - { - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - 4f; - Main.PlaySound(3, npc.Center, 7); - } - if (npc.ai[3] < (float)num) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num7 = 6f; - float num8 = 0.07f; - if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) - { - if (Math.Sign(npc.velocity.X) != npc.direction) - { - npc.velocity.X = npc.velocity.X * 0.92f; - } - float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); - if (!Main.player[npc.target].ZoneSandstorm) - { - num9 = 0f; - } - num7 = 5f + num9 * (float)npc.direction * 4f; - num8 = 0.2f; - if (npc.velocity.X < -num7 || npc.velocity.X > num7) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num7 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X > num7) - { - npc.velocity.X = num7; - } - } - else if (npc.velocity.X > -num7 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X < -num7) - { - npc.velocity.X = -num7; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num10 = 0; - if (npc.velocity.X < 0f) - { - num10 = -1; - } - if (npc.velocity.X > 0f) - { - num10 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); - int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num11, num12] == null) - { - Main.tile[num11, num12] = new Tile(); - } - if (Main.tile[num11, num12 - 1] == null) - { - Main.tile[num11, num12 - 1] = new Tile(); - } - if (Main.tile[num11, num12 - 2] == null) - { - Main.tile[num11, num12 - 2] = new Tile(); - } - if (Main.tile[num11, num12 - 3] == null) - { - Main.tile[num11, num12 - 3] = new Tile(); - } - if (Main.tile[num11, num12 + 1] == null) - { - Main.tile[num11, num12 + 1] = new Tile(); - } - if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) - { - float num13 = (float)(num12 * 16); - if (Main.tile[num11, num12].halfBrick()) - { - num13 += 8f; - } - if (Main.tile[num11, num12 - 1].halfBrick()) - { - num13 -= 8f; - } - if (num13 < position.Y + (float)npc.height) - { - float num14 = position.Y + (float)npc.height - num13; - if ((double)num14 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num13; - npc.position.Y = num13 - (float)npc.height; - if (num14 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num15, num16] == null) - { - Main.tile[num15, num16] = new Tile(); - } - if (Main.tile[num15, num16 - 1] == null) - { - Main.tile[num15, num16 - 1] = new Tile(); - } - if (Main.tile[num15, num16 - 2] == null) - { - Main.tile[num15, num16 - 2] = new Tile(); - } - if (Main.tile[num15, num16 - 3] == null) - { - Main.tile[num15, num16 - 3] = new Tile(); - } - if (Main.tile[num15, num16 + 1] == null) - { - Main.tile[num15, num16 + 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 - 1] == null) - { - Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 + 1] == null) - { - Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); - } - if (Main.tile[num15 - npc.direction, num16 + 1] == null) - { - Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); - } - int num17 = npc.spriteDirection; - num17 *= -1; - if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) - { - bool flag6 = npc.type == 410 || npc.type == 423; - float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) - { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) - { - npc.velocity.Y = -8.5f; - npc.netUpdate = true; - } - else - { - npc.velocity.Y = -7.5f; - npc.netUpdate = true; - } - } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) - { - npc.velocity.Y = -7f; - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) - { - npc.velocity.Y = -6f; - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!flag6 || !Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) - { - npc.velocity.Y = -8f; - npc.netUpdate = true; - } - } - } - npc.rotation += npc.velocity.X * 0.05f; - npc.spriteDirection = -npc.direction; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss) - { - return 0f; - } - return SpawnCondition.JungleTemple.Chance * 0.05f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 155, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 155, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - if (CalamityWorld.downedSCal) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NO")); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class Bohldohr : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("BOHLDOHR"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 150; + npc.width = 40; //324 + npc.height = 40; //216 + npc.defense = 28; + npc.lifeMax = 300; + npc.knockBackResist = 0.9f; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit7; + npc.DeathSound = SoundID.NPCDeath35; + npc.behindTiles = true; + banner = npc.type; + bannerItem = mod.ItemType("BOHLDOHRBanner"); + } + + public override void AI() + { + int num = 30; + int num2 = 10; + bool flag = false; + bool flag2 = false; + bool flag3 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag2 = true; + npc.ai[3] += 1f; + } + num2 = 4; + bool flag4 = npc.velocity.Y == 0f; + for (int i = 0; i < 200; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + } + } + if (flag4) + { + npc.velocity.Y = 0f; + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) + { + npc.ai[3] += 1f; + flag3 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num * num2)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num) + { + npc.netUpdate = true; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num4 = Main.player[npc.target].position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + if (num5 < 200f && !flag3) + { + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - 4f; + Main.PlaySound(3, npc.Center, 7); + } + if (npc.ai[3] < (float)num) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num7 = 6f; + float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) + { + if (Math.Sign(npc.velocity.X) != npc.direction) + { + npc.velocity.X = npc.velocity.X * 0.92f; + } + float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); + if (!Main.player[npc.target].ZoneSandstorm) + { + num9 = 0f; + } + num7 = 5f + num9 * (float)npc.direction * 4f; + num8 = 0.2f; + if (npc.velocity.X < -num7 || npc.velocity.X > num7) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num7 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X > num7) + { + npc.velocity.X = num7; + } + } + else if (npc.velocity.X > -num7 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X < -num7) + { + npc.velocity.X = -num7; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num10 = 0; + if (npc.velocity.X < 0f) + { + num10 = -1; + } + if (npc.velocity.X > 0f) + { + num10 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); + int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num11, num12] == null) + { + Main.tile[num11, num12] = new Tile(); + } + if (Main.tile[num11, num12 - 1] == null) + { + Main.tile[num11, num12 - 1] = new Tile(); + } + if (Main.tile[num11, num12 - 2] == null) + { + Main.tile[num11, num12 - 2] = new Tile(); + } + if (Main.tile[num11, num12 - 3] == null) + { + Main.tile[num11, num12 - 3] = new Tile(); + } + if (Main.tile[num11, num12 + 1] == null) + { + Main.tile[num11, num12 + 1] = new Tile(); + } + if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) + { + float num13 = (float)(num12 * 16); + if (Main.tile[num11, num12].halfBrick()) + { + num13 += 8f; + } + if (Main.tile[num11, num12 - 1].halfBrick()) + { + num13 -= 8f; + } + if (num13 < position.Y + (float)npc.height) + { + float num14 = position.Y + (float)npc.height - num13; + if ((double)num14 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num13; + npc.position.Y = num13 - (float)npc.height; + if (num14 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num15, num16] == null) + { + Main.tile[num15, num16] = new Tile(); + } + if (Main.tile[num15, num16 - 1] == null) + { + Main.tile[num15, num16 - 1] = new Tile(); + } + if (Main.tile[num15, num16 - 2] == null) + { + Main.tile[num15, num16 - 2] = new Tile(); + } + if (Main.tile[num15, num16 - 3] == null) + { + Main.tile[num15, num16 - 3] = new Tile(); + } + if (Main.tile[num15, num16 + 1] == null) + { + Main.tile[num15, num16 + 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 - 1] == null) + { + Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 + 1] == null) + { + Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); + } + if (Main.tile[num15 - npc.direction, num16 + 1] == null) + { + Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); + } + int num17 = npc.spriteDirection; + num17 *= -1; + if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) + { + bool flag6 = npc.type == 410 || npc.type == 423; + float num18 = 3f; + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + { + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + { + npc.velocity.Y = -8.5f; + npc.netUpdate = true; + } + else + { + npc.velocity.Y = -7.5f; + npc.netUpdate = true; + } + } + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + { + npc.velocity.Y = -7f; + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + { + npc.velocity.Y = -6f; + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!flag6 || !Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + { + npc.velocity.Y = -8f; + npc.netUpdate = true; + } + } + } + npc.rotation += npc.velocity.X * 0.05f; + npc.spriteDirection = -npc.direction; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedPlantBoss) + { + return 0f; + } + return SpawnCondition.JungleTemple.Chance * 0.05f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 155, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 155, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + if (CalamityWorld.downedSCal) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NO")); + } + } + } +} diff --git a/NPCs/NormalNPCs/CalamityEye.cs b/NPCs/NormalNPCs/CalamityEye.cs index 12cd62678f..5fd7c21b78 100644 --- a/NPCs/NormalNPCs/CalamityEye.cs +++ b/NPCs/NormalNPCs/CalamityEye.cs @@ -1,81 +1,81 @@ -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 CalamityEye : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamity Eye"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = 2; - npc.damage = 40; - npc.width = 30; //324 - npc.height = 32; //216 - npc.defense = 24; - npc.lifeMax = 140; - npc.knockBackResist = 0f; - animationType = 2; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("CalamityEyeBanner"); - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldNightMonster.Chance * 0.045f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Weak, 120, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); - } - - 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("BlightedLens")); - } - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Lens); - } - } - } -} \ No newline at end of file +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 CalamityEye : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamity Eye"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = 2; + npc.damage = 40; + npc.width = 30; //324 + npc.height = 32; //216 + npc.defense = 24; + npc.lifeMax = 140; + npc.knockBackResist = 0f; + animationType = 2; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("CalamityEyeBanner"); + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldNightMonster.Chance * 0.045f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Weak, 120, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); + } + + 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("BlightedLens")); + } + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Lens); + } + } + } +} diff --git a/NPCs/NormalNPCs/CharredSlime.cs b/NPCs/NormalNPCs/CharredSlime.cs index 5fcfc0604f..8d6a6e69fe 100644 --- a/NPCs/NormalNPCs/CharredSlime.cs +++ b/NPCs/NormalNPCs/CharredSlime.cs @@ -1,71 +1,71 @@ -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 CharredSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Charred Slime"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 40; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 20; - npc.lifeMax = 250; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.alpha = 50; - npc.lavaImmune = true; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("CharredSlimeBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss) - { - return 0f; - } - return SpawnCondition.Underworld.Chance * 0.06f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CharredOre"), Main.rand.Next(10, 27)); - } - } -} \ No newline at end of file +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 CharredSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Charred Slime"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 40; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 20; + npc.lifeMax = 250; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.alpha = 50; + npc.lavaImmune = true; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("CharredSlimeBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedPlantBoss) + { + return 0f; + } + return SpawnCondition.Underworld.Chance * 0.06f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CharredOre"), Main.rand.Next(10, 27)); + } + } +} diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 20e8c69cc9..f33637c736 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -1,331 +1,331 @@ -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; -using CalamityMod.Items; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class Cnidrion : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cnidrion"); - Main.npcFrameCount[npc.type] = 10; - } - - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.damage = 20; - npc.width = 160; //324 - npc.height = 80; //216 - npc.defense = 10; - npc.lifeMax = 400; - npc.knockBackResist = 0.05f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit12; - npc.DeathSound = SoundID.NPCDeath18; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("CnidrionBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.DesertCave.Chance * 0.0175f; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override void AI() - { - Player player = Main.player[npc.target]; - bool expertMode = Main.expertMode; - npc.noGravity = true; - npc.noTileCollide = true; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - float num823 = 1f; - npc.TargetClosest(true); - bool flag51 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.33) - { - num823 = 2f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num823 = 4f; - } - if (npc.ai[0] == 0f) - { - npc.ai[1] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.33) - { - npc.ai[1] += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 300f && Main.netMode != 1) - { - npc.ai[1] = 0f; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - npc.ai[0] = (float)Main.rand.Next(3, 5); - } - else - { - npc.ai[0] = (float)Main.rand.Next(1, 3); - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - flag51 = true; - npc.ai[1] += 1f; - if (npc.ai[1] % 15f == 0f) - { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(10 * npc.direction); - float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; - float num830 = Main.player[npc.target].position.Y - vector18.Y; - float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); - float num832 = 6f; - num831 = num832 / num831; - num829 *= num831; - num830 *= num831; - num829 *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f; - num830 *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f; - int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 6 : 9), 0f, Main.myPlayer, 0f, 0f); - } - if (npc.ai[1] >= 120f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 2f) - { - flag51 = true; - npc.ai[1] += 1f; - if (npc.ai[1] > 60f && npc.ai[1] < 240f && npc.ai[1] % 8f == 0f) - { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(10 * npc.direction); - float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; - float num830 = Main.player[npc.target].position.Y - vector18.Y; - float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); - float num832 = 8f; - num831 = num832 / num831; - num829 *= num831; - num830 *= num831; - num829 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; - num830 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; - int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 7 : 10), 0f, Main.myPlayer, 0f, 0f); - } - if (npc.ai[1] >= 300f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - num823 = 4f; - npc.ai[1] += 1f; - if (npc.ai[1] % 30f == 0f) - { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(10 * npc.direction); - float num844 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; - float num845 = Main.player[npc.target].position.Y - vector18.Y; - float num846 = (float)Math.Sqrt((double)(num844 * num844 + num845 * num845)); - float num847 = 10f; - num846 = num847 / num846; - num844 *= num846; - num845 *= num846; - num844 *= 1f + (float)Main.rand.Next(-20, 21) * 0.001f; - num845 *= 1f + (float)Main.rand.Next(-20, 21) * 0.001f; - int num848 = Projectile.NewProjectile(vector18.X, vector18.Y, num844, num845, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 9 : 12), 0f, Main.myPlayer, 0f, 0f); - } - if (npc.ai[1] >= 120f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 4f) - { - num823 = 4f; - npc.ai[1] += 1f; - if (npc.ai[1] % 10f == 0f) - { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(10 * npc.direction); - float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; - float num830 = Main.player[npc.target].position.Y - vector18.Y; - float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); - float num832 = 11f; - num831 = num832 / num831; - num829 *= num831; - num830 *= num831; - num829 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - num830 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 11 : 15), 0f, Main.myPlayer, 0f, 0f); - } - if (npc.ai[1] >= 240f) - { - npc.ai[1] = 0f; - npc.ai[0] = 0f; - } - } - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 50f) - { - 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 - { - 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; - } - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - return; - } - float num116 = (float)Main.rand.Next(30, 900); - num116 *= (float)npc.life / (float)npc.lifeMax; - num116 += 30f; - if (Main.netMode != 1 && npc.ai[2] >= num116 && npc.velocity.Y == 0f && !player.dead && ((npc.direction > 0 && npc.Center.X < player.Center.X) || (npc.direction < 0 && npc.Center.X > player.Center.X)) && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num117 = 13f; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(10 * npc.direction); - float num118 = player.position.X + (float)player.width * 0.5f - vector18.X; - float num119 = player.position.Y + (float)player.height * 0.5f - vector18.Y; - num118 += (float)Main.rand.Next(-40, 41); - num119 += (float)Main.rand.Next(-40, 41); - float num120 = (float)Math.Sqrt((double)(num118 * num118 + num119 * num119)); - npc.netUpdate = true; - num120 = num117 / num120; - num118 *= num120; - num119 *= num120; - int num121 = expertMode ? 8 : 12; - int num122 = mod.ProjectileType("HorsWaterBlast"); - vector18.X += num118 * 3f; - vector18.Y += num119 * 3f; - Projectile.NewProjectile(vector18.X, vector18.Y, num118, num119, num122, num121, 0f, Main.myPlayer, 0f, 0f); - npc.ai[2] = 0f; - } - } - - 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 < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 2f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(1, 4)); - 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) - { - 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")); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.Items; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class Cnidrion : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cnidrion"); + Main.npcFrameCount[npc.type] = 10; + } + + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.aiStyle = -1; + npc.damage = 20; + npc.width = 160; //324 + npc.height = 80; //216 + npc.defense = 10; + npc.lifeMax = 400; + npc.knockBackResist = 0.05f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 25, 0); + npc.HitSound = SoundID.NPCHit12; + npc.DeathSound = SoundID.NPCDeath18; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("CnidrionBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.DesertCave.Chance * 0.0175f; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.1f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override void AI() + { + Player player = Main.player[npc.target]; + bool expertMode = Main.expertMode; + npc.noGravity = true; + npc.noTileCollide = true; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + float num823 = 1f; + npc.TargetClosest(true); + bool flag51 = false; + if ((double)npc.life < (double)npc.lifeMax * 0.33) + { + num823 = 2f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num823 = 4f; + } + if (npc.ai[0] == 0f) + { + npc.ai[1] += 1f; + if ((double)npc.life < (double)npc.lifeMax * 0.33) + { + npc.ai[1] += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 300f && Main.netMode != 1) + { + npc.ai[1] = 0f; + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + npc.ai[0] = (float)Main.rand.Next(3, 5); + } + else + { + npc.ai[0] = (float)Main.rand.Next(1, 3); + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + flag51 = true; + npc.ai[1] += 1f; + if (npc.ai[1] % 15f == 0f) + { + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += (float)(10 * npc.direction); + float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + float num830 = Main.player[npc.target].position.Y - vector18.Y; + float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); + float num832 = 6f; + num831 = num832 / num831; + num829 *= num831; + num830 *= num831; + num829 *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f; + num830 *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f; + int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 6 : 9), 0f, Main.myPlayer, 0f, 0f); + } + if (npc.ai[1] >= 120f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 2f) + { + flag51 = true; + npc.ai[1] += 1f; + if (npc.ai[1] > 60f && npc.ai[1] < 240f && npc.ai[1] % 8f == 0f) + { + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += (float)(10 * npc.direction); + float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + float num830 = Main.player[npc.target].position.Y - vector18.Y; + float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); + float num832 = 8f; + num831 = num832 / num831; + num829 *= num831; + num830 *= num831; + num829 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; + num830 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; + int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 7 : 10), 0f, Main.myPlayer, 0f, 0f); + } + if (npc.ai[1] >= 300f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + num823 = 4f; + npc.ai[1] += 1f; + if (npc.ai[1] % 30f == 0f) + { + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += (float)(10 * npc.direction); + float num844 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + float num845 = Main.player[npc.target].position.Y - vector18.Y; + float num846 = (float)Math.Sqrt((double)(num844 * num844 + num845 * num845)); + float num847 = 10f; + num846 = num847 / num846; + num844 *= num846; + num845 *= num846; + num844 *= 1f + (float)Main.rand.Next(-20, 21) * 0.001f; + num845 *= 1f + (float)Main.rand.Next(-20, 21) * 0.001f; + int num848 = Projectile.NewProjectile(vector18.X, vector18.Y, num844, num845, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 9 : 12), 0f, Main.myPlayer, 0f, 0f); + } + if (npc.ai[1] >= 120f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 4f) + { + num823 = 4f; + npc.ai[1] += 1f; + if (npc.ai[1] % 10f == 0f) + { + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += (float)(10 * npc.direction); + float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + float num830 = Main.player[npc.target].position.Y - vector18.Y; + float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); + float num832 = 11f; + num831 = num832 / num831; + num829 *= num831; + num830 *= num831; + num829 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + num830 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, mod.ProjectileType("HorsWaterBlast"), (expertMode ? 11 : 15), 0f, Main.myPlayer, 0f, 0f); + } + if (npc.ai[1] >= 240f) + { + npc.ai[1] = 0f; + npc.ai[0] = 0f; + } + } + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 50f) + { + 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 + { + 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; + } + } + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + return; + } + float num116 = (float)Main.rand.Next(30, 900); + num116 *= (float)npc.life / (float)npc.lifeMax; + num116 += 30f; + if (Main.netMode != 1 && npc.ai[2] >= num116 && npc.velocity.Y == 0f && !player.dead && ((npc.direction > 0 && npc.Center.X < player.Center.X) || (npc.direction < 0 && npc.Center.X > player.Center.X)) && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + float num117 = 13f; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += (float)(10 * npc.direction); + float num118 = player.position.X + (float)player.width * 0.5f - vector18.X; + float num119 = player.position.Y + (float)player.height * 0.5f - vector18.Y; + num118 += (float)Main.rand.Next(-40, 41); + num119 += (float)Main.rand.Next(-40, 41); + float num120 = (float)Math.Sqrt((double)(num118 * num118 + num119 * num119)); + npc.netUpdate = true; + num120 = num117 / num120; + num118 *= num120; + num119 *= num120; + int num121 = expertMode ? 8 : 12; + int num122 = mod.ProjectileType("HorsWaterBlast"); + vector18.X += num118 * 3f; + vector18.Y += num119 * 3f; + Projectile.NewProjectile(vector18.X, vector18.Y, num118, num119, num122, num121, 0f, Main.myPlayer, 0f, 0f); + npc.ai[2] = 0f; + } + } + + 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 < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 2f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(1, 4)); + 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) + { + 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/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs index f9254e2105..4059916f69 100644 --- a/NPCs/NormalNPCs/CosmicElemental.cs +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -1,108 +1,108 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class CosmicElemental : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Elemental"); - Main.npcFrameCount[npc.type] = 22; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.5f; - npc.aiStyle = 91; - npc.damage = 20; - npc.width = 20; //324 - npc.height = 30; //216 - npc.defense = 10; - npc.lifeMax = 25; - npc.knockBackResist = 0.5f; - animationType = 483; - npc.value = Item.buyPrice(0, 0, 3, 0); - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath6; - banner = npc.type; - bannerItem = mod.ItemType("CosmicElementalBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.01f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - player.AddBuff(BuffID.Confused, 180, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneSword); - } - if (Main.rand.Next(50) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfury); - } - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.EnchantedSword); - } - if (Main.rand.Next(1000) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Arkhalis); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfury); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.EnchantedSword); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Arkhalis); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class CosmicElemental : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Elemental"); + Main.npcFrameCount[npc.type] = 22; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.5f; + npc.aiStyle = 91; + npc.damage = 20; + npc.width = 20; //324 + npc.height = 30; //216 + npc.defense = 10; + npc.lifeMax = 25; + npc.knockBackResist = 0.5f; + animationType = 483; + npc.value = Item.buyPrice(0, 0, 3, 0); + npc.HitSound = SoundID.NPCHit7; + npc.DeathSound = SoundID.NPCDeath6; + banner = npc.type; + bannerItem = mod.ItemType("CosmicElementalBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.01f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + player.AddBuff(BuffID.Confused, 180, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneSword); + } + if (Main.rand.Next(50) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfury); + } + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.EnchantedSword); + } + if (Main.rand.Next(1000) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Arkhalis); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfury); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.EnchantedSword); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Arkhalis); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index 64fb284688..758a7ce6b4 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -1,273 +1,273 @@ -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 CrawlerAmber : ModNPC - { - private bool detected = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amber Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 25; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 18; - npc.lifeMax = 90; - npc.knockBackResist = 0.3f; - npc.value = Item.buyPrice(0, 0, 0, 80); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("AmberCrawlerBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } - - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } - - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 5f; //5 - float num70 = 0.05f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.DesertCave.Chance * 0.0175f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 32, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 32, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amber, Main.rand.Next(2, 5)); - } - } -} \ No newline at end of file +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 CrawlerAmber : ModNPC + { + private bool detected = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amber Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 25; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 18; + npc.lifeMax = 90; + npc.knockBackResist = 0.3f; + npc.value = Item.buyPrice(0, 0, 0, 80); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("AmberCrawlerBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } + + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 5f; //5 + float num70 = 0.05f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.DesertCave.Chance * 0.0175f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 32, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 32, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amber, Main.rand.Next(2, 5)); + } + } +} diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index b0e8ff2ae7..3a2e696e27 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -1,273 +1,273 @@ -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 CrawlerAmethyst : ModNPC - { - private bool detected = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amethyst Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 15; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 8; - npc.lifeMax = 60; - npc.knockBackResist = 0.75f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("AmethystCrawlerBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } - - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } - - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 4.5f; //5 - float num70 = 0.045f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.04f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amethyst, Main.rand.Next(2, 5)); - } - } -} \ No newline at end of file +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 CrawlerAmethyst : ModNPC + { + private bool detected = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amethyst Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 15; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 8; + npc.lifeMax = 60; + npc.knockBackResist = 0.75f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 0, 30); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("AmethystCrawlerBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } + + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 4.5f; //5 + float num70 = 0.045f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.04f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 70, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amethyst, Main.rand.Next(2, 5)); + } + } +} diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index c905fdad9d..e402df93e2 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -1,277 +1,277 @@ -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 CrawlerCrystal : ModNPC - { - private bool detected = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 35; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 18; - npc.lifeMax = 300; - npc.knockBackResist = 0.15f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("CrystalCrawlerBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } - - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } - - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 7f; //5 - float num70 = 0.07f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.EnchantedSword.Chance; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrystalShard, 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("CrystalBlade")); - } - } - } -} \ No newline at end of file +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 CrawlerCrystal : ModNPC + { + private bool detected = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 35; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 18; + npc.lifeMax = 300; + npc.knockBackResist = 0.15f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("CrystalCrawlerBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } + + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 7f; //5 + float num70 = 0.07f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.EnchantedSword.Chance; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrystalShard, 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("CrystalBlade")); + } + } + } +} diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 9161ea3726..6d1639cf09 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -1,273 +1,273 @@ -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 CrawlerDiamond : ModNPC - { - private bool detected = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Diamond Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 24; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 16; - npc.lifeMax = 150; - npc.knockBackResist = 0.35f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("DiamondCrawlerBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } - - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } - - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 6f; //5 - float num70 = 0.06f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.0175f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 91, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 91, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Diamond, Main.rand.Next(2, 5)); - } - } -} \ No newline at end of file +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 CrawlerDiamond : ModNPC + { + private bool detected = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Diamond Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 24; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 16; + npc.lifeMax = 150; + npc.knockBackResist = 0.35f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("DiamondCrawlerBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } + + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 6f; //5 + float num70 = 0.06f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.0175f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 91, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 91, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Diamond, Main.rand.Next(2, 5)); + } + } +} diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index bc80d33b8b..54a7287d05 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -1,273 +1,273 @@ -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 CrawlerEmerald : ModNPC - { - private bool detected = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Emerald Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 20; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 12; - npc.lifeMax = 105; - npc.knockBackResist = 0.55f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("EmeraldCrawlerBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } - - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } - - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 5.5f; //5 - float num70 = 0.055f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.0275f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 89, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 89, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Emerald, Main.rand.Next(2, 5)); - } - } -} \ No newline at end of file +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 CrawlerEmerald : ModNPC + { + private bool detected = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Emerald Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 20; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 12; + npc.lifeMax = 105; + npc.knockBackResist = 0.55f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("EmeraldCrawlerBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } + + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 5.5f; //5 + float num70 = 0.055f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.0275f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 89, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 89, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Emerald, Main.rand.Next(2, 5)); + } + } +} diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index f22692eaea..9a020d9cc8 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -1,273 +1,273 @@ -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 CrawlerRuby : ModNPC - { - private bool detected = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ruby Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 23; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 14; - npc.lifeMax = 135; - npc.knockBackResist = 0.45f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("RubyCrawlerBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } - - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } - - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 6f; //5 - float num70 = 0.06f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.0275f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 12, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 12, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ruby, Main.rand.Next(2, 5)); - } - } -} \ No newline at end of file +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 CrawlerRuby : ModNPC + { + private bool detected = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ruby Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 23; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 14; + npc.lifeMax = 135; + npc.knockBackResist = 0.45f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("RubyCrawlerBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } + + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 6f; //5 + float num70 = 0.06f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.0275f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 12, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 12, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ruby, Main.rand.Next(2, 5)); + } + } +} diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index b2baabbf91..e76d2ffac9 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -1,273 +1,273 @@ -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 CrawlerSapphire : ModNPC - { - private bool detected = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sapphire Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 18; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 10; - npc.lifeMax = 90; - npc.knockBackResist = 0.65f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("SapphireCrawlerBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } - - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } - - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 5.5f; //5 - float num70 = 0.055f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.03f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sapphire, Main.rand.Next(2, 5)); - } - } -} \ No newline at end of file +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 CrawlerSapphire : ModNPC + { + private bool detected = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sapphire Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 18; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 10; + npc.lifeMax = 90; + npc.knockBackResist = 0.65f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("SapphireCrawlerBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } + + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 5.5f; //5 + float num70 = 0.055f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.03f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sapphire, Main.rand.Next(2, 5)); + } + } +} diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index 2ced46c4b7..56b0b123f0 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -1,273 +1,273 @@ -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 CrawlerTopaz : ModNPC - { - private bool detected = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Topaz Crawler"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.3f; - npc.aiStyle = -1; - npc.damage = 12; - npc.width = 44; //324 - npc.height = 34; //216 - npc.defense = 6; - npc.lifeMax = 45; - npc.knockBackResist = 0.85f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.HitSound = SoundID.NPCHit33; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("TopazCrawlerBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(detected); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - detected = reader.ReadBoolean(); - } - - public override void FindFrame(int frameHeight) - { - if (!detected) - { - npc.frame.Y = frameHeight * 4; - npc.frameCounter = 0.0; - return; - } - npc.spriteDirection = -npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 8f); - if (npc.frameCounter > 2.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - } - } - - public override void AI() - { - if (!detected) - npc.TargetClosest(true); - if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, - Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) - detected = true; - if (!detected) - return; - int num19 = 30; - int num20 = 10; - bool flag19 = false; - bool flag20 = false; - bool flag30 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) - { - flag20 = true; - npc.ai[3] += 1f; - } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) - { - npc.ai[3] += 1f; - flag30 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num19 * num20)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num19) - { - npc.netUpdate = true; - } - Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; - float num30 = Main.player[npc.target].position.Y - vector19.Y; - float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); - if (num40 < 200f && !flag30) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] < (float)num19) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = -npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num6 = 4.5f; //5 - float num70 = 0.045f; //0.05 - if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) - { - if (npc.velocity.X < -num6 || npc.velocity.X > num6) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num6 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X + num70; - if (npc.velocity.X > num6) - { - npc.velocity.X = num6; - } - } - else if (npc.velocity.X > -num6 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X - num70; - if (npc.velocity.X < -num6) - { - npc.velocity.X = -num6; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num9 = 0; - if (npc.velocity.X < 0f) - { - num9 = -1; - } - if (npc.velocity.X > 0f) - { - num9 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); - int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num10, num11] == null) - { - Main.tile[num10, num11] = new Tile(); - } - if (Main.tile[num10, num11 - 1] == null) - { - Main.tile[num10, num11 - 1] = new Tile(); - } - if (Main.tile[num10, num11 - 2] == null) - { - Main.tile[num10, num11 - 2] = new Tile(); - } - if (Main.tile[num10, num11 - 3] == null) - { - Main.tile[num10, num11 - 3] = new Tile(); - } - if (Main.tile[num10, num11 + 1] == null) - { - Main.tile[num10, num11 + 1] = new Tile(); - } - if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) - { - float num12 = (float)(num11 * 16); - if (Main.tile[num10, num11].halfBrick()) - { - num12 += 8f; - } - if (Main.tile[num10, num11 - 1].halfBrick()) - { - num12 -= 8f; - } - if (num12 < position.Y + (float)npc.height) - { - float num13 = position.Y + (float)npc.height - num12; - if ((double)num13 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num12; - npc.position.Y = num12 - (float)npc.height; - if (num13 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.0425f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 147, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 147, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Topaz, Main.rand.Next(2, 5)); - } - } -} \ No newline at end of file +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 CrawlerTopaz : ModNPC + { + private bool detected = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Topaz Crawler"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.3f; + npc.aiStyle = -1; + npc.damage = 12; + npc.width = 44; //324 + npc.height = 34; //216 + npc.defense = 6; + npc.lifeMax = 45; + npc.knockBackResist = 0.85f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 0, 30); + npc.HitSound = SoundID.NPCHit33; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("TopazCrawlerBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(detected); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + detected = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) + { + if (!detected) + { + npc.frame.Y = frameHeight * 4; + npc.frameCounter = 0.0; + return; + } + npc.spriteDirection = -npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 8f); + if (npc.frameCounter > 2.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + } + } + + public override void AI() + { + if (!detected) + npc.TargetClosest(true); + if (((Main.player[npc.target].Center - npc.Center).Length() < 100f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, + Main.player[npc.target].width, Main.player[npc.target].height)) || npc.justHit) + detected = true; + if (!detected) + return; + int num19 = 30; + int num20 = 10; + bool flag19 = false; + bool flag20 = false; + bool flag30 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + { + flag20 = true; + npc.ai[3] += 1f; + } + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num19) | flag20) + { + npc.ai[3] += 1f; + flag30 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num19 * num20)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num19) + { + npc.netUpdate = true; + } + Vector2 vector19 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float arg_31B_0 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector19.X; + float num30 = Main.player[npc.target].position.Y - vector19.Y; + float num40 = (float)Math.Sqrt((double)(arg_31B_0 * arg_31B_0 + num30 * num30)); + if (num40 < 200f && !flag30) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] < (float)num19) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = -npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num6 = 4.5f; //5 + float num70 = 0.045f; //0.05 + if (!flag19 && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + { + if (npc.velocity.X < -num6 || npc.velocity.X > num6) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num6 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X + num70; + if (npc.velocity.X > num6) + { + npc.velocity.X = num6; + } + } + else if (npc.velocity.X > -num6 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X - num70; + if (npc.velocity.X < -num6) + { + npc.velocity.X = -num6; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num9 = 0; + if (npc.velocity.X < 0f) + { + num9 = -1; + } + if (npc.velocity.X > 0f) + { + num9 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num10 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num9)) / 16f); + int num11 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num10, num11] == null) + { + Main.tile[num10, num11] = new Tile(); + } + if (Main.tile[num10, num11 - 1] == null) + { + Main.tile[num10, num11 - 1] = new Tile(); + } + if (Main.tile[num10, num11 - 2] == null) + { + Main.tile[num10, num11 - 2] = new Tile(); + } + if (Main.tile[num10, num11 - 3] == null) + { + Main.tile[num10, num11 - 3] = new Tile(); + } + if (Main.tile[num10, num11 + 1] == null) + { + Main.tile[num10, num11 + 1] = new Tile(); + } + if ((float)(num10 * 16) < position.X + (float)npc.width && (float)(num10 * 16 + 16) > position.X && ((Main.tile[num10, num11].nactive() && !Main.tile[num10, num11].topSlope() && !Main.tile[num10, num11 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num10, num11].type] && !Main.tileSolidTop[(int)Main.tile[num10, num11].type]) || (Main.tile[num10, num11 - 1].halfBrick() && Main.tile[num10, num11 - 1].nactive())) && (!Main.tile[num10, num11 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 1].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 1].type] || (Main.tile[num10, num11 - 1].halfBrick() && (!Main.tile[num10, num11 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 4].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 4].type]))) && (!Main.tile[num10, num11 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 2].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 2].type]) && (!Main.tile[num10, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10, num11 - 3].type] || Main.tileSolidTop[(int)Main.tile[num10, num11 - 3].type]) && (!Main.tile[num10 - num9, num11 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num10 - num9, num11 - 3].type])) + { + float num12 = (float)(num11 * 16); + if (Main.tile[num10, num11].halfBrick()) + { + num12 += 8f; + } + if (Main.tile[num10, num11 - 1].halfBrick()) + { + num12 -= 8f; + } + if (num12 < position.Y + (float)npc.height) + { + float num13 = position.Y + (float)npc.height - num12; + if ((double)num13 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num12; + npc.position.Y = num12 - (float)npc.height; + if (num13 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.0425f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 147, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 147, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Topaz, Main.rand.Next(2, 5)); + } + } +} diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 4476decdc8..d47a7b9edf 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -1,83 +1,83 @@ -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 CrimulanBlightSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimulan Blight Slime"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 30; - npc.width = 60; //324 - npc.height = 42; //216 - npc.defense = 12; - npc.lifeMax = 130; - npc.knockBackResist = 0.3f; - animationType = 244; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.alpha = 105; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - banner = npc.type; - bannerItem = mod.ItemType("CrimulanBlightSlimeBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - return 0f; - } - return SpawnCondition.Crimson.Chance * 0.15f; - } - - 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 < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.ManaSickness, 120, true); - player.AddBuff(BuffID.Confused, 120, true); - } - - public override void NPCLoot() - { - 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 +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 CrimulanBlightSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimulan Blight Slime"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 30; + npc.width = 60; //324 + npc.height = 42; //216 + npc.defense = 12; + npc.lifeMax = 130; + npc.knockBackResist = 0.3f; + animationType = 244; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.alpha = 105; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + banner = npc.type; + bannerItem = mod.ItemType("CrimulanBlightSlimeBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + return 0f; + } + return SpawnCondition.Crimson.Chance * 0.15f; + } + + 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 < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.ManaSickness, 120, true); + player.AddBuff(BuffID.Confused, 120, true); + } + + public override void NPCLoot() + { + 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")); + } + } + } +} diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index d9debae1ef..a80780c0a4 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -1,73 +1,73 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class CryoSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryo Slime"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 30; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 12; - npc.lifeMax = 120; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("CryoSlimeBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || - spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.08f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("MSparkle"), hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("MSparkle"), hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CryonicOre"), Main.rand.Next(10, 27)); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class CryoSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryo Slime"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 30; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 12; + npc.lifeMax = 120; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("CryoSlimeBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || + spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.08f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("MSparkle"), hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("MSparkle"), hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CryonicOre"), Main.rand.Next(10, 27)); + } + } +} diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index e8d2ff03c1..ecef0969ed 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -1,386 +1,386 @@ -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 Cryon : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryon"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 42; - npc.width = 50; //324 - npc.height = 64; //216 - npc.defense = 20; - npc.lifeMax = 300; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - banner = npc.type; - bannerItem = mod.ItemType("CryonBanner"); - } - - public override void AI() - { - int num = 30; - int num2 = 10; - bool flag = false; - bool flag2 = false; - bool flag3 = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) - { - flag2 = true; - npc.ai[3] += 1f; - } - num2 = 4; - bool flag4 = npc.velocity.Y == 0f; - for (int i = 0; i < 200; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) - { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - } - } - if (flag4) - { - npc.velocity.Y = 0f; - } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) - { - npc.ai[3] += 1f; - flag3 = true; - } - else if (npc.ai[3] > 0f) - { - npc.ai[3] -= 1f; - } - if (npc.ai[3] > (float)(num * num2)) - { - npc.ai[3] = 0f; - } - if (npc.justHit) - { - npc.ai[3] = 0f; - } - if (npc.ai[3] == (float)num) - { - npc.netUpdate = true; - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; - float num4 = Main.player[npc.target].position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - if (num5 < 200f && !flag3) - { - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) - { - npc.velocity.Y = npc.velocity.Y - 4f; - } - if (npc.ai[3] < (float)num) - { - npc.TargetClosest(true); - } - else - { - if (npc.velocity.X == 0f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[0] += 1f; - if (npc.ai[0] >= 2f) - { - npc.direction *= -1; - npc.spriteDirection = npc.direction; - npc.ai[0] = 0f; - } - } - } - else - { - npc.ai[0] = 0f; - } - npc.directionY = -1; - if (npc.direction == 0) - { - npc.direction = 1; - } - } - float num7 = 6f; - float num8 = 0.07f; - if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) - { - if (Math.Sign(npc.velocity.X) != npc.direction) - { - npc.velocity.X = npc.velocity.X * 0.92f; - } - float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); - if (!Main.player[npc.target].ZoneSandstorm) - { - num9 = 0f; - } - num7 = 5f + num9 * (float)npc.direction * 4f; - num8 = 0.1f; - if (npc.velocity.X < -num7 || npc.velocity.X > num7) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num7 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + num8; - if (npc.velocity.X > num7) - { - npc.velocity.X = num7; - } - } - else if (npc.velocity.X > -num7 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - num8; - if (npc.velocity.X < -num7) - { - npc.velocity.X = -num7; - } - } - } - if (npc.velocity.Y >= 0f) - { - int num10 = 0; - if (npc.velocity.X < 0f) - { - num10 = -1; - } - if (npc.velocity.X > 0f) - { - num10 = 1; - } - Vector2 position = npc.position; - position.X += npc.velocity.X; - int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); - int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); - if (Main.tile[num11, num12] == null) - { - Main.tile[num11, num12] = new Tile(); - } - if (Main.tile[num11, num12 - 1] == null) - { - Main.tile[num11, num12 - 1] = new Tile(); - } - if (Main.tile[num11, num12 - 2] == null) - { - Main.tile[num11, num12 - 2] = new Tile(); - } - if (Main.tile[num11, num12 - 3] == null) - { - Main.tile[num11, num12 - 3] = new Tile(); - } - if (Main.tile[num11, num12 + 1] == null) - { - Main.tile[num11, num12 + 1] = new Tile(); - } - if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) - { - float num13 = (float)(num12 * 16); - if (Main.tile[num11, num12].halfBrick()) - { - num13 += 8f; - } - if (Main.tile[num11, num12 - 1].halfBrick()) - { - num13 -= 8f; - } - if (num13 < position.Y + (float)npc.height) - { - float num14 = position.Y + (float)npc.height - num13; - if ((double)num14 <= 16.1) - { - npc.gfxOffY += npc.position.Y + (float)npc.height - num13; - npc.position.Y = num13 - (float)npc.height; - if (num14 < 9f) - { - npc.stepSpeed = 1f; - } - else - { - npc.stepSpeed = 2f; - } - } - } - } - } - if (npc.velocity.Y == 0f) - { - int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - if (Main.tile[num15, num16] == null) - { - Main.tile[num15, num16] = new Tile(); - } - if (Main.tile[num15, num16 - 1] == null) - { - Main.tile[num15, num16 - 1] = new Tile(); - } - if (Main.tile[num15, num16 - 2] == null) - { - Main.tile[num15, num16 - 2] = new Tile(); - } - if (Main.tile[num15, num16 - 3] == null) - { - Main.tile[num15, num16 - 3] = new Tile(); - } - if (Main.tile[num15, num16 + 1] == null) - { - Main.tile[num15, num16 + 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 - 1] == null) - { - Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); - } - if (Main.tile[num15 + npc.direction, num16 + 1] == null) - { - Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); - } - if (Main.tile[num15 - npc.direction, num16 + 1] == null) - { - Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); - } - int num17 = npc.spriteDirection; - num17 *= -1; - if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) - { - bool flag6 = npc.type == 410 || npc.type == 423; - float num18 = 3f; - if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) - { - if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) - { - npc.velocity.Y = -8.5f; - npc.netUpdate = true; - } - else - { - npc.velocity.Y = -7.5f; - npc.netUpdate = true; - } - } - else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) - { - npc.velocity.Y = -7f; - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) - { - npc.velocity.Y = -6f; - npc.netUpdate = true; - } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!flag6 || !Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) - { - npc.velocity.Y = -8f; - npc.netUpdate = true; - } - } - } - } - - public override void FindFrame(int frameHeight) - { - if (npc.velocity.Y > 0f || npc.velocity.Y < 0f) - { - npc.spriteDirection = npc.direction; - npc.frame.Y = frameHeight * 7; - npc.frameCounter = 0.0; - } - else - { - npc.spriteDirection = npc.direction; - npc.frameCounter += (double)(npc.velocity.Length() / 2f); - 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 float SpawnChance(NPCSpawnInfo spawnInfo) - { - return spawnInfo.player.ZoneSnow && - !spawnInfo.player.ZoneTowerStardust && - !spawnInfo.player.ZoneTowerSolar && - !spawnInfo.player.ZoneTowerVortex && - !spawnInfo.player.ZoneTowerNebula && - !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.015f : 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Frostburn, 300, true); - if (Main.rand.Next(3) == 0) - { - player.AddBuff(mod.BuffType("GlacialState"), 30, true); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 92, 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, 92, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - 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")); - } - } - } -} \ No newline at end of file +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 Cryon : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryon"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 42; + npc.width = 50; //324 + npc.height = 64; //216 + npc.defense = 20; + npc.lifeMax = 300; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + banner = npc.type; + bannerItem = mod.ItemType("CryonBanner"); + } + + public override void AI() + { + int num = 30; + int num2 = 10; + bool flag = false; + bool flag2 = false; + bool flag3 = false; + if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + { + flag2 = true; + npc.ai[3] += 1f; + } + num2 = 4; + bool flag4 = npc.velocity.Y == 0f; + for (int i = 0; i < 200; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + { + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X = npc.velocity.X - 0.05f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y = npc.velocity.Y - 0.05f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + } + } + if (flag4) + { + npc.velocity.Y = 0f; + } + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)num || flag2) + { + npc.ai[3] += 1f; + flag3 = true; + } + else if (npc.ai[3] > 0f) + { + npc.ai[3] -= 1f; + } + if (npc.ai[3] > (float)(num * num2)) + { + npc.ai[3] = 0f; + } + if (npc.justHit) + { + npc.ai[3] = 0f; + } + if (npc.ai[3] == (float)num) + { + npc.netUpdate = true; + } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num3 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num4 = Main.player[npc.target].position.Y - vector.Y; + float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); + if (num5 < 200f && !flag3) + { + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + { + npc.velocity.Y = npc.velocity.Y - 4f; + } + if (npc.ai[3] < (float)num) + { + npc.TargetClosest(true); + } + else + { + if (npc.velocity.X == 0f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[0] += 1f; + if (npc.ai[0] >= 2f) + { + npc.direction *= -1; + npc.spriteDirection = npc.direction; + npc.ai[0] = 0f; + } + } + } + else + { + npc.ai[0] = 0f; + } + npc.directionY = -1; + if (npc.direction == 0) + { + npc.direction = 1; + } + } + float num7 = 6f; + float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) + { + if (Math.Sign(npc.velocity.X) != npc.direction) + { + npc.velocity.X = npc.velocity.X * 0.92f; + } + float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); + if (!Main.player[npc.target].ZoneSandstorm) + { + num9 = 0f; + } + num7 = 5f + num9 * (float)npc.direction * 4f; + num8 = 0.1f; + if (npc.velocity.X < -num7 || npc.velocity.X > num7) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num7 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num8; + if (npc.velocity.X > num7) + { + npc.velocity.X = num7; + } + } + else if (npc.velocity.X > -num7 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num8; + if (npc.velocity.X < -num7) + { + npc.velocity.X = -num7; + } + } + } + if (npc.velocity.Y >= 0f) + { + int num10 = 0; + if (npc.velocity.X < 0f) + { + num10 = -1; + } + if (npc.velocity.X > 0f) + { + num10 = 1; + } + Vector2 position = npc.position; + position.X += npc.velocity.X; + int num11 = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f); + int num12 = (int)((position.Y + (float)npc.height - 1f) / 16f); + if (Main.tile[num11, num12] == null) + { + Main.tile[num11, num12] = new Tile(); + } + if (Main.tile[num11, num12 - 1] == null) + { + Main.tile[num11, num12 - 1] = new Tile(); + } + if (Main.tile[num11, num12 - 2] == null) + { + Main.tile[num11, num12 - 2] = new Tile(); + } + if (Main.tile[num11, num12 - 3] == null) + { + Main.tile[num11, num12 - 3] = new Tile(); + } + if (Main.tile[num11, num12 + 1] == null) + { + Main.tile[num11, num12 + 1] = new Tile(); + } + if ((float)(num11 * 16) < position.X + (float)npc.width && (float)(num11 * 16 + 16) > position.X && ((Main.tile[num11, num12].nactive() && !Main.tile[num11, num12].topSlope() && !Main.tile[num11, num12 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num11, num12].type] && !Main.tileSolidTop[(int)Main.tile[num11, num12].type]) || (Main.tile[num11, num12 - 1].halfBrick() && Main.tile[num11, num12 - 1].nactive())) && (!Main.tile[num11, num12 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 1].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 1].type] || (Main.tile[num11, num12 - 1].halfBrick() && (!Main.tile[num11, num12 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 4].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 4].type]))) && (!Main.tile[num11, num12 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 2].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 2].type]) && (!Main.tile[num11, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11, num12 - 3].type] || Main.tileSolidTop[(int)Main.tile[num11, num12 - 3].type]) && (!Main.tile[num11 - num10, num12 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num11 - num10, num12 - 3].type])) + { + float num13 = (float)(num12 * 16); + if (Main.tile[num11, num12].halfBrick()) + { + num13 += 8f; + } + if (Main.tile[num11, num12 - 1].halfBrick()) + { + num13 -= 8f; + } + if (num13 < position.Y + (float)npc.height) + { + float num14 = position.Y + (float)npc.height - num13; + if ((double)num14 <= 16.1) + { + npc.gfxOffY += npc.position.Y + (float)npc.height - num13; + npc.position.Y = num13 - (float)npc.height; + if (num14 < 9f) + { + npc.stepSpeed = 1f; + } + else + { + npc.stepSpeed = 2f; + } + } + } + } + } + if (npc.velocity.Y == 0f) + { + int num15 = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); + int num16 = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); + if (Main.tile[num15, num16] == null) + { + Main.tile[num15, num16] = new Tile(); + } + if (Main.tile[num15, num16 - 1] == null) + { + Main.tile[num15, num16 - 1] = new Tile(); + } + if (Main.tile[num15, num16 - 2] == null) + { + Main.tile[num15, num16 - 2] = new Tile(); + } + if (Main.tile[num15, num16 - 3] == null) + { + Main.tile[num15, num16 - 3] = new Tile(); + } + if (Main.tile[num15, num16 + 1] == null) + { + Main.tile[num15, num16 + 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 - 1] == null) + { + Main.tile[num15 + npc.direction, num16 - 1] = new Tile(); + } + if (Main.tile[num15 + npc.direction, num16 + 1] == null) + { + Main.tile[num15 + npc.direction, num16 + 1] = new Tile(); + } + if (Main.tile[num15 - npc.direction, num16 + 1] == null) + { + Main.tile[num15 - npc.direction, num16 + 1] = new Tile(); + } + int num17 = npc.spriteDirection; + num17 *= -1; + if ((npc.velocity.X < 0f && num17 == -1) || (npc.velocity.X > 0f && num17 == 1)) + { + bool flag6 = npc.type == 410 || npc.type == 423; + float num18 = 3f; + if (Main.tile[num15, num16 - 2].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 2].type]) + { + if (Main.tile[num15, num16 - 3].nactive() && Main.tileSolid[(int)Main.tile[num15, num16 - 3].type]) + { + npc.velocity.Y = -8.5f; + npc.netUpdate = true; + } + else + { + npc.velocity.Y = -7.5f; + npc.netUpdate = true; + } + } + else if (Main.tile[num15, num16 - 1].nactive() && !Main.tile[num15, num16 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16 - 1].type]) + { + npc.velocity.Y = -7f; + npc.netUpdate = true; + } + else if (npc.position.Y + (float)npc.height - (float)(num16 * 16) > 20f && Main.tile[num15, num16].nactive() && !Main.tile[num15, num16].topSlope() && Main.tileSolid[(int)Main.tile[num15, num16].type]) + { + npc.velocity.Y = -6f; + npc.netUpdate = true; + } + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > num18) && (!flag6 || !Main.tile[num15, num16 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 1].type]) && (!Main.tile[num15, num16 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num15, num16 + 2].type]) && (!Main.tile[num15 + npc.direction, num16 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num15 + npc.direction, num16 + 3].type])) + { + npc.velocity.Y = -8f; + npc.netUpdate = true; + } + } + } + } + + public override void FindFrame(int frameHeight) + { + if (npc.velocity.Y > 0f || npc.velocity.Y < 0f) + { + npc.spriteDirection = npc.direction; + npc.frame.Y = frameHeight * 7; + npc.frameCounter = 0.0; + } + else + { + npc.spriteDirection = npc.direction; + npc.frameCounter += (double)(npc.velocity.Length() / 2f); + 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 float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.ZoneSnow && + !spawnInfo.player.ZoneTowerStardust && + !spawnInfo.player.ZoneTowerSolar && + !spawnInfo.player.ZoneTowerVortex && + !spawnInfo.player.ZoneTowerNebula && + !spawnInfo.player.ZoneDungeon && + !spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.015f : 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 300, true); + if (Main.rand.Next(3) == 0) + { + player.AddBuff(mod.BuffType("GlacialState"), 30, true); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 92, 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, 92, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + 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")); + } + } + } +} diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index df6e1edf46..a2515bcee2 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -1,79 +1,79 @@ -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 EbonianBlightSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ebonian Blight Slime"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 30; - npc.width = 60; //324 - npc.height = 42; //216 - npc.defense = 12; - npc.lifeMax = 130; - npc.knockBackResist = 0.3f; - animationType = 244; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.alpha = 105; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - banner = npc.type; - bannerItem = mod.ItemType("EbonianBlightSlimeBanner"); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 40; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) - { - return 0f; - } - return SpawnCondition.Corruption.Chance * 0.15f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.ManaSickness, 120, true); - player.AddBuff(BuffID.Weak, 120, true); - } - - public override void NPCLoot() - { - 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)); - } - } -} \ No newline at end of file +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 EbonianBlightSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ebonian Blight Slime"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 30; + npc.width = 60; //324 + npc.height = 42; //216 + npc.defense = 12; + npc.lifeMax = 130; + npc.knockBackResist = 0.3f; + animationType = 244; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.alpha = 105; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + banner = npc.type; + bannerItem = mod.ItemType("EbonianBlightSlimeBanner"); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 40; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneAbyss) + { + return 0f; + } + return SpawnCondition.Corruption.Chance * 0.15f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.ManaSickness, 120, true); + player.AddBuff(BuffID.Weak, 120, true); + } + + public override void NPCLoot() + { + 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)); + } + } +} diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index c9496eb6b0..4c9b05ac83 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -1,339 +1,339 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class Eidolist : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eidolist"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.aiStyle = -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; - } - npc.knockBackResist = 0f; - 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; - banner = npc.type; - bannerItem = mod.ItemType("EidolistBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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) - { - 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++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - 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)); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class Eidolist : ModNPC + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eidolist"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.aiStyle = -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; + } + npc.knockBackResist = 0f; + 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; + banner = npc.type; + bannerItem = mod.ItemType("EidolistBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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) + { + 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++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + 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)); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/HeatSpirit.cs b/NPCs/NormalNPCs/HeatSpirit.cs index b5fcc7148f..a9f8e1e664 100644 --- a/NPCs/NormalNPCs/HeatSpirit.cs +++ b/NPCs/NormalNPCs/HeatSpirit.cs @@ -1,106 +1,106 @@ -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 HeatSpirit : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heat Spirit"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.5f; - npc.aiStyle = 86; - npc.damage = 33; - npc.width = 40; //324 - npc.height = 24; //216 - npc.defense = 20; - npc.lifeMax = 50; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - banner = npc.type; - bannerItem = mod.ItemType("HeatSpiritBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode) - { - return 0f; - } - return SpawnCondition.Underworld.Chance * 0.065f; - } - - public override void FindFrame(int frameHeight) - { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - if (npc.direction == 1) - { - npc.spriteDirection = 1; - } - if (npc.direction == -1) - { - npc.spriteDirection = -1; - } - npc.rotation = (float)Math.Atan2((double)(npc.velocity.Y * (float)npc.direction), (double)(npc.velocity.X * (float)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 AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 0f, 0.05f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 120, true); - player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - } -} \ No newline at end of file +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 HeatSpirit : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heat Spirit"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.5f; + npc.aiStyle = 86; + npc.damage = 33; + npc.width = 40; //324 + npc.height = 24; //216 + npc.defense = 20; + npc.lifeMax = 50; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + banner = npc.type; + bannerItem = mod.ItemType("HeatSpiritBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode) + { + return 0f; + } + return SpawnCondition.Underworld.Chance * 0.065f; + } + + public override void FindFrame(int frameHeight) + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + if (npc.direction == 1) + { + npc.spriteDirection = 1; + } + if (npc.direction == -1) + { + npc.spriteDirection = -1; + } + npc.rotation = (float)Math.Atan2((double)(npc.velocity.Y * (float)npc.direction), (double)(npc.velocity.X * (float)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 AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 0f, 0.05f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 120, true); + player.AddBuff(mod.BuffType("BrimstoneFlames"), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + } +} diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index a414b2620d..ea326dd4f6 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -1,246 +1,246 @@ -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; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class Horse : ModNPC - { - private int chargetimer = 0; - private 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.width = 230; - npc.height = 230; - npc.defense = 30; - 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.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; - banner = npc.type; - bannerItem = mod.ItemType("EarthElementalBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(chargetimer); - writer.Write(basespeed); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - chargetimer = reader.ReadInt32(); - basespeed = reader.ReadInt32(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || - spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - 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() - { - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AridArtifact")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlagMagnum")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Aftershock")); - } - if (Main.rand.Next(4) == 0) - { - 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) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 31, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - 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.width = 160; - npc.height = 160; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default(Color), 3f); - 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, 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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 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; - - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class Horse : ModNPC + { + private int chargetimer = 0; + private 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.width = 230; + npc.height = 230; + npc.defense = 30; + 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.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; + banner = npc.type; + bannerItem = mod.ItemType("EarthElementalBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(chargetimer); + writer.Write(basespeed); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + chargetimer = reader.ReadInt32(); + basespeed = reader.ReadInt32(); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || + spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + 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() + { + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AridArtifact")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlagMagnum")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Aftershock")); + } + if (Main.rand.Next(4) == 0) + { + 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) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 31, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + 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.width = 160; + npc.height = 160; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default(Color), 3f); + 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, 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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 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; + + } + } +} diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index c137c9d0a6..820a76a8ed 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -1,286 +1,286 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class IceClasper : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Clasper"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.noGravity = true; - npc.damage = 32; - npc.width = 40; - npc.height = 40; - npc.defense = 23; - npc.lifeMax = 600; - npc.knockBackResist = 0.35f; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 25, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - npc.coldDamage = true; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("IceClasperBanner"); - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = revenge ? 7f : 6f; - float num2 = revenge ? 0.07f : 0.06f; - 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] >= 150f) - { - 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)) - { - int num8 = 36; - if (Main.expertMode) - { - num8 = 25; - } - int num9 = 128; - int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[beam].timeLeft = 300; - } - } - 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), 0f, 0.6f, 0.75f); - } - Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); - float num740 = Main.player[npc.target].Center.X - vector92.X; - float num741 = Main.player[npc.target].Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - if (npc.ai[2] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[2] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 0f) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 150f) - { - npc.ai[2] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - if (npc.ai[2] == 0f) - { - npc.alpha = 0; - npc.noTileCollide = false; - } - else - { - npc.wet = false; - npc.alpha = 200; - npc.noTileCollide = true; - } - 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 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 float SpawnChance(NPCSpawnInfo spawnInfo) - { - return spawnInfo.player.ZoneSnow && - !spawnInfo.player.ZoneTowerStardust && - !spawnInfo.player.ZoneTowerSolar && - !spawnInfo.player.ZoneTowerVortex && - !spawnInfo.player.ZoneTowerNebula && - !spawnInfo.player.ZoneDungeon && - !spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && - Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.007f : 0f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Frostburn, 300, true); - if (Main.rand.Next(3) == 0) - { - player.AddBuff(mod.BuffType("GlacialState"), 30, true); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 92, 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, 92, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - 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")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientIceChunk")); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class IceClasper : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Clasper"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.noGravity = true; + npc.damage = 32; + npc.width = 40; + npc.height = 40; + npc.defense = 23; + npc.lifeMax = 600; + npc.knockBackResist = 0.35f; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 25, 0); + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + npc.coldDamage = true; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("IceClasperBanner"); + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = revenge ? 7f : 6f; + float num2 = revenge ? 0.07f : 0.06f; + 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] >= 150f) + { + 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)) + { + int num8 = 36; + if (Main.expertMode) + { + num8 = 25; + } + int num9 = 128; + int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[beam].timeLeft = 300; + } + } + 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), 0f, 0.6f, 0.75f); + } + Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); + float num740 = Main.player[npc.target].Center.X - vector92.X; + float num741 = Main.player[npc.target].Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + if (npc.ai[2] > 0f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[2] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 0f) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 150f) + { + npc.ai[2] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + if (npc.ai[2] == 0f) + { + npc.alpha = 0; + npc.noTileCollide = false; + } + else + { + npc.wet = false; + npc.alpha = 200; + npc.noTileCollide = true; + } + 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 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 float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.ZoneSnow && + !spawnInfo.player.ZoneTowerStardust && + !spawnInfo.player.ZoneTowerSolar && + !spawnInfo.player.ZoneTowerVortex && + !spawnInfo.player.ZoneTowerNebula && + !spawnInfo.player.ZoneDungeon && + !spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && + Main.hardMode && !spawnInfo.playerInTown && !spawnInfo.player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.007f : 0f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 300, true); + if (Main.rand.Next(3) == 0) + { + player.AddBuff(mod.BuffType("GlacialState"), 30, true); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 92, 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, 92, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + 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")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientIceChunk")); + } + } + } +} diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index e92c22b5b8..bfa892941a 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -1,294 +1,294 @@ -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 ImpiousImmolator : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Impious Immolator"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 0; - npc.width = 60; - npc.height = 60; - npc.defense = 30; - npc.lifeMax = 11000; - npc.aiStyle = -1; - 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.value = Item.buyPrice(0, 0, 50, 0); - npc.HitSound = SoundID.NPCHit5; - npc.DeathSound = SoundID.NPCDeath7; - npc.knockBackResist = 0.2f; - banner = npc.type; - bannerItem = mod.ItemType("ImpiousImmolatorBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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 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 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 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 < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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 ImpiousImmolator : ModNPC + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Impious Immolator"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.lavaImmune = true; + npc.damage = 0; + npc.width = 60; + npc.height = 60; + npc.defense = 30; + npc.lifeMax = 11000; + npc.aiStyle = -1; + 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.value = Item.buyPrice(0, 0, 50, 0); + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + npc.knockBackResist = 0.2f; + banner = npc.type; + bannerItem = mod.ItemType("ImpiousImmolatorBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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 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 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 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 < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/IrradiatedSlime.cs b/NPCs/NormalNPCs/IrradiatedSlime.cs index c26256bd7c..d95fb7e5db 100644 --- a/NPCs/NormalNPCs/IrradiatedSlime.cs +++ b/NPCs/NormalNPCs/IrradiatedSlime.cs @@ -1,98 +1,98 @@ -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 IrradiatedSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Irradiated Slime"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 50; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 100; - npc.lifeMax = 300; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - 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 || !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 HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - 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) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeadCore")); - } - } - } -} \ No newline at end of file +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 IrradiatedSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Irradiated Slime"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 50; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 100; + npc.lifeMax = 300; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + 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 || !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 HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + 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) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeadCore")); + } + } + } +} diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index 9e16420ca0..d283936b6b 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -1,86 +1,86 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class OverloadedSoldier : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Overloaded Soldier"); - Main.npcFrameCount[npc.type] = 15; - } - - public override void SetDefaults() - { - npc.aiStyle = 3; - npc.damage = 42; - npc.width = 18; //324 - npc.height = 40; //216 - npc.defense = 28; - npc.lifeMax = 90; - npc.knockBackResist = 0.5f; - animationType = 77; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit2; - npc.DeathSound = SoundID.NPCDeath2; - banner = npc.type; - bannerItem = mod.ItemType("OverloadedSoldierBanner"); - } - - public override void AI() - { - npc.velocity.X *= 1.05f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || - spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.02f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 60, 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, 60, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); - if (NPC.downedMoonlord) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm")); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class OverloadedSoldier : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Overloaded Soldier"); + Main.npcFrameCount[npc.type] = 15; + } + + public override void SetDefaults() + { + npc.aiStyle = 3; + npc.damage = 42; + npc.width = 18; //324 + npc.height = 40; //216 + npc.defense = 28; + npc.lifeMax = 90; + npc.knockBackResist = 0.5f; + animationType = 77; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit2; + npc.DeathSound = SoundID.NPCDeath2; + banner = npc.type; + bannerItem = mod.ItemType("OverloadedSoldierBanner"); + } + + public override void AI() + { + npc.velocity.X *= 1.05f; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || + spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.02f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 60, 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, 60, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); + if (NPC.downedMoonlord) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm")); + } + } + } +} diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index 086c7144c0..2d6da30b89 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -1,72 +1,72 @@ -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 PerennialSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perennial Slime"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 35; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 16; - npc.lifeMax = 150; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.alpha = 50; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("PerennialSlimeBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || - spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Cavern.Chance * 0.08f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("CESparkle"), hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("CESparkle"), hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PerennialOre"), Main.rand.Next(10, 27)); - } - } -} \ No newline at end of file +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 PerennialSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perennial Slime"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 35; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 16; + npc.lifeMax = 150; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.alpha = 50; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("PerennialSlimeBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || + spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Cavern.Chance * 0.08f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("CESparkle"), hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("CESparkle"), hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PerennialOre"), Main.rand.Next(10, 27)); + } + } +} diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index a6fb9b089e..6f90f42314 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -1,133 +1,133 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class PhantomDebris : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Debris"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 30; - npc.width = 44; //324 - npc.height = 22; //216 - npc.defense = 35; - npc.lifeMax = 80; - npc.aiStyle = 3; - aiType = 67; - npc.knockBackResist = 0.5f; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit2; - npc.DeathSound = SoundID.NPCDeath36; - banner = npc.type; - bannerItem = mod.ItemType("PhantomDebrisBanner"); - } - - 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() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - float num78 = 1f; - float num79 = (Main.player[npc.target].Center - npc.Center).Length(); - num79 *= 0.0025f; - if ((double)num79 > 1.5) - { - num79 = 1.5f; - } - if (Main.expertMode) - { - num78 = 4f - num79; - } - else - { - num78 = 3f - num79; - } - num78 *= 0.8f; - if (npc.velocity.X < -num78 || npc.velocity.X > num78) - { - if (npc.velocity.Y == 0f) - { - npc.velocity *= 0.8f; - } - } - else if (npc.velocity.X < num78 && npc.direction == 1) - { - npc.velocity.X = npc.velocity.X + 1.5f; - if (npc.velocity.X > num78) - { - npc.velocity.X = num78; - } - } - else if (npc.velocity.X > -num78 && npc.direction == -1) - { - npc.velocity.X = npc.velocity.X - 1.5f; - if (npc.velocity.X < -num78) - { - npc.velocity.X = -num78; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || - spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.02f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 60, 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, 60, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); - if (NPC.downedMoonlord) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm")); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class PhantomDebris : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Debris"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 30; + npc.width = 44; //324 + npc.height = 22; //216 + npc.defense = 35; + npc.lifeMax = 80; + npc.aiStyle = 3; + aiType = 67; + npc.knockBackResist = 0.5f; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit2; + npc.DeathSound = SoundID.NPCDeath36; + banner = npc.type; + bannerItem = mod.ItemType("PhantomDebrisBanner"); + } + + 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() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + float num78 = 1f; + float num79 = (Main.player[npc.target].Center - npc.Center).Length(); + num79 *= 0.0025f; + if ((double)num79 > 1.5) + { + num79 = 1.5f; + } + if (Main.expertMode) + { + num78 = 4f - num79; + } + else + { + num78 = 3f - num79; + } + num78 *= 0.8f; + if (npc.velocity.X < -num78 || npc.velocity.X > num78) + { + if (npc.velocity.Y == 0f) + { + npc.velocity *= 0.8f; + } + } + else if (npc.velocity.X < num78 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + 1.5f; + if (npc.velocity.X > num78) + { + npc.velocity.X = num78; + } + } + else if (npc.velocity.X > -num78 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - 1.5f; + if (npc.velocity.X < -num78) + { + npc.velocity.X = -num78; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || + spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.02f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 60, 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, 60, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); + if (NPC.downedMoonlord) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm")); + } + } + } +} diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index ac49303326..521307cac7 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -1,101 +1,101 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class PhantomSpirit : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 3; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 70; - npc.width = 16; //324 - npc.height = 16; //216 - npc.defense = 40; - npc.lifeMax = 1000; - npc.knockBackResist = 0.1f; - animationType = 288; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - banner = npc.type; - bannerItem = mod.ItemType("PhantomSpiritBanner"); - } - - public override void AI() - { - npc.TargetClosest(true); - Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); - float num818 = Main.player[npc.target].Center.X - vector102.X; - float num819 = Main.player[npc.target].Center.Y - vector102.Y; - float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); - float num821 = 17f; - num820 = num821 / num820; - num818 *= num820; - num819 *= num820; - npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; - npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default(Color), 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - return; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int num288 = 0; num288 < 50; num288++) - { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default(Color), 1f); - Dust dust = Main.dust[num289]; - dust.velocity *= 2f; - Main.dust[num289].noGravity = true; - Main.dust[num289].scale = 1.4f; - } - } - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, 0); - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm")); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class PhantomSpirit : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Spirit"); + Main.npcFrameCount[npc.type] = 3; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 70; + npc.width = 16; //324 + npc.height = 16; //216 + npc.defense = 40; + npc.lifeMax = 1000; + npc.knockBackResist = 0.1f; + animationType = 288; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 20, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = true; + banner = npc.type; + bannerItem = mod.ItemType("PhantomSpiritBanner"); + } + + public override void AI() + { + npc.TargetClosest(true); + Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); + float num818 = Main.player[npc.target].Center.X - vector102.X; + float num819 = Main.player[npc.target].Center.Y - vector102.Y; + float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); + float num821 = 17f; + num820 = num821 / num820; + num818 *= num820; + num819 *= num820; + npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; + npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default(Color), 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + return; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int num288 = 0; num288 < 50; num288++) + { + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default(Color), 1f); + Dust dust = Main.dust[num289]; + dust.velocity *= 2f; + Main.dust[num289].noGravity = true; + Main.dust[num289].scale = 1.4f; + } + } + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, 0); + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm")); + } + } +} diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index 22a89ac7e7..0d431ef3e0 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -1,153 +1,153 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class PhantomSpiritL : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 100; - npc.width = 32; //324 - npc.height = 32; //216 - npc.scale = 1.2f; - npc.defense = 100; - npc.lifeMax = 9000; - npc.knockBackResist = 0f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 60, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - banner = mod.NPCType("PhantomSpirit"); - bannerItem = mod.ItemType("PhantomSpiritBanner"); - } - - 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() - { - npc.TargetClosest(true); - Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); - float num818 = Main.player[npc.target].Center.X - vector102.X; - float num819 = Main.player[npc.target].Center.Y - vector102.Y; - float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); - float num821 = 12f; - num820 = num821 / num820; - num818 *= num820; - num819 *= num820; - npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; - npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default(Color), 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - Vector2 vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; - float num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; - float num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); - num149 = 4f / num149; - num147 *= num149; - num148 *= num149; - vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; - num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; - num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); - if (num149 > 800f) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[2] += 1f; - if (npc.ai[3] == 0f) - { - if (npc.ai[2] > 120f) - { - npc.ai[2] = 0f; - npc.ai[3] = 1f; - npc.netUpdate = true; - return; - } - } - else - { - if (npc.ai[2] > 40f) - { - npc.ai[3] = 0f; - } - if (Main.netMode != 1 && npc.ai[2] == 20f) - { - float num151 = 5f; - int num152 = 60; - int num153 = mod.ProjectileType("PhantomGhostShot"); - num149 = num151 / num149; - num147 *= num149; - num148 *= num149; - int num154 = Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int num288 = 0; num288 < 50; num288++) - { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default(Color), 1f); - Dust dust = Main.dust[num289]; - dust.velocity *= 2f; - Main.dust[num289].noGravity = true; - Main.dust[num289].scale = 1.4f; - } - } - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, 0); - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(2, 5)); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class PhantomSpiritL : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Spirit"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 100; + npc.width = 32; //324 + npc.height = 32; //216 + npc.scale = 1.2f; + npc.defense = 100; + npc.lifeMax = 9000; + npc.knockBackResist = 0f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 60, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = true; + banner = mod.NPCType("PhantomSpirit"); + bannerItem = mod.ItemType("PhantomSpiritBanner"); + } + + 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() + { + npc.TargetClosest(true); + Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); + float num818 = Main.player[npc.target].Center.X - vector102.X; + float num819 = Main.player[npc.target].Center.Y - vector102.Y; + float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); + float num821 = 12f; + num820 = num821 / num820; + num818 *= num820; + num819 *= num820; + npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; + npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default(Color), 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + Vector2 vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; + float num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; + float num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); + num149 = 4f / num149; + num147 *= num149; + num148 *= num149; + vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; + num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; + num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); + if (num149 > 800f) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return; + } + npc.ai[2] += 1f; + if (npc.ai[3] == 0f) + { + if (npc.ai[2] > 120f) + { + npc.ai[2] = 0f; + npc.ai[3] = 1f; + npc.netUpdate = true; + return; + } + } + else + { + if (npc.ai[2] > 40f) + { + npc.ai[3] = 0f; + } + if (Main.netMode != 1 && npc.ai[2] == 20f) + { + float num151 = 5f; + int num152 = 60; + int num153 = mod.ProjectileType("PhantomGhostShot"); + num149 = num151 / num149; + num147 *= num149; + num148 *= num149; + int num154 = Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int num288 = 0; num288 < 50; num288++) + { + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default(Color), 1f); + Dust dust = Main.dust[num289]; + dust.velocity *= 2f; + Main.dust[num289].noGravity = true; + Main.dust[num289].scale = 1.4f; + } + } + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, 0); + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(2, 5)); + } + } +} diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index 300f176d95..fd77db3511 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -1,109 +1,109 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class PhantomSpiritM : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 90; - npc.width = 32; //324 - npc.height = 32; //216 - npc.scale = 1.1f; - npc.defense = 70; - npc.lifeMax = 2100; - npc.knockBackResist = 0.1f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 40, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - banner = mod.NPCType("PhantomSpirit"); - bannerItem = mod.ItemType("PhantomSpiritBanner"); - } - - 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() - { - npc.TargetClosest(true); - Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); - float num818 = Main.player[npc.target].Center.X - vector102.X; - float num819 = Main.player[npc.target].Center.Y - vector102.Y; - float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); - float num821 = 13.5f; - num820 = num821 / num820; - num818 *= num820; - num819 *= num820; - npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; - npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default(Color), 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - return; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 150); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int num288 = 0; num288 < 50; num288++) - { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default(Color), 1f); - Dust dust = Main.dust[num289]; - dust.velocity *= 2f; - Main.dust[num289].noGravity = true; - Main.dust[num289].scale = 1.4f; - } - } - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, 0); - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(1, 4)); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class PhantomSpiritM : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Spirit"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 90; + npc.width = 32; //324 + npc.height = 32; //216 + npc.scale = 1.1f; + npc.defense = 70; + npc.lifeMax = 2100; + npc.knockBackResist = 0.1f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 40, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = true; + banner = mod.NPCType("PhantomSpirit"); + bannerItem = mod.ItemType("PhantomSpiritBanner"); + } + + 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() + { + npc.TargetClosest(true); + Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); + float num818 = Main.player[npc.target].Center.X - vector102.X; + float num819 = Main.player[npc.target].Center.Y - vector102.Y; + float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); + float num821 = 13.5f; + num820 = num821 / num820; + num818 *= num820; + num819 *= num820; + npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; + npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default(Color), 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + return; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 150); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int num288 = 0; num288 < 50; num288++) + { + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default(Color), 1f); + Dust dust = Main.dust[num289]; + dust.velocity *= 2f; + Main.dust[num289].noGravity = true; + Main.dust[num289].scale = 1.4f; + } + } + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, 0); + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(1, 4)); + } + } +} diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 2b85fdf77e..b86ee34cc5 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -1,108 +1,108 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class PhantomSpiritS : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Spirit"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 80; - npc.width = 32; //324 - npc.height = 32; //216 - npc.defense = 50; - npc.lifeMax = 1500; - npc.knockBackResist = 0.1f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 30, 0); - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - npc.noGravity = true; - npc.noTileCollide = true; - banner = mod.NPCType("PhantomSpirit"); - bannerItem = mod.ItemType("PhantomSpiritBanner"); - } - - 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() - { - npc.TargetClosest(true); - Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); - float num818 = Main.player[npc.target].Center.X - vector102.X; - float num819 = Main.player[npc.target].Center.Y - vector102.Y; - float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); - float num821 = 15f; - num820 = num821 / num820; - num818 *= num820; - num819 *= num820; - npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; - npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default(Color), 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - return; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 150); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int num288 = 0; num288 < 50; num288++) - { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default(Color), 1f); - Dust dust = Main.dust[num289]; - dust.velocity *= 2f; - Main.dust[num289].noGravity = true; - Main.dust[num289].scale = 1.4f; - } - } - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, 0); - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(1, 3)); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class PhantomSpiritS : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Spirit"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 80; + npc.width = 32; //324 + npc.height = 32; //216 + npc.defense = 50; + npc.lifeMax = 1500; + npc.knockBackResist = 0.1f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 30, 0); + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + npc.noGravity = true; + npc.noTileCollide = true; + banner = mod.NPCType("PhantomSpirit"); + bannerItem = mod.ItemType("PhantomSpiritBanner"); + } + + 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() + { + npc.TargetClosest(true); + Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); + float num818 = Main.player[npc.target].Center.X - vector102.X; + float num819 = Main.player[npc.target].Center.Y - vector102.Y; + float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); + float num821 = 15f; + num820 = num821 / num820; + num818 *= num820; + num819 *= num820; + npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f; + npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f; + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default(Color), 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + return; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 150); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int num288 = 0; num288 < 50; num288++) + { + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default(Color), 1f); + Dust dust = Main.dust[num289]; + dust.velocity *= 2f; + Main.dust[num289].noGravity = true; + Main.dust[num289].scale = 1.4f; + } + } + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, 0); + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Phantoplasm"), Main.rand.Next(1, 3)); + } + } +} diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index 518c3ccc4c..1dc8d47d58 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -103,4 +103,4 @@ namespace CalamityMod.NPCs.NormalNPCs } } } -} \ No newline at end of file +} diff --git a/NPCs/NormalNPCs/Pitbull.cs b/NPCs/NormalNPCs/Pitbull.cs index de677497c1..bfa734c84c 100644 --- a/NPCs/NormalNPCs/Pitbull.cs +++ b/NPCs/NormalNPCs/Pitbull.cs @@ -1,68 +1,68 @@ -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 Pitbull : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pitbull"); - Main.npcFrameCount[npc.type] = 10; - } - - public override void SetDefaults() - { - npc.aiStyle = 26; - npc.damage = 18; - npc.width = 46; //324 - npc.height = 30; //216 - npc.defense = 12; - npc.lifeMax = 60; - npc.knockBackResist = 0.3f; - animationType = 329; - aiType = NPCID.Wolf; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath5; - banner = npc.type; - bannerItem = mod.ItemType("PitbullBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedBoss1 || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldNightMonster.Chance * 0.045f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 180, true); - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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 Pitbull : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pitbull"); + Main.npcFrameCount[npc.type] = 10; + } + + public override void SetDefaults() + { + npc.aiStyle = 26; + npc.damage = 18; + npc.width = 46; //324 + npc.height = 30; //216 + npc.defense = 12; + npc.lifeMax = 60; + npc.knockBackResist = 0.3f; + animationType = 329; + aiType = NPCID.Wolf; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath5; + banner = npc.type; + bannerItem = mod.ItemType("PitbullBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedBoss1 || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldNightMonster.Chance * 0.045f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Bleeding, 180, true); + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/PlagueBee.cs b/NPCs/NormalNPCs/PlagueBee.cs index 8d87c6254b..c38028ae71 100644 --- a/NPCs/NormalNPCs/PlagueBee.cs +++ b/NPCs/NormalNPCs/PlagueBee.cs @@ -1,87 +1,87 @@ -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 PlagueBee : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Charger"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 37; - npc.width = 36; //324 - npc.height = 30; //216 - npc.defense = 20; - npc.scale = 0.5f; - npc.lifeMax = 200; - npc.aiStyle = 5; - aiType = 210; - npc.knockBackResist = 0f; - animationType = 210; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - banner = npc.type; - bannerItem = mod.ItemType("PlagueChargerBanner"); - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.12f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 180, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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 PlagueBee : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Charger"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 37; + npc.width = 36; //324 + npc.height = 30; //216 + npc.defense = 20; + npc.scale = 0.5f; + npc.lifeMax = 200; + npc.aiStyle = 5; + aiType = 210; + npc.knockBackResist = 0f; + animationType = 210; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = false; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + banner = npc.type; + bannerItem = mod.ItemType("PlagueChargerBanner"); + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.12f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 180, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/PlagueBeeLarge.cs b/NPCs/NormalNPCs/PlagueBeeLarge.cs index b4787b829a..9279c4fef0 100644 --- a/NPCs/NormalNPCs/PlagueBeeLarge.cs +++ b/NPCs/NormalNPCs/PlagueBeeLarge.cs @@ -1,87 +1,87 @@ -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 PlagueBeeLarge : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Charger"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 45; - npc.width = 36; //324 - npc.height = 30; //216 - npc.defense = 23; - npc.scale = 0.75f; - npc.lifeMax = 300; - npc.aiStyle = 5; - aiType = 210; - npc.knockBackResist = 0f; - animationType = 210; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - banner = mod.NPCType("PlagueBee"); - bannerItem = mod.ItemType("PlagueChargerBanner"); - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(2, 4)); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.12f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 180, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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 PlagueBeeLarge : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Charger"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 45; + npc.width = 36; //324 + npc.height = 30; //216 + npc.defense = 23; + npc.scale = 0.75f; + npc.lifeMax = 300; + npc.aiStyle = 5; + aiType = 210; + npc.knockBackResist = 0f; + animationType = 210; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = false; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + banner = mod.NPCType("PlagueBee"); + bannerItem = mod.ItemType("PlagueChargerBanner"); + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(2, 4)); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.12f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 180, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/PlaguedDerpling.cs b/NPCs/NormalNPCs/PlaguedDerpling.cs index a7e872904e..132438e31e 100644 --- a/NPCs/NormalNPCs/PlaguedDerpling.cs +++ b/NPCs/NormalNPCs/PlaguedDerpling.cs @@ -1,195 +1,195 @@ -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 PlaguedDerpling : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Viruling"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 60; - npc.width = 58; //324 - npc.height = 44; //216 - npc.defense = 38; - npc.lifeMax = 400; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit22; - npc.DeathSound = SoundID.NPCDeath25; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - banner = npc.type; - bannerItem = mod.ItemType("VirulingBanner"); - } - - 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() - { - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = 6f; //2 - float num2 = 0.05f; - 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; - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - 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; - } - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); - } - else 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 (((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; - } - int num13 = Dust.NewDust(new Vector2(npc.position.X - npc.velocity.X, npc.position.Y - npc.velocity.Y), npc.width, npc.height, 46, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); - Main.dust[num13].noGravity = true; - Dust expr_F26_cp_0 = Main.dust[num13]; - expr_F26_cp_0.velocity.X = expr_F26_cp_0.velocity.X * 0.3f; - Dust expr_F44_cp_0 = Main.dust[num13]; - expr_F44_cp_0.velocity.Y = expr_F44_cp_0.velocity.Y * 0.3f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.09f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 300, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling3"), 1f); - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); - } - } -} \ No newline at end of file +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 PlaguedDerpling : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Viruling"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 60; + npc.width = 58; //324 + npc.height = 44; //216 + npc.defense = 38; + npc.lifeMax = 400; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit22; + npc.DeathSound = SoundID.NPCDeath25; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + banner = npc.type; + bannerItem = mod.ItemType("VirulingBanner"); + } + + 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() + { + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = 6f; //2 + float num2 = 0.05f; + 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; + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + 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; + } + if (num4 > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + } + else 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 (((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; + } + int num13 = Dust.NewDust(new Vector2(npc.position.X - npc.velocity.X, npc.position.Y - npc.velocity.Y), npc.width, npc.height, 46, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); + Main.dust[num13].noGravity = true; + Dust expr_F26_cp_0 = Main.dust[num13]; + expr_F26_cp_0.velocity.X = expr_F26_cp_0.velocity.X * 0.3f; + Dust expr_F44_cp_0 = Main.dust[num13]; + expr_F44_cp_0.velocity.Y = expr_F44_cp_0.velocity.Y * 0.3f; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.09f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 300, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling3"), 1f); + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); + } + } +} diff --git a/NPCs/NormalNPCs/PlaguedFlyingFox.cs b/NPCs/NormalNPCs/PlaguedFlyingFox.cs index fd70d20364..8703f0c0f0 100644 --- a/NPCs/NormalNPCs/PlaguedFlyingFox.cs +++ b/NPCs/NormalNPCs/PlaguedFlyingFox.cs @@ -1,85 +1,85 @@ -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 PlaguedFlyingFox : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Melter"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.5f; - npc.aiStyle = 14; - aiType = 152; - animationType = 152; - npc.damage = 55; - npc.width = 38; //324 - npc.height = 34; //216 - npc.defense = 35; - npc.lifeMax = 500; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath4; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - banner = npc.type; - bannerItem = mod.ItemType("MelterBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.09f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 300, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); - } - } -} \ No newline at end of file +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 PlaguedFlyingFox : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Melter"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.5f; + npc.aiStyle = 14; + aiType = 152; + animationType = 152; + npc.damage = 55; + npc.width = 38; //324 + npc.height = 34; //216 + npc.defense = 35; + npc.lifeMax = 500; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath4; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + banner = npc.type; + bannerItem = mod.ItemType("MelterBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.09f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 300, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); + } + } +} diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.cs b/NPCs/NormalNPCs/PlaguedJungleSlime.cs index cac0467eca..df251c05ae 100644 --- a/NPCs/NormalNPCs/PlaguedJungleSlime.cs +++ b/NPCs/NormalNPCs/PlaguedJungleSlime.cs @@ -1,145 +1,145 @@ -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 PlaguedJungleSlime : ModNPC - { - public float spikeTimer = 60f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pestilent Slime"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 55; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 25; - npc.lifeMax = 350; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 10, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - banner = npc.type; - bannerItem = mod.ItemType("PestilentSlimeBanner"); - } - - public override void AI() - { - if (spikeTimer > 0f) - { - spikeTimer -= 1f; - } - if (!npc.wet) - { - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; - float num15 = Main.player[npc.target].position.Y - vector3.Y; - float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if (Main.expertMode && num16 < 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) - { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - if (Main.netMode != 1 && spikeTimer == 0f) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); - for (int n = 0; n < 5; n++) - { - Vector2 vector4 = new Vector2((float)(n - 2), -4f); - vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - vector4.Normalize(); - vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; - Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, mod.ProjectileType("PlagueStingerGoliathV2"), 25, 0f, Main.myPlayer, 0f, 0f); - spikeTimer = 30f; - } - } - } - else if (num16 < 360f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) - { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - if (Main.netMode != 1 && spikeTimer == 0f) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); - num15 = Main.player[npc.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); - num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - num16 = 6.5f / num16; - num14 *= num16; - num15 *= num16; - spikeTimer = 50f; - Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, mod.ProjectileType("PlagueStingerGoliathV2"), 22, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.09f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 300, true); - } - } -} \ No newline at end of file +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 PlaguedJungleSlime : ModNPC + { + public float spikeTimer = 60f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pestilent Slime"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 55; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 25; + npc.lifeMax = 350; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 10, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + banner = npc.type; + bannerItem = mod.ItemType("PestilentSlimeBanner"); + } + + public override void AI() + { + if (spikeTimer > 0f) + { + spikeTimer -= 1f; + } + if (!npc.wet) + { + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; + float num15 = Main.player[npc.target].position.Y - vector3.Y; + float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + if (Main.expertMode && num16 < 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + if (Main.netMode != 1 && spikeTimer == 0f) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); + for (int n = 0; n < 5; n++) + { + Vector2 vector4 = new Vector2((float)(n - 2), -4f); + vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector4.Normalize(); + vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; + Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, mod.ProjectileType("PlagueStingerGoliathV2"), 25, 0f, Main.myPlayer, 0f, 0f); + spikeTimer = 30f; + } + } + } + else if (num16 < 360f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + if (Main.netMode != 1 && spikeTimer == 0f) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); + num15 = Main.player[npc.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); + num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + num16 = 6.5f / num16; + num14 *= num16; + num15 *= num16; + spikeTimer = 50f; + Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, mod.ProjectileType("PlagueStingerGoliathV2"), 22, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.09f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(1, 3)); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 300, true); + } + } +} diff --git a/NPCs/NormalNPCs/PlaguedTortoise.cs b/NPCs/NormalNPCs/PlaguedTortoise.cs index 90fe3ee827..f5c8dfb6dc 100644 --- a/NPCs/NormalNPCs/PlaguedTortoise.cs +++ b/NPCs/NormalNPCs/PlaguedTortoise.cs @@ -1,87 +1,87 @@ -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.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class PlaguedTortoise : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plagueshell"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.npcSlots = 2f; - npc.damage = 80; - npc.aiStyle = 39; - npc.width = 46; - npc.height = 32; - npc.defense = 48; - npc.lifeMax = 800; - npc.knockBackResist = 0.2f; - animationType = 153; - npc.value = Item.buyPrice(0, 0, 20, 0); - npc.HitSound = SoundID.NPCHit24; - npc.DeathSound = SoundID.NPCDeath27; - npc.noGravity = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - banner = npc.type; - bannerItem = mod.ItemType("PlagueshellBanner"); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.09f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 300, true); - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(3, 5)); - } - } -} \ No newline at end of file +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.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class PlaguedTortoise : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plagueshell"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.npcSlots = 2f; + npc.damage = 80; + npc.aiStyle = 39; + npc.width = 46; + npc.height = 32; + npc.defense = 48; + npc.lifeMax = 800; + npc.knockBackResist = 0.2f; + animationType = 153; + npc.value = Item.buyPrice(0, 0, 20, 0); + npc.HitSound = SoundID.NPCHit24; + npc.DeathSound = SoundID.NPCDeath27; + npc.noGravity = false; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + banner = npc.type; + bannerItem = mod.ItemType("PlagueshellBanner"); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.09f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 300, true); + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(3, 5)); + } + } +} diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index d9bd0aa782..c40e62d1c4 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -1,89 +1,89 @@ -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 ProfanedEnergyBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Energy"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.npcSlots = 3f; - npc.width = 72; //324 - npc.height = 36; //216 - npc.defense = 58; - npc.lifeMax = 6000; - npc.knockBackResist = 0f; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.lavaImmune = true; - npc.noGravity = true; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - banner = npc.type; - bannerItem = mod.ItemType("ProfanedEnergyBanner"); - } - - public override void AI() - { - CalamityGlobalNPC.energyFlame = npc.whoAmI; - if (Main.netMode != 1) - { - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - for (int num723 = 0; num723 < 2; num723++) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("ProfanedEnergyLantern"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedMoonlord || NPC.AnyNPCs(npc.type)) - { - return 0f; - } - if (SpawnCondition.Underworld.Chance > 0f) - { - return SpawnCondition.Underworld.Chance / 6f; - } - return SpawnCondition.OverworldHallow.Chance / 6f; - } - - 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); - } - } - } - - 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)); - } - } -} \ No newline at end of file +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 ProfanedEnergyBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Energy"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.npcSlots = 3f; + npc.width = 72; //324 + npc.height = 36; //216 + npc.defense = 58; + npc.lifeMax = 6000; + npc.knockBackResist = 0f; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 50, 0); + npc.lavaImmune = true; + npc.noGravity = true; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + banner = npc.type; + bannerItem = mod.ItemType("ProfanedEnergyBanner"); + } + + public override void AI() + { + CalamityGlobalNPC.energyFlame = npc.whoAmI; + if (Main.netMode != 1) + { + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + for (int num723 = 0; num723 < 2; num723++) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("ProfanedEnergyLantern"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedMoonlord || NPC.AnyNPCs(npc.type)) + { + return 0f; + } + if (SpawnCondition.Underworld.Chance > 0f) + { + return SpawnCondition.Underworld.Chance / 6f; + } + return SpawnCondition.OverworldHallow.Chance / 6f; + } + + 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); + } + } + } + + 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/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index aff936bc49..f7a12ba8c1 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -1,236 +1,236 @@ -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 ProfanedEnergyLantern : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Energy"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.damage = 60; - npc.width = 30; //324 - npc.height = 30; //216 - npc.lifeMax = 1; - aiType = -1; - npc.lavaImmune = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } - - public override void AI() - { - if (CalamityGlobalNPC.energyFlame < 0 || !Main.npc[CalamityGlobalNPC.energyFlame].active) - { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); - npc.netUpdate = true; - return; - } - int num750 = CalamityGlobalNPC.energyFlame; - if (npc.ai[3] > 0f) - { - num750 = (int)npc.ai[3] - 1; - } - if (Main.netMode != 1) - { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(120, 480); - npc.ai[0] = (float)Main.rand.Next(-100, 101); - npc.ai[1] = (float)Main.rand.Next(-100, 101); - npc.netUpdate = true; - } - } - npc.TargetClosest(true); - float num751 = 0.1f; - float num752 = 500f; - if ((double)Main.npc[CalamityGlobalNPC.energyFlame].life < (double)Main.npc[CalamityGlobalNPC.energyFlame].lifeMax * 0.25) - { - num752 += 50f; - } - if ((double)Main.npc[CalamityGlobalNPC.energyFlame].life < (double)Main.npc[CalamityGlobalNPC.energyFlame].lifeMax * 0.1) - { - num752 += 50f; - } - if (Main.expertMode) - { - float num753 = 1f - (float)npc.life / (float)npc.lifeMax; - num752 += num753 * 200f; - num751 += 0.15f; - } - if (!Main.npc[num750].active || CalamityGlobalNPC.energyFlame < 0) - { - npc.active = false; - return; - } - Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); - float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; - float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; - float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); - float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); - float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); - Vector2 vector93 = new Vector2(num754, num755); - float num756 = num754 + npc.ai[0]; - float num757 = num755 + npc.ai[1]; - float num758 = num756 - vector93.X; - float num759 = num757 - vector93.Y; - float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); - num760 = num752 / num760; - num758 *= num760; - num759 *= num760; - if (npc.position.X < num754 + num758) - { - npc.velocity.X = npc.velocity.X + num751; - if (npc.velocity.X < 0f && num758 > 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - else if (npc.position.X > num754 + num758) - { - npc.velocity.X = npc.velocity.X - num751; - if (npc.velocity.X > 0f && num758 < 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (npc.position.Y < num755 + num759) - { - npc.velocity.Y = npc.velocity.Y + num751; - if (npc.velocity.Y < 0f && num759 > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - else if (npc.position.Y > num755 + num759) - { - npc.velocity.Y = npc.velocity.Y - num751; - if (npc.velocity.Y > 0f && num759 < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - } - if (npc.velocity.X > 8f) - { - npc.velocity.X = 8f; - } - if (npc.velocity.X < -8f) - { - npc.velocity.X = -8f; - } - if (npc.velocity.Y > 8f) - { - npc.velocity.Y = 8f; - } - if (npc.velocity.Y < -8f) - { - npc.velocity.Y = -8f; - } - if (Main.netMode != 1) - { - if (!Main.player[npc.target].dead) - { - npc.localAI[1] += (float)Main.rand.Next(1, 6); - if (npc.localAI[1] >= 600f) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - float num196 = 11f; - vector22 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num189 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector22.X + (float)Main.rand.Next(-10, 11); - float num197 = Math.Abs(num189 * 0.1f); - if (num190 > 0f) - { - num197 = 0f; - } - num190 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector22.Y + (float)Main.rand.Next(-10, 11) - num197; - num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); - num191 = num196 / num191; - num189 *= num191; - num190 *= num191; - int num9 = mod.ProjectileType("HolyBomb"); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num189, num190, num9, 40, 0f, Main.myPlayer, 0f, 0f); - npc.localAI[1] = 0f; - return; - } - npc.localAI[1] = 250f; - } - } - } - } - - 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 PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (CalamityGlobalNPC.energyFlame != -1) - { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float drawPositionX = Main.npc[CalamityGlobalNPC.energyFlame].Center.X - center.X; - float drawPositionY = Main.npc[CalamityGlobalNPC.energyFlame].Center.Y - center.Y; - drawPositionY += 10f; - float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; - bool draw = true; - while (draw) - { - float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); - if (totalDrawDistance < 16f) - { - draw = false; - } - else - { - totalDrawDistance = 16f / totalDrawDistance; - drawPositionX *= totalDrawDistance; - drawPositionY *= totalDrawDistance; - center.X += drawPositionX; - center.Y += drawPositionY; - drawPositionX = Main.npc[CalamityGlobalNPC.energyFlame].Center.X - center.X; - drawPositionY = Main.npc[CalamityGlobalNPC.energyFlame].Center.Y - center.Y; - drawPositionY -= 10f; - Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/NormalNPCs/ProfanedEnergySegment"), 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/NormalNPCs/ProfanedEnergySegment").Width, mod.GetTexture("NPCs/NormalNPCs/ProfanedEnergySegment").Height)), color, rotation, - new Vector2((float)mod.GetTexture("NPCs/NormalNPCs/ProfanedEnergySegment").Width * 0.5f, (float)mod.GetTexture("NPCs/NormalNPCs/ProfanedEnergySegment").Height * 0.5f), 1f, SpriteEffects.None, 0f); - } - } - } - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - 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 +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 ProfanedEnergyLantern : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Energy"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 1f; + npc.aiStyle = -1; + npc.damage = 60; + npc.width = 30; //324 + npc.height = 30; //216 + npc.lifeMax = 1; + aiType = -1; + npc.lavaImmune = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.dontTakeDamage = true; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } + + public override void AI() + { + if (CalamityGlobalNPC.energyFlame < 0 || !Main.npc[CalamityGlobalNPC.energyFlame].active) + { + npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); + npc.netUpdate = true; + return; + } + int num750 = CalamityGlobalNPC.energyFlame; + if (npc.ai[3] > 0f) + { + num750 = (int)npc.ai[3] - 1; + } + if (Main.netMode != 1) + { + npc.localAI[0] -= 1f; + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = (float)Main.rand.Next(120, 480); + npc.ai[0] = (float)Main.rand.Next(-100, 101); + npc.ai[1] = (float)Main.rand.Next(-100, 101); + npc.netUpdate = true; + } + } + npc.TargetClosest(true); + float num751 = 0.1f; + float num752 = 500f; + if ((double)Main.npc[CalamityGlobalNPC.energyFlame].life < (double)Main.npc[CalamityGlobalNPC.energyFlame].lifeMax * 0.25) + { + num752 += 50f; + } + if ((double)Main.npc[CalamityGlobalNPC.energyFlame].life < (double)Main.npc[CalamityGlobalNPC.energyFlame].lifeMax * 0.1) + { + num752 += 50f; + } + if (Main.expertMode) + { + float num753 = 1f - (float)npc.life / (float)npc.lifeMax; + num752 += num753 * 200f; + num751 += 0.15f; + } + if (!Main.npc[num750].active || CalamityGlobalNPC.energyFlame < 0) + { + npc.active = false; + return; + } + Vector2 vector22 = new Vector2(npc.ai[0] * 16f + 8f, npc.ai[1] * 16f + 8f); + float num189 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - (float)(npc.width / 2) - vector22.X; + float num190 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)(npc.height / 2) - vector22.Y; + float num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); + float num754 = Main.npc[num750].position.X + (float)(Main.npc[num750].width / 2); + float num755 = Main.npc[num750].position.Y + (float)(Main.npc[num750].height / 2); + Vector2 vector93 = new Vector2(num754, num755); + float num756 = num754 + npc.ai[0]; + float num757 = num755 + npc.ai[1]; + float num758 = num756 - vector93.X; + float num759 = num757 - vector93.Y; + float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759)); + num760 = num752 / num760; + num758 *= num760; + num759 *= num760; + if (npc.position.X < num754 + num758) + { + npc.velocity.X = npc.velocity.X + num751; + if (npc.velocity.X < 0f && num758 > 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + else if (npc.position.X > num754 + num758) + { + npc.velocity.X = npc.velocity.X - num751; + if (npc.velocity.X > 0f && num758 < 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + } + if (npc.position.Y < num755 + num759) + { + npc.velocity.Y = npc.velocity.Y + num751; + if (npc.velocity.Y < 0f && num759 > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + else if (npc.position.Y > num755 + num759) + { + npc.velocity.Y = npc.velocity.Y - num751; + if (npc.velocity.Y > 0f && num759 < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.9f; + } + } + if (npc.velocity.X > 8f) + { + npc.velocity.X = 8f; + } + if (npc.velocity.X < -8f) + { + npc.velocity.X = -8f; + } + if (npc.velocity.Y > 8f) + { + npc.velocity.Y = 8f; + } + if (npc.velocity.Y < -8f) + { + npc.velocity.Y = -8f; + } + if (Main.netMode != 1) + { + if (!Main.player[npc.target].dead) + { + npc.localAI[1] += (float)Main.rand.Next(1, 6); + if (npc.localAI[1] >= 600f) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + float num196 = 11f; + vector22 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num189 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector22.X + (float)Main.rand.Next(-10, 11); + float num197 = Math.Abs(num189 * 0.1f); + if (num190 > 0f) + { + num197 = 0f; + } + num190 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector22.Y + (float)Main.rand.Next(-10, 11) - num197; + num191 = (float)Math.Sqrt((double)(num189 * num189 + num190 * num190)); + num191 = num196 / num191; + num189 *= num191; + num190 *= num191; + int num9 = mod.ProjectileType("HolyBomb"); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num189, num190, num9, 40, 0f, Main.myPlayer, 0f, 0f); + npc.localAI[1] = 0f; + return; + } + npc.localAI[1] = 250f; + } + } + } + } + + 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 PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (CalamityGlobalNPC.energyFlame != -1) + { + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + float drawPositionX = Main.npc[CalamityGlobalNPC.energyFlame].Center.X - center.X; + float drawPositionY = Main.npc[CalamityGlobalNPC.energyFlame].Center.Y - center.Y; + drawPositionY += 10f; + float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; + bool draw = true; + while (draw) + { + float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); + if (totalDrawDistance < 16f) + { + draw = false; + } + else + { + totalDrawDistance = 16f / totalDrawDistance; + drawPositionX *= totalDrawDistance; + drawPositionY *= totalDrawDistance; + center.X += drawPositionX; + center.Y += drawPositionY; + drawPositionX = Main.npc[CalamityGlobalNPC.energyFlame].Center.X - center.X; + drawPositionY = Main.npc[CalamityGlobalNPC.energyFlame].Center.Y - center.Y; + drawPositionY -= 10f; + Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/NormalNPCs/ProfanedEnergySegment"), 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/NormalNPCs/ProfanedEnergySegment").Width, mod.GetTexture("NPCs/NormalNPCs/ProfanedEnergySegment").Height)), color, rotation, + new Vector2((float)mod.GetTexture("NPCs/NormalNPCs/ProfanedEnergySegment").Width * 0.5f, (float)mod.GetTexture("NPCs/NormalNPCs/ProfanedEnergySegment").Height * 0.5f), 1f, SpriteEffects.None, 0f); + } + } + } + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + 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); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/SandTortoise.cs b/NPCs/NormalNPCs/SandTortoise.cs index 649ba24812..4387b78261 100644 --- a/NPCs/NormalNPCs/SandTortoise.cs +++ b/NPCs/NormalNPCs/SandTortoise.cs @@ -1,75 +1,75 @@ -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.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class SandTortoise : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand Tortoise"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.npcSlots = 2f; - npc.damage = 110; - npc.aiStyle = 39; - npc.width = 46; - npc.height = 32; - npc.defense = 34; - npc.scale = 1.5f; - npc.lifeMax = 580; - npc.knockBackResist = 0.2f; - animationType = 153; - npc.value = Item.buyPrice(0, 0, 15, 0); - npc.HitSound = SoundID.NPCHit24; - npc.DeathSound = SoundID.NPCDeath27; - npc.noGravity = false; - banner = npc.type; - bannerItem = mod.ItemType("SandTortoiseBanner"); - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.DesertCave.Chance * 0.05f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TurtleShell); - } - } - } -} \ No newline at end of file +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.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class SandTortoise : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Tortoise"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.npcSlots = 2f; + npc.damage = 110; + npc.aiStyle = 39; + npc.width = 46; + npc.height = 32; + npc.defense = 34; + npc.scale = 1.5f; + npc.lifeMax = 580; + npc.knockBackResist = 0.2f; + animationType = 153; + npc.value = Item.buyPrice(0, 0, 15, 0); + npc.HitSound = SoundID.NPCHit24; + npc.DeathSound = SoundID.NPCDeath27; + npc.noGravity = false; + banner = npc.type; + bannerItem = mod.ItemType("SandTortoiseBanner"); + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.DesertCave.Chance * 0.05f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TurtleShell); + } + } + } +} diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 306ee931f2..f88c436e6e 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -1,191 +1,191 @@ -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 ScornEater : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scorn Eater"); - Main.npcFrameCount[npc.type] = 7; - } - - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.damage = 90; - npc.width = 160; //324 - npc.height = 160; //216 - npc.defense = 38; - npc.lifeMax = 16000; - 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.lavaImmune = true; - npc.value = Item.buyPrice(0, 0, 50, 0); - npc.HitSound = SoundID.NPCHit23; - npc.DeathSound = SoundID.NPCDeath26; - banner = npc.type; - bannerItem = mod.ItemType("ScornEaterBanner"); - } - - public override void AI() - { - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - if (Main.netMode != 1) - { - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) - { - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - } - else if (npc.velocity.Y == 0f) - { - npc.ai[2] += 1f; - int num321 = 20; - if (npc.ai[1] == 0f) - { - num321 = 12; - } - 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) - { - 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.netUpdate = true; - return; - } - else - { - 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) - { - 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 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); - } - 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)); - } - } -} \ No newline at end of file +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 ScornEater : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scorn Eater"); + Main.npcFrameCount[npc.type] = 7; + } + + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.aiStyle = -1; + npc.damage = 90; + npc.width = 160; //324 + npc.height = 160; //216 + npc.defense = 38; + npc.lifeMax = 16000; + 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.lavaImmune = true; + npc.value = Item.buyPrice(0, 0, 50, 0); + npc.HitSound = SoundID.NPCHit23; + npc.DeathSound = SoundID.NPCDeath26; + banner = npc.type; + bannerItem = mod.ItemType("ScornEaterBanner"); + } + + public override void AI() + { + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + if (Main.netMode != 1) + { + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) + { + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + } + else if (npc.velocity.Y == 0f) + { + npc.ai[2] += 1f; + int num321 = 20; + if (npc.ai[1] == 0f) + { + num321 = 12; + } + 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) + { + 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.netUpdate = true; + return; + } + else + { + 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) + { + 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 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); + } + 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/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 955c036c54..18e3eb3a34 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -1,582 +1,582 @@ -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 ShockstormShuttle : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shockstorm Shuttle"); - } - - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.damage = 30; - npc.width = 64; //324 - npc.height = 38; //216 - npc.defense = 20; - npc.lifeMax = 150; - npc.aiStyle = -1; //new multiplayer desync fix - aiType = -1; //new multiplayer desync fix - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - banner = npc.type; - bannerItem = mod.ItemType("ShockstormShuttleBanner"); - } - - public override void AI() - { - if (Main.netMode != 1) - { - npc.localAI[0] += (float)Main.rand.Next(4); //adds to localAI to fire projectiles at random times - if (npc.localAI[0] >= (float)Main.rand.Next(100, 120)) //rate at which projectiles are shot - { - npc.localAI[0] = 0f; - 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 = 12f; //speed of projectile - 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; //projectile damage - if (Main.expertMode) - { - num184 = 22; - } - int num185 = 435; //projectile ID - if (Main.rand.Next(8) == 0) - { - num185 = 449; //more powerful projectile ID - } - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; num186++) //shoots two projectiles by looping twice - { - 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 = 12f / num183; - num180 += (float)Main.rand.Next(-20, 21); //projectile spreadX - num182 += (float)Main.rand.Next(-20, 21); //projectile spreadY - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - if (npc.localAI[3] == 0f && Main.netMode != 1) - { - npc.localAI[3] = 1f; - } - Vector2 center16 = npc.Center; - Player player8 = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player8.dead || !player8.active) - { - npc.TargetClosest(true); - player8 = Main.player[npc.target]; - npc.netUpdate = true; - } - if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && npc.ai[0] != 1f) - { - if (npc.ai[0] == 0f) - { - npc.ai[0] = -1f; - } - if (npc.ai[0] == 2f) - { - npc.ai[0] = -2f; - } - npc.netUpdate = true; - } - if (npc.ai[0] == -1f || npc.ai[0] == -2f) - { - npc.velocity.Y = npc.velocity.Y - 0.4f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - if (!player8.dead) - { - npc.timeLeft = 300; - if (npc.ai[0] == -2f) - { - npc.ai[0] = 2f; - } - if (npc.ai[0] == 0f) - { - npc.ai[0] = 0f; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 0f) - { - int num1580 = 0; - if (npc.ai[3] >= 580f) - { - num1580 = 0; - } - else if (npc.ai[3] >= 440f) - { - num1580 = 5; - } - else if (npc.ai[3] >= 420f) - { - num1580 = 4; - } - else if (npc.ai[3] >= 280f) - { - num1580 = 3; - } - else if (npc.ai[3] >= 260f) - { - num1580 = 2; - } - else if (npc.ai[3] >= 20f) - { - num1580 = 1; - } - npc.ai[3] += 1f; - if (npc.ai[3] >= 600f) - { - npc.ai[3] = 0f; - } - int num1581 = num1580; - if (npc.ai[3] >= 580f) - { - num1580 = 0; - } - else if (npc.ai[3] >= 440f) - { - num1580 = 5; - } - else if (npc.ai[3] >= 420f) - { - num1580 = 4; - } - else if (npc.ai[3] >= 280f) - { - num1580 = 3; - } - else if (npc.ai[3] >= 260f) - { - num1580 = 2; - } - else if (npc.ai[3] >= 20f) - { - num1580 = 1; - } - if (num1580 != num1581) - { - if (num1580 == 0) - { - npc.ai[2] = 0f; - } - if (num1580 == 1) - { - npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); - } - if (num1580 == 2) - { - npc.ai[2] = 0f; - } - npc.netUpdate = true; - } - if (num1580 == 0) - { - if (npc.ai[2] == 0f) - { - npc.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); - } - Vector2 vector196 = player8.Center + new Vector2(npc.ai[2], -250f) - center16; - if (vector196.Length() < 50f) - { - npc.ai[3] = 19f; - } - else - { - vector196.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector196 * 16f, 0.1f); - } - } - if (num1580 == 1) - { - int num1582 = (int)npc.Center.X / 16; - int num1583 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1584 = 0; - bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].type]; - if (flag149) - { - num1584 = 1; - } - else - { - while (num1584 < 150 && num1583 + num1584 < Main.maxTilesY) - { - int num1585 = num1583 + num1584; - bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].type]; - if (flag150) - { - num1584--; - break; - } - num1584++; - } - } - float num1586 = (float)(num1584 * 16); - float num1587 = 250f; - if (num1586 < num1587) - { - float num1588 = -4f; - if (-num1588 > num1586) - { - num1588 = -num1586; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1588, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.X = 3.5f * npc.ai[2]; - } - if (num1580 == 2) - { - if (npc.ai[2] == 0f) - { - npc.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); - } - Vector2 vector197 = player8.Center + new Vector2(npc.ai[2], -170f) - center16; - int num1589 = (int)npc.Center.X / 16; - int num1590 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1591 = 0; - bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].type]; - if (flag151) - { - num1591 = 1; - } - else - { - while (num1591 < 150 && num1590 + num1591 < Main.maxTilesY) - { - int num1592 = num1590 + num1591; - bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].type]; - if (flag152) - { - num1591--; - break; - } - num1591++; - } - } - float num1593 = (float)(num1591 * 16); - float num1594 = 170f; - if (num1593 < num1594) - { - vector197.Y -= num1594 - num1593; - } - if (vector197.Length() < 70f) - { - npc.ai[3] = 279f; - } - else - { - vector197.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector197 * 20f, 0.1f); - } - } - else if (num1580 == 3) - { - float num1595 = 0.85f; - int num1596 = (int)npc.Center.X / 16; - int num1597 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1598 = 0; - bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].type]; - if (flag153) - { - num1598 = 1; - } - else - { - while (num1598 < 150 && num1597 + num1598 < Main.maxTilesY) - { - int num1599 = num1597 + num1598; - bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].type]; - if (flag154) - { - num1598--; - break; - } - num1598++; - } - } - float num1600 = (float)(num1598 * 16); - float num1601 = 170f; - if (num1600 < num1601) - { - float num1602 = -4f; - if (-num1602 > num1600) - { - num1602 = -num1600; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1602, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * num1595; - } - npc.velocity.X = npc.velocity.X * num1595; - } - if (num1580 == 4) - { - Vector2 vector198 = player8.Center + new Vector2(0f, -250f) - center16; - if (vector198.Length() < 50f) - { - npc.ai[3] = 439f; - return; - } - vector198.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector198 * 16f, 0.1f); - return; - } - else if (num1580 == 5) - { - npc.velocity *= 0.85f; - return; - } - } - else if (npc.ai[0] == 1f) - { - npc.velocity *= 0.96f; - float num1603 = 150f; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1603) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.rotation = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] < 40f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 40f * 6.28318548f), default(Vector2)).Y * 0.2f; - return; - } - if (npc.ai[1] < 80f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 20f * 6.28318548f), default(Vector2)).Y * 0.3f; - return; - } - if (npc.ai[1] < 120f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 10f * 6.28318548f), default(Vector2)).Y * 0.4f; - return; - } - npc.rotation = (npc.ai[1] - 120f) / 30f * 6.28318548f; - return; - } - else if (npc.ai[0] == 2f) - { - float num1605 = 3600f; - float num1606 = 120f; - float num1607 = 60f; - int num1608 = 0; - if (npc.ai[3] % num1606 >= num1607) - { - num1608 = 1; - } - int num1609 = num1608; - num1608 = 0; - npc.ai[3] += 1f; - if (npc.ai[3] % num1606 >= num1607) - { - num1608 = 1; - } - if (num1608 != num1609) - { - if (num1608 == 1) - { - npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); - if (Main.netMode != 1) //second projectile being shot. Didn't use this - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.localAI[0] >= (float)Main.rand.Next(50, 100)) - { - npc.localAI[0] = 0f; - 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 = 11f; - 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 = 50; - if (Main.expertMode) - { - num184 = 28; - } - if (Main.hardMode) - { - num184 = 40; - if (NPC.downedMoonlord) - { - num184 = 80; - if (Main.expertMode) - { - num184 = 45; - } - } - } - int num185 = 449; - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; 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 = 12f / num183; - num180 += (float)Main.rand.Next(-20, 21); - num182 += (float)Main.rand.Next(-20, 21); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - Main.PlaySound(2, (int)npc.Center.X, (int)npc.Center.Y, 12); - } - npc.netUpdate = true; - } - if (npc.ai[3] >= num1605) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - else if (num1608 == 0) - { - Vector2 vector199 = player8.Center + new Vector2(npc.ai[2] * 350f, -250f) - center16; - vector199.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector199 * 16f, 0.1f); - } - else - { - int num1610 = (int)npc.Center.X / 16; - int num1611 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1612 = 0; - bool flag155 = Main.tile[num1610, num1611].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1611].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1611].type]; - if (flag155) - { - num1612 = 1; - } - else - { - while (num1612 < 150 && num1611 + num1612 < Main.maxTilesY) - { - int num1613 = num1611 + num1612; - bool flag156 = Main.tile[num1610, num1613].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1613].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1613].type]; - if (flag156) - { - num1612--; - break; - } - num1612++; - } - } - float num1614 = (float)(num1612 * 16); - float num1615 = 250f; - if (num1614 < num1615) - { - float num1616 = -4f; - if (-num1616 > num1614) - { - num1616 = -num1614; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1616, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.X = 8f * npc.ai[2]; - } - npc.rotation = 0f; - return; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode) - { - return 0f; - } - return SpawnCondition.Sky.Chance * 0.1f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Electrified, 120, true); - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MartianConduitPlating, Main.rand.Next(10, 30)); - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); - } - } - } -} \ No newline at end of file +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 ShockstormShuttle : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shockstorm Shuttle"); + } + + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.damage = 30; + npc.width = 64; //324 + npc.height = 38; //216 + npc.defense = 20; + npc.lifeMax = 150; + npc.aiStyle = -1; //new multiplayer desync fix + aiType = -1; //new multiplayer desync fix + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = true; + banner = npc.type; + bannerItem = mod.ItemType("ShockstormShuttleBanner"); + } + + public override void AI() + { + if (Main.netMode != 1) + { + npc.localAI[0] += (float)Main.rand.Next(4); //adds to localAI to fire projectiles at random times + if (npc.localAI[0] >= (float)Main.rand.Next(100, 120)) //rate at which projectiles are shot + { + npc.localAI[0] = 0f; + 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 = 12f; //speed of projectile + 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; //projectile damage + if (Main.expertMode) + { + num184 = 22; + } + int num185 = 435; //projectile ID + if (Main.rand.Next(8) == 0) + { + num185 = 449; //more powerful projectile ID + } + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 2; num186++) //shoots two projectiles by looping twice + { + 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 = 12f / num183; + num180 += (float)Main.rand.Next(-20, 21); //projectile spreadX + num182 += (float)Main.rand.Next(-20, 21); //projectile spreadY + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + if (npc.localAI[3] == 0f && Main.netMode != 1) + { + npc.localAI[3] = 1f; + } + Vector2 center16 = npc.Center; + Player player8 = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player8.dead || !player8.active) + { + npc.TargetClosest(true); + player8 = Main.player[npc.target]; + npc.netUpdate = true; + } + if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && npc.ai[0] != 1f) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] = -1f; + } + if (npc.ai[0] == 2f) + { + npc.ai[0] = -2f; + } + npc.netUpdate = true; + } + if (npc.ai[0] == -1f || npc.ai[0] == -2f) + { + npc.velocity.Y = npc.velocity.Y - 0.4f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + if (!player8.dead) + { + npc.timeLeft = 300; + if (npc.ai[0] == -2f) + { + npc.ai[0] = 2f; + } + if (npc.ai[0] == 0f) + { + npc.ai[0] = 0f; + } + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 0f) + { + int num1580 = 0; + if (npc.ai[3] >= 580f) + { + num1580 = 0; + } + else if (npc.ai[3] >= 440f) + { + num1580 = 5; + } + else if (npc.ai[3] >= 420f) + { + num1580 = 4; + } + else if (npc.ai[3] >= 280f) + { + num1580 = 3; + } + else if (npc.ai[3] >= 260f) + { + num1580 = 2; + } + else if (npc.ai[3] >= 20f) + { + num1580 = 1; + } + npc.ai[3] += 1f; + if (npc.ai[3] >= 600f) + { + npc.ai[3] = 0f; + } + int num1581 = num1580; + if (npc.ai[3] >= 580f) + { + num1580 = 0; + } + else if (npc.ai[3] >= 440f) + { + num1580 = 5; + } + else if (npc.ai[3] >= 420f) + { + num1580 = 4; + } + else if (npc.ai[3] >= 280f) + { + num1580 = 3; + } + else if (npc.ai[3] >= 260f) + { + num1580 = 2; + } + else if (npc.ai[3] >= 20f) + { + num1580 = 1; + } + if (num1580 != num1581) + { + if (num1580 == 0) + { + npc.ai[2] = 0f; + } + if (num1580 == 1) + { + npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); + } + if (num1580 == 2) + { + npc.ai[2] = 0f; + } + npc.netUpdate = true; + } + if (num1580 == 0) + { + if (npc.ai[2] == 0f) + { + npc.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); + } + Vector2 vector196 = player8.Center + new Vector2(npc.ai[2], -250f) - center16; + if (vector196.Length() < 50f) + { + npc.ai[3] = 19f; + } + else + { + vector196.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector196 * 16f, 0.1f); + } + } + if (num1580 == 1) + { + int num1582 = (int)npc.Center.X / 16; + int num1583 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1584 = 0; + bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].type]; + if (flag149) + { + num1584 = 1; + } + else + { + while (num1584 < 150 && num1583 + num1584 < Main.maxTilesY) + { + int num1585 = num1583 + num1584; + bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].type]; + if (flag150) + { + num1584--; + break; + } + num1584++; + } + } + float num1586 = (float)(num1584 * 16); + float num1587 = 250f; + if (num1586 < num1587) + { + float num1588 = -4f; + if (-num1588 > num1586) + { + num1588 = -num1586; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1588, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + npc.velocity.X = 3.5f * npc.ai[2]; + } + if (num1580 == 2) + { + if (npc.ai[2] == 0f) + { + npc.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); + } + Vector2 vector197 = player8.Center + new Vector2(npc.ai[2], -170f) - center16; + int num1589 = (int)npc.Center.X / 16; + int num1590 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1591 = 0; + bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].type]; + if (flag151) + { + num1591 = 1; + } + else + { + while (num1591 < 150 && num1590 + num1591 < Main.maxTilesY) + { + int num1592 = num1590 + num1591; + bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].type]; + if (flag152) + { + num1591--; + break; + } + num1591++; + } + } + float num1593 = (float)(num1591 * 16); + float num1594 = 170f; + if (num1593 < num1594) + { + vector197.Y -= num1594 - num1593; + } + if (vector197.Length() < 70f) + { + npc.ai[3] = 279f; + } + else + { + vector197.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector197 * 20f, 0.1f); + } + } + else if (num1580 == 3) + { + float num1595 = 0.85f; + int num1596 = (int)npc.Center.X / 16; + int num1597 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1598 = 0; + bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].type]; + if (flag153) + { + num1598 = 1; + } + else + { + while (num1598 < 150 && num1597 + num1598 < Main.maxTilesY) + { + int num1599 = num1597 + num1598; + bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].type]; + if (flag154) + { + num1598--; + break; + } + num1598++; + } + } + float num1600 = (float)(num1598 * 16); + float num1601 = 170f; + if (num1600 < num1601) + { + float num1602 = -4f; + if (-num1602 > num1600) + { + num1602 = -num1600; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1602, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * num1595; + } + npc.velocity.X = npc.velocity.X * num1595; + } + if (num1580 == 4) + { + Vector2 vector198 = player8.Center + new Vector2(0f, -250f) - center16; + if (vector198.Length() < 50f) + { + npc.ai[3] = 439f; + return; + } + vector198.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector198 * 16f, 0.1f); + return; + } + else if (num1580 == 5) + { + npc.velocity *= 0.85f; + return; + } + } + else if (npc.ai[0] == 1f) + { + npc.velocity *= 0.96f; + float num1603 = 150f; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1603) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.rotation = 0f; + npc.netUpdate = true; + return; + } + if (npc.ai[1] < 40f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 40f * 6.28318548f), default(Vector2)).Y * 0.2f; + return; + } + if (npc.ai[1] < 80f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 20f * 6.28318548f), default(Vector2)).Y * 0.3f; + return; + } + if (npc.ai[1] < 120f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 10f * 6.28318548f), default(Vector2)).Y * 0.4f; + return; + } + npc.rotation = (npc.ai[1] - 120f) / 30f * 6.28318548f; + return; + } + else if (npc.ai[0] == 2f) + { + float num1605 = 3600f; + float num1606 = 120f; + float num1607 = 60f; + int num1608 = 0; + if (npc.ai[3] % num1606 >= num1607) + { + num1608 = 1; + } + int num1609 = num1608; + num1608 = 0; + npc.ai[3] += 1f; + if (npc.ai[3] % num1606 >= num1607) + { + num1608 = 1; + } + if (num1608 != num1609) + { + if (num1608 == 1) + { + npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); + if (Main.netMode != 1) //second projectile being shot. Didn't use this + { + npc.localAI[0] += (float)Main.rand.Next(4); + if (npc.localAI[0] >= (float)Main.rand.Next(50, 100)) + { + npc.localAI[0] = 0f; + 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 = 11f; + 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 = 50; + if (Main.expertMode) + { + num184 = 28; + } + if (Main.hardMode) + { + num184 = 40; + if (NPC.downedMoonlord) + { + num184 = 80; + if (Main.expertMode) + { + num184 = 45; + } + } + } + int num185 = 449; + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 2; 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 = 12f / num183; + num180 += (float)Main.rand.Next(-20, 21); + num182 += (float)Main.rand.Next(-20, 21); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + Main.PlaySound(2, (int)npc.Center.X, (int)npc.Center.Y, 12); + } + npc.netUpdate = true; + } + if (npc.ai[3] >= num1605) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + else if (num1608 == 0) + { + Vector2 vector199 = player8.Center + new Vector2(npc.ai[2] * 350f, -250f) - center16; + vector199.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector199 * 16f, 0.1f); + } + else + { + int num1610 = (int)npc.Center.X / 16; + int num1611 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1612 = 0; + bool flag155 = Main.tile[num1610, num1611].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1611].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1611].type]; + if (flag155) + { + num1612 = 1; + } + else + { + while (num1612 < 150 && num1611 + num1612 < Main.maxTilesY) + { + int num1613 = num1611 + num1612; + bool flag156 = Main.tile[num1610, num1613].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1613].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1613].type]; + if (flag156) + { + num1612--; + break; + } + num1612++; + } + } + float num1614 = (float)(num1612 * 16); + float num1615 = 250f; + if (num1614 < num1615) + { + float num1616 = -4f; + if (-num1616 > num1614) + { + num1616 = -num1614; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1616, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + npc.velocity.X = 8f * npc.ai[2]; + } + npc.rotation = 0f; + return; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode) + { + return 0f; + } + return SpawnCondition.Sky.Chance * 0.1f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 120, true); + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MartianConduitPlating, Main.rand.Next(10, 30)); + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); + } + } + } +} diff --git a/NPCs/NormalNPCs/StormlionCharger.cs b/NPCs/NormalNPCs/StormlionCharger.cs index 53604acc8f..0794057870 100644 --- a/NPCs/NormalNPCs/StormlionCharger.cs +++ b/NPCs/NormalNPCs/StormlionCharger.cs @@ -1,77 +1,77 @@ -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.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class StormlionCharger : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stormlion"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 20; - npc.aiStyle = 3; - npc.width = 33; //324 - npc.height = 31; //216 - npc.defense = 9; - npc.lifeMax = 80; - npc.knockBackResist = 0.2f; - animationType = 508; - npc.value = Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit31; - npc.DeathSound = SoundID.NPCDeath34; - banner = npc.type; - bannerItem = mod.ItemType("StormlionBanner"); - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.DesertCave.Chance * 0.2f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Electrified, 90, true); - } - - 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("StormlionMandible")); - } - } - } -} \ No newline at end of file +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.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class StormlionCharger : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stormlion"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 20; + npc.aiStyle = 3; + npc.width = 33; //324 + npc.height = 31; //216 + npc.defense = 9; + npc.lifeMax = 80; + npc.knockBackResist = 0.2f; + animationType = 508; + npc.value = Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit31; + npc.DeathSound = SoundID.NPCDeath34; + banner = npc.type; + bannerItem = mod.ItemType("StormlionBanner"); + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.DesertCave.Chance * 0.2f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 90, true); + } + + 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("StormlionMandible")); + } + } + } +} diff --git a/NPCs/NormalNPCs/SunBat.cs b/NPCs/NormalNPCs/SunBat.cs index 2f7f6df6dc..bdb4b6e638 100644 --- a/NPCs/NormalNPCs/SunBat.cs +++ b/NPCs/NormalNPCs/SunBat.cs @@ -1,91 +1,91 @@ -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 SunBat : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sun Bat"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = 14; - aiType = 151; - npc.damage = 35; - npc.width = 26; //324 - npc.height = 20; //216 - npc.defense = 20; - npc.lifeMax = 120; - npc.knockBackResist = 0.65f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath4; - banner = npc.type; - bannerItem = mod.ItemType("SunBatBanner"); - } - - 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() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || - spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) - { - return 0f; - } - return SpawnCondition.Underground.Chance * 0.12f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 120, true); - player.AddBuff(mod.BuffType("HolyLight"), 120, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - 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("EssenceofCinder")); - } - } - } -} \ No newline at end of file +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 SunBat : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sun Bat"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = 14; + aiType = 151; + npc.damage = 35; + npc.width = 26; //324 + npc.height = 20; //216 + npc.defense = 20; + npc.lifeMax = 120; + npc.knockBackResist = 0.65f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath4; + banner = npc.type; + bannerItem = mod.ItemType("SunBatBanner"); + } + + 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() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || + spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea) + { + return 0f; + } + return SpawnCondition.Underground.Chance * 0.12f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 120, true); + player.AddBuff(mod.BuffType("HolyLight"), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + 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("EssenceofCinder")); + } + } + } +} diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index 87c816f53b..d184d24127 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -1,260 +1,260 @@ -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 Sunskater : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sunskater"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.lavaImmune = true; - npc.damage = 20; - npc.width = 58; - npc.height = 22; - npc.defense = 10; - npc.lifeMax = 100; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit50; - npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater"); - npc.knockBackResist = 0.7f; - banner = npc.type; - bannerItem = mod.ItemType("SunskaterBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - 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.15f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - if (npc.velocity.X > 10f) - { - npc.velocity.X = 10f; - } - if (npc.velocity.X < -10f) - { - npc.velocity.X = -10f; - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - if (npc.velocity.Y < -10f) - { - npc.velocity.Y = -10f; - } - } - else - { - 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.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 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) - { - return 0f; - } - return SpawnCondition.Sky.Chance * 0.15f; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 120, true); - player.AddBuff(mod.BuffType("HolyLight"), 120, true); - } - - public override void NPCLoot() - { - if (Main.hardMode && Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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 Sunskater : ModNPC + { + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sunskater"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.lavaImmune = true; + npc.damage = 20; + npc.width = 58; + npc.height = 22; + npc.defense = 10; + npc.lifeMax = 100; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit50; + npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater"); + npc.knockBackResist = 0.7f; + banner = npc.type; + bannerItem = mod.ItemType("SunskaterBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hasBeenHit); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hasBeenHit = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + 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.15f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + if (npc.velocity.X > 10f) + { + npc.velocity.X = 10f; + } + if (npc.velocity.X < -10f) + { + npc.velocity.X = -10f; + } + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + if (npc.velocity.Y < -10f) + { + npc.velocity.Y = -10f; + } + } + else + { + 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.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 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) + { + return 0f; + } + return SpawnCondition.Sky.Chance * 0.15f; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 120, true); + player.AddBuff(mod.BuffType("HolyLight"), 120, true); + } + + public override void NPCLoot() + { + if (Main.hardMode && Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 64, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/SuperDummy.cs b/NPCs/NormalNPCs/SuperDummy.cs index aa5ab55f97..dcc632b923 100644 --- a/NPCs/NormalNPCs/SuperDummy.cs +++ b/NPCs/NormalNPCs/SuperDummy.cs @@ -1,49 +1,49 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class SuperDummy : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Super Dummy"); - } - - public override void SetDefaults() - { - npc.width = 18; - npc.height = 48; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 9999999; - npc.HitSound = SoundID.NPCHit15; - npc.DeathSound = SoundID.NPCDeath2; - npc.value = 0f; - npc.knockBackResist = 0f; - } - - public override void UpdateLifeRegen (ref int damage) - { - npc.lifeRegen += 2000000; - } - - public override bool? DrawHealthBar (byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override bool CheckDead () - { - if (npc.lifeRegen < 0) - { - npc.life = npc.lifeMax; - return false; - } - return true; - } - } -} +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class SuperDummy : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Super Dummy"); + } + + public override void SetDefaults() + { + npc.width = 18; + npc.height = 48; + npc.damage = 0; + npc.defense = 0; + npc.lifeMax = 9999999; + npc.HitSound = SoundID.NPCHit15; + npc.DeathSound = SoundID.NPCDeath2; + npc.value = 0f; + npc.knockBackResist = 0f; + } + + public override void UpdateLifeRegen (ref int damage) + { + npc.lifeRegen += 2000000; + } + + public override bool? DrawHealthBar (byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override bool CheckDead () + { + if (npc.lifeRegen < 0) + { + npc.life = npc.lifeMax; + return false; + } + return true; + } + } +} diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 10540e5916..c00f3ffe45 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -1,464 +1,464 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class ThiccWaifu : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud Elemental"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.damage = 38; - npc.width = 50; //324 - 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; - npc.DeathSound = SoundID.NPCDeath39; - npc.buffImmune[20] = true; - npc.buffImmune[44] = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("CloudElementalBanner"); - } - - 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.375f, 0.5f, 0.625f); - bool flag111 = false; - bool flag112 = false; - bool flag113 = true; - bool flag114 = false; - int num1454 = 4; - int num1455 = 3; - int num1456 = 0; - float num1457 = 0.2f; - float num1458 = 2f; - float num1459 = -0.2f; - float num1460 = -4f; - bool flag115 = true; - float num1461 = 2f; - float num1462 = 0.1f; - float num1463 = 1f; - float num1464 = 0.04f; - bool flag116 = false; - float scaleFactor26 = 0.96f; - bool flag117 = true; - if (npc.type == mod.NPCType("ThiccWaifu")) - { - flag115 = false; - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - num1456 = 3; - num1459 = -0.1f; - num1457 = 0.1f; - float num1465 = (float)npc.life / (float)npc.lifeMax; - num1461 += (1f - num1465) * 2f; - num1462 += (1f - num1465) * 0.02f; - if (num1465 < 0.5f) - { - npc.knockBackResist = 0f; - } - npc.localAI[2] = 0f; - if (npc.ai[0] < 0f) - { - npc.ai[0] = MathHelper.Min(npc.ai[0] + 1f, 0f); - } - if (npc.ai[0] > 0f) - { - flag117 = false; - flag116 = true; - npc.ai[0] += 1f; - if (npc.ai[0] >= 135f) - { - npc.ai[0] = -300f; - npc.netUpdate = true; - } - Vector2 vector = npc.Center; - vector = Vector2.UnitX * (float)npc.direction * 200f; - Vector2 vector223 = npc.Center + Vector2.UnitX * (float)npc.direction * 50f - Vector2.UnitY * 6f; - if (npc.ai[0] == 54f && Main.netMode != 1) - { - List list4 = new List(); - Vector2 vec5 = Main.player[npc.target].Center + new Vector2(Main.player[npc.target].velocity.X * 30f, 0f); - Point point14 = vec5.ToTileCoordinates(); - int num1468 = 0; - while (num1468 < 1000 && list4.Count < 3) - { - bool flag118 = false; - int num1469 = Main.rand.Next(point14.X - 30, point14.X + 30 + 1); - foreach (Point current in list4) - { - if (Math.Abs(current.X - num1469) < 10) - { - flag118 = true; - break; - } - } - if (!flag118) - { - int startY = point14.Y - 20; - int num1470; - int num1471; - Collision.ExpandVertically(num1469, startY, out num1470, out num1471, 1, 51); - if (StrayMethods.CanSpawnSandstormHostile(new Vector2((float)num1469, (float)(num1471 - 15)) * 16f, 15, 15)) - { - list4.Add(new Point(num1469, num1471 - 15)); - } - } - num1468++; - } - foreach (Point current2 in list4) - { - Projectile.NewProjectile((float)(current2.X * 16), (float)(current2.Y * 16), 0f, 0f, mod.ProjectileType("StormMarkHostile"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - new Vector2(0.9f, 2f); - if (npc.ai[0] < 114f && npc.ai[0] > 0f) - { - List list5 = new List(); - for (int num1472 = 0; num1472 < 1000; num1472++) - { - Projectile projectile9 = Main.projectile[num1472]; - if (projectile9.active && projectile9.type == mod.ProjectileType("StormMarkHostile")) - { - list5.Add(projectile9.Center); - } - } - } - } - if (npc.ai[0] == 0f) - { - npc.ai[0] = 1f; - npc.netUpdate = true; - flag116 = true; - } - } - if (npc.justHit) - { - npc.localAI[2] = 0f; - } - if (!flag112) - { - if (npc.localAI[2] >= 0f) - { - float num1477 = 16f; - bool flag119 = false; - bool flag120 = false; - if (npc.position.X > npc.localAI[0] - num1477 && npc.position.X < npc.localAI[0] + num1477) - { - flag119 = true; - } - else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) - { - flag119 = true; - num1477 += 24f; - } - if (npc.position.Y > npc.localAI[1] - num1477 && npc.position.Y < npc.localAI[1] + num1477) - { - flag120 = true; - } - if (flag119 && flag120) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 30f && num1477 == 16f) - { - flag111 = true; - } - if (npc.localAI[2] >= 60f) - { - npc.localAI[2] = -180f; - npc.direction *= -1; - npc.velocity.X = npc.velocity.X * -1f; - npc.collideX = false; - } - } - else - { - npc.localAI[0] = npc.position.X; - npc.localAI[1] = npc.position.Y; - npc.localAI[2] = 0f; - } - if (flag117) - { - npc.TargetClosest(true); - } - } - else - { - npc.localAI[2] += 1f; - npc.direction = ((Main.player[npc.target].Center.X > npc.Center.X) ? 1 : -1); - } - } - int num1478 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; - int num1479 = (int)((npc.position.Y + (float)npc.height) / 16f); - int num1480 = (int)npc.Bottom.Y / 16; - int num1481 = (int)npc.Bottom.X / 16; - if (flag116) - { - npc.velocity *= scaleFactor26; - return; - } - for (int num1482 = num1479; num1482 < num1479 + num1454; num1482++) - { - if (Main.tile[num1478, num1482] == null) - { - Main.tile[num1478, num1482] = new Tile(); - } - if ((Main.tile[num1478, num1482].nactive() && Main.tileSolid[(int)Main.tile[num1478, num1482].type]) || Main.tile[num1478, num1482].liquid > 0) - { - if (num1482 <= num1479 + 1) - { - flag114 = true; - } - flag113 = false; - break; - } - } - for (int num1483 = num1480; num1483 < num1480 + num1456; num1483++) - { - if (Main.tile[num1481, num1483] == null) - { - Main.tile[num1481, num1483] = new Tile(); - } - if ((Main.tile[num1481, num1483].nactive() && Main.tileSolid[(int)Main.tile[num1481, num1483].type]) || Main.tile[num1481, num1483].liquid > 0) - { - flag114 = true; - flag113 = false; - break; - } - } - if (flag115) - { - for (int num1484 = num1479 - num1455; num1484 < num1479; num1484++) - { - if (Main.tile[num1478, num1484] == null) - { - Main.tile[num1478, num1484] = new Tile(); - } - if ((Main.tile[num1478, num1484].nactive() && Main.tileSolid[(int)Main.tile[num1478, num1484].type]) || Main.tile[num1478, num1484].liquid > 0) - { - flag114 = false; - flag111 = true; - break; - } - } - } - if (flag111) - { - flag114 = false; - flag113 = true; - } - if (flag113) - { - npc.velocity.Y = npc.velocity.Y + num1457; - if (npc.velocity.Y > num1458) - { - npc.velocity.Y = num1458; - } - } - else - { - if ((npc.directionY < 0 && npc.velocity.Y > 0f) || flag114) - { - npc.velocity.Y = npc.velocity.Y + num1459; - } - if (npc.velocity.Y < num1460) - { - npc.velocity.Y = num1460; - } - } - if (npc.collideX) - { - npc.velocity.X = npc.oldVelocity.X * -0.4f; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) - { - npc.velocity.X = 1f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) - { - npc.velocity.X = -1f; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.oldVelocity.Y * -0.25f; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) - { - npc.velocity.Y = 1f; - } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) - { - npc.velocity.Y = -1f; - } - } - if (npc.direction == -1 && npc.velocity.X > -num1461) - { - npc.velocity.X = npc.velocity.X - num1462; - if (npc.velocity.X > num1461) - { - npc.velocity.X = npc.velocity.X - num1462; - } - else if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num1462 / 2f; - } - if (npc.velocity.X < -num1461) - { - npc.velocity.X = -num1461; - } - } - else if (npc.direction == 1 && npc.velocity.X < num1461) - { - npc.velocity.X = npc.velocity.X + num1462; - if (npc.velocity.X < -num1461) - { - npc.velocity.X = npc.velocity.X + num1462; - } - else if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num1462 / 2f; - } - if (npc.velocity.X > num1461) - { - npc.velocity.X = num1461; - } - } - if (npc.directionY == -1 && npc.velocity.Y > -num1463) - { - npc.velocity.Y = npc.velocity.Y - num1464; - if (npc.velocity.Y > num1463) - { - npc.velocity.Y = npc.velocity.Y - num1464 * 1.25f; - } - else if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1464 * 0.75f; - } - if (npc.velocity.Y < -num1463) - { - npc.velocity.Y = -num1461; - return; - } - } - else if (npc.directionY == 1 && npc.velocity.Y < num1463) - { - npc.velocity.Y = npc.velocity.Y + num1464; - if (npc.velocity.Y < -num1463) - { - npc.velocity.Y = npc.velocity.Y + num1464 * 1.25f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1464 * 0.75f; - } - if (npc.velocity.Y > num1463) - { - npc.velocity.Y = num1463; - return; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = mod.GetTexture("NPCs/NormalNPCs/ThiccWaifuAttack"); - if (npc.ai[0] > 0f) - { - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); - } - else - { - CalamityMod.DrawTexture(spriteBatch, Main.npcTexture[npc.type], 0, npc, drawColor); - } - return false; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter = npc.frameCounter + (double)(npc.velocity.Length() * 0.1f) + 1.0; - if (npc.frameCounter >= (npc.ai[0] > 0f ? 16.0 : 8.0)) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 8) - { - npc.frame.Y = 0; - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode || !Main.raining) - { - return 0f; - } - return SpawnCondition.Sky.Chance * 0.1f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 16, 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, 16, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - 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) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EyeoftheStorm")); - } - } - else if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EyeoftheStorm")); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormSaber")); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class ThiccWaifu : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud Elemental"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.damage = 38; + npc.width = 50; //324 + 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; + npc.DeathSound = SoundID.NPCDeath39; + npc.buffImmune[20] = true; + npc.buffImmune[44] = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("CloudElementalBanner"); + } + + 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.375f, 0.5f, 0.625f); + bool flag111 = false; + bool flag112 = false; + bool flag113 = true; + bool flag114 = false; + int num1454 = 4; + int num1455 = 3; + int num1456 = 0; + float num1457 = 0.2f; + float num1458 = 2f; + float num1459 = -0.2f; + float num1460 = -4f; + bool flag115 = true; + float num1461 = 2f; + float num1462 = 0.1f; + float num1463 = 1f; + float num1464 = 0.04f; + bool flag116 = false; + float scaleFactor26 = 0.96f; + bool flag117 = true; + if (npc.type == mod.NPCType("ThiccWaifu")) + { + flag115 = false; + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + num1456 = 3; + num1459 = -0.1f; + num1457 = 0.1f; + float num1465 = (float)npc.life / (float)npc.lifeMax; + num1461 += (1f - num1465) * 2f; + num1462 += (1f - num1465) * 0.02f; + if (num1465 < 0.5f) + { + npc.knockBackResist = 0f; + } + npc.localAI[2] = 0f; + if (npc.ai[0] < 0f) + { + npc.ai[0] = MathHelper.Min(npc.ai[0] + 1f, 0f); + } + if (npc.ai[0] > 0f) + { + flag117 = false; + flag116 = true; + npc.ai[0] += 1f; + if (npc.ai[0] >= 135f) + { + npc.ai[0] = -300f; + npc.netUpdate = true; + } + Vector2 vector = npc.Center; + vector = Vector2.UnitX * (float)npc.direction * 200f; + Vector2 vector223 = npc.Center + Vector2.UnitX * (float)npc.direction * 50f - Vector2.UnitY * 6f; + if (npc.ai[0] == 54f && Main.netMode != 1) + { + List list4 = new List(); + Vector2 vec5 = Main.player[npc.target].Center + new Vector2(Main.player[npc.target].velocity.X * 30f, 0f); + Point point14 = vec5.ToTileCoordinates(); + int num1468 = 0; + while (num1468 < 1000 && list4.Count < 3) + { + bool flag118 = false; + int num1469 = Main.rand.Next(point14.X - 30, point14.X + 30 + 1); + foreach (Point current in list4) + { + if (Math.Abs(current.X - num1469) < 10) + { + flag118 = true; + break; + } + } + if (!flag118) + { + int startY = point14.Y - 20; + int num1470; + int num1471; + Collision.ExpandVertically(num1469, startY, out num1470, out num1471, 1, 51); + if (StrayMethods.CanSpawnSandstormHostile(new Vector2((float)num1469, (float)(num1471 - 15)) * 16f, 15, 15)) + { + list4.Add(new Point(num1469, num1471 - 15)); + } + } + num1468++; + } + foreach (Point current2 in list4) + { + Projectile.NewProjectile((float)(current2.X * 16), (float)(current2.Y * 16), 0f, 0f, mod.ProjectileType("StormMarkHostile"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + new Vector2(0.9f, 2f); + if (npc.ai[0] < 114f && npc.ai[0] > 0f) + { + List list5 = new List(); + for (int num1472 = 0; num1472 < 1000; num1472++) + { + Projectile projectile9 = Main.projectile[num1472]; + if (projectile9.active && projectile9.type == mod.ProjectileType("StormMarkHostile")) + { + list5.Add(projectile9.Center); + } + } + } + } + if (npc.ai[0] == 0f) + { + npc.ai[0] = 1f; + npc.netUpdate = true; + flag116 = true; + } + } + if (npc.justHit) + { + npc.localAI[2] = 0f; + } + if (!flag112) + { + if (npc.localAI[2] >= 0f) + { + float num1477 = 16f; + bool flag119 = false; + bool flag120 = false; + if (npc.position.X > npc.localAI[0] - num1477 && npc.position.X < npc.localAI[0] + num1477) + { + flag119 = true; + } + else if ((npc.velocity.X < 0f && npc.direction > 0) || (npc.velocity.X > 0f && npc.direction < 0)) + { + flag119 = true; + num1477 += 24f; + } + if (npc.position.Y > npc.localAI[1] - num1477 && npc.position.Y < npc.localAI[1] + num1477) + { + flag120 = true; + } + if (flag119 && flag120) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 30f && num1477 == 16f) + { + flag111 = true; + } + if (npc.localAI[2] >= 60f) + { + npc.localAI[2] = -180f; + npc.direction *= -1; + npc.velocity.X = npc.velocity.X * -1f; + npc.collideX = false; + } + } + else + { + npc.localAI[0] = npc.position.X; + npc.localAI[1] = npc.position.Y; + npc.localAI[2] = 0f; + } + if (flag117) + { + npc.TargetClosest(true); + } + } + else + { + npc.localAI[2] += 1f; + npc.direction = ((Main.player[npc.target].Center.X > npc.Center.X) ? 1 : -1); + } + } + int num1478 = (int)((npc.position.X + (float)(npc.width / 2)) / 16f) + npc.direction * 2; + int num1479 = (int)((npc.position.Y + (float)npc.height) / 16f); + int num1480 = (int)npc.Bottom.Y / 16; + int num1481 = (int)npc.Bottom.X / 16; + if (flag116) + { + npc.velocity *= scaleFactor26; + return; + } + for (int num1482 = num1479; num1482 < num1479 + num1454; num1482++) + { + if (Main.tile[num1478, num1482] == null) + { + Main.tile[num1478, num1482] = new Tile(); + } + if ((Main.tile[num1478, num1482].nactive() && Main.tileSolid[(int)Main.tile[num1478, num1482].type]) || Main.tile[num1478, num1482].liquid > 0) + { + if (num1482 <= num1479 + 1) + { + flag114 = true; + } + flag113 = false; + break; + } + } + for (int num1483 = num1480; num1483 < num1480 + num1456; num1483++) + { + if (Main.tile[num1481, num1483] == null) + { + Main.tile[num1481, num1483] = new Tile(); + } + if ((Main.tile[num1481, num1483].nactive() && Main.tileSolid[(int)Main.tile[num1481, num1483].type]) || Main.tile[num1481, num1483].liquid > 0) + { + flag114 = true; + flag113 = false; + break; + } + } + if (flag115) + { + for (int num1484 = num1479 - num1455; num1484 < num1479; num1484++) + { + if (Main.tile[num1478, num1484] == null) + { + Main.tile[num1478, num1484] = new Tile(); + } + if ((Main.tile[num1478, num1484].nactive() && Main.tileSolid[(int)Main.tile[num1478, num1484].type]) || Main.tile[num1478, num1484].liquid > 0) + { + flag114 = false; + flag111 = true; + break; + } + } + } + if (flag111) + { + flag114 = false; + flag113 = true; + } + if (flag113) + { + npc.velocity.Y = npc.velocity.Y + num1457; + if (npc.velocity.Y > num1458) + { + npc.velocity.Y = num1458; + } + } + else + { + if ((npc.directionY < 0 && npc.velocity.Y > 0f) || flag114) + { + npc.velocity.Y = npc.velocity.Y + num1459; + } + if (npc.velocity.Y < num1460) + { + npc.velocity.Y = num1460; + } + } + if (npc.collideX) + { + npc.velocity.X = npc.oldVelocity.X * -0.4f; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 1f) + { + npc.velocity.X = 1f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -1f) + { + npc.velocity.X = -1f; + } + } + if (npc.collideY) + { + npc.velocity.Y = npc.oldVelocity.Y * -0.25f; + if (npc.velocity.Y > 0f && npc.velocity.Y < 1f) + { + npc.velocity.Y = 1f; + } + if (npc.velocity.Y < 0f && npc.velocity.Y > -1f) + { + npc.velocity.Y = -1f; + } + } + if (npc.direction == -1 && npc.velocity.X > -num1461) + { + npc.velocity.X = npc.velocity.X - num1462; + if (npc.velocity.X > num1461) + { + npc.velocity.X = npc.velocity.X - num1462; + } + else if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num1462 / 2f; + } + if (npc.velocity.X < -num1461) + { + npc.velocity.X = -num1461; + } + } + else if (npc.direction == 1 && npc.velocity.X < num1461) + { + npc.velocity.X = npc.velocity.X + num1462; + if (npc.velocity.X < -num1461) + { + npc.velocity.X = npc.velocity.X + num1462; + } + else if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num1462 / 2f; + } + if (npc.velocity.X > num1461) + { + npc.velocity.X = num1461; + } + } + if (npc.directionY == -1 && npc.velocity.Y > -num1463) + { + npc.velocity.Y = npc.velocity.Y - num1464; + if (npc.velocity.Y > num1463) + { + npc.velocity.Y = npc.velocity.Y - num1464 * 1.25f; + } + else if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1464 * 0.75f; + } + if (npc.velocity.Y < -num1463) + { + npc.velocity.Y = -num1461; + return; + } + } + else if (npc.directionY == 1 && npc.velocity.Y < num1463) + { + npc.velocity.Y = npc.velocity.Y + num1464; + if (npc.velocity.Y < -num1463) + { + npc.velocity.Y = npc.velocity.Y + num1464 * 1.25f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1464 * 0.75f; + } + if (npc.velocity.Y > num1463) + { + npc.velocity.Y = num1463; + return; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = mod.GetTexture("NPCs/NormalNPCs/ThiccWaifuAttack"); + if (npc.ai[0] > 0f) + { + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); + } + else + { + CalamityMod.DrawTexture(spriteBatch, Main.npcTexture[npc.type], 0, npc, drawColor); + } + return false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter = npc.frameCounter + (double)(npc.velocity.Length() * 0.1f) + 1.0; + if (npc.frameCounter >= (npc.ai[0] > 0f ? 16.0 : 8.0)) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 8) + { + npc.frame.Y = 0; + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode || !Main.raining) + { + return 0f; + } + return SpawnCondition.Sky.Chance * 0.1f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 16, 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, 16, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + 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) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EyeoftheStorm")); + } + } + else if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EyeoftheStorm")); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormSaber")); + } + } + } +} diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 57206583d9..42009f4339 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -1,86 +1,86 @@ -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.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class WulfrumDrone : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Drone"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.damage = 10; - npc.aiStyle = 3; - aiType = 73; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 6; - npc.lifeMax = 22; - npc.knockBackResist = 0.35f; - npc.value = Item.buyPrice(0, 0, 0, 50); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("WulfrumDroneBanner"); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - } - - 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 float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.05f : 0.2f); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 3, 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, 3, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard"), Main.rand.Next(1, 4)); - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); - } - } - } -} \ No newline at end of file +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.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class WulfrumDrone : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Drone"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.damage = 10; + npc.aiStyle = 3; + aiType = 73; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 6; + npc.lifeMax = 22; + npc.knockBackResist = 0.35f; + npc.value = Item.buyPrice(0, 0, 0, 50); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("WulfrumDroneBanner"); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + } + + 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 float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.05f : 0.2f); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, 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, 3, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard"), Main.rand.Next(1, 4)); + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); + } + } + } +} diff --git a/NPCs/NormalNPCs/WulfrumSlime.cs b/NPCs/NormalNPCs/WulfrumSlime.cs index a9a4b8d8d0..1c1c81cc6a 100644 --- a/NPCs/NormalNPCs/WulfrumSlime.cs +++ b/NPCs/NormalNPCs/WulfrumSlime.cs @@ -1,75 +1,75 @@ -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 WulfrumSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Slime"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 8; - npc.width = 30; //324 - npc.height = 22; //216 - npc.defense = 4; - npc.lifeMax = 12; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("WulfrumSlimeBanner"); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.08f : 0.33f); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 3, 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, 3, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); - } - } - } -} \ No newline at end of file +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 WulfrumSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Slime"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 8; + npc.width = 30; //324 + npc.height = 22; //216 + npc.defense = 4; + npc.lifeMax = 12; + npc.knockBackResist = 0f; + animationType = 81; + npc.value = Item.buyPrice(0, 0, 0, 30); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("WulfrumSlimeBanner"); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.08f : 0.33f); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, 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, 3, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WulfrumShard")); + } + } + } +} diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index e1706dfcd7..0ae51cec45 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -1,158 +1,158 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Perforator -{ - public class PerforatorBodyLarge : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 30; //70 - npc.npcSlots = 5f; - npc.width = 60; //324 - npc.height = 60; //216 - npc.defense = 12; - 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; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - if (Main.netMode != 1) - { - int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(5500, 20000)) - { - npc.localAI[0] = 0f; - 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 num941 = revenge ? 9f : 8f; - 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(-50, 51) * 0.05f; - num943 += (float)Main.rand.Next(-50, 51) * 0.05f; - int num945 = expertMode ? 9 : 11; - int num946 = mod.ProjectileType("BloodClot"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - if (Main.rand.Next(2) == 0) - { - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num947].timeLeft = 160; - } - npc.netUpdate = true; - } - } - } - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = mod.GetTexture("NPCs/Perforator/PerforatorBodyLargeAlt"); - CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor); - return false; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf4"), 1f); - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 180, true); - player.AddBuff(BuffID.Bleeding, 180, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Perforator +{ + public class PerforatorBodyLarge : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } + + public override void SetDefaults() + { + npc.damage = 30; //70 + npc.npcSlots = 5f; + npc.width = 60; //324 + npc.height = 60; //216 + npc.defense = 12; + 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; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (Main.netMode != 1) + { + int shoot = revenge ? 5 : 4; + npc.localAI[0] += (float)Main.rand.Next(shoot); + if (npc.localAI[0] >= (float)Main.rand.Next(5500, 20000)) + { + npc.localAI[0] = 0f; + 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 num941 = revenge ? 9f : 8f; + 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(-50, 51) * 0.05f; + num943 += (float)Main.rand.Next(-50, 51) * 0.05f; + int num945 = expertMode ? 9 : 11; + int num946 = mod.ProjectileType("BloodClot"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + if (Main.rand.Next(2) == 0) + { + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num947].timeLeft = 160; + } + npc.netUpdate = true; + } + } + } + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = mod.GetTexture("NPCs/Perforator/PerforatorBodyLargeAlt"); + CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor); + return false; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf4"), 1f); + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 180, true); + player.AddBuff(BuffID.Bleeding, 180, true); + } + } +} diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 87f73b338f..563c4b9728 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -1,149 +1,149 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Perforator -{ - public class PerforatorBodyMedium : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 25; //70 - npc.npcSlots = 5f; - npc.width = 54; //324 - npc.height = 54; //216 - npc.defense = 10; - 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; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - if (Main.netMode != 1) - { - int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(4000, 12000)) - { - npc.localAI[0] = 0f; - 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 num941 = revenge ? 9f : 8f; - 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(-50, 51) * 0.05f; - num943 += (float)Main.rand.Next(-50, 51) * 0.05f; - int num945 = expertMode ? 9 : 11; - int num946 = mod.ProjectileType("BloodClot"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - if (Main.rand.Next(2) == 0) - { - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num947].timeLeft = 160; - } - npc.netUpdate = true; - } - } - } - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf3"), 1f); - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 120, true); - player.AddBuff(BuffID.Bleeding, 120, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Perforator +{ + public class PerforatorBodyMedium : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } + + public override void SetDefaults() + { + npc.damage = 25; //70 + npc.npcSlots = 5f; + npc.width = 54; //324 + npc.height = 54; //216 + npc.defense = 10; + 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; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (Main.netMode != 1) + { + int shoot = revenge ? 5 : 4; + npc.localAI[0] += (float)Main.rand.Next(shoot); + if (npc.localAI[0] >= (float)Main.rand.Next(4000, 12000)) + { + npc.localAI[0] = 0f; + 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 num941 = revenge ? 9f : 8f; + 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(-50, 51) * 0.05f; + num943 += (float)Main.rand.Next(-50, 51) * 0.05f; + int num945 = expertMode ? 9 : 11; + int num946 = mod.ProjectileType("BloodClot"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + if (Main.rand.Next(2) == 0) + { + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num947].timeLeft = 160; + } + npc.netUpdate = true; + } + } + } + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf3"), 1f); + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 120, true); + player.AddBuff(BuffID.Bleeding, 120, true); + } + } +} diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 6fc5813310..f12afc0096 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -1,148 +1,148 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Perforator -{ - public class PerforatorBodySmall : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 20; //70 - npc.npcSlots = 5f; - npc.width = 42; //324 - npc.height = 42; //216 - npc.defense = 8; - 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; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - if (Main.netMode != 1) - { - int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(1500, 6000)) - { - npc.localAI[0] = 0f; - 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 num941 = revenge ? 9f : 8f; - 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(-50, 51) * 0.05f; - num943 += (float)Main.rand.Next(-50, 51) * 0.05f; - int num945 = expertMode ? 9 : 11; - int num946 = mod.ProjectileType("BloodClot"); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - if (Main.rand.Next(2) == 0) - { - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num947].timeLeft = 160; - } - npc.netUpdate = true; - } - } - } - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - 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 < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf2"), 1f); - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 90, true); - player.AddBuff(BuffID.Bleeding, 90, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Perforator +{ + public class PerforatorBodySmall : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } + + public override void SetDefaults() + { + npc.damage = 20; //70 + npc.npcSlots = 5f; + npc.width = 42; //324 + npc.height = 42; //216 + npc.defense = 8; + 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; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (Main.netMode != 1) + { + int shoot = revenge ? 5 : 4; + npc.localAI[0] += (float)Main.rand.Next(shoot); + if (npc.localAI[0] >= (float)Main.rand.Next(1500, 6000)) + { + npc.localAI[0] = 0f; + 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 num941 = revenge ? 9f : 8f; + 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(-50, 51) * 0.05f; + num943 += (float)Main.rand.Next(-50, 51) * 0.05f; + int num945 = expertMode ? 9 : 11; + int num946 = mod.ProjectileType("BloodClot"); + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + if (Main.rand.Next(2) == 0) + { + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num947].timeLeft = 160; + } + npc.netUpdate = true; + } + } + } + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + 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 < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf2"), 1f); + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 90, true); + player.AddBuff(BuffID.Bleeding, 90, true); + } + } +} diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index 6c725b5c5f..ef3ebbd2d8 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -1,80 +1,80 @@ -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.Perforator -{ - public class PerforatorCyst : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Perforator Cyst"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.1f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 0; - npc.lifeMax = 1000; - npc.knockBackResist = 0f; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit13; - npc.rarity = 2; - } - - 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 float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || NPC.AnyNPCs(mod.NPCType("PerforatorCyst")) || NPC.AnyNPCs(mod.NPCType("PerforatorHive"))) - { - return 0f; - } - return SpawnCondition.Crimson.Chance * (Main.hardMode ? 0.05f : 0.5f); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 2000; - npc.damage = 0; - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (Main.netMode != 1 && NPC.CountNPCS(mod.NPCType("PerforatorHive")) < 1) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("PerforatorHive")); - } - } - } - } -} \ No newline at end of file +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.Perforator +{ + public class PerforatorCyst : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perforator Cyst"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.1f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 0; + npc.lifeMax = 1000; + npc.knockBackResist = 0f; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit13; + npc.rarity = 2; + } + + 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 float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || NPC.AnyNPCs(mod.NPCType("PerforatorCyst")) || NPC.AnyNPCs(mod.NPCType("PerforatorHive"))) + { + return 0f; + } + return SpawnCondition.Crimson.Chance * (Main.hardMode ? 0.05f : 0.5f); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 2000; + npc.damage = 0; + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (Main.netMode != 1 && NPC.CountNPCS(mod.NPCType("PerforatorHive")) < 1) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("PerforatorHive")); + } + } + } + } +} diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 2eb5c602a4..614c120d49 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -1,471 +1,471 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Perforator -{ - [AutoloadBossHead] - public class PerforatorHeadLarge : ModNPC - { - private bool flies = false; - private float speed = 17f; - private float turnSpeed = 0.15f; - private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 7 : 15; - private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 8 : 16; - private bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 40; //150 - npc.npcSlots = 5f; - npc.width = 70; //324 - npc.height = 84; //216 - npc.defense = 0; - 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; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - } - - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - float speedMult = expertMode ? 1.5f : 1.425f; - float life = (float)npc.life; - float totalLife = (float)npc.lifeMax; - speed = 17f * (speedMult - (life / totalLife)); - turnSpeed = 0.15f * (speedMult - (life / totalLife)); - 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(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodyLarge"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailLarge"), npc.whoAmI); - } - if (num36 % 2 == 0) - { - Main.npc[lol].localAI[3] = 1f; - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - 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; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 400; - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) - { - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 0.05f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = 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; - } - else - { - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.5f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - 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 == num188) - { - 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; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - 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; - bool flag21 = false; - if (!flag21) - { - 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; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - 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; - } - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - 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; - } - } - } - - public override bool CheckActive() - { - return false; - } - - 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf2"), 1f); - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - name = "The Large Perforator"; - potionType = ItemID.HealingPotion; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(4, 9)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(3, 6)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(2, 5)); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 1.15f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 300, true); - player.AddBuff(BuffID.Bleeding, 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Perforator +{ + [AutoloadBossHead] + public class PerforatorHeadLarge : ModNPC + { + private bool flies = false; + private float speed = 17f; + private float turnSpeed = 0.15f; + private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 7 : 15; + private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 8 : 16; + private bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } + + public override void SetDefaults() + { + npc.damage = 40; //150 + npc.npcSlots = 5f; + npc.width = 70; //324 + npc.height = 84; //216 + npc.defense = 0; + 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; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + } + + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + float speedMult = expertMode ? 1.5f : 1.425f; + float life = (float)npc.life; + float totalLife = (float)npc.lifeMax; + speed = 17f * (speedMult - (life / totalLife)); + turnSpeed = 0.15f * (speedMult - (life / totalLife)); + 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(); + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (!TailSpawned) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodyLarge"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailLarge"), npc.whoAmI); + } + if (num36 % 2 == 0) + { + Main.npc[lol].localAI[3] = 1f; + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + 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; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 400; + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) + { + flag94 = false; + npc.velocity.Y = npc.velocity.Y + 0.05f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = 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; + } + else + { + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.5f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + 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 == num188) + { + 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; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + 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; + bool flag21 = false; + if (!flag21) + { + 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; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + 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; + } + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + 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; + } + } + } + + public override bool CheckActive() + { + return false; + } + + 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf2"), 1f); + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + name = "The Large Perforator"; + potionType = ItemID.HealingPotion; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(4, 9)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(3, 6)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(2, 5)); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 1.15f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 300, true); + player.AddBuff(BuffID.Bleeding, 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + } +} diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 29b8eb6a71..a989745e8e 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -1,467 +1,467 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Perforator -{ - [AutoloadBossHead] - public class PerforatorHeadMedium : ModNPC - { - private bool flies = false; - private float speed = 19f; - private float turnSpeed = 0.17f; - private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5 : 10; - private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 6 : 11; - private bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 35; //150 - npc.npcSlots = 5f; - npc.width = 58; //324 - npc.height = 68; //216 - npc.defense = 0; - 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; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - } - - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - float speedMult = expertMode ? 1.5f : 1.425f; - float life = (float)npc.life; - float totalLife = (float)npc.lifeMax; - speed = 15f * (speedMult - (life / totalLife)); - turnSpeed = 0.13f * (speedMult - (life / totalLife)); - 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(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodyMedium"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailMedium"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - 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; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 200; - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) - { - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 0.05f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = 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; - } - else - { - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.7f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - 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 == num188) - { - 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; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - 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; - bool flag21 = false; - if (!flag21) - { - 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; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - 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; - } - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - 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; - } - } - } - - public override bool CheckActive() - { - return false; - } - - 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf2"), 1f); - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - name = "The Medium Perforator"; - potionType = ItemID.HealingPotion; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(3, 8)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(2, 5)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(2, 4)); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 1.15f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 240, true); - player.AddBuff(BuffID.Bleeding, 240, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Perforator +{ + [AutoloadBossHead] + public class PerforatorHeadMedium : ModNPC + { + private bool flies = false; + private float speed = 19f; + private float turnSpeed = 0.17f; + private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5 : 10; + private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 6 : 11; + private bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } + + public override void SetDefaults() + { + npc.damage = 35; //150 + npc.npcSlots = 5f; + npc.width = 58; //324 + npc.height = 68; //216 + npc.defense = 0; + 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; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + } + + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + float speedMult = expertMode ? 1.5f : 1.425f; + float life = (float)npc.life; + float totalLife = (float)npc.lifeMax; + speed = 15f * (speedMult - (life / totalLife)); + turnSpeed = 0.13f * (speedMult - (life / totalLife)); + 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(); + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (!TailSpawned) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodyMedium"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailMedium"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + 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; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 200; + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) + { + flag94 = false; + npc.velocity.Y = npc.velocity.Y + 0.05f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = 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; + } + else + { + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.7f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + 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 == num188) + { + 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; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + 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; + bool flag21 = false; + if (!flag21) + { + 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; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + 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; + } + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + 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; + } + } + } + + public override bool CheckActive() + { + return false; + } + + 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf2"), 1f); + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + name = "The Medium Perforator"; + potionType = ItemID.HealingPotion; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(3, 8)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(2, 5)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(2, 4)); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 1.15f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 240, true); + player.AddBuff(BuffID.Bleeding, 240, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + } +} diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index e52975863c..0dc17e1d4a 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -1,466 +1,466 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Perforator -{ - [AutoloadBossHead] - public class PerforatorHeadSmall : ModNPC - { - private bool flies = false; - private float speed = 21f; - private float turnSpeed = 0.19f; - private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 3 : 6; - private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 4 : 7; - private bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 30; //150 - npc.npcSlots = 5f; - npc.width = 42; //324 - npc.height = 62; //216 - npc.defense = 0; - 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; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - } - - public override void AI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - float speedMult = expertMode ? 1.5f : 1.425f; - float life = (float)npc.life; - float totalLife = (float)npc.lifeMax; - speed = 13f * (speedMult - (life / totalLife)); - turnSpeed = 0.11f * (speedMult - (life / totalLife)); - 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(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodySmall"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailSmall"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - 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; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 100; - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) - { - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 0.05f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = 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; - } - else - { - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.9f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - 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 == num188) - { - 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; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - 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; - bool flag21 = false; - if (!flag21) - { - 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; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - 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; - } - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - 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; - } - } - } - - public override bool CheckActive() - { - return false; - } - - 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 < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf"), 1f); - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - name = "The Small Perforator"; - potionType = ItemID.HealingPotion; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(2, 6)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(1, 3)); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 1.15f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 180, true); - player.AddBuff(BuffID.Bleeding, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Perforator +{ + [AutoloadBossHead] + public class PerforatorHeadSmall : ModNPC + { + private bool flies = false; + private float speed = 21f; + private float turnSpeed = 0.19f; + private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 3 : 6; + private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 4 : 7; + private bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } + + public override void SetDefaults() + { + npc.damage = 30; //150 + npc.npcSlots = 5f; + npc.width = 42; //324 + npc.height = 62; //216 + npc.defense = 0; + 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; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + } + + public override void AI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + float speedMult = expertMode ? 1.5f : 1.425f; + float life = (float)npc.life; + float totalLife = (float)npc.lifeMax; + speed = 13f * (speedMult - (life / totalLife)); + turnSpeed = 0.11f * (speedMult - (life / totalLife)); + 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(); + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (!TailSpawned) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodySmall"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorTailSmall"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + 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; + } + bool flag94 = flies; + if (!flag94) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flag94 = true; + break; + } + } + } + } + } + if (!flag94) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 100; + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flag94 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + if (Main.player[npc.target].dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) + { + flag94 = false; + npc.velocity.Y = npc.velocity.Y + 0.05f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 0.05f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = 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; + } + else + { + if (!flag94) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.9f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + 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 == num188) + { + 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; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + 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; + bool flag21 = false; + if (!flag21) + { + 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; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + 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; + } + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag94) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + 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; + } + } + } + + public override bool CheckActive() + { + return false; + } + + 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 < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf"), 1f); + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + name = "The Small Perforator"; + potionType = ItemID.HealingPotion; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(2, 6)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(1, 3)); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 1.15f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 180, true); + player.AddBuff(BuffID.Bleeding, 180, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + } + } +} diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index ada9ee3aaa..9139753a69 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -1,392 +1,392 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Perforator -{ - [AutoloadBossHead] - public class PerforatorHive : ModNPC - { - private bool small = false; - private bool medium = false; - private bool large = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator Hive"); - Main.npcFrameCount[npc.type] = 10; - } - - public override void SetDefaults() - { - npc.npcSlots = 18f; - npc.damage = 35; - npc.width = 110; //324 - npc.height = 100; //216 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 5400 : 3750; - if (CalamityWorld.death) - { - npc.lifeMax = 7600; - } - if (CalamityWorld.bossRushActive) - { - 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; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 6, 0, 0); - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath19; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - else - music = MusicID.Boss2; - bossBag = mod.ItemType("PerforatorBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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() - { - CalamityGlobalNPC.perfHive = npc.whoAmI; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1.5f, 0f, 0f); - Player player = Main.player[npc.target]; - bool isCrimson = player.ZoneCrimson || CalamityWorld.bossRushActive; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - if (Vector2.Distance(player.Center, npc.Center) > 5600f) - { - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, 10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - npc.TargetClosest(true); - bool wormAlive = false; - if (NPC.AnyNPCs(mod.NPCType("PerforatorHeadLarge"))) - { - wormAlive = true; - } - if (wormAlive) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = isCrimson ? false : true; - } - if (Main.netMode != 1) - { - int shoot = revenge ? 6 : 4; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - shoot += 3; - } - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(300, 900)) - { - npc.localAI[0] = 0f; - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 20); - for (int num621 = 0; num621 < 8; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 170, 0f, 0f, 100, default(Color), 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.25f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 16; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 1.5f); - 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, 5, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - npc.TargetClosest(true); - float num179 = 8f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.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 = expertMode ? 14 : 18; - int num185 = (Main.rand.Next(2) == 0 ? mod.ProjectileType("IchorShot") : mod.ProjectileType("BloodGeyser")); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 20; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-180, 181); - num180 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -5f, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (npc.position.Y > player.position.Y - 160f) //200 - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.98f; - } - npc.velocity.Y = npc.velocity.Y - 0.1f; - if (npc.velocity.Y > 2f) - { - npc.velocity.Y = 2f; - } - } - else if (npc.position.Y < player.position.Y - 400f) //500 - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.98f; - } - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y < -2f) - { - npc.velocity.Y = -2f; - } - } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 80f) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > 8f) - { - npc.velocity.X = 8f; - } - } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 80f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -8f) - { - npc.velocity.X = -8f; - } - } - if (npc.ai[3] == 0f && npc.life > 0) - { - npc.ai[3] = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.3); - if ((float)(npc.life + num660) < npc.ai[3]) - { - npc.ai[3] = (float)npc.life; - int wormType = mod.NPCType("PerforatorHeadSmall"); - if (!small) - { - small = true; - } - else if (!medium) - { - medium = true; - wormType = mod.NPCType("PerforatorHeadMedium"); - } - else if (!large) - { - large = true; - wormType = mod.NPCType("PerforatorHeadLarge"); - } - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), wormType); - return; - } - } - } - } - - public override bool CheckDead() - { - if (NPC.AnyNPCs(mod.NPCType("PerforatorHeadLarge"))) - { - return false; - } - return true; - } - - 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 BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.HealingPotion; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PerforatorTrophy")); - } - 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("PerforatorMask")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Aorta")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SausageMaker")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodyRupture")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodBath")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VeinBurster")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Eviscerator")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ToothBall"), Main.rand.Next(25, 51)); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodClotStaff")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(7, 15)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(3, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(2, 6)); - if (Main.hardMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ichor, Main.rand.Next(10, 21)); - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive4"), 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 3f); - 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, 5, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Perforator +{ + [AutoloadBossHead] + public class PerforatorHive : ModNPC + { + private bool small = false; + private bool medium = false; + private bool large = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator Hive"); + Main.npcFrameCount[npc.type] = 10; + } + + public override void SetDefaults() + { + npc.npcSlots = 18f; + npc.damage = 35; + npc.width = 110; //324 + npc.height = 100; //216 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 5400 : 3750; + if (CalamityWorld.death) + { + npc.lifeMax = 7600; + } + if (CalamityWorld.bossRushActive) + { + 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; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 6, 0, 0); + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath19; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); + else + music = MusicID.Boss2; + bossBag = mod.ItemType("PerforatorBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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() + { + CalamityGlobalNPC.perfHive = npc.whoAmI; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1.5f, 0f, 0f); + Player player = Main.player[npc.target]; + bool isCrimson = player.ZoneCrimson || CalamityWorld.bossRushActive; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (Vector2.Distance(player.Center, npc.Center) > 5600f) + { + if (npc.timeLeft > 10) + npc.timeLeft = 10; + } + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, 10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + npc.TargetClosest(true); + bool wormAlive = false; + if (NPC.AnyNPCs(mod.NPCType("PerforatorHeadLarge"))) + { + wormAlive = true; + } + if (wormAlive) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = isCrimson ? false : true; + } + if (Main.netMode != 1) + { + int shoot = revenge ? 6 : 4; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + shoot += 3; + } + npc.localAI[0] += (float)Main.rand.Next(shoot); + if (npc.localAI[0] >= (float)Main.rand.Next(300, 900)) + { + npc.localAI[0] = 0f; + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 20); + for (int num621 = 0; num621 < 8; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 170, 0f, 0f, 100, default(Color), 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.25f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 16; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 1.5f); + 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, 5, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + npc.TargetClosest(true); + float num179 = 8f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.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 = expertMode ? 14 : 18; + int num185 = (Main.rand.Next(2) == 0 ? mod.ProjectileType("IchorShot") : mod.ProjectileType("BloodGeyser")); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 20; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-180, 181); + num180 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, -5f, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (npc.position.Y > player.position.Y - 160f) //200 + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.98f; + } + npc.velocity.Y = npc.velocity.Y - 0.1f; + if (npc.velocity.Y > 2f) + { + npc.velocity.Y = 2f; + } + } + else if (npc.position.Y < player.position.Y - 400f) //500 + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.98f; + } + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y < -2f) + { + npc.velocity.Y = -2f; + } + } + if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 80f) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X - 0.1f; + if (npc.velocity.X > 8f) + { + npc.velocity.X = 8f; + } + } + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 80f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X + 0.1f; + if (npc.velocity.X < -8f) + { + npc.velocity.X = -8f; + } + } + if (npc.ai[3] == 0f && npc.life > 0) + { + npc.ai[3] = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.3); + if ((float)(npc.life + num660) < npc.ai[3]) + { + npc.ai[3] = (float)npc.life; + int wormType = mod.NPCType("PerforatorHeadSmall"); + if (!small) + { + small = true; + } + else if (!medium) + { + medium = true; + wormType = mod.NPCType("PerforatorHeadMedium"); + } + else if (!large) + { + large = true; + wormType = mod.NPCType("PerforatorHeadLarge"); + } + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), wormType); + return; + } + } + } + } + + public override bool CheckDead() + { + if (NPC.AnyNPCs(mod.NPCType("PerforatorHeadLarge"))) + { + return false; + } + return true; + } + + 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 BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.HealingPotion; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PerforatorTrophy")); + } + 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("PerforatorMask")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Aorta")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SausageMaker")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodyRupture")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodBath")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VeinBurster")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Eviscerator")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ToothBall"), Main.rand.Next(25, 51)); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodClotStaff")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodSample"), Main.rand.Next(7, 15)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vertebrae, Main.rand.Next(3, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimtaneBar, Main.rand.Next(2, 6)); + if (Main.hardMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ichor, Main.rand.Next(10, 21)); + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Hive4"), 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default(Color), 3f); + 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, 5, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index a3ba5a89a9..8286f7e5e6 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -1,114 +1,114 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Perforator -{ - public class PerforatorTailLarge : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 20; - npc.npcSlots = 5f; - npc.width = 60; //324 - npc.height = 78; //216 - npc.defense = 25; - 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; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - 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 < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf5"), 1f); - } - } - - 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.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 90, true); - player.AddBuff(BuffID.Bleeding, 90, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Perforator +{ + public class PerforatorTailLarge : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } + + public override void SetDefaults() + { + npc.damage = 20; + npc.npcSlots = 5f; + npc.width = 60; //324 + npc.height = 78; //216 + npc.defense = 25; + 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; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + 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 < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf5"), 1f); + } + } + + 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.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 90, true); + player.AddBuff(BuffID.Bleeding, 90, true); + } + } +} diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index ec7090f66c..e605ca6ba3 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -1,114 +1,114 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Perforator -{ - public class PerforatorTailMedium : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 15; - npc.npcSlots = 5f; - npc.width = 44; //324 - npc.height = 58; //216 - npc.defense = 22; - 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; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - 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 < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf4"), 1f); - } - } - - 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.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 60, true); - player.AddBuff(BuffID.Bleeding, 60, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Perforator +{ + public class PerforatorTailMedium : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } + + public override void SetDefaults() + { + npc.damage = 15; + npc.npcSlots = 5f; + npc.width = 44; //324 + npc.height = 58; //216 + npc.defense = 22; + 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; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + 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 < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf4"), 1f); + } + } + + 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.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 60, true); + player.AddBuff(BuffID.Bleeding, 60, true); + } + } +} diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 3ad9aab1be..8c41e82714 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -1,114 +1,114 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Perforator -{ - public class PerforatorTailSmall : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforator"); - } - - public override void SetDefaults() - { - npc.damage = 10; - npc.npcSlots = 5f; - npc.width = 40; //324 - npc.height = 34; //216 - npc.defense = 18; - 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; - npc.scale = 0.9f; - npc.alpha = 255; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - 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 < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf3"), 1f); - } - } - - 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.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("BurningBlood"), 60, true); - player.AddBuff(BuffID.Bleeding, 60, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Perforator +{ + public class PerforatorTailSmall : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforator"); + } + + public override void SetDefaults() + { + npc.damage = 10; + npc.npcSlots = 5f; + npc.width = 40; //324 + npc.height = 34; //216 + npc.defense = 18; + 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; + npc.scale = 0.9f; + npc.alpha = 255; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + 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 < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf3"), 1f); + } + } + + 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.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("BurningBlood"), 60, true); + player.AddBuff(BuffID.Bleeding, 60, true); + } + } +} diff --git a/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs index 16048e6665..0da166a206 100644 --- a/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs +++ b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs @@ -1,44 +1,44 @@ -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.PlaguebringerGoliath -{ - public class PbGScreenShaderData : ScreenShaderData - { - private int PbGIndex; - - public PbGScreenShaderData(string passName) - : base(passName) - { - } - - private void UpdatePbGIndex() - { - int PbGType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); - if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) - { - return; - } - PbGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == PbGType) - { - PbGIndex = i; - break; - } - } - } - - public override void Apply() - { - UpdatePbGIndex(); - if (PbGIndex != -1) - { - UseTargetPosition(Main.npc[PbGIndex].Center); - } - base.Apply(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.PlaguebringerGoliath +{ + public class PbGScreenShaderData : ScreenShaderData + { + private int PbGIndex; + + public PbGScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdatePbGIndex() + { + int PbGType = ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3"); + if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) + { + return; + } + PbGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == PbGType) + { + PbGIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdatePbGIndex(); + if (PbGIndex != -1) + { + UseTargetPosition(Main.npc[PbGIndex].Center); + } + base.Apply(); + } + } +} diff --git a/NPCs/PlaguebringerGoliath/PbGSky.cs b/NPCs/PlaguebringerGoliath/PbGSky.cs index 4dfc927545..73c009f6e4 100644 --- a/NPCs/PlaguebringerGoliath/PbGSky.cs +++ b/NPCs/PlaguebringerGoliath/PbGSky.cs @@ -1,101 +1,101 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.PlaguebringerGoliath -{ - public class PbGSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int PbGIndex = -1; - - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } - - private float GetIntensity() - { - if (this.UpdatePbGIndex()) - { - float x = 0f; - if (this.PbGIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.PbGIndex].Center); - } - return 1f - Utils.SmoothStep(3000f, 6000f, x); - } - return 0f; - } - - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } - - private bool UpdatePbGIndex() - { - int PbGType = ModLoader.GetMod("CalamityMod").NPCType("PlaguebringerGoliath"); - if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) - { - return true; - } - PbGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == PbGType) - { - PbGIndex = i; - break; - } - } - //this.DoGIndex = DoGIndex; - return PbGIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); - } - } - - public override float GetCloudAlpha() - { - return 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } - - public override void Deactivate(params object[] args) - { - isActive = false; - } - - public override void Reset() - { - isActive = false; - } - - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.PlaguebringerGoliath +{ + public class PbGSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int PbGIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdatePbGIndex()) + { + float x = 0f; + if (this.PbGIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.PbGIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdatePbGIndex() + { + int PbGType = ModLoader.GetMod("CalamityMod").NPCType("PlaguebringerGoliath"); + if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) + { + return true; + } + PbGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == PbGType) + { + PbGIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return PbGIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs index ac19b9e0c1..7e4e6eba1c 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs @@ -1,231 +1,231 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.PlaguebringerGoliath -{ - public class PlagueBeeG : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Charger"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 60; - npc.width = 36; //324 - npc.height = 30; //216 - npc.defense = 20; - npc.scale = 0.75f; - npc.lifeMax = 300; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0.9f; - animationType = 210; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.015f, 0.1f, 0f); - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - 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) - { - 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 = 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; - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - 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; - 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; - } - } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - 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 (((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 bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 120, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.PlaguebringerGoliath +{ + public class PlagueBeeG : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Charger"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 60; + npc.width = 36; //324 + npc.height = 30; //216 + npc.defense = 20; + npc.scale = 0.75f; + npc.lifeMax = 300; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 50000; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0.9f; + animationType = 210; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.015f, 0.1f, 0f); + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + 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) + { + 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 = 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; + if (num6 == 0f) + { + num4 = npc.velocity.X; + num5 = npc.velocity.Y; + } + else + { + num6 = num / num6; + num4 *= num6; + num5 *= num6; + } + 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; + 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; + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + 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 (((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 bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs index f894d70a82..b2c3bcdf55 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs @@ -1,127 +1,127 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.PlaguebringerGoliath -{ - public class PlagueBeeLargeG : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Charger"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 65; - npc.width = 36; //324 - npc.height = 30; //216 - npc.defense = 23; - npc.lifeMax = 400; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 100000; - } - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0.95f; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = true; - } - - 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() - { - bool revenge = CalamityWorld.revenge; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.025f, 0.15f, 0.015f); - Player player = Main.player[npc.target]; - if (player.dead) - { - npc.TargetClosest(false); - npc.velocity.Y = npc.velocity.Y + 3f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 3f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - npc.rotation = npc.velocity.X * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.TargetClosest(true); - Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); - 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 ? 22f : 20f; - num1260 = num1261 / num1260; - num1258 *= num1260; - num1259 *= num1260; - npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; - return; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 180, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.PlaguebringerGoliath +{ + public class PlagueBeeLargeG : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Charger"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 65; + npc.width = 36; //324 + npc.height = 30; //216 + npc.defense = 23; + npc.lifeMax = 400; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 100000; + } + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0.95f; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = true; + } + + 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() + { + bool revenge = CalamityWorld.revenge; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.025f, 0.15f, 0.015f); + Player player = Main.player[npc.target]; + if (player.dead) + { + npc.TargetClosest(false); + npc.velocity.Y = npc.velocity.Y + 3f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 3f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + npc.rotation = npc.velocity.X * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.TargetClosest(true); + Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); + 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 ? 22f : 20f; + num1260 = num1261 / num1260; + num1258 *= num1260; + num1259 *= num1260; + npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; + return; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 180, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index cee88aca65..8fbfa5a7cf 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -1,217 +1,217 @@ -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.World; - -namespace CalamityMod.NPCs.PlaguebringerGoliath -{ - public class PlagueHomingMissile : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Homing Missile"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 90; - npc.width = 22; //324 - npc.height = 22; //216 - npc.defense = 10; - npc.lifeMax = 200; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[44] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; - npc.buffImmune[mod.BuffType("HolyLight")] = true; - npc.buffImmune[mod.BuffType("Plague")] = 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.015f, 0.1f, 0f); - if (Math.Abs(npc.velocity.X) >= 3f || Math.Abs(npc.velocity.Y) >= 3f) - { - float num247 = 0f; - float num248 = 0f; - if (Main.rand.Next(2) == 1) - { - num247 = npc.velocity.X * 0.5f; - num248 = npc.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(npc.position.X + 3f + num247, npc.position.Y + 3f + num248) - npc.velocity * 0.5f, npc.width - 8, npc.height - 8, 6, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(npc.position.X + 3f + num247, npc.position.Y + 3f + num248) - npc.velocity * 0.5f, npc.width - 8, npc.height - 8, 31, 0f, 0f, 100, default(Color), 0.25f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - else if (Main.rand.Next(4) == 0) - { - int num252 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = npc.Center + new Vector2(0f, (float)(-(float)npc.height / 2)).RotatedBy((double)npc.rotation, default(Vector2)) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = npc.Center + new Vector2(0f, (float)(-(float)npc.height / 2 - 6)).RotatedBy((double)npc.rotation, default(Vector2)) * 1.1f; - } - npc.rotation = npc.velocity.ToRotation() + 1.57079637f; - if (npc.ai[2] < 90f) - { - npc.ai[2] += 1f; - return; - } - int num3; - if (npc.ai[0] == 0f && npc.ai[1] > 0f) - { - float[] var_2_2065C_cp_0 = npc.ai; - int var_2_2065C_cp_1 = 1; - float num73 = var_2_2065C_cp_0[var_2_2065C_cp_1]; - var_2_2065C_cp_0[var_2_2065C_cp_1] = num73 - 1f; - } - else if (npc.ai[0] == 0f && npc.ai[1] == 0f) - { - npc.ai[0] = 1f; - npc.ai[1] = (float)Player.FindClosest(npc.position, npc.width, npc.height); - npc.netUpdate = true; - float num754 = npc.velocity.Length(); - npc.velocity = Vector2.Normalize(npc.velocity) * (num754 + 1f); - } - else if (npc.ai[0] == 1f) - { - float[] var_2_2087A_cp_0 = npc.localAI; - int var_2_2087A_cp_1 = 1; - float num73 = var_2_2087A_cp_0[var_2_2087A_cp_1]; - var_2_2087A_cp_0[var_2_2087A_cp_1] = num73 + 1f; - float num757 = 600f; - float num758 = 0f; - float num759 = 300f; - if (npc.localAI[1] == num757) - { - CheckDead(); - npc.life = 0; - return; - } - if (npc.localAI[1] >= num758 && npc.localAI[1] < num758 + num759) - { - npc.noTileCollide = true; - Vector2 v3 = Main.player[(int)npc.ai[1]].Center - npc.Center; - float num760 = npc.velocity.ToRotation(); - float num761 = v3.ToRotation(); - double num762 = (double)(num761 - num760); - if (num762 > 3.1415926535897931) - { - num762 -= 6.2831853071795862; - } - if (num762 < -3.1415926535897931) - { - num762 += 6.2831853071795862; - } - npc.velocity = npc.velocity.RotatedBy(num762 * 0.20000000298023224, default(Vector2)); - } - else - { - npc.noTileCollide = false; - } - } - for (int num767 = 0; num767 < 255; num767 = num3 + 1) - { - Player player5 = Main.player[num767]; - if (player5.active && !player5.dead && Vector2.Distance(player5.Center, npc.Center) <= 42f) - { - CheckDead(); - npc.life = 0; - return; - } - num3 = num767; - } - } - - 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 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.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, 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; - } - 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, 89, 0f, 0f, 100, default(Color), 3f); - 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, 89, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - return true; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("Plague"), 180, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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.World; + +namespace CalamityMod.NPCs.PlaguebringerGoliath +{ + public class PlagueHomingMissile : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Homing Missile"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 90; + npc.width = 22; //324 + npc.height = 22; //216 + npc.defense = 10; + npc.lifeMax = 200; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.canGhostHeal = false; + npc.buffImmune[189] = true; + npc.buffImmune[153] = true; + npc.buffImmune[70] = true; + npc.buffImmune[69] = true; + npc.buffImmune[44] = true; + npc.buffImmune[39] = true; + npc.buffImmune[24] = true; + npc.buffImmune[20] = true; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = true; + npc.buffImmune[mod.BuffType("HolyLight")] = true; + npc.buffImmune[mod.BuffType("Plague")] = 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.015f, 0.1f, 0f); + if (Math.Abs(npc.velocity.X) >= 3f || Math.Abs(npc.velocity.Y) >= 3f) + { + float num247 = 0f; + float num248 = 0f; + if (Main.rand.Next(2) == 1) + { + num247 = npc.velocity.X * 0.5f; + num248 = npc.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(npc.position.X + 3f + num247, npc.position.Y + 3f + num248) - npc.velocity * 0.5f, npc.width - 8, npc.height - 8, 6, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(npc.position.X + 3f + num247, npc.position.Y + 3f + num248) - npc.velocity * 0.5f, npc.width - 8, npc.height - 8, 31, 0f, 0f, 100, default(Color), 0.25f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + else if (Main.rand.Next(4) == 0) + { + int num252 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = npc.Center + new Vector2(0f, (float)(-(float)npc.height / 2)).RotatedBy((double)npc.rotation, default(Vector2)) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = npc.Center + new Vector2(0f, (float)(-(float)npc.height / 2 - 6)).RotatedBy((double)npc.rotation, default(Vector2)) * 1.1f; + } + npc.rotation = npc.velocity.ToRotation() + 1.57079637f; + if (npc.ai[2] < 90f) + { + npc.ai[2] += 1f; + return; + } + int num3; + if (npc.ai[0] == 0f && npc.ai[1] > 0f) + { + float[] var_2_2065C_cp_0 = npc.ai; + int var_2_2065C_cp_1 = 1; + float num73 = var_2_2065C_cp_0[var_2_2065C_cp_1]; + var_2_2065C_cp_0[var_2_2065C_cp_1] = num73 - 1f; + } + else if (npc.ai[0] == 0f && npc.ai[1] == 0f) + { + npc.ai[0] = 1f; + npc.ai[1] = (float)Player.FindClosest(npc.position, npc.width, npc.height); + npc.netUpdate = true; + float num754 = npc.velocity.Length(); + npc.velocity = Vector2.Normalize(npc.velocity) * (num754 + 1f); + } + else if (npc.ai[0] == 1f) + { + float[] var_2_2087A_cp_0 = npc.localAI; + int var_2_2087A_cp_1 = 1; + float num73 = var_2_2087A_cp_0[var_2_2087A_cp_1]; + var_2_2087A_cp_0[var_2_2087A_cp_1] = num73 + 1f; + float num757 = 600f; + float num758 = 0f; + float num759 = 300f; + if (npc.localAI[1] == num757) + { + CheckDead(); + npc.life = 0; + return; + } + if (npc.localAI[1] >= num758 && npc.localAI[1] < num758 + num759) + { + npc.noTileCollide = true; + Vector2 v3 = Main.player[(int)npc.ai[1]].Center - npc.Center; + float num760 = npc.velocity.ToRotation(); + float num761 = v3.ToRotation(); + double num762 = (double)(num761 - num760); + if (num762 > 3.1415926535897931) + { + num762 -= 6.2831853071795862; + } + if (num762 < -3.1415926535897931) + { + num762 += 6.2831853071795862; + } + npc.velocity = npc.velocity.RotatedBy(num762 * 0.20000000298023224, default(Vector2)); + } + else + { + npc.noTileCollide = false; + } + } + for (int num767 = 0; num767 < 255; num767 = num3 + 1) + { + Player player5 = Main.player[num767]; + if (player5.active && !player5.dead && Vector2.Distance(player5.Center, npc.Center) <= 42f) + { + CheckDead(); + npc.life = 0; + return; + } + num3 = num767; + } + } + + 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 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.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, 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; + } + 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, 89, 0f, 0f, 100, default(Color), 3f); + 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, 89, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + return true; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("Plague"), 180, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 9de6968ef0..cc5f79c296 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -1,163 +1,163 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.PlaguebringerGoliath -{ - public class PlagueMine : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Mine"); - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 1f; - npc.width = 42; //324 - npc.height = 42; //216 - npc.defense = 0; - npc.lifeMax = 100; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override void AI() - { - Player player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - return; - } - } - else if (npc.timeLeft > 600) - { - npc.timeLeft = 600; - } - Vector2 vector = Main.player[npc.target].Center - npc.Center; - if (vector.Length() < 90f || npc.ai[3] >= 900f) - { - npc.dontTakeDamage = false; - CheckDead(); - npc.life = 0; - return; - } - npc.ai[3] += 1f; - npc.dontTakeDamage = (npc.ai[3] >= 180f ? false : true); - if (npc.ai[3] >= 480f) - { - npc.velocity.Y *= 0.985f; - npc.velocity.X *= 0.985f; - return; - } - npc.TargetClosest(true); - float num1372 = 7f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } - - 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 ? 300 : 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, 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; - } - 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, 89, 0f, 0f, 100, default(Color), 3f); - 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, 89, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - return true; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 100; - npc.damage = 0; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.PlaguebringerGoliath +{ + public class PlagueMine : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Mine"); + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 1f; + npc.width = 42; //324 + npc.height = 42; //216 + npc.defense = 0; + npc.lifeMax = 100; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void AI() + { + Player player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + return; + } + } + else if (npc.timeLeft > 600) + { + npc.timeLeft = 600; + } + Vector2 vector = Main.player[npc.target].Center - npc.Center; + if (vector.Length() < 90f || npc.ai[3] >= 900f) + { + npc.dontTakeDamage = false; + CheckDead(); + npc.life = 0; + return; + } + npc.ai[3] += 1f; + npc.dontTakeDamage = (npc.ai[3] >= 180f ? false : true); + if (npc.ai[3] >= 480f) + { + npc.velocity.Y *= 0.985f; + npc.velocity.X *= 0.985f; + return; + } + npc.TargetClosest(true); + float num1372 = 7f; + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + float num1374 = player.Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + } + + 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 ? 300 : 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, 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; + } + 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, 89, 0f, 0f, 100, default(Color), 3f); + 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, 89, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + return true; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = 100; + npc.damage = 0; + } + } +} diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 0ecfca7d53..cbe2aaaf3e 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1,1204 +1,1204 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.PlaguebringerGoliath -{ - [AutoloadBossHead] - public class PlaguebringerGoliath : ModNPC - { - private const float MissileAngleSpread = 90; - private const int MissileProjectiles = 5; - private int MissileCountdown = 0; - private int despawnTimer = 600; - private int chargeDistance = 0; - private bool charging = false; - private bool halfLife = false; - private bool canDespawn = false; - private bool flyingFrame2 = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Plaguebringer Goliath"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 100; //150 - npc.npcSlots = 64f; - npc.width = 198; //324 - npc.height = 198; //216 - npc.defense = 55; - npc.lifeMax = CalamityWorld.revenge ? 77275 : 58500; - if (CalamityWorld.death) - { - npc.lifeMax = 110000; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.boss = true; - npc.value = Item.buyPrice(0, 25, 0, 0); - 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[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; - npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"); - else - music = MusicID.Boss3; - bossBag = mod.ItemType("PlaguebringerGoliathBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(halfLife); - writer.Write(canDespawn); - writer.Write(flyingFrame2); - writer.Write(MissileCountdown); - writer.Write(despawnTimer); - writer.Write(chargeDistance); - writer.Write(charging); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - halfLife = reader.ReadBoolean(); - canDespawn = reader.ReadBoolean(); - flyingFrame2 = reader.ReadBoolean(); - MissileCountdown = reader.ReadInt32(); - despawnTimer = reader.ReadInt32(); - chargeDistance = reader.ReadInt32(); - charging = reader.ReadBoolean(); - } - - public override void AI() - { - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.15f, 0.35f, 0.05f); - if (!halfLife && ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.death || CalamityWorld.bossRushActive)) - { - string key = "Mods.CalamityMod.PlagueBossText"; - Color messageColor = Color.Lime; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - halfLife = true; - } - if (halfLife && MissileCountdown == 0) - { - MissileCountdown = 600; - } - if (MissileCountdown > 1) - { - MissileCountdown--; - } - int num1038 = 0; - for (int num1039 = 0; num1039 < 255; num1039++) - { - if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) - { - num1038++; - } - } - if (expertMode) - { - int num1040 = (int)(50f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense + num1040; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - } - Vector2 distFromPlayer = Main.player[npc.target].Center - npc.Center; - bool aboveGroundEnrage = ((double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0 || - Main.player[npc.target].position.Y > (float)((Main.maxTilesY - 200) * 16)) && !CalamityWorld.bossRushActive; - bool jungleEnrage = false; - if (!Main.player[npc.target].ZoneJungle && !CalamityWorld.bossRushActive) - { - jungleEnrage = true; - } - if (jungleEnrage || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) - { - if (despawnTimer > 0) - { - despawnTimer--; - } - } - else - { - despawnTimer = 600; - } - canDespawn = (despawnTimer <= 0); - if (canDespawn) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - } - if (npc.ai[0] == -1f) - { - if (Main.netMode != 1) - { - float num595 = npc.ai[1]; - int num596; - do - { - num596 = Main.rand.Next(3); - if (MissileCountdown == 1) - { - num596 = 4; - } - else if (num596 == 1) - { - num596 = 2; - } - else if (num596 == 2) - { - num596 = 3; - } - } - while ((float)num596 == num595); - if (num596 == 0 && ((double)npc.life <= (double)npc.lifeMax * 0.8 || CalamityWorld.death) && distFromPlayer.Length() < 1800f) - { - switch (Main.rand.Next(3)) - { - case 0: chargeDistance = 0; break; - case 1: chargeDistance = 400; break; - case 2: chargeDistance = -400; break; - } - } - npc.ai[0] = (float)num596; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.ai[0] == 0f) - { - int num1043 = 2; //2 - if ((npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] % 2f == 0f) - { - npc.TargetClosest(true); - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)chargeDistance)) < 20f) - { - switch (Main.rand.Next(3)) - { - case 0: chargeDistance = 0; break; - case 1: chargeDistance = 400; break; - case 2: chargeDistance = -400; break; - } - charging = true; - npc.ai[1] += 1f; - npc.ai[2] = 0f; - float num1044 = revenge ? 24f : 22f; //16 - if (aboveGroundEnrage) - { - num1044 += 6f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num1044 += 2f; //2 not a prob - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num1044 += 2f; //2 not a prob - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num1044 += 2f; //2 not a prob - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num1044 += 2f; //2 not a prob - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1044 += 2f; - } - Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; - float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); - num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); - return; - } - charging = false; - float num1048 = revenge ? 10f : 9f; //12 not a prob - float num1049 = revenge ? 0.15f : 0.13f; //0.15 not a prob - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num1048 += 1f; //1 not a prob - num1049 += 0.05f; //0.05 not a prob - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num1048 += 1f; //1 not a prob - num1049 += 0.05f; //0.05 not a prob - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num1048 += 2f; //2 not a prob - num1049 += 0.05f; //0.05 not a prob - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num1048 += 2f; //2 not a prob - num1049 += 0.1f; //0.1 not a prob - } - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1048 += 2f; - num1049 += 0.1f; - } - if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)chargeDistance)) - { - npc.velocity.Y = npc.velocity.Y + num1049; - } - else - { - npc.velocity.Y = npc.velocity.Y - num1049; - } - if (npc.velocity.Y < -12f) - { - npc.velocity.Y = -num1048; - } - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = num1048; - } - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - { - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; - } - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - { - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; - } - else - { - npc.velocity.X = npc.velocity.X * 0.8f; - } - if (npc.velocity.X < -16f) - { - npc.velocity.X = -16f; - } - if (npc.velocity.X > 16f) - { - npc.velocity.X = 16f; - } - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - } - else - { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - int num1050 = 600; //600 not a prob - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1050 = 250; - } - else if (aboveGroundEnrage) - { - num1050 = 350; - } - else if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num1050 = 400; - } - else if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num1050 = revenge ? 425 : 450; //300 not a prob - } - else if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num1050 = revenge ? 450 : 475; //450 not a prob - } - else if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num1050 = 500; //500 not a prob - } - else if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num1050 = 550; //550 not a prob - } - int num1051 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - { - num1051 = -1; - } - if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) - { - npc.ai[2] = 1f; - } - if (npc.ai[2] != 1f) - { - charging = true; - return; - } - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - charging = false; - npc.velocity *= 0.9f; - float num1052 = revenge ? 0.13f : 0.115f; //0.1 - if (npc.life < npc.lifeMax / 2) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; //0.05 - } - if (npc.life < npc.lifeMax / 3) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; //0.05 - } - if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; //0.05 - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - } - } - } - else if (npc.ai[0] == 2f) - { - npc.TargetClosest(true); - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - float num1053 = 12f; - float num1054 = 0.2f; - float num10542 = 0.1f; - Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1055 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector118.X; - float num1056 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector118.Y; - float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); - if (num1057 < 800f) - { - npc.ai[0] = (((double)npc.life <= (double)npc.lifeMax * 0.66 || CalamityWorld.death) ? 5f : 1f); - npc.ai[1] = 0f; - npc.netUpdate = true; - return; - } - num1057 = num1053 / num1057; - if (npc.velocity.X < num1055) - { - npc.velocity.X = npc.velocity.X + num1054; - if (npc.velocity.X < 0f && num1055 > 0f) - { - npc.velocity.X = npc.velocity.X + num1054; - } - } - else if (npc.velocity.X > num1055) - { - npc.velocity.X = npc.velocity.X - num1054; - if (npc.velocity.X > 0f && num1055 < 0f) - { - npc.velocity.X = npc.velocity.X - num1054; - } - } - if (npc.velocity.Y < num1056) - { - npc.velocity.Y = npc.velocity.Y + num10542; - if (npc.velocity.Y < 0f && num1056 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10542; - } - } - else if (npc.velocity.Y > num1056) - { - npc.velocity.Y = npc.velocity.Y - num10542; - if (npc.velocity.Y > 0f && num1056 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10542; - } - } - } - else if (npc.ai[0] == 1f) - { - charging = false; - npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - npc.ai[1] += 1f; - npc.ai[1] += (float)(num1038 / 2); - if ((double)npc.life < (double)npc.lifeMax * 0.75 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 0.25f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 0.25f; - } - bool flag103 = false; - if (npc.ai[1] > 40f) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - flag103 = true; - } - if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 8); - if (Main.netMode != 1) - { - int randomAmt = expertMode ? 2 : 4; - int num1061; - if (Main.rand.Next(randomAmt) == 0) - { - num1061 = mod.NPCType("PlagueBeeLargeG"); - } - else - { - num1061 = mod.NPCType("PlagueBeeG"); - } - if (expertMode && NPC.CountNPCS(mod.NPCType("PlagueMine")) < (aboveGroundEnrage ? 4 : 2)) - { - NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueMine"), 0, 0f, 0f, 0f, 0f, 255); - } - if (revenge && NPC.CountNPCS(mod.NPCType("PlaguebringerShade")) < (aboveGroundEnrage ? 2 : 1)) - { - NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlaguebringerShade"), 0, 0f, 0f, 0f, 0f, 255); - } - if (NPC.CountNPCS(mod.NPCType("PlagueBeeLargeG")) < 2) - { - 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.02f; - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.02f; - Main.npc[num1062].localAI[0] = 60f; - Main.npc[num1062].netUpdate = true; - } - } - } - if (num1060 > 800f || !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)) - { - float num1063 = 14f; //changed from 14 not a prob - float num1064 = 0.2f; //changed from 0.1 not a prob - float num10642 = 0.07f; - vector120 = vector119; - num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - num1060 = num1063 / num1060; - if (npc.velocity.X < num1058) - { - npc.velocity.X = npc.velocity.X + num1064; - if (npc.velocity.X < 0f && num1058 > 0f) - { - npc.velocity.X = npc.velocity.X + num1064; - } - } - else if (npc.velocity.X > num1058) - { - npc.velocity.X = npc.velocity.X - num1064; - if (npc.velocity.X > 0f && num1058 < 0f) - { - npc.velocity.X = npc.velocity.X - num1064; - } - } - if (npc.velocity.Y < num1059) - { - npc.velocity.Y = npc.velocity.Y + num10642; - if (npc.velocity.Y < 0f && num1059 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10642; - } - } - else if (npc.velocity.Y > num1059) - { - npc.velocity.Y = npc.velocity.Y - num10642; - if (npc.velocity.Y > 0f && num1059 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10642; - } - } - } - else - { - npc.velocity *= 0.9f; - } - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - if (npc.ai[2] > 3f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 5f) - { - charging = false; - npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - npc.ai[1] += 1f; - npc.ai[1] += (float)(num1038 / 2); - bool flag103 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 0.25f; //0.25 not a prob - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.ai[1] += 0.25f; //0.25 not a prob - } - if (npc.ai[1] > 40f) //changed from 40 not a prob - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - flag103 = true; - } - if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 88); - if (Main.netMode != 1) - { - if (expertMode && NPC.CountNPCS(mod.NPCType("PlagueMine")) < (aboveGroundEnrage ? 6 : 4)) - { - NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueMine"), 0, 0f, 0f, 0f, 0f, 255); - } - if (revenge && NPC.CountNPCS(mod.NPCType("PlaguebringerShade")) < 1 && aboveGroundEnrage) - { - NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlaguebringerShade"), 0, 0f, 0f, 0f, 0f, 255); - } - float projectileSpeed = revenge ? 6f : 5f; - float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector119.X + (float)Main.rand.Next(-80, 81); - float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector119.Y + (float)Main.rand.Next(-40, 41); - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); - num1073 = projectileSpeed / num1073; - num1071 *= num1073; - num1072 *= num1073; - if (NPC.CountNPCS(mod.NPCType("PlagueHomingMissile")) < (aboveGroundEnrage ? 8 : 5)) - { - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueHomingMissile"), 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = num1071; - Main.npc[num1062].velocity.Y = num1072; - Main.npc[num1062].netUpdate = true; - } - } - } - if (num1060 > 800f || !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)) - { - float num1063 = 14f; //changed from 14 not a prob - float num1064 = 0.2f; //changed from 0.1 not a prob - float num10642 = 0.07f; - vector120 = vector119; - num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - num1060 = num1063 / num1060; - if (npc.velocity.X < num1058) - { - npc.velocity.X = npc.velocity.X + num1064; - if (npc.velocity.X < 0f && num1058 > 0f) - { - npc.velocity.X = npc.velocity.X + num1064; - } - } - else if (npc.velocity.X > num1058) - { - npc.velocity.X = npc.velocity.X - num1064; - if (npc.velocity.X > 0f && num1058 < 0f) - { - npc.velocity.X = npc.velocity.X - num1064; - } - } - if (npc.velocity.Y < num1059) - { - npc.velocity.Y = npc.velocity.Y + num10642; - if (npc.velocity.Y < 0f && num1059 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num10642; - } - } - else if (npc.velocity.Y > num1059) - { - npc.velocity.Y = npc.velocity.Y - num10642; - if (npc.velocity.Y > 0f && num1059 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num10642; - } - } - } - else - { - npc.velocity *= 0.9f; - } - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - if (npc.ai[2] > 3f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - if (npc.ai[1] % 10f == 9f) - { - flag104 = true; - } - } - else if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.death || CalamityWorld.bossRushActive || aboveGroundEnrage) - { - if (npc.ai[1] % 20f == 19f) - { - flag104 = true; - } - } - else if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - if (npc.ai[1] % 25f == 24f) - { - flag104 = true; - } - } - else if (npc.ai[1] % 30f == 29f) - { - flag104 = true; - } - if (flag104 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector121, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); - if (Main.netMode != 1) - { - float projectileSpeed = revenge ? 6.5f : 6f; - if (jungleEnrage || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - projectileSpeed += 10f; - } - float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector121.X + (float)Main.rand.Next(-80, 81); - float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector121.Y + (float)Main.rand.Next(-40, 41); - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); - num1073 = projectileSpeed / num1073; - num1071 *= num1073; - num1072 *= num1073; - int num1074 = 40; //projectile damage - int num1075 = (Main.rand.Next(2) == 0 ? mod.ProjectileType("PlagueStingerGoliath") : mod.ProjectileType("PlagueStingerGoliathV2")); - if (expertMode) - { - num1074 = 28; //112 - int damageBoost = (int)(6f * (1f - (float)npc.life / (float)npc.lifeMax)); - num1074 += damageBoost; //112 to 136 - if (Main.rand.Next(6) == 0) - { - num1074 += 8; //144 to 168 - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - } - else - { - if (Main.rand.Next(9) == 0) - { - num1074 = 50; - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - } - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, -1f, 0f); - } - } - if (npc.position.Y > Main.player[npc.target].position.Y - 200f) //200 - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.98f; - } - npc.velocity.Y = npc.velocity.Y - 0.1f; - if (npc.velocity.Y > 2f) - { - npc.velocity.Y = 2f; - } - } - else if (npc.position.Y < Main.player[npc.target].position.Y - 500f) //500 - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y * 0.98f; - } - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y < -2f) - { - npc.velocity.Y = -2f; - } - } - if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 100f) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X - 0.1f; - if (npc.velocity.X > 8f) - { - npc.velocity.X = 8f; - } - } - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 100f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X * 0.98f; - } - npc.velocity.X = npc.velocity.X + 0.1f; - if (npc.velocity.X < -8f) - { - npc.velocity.X = -8f; - } - } - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - if (npc.ai[1] > 300f) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - int num1043 = 2; //2 - if (npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) - { - MissileCountdown = 0; - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] % 2f == 0f) - { - npc.TargetClosest(true); - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 500f)) < 20f) - { - if (MissileCountdown == 1) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 116); - if (Main.netMode != 1) - { - int speed = revenge ? 6 : 5; - float spawnX = Main.rand.Next(1000) - 500 + npc.Center.X; - float spawnY = npc.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed; - int damage = expertMode ? 42 : 57; - for (int i = 0; i < MissileProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - (MissileProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / (float)MissileProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("HiveBombGoliath"), damage, 10f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); - } - } - } - charging = true; - npc.ai[1] += 1f; - npc.ai[2] = 0f; - float num1044 = revenge ? 28f : 26f; //16 - Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; - float num1046 = (Main.player[npc.target].position.Y - 500f) + (float)(Main.player[npc.target].height / 2) - vector117.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); - num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - return; - } - charging = false; - float num1048 = 12f; //12 not a prob - float num1049 = 0.15f; //0.15 not a prob - if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 500f)) - { - npc.velocity.Y = npc.velocity.Y + num1049; - } - else - { - npc.velocity.Y = npc.velocity.Y - num1049; - } - if (npc.velocity.Y < -12f) - { - npc.velocity.Y = -num1048; - } - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = num1048; - } - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - { - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; - } - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - { - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; - } - else - { - npc.velocity.X = npc.velocity.X * 0.8f; - } - if (npc.velocity.X < -16f) - { - npc.velocity.X = -16f; - } - if (npc.velocity.X > 16f) - { - npc.velocity.X = 16f; - } - npc.direction = (playerLocation < 0 ? 1 : -1); - npc.spriteDirection = npc.direction; - } - else - { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - int num1050 = 600; //600 not a prob - int num1051 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - { - num1051 = -1; - } - if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) - { - npc.ai[2] = 1f; - } - if (npc.ai[2] != 1f) - { - charging = true; - return; - } - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - charging = false; - npc.velocity *= 0.9f; - float num1052 = revenge ? 0.13f : 0.115f; //0.1 - if (npc.life < npc.lifeMax / 2) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; //0.05 - } - if (npc.life < npc.lifeMax / 3) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; //0.05 - } - if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; //0.05 - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - } - } - } - } - - public override bool CheckActive() - { - return canDespawn; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg"), 2f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg2"), 2f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg3"), 2f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg4"), 2f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg5"), 2f); - 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default(Color), 3f); - 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, 46, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = Main.npcTexture[npc.type]; - if (charging) - { - texture = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex"); - } - else - { - if (!flyingFrame2) - { - texture = Main.npcTexture[npc.type]; - } - else - { - texture = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathAltTex"); - } - } - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 4) - { - npc.frame.Y = 0; - if (!charging) - { - flyingFrame2 = !flyingFrame2; - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlaguebringerGoliathTrophy")); - } - 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("PlagueCellCluster"), Main.rand.Next(10, 15)); - if (Main.rand.Next(10) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("BloomStone"), 1, true); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MepheticSprayer")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Malevolence")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VirulentKatana")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DiseasedPike")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PestilentDefiler")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ThePlaguebringer")); - } - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlaguebringerGoliathMask")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheHive")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueStaff")); - } - } - } - - 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("Plague"), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 180, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.PlaguebringerGoliath +{ + [AutoloadBossHead] + public class PlaguebringerGoliath : ModNPC + { + private const float MissileAngleSpread = 90; + private const int MissileProjectiles = 5; + private int MissileCountdown = 0; + private int despawnTimer = 600; + private int chargeDistance = 0; + private bool charging = false; + private bool halfLife = false; + private bool canDespawn = false; + private bool flyingFrame2 = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Plaguebringer Goliath"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 100; //150 + npc.npcSlots = 64f; + npc.width = 198; //324 + npc.height = 198; //216 + npc.defense = 55; + npc.lifeMax = CalamityWorld.revenge ? 77275 : 58500; + if (CalamityWorld.death) + { + npc.lifeMax = 110000; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.boss = true; + npc.value = Item.buyPrice(0, 25, 0, 0); + 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[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; + npc.DeathSound = SoundID.NPCDeath14; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"); + else + music = MusicID.Boss3; + bossBag = mod.ItemType("PlaguebringerGoliathBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(halfLife); + writer.Write(canDespawn); + writer.Write(flyingFrame2); + writer.Write(MissileCountdown); + writer.Write(despawnTimer); + writer.Write(chargeDistance); + writer.Write(charging); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + halfLife = reader.ReadBoolean(); + canDespawn = reader.ReadBoolean(); + flyingFrame2 = reader.ReadBoolean(); + MissileCountdown = reader.ReadInt32(); + despawnTimer = reader.ReadInt32(); + chargeDistance = reader.ReadInt32(); + charging = reader.ReadBoolean(); + } + + public override void AI() + { + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.15f, 0.35f, 0.05f); + if (!halfLife && ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.death || CalamityWorld.bossRushActive)) + { + string key = "Mods.CalamityMod.PlagueBossText"; + Color messageColor = Color.Lime; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + halfLife = true; + } + if (halfLife && MissileCountdown == 0) + { + MissileCountdown = 600; + } + if (MissileCountdown > 1) + { + MissileCountdown--; + } + int num1038 = 0; + for (int num1039 = 0; num1039 < 255; num1039++) + { + if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) + { + num1038++; + } + } + if (expertMode) + { + int num1040 = (int)(50f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.defense = npc.defDefense + num1040; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + } + Vector2 distFromPlayer = Main.player[npc.target].Center - npc.Center; + bool aboveGroundEnrage = ((double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0 || + Main.player[npc.target].position.Y > (float)((Main.maxTilesY - 200) * 16)) && !CalamityWorld.bossRushActive; + bool jungleEnrage = false; + if (!Main.player[npc.target].ZoneJungle && !CalamityWorld.bossRushActive) + { + jungleEnrage = true; + } + if (jungleEnrage || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) + { + if (despawnTimer > 0) + { + despawnTimer--; + } + } + else + { + despawnTimer = 600; + } + canDespawn = (despawnTimer <= 0); + if (canDespawn) + { + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + } + if (npc.ai[0] == -1f) + { + if (Main.netMode != 1) + { + float num595 = npc.ai[1]; + int num596; + do + { + num596 = Main.rand.Next(3); + if (MissileCountdown == 1) + { + num596 = 4; + } + else if (num596 == 1) + { + num596 = 2; + } + else if (num596 == 2) + { + num596 = 3; + } + } + while ((float)num596 == num595); + if (num596 == 0 && ((double)npc.life <= (double)npc.lifeMax * 0.8 || CalamityWorld.death) && distFromPlayer.Length() < 1800f) + { + switch (Main.rand.Next(3)) + { + case 0: chargeDistance = 0; break; + case 1: chargeDistance = 400; break; + case 2: chargeDistance = -400; break; + } + } + npc.ai[0] = (float)num596; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.ai[0] == 0f) + { + int num1043 = 2; //2 + if ((npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + if (npc.ai[1] % 2f == 0f) + { + npc.TargetClosest(true); + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)chargeDistance)) < 20f) + { + switch (Main.rand.Next(3)) + { + case 0: chargeDistance = 0; break; + case 1: chargeDistance = 400; break; + case 2: chargeDistance = -400; break; + } + charging = true; + npc.ai[1] += 1f; + npc.ai[2] = 0f; + float num1044 = revenge ? 24f : 22f; //16 + if (aboveGroundEnrage) + { + num1044 += 6f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num1044 += 2f; //2 not a prob + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num1044 += 2f; //2 not a prob + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num1044 += 2f; //2 not a prob + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num1044 += 2f; //2 not a prob + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1044 += 2f; + } + Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; + float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; + float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + num1047 = num1044 / num1047; + npc.velocity.X = num1045 * num1047; + npc.velocity.Y = num1046 * num1047; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + return; + } + charging = false; + float num1048 = revenge ? 10f : 9f; //12 not a prob + float num1049 = revenge ? 0.15f : 0.13f; //0.15 not a prob + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num1048 += 1f; //1 not a prob + num1049 += 0.05f; //0.05 not a prob + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num1048 += 1f; //1 not a prob + num1049 += 0.05f; //0.05 not a prob + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num1048 += 2f; //2 not a prob + num1049 += 0.05f; //0.05 not a prob + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num1048 += 2f; //2 not a prob + num1049 += 0.1f; //0.1 not a prob + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1048 += 2f; + num1049 += 0.1f; + } + if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - (float)chargeDistance)) + { + npc.velocity.Y = npc.velocity.Y + num1049; + } + else + { + npc.velocity.Y = npc.velocity.Y - num1049; + } + if (npc.velocity.Y < -12f) + { + npc.velocity.Y = -num1048; + } + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = num1048; + } + if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + { + npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + } + else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + { + npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + } + else + { + npc.velocity.X = npc.velocity.X * 0.8f; + } + if (npc.velocity.X < -16f) + { + npc.velocity.X = -16f; + } + if (npc.velocity.X > 16f) + { + npc.velocity.X = 16f; + } + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + } + else + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + int num1050 = 600; //600 not a prob + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1050 = 250; + } + else if (aboveGroundEnrage) + { + num1050 = 350; + } + else if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num1050 = 400; + } + else if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num1050 = revenge ? 425 : 450; //300 not a prob + } + else if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num1050 = revenge ? 450 : 475; //450 not a prob + } + else if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num1050 = 500; //500 not a prob + } + else if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num1050 = 550; //550 not a prob + } + int num1051 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + { + num1051 = -1; + } + if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) + { + npc.ai[2] = 1f; + } + if (npc.ai[2] != 1f) + { + charging = true; + return; + } + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + charging = false; + npc.velocity *= 0.9f; + float num1052 = revenge ? 0.13f : 0.115f; //0.1 + if (npc.life < npc.lifeMax / 2) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; //0.05 + } + if (npc.life < npc.lifeMax / 3) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; //0.05 + } + if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; //0.05 + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + } + } + } + else if (npc.ai[0] == 2f) + { + npc.TargetClosest(true); + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + float num1053 = 12f; + float num1054 = 0.2f; + float num10542 = 0.1f; + Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1055 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector118.X; + float num1056 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector118.Y; + float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); + if (num1057 < 800f) + { + npc.ai[0] = (((double)npc.life <= (double)npc.lifeMax * 0.66 || CalamityWorld.death) ? 5f : 1f); + npc.ai[1] = 0f; + npc.netUpdate = true; + return; + } + num1057 = num1053 / num1057; + if (npc.velocity.X < num1055) + { + npc.velocity.X = npc.velocity.X + num1054; + if (npc.velocity.X < 0f && num1055 > 0f) + { + npc.velocity.X = npc.velocity.X + num1054; + } + } + else if (npc.velocity.X > num1055) + { + npc.velocity.X = npc.velocity.X - num1054; + if (npc.velocity.X > 0f && num1055 < 0f) + { + npc.velocity.X = npc.velocity.X - num1054; + } + } + if (npc.velocity.Y < num1056) + { + npc.velocity.Y = npc.velocity.Y + num10542; + if (npc.velocity.Y < 0f && num1056 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10542; + } + } + else if (npc.velocity.Y > num1056) + { + npc.velocity.Y = npc.velocity.Y - num10542; + if (npc.velocity.Y > 0f && num1056 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10542; + } + } + } + else if (npc.ai[0] == 1f) + { + charging = false; + npc.TargetClosest(true); + Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + npc.ai[1] += 1f; + npc.ai[1] += (float)(num1038 / 2); + if ((double)npc.life < (double)npc.lifeMax * 0.75 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 0.25f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 0.25f; + } + bool flag103 = false; + if (npc.ai[1] > 40f) + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + flag103 = true; + } + if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 8); + if (Main.netMode != 1) + { + int randomAmt = expertMode ? 2 : 4; + int num1061; + if (Main.rand.Next(randomAmt) == 0) + { + num1061 = mod.NPCType("PlagueBeeLargeG"); + } + else + { + num1061 = mod.NPCType("PlagueBeeG"); + } + if (expertMode && NPC.CountNPCS(mod.NPCType("PlagueMine")) < (aboveGroundEnrage ? 4 : 2)) + { + NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueMine"), 0, 0f, 0f, 0f, 0f, 255); + } + if (revenge && NPC.CountNPCS(mod.NPCType("PlaguebringerShade")) < (aboveGroundEnrage ? 2 : 1)) + { + NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlaguebringerShade"), 0, 0f, 0f, 0f, 0f, 255); + } + if (NPC.CountNPCS(mod.NPCType("PlagueBeeLargeG")) < 2) + { + 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.02f; + Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.02f; + Main.npc[num1062].localAI[0] = 60f; + Main.npc[num1062].netUpdate = true; + } + } + } + if (num1060 > 800f || !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)) + { + float num1063 = 14f; //changed from 14 not a prob + float num1064 = 0.2f; //changed from 0.1 not a prob + float num10642 = 0.07f; + vector120 = vector119; + num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + num1060 = num1063 / num1060; + if (npc.velocity.X < num1058) + { + npc.velocity.X = npc.velocity.X + num1064; + if (npc.velocity.X < 0f && num1058 > 0f) + { + npc.velocity.X = npc.velocity.X + num1064; + } + } + else if (npc.velocity.X > num1058) + { + npc.velocity.X = npc.velocity.X - num1064; + if (npc.velocity.X > 0f && num1058 < 0f) + { + npc.velocity.X = npc.velocity.X - num1064; + } + } + if (npc.velocity.Y < num1059) + { + npc.velocity.Y = npc.velocity.Y + num10642; + if (npc.velocity.Y < 0f && num1059 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10642; + } + } + else if (npc.velocity.Y > num1059) + { + npc.velocity.Y = npc.velocity.Y - num10642; + if (npc.velocity.Y > 0f && num1059 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10642; + } + } + } + else + { + npc.velocity *= 0.9f; + } + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + if (npc.ai[2] > 3f) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 5f) + { + charging = false; + npc.TargetClosest(true); + Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + npc.ai[1] += 1f; + npc.ai[1] += (float)(num1038 / 2); + bool flag103 = false; + if ((double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 0.25f; //0.25 not a prob + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.ai[1] += 0.25f; //0.25 not a prob + } + if (npc.ai[1] > 40f) //changed from 40 not a prob + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + flag103 = true; + } + if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 88); + if (Main.netMode != 1) + { + if (expertMode && NPC.CountNPCS(mod.NPCType("PlagueMine")) < (aboveGroundEnrage ? 6 : 4)) + { + NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueMine"), 0, 0f, 0f, 0f, 0f, 255); + } + if (revenge && NPC.CountNPCS(mod.NPCType("PlaguebringerShade")) < 1 && aboveGroundEnrage) + { + NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlaguebringerShade"), 0, 0f, 0f, 0f, 0f, 255); + } + float projectileSpeed = revenge ? 6f : 5f; + float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector119.X + (float)Main.rand.Next(-80, 81); + float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector119.Y + (float)Main.rand.Next(-40, 41); + float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + num1073 = projectileSpeed / num1073; + num1071 *= num1073; + num1072 *= num1073; + if (NPC.CountNPCS(mod.NPCType("PlagueHomingMissile")) < (aboveGroundEnrage ? 8 : 5)) + { + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, mod.NPCType("PlagueHomingMissile"), 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1062].velocity.X = num1071; + Main.npc[num1062].velocity.Y = num1072; + Main.npc[num1062].netUpdate = true; + } + } + } + if (num1060 > 800f || !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)) + { + float num1063 = 14f; //changed from 14 not a prob + float num1064 = 0.2f; //changed from 0.1 not a prob + float num10642 = 0.07f; + vector120 = vector119; + num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + num1060 = num1063 / num1060; + if (npc.velocity.X < num1058) + { + npc.velocity.X = npc.velocity.X + num1064; + if (npc.velocity.X < 0f && num1058 > 0f) + { + npc.velocity.X = npc.velocity.X + num1064; + } + } + else if (npc.velocity.X > num1058) + { + npc.velocity.X = npc.velocity.X - num1064; + if (npc.velocity.X > 0f && num1058 < 0f) + { + npc.velocity.X = npc.velocity.X - num1064; + } + } + if (npc.velocity.Y < num1059) + { + npc.velocity.Y = npc.velocity.Y + num10642; + if (npc.velocity.Y < 0f && num1059 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num10642; + } + } + else if (npc.velocity.Y > num1059) + { + npc.velocity.Y = npc.velocity.Y - num10642; + if (npc.velocity.Y > 0f && num1059 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num10642; + } + } + } + else + { + npc.velocity *= 0.9f; + } + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + if (npc.ai[2] > 3f) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + if (npc.ai[1] % 10f == 9f) + { + flag104 = true; + } + } + else if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.death || CalamityWorld.bossRushActive || aboveGroundEnrage) + { + if (npc.ai[1] % 20f == 19f) + { + flag104 = true; + } + } + else if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + if (npc.ai[1] % 25f == 24f) + { + flag104 = true; + } + } + else if (npc.ai[1] % 30f == 29f) + { + flag104 = true; + } + if (flag104 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector121, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); + if (Main.netMode != 1) + { + float projectileSpeed = revenge ? 6.5f : 6f; + if (jungleEnrage || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + projectileSpeed += 10f; + } + float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector121.X + (float)Main.rand.Next(-80, 81); + float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector121.Y + (float)Main.rand.Next(-40, 41); + float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + num1073 = projectileSpeed / num1073; + num1071 *= num1073; + num1072 *= num1073; + int num1074 = 40; //projectile damage + int num1075 = (Main.rand.Next(2) == 0 ? mod.ProjectileType("PlagueStingerGoliath") : mod.ProjectileType("PlagueStingerGoliathV2")); + if (expertMode) + { + num1074 = 28; //112 + int damageBoost = (int)(6f * (1f - (float)npc.life / (float)npc.lifeMax)); + num1074 += damageBoost; //112 to 136 + if (Main.rand.Next(6) == 0) + { + num1074 += 8; //144 to 168 + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + } + else + { + if (Main.rand.Next(9) == 0) + { + num1074 = 50; + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + } + Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, -1f, 0f); + } + } + if (npc.position.Y > Main.player[npc.target].position.Y - 200f) //200 + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.98f; + } + npc.velocity.Y = npc.velocity.Y - 0.1f; + if (npc.velocity.Y > 2f) + { + npc.velocity.Y = 2f; + } + } + else if (npc.position.Y < Main.player[npc.target].position.Y - 500f) //500 + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y * 0.98f; + } + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y < -2f) + { + npc.velocity.Y = -2f; + } + } + if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 100f) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X - 0.1f; + if (npc.velocity.X > 8f) + { + npc.velocity.X = 8f; + } + } + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 100f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X * 0.98f; + } + npc.velocity.X = npc.velocity.X + 0.1f; + if (npc.velocity.X < -8f) + { + npc.velocity.X = -8f; + } + } + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + if (npc.ai[1] > 300f) + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + int num1043 = 2; //2 + if (npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) + { + MissileCountdown = 0; + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + if (npc.ai[1] % 2f == 0f) + { + npc.TargetClosest(true); + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 500f)) < 20f) + { + if (MissileCountdown == 1) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 116); + if (Main.netMode != 1) + { + int speed = revenge ? 6 : 5; + float spawnX = Main.rand.Next(1000) - 500 + npc.Center.X; + float spawnY = npc.Center.Y; + Vector2 baseSpawn = new Vector2(spawnX, spawnY); + Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity = baseVelocity * speed; + int damage = expertMode ? 42 : 57; + for (int i = 0; i < MissileProjectiles; i++) + { + Vector2 spawn = baseSpawn; + spawn.X = spawn.X + i * 30 - (MissileProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / (float)MissileProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("HiveBombGoliath"), damage, 10f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); + } + } + } + charging = true; + npc.ai[1] += 1f; + npc.ai[2] = 0f; + float num1044 = revenge ? 28f : 26f; //16 + Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; + float num1046 = (Main.player[npc.target].position.Y - 500f) + (float)(Main.player[npc.target].height / 2) - vector117.Y; + float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + num1047 = num1044 / num1047; + npc.velocity.X = num1045 * num1047; + npc.velocity.Y = num1046 * num1047; + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + return; + } + charging = false; + float num1048 = 12f; //12 not a prob + float num1049 = 0.15f; //0.15 not a prob + if (npc.position.Y + (float)(npc.height / 2) < (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 500f)) + { + npc.velocity.Y = npc.velocity.Y + num1049; + } + else + { + npc.velocity.Y = npc.velocity.Y - num1049; + } + if (npc.velocity.Y < -12f) + { + npc.velocity.Y = -num1048; + } + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = num1048; + } + if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + { + npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + } + else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + { + npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + } + else + { + npc.velocity.X = npc.velocity.X * 0.8f; + } + if (npc.velocity.X < -16f) + { + npc.velocity.X = -16f; + } + if (npc.velocity.X > 16f) + { + npc.velocity.X = 16f; + } + npc.direction = (playerLocation < 0 ? 1 : -1); + npc.spriteDirection = npc.direction; + } + else + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + int num1050 = 600; //600 not a prob + int num1051 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + { + num1051 = -1; + } + if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) + { + npc.ai[2] = 1f; + } + if (npc.ai[2] != 1f) + { + charging = true; + return; + } + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + charging = false; + npc.velocity *= 0.9f; + float num1052 = revenge ? 0.13f : 0.115f; //0.1 + if (npc.life < npc.lifeMax / 2) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; //0.05 + } + if (npc.life < npc.lifeMax / 3) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; //0.05 + } + if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) + { + npc.velocity *= 0.9f; + num1052 += 0.05f; //0.05 + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + } + } + } + } + + public override bool CheckActive() + { + return canDespawn; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg"), 2f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg2"), 2f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg3"), 2f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg4"), 2f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg5"), 2f); + 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default(Color), 3f); + 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, 46, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = Main.npcTexture[npc.type]; + if (charging) + { + texture = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathChargeTex"); + } + else + { + if (!flyingFrame2) + { + texture = Main.npcTexture[npc.type]; + } + else + { + texture = mod.GetTexture("NPCs/PlaguebringerGoliath/PlaguebringerGoliathAltTex"); + } + } + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 4) + { + npc.frame.Y = 0; + if (!charging) + { + flyingFrame2 = !flyingFrame2; + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.GreaterHealingPotion; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlaguebringerGoliathTrophy")); + } + 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("PlagueCellCluster"), Main.rand.Next(10, 15)); + if (Main.rand.Next(10) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("BloomStone"), 1, true); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MepheticSprayer")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Malevolence")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VirulentKatana")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DiseasedPike")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PestilentDefiler")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ThePlaguebringer")); + } + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlaguebringerGoliathMask")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheHive")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueStaff")); + } + } + } + + 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("Plague"), 300, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 180, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + } + } +} diff --git a/NPCs/PlaguebringerShade/PlaguebringerShade.cs b/NPCs/PlaguebringerShade/PlaguebringerShade.cs index 5c9e75b3d8..d6cf1abff0 100644 --- a/NPCs/PlaguebringerShade/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerShade/PlaguebringerShade.cs @@ -1,633 +1,633 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.PlaguebringerShade -{ - public class PlaguebringerShade : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plaguebringer"); - Main.npcFrameCount[npc.type] = 12; - } - - public override void SetDefaults() - { - npc.damage = 80; //150 - npc.npcSlots = 8f; - npc.width = 66; //324 - 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.aiStyle = -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.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - 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); - if (Main.expertMode) - { - int num1041 = (int)(30f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.damage = npc.defDamage - num1041; - } - bool flag113 = false; - if (!Main.player[npc.target].ZoneJungle && !CalamityWorld.bossRushActive) - { - flag113 = true; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - } - else - { - if (npc.timeLeft < 750) - { - npc.timeLeft = 750; - } - } - int num1038 = 0; - for (int num1039 = 0; num1039 < 255; num1039++) - { - if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) - { - num1038++; - } - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - } - bool dead4 = Main.player[npc.target].dead; - if (dead4 && Main.expertMode) - { - if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) - { - npc.velocity.Y = npc.velocity.Y + 0.04f; - } - if (npc.position.X < (float)(Main.maxTilesX * 8)) - { - npc.velocity.X = npc.velocity.X - 0.04f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.04f; - } - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - return; - } - } - else if (npc.ai[0] == -1f) - { - if (Main.netMode != 1) - { - float num1041 = npc.ai[1]; - int num1042; - do - { - num1042 = Main.rand.Next(3); - if (num1042 == 1) - { - num1042 = 2; - } - else if (num1042 == 2) - { - num1042 = 3; - } - } - while ((float)num1042 == num1041); - npc.ai[0] = (float)num1042; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - return; - } - } - else if (npc.ai[0] == 0f) - { - int num1043 = 2; //2 - if (flag113) - { - num1043 += 1; - } - if (npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] % 2f == 0f) - { - npc.TargetClosest(true); - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) - { - npc.localAI[0] = 1f; - npc.ai[1] += 1f; - npc.ai[2] = 0f; - float num1044 = 15f; //12 - if (flag113) - { - num1044 += 2f; - } - Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; - float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); - num1047 = num1044 / num1047; - npc.velocity.X = num1045 * num1047; - npc.velocity.Y = num1046 * num1047; - npc.spriteDirection = npc.direction; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); - return; - } - npc.localAI[0] = 0f; - float num1048 = 12.25f; //12 - float num1049 = 0.155f; //0.15 - if (flag113) - { - num1048 += 1f; //2 - num1049 += 0.075f; //0.1 - } - if (npc.position.Y + (float)(npc.height / 2) < Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2)) - { - npc.velocity.Y = npc.velocity.Y + num1049; - } - else - { - npc.velocity.Y = npc.velocity.Y - num1049; - } - if (npc.velocity.Y < -12f) - { - npc.velocity.Y = -num1048; - } - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = num1048; - } - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) - { - npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; - } - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) - { - npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; - } - else - { - npc.velocity.X = npc.velocity.X * 0.8f; - } - if (npc.velocity.X < -16f) - { - npc.velocity.X = -16f; - } - if (npc.velocity.X > 16f) - { - npc.velocity.X = 16f; - } - npc.spriteDirection = npc.direction; - return; - } - else - { - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - int num1050 = 500; //600 - int num1051 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) - { - num1051 = -1; - } - if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) - { - npc.ai[2] = 1f; - } - if (npc.ai[2] != 1f) - { - npc.localAI[0] = 1f; - return; - } - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.localAI[0] = 0f; - npc.velocity *= 0.9f; - float num1052 = 0.105f; //0.1 - if (flag113) - { - npc.velocity *= 0.9f; - num1052 += 0.075f; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - return; - } - } - } - else if (npc.ai[0] == 2f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - float num1053 = 12f; //12 - float num1054 = 0.1f; //0.07 - if (flag113) - { - num1054 = 0.12f; - } - Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1055 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector118.X; - float num1056 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector118.Y; - float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); - if (num1057 < 400f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return; - } - num1057 = num1053 / num1057; - if (npc.velocity.X < num1055) - { - npc.velocity.X = npc.velocity.X + num1054; - if (npc.velocity.X < 0f && num1055 > 0f) - { - npc.velocity.X = npc.velocity.X + num1054; - } - } - else if (npc.velocity.X > num1055) - { - npc.velocity.X = npc.velocity.X - num1054; - if (npc.velocity.X > 0f && num1055 < 0f) - { - npc.velocity.X = npc.velocity.X - num1054; - } - } - if (npc.velocity.Y < num1056) - { - npc.velocity.Y = npc.velocity.Y + num1054; - if (npc.velocity.Y < 0f && num1056 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1054; - return; - } - } - else if (npc.velocity.Y > num1056) - { - npc.velocity.Y = npc.velocity.Y - num1054; - if (npc.velocity.Y > 0f && num1056 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1054; - return; - } - } - } - else if (npc.ai[0] == 1f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - npc.ai[1] += 1f; - npc.ai[1] += (float)(num1038 / 2); - bool flag103 = false; - if (npc.ai[1] > 10f) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - flag103 = true; - } - if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) - { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 8); - if (Main.netMode != 1) - { - int num1061; - if (Main.rand.Next(4) == 0) - { - num1061 = mod.NPCType("PlagueBeeLargeG"); - } - else - { - 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 (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)) - { - float num1063 = 14.5f; //changed from 14 - float num1064 = 0.105f; //changed from 0.1 - vector120 = vector119; - num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; - num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; - num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); - num1060 = num1063 / num1060; - if (npc.velocity.X < num1058) - { - npc.velocity.X = npc.velocity.X + num1064; - if (npc.velocity.X < 0f && num1058 > 0f) - { - npc.velocity.X = npc.velocity.X + num1064; - } - } - else if (npc.velocity.X > num1058) - { - npc.velocity.X = npc.velocity.X - num1064; - if (npc.velocity.X > 0f && num1058 < 0f) - { - npc.velocity.X = npc.velocity.X - num1064; - } - } - if (npc.velocity.Y < num1059) - { - npc.velocity.Y = npc.velocity.Y + num1064; - if (npc.velocity.Y < 0f && num1059 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1064; - } - } - else if (npc.velocity.Y > num1059) - { - npc.velocity.Y = npc.velocity.Y - num1064; - if (npc.velocity.Y > 0f && num1059 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1064; - } - } - } - else - { - npc.velocity *= 0.9f; //changed from 0.9 - } - npc.spriteDirection = npc.direction; - if (npc.ai[2] > 2f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 3f) - { - float num1065 = 7f; //changed from 4 - float num1066 = 0.075f; //changed from 0.05 - if (flag113) - { - num1066 = 0.09f; - num1065 = 8f; - } - 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); - Vector2 vector122 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1067 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector122.X; - float num1068 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector122.Y; - float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); - npc.ai[1] += 1f; - bool flag104 = false; - if (npc.ai[1] % 35f == 34f) - { - flag104 = true; - } - if (flag104 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector121, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); - if (Main.netMode != 1) - { - float num1070 = 6f; //changed from 8 - if (flag113) - { - num1070 += 2f; - } - float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector121.X + (float)Main.rand.Next(-80, 81); - float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector121.Y + (float)Main.rand.Next(-40, 41); - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); - num1073 = num1070 / num1073; - num1071 *= num1073; - num1072 *= num1073; - int num1074 = 20; //projectile damage - int num1075 = mod.ProjectileType("PlagueStingerGoliathV2"); //projectile type - if (Main.rand.Next(15) == 0) - { - num1074 = 25; - num1075 = mod.ProjectileType("HiveBombGoliath"); - } - 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; - } - } - if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - num1065 = 14.5f; //changed from 14 - num1066 = 0.105f; //changed from 0.1 - vector122 = vector121; - num1067 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector122.X; - num1068 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector122.Y; - num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); - num1069 = num1065 / num1069; - if (npc.velocity.X < num1067) - { - npc.velocity.X = npc.velocity.X + num1066; - if (npc.velocity.X < 0f && num1067 > 0f) - { - npc.velocity.X = npc.velocity.X + num1066; - } - } - else if (npc.velocity.X > num1067) - { - npc.velocity.X = npc.velocity.X - num1066; - if (npc.velocity.X > 0f && num1067 < 0f) - { - npc.velocity.X = npc.velocity.X - num1066; - } - } - if (npc.velocity.Y < num1068) - { - npc.velocity.Y = npc.velocity.Y + num1066; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1066; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num1066; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1066; - } - } - } - else if (num1069 > 100f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - num1069 = num1065 / num1069; - if (npc.velocity.X < num1067) - { - npc.velocity.X = npc.velocity.X + num1066; - if (npc.velocity.X < 0f && num1067 > 0f) - { - npc.velocity.X = npc.velocity.X + num1066 * 2f; - } - } - else if (npc.velocity.X > num1067) - { - npc.velocity.X = npc.velocity.X - num1066; - if (npc.velocity.X > 0f && num1067 < 0f) - { - npc.velocity.X = npc.velocity.X - num1066 * 2f; - } - } - if (npc.velocity.Y < num1068) - { - npc.velocity.Y = npc.velocity.Y + num1066; - if (npc.velocity.Y < 0f && num1068 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1066 * 2f; - } - } - else if (npc.velocity.Y > num1068) - { - npc.velocity.Y = npc.velocity.Y - num1066; - if (npc.velocity.Y > 0f && num1068 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1066 * 2f; - } - } - } - if (npc.ai[1] > 600f) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - return; - } - } - } - - 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) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); - } - 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); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 100; - npc.height = 100; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default(Color), 3f); - 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, 46, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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); - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.PlaguebringerShade +{ + public class PlaguebringerShade : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer"); + Main.npcFrameCount[npc.type] = 12; + } + + public override void SetDefaults() + { + npc.damage = 80; //150 + npc.npcSlots = 8f; + npc.width = 66; //324 + 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.aiStyle = -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.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + 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); + if (Main.expertMode) + { + int num1041 = (int)(30f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.damage = npc.defDamage - num1041; + } + bool flag113 = false; + if (!Main.player[npc.target].ZoneJungle && !CalamityWorld.bossRushActive) + { + flag113 = true; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + } + else + { + if (npc.timeLeft < 750) + { + npc.timeLeft = 750; + } + } + int num1038 = 0; + for (int num1039 = 0; num1039 < 255; num1039++) + { + if (Main.player[num1039].active && !Main.player[num1039].dead && (npc.Center - Main.player[num1039].Center).Length() < 1000f) + { + num1038++; + } + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(true); + } + bool dead4 = Main.player[npc.target].dead; + if (dead4 && Main.expertMode) + { + if ((double)npc.position.Y < Main.worldSurface * 16.0 + 2000.0) + { + npc.velocity.Y = npc.velocity.Y + 0.04f; + } + if (npc.position.X < (float)(Main.maxTilesX * 8)) + { + npc.velocity.X = npc.velocity.X - 0.04f; + } + else + { + npc.velocity.X = npc.velocity.X + 0.04f; + } + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + return; + } + } + else if (npc.ai[0] == -1f) + { + if (Main.netMode != 1) + { + float num1041 = npc.ai[1]; + int num1042; + do + { + num1042 = Main.rand.Next(3); + if (num1042 == 1) + { + num1042 = 2; + } + else if (num1042 == 2) + { + num1042 = 3; + } + } + while ((float)num1042 == num1041); + npc.ai[0] = (float)num1042; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + return; + } + } + else if (npc.ai[0] == 0f) + { + int num1043 = 2; //2 + if (flag113) + { + num1043 += 1; + } + if (npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + if (npc.ai[1] % 2f == 0f) + { + npc.TargetClosest(true); + if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2))) < 20f) + { + npc.localAI[0] = 1f; + npc.ai[1] += 1f; + npc.ai[2] = 0f; + float num1044 = 15f; //12 + if (flag113) + { + num1044 += 2f; + } + Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1045 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector117.X; + float num1046 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector117.Y; + float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + num1047 = num1044 / num1047; + npc.velocity.X = num1045 * num1047; + npc.velocity.Y = num1046 * num1047; + npc.spriteDirection = npc.direction; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + return; + } + npc.localAI[0] = 0f; + float num1048 = 12.25f; //12 + float num1049 = 0.155f; //0.15 + if (flag113) + { + num1048 += 1f; //2 + num1049 += 0.075f; //0.1 + } + if (npc.position.Y + (float)(npc.height / 2) < Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2)) + { + npc.velocity.Y = npc.velocity.Y + num1049; + } + else + { + npc.velocity.Y = npc.velocity.Y - num1049; + } + if (npc.velocity.Y < -12f) + { + npc.velocity.Y = -num1048; + } + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = num1048; + } + if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > 600f) + { + npc.velocity.X = npc.velocity.X + 0.15f * (float)npc.direction; + } + else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) < 300f) + { + npc.velocity.X = npc.velocity.X - 0.15f * (float)npc.direction; + } + else + { + npc.velocity.X = npc.velocity.X * 0.8f; + } + if (npc.velocity.X < -16f) + { + npc.velocity.X = -16f; + } + if (npc.velocity.X > 16f) + { + npc.velocity.X = 16f; + } + npc.spriteDirection = npc.direction; + return; + } + else + { + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + int num1050 = 500; //600 + int num1051 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) + { + num1051 = -1; + } + if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))) > (float)num1050) + { + npc.ai[2] = 1f; + } + if (npc.ai[2] != 1f) + { + npc.localAI[0] = 1f; + return; + } + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + npc.localAI[0] = 0f; + npc.velocity *= 0.9f; + float num1052 = 0.105f; //0.1 + if (flag113) + { + npc.velocity *= 0.9f; + num1052 += 0.075f; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; + return; + } + } + } + else if (npc.ai[0] == 2f) + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + float num1053 = 12f; //12 + float num1054 = 0.1f; //0.07 + if (flag113) + { + num1054 = 0.12f; + } + Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1055 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector118.X; + float num1056 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector118.Y; + float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); + if (num1057 < 400f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + return; + } + num1057 = num1053 / num1057; + if (npc.velocity.X < num1055) + { + npc.velocity.X = npc.velocity.X + num1054; + if (npc.velocity.X < 0f && num1055 > 0f) + { + npc.velocity.X = npc.velocity.X + num1054; + } + } + else if (npc.velocity.X > num1055) + { + npc.velocity.X = npc.velocity.X - num1054; + if (npc.velocity.X > 0f && num1055 < 0f) + { + npc.velocity.X = npc.velocity.X - num1054; + } + } + if (npc.velocity.Y < num1056) + { + npc.velocity.Y = npc.velocity.Y + num1054; + if (npc.velocity.Y < 0f && num1056 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1054; + return; + } + } + else if (npc.velocity.Y > num1056) + { + npc.velocity.Y = npc.velocity.Y - num1054; + if (npc.velocity.Y > 0f && num1056 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1054; + return; + } + } + } + else if (npc.ai[0] == 1f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); + Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + float num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + npc.ai[1] += 1f; + npc.ai[1] += (float)(num1038 / 2); + bool flag103 = false; + if (npc.ai[1] > 10f) + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + flag103 = true; + } + if (Collision.CanHit(vector119, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag103) + { + Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 8); + if (Main.netMode != 1) + { + int num1061; + if (Main.rand.Next(4) == 0) + { + num1061 = mod.NPCType("PlagueBeeLargeG"); + } + else + { + 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 (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)) + { + float num1063 = 14.5f; //changed from 14 + float num1064 = 0.105f; //changed from 0.1 + vector120 = vector119; + num1058 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector120.X; + num1059 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector120.Y; + num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + num1060 = num1063 / num1060; + if (npc.velocity.X < num1058) + { + npc.velocity.X = npc.velocity.X + num1064; + if (npc.velocity.X < 0f && num1058 > 0f) + { + npc.velocity.X = npc.velocity.X + num1064; + } + } + else if (npc.velocity.X > num1058) + { + npc.velocity.X = npc.velocity.X - num1064; + if (npc.velocity.X > 0f && num1058 < 0f) + { + npc.velocity.X = npc.velocity.X - num1064; + } + } + if (npc.velocity.Y < num1059) + { + npc.velocity.Y = npc.velocity.Y + num1064; + if (npc.velocity.Y < 0f && num1059 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1064; + } + } + else if (npc.velocity.Y > num1059) + { + npc.velocity.Y = npc.velocity.Y - num1064; + if (npc.velocity.Y > 0f && num1059 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1064; + } + } + } + else + { + npc.velocity *= 0.9f; //changed from 0.9 + } + npc.spriteDirection = npc.direction; + if (npc.ai[2] > 2f) + { + npc.ai[0] = -1f; + npc.ai[1] = 1f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 3f) + { + float num1065 = 7f; //changed from 4 + float num1066 = 0.075f; //changed from 0.05 + if (flag113) + { + num1066 = 0.09f; + num1065 = 8f; + } + 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); + Vector2 vector122 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num1067 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector122.X; + float num1068 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector122.Y; + float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); + npc.ai[1] += 1f; + bool flag104 = false; + if (npc.ai[1] % 35f == 34f) + { + flag104 = true; + } + if (flag104 && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector121, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); + if (Main.netMode != 1) + { + float num1070 = 6f; //changed from 8 + if (flag113) + { + num1070 += 2f; + } + float num1071 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector121.X + (float)Main.rand.Next(-80, 81); + float num1072 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector121.Y + (float)Main.rand.Next(-40, 41); + float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + num1073 = num1070 / num1073; + num1071 *= num1073; + num1072 *= num1073; + int num1074 = 20; //projectile damage + int num1075 = mod.ProjectileType("PlagueStingerGoliathV2"); //projectile type + if (Main.rand.Next(15) == 0) + { + num1074 = 25; + num1075 = mod.ProjectileType("HiveBombGoliath"); + } + 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; + } + } + if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + num1065 = 14.5f; //changed from 14 + num1066 = 0.105f; //changed from 0.1 + vector122 = vector121; + num1067 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector122.X; + num1068 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector122.Y; + num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); + num1069 = num1065 / num1069; + if (npc.velocity.X < num1067) + { + npc.velocity.X = npc.velocity.X + num1066; + if (npc.velocity.X < 0f && num1067 > 0f) + { + npc.velocity.X = npc.velocity.X + num1066; + } + } + else if (npc.velocity.X > num1067) + { + npc.velocity.X = npc.velocity.X - num1066; + if (npc.velocity.X > 0f && num1067 < 0f) + { + npc.velocity.X = npc.velocity.X - num1066; + } + } + if (npc.velocity.Y < num1068) + { + npc.velocity.Y = npc.velocity.Y + num1066; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1066; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num1066; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1066; + } + } + } + else if (num1069 > 100f) + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + num1069 = num1065 / num1069; + if (npc.velocity.X < num1067) + { + npc.velocity.X = npc.velocity.X + num1066; + if (npc.velocity.X < 0f && num1067 > 0f) + { + npc.velocity.X = npc.velocity.X + num1066 * 2f; + } + } + else if (npc.velocity.X > num1067) + { + npc.velocity.X = npc.velocity.X - num1066; + if (npc.velocity.X > 0f && num1067 < 0f) + { + npc.velocity.X = npc.velocity.X - num1066 * 2f; + } + } + if (npc.velocity.Y < num1068) + { + npc.velocity.Y = npc.velocity.Y + num1066; + if (npc.velocity.Y < 0f && num1068 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1066 * 2f; + } + } + else if (npc.velocity.Y > num1068) + { + npc.velocity.Y = npc.velocity.Y - num1066; + if (npc.velocity.Y > 0f && num1068 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1066 * 2f; + } + } + } + if (npc.ai[1] > 600f) + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + return; + } + } + } + + 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) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default(Color), 1f); + } + 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); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 100; + npc.height = 100; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default(Color), 3f); + 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, 46, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index b7920a5228..0b2e9f5b39 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -1,138 +1,138 @@ -using System; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Polterghast -{ - public class PhantomFuckYou : ModNPC - { - private bool start = true; - private int timer = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 30; - npc.height = 30; - npc.noGravity = true; - npc.noTileCollide = true; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 1500; - npc.dontTakeDamage = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(start); - writer.Write(timer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - start = reader.ReadBoolean(); - timer = reader.ReadInt32(); - } - - public override bool PreAI() - { - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - if (start) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default(Color), 2f); - } - npc.ai[1] = npc.ai[0]; - start = false; - } - if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= 9f; - npc.rotation = direction.ToRotation(); - timer++; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - timer++; - } - if (timer > 180) - { - if (Main.netMode != 1) - { - int damage = expertMode ? 58 : 70; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 0.05f, direction.Y * 0.05f, mod.ProjectileType("PhantomMine"), damage, 1f, npc.target); - } - timer = 0; - } - Player player = Main.player[npc.target]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 500; - npc.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 0.5f; //1f - return false; - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, npc.alpha); - } - - public override bool CheckActive() - { - return false; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.5f); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.velocity != Vector2.Zero) - { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); - for (int i = 1; i < npc.oldPos.Length; ++i) - { - Vector2 vector2_2 = npc.oldPos[i]; - Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; - color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); - color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); - color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); - color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), - npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); - } - } - return true; - } - } -} \ No newline at end of file +using System; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Polterghast +{ + public class PhantomFuckYou : ModNPC + { + private bool start = true; + private int timer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 30; + npc.height = 30; + npc.noGravity = true; + npc.noTileCollide = true; + npc.damage = 0; + npc.defense = 0; + npc.lifeMax = 1500; + npc.dontTakeDamage = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(start); + writer.Write(timer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + start = reader.ReadBoolean(); + timer = reader.ReadInt32(); + } + + public override bool PreAI() + { + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + if (start) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default(Color), 2f); + } + npc.ai[1] = npc.ai[0]; + start = false; + } + if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= 9f; + npc.rotation = direction.ToRotation(); + timer++; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + timer++; + } + if (timer > 180) + { + if (Main.netMode != 1) + { + int damage = expertMode ? 58 : 70; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 0.05f, direction.Y * 0.05f, mod.ProjectileType("PhantomMine"), damage, 1f, npc.target); + } + timer = 0; + } + Player player = Main.player[npc.target]; + double deg = (double)npc.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 500; + npc.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.ai[1] += 0.5f; //1f + return false; + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, npc.alpha); + } + + public override bool CheckActive() + { + return false; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.5f); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.velocity != Vector2.Zero) + { + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + for (int i = 1; i < npc.oldPos.Length; ++i) + { + Vector2 vector2_2 = npc.oldPos[i]; + Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; + color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); + color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); + color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); + color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), + npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); + } + } + return true; + } + } +} diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 41af940cfd..e4a03b1fd9 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -1,310 +1,310 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Polterghast -{ - public class PolterPhantom : ModNPC - { - private int despawnTimer = 600; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polterghast"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 210; - npc.width = 90; - npc.height = 120; - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 150000 : 130000; - if (CalamityWorld.death) - { - npc.lifeMax = 225000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; - } - 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.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit36; - npc.DeathSound = SoundID.NPCDeath39; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(despawnTimer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - despawnTimer = reader.ReadInt32(); - } - - public override void AI() - { - CalamityGlobalNPC.ghostBossClone = npc.whoAmI; - npc.alpha -= 5; - if (npc.alpha < 50) - { - npc.alpha = 50; - } - if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - 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; - } - bool speedBoost1 = false; - bool despawnBoost = false; - if (npc.timeLeft < 1500) - { - npc.timeLeft = 1500; - } - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - int[] array2 = new int[4]; - float num730 = 0f; - float num731 = 0f; - int num732 = 0; - int num; - for (int num733 = 0; num733 < 200; num733 = num + 1) - { - if (Main.npc[num733].active && Main.npc[num733].type == mod.NPCType("PolterghastHook")) - { - num730 += Main.npc[num733].Center.X; - num731 += Main.npc[num733].Center.Y; - array2[num732] = num733; - num732++; - if (num732 > 3) - break; - } - num = num733; - } - num730 /= (float)num732; - num731 /= (float)num732; - float num734 = 3f; - float num735 = 0.03f; - if (!Main.player[npc.target].ZoneDungeon) - { - despawnTimer--; - if (despawnTimer <= 0) - despawnBoost = true; - speedBoost1 = true; - num734 += 8f; - num735 = 0.15f; - } - else - { - despawnTimer = 600; - } - if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < 300f) - { - num734 = 18f; - num735 = 0.12f; - } - if (expertMode) - { - num734 += revenge ? 1.5f : 1f; - num734 *= revenge ? 1.25f : 1.1f; - num735 += revenge ? 0.015f : 0.01f; - num735 *= revenge ? 1.2f : 1.1f; - } - Vector2 vector91 = new Vector2(num730, num731); - float num736 = Main.player[npc.target].Center.X - vector91.X; - float num737 = Main.player[npc.target].Center.Y - vector91.Y; - if (despawnBoost) - { - num737 *= -1f; - num736 *= -1f; - num734 += 8f; - } - float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); - int num739 = 500; - if (speedBoost1) - { - num739 += 500; - } - if (expertMode) - { - num739 += 150; - } - if (num738 >= (float)num739) - { - num738 = (float)num739 / num738; - num736 *= num738; - num737 *= num738; - } - num730 += num736; - num731 += num737; - vector91 = new Vector2(vector.X, vector.Y); - num736 = num730 - vector91.X; - num737 = num731 - vector91.Y; - num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); - if (num738 < num734) - { - num736 = npc.velocity.X; - num737 = npc.velocity.Y; - } - else - { - num738 = num734 / num738; - num736 *= num738; - num737 *= num738; - } - if (npc.velocity.X < num736) - { - npc.velocity.X = npc.velocity.X + num735; - if (npc.velocity.X < 0f && num736 > 0f) - { - npc.velocity.X = npc.velocity.X + num735 * 2f; - } - } - else if (npc.velocity.X > num736) - { - npc.velocity.X = npc.velocity.X - num735; - if (npc.velocity.X > 0f && num736 < 0f) - { - npc.velocity.X = npc.velocity.X - num735 * 2f; - } - } - if (npc.velocity.Y < num737) - { - npc.velocity.Y = npc.velocity.Y + num735; - if (npc.velocity.Y < 0f && num737 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num735 * 2f; - } - } - else if (npc.velocity.Y > num737) - { - npc.velocity.Y = npc.velocity.Y - num735; - if (npc.velocity.Y > 0f && num737 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num735 * 2f; - } - } - Vector2 vector92 = new Vector2(vector.X, vector.Y); - float num740 = Main.player[npc.target].Center.X - vector92.X; - float num741 = Main.player[npc.target].Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; - if (speedBoost1) - { - npc.defense = 400; - npc.damage = 1200; - } - else - { - npc.damage = expertMode ? 336 : 210; - npc.defense = 0; - } - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 150, 255, npc.alpha); - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - 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 HitEffect(int hitDirection, double damage) - { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default(Color), 1f); - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 90; - npc.height = 90; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default(Color), 3f); - 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, 180, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Polterghast +{ + public class PolterPhantom : ModNPC + { + private int despawnTimer = 600; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 210; + npc.width = 90; + npc.height = 120; + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 150000 : 130000; + if (CalamityWorld.death) + { + npc.lifeMax = 225000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; + } + 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.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit36; + npc.DeathSound = SoundID.NPCDeath39; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(despawnTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + despawnTimer = reader.ReadInt32(); + } + + public override void AI() + { + CalamityGlobalNPC.ghostBossClone = npc.whoAmI; + npc.alpha -= 5; + if (npc.alpha < 50) + { + npc.alpha = 50; + } + if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + 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; + } + bool speedBoost1 = false; + bool despawnBoost = false; + if (npc.timeLeft < 1500) + { + npc.timeLeft = 1500; + } + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + int[] array2 = new int[4]; + float num730 = 0f; + float num731 = 0f; + int num732 = 0; + int num; + for (int num733 = 0; num733 < 200; num733 = num + 1) + { + if (Main.npc[num733].active && Main.npc[num733].type == mod.NPCType("PolterghastHook")) + { + num730 += Main.npc[num733].Center.X; + num731 += Main.npc[num733].Center.Y; + array2[num732] = num733; + num732++; + if (num732 > 3) + break; + } + num = num733; + } + num730 /= (float)num732; + num731 /= (float)num732; + float num734 = 3f; + float num735 = 0.03f; + if (!Main.player[npc.target].ZoneDungeon) + { + despawnTimer--; + if (despawnTimer <= 0) + despawnBoost = true; + speedBoost1 = true; + num734 += 8f; + num735 = 0.15f; + } + else + { + despawnTimer = 600; + } + if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < 300f) + { + num734 = 18f; + num735 = 0.12f; + } + if (expertMode) + { + num734 += revenge ? 1.5f : 1f; + num734 *= revenge ? 1.25f : 1.1f; + num735 += revenge ? 0.015f : 0.01f; + num735 *= revenge ? 1.2f : 1.1f; + } + Vector2 vector91 = new Vector2(num730, num731); + float num736 = Main.player[npc.target].Center.X - vector91.X; + float num737 = Main.player[npc.target].Center.Y - vector91.Y; + if (despawnBoost) + { + num737 *= -1f; + num736 *= -1f; + num734 += 8f; + } + float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + int num739 = 500; + if (speedBoost1) + { + num739 += 500; + } + if (expertMode) + { + num739 += 150; + } + if (num738 >= (float)num739) + { + num738 = (float)num739 / num738; + num736 *= num738; + num737 *= num738; + } + num730 += num736; + num731 += num737; + vector91 = new Vector2(vector.X, vector.Y); + num736 = num730 - vector91.X; + num737 = num731 - vector91.Y; + num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + if (num738 < num734) + { + num736 = npc.velocity.X; + num737 = npc.velocity.Y; + } + else + { + num738 = num734 / num738; + num736 *= num738; + num737 *= num738; + } + if (npc.velocity.X < num736) + { + npc.velocity.X = npc.velocity.X + num735; + if (npc.velocity.X < 0f && num736 > 0f) + { + npc.velocity.X = npc.velocity.X + num735 * 2f; + } + } + else if (npc.velocity.X > num736) + { + npc.velocity.X = npc.velocity.X - num735; + if (npc.velocity.X > 0f && num736 < 0f) + { + npc.velocity.X = npc.velocity.X - num735 * 2f; + } + } + if (npc.velocity.Y < num737) + { + npc.velocity.Y = npc.velocity.Y + num735; + if (npc.velocity.Y < 0f && num737 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num735 * 2f; + } + } + else if (npc.velocity.Y > num737) + { + npc.velocity.Y = npc.velocity.Y - num735; + if (npc.velocity.Y > 0f && num737 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num735 * 2f; + } + } + Vector2 vector92 = new Vector2(vector.X, vector.Y); + float num740 = Main.player[npc.target].Center.X - vector92.X; + float num741 = Main.player[npc.target].Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; + if (speedBoost1) + { + npc.defense = 400; + npc.damage = 1200; + } + else + { + npc.damage = expertMode ? 336 : 210; + npc.defense = 0; + } + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 150, 255, npc.alpha); + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + 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 HitEffect(int hitDirection, double damage) + { + Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default(Color), 1f); + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 90; + npc.height = 90; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default(Color), 3f); + 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, 180, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 239b85088b..6a92500883 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -1,812 +1,812 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Polterghast -{ - [AutoloadBossHead] - public class Polterghast : ModNPC - { - private int despawnTimer = 600; - private bool spawnGhost = false; - private bool boostDR = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polterghast"); - Main.npcFrameCount[npc.type] = 12; - } - - public override void SetDefaults() - { - npc.npcSlots = 50f; - npc.damage = 150; - npc.width = 90; - npc.height = 120; - npc.defense = 150; - npc.lifeMax = CalamityWorld.revenge ? 495000 : 412500; - if (CalamityWorld.death) - { - npc.lifeMax = 660000; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.value = Item.buyPrice(0, 60, 0, 0); - npc.boss = true; - 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.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"); - else - music = MusicID.Plantera; - npc.HitSound = SoundID.NPCHit7; - npc.DeathSound = SoundID.NPCDeath39; - bossBag = mod.ItemType("PolterghastBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(spawnGhost); - writer.Write(boostDR); - writer.Write(despawnTimer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - spawnGhost = reader.ReadBoolean(); - boostDR = reader.ReadBoolean(); - despawnTimer = reader.ReadInt32(); - } - - 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.5f, 1.25f, 1.25f); - CalamityGlobalNPC.ghostBoss = npc.whoAmI; - - bool cloneAlive = false; - if (CalamityGlobalNPC.ghostBossClone != -1) - { - cloneAlive = Main.npc[CalamityGlobalNPC.ghostBossClone].active; - } - - Vector2 vector = npc.Center; - bool speedBoost1 = false; - bool despawnBoost = false; - 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 - bool phase3 = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.5 : 0.33); //hooks die and begins charging with ghosts spinning around player - bool phase4 = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.33 : 0.2); //starts spitting ghost dudes - bool phase5 = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.1 : 0.05); //starts moving incredibly fast - npc.TargetClosest(true); - - if (Main.raining) - CalamityGlobalNPC.StopRain(); - if (npc.timeLeft < 1500) - npc.timeLeft = 1500; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) - npc.active = false; - - if (npc.localAI[0] == 0f && Main.netMode != 1) - { - npc.localAI[0] = 1f; - int num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - int[] array2 = new int[4]; - float num730 = 0f; - float num731 = 0f; - int num732 = 0; - int num; - for (int num733 = 0; num733 < 200; num733 = num + 1) - { - if (Main.npc[num733].active && Main.npc[num733].type == mod.NPCType("PolterghastHook")) - { - num730 += Main.npc[num733].Center.X; - num731 += Main.npc[num733].Center.Y; - array2[num732] = num733; - num732++; - if (num732 > 3) - break; - } - num = num733; - } - num730 /= (float)num732; - num731 /= (float)num732; - - float num734 = 2.5f; - float num735 = 0.025f; - if (!Main.player[npc.target].ZoneDungeon && !CalamityWorld.bossRushActive) - { - despawnTimer--; - if (despawnTimer <= 0) - despawnBoost = true; - speedBoost1 = true; - num734 += 2f; - num735 += 0.025f; - } - else - { - despawnTimer = 600; - } - - if (phase2) - { - num734 += 1.5f; - num735 += 0.01f; - } - - if (phase3) - { - if (cloneAlive) - { - boostDR = true; - if (npc.ai[2] >= 300f) - { - num734 += phase5 ? 14.5f : 8.5f; - num735 += phase5 ? 0.085f : 0.045f; - } - else - { - if (phase5) - { - num734 += 1.5f; - num735 += 0.015f; - } - else if (phase4) - { - num734 += 1f; - num735 += 0.01f; - } - else - { - num734 += 0.5f; - num735 += 0.005f; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 600f) - { - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else - { - boostDR = false; - num734 += phase5 ? 18.5f : 14.5f; - num735 += phase5 ? 0.115f : 0.085f; - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 600f) - { - npc.localAI[2] = 0f; - if (Main.netMode != 1) - { - NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterPhantom"), 0, 0f, 0f, 0f, 0f, 255); - } - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - 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(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 180, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } - - if (expertMode) - { - num734 += revenge ? 1.5f : 1f; - num734 *= revenge ? 1.25f : 1.1f; - num735 += revenge ? 0.015f : 0.01f; - num735 *= revenge ? 1.2f : 1.1f; - } - - Vector2 vector91 = new Vector2(num730, num731); - float num736 = Main.player[npc.target].Center.X - vector91.X; - float num737 = Main.player[npc.target].Center.Y - vector91.Y; - if (despawnBoost) - { - num737 *= -1f; - num736 *= -1f; - num734 += 10f; - } - float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); - - int num739 = 500; - if (speedBoost1) - num739 += 250; - if (expertMode) - num739 += 150; - - if (num738 >= (float)num739) - { - num738 = (float)num739 / num738; - num736 *= num738; - num737 *= num738; - } - num730 += num736; - num731 += num737; - vector91 = new Vector2(vector.X, vector.Y); - num736 = num730 - vector91.X; - num737 = num731 - vector91.Y; - num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); - if (num738 < num734) - { - num736 = npc.velocity.X; - num737 = npc.velocity.Y; - } - else - { - num738 = num734 / num738; - num736 *= num738; - num737 *= num738; - } - - Vector2 vector92 = new Vector2(vector.X, vector.Y); - float num740 = Main.player[npc.target].Center.X - vector92.X; - float num741 = Main.player[npc.target].Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; - - if (npc.velocity.X < num736) - { - npc.velocity.X = npc.velocity.X + num735; - if (npc.velocity.X < 0f && num736 > 0f) - npc.velocity.X = npc.velocity.X + num735 * 2f; - } - else if (npc.velocity.X > num736) - { - npc.velocity.X = npc.velocity.X - num735; - if (npc.velocity.X > 0f && num736 < 0f) - npc.velocity.X = npc.velocity.X - num735 * 2f; - } - if (npc.velocity.Y < num737) - { - npc.velocity.Y = npc.velocity.Y + num735; - if (npc.velocity.Y < 0f && num737 > 0f) - npc.velocity.Y = npc.velocity.Y + num735 * 2f; - } - else if (npc.velocity.Y > num737) - { - npc.velocity.Y = npc.velocity.Y - num735; - if (npc.velocity.Y > 0f && num737 < 0f) - npc.velocity.Y = npc.velocity.Y - num735 * 2f; - } - - if (!phase2 && !phase3) - { - if (speedBoost1) - { - npc.defense = 300; - npc.damage = (int)(200f * Main.damageMultiplier); - } - else - { - npc.damage = expertMode ? 240 : 150; - npc.defense = 150; - } - if (Main.netMode != 1) - { - npc.localAI[1] += (expertMode ? 2f : 1.5f); - if (speedBoost1 || CalamityWorld.bossRushActive) - npc.localAI[1] += 6f; - - if (npc.localAI[1] >= 60f) - { - npc.localAI[1] = 0f; - bool flag47 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (npc.localAI[3] > 0f) - { - flag47 = true; - npc.localAI[3] = 0f; - } - if (flag47) - { - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = 6f; - if (expertMode) - { - num742 = (CalamityWorld.bossRushActive ? 13f : 7f); - } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num742 *= 2f; - } - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - int num746 = expertMode ? 46 : 55; - int num747 = mod.ProjectileType("PhantomShot"); - int maxValue2 = 2; - if (expertMode) - { - maxValue2 = 4; - } - if ((double)npc.life < (double)npc.lifeMax * 0.8 && Main.rand.Next(maxValue2) == 0) - { - num746 = expertMode ? 51 : 60; - npc.localAI[1] = -30f; - num747 = mod.ProjectileType("PhantomBlast"); - } - 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 = (num747 == mod.ProjectileType("PhantomBlast") ? 300 : 1200); - } - else - { - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = 11f; - if (expertMode) - { - num742 = (CalamityWorld.bossRushActive ? 18f : 12f); - } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num742 *= 2f; - } - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - int num746 = expertMode ? 51 : 60; - int num747 = mod.ProjectileType("PhantomBlast"); - 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 = 180; - } - } - } - } - else if (!phase3) - { - if (npc.ai[0] == 0f) - { - npc.ai[0] += 1f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt5"), 1f); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - 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(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default(Color), 3f); - 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, 180, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - npc.GivenName = "Necroghast"; - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.defense = 200; - npc.damage = (int)(300f * Main.damageMultiplier); - } - else - { - npc.damage = expertMode ? 288 : 180; - npc.defense = 100; - } - if (Main.netMode != 1) - { - npc.localAI[1] += (expertMode ? 2f : 1.5f); - if (speedBoost1 || CalamityWorld.bossRushActive) - npc.localAI[1] += 8f; - - if (npc.localAI[1] > 50f) - { - npc.localAI[1] = 0f; - bool flag47 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (npc.localAI[3] > 0f) - { - flag47 = true; - npc.localAI[3] = 0f; - } - if (flag47) - { - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = 6f; - if (expertMode) - { - num742 = (CalamityWorld.bossRushActive ? 13f : 7f); - } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num742 *= 2f; - } - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - int num746 = expertMode ? 49 : 60; - int num747 = mod.ProjectileType("PhantomShot2"); - int maxValue2 = 2; - if (expertMode) - { - maxValue2 = 4; - } - if (Main.rand.Next(maxValue2) == 0) - { - num746 = expertMode ? 54 : 65; - npc.localAI[1] = -30f; - num747 = mod.ProjectileType("PhantomBlast2"); - } - 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 = (num747 == mod.ProjectileType("PhantomBlast2") ? 300 : 1200); - } - else - { - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = 11f; - if (expertMode) - { - num742 = (CalamityWorld.bossRushActive ? 18f : 12f); - } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num742 *= 2f; - } - float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - int num746 = expertMode ? 54 : 65; - int num747 = mod.ProjectileType("PhantomBlast2"); - 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 = 240; - } - } - } - } - else - { - npc.HitSound = SoundID.NPCHit36; - if (!spawnGhost) - { - spawnGhost = true; - if (Main.netMode != 1) - { - NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterPhantom"), 0, 0f, 0f, 0f, 0f, 255); - for (int I = 0; I < 3; I++) - { - int Phantom = NPC.NewNPC((int)(Main.player[npc.target].Center.X + (Math.Sin(I * 120) * 500)), - (int)(Main.player[npc.target].Center.Y + (Math.Cos(I * 120) * 500)), mod.NPCType("PhantomFuckYou"), 0, 0, 0, 0, -1); - NPC Eye = Main.npc[Phantom]; - Eye.ai[0] = I * 120; - Eye.ai[3] = I * 120; - } - } - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt5"), 1f); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - 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(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default(Color), 3f); - 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, 180, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - npc.GivenName = "Necroplasm"; - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.defense = 200; - npc.damage = (int)(400f * Main.damageMultiplier); - } - else - { - npc.damage = expertMode ? 336 : 210; - npc.defense = 0; - } - if (phase4) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 150f) - { - float num757 = 8f; - Vector2 vector94 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num758 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector94.X + (float)Main.rand.Next(-10, 11); - float num759 = Math.Abs(num758 * 0.2f); - float num760 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector94.Y + (float)Main.rand.Next(-10, 11); - if (num760 > 0f) - { - num759 = 0f; - } - num760 -= num759; - float num761 = (float)Math.Sqrt((double)(num758 * num758 + num760 * num760)); - num761 = num757 / num761; - num758 *= num761; - num760 *= num761; - if (NPC.CountNPCS(mod.NPCType("PhantomSpiritL")) < (revenge ? 3 : 2) && Main.netMode != 1) - { - int num762 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PhantomSpiritL"), 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num762].velocity.X = num758; - Main.npc[num762].velocity.Y = num760; - Main.npc[num762].netUpdate = true; - } - npc.localAI[1] = 0f; - } - } - } - } - - 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("PolterghastTrophy")); - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RuinousSoul"), Main.rand.Next(5, 9)); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BansheeHook")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DaemonsFlame")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EtherealSubjugator")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FatesReveal")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GhastlyVisage")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GhoulishGouger")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TerrorBlade")); - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SuperHealingPotion; - } - - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - double newDamage = (damage + (int)((double)defense * 0.25)); - float protection = 0.1f + //.1 - ((double)npc.life <= (double)npc.lifeMax * 0.75 ? 0.05f : 0f) + //.15 - ((double)npc.life <= (double)npc.lifeMax * (CalamityWorld.revenge ? 0.5 : 0.33) ? 0.05f : 0f) + //.2 - (boostDR ? 0.6f : 0f); //.8 - if (npc.ichor) - { - protection *= 0.88f; - } - else if (npc.onFire2) - { - protection *= 0.9f; - } - if (newDamage < 1.0) - { - newDamage = 1.0; - } - if (newDamage >= 1.0) - { - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - if (newDamage < 1.0) - { - newDamage = 1.0; - } - } - damage = newDamage; - return true; - } - - public override void FindFrame(int frameHeight) - { - bool phase2 = (double)npc.life > (double)npc.lifeMax * (CalamityWorld.revenge ? 0.5 : 0.33); - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if ((double)npc.life > (double)npc.lifeMax * 0.75) - { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - else if (phase2) - { - if (npc.frame.Y < frameHeight * 4) - { - npc.frame.Y = frameHeight * 4; - } - if (npc.frame.Y > frameHeight * 7) - { - npc.frame.Y = frameHeight * 4; - } - } - else - { - if (npc.frame.Y < frameHeight * 8) - { - npc.frame.Y = frameHeight * 8; - } - if (npc.frame.Y > frameHeight * 11) - { - npc.frame.Y = frameHeight * 8; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - player.AddBuff(mod.BuffType("Horror"), 300, true); - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - 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 HitEffect(int hitDirection, double damage) - { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default(Color), 1f); - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 90; - npc.height = 90; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default(Color), 3f); - 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, 180, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Polterghast +{ + [AutoloadBossHead] + public class Polterghast : ModNPC + { + private int despawnTimer = 600; + private bool spawnGhost = false; + private bool boostDR = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast"); + Main.npcFrameCount[npc.type] = 12; + } + + public override void SetDefaults() + { + npc.npcSlots = 50f; + npc.damage = 150; + npc.width = 90; + npc.height = 120; + npc.defense = 150; + npc.lifeMax = CalamityWorld.revenge ? 495000 : 412500; + if (CalamityWorld.death) + { + npc.lifeMax = 660000; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.value = Item.buyPrice(0, 60, 0, 0); + npc.boss = true; + 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.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"); + else + music = MusicID.Plantera; + npc.HitSound = SoundID.NPCHit7; + npc.DeathSound = SoundID.NPCDeath39; + bossBag = mod.ItemType("PolterghastBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(spawnGhost); + writer.Write(boostDR); + writer.Write(despawnTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + spawnGhost = reader.ReadBoolean(); + boostDR = reader.ReadBoolean(); + despawnTimer = reader.ReadInt32(); + } + + 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.5f, 1.25f, 1.25f); + CalamityGlobalNPC.ghostBoss = npc.whoAmI; + + bool cloneAlive = false; + if (CalamityGlobalNPC.ghostBossClone != -1) + { + cloneAlive = Main.npc[CalamityGlobalNPC.ghostBossClone].active; + } + + Vector2 vector = npc.Center; + bool speedBoost1 = false; + bool despawnBoost = false; + 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 + bool phase3 = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.5 : 0.33); //hooks die and begins charging with ghosts spinning around player + bool phase4 = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.33 : 0.2); //starts spitting ghost dudes + bool phase5 = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.1 : 0.05); //starts moving incredibly fast + npc.TargetClosest(true); + + if (Main.raining) + CalamityGlobalNPC.StopRain(); + if (npc.timeLeft < 1500) + npc.timeLeft = 1500; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) + npc.active = false; + + if (npc.localAI[0] == 0f && Main.netMode != 1) + { + npc.localAI[0] = 1f; + int num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterghastHook"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + int[] array2 = new int[4]; + float num730 = 0f; + float num731 = 0f; + int num732 = 0; + int num; + for (int num733 = 0; num733 < 200; num733 = num + 1) + { + if (Main.npc[num733].active && Main.npc[num733].type == mod.NPCType("PolterghastHook")) + { + num730 += Main.npc[num733].Center.X; + num731 += Main.npc[num733].Center.Y; + array2[num732] = num733; + num732++; + if (num732 > 3) + break; + } + num = num733; + } + num730 /= (float)num732; + num731 /= (float)num732; + + float num734 = 2.5f; + float num735 = 0.025f; + if (!Main.player[npc.target].ZoneDungeon && !CalamityWorld.bossRushActive) + { + despawnTimer--; + if (despawnTimer <= 0) + despawnBoost = true; + speedBoost1 = true; + num734 += 2f; + num735 += 0.025f; + } + else + { + despawnTimer = 600; + } + + if (phase2) + { + num734 += 1.5f; + num735 += 0.01f; + } + + if (phase3) + { + if (cloneAlive) + { + boostDR = true; + if (npc.ai[2] >= 300f) + { + num734 += phase5 ? 14.5f : 8.5f; + num735 += phase5 ? 0.085f : 0.045f; + } + else + { + if (phase5) + { + num734 += 1.5f; + num735 += 0.015f; + } + else if (phase4) + { + num734 += 1f; + num735 += 0.01f; + } + else + { + num734 += 0.5f; + num735 += 0.005f; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 600f) + { + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else + { + boostDR = false; + num734 += phase5 ? 18.5f : 14.5f; + num735 += phase5 ? 0.115f : 0.085f; + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 600f) + { + npc.localAI[2] = 0f; + if (Main.netMode != 1) + { + NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterPhantom"), 0, 0f, 0f, 0f, 0f, 255); + } + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + 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(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 180, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } + + if (expertMode) + { + num734 += revenge ? 1.5f : 1f; + num734 *= revenge ? 1.25f : 1.1f; + num735 += revenge ? 0.015f : 0.01f; + num735 *= revenge ? 1.2f : 1.1f; + } + + Vector2 vector91 = new Vector2(num730, num731); + float num736 = Main.player[npc.target].Center.X - vector91.X; + float num737 = Main.player[npc.target].Center.Y - vector91.Y; + if (despawnBoost) + { + num737 *= -1f; + num736 *= -1f; + num734 += 10f; + } + float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + + int num739 = 500; + if (speedBoost1) + num739 += 250; + if (expertMode) + num739 += 150; + + if (num738 >= (float)num739) + { + num738 = (float)num739 / num738; + num736 *= num738; + num737 *= num738; + } + num730 += num736; + num731 += num737; + vector91 = new Vector2(vector.X, vector.Y); + num736 = num730 - vector91.X; + num737 = num731 - vector91.Y; + num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + if (num738 < num734) + { + num736 = npc.velocity.X; + num737 = npc.velocity.Y; + } + else + { + num738 = num734 / num738; + num736 *= num738; + num737 *= num738; + } + + Vector2 vector92 = new Vector2(vector.X, vector.Y); + float num740 = Main.player[npc.target].Center.X - vector92.X; + float num741 = Main.player[npc.target].Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; + + if (npc.velocity.X < num736) + { + npc.velocity.X = npc.velocity.X + num735; + if (npc.velocity.X < 0f && num736 > 0f) + npc.velocity.X = npc.velocity.X + num735 * 2f; + } + else if (npc.velocity.X > num736) + { + npc.velocity.X = npc.velocity.X - num735; + if (npc.velocity.X > 0f && num736 < 0f) + npc.velocity.X = npc.velocity.X - num735 * 2f; + } + if (npc.velocity.Y < num737) + { + npc.velocity.Y = npc.velocity.Y + num735; + if (npc.velocity.Y < 0f && num737 > 0f) + npc.velocity.Y = npc.velocity.Y + num735 * 2f; + } + else if (npc.velocity.Y > num737) + { + npc.velocity.Y = npc.velocity.Y - num735; + if (npc.velocity.Y > 0f && num737 < 0f) + npc.velocity.Y = npc.velocity.Y - num735 * 2f; + } + + if (!phase2 && !phase3) + { + if (speedBoost1) + { + npc.defense = 300; + npc.damage = (int)(200f * Main.damageMultiplier); + } + else + { + npc.damage = expertMode ? 240 : 150; + npc.defense = 150; + } + if (Main.netMode != 1) + { + npc.localAI[1] += (expertMode ? 2f : 1.5f); + if (speedBoost1 || CalamityWorld.bossRushActive) + npc.localAI[1] += 6f; + + if (npc.localAI[1] >= 60f) + { + npc.localAI[1] = 0f; + bool flag47 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (npc.localAI[3] > 0f) + { + flag47 = true; + npc.localAI[3] = 0f; + } + if (flag47) + { + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = 6f; + if (expertMode) + { + num742 = (CalamityWorld.bossRushActive ? 13f : 7f); + } + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num742 *= 2f; + } + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + int num746 = expertMode ? 46 : 55; + int num747 = mod.ProjectileType("PhantomShot"); + int maxValue2 = 2; + if (expertMode) + { + maxValue2 = 4; + } + if ((double)npc.life < (double)npc.lifeMax * 0.8 && Main.rand.Next(maxValue2) == 0) + { + num746 = expertMode ? 51 : 60; + npc.localAI[1] = -30f; + num747 = mod.ProjectileType("PhantomBlast"); + } + 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 = (num747 == mod.ProjectileType("PhantomBlast") ? 300 : 1200); + } + else + { + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = 11f; + if (expertMode) + { + num742 = (CalamityWorld.bossRushActive ? 18f : 12f); + } + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num742 *= 2f; + } + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + int num746 = expertMode ? 51 : 60; + int num747 = mod.ProjectileType("PhantomBlast"); + 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 = 180; + } + } + } + } + else if (!phase3) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] += 1f; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt5"), 1f); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + 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(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default(Color), 3f); + 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, 180, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + npc.GivenName = "Necroghast"; + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npc.defense = 200; + npc.damage = (int)(300f * Main.damageMultiplier); + } + else + { + npc.damage = expertMode ? 288 : 180; + npc.defense = 100; + } + if (Main.netMode != 1) + { + npc.localAI[1] += (expertMode ? 2f : 1.5f); + if (speedBoost1 || CalamityWorld.bossRushActive) + npc.localAI[1] += 8f; + + if (npc.localAI[1] > 50f) + { + npc.localAI[1] = 0f; + bool flag47 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (npc.localAI[3] > 0f) + { + flag47 = true; + npc.localAI[3] = 0f; + } + if (flag47) + { + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = 6f; + if (expertMode) + { + num742 = (CalamityWorld.bossRushActive ? 13f : 7f); + } + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num742 *= 2f; + } + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + int num746 = expertMode ? 49 : 60; + int num747 = mod.ProjectileType("PhantomShot2"); + int maxValue2 = 2; + if (expertMode) + { + maxValue2 = 4; + } + if (Main.rand.Next(maxValue2) == 0) + { + num746 = expertMode ? 54 : 65; + npc.localAI[1] = -30f; + num747 = mod.ProjectileType("PhantomBlast2"); + } + 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 = (num747 == mod.ProjectileType("PhantomBlast2") ? 300 : 1200); + } + else + { + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = 11f; + if (expertMode) + { + num742 = (CalamityWorld.bossRushActive ? 18f : 12f); + } + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num742 *= 2f; + } + float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + int num746 = expertMode ? 54 : 65; + int num747 = mod.ProjectileType("PhantomBlast2"); + 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 = 240; + } + } + } + } + else + { + npc.HitSound = SoundID.NPCHit36; + if (!spawnGhost) + { + spawnGhost = true; + if (Main.netMode != 1) + { + NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PolterPhantom"), 0, 0f, 0f, 0f, 0f, 255); + for (int I = 0; I < 3; I++) + { + int Phantom = NPC.NewNPC((int)(Main.player[npc.target].Center.X + (Math.Sin(I * 120) * 500)), + (int)(Main.player[npc.target].Center.Y + (Math.Cos(I * 120) * 500)), mod.NPCType("PhantomFuckYou"), 0, 0, 0, 0, -1); + NPC Eye = Main.npc[Phantom]; + Eye.ai[0] = I * 120; + Eye.ai[3] = I * 120; + } + } + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt5"), 1f); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + 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(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default(Color), 3f); + 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, 180, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + npc.GivenName = "Necroplasm"; + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npc.defense = 200; + npc.damage = (int)(400f * Main.damageMultiplier); + } + else + { + npc.damage = expertMode ? 336 : 210; + npc.defense = 0; + } + if (phase4) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 150f) + { + float num757 = 8f; + Vector2 vector94 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num758 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector94.X + (float)Main.rand.Next(-10, 11); + float num759 = Math.Abs(num758 * 0.2f); + float num760 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector94.Y + (float)Main.rand.Next(-10, 11); + if (num760 > 0f) + { + num759 = 0f; + } + num760 -= num759; + float num761 = (float)Math.Sqrt((double)(num758 * num758 + num760 * num760)); + num761 = num757 / num761; + num758 *= num761; + num760 *= num761; + if (NPC.CountNPCS(mod.NPCType("PhantomSpiritL")) < (revenge ? 3 : 2) && Main.netMode != 1) + { + int num762 = NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("PhantomSpiritL"), 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num762].velocity.X = num758; + Main.npc[num762].velocity.Y = num760; + Main.npc[num762].netUpdate = true; + } + npc.localAI[1] = 0f; + } + } + } + } + + 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("PolterghastTrophy")); + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RuinousSoul"), Main.rand.Next(5, 9)); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BansheeHook")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DaemonsFlame")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EtherealSubjugator")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FatesReveal")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GhastlyVisage")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GhoulishGouger")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TerrorBlade")); + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SuperHealingPotion; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + double newDamage = (damage + (int)((double)defense * 0.25)); + float protection = 0.1f + //.1 + ((double)npc.life <= (double)npc.lifeMax * 0.75 ? 0.05f : 0f) + //.15 + ((double)npc.life <= (double)npc.lifeMax * (CalamityWorld.revenge ? 0.5 : 0.33) ? 0.05f : 0f) + //.2 + (boostDR ? 0.6f : 0f); //.8 + if (npc.ichor) + { + protection *= 0.88f; + } + else if (npc.onFire2) + { + protection *= 0.9f; + } + if (newDamage < 1.0) + { + newDamage = 1.0; + } + if (newDamage >= 1.0) + { + newDamage = (double)((int)((double)(1f - protection) * newDamage)); + if (newDamage < 1.0) + { + newDamage = 1.0; + } + } + damage = newDamage; + return true; + } + + public override void FindFrame(int frameHeight) + { + bool phase2 = (double)npc.life > (double)npc.lifeMax * (CalamityWorld.revenge ? 0.5 : 0.33); + npc.frameCounter += 1.0; + if (npc.frameCounter > 6.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if ((double)npc.life > (double)npc.lifeMax * 0.75) + { + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + else if (phase2) + { + if (npc.frame.Y < frameHeight * 4) + { + npc.frame.Y = frameHeight * 4; + } + if (npc.frame.Y > frameHeight * 7) + { + npc.frame.Y = frameHeight * 4; + } + } + else + { + if (npc.frame.Y < frameHeight * 8) + { + npc.frame.Y = frameHeight * 8; + } + if (npc.frame.Y > frameHeight * 11) + { + npc.frame.Y = frameHeight * 8; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + player.AddBuff(mod.BuffType("Horror"), 300, true); + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + 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 HitEffect(int hitDirection, double damage) + { + Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default(Color), 1f); + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 90; + npc.height = 90; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default(Color), 3f); + 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, 180, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index 444e14f419..0c45cc42b7 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -1,484 +1,484 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Polterghast -{ - public class PolterghastHook : ModNPC - { - private int despawnTimer = 300; - private bool phase2 = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polterghast Hook"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 120; - npc.width = 40; //324 - npc.height = 40; //216 - npc.defense = 50; - npc.lifeMax = CalamityWorld.revenge ? 60000 : 50000; - if (CalamityWorld.death) - { - npc.lifeMax = 100000; - } - npc.dontTakeDamage = true; - npc.noGravity = true; - npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit34; - npc.DeathSound = SoundID.NPCDeath39; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(phase2); - writer.Write(despawnTimer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - phase2 = reader.ReadBoolean(); - despawnTimer = reader.ReadInt32(); - } - - 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.3f, 1f, 1f); - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - bool speedBoost1 = false; - bool despawnBoost = false; - if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (CalamityGlobalNPC.ghostBoss != -1 && !Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].ZoneDungeon && !CalamityWorld.bossRushActive) - { - despawnTimer--; - if (despawnTimer <= 0) { despawnBoost = true; } - npc.localAI[0] -= 6f; - speedBoost1 = true; - } - else { despawnTimer = 300; } - if ((double)Main.npc[CalamityGlobalNPC.ghostBoss].life <= (double)Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax * 0.75) - { - if (!phase2) - { - npc.damage = 0; - phase2 = true; - } - npc.TargetClosest(true); - if (Main.netMode == 1) - { - if (npc.ai[0] == 0f) - { - npc.ai[0] = (float)((int)(npc.Center.X / 16f)); - } - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)((int)(npc.Center.X / 16f)); - } - } - if (Main.netMode != 1) - { - if (npc.ai[0] == 0f || npc.ai[1] == 0f) - { - npc.localAI[0] = 0f; - } - npc.localAI[0] -= 5f; - if (speedBoost1) - { - npc.localAI[0] -= 10f; - } - if (!despawnBoost && npc.localAI[0] <= 0f && npc.ai[0] != 0f) - { - int num; - for (int num763 = 0; num763 < 200; num763 = num + 1) - { - if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) - { - npc.localAI[0] = (float)Main.rand.Next(60, 300); - } - num = num763; - } - } - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(300, 600); - bool flag50 = false; - int num764 = 0; - while (!flag50 && num764 <= 1000) - { - num764++; - int num765 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X / 16f); - int num766 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y / 16f); - if (npc.ai[0] == 0f) - { - num765 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X + Main.npc[CalamityGlobalNPC.ghostBoss].Center.X) / 32f); - num766 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y + Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y) / 32f); - } - if (despawnBoost) - { - num765 = (int)Main.npc[CalamityGlobalNPC.ghostBoss].position.X / 16; - num766 = (int)(Main.npc[CalamityGlobalNPC.ghostBoss].position.Y + 400f) / 16; - } - int num767 = 20; - num767 += (int)(100f * ((float)num764 / 1000f)); - int num768 = num765 + Main.rand.Next(-num767, num767 + 1); - int num769 = num766 + Main.rand.Next(-num767, num767 + 1); - try - { - if (WorldGen.SolidTile(num768, num769) || (Main.tile[num768, num769].wall > 0 && (num764 > 500 || Main.npc[CalamityGlobalNPC.ghostBoss].life < Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax / 2))) - { - flag50 = true; - npc.ai[0] = (float)num768; - npc.ai[1] = (float)num769; - npc.netUpdate = true; - } - } - catch - { - } - } - } - } - if (npc.ai[0] > 0f && npc.ai[1] > 0f) - { - float num772 = 8f; - if (expertMode) - { - num772 += 1f; - } - if (speedBoost1) - { - num772 *= 2f; - } - if (despawnBoost) - { - num772 *= 2f; - } - Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); - float num773 = npc.ai[0] * 16f - 8f - vector95.X; - float num774 = npc.ai[1] * 16f - 8f - vector95.Y; - float num775 = (float)Math.Sqrt((double)(num773 * num773 + num774 * num774)); - if (num775 < 12f + num772) - { - npc.velocity.X = num773; - npc.velocity.Y = num774; - } - else - { - num775 = num772 / num775; - npc.velocity.X = num773 * num775; - npc.velocity.Y = num774 * num775; - } - } - Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); - float num818 = Main.player[npc.target].Center.X - vector102.X; - float num819 = Main.player[npc.target].Center.Y - vector102.Y; - float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); - float num821 = 10f; - num820 = num821 / num820; - num818 *= num820; - num819 *= num820; - npc.rotation = (float)Math.Atan2((double)num819, (double)num818) + 1.57f; - Vector2 vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; - float num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; - float num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); - num149 = 4f / num149; - num147 *= num149; - num148 *= num149; - vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; - num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; - num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); - if (num149 > 1200f) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[2] += 1f; - if (npc.ai[3] == 0f) - { - if (npc.ai[2] > 120f) - { - npc.ai[2] = 0f; - npc.ai[3] = 1f; - npc.netUpdate = true; - } - } - else - { - if (npc.ai[2] > 40f) - { - npc.ai[3] = 0f; - } - if (Main.netMode != 1 && npc.ai[2] == 20f) - { - float num151 = 5f; - int num152 = 60; - int num153 = mod.ProjectileType("PhantomHookShot"); - num149 = num151 / num149; - num147 *= num149; - num148 *= num149; - int num154 = Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); - } - } - return; - } - if (Main.netMode == 1) - { - if (npc.ai[0] == 0f) - { - npc.ai[0] = (float)((int)(npc.Center.X / 16f)); - } - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)((int)(npc.Center.X / 16f)); - } - } - if (Main.netMode != 1) - { - if (npc.ai[0] == 0f || npc.ai[1] == 0f) - { - npc.localAI[0] = 0f; - } - npc.localAI[0] -= 5f; - if (speedBoost1) - { - npc.localAI[0] -= 10f; - } - if (!despawnBoost && npc.localAI[0] <= 0f && npc.ai[0] != 0f) - { - int num; - for (int num763 = 0; num763 < 200; num763 = num + 1) - { - if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) - { - npc.localAI[0] = (float)Main.rand.Next(60, 300); - } - num = num763; - } - } - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = (float)Main.rand.Next(300, 600); - bool flag50 = false; - int num764 = 0; - while (!flag50 && num764 <= 1000) - { - num764++; - int num765 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X / 16f); - int num766 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y / 16f); - if (npc.ai[0] == 0f) - { - num765 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X + Main.npc[CalamityGlobalNPC.ghostBoss].Center.X) / 32f); - num766 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y + Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y) / 32f); - } - if (despawnBoost) - { - num765 = (int)Main.npc[CalamityGlobalNPC.ghostBoss].position.X / 16; - num766 = (int)(Main.npc[CalamityGlobalNPC.ghostBoss].position.Y + 400f) / 16; - } - int num767 = 20; - num767 += (int)(100f * ((float)num764 / 1000f)); - int num768 = num765 + Main.rand.Next(-num767, num767 + 1); - int num769 = num766 + Main.rand.Next(-num767, num767 + 1); - try - { - if (WorldGen.SolidTile(num768, num769) || (Main.tile[num768, num769].wall > 0 && (num764 > 500 || Main.npc[CalamityGlobalNPC.ghostBoss].life < Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax / 2))) - { - flag50 = true; - npc.ai[0] = (float)num768; - npc.ai[1] = (float)num769; - npc.netUpdate = true; - } - } - catch - { - } - } - } - } - if (npc.ai[0] > 0f && npc.ai[1] > 0f) - { - float num772 = 11f; - if (expertMode) - { - num772 += 1f; - } - if (speedBoost1) - { - num772 *= 2f; - } - if (despawnBoost) - { - num772 *= 2f; - } - Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); - float num773 = npc.ai[0] * 16f - 8f - vector95.X; - float num774 = npc.ai[1] * 16f - 8f - vector95.Y; - float num775 = (float)Math.Sqrt((double)(num773 * num773 + num774 * num774)); - if (num775 < 12f + num772) - { - npc.velocity.X = num773; - npc.velocity.Y = num774; - } - else - { - num775 = num772 / num775; - npc.velocity.X = num773 * num775; - npc.velocity.Y = num774 * num775; - } - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num776 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - vector96.X; - float num777 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - vector96.Y; - npc.rotation = (float)Math.Atan2((double)num777, (double)num776) - 1.57f; - } - } - - public override void FindFrame(int frameHeight) - { - if (phase2) - { - if (npc.ai[3] == 0f) - { - if (npc.frame.Y < 1) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - } - } - else if (npc.frame.Y > 0) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y - frameHeight; - } - } - return; - } - if (npc.velocity.X == 0f && npc.velocity.Y == 0f) - { - if (npc.frame.Y < 1) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - } - } - else if (npc.frame.Y > 0) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y - frameHeight; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (Main.npc[CalamityGlobalNPC.ghostBoss].active && !phase2) - { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; - float bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; - float rotation2 = (float)Math.Atan2((double)bossCenterY, (double)bossCenterX) - 1.57f; - bool draw = true; - while (draw) - { - int chainWidth = 20; //16 24 - int chainHeight = 52; //32 16 - float num10 = (float)Math.Sqrt((double)(bossCenterX * bossCenterX + bossCenterY * bossCenterY)); - if (num10 < (float)chainHeight) - { - chainWidth = (int)num10 - chainHeight + chainWidth; - draw = false; - } - num10 = (float)chainWidth / num10; - bossCenterX *= num10; - bossCenterY *= num10; - center.X += bossCenterX; - center.Y += bossCenterY; - bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; - bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; - Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Polterghast/PolterghastChain"), 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/Polterghast/PolterghastChain").Width, chainWidth)), color2, rotation2, - new Vector2((float)mod.GetTexture("NPCs/Polterghast/PolterghastChain").Width * 0.5f, (float)mod.GetTexture("NPCs/Polterghast/PolterghastChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); - } - } - return true; - } - - public override bool CheckActive() - { - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - player.AddBuff(mod.BuffType("Horror"), 180, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Polterghast +{ + public class PolterghastHook : ModNPC + { + private int despawnTimer = 300; + private bool phase2 = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast Hook"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 120; + npc.width = 40; //324 + npc.height = 40; //216 + npc.defense = 50; + npc.lifeMax = CalamityWorld.revenge ? 60000 : 50000; + if (CalamityWorld.death) + { + npc.lifeMax = 100000; + } + npc.dontTakeDamage = true; + npc.noGravity = true; + npc.noTileCollide = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.HitSound = SoundID.NPCHit34; + npc.DeathSound = SoundID.NPCDeath39; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(phase2); + writer.Write(despawnTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + phase2 = reader.ReadBoolean(); + despawnTimer = reader.ReadInt32(); + } + + 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.3f, 1f, 1f); + bool expertMode = Main.expertMode; + bool revenge = CalamityWorld.revenge; + bool speedBoost1 = false; + bool despawnBoost = false; + if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (CalamityGlobalNPC.ghostBoss != -1 && !Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].ZoneDungeon && !CalamityWorld.bossRushActive) + { + despawnTimer--; + if (despawnTimer <= 0) { despawnBoost = true; } + npc.localAI[0] -= 6f; + speedBoost1 = true; + } + else { despawnTimer = 300; } + if ((double)Main.npc[CalamityGlobalNPC.ghostBoss].life <= (double)Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax * 0.75) + { + if (!phase2) + { + npc.damage = 0; + phase2 = true; + } + npc.TargetClosest(true); + if (Main.netMode == 1) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] = (float)((int)(npc.Center.X / 16f)); + } + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)((int)(npc.Center.X / 16f)); + } + } + if (Main.netMode != 1) + { + if (npc.ai[0] == 0f || npc.ai[1] == 0f) + { + npc.localAI[0] = 0f; + } + npc.localAI[0] -= 5f; + if (speedBoost1) + { + npc.localAI[0] -= 10f; + } + if (!despawnBoost && npc.localAI[0] <= 0f && npc.ai[0] != 0f) + { + int num; + for (int num763 = 0; num763 < 200; num763 = num + 1) + { + if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) + { + npc.localAI[0] = (float)Main.rand.Next(60, 300); + } + num = num763; + } + } + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = (float)Main.rand.Next(300, 600); + bool flag50 = false; + int num764 = 0; + while (!flag50 && num764 <= 1000) + { + num764++; + int num765 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X / 16f); + int num766 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y / 16f); + if (npc.ai[0] == 0f) + { + num765 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X + Main.npc[CalamityGlobalNPC.ghostBoss].Center.X) / 32f); + num766 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y + Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y) / 32f); + } + if (despawnBoost) + { + num765 = (int)Main.npc[CalamityGlobalNPC.ghostBoss].position.X / 16; + num766 = (int)(Main.npc[CalamityGlobalNPC.ghostBoss].position.Y + 400f) / 16; + } + int num767 = 20; + num767 += (int)(100f * ((float)num764 / 1000f)); + int num768 = num765 + Main.rand.Next(-num767, num767 + 1); + int num769 = num766 + Main.rand.Next(-num767, num767 + 1); + try + { + if (WorldGen.SolidTile(num768, num769) || (Main.tile[num768, num769].wall > 0 && (num764 > 500 || Main.npc[CalamityGlobalNPC.ghostBoss].life < Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax / 2))) + { + flag50 = true; + npc.ai[0] = (float)num768; + npc.ai[1] = (float)num769; + npc.netUpdate = true; + } + } + catch + { + } + } + } + } + if (npc.ai[0] > 0f && npc.ai[1] > 0f) + { + float num772 = 8f; + if (expertMode) + { + num772 += 1f; + } + if (speedBoost1) + { + num772 *= 2f; + } + if (despawnBoost) + { + num772 *= 2f; + } + Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); + float num773 = npc.ai[0] * 16f - 8f - vector95.X; + float num774 = npc.ai[1] * 16f - 8f - vector95.Y; + float num775 = (float)Math.Sqrt((double)(num773 * num773 + num774 * num774)); + if (num775 < 12f + num772) + { + npc.velocity.X = num773; + npc.velocity.Y = num774; + } + else + { + num775 = num772 / num775; + npc.velocity.X = num773 * num775; + npc.velocity.Y = num774 * num775; + } + } + Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y); + float num818 = Main.player[npc.target].Center.X - vector102.X; + float num819 = Main.player[npc.target].Center.Y - vector102.Y; + float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); + float num821 = 10f; + num820 = num821 / num820; + num818 *= num820; + num819 *= num820; + npc.rotation = (float)Math.Atan2((double)num819, (double)num818) + 1.57f; + Vector2 vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; + float num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; + float num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); + num149 = 4f / num149; + num147 *= num149; + num148 *= num149; + vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; + num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; + num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); + if (num149 > 1200f) + { + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return; + } + npc.ai[2] += 1f; + if (npc.ai[3] == 0f) + { + if (npc.ai[2] > 120f) + { + npc.ai[2] = 0f; + npc.ai[3] = 1f; + npc.netUpdate = true; + } + } + else + { + if (npc.ai[2] > 40f) + { + npc.ai[3] = 0f; + } + if (Main.netMode != 1 && npc.ai[2] == 20f) + { + float num151 = 5f; + int num152 = 60; + int num153 = mod.ProjectileType("PhantomHookShot"); + num149 = num151 / num149; + num147 *= num149; + num148 *= num149; + int num154 = Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); + } + } + return; + } + if (Main.netMode == 1) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] = (float)((int)(npc.Center.X / 16f)); + } + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)((int)(npc.Center.X / 16f)); + } + } + if (Main.netMode != 1) + { + if (npc.ai[0] == 0f || npc.ai[1] == 0f) + { + npc.localAI[0] = 0f; + } + npc.localAI[0] -= 5f; + if (speedBoost1) + { + npc.localAI[0] -= 10f; + } + if (!despawnBoost && npc.localAI[0] <= 0f && npc.ai[0] != 0f) + { + int num; + for (int num763 = 0; num763 < 200; num763 = num + 1) + { + if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) + { + npc.localAI[0] = (float)Main.rand.Next(60, 300); + } + num = num763; + } + } + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = (float)Main.rand.Next(300, 600); + bool flag50 = false; + int num764 = 0; + while (!flag50 && num764 <= 1000) + { + num764++; + int num765 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X / 16f); + int num766 = (int)(Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y / 16f); + if (npc.ai[0] == 0f) + { + num765 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.X + Main.npc[CalamityGlobalNPC.ghostBoss].Center.X) / 32f); + num766 = (int)((Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center.Y + Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y) / 32f); + } + if (despawnBoost) + { + num765 = (int)Main.npc[CalamityGlobalNPC.ghostBoss].position.X / 16; + num766 = (int)(Main.npc[CalamityGlobalNPC.ghostBoss].position.Y + 400f) / 16; + } + int num767 = 20; + num767 += (int)(100f * ((float)num764 / 1000f)); + int num768 = num765 + Main.rand.Next(-num767, num767 + 1); + int num769 = num766 + Main.rand.Next(-num767, num767 + 1); + try + { + if (WorldGen.SolidTile(num768, num769) || (Main.tile[num768, num769].wall > 0 && (num764 > 500 || Main.npc[CalamityGlobalNPC.ghostBoss].life < Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax / 2))) + { + flag50 = true; + npc.ai[0] = (float)num768; + npc.ai[1] = (float)num769; + npc.netUpdate = true; + } + } + catch + { + } + } + } + } + if (npc.ai[0] > 0f && npc.ai[1] > 0f) + { + float num772 = 11f; + if (expertMode) + { + num772 += 1f; + } + if (speedBoost1) + { + num772 *= 2f; + } + if (despawnBoost) + { + num772 *= 2f; + } + Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); + float num773 = npc.ai[0] * 16f - 8f - vector95.X; + float num774 = npc.ai[1] * 16f - 8f - vector95.Y; + float num775 = (float)Math.Sqrt((double)(num773 * num773 + num774 * num774)); + if (num775 < 12f + num772) + { + npc.velocity.X = num773; + npc.velocity.Y = num774; + } + else + { + num775 = num772 / num775; + npc.velocity.X = num773 * num775; + npc.velocity.Y = num774 * num775; + } + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num776 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - vector96.X; + float num777 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - vector96.Y; + npc.rotation = (float)Math.Atan2((double)num777, (double)num776) - 1.57f; + } + } + + public override void FindFrame(int frameHeight) + { + if (phase2) + { + if (npc.ai[3] == 0f) + { + if (npc.frame.Y < 1) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + } + } + else if (npc.frame.Y > 0) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y - frameHeight; + } + } + return; + } + if (npc.velocity.X == 0f && npc.velocity.Y == 0f) + { + if (npc.frame.Y < 1) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + } + } + else if (npc.frame.Y > 0) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y - frameHeight; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (Main.npc[CalamityGlobalNPC.ghostBoss].active && !phase2) + { + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + float bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; + float bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; + float rotation2 = (float)Math.Atan2((double)bossCenterY, (double)bossCenterX) - 1.57f; + bool draw = true; + while (draw) + { + int chainWidth = 20; //16 24 + int chainHeight = 52; //32 16 + float num10 = (float)Math.Sqrt((double)(bossCenterX * bossCenterX + bossCenterY * bossCenterY)); + if (num10 < (float)chainHeight) + { + chainWidth = (int)num10 - chainHeight + chainWidth; + draw = false; + } + num10 = (float)chainWidth / num10; + bossCenterX *= num10; + bossCenterY *= num10; + center.X += bossCenterX; + center.Y += bossCenterY; + bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; + bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; + Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Polterghast/PolterghastChain"), 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/Polterghast/PolterghastChain").Width, chainWidth)), color2, rotation2, + new Vector2((float)mod.GetTexture("NPCs/Polterghast/PolterghastChain").Width * 0.5f, (float)mod.GetTexture("NPCs/Polterghast/PolterghastChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); + } + } + return true; + } + + public override bool CheckActive() + { + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + player.AddBuff(mod.BuffType("Horror"), 180, true); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs index d62c09c093..d75cfd0b42 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs @@ -1,466 +1,466 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.ProfanedGuardianBoss -{ - [AutoloadBossHead] - public class ProfanedGuardianBoss : ModNPC - { - private int flareTimer = 0; - private int flareProjectiles = 1; - private int dustTimer = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 20f; - npc.aiStyle = -1; - npc.damage = 100; - npc.width = 100; //324 - npc.height = 80; //216 - npc.defense = 50; - npc.lifeMax = 102500; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 600000 : 500000; - } - 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; - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); - else - music = MusicID.Boss1; - 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[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; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(flareTimer); - writer.Write(dustTimer); - writer.Write(flareProjectiles); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - flareTimer = reader.ReadInt32(); - dustTimer = reader.ReadInt32(); - flareProjectiles = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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() - { - CalamityGlobalNPC.doughnutBoss = npc.whoAmI; - bool fireBalls = (double)npc.life <= (double)npc.lifeMax * 0.75; - bool powerBoost = (double)npc.life <= (double)npc.lifeMax * 0.5; - bool fireDust = (double)npc.life <= (double)npc.lifeMax * 0.25; - Player player = Main.player[npc.target]; - Vector2 vector = npc.Center; - if (Main.netMode != 1 && npc.localAI[1] == 0f) - { - npc.localAI[1] = 1f; - NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("ProfanedGuardianBoss2"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("ProfanedGuardianBoss3"), 0, 0f, 0f, 0f, 0f, 255); - } - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - bool isHoly = player.ZoneHoly; - bool isHell = player.ZoneUnderworldHeight; - npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 50 : 99999; - Vector2 vectorCenter = npc.Center; - npc.TargetClosest(false); - if (!Main.dayTime || !player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!Main.dayTime || !player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - bool flag100 = false; - for (int num569 = 0; num569 < 200; num569++) - { - if ((Main.npc[num569].active && Main.npc[num569].type == (mod.NPCType("ProfanedGuardianBoss2"))) || (Main.npc[num569].active && Main.npc[num569].type == mod.NPCType("ProfanedGuardianBoss3"))) - { - flag100 = true; - } - } - if (flag100) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - float num998 = 8f; - float scaleFactor3 = 300f; - float num999 = 800f; - float num1000 = powerBoost ? 14f : 16f; - if (revenge) - { - num1000 *= 1.15f; - } - float num1001 = 5f; - float scaleFactor4 = 0.8f; - int num1002 = 0; - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1005 = powerBoost ? 14f : 16f; - if (revenge) - { - num1005 *= 1.15f; - } - float num1006 = 0.333333343f; - float num1007 = 8f; - num1006 *= num1005; - int num1009 = (npc.ai[0] == 2f) ? 2 : 1; - int num1010 = (npc.ai[0] == 2f) ? 80 : 60; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 244, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (Main.netMode != 1) - { - npc.localAI[0] += expertMode ? 2f : 1f; - if (npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - 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)) - { - Main.PlaySound(SoundID.Item20, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = expertMode ? 33 : 48; - int projectileShot = mod.ProjectileType("ProfanedSpear"); - int i; - for (i = 0; i < 8; i++) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - if (fireBalls && flareTimer == 0) - { - flareTimer = 420; - } - if (flareTimer > 0) - { - flareTimer--; - if (flareTimer == 0) - { - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - if (Main.netMode != 1) - { - Main.PlaySound(SoundID.Item20, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = expertMode ? 34 : 50; - int j; - for (j = 0; j < flareProjectiles; j++) - { - int randomTime = Main.rand.Next(60, 120); - offsetAngle = (startAngle + deltaAngle * ( j + j * j ) / 2f ) + 32f * j; - int projectile = Projectile.NewProjectile(value9.X, value9.Y, 0f, 0f, mod.ProjectileType("GigaFlare"), damage, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - int projectile2 = Projectile.NewProjectile(value9.X, value9.Y, 0f, 0f, mod.ProjectileType("GigaFlare"), damage, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - Main.projectile[projectile].timeLeft = randomTime; - Main.projectile[projectile2].timeLeft = randomTime; - Main.projectile[projectile].velocity.X = (float)Main.rand.Next(-50, 51) * 0.125f; - Main.projectile[projectile].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.125f; - Main.projectile[projectile2].velocity.X = (float)Main.rand.Next(-50, 51) * 0.125f; - Main.projectile[projectile2].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.125f; - } - } - } - } - } - npc.damage = expertMode ? 200 : 100; - if (npc.ai[0] == 0f) - { - npc.knockBackResist = 0f; - float scaleFactor6 = num998; - Vector2 center4 = npc.Center; - Vector2 center5 = Main.player[npc.target].Center; - Vector2 vector126 = center5 - center4; - Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; - float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - if (npc.ai[3] >= 120f) - { - flag64 = true; - } - float num1014 = 8f; - 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) / num1000; - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; - if (!flag64) - { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) - { - npc.netUpdate = true; - } - } - else - { - npc.ai[3] = 0f; - } - } - else - { - npc.ai[0] = 1f; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - npc.knockBackResist = 0f; - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; - velocity.Normalize(); - velocity *= scaleFactor5; - npc.velocity = velocity; - } - } - else if (npc.ai[0] == 2f) - { - if (Main.netMode != 1) - { - dustTimer--; - if (fireDust && dustTimer <= 0) - { - Main.PlaySound(SoundID.Item20, npc.position); - int damage = expertMode ? 38 : 56; - 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("FlareDust"), damage, 0f, Main.myPlayer, 0f, 0f); //changed - Main.projectile[projectile].timeLeft = 120; - Main.projectile[projectile].velocity.X = 0f; - Main.projectile[projectile].velocity.Y = 0f; - dustTimer = 3; - } - } - npc.damage = expertMode ? 240 : 120; - npc.knockBackResist = 0f; - float num1016 = num1003; - npc.ai[1] += 1f; - bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; - if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - npc.ai[0] = 3f; - } - else - { - Vector2 center6 = npc.Center; - Vector2 center7 = Main.player[npc.target].Center; - Vector2 vec2 = center7 - center6; - vec2.Normalize(); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; - } - } - else if (npc.ai[0] == 3f) - { - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.98f; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); - while (npc.ai[0] == 2f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void BossLoot(ref string name, ref int potionType) - { - name = "A Profaned Guardian"; - potionType = ItemID.GreaterHealingPotion; - } - - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProfanedCore")); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } - - 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 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) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.ProfanedGuardianBoss +{ + [AutoloadBossHead] + public class ProfanedGuardianBoss : ModNPC + { + private int flareTimer = 0; + private int flareProjectiles = 1; + private int dustTimer = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 20f; + npc.aiStyle = -1; + npc.damage = 100; + npc.width = 100; //324 + npc.height = 80; //216 + npc.defense = 50; + npc.lifeMax = 102500; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 600000 : 500000; + } + 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; + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); + else + music = MusicID.Boss1; + 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[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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(flareTimer); + writer.Write(dustTimer); + writer.Write(flareProjectiles); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + flareTimer = reader.ReadInt32(); + dustTimer = reader.ReadInt32(); + flareProjectiles = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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() + { + CalamityGlobalNPC.doughnutBoss = npc.whoAmI; + bool fireBalls = (double)npc.life <= (double)npc.lifeMax * 0.75; + bool powerBoost = (double)npc.life <= (double)npc.lifeMax * 0.5; + bool fireDust = (double)npc.life <= (double)npc.lifeMax * 0.25; + Player player = Main.player[npc.target]; + Vector2 vector = npc.Center; + if (Main.netMode != 1 && npc.localAI[1] == 0f) + { + npc.localAI[1] = 1f; + NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("ProfanedGuardianBoss2"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)vector.X, (int)vector.Y, mod.NPCType("ProfanedGuardianBoss3"), 0, 0f, 0f, 0f, 0f, 255); + } + bool expertMode = Main.expertMode; + bool revenge = CalamityWorld.revenge; + bool isHoly = player.ZoneHoly; + bool isHell = player.ZoneUnderworldHeight; + npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 50 : 99999; + Vector2 vectorCenter = npc.Center; + npc.TargetClosest(false); + if (!Main.dayTime || !player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!Main.dayTime || !player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + bool flag100 = false; + for (int num569 = 0; num569 < 200; num569++) + { + if ((Main.npc[num569].active && Main.npc[num569].type == (mod.NPCType("ProfanedGuardianBoss2"))) || (Main.npc[num569].active && Main.npc[num569].type == mod.NPCType("ProfanedGuardianBoss3"))) + { + flag100 = true; + } + } + if (flag100) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + float num998 = 8f; + float scaleFactor3 = 300f; + float num999 = 800f; + float num1000 = powerBoost ? 14f : 16f; + if (revenge) + { + num1000 *= 1.15f; + } + float num1001 = 5f; + float scaleFactor4 = 0.8f; + int num1002 = 0; + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1005 = powerBoost ? 14f : 16f; + if (revenge) + { + num1005 *= 1.15f; + } + float num1006 = 0.333333343f; + float num1007 = 8f; + num1006 *= num1005; + int num1009 = (npc.ai[0] == 2f) ? 2 : 1; + int num1010 = (npc.ai[0] == 2f) ? 80 : 60; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 244, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (Main.netMode != 1) + { + npc.localAI[0] += expertMode ? 2f : 1f; + if (npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; + 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)) + { + Main.PlaySound(SoundID.Item20, npc.position); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int damage = expertMode ? 33 : 48; + int projectileShot = mod.ProjectileType("ProfanedSpear"); + int i; + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + if (fireBalls && flareTimer == 0) + { + flareTimer = 420; + } + if (flareTimer > 0) + { + flareTimer--; + if (flareTimer == 0) + { + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + if (Main.netMode != 1) + { + Main.PlaySound(SoundID.Item20, npc.position); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 90f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int damage = expertMode ? 34 : 50; + int j; + for (j = 0; j < flareProjectiles; j++) + { + int randomTime = Main.rand.Next(60, 120); + offsetAngle = (startAngle + deltaAngle * ( j + j * j ) / 2f ) + 32f * j; + int projectile = Projectile.NewProjectile(value9.X, value9.Y, 0f, 0f, mod.ProjectileType("GigaFlare"), damage, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + int projectile2 = Projectile.NewProjectile(value9.X, value9.Y, 0f, 0f, mod.ProjectileType("GigaFlare"), damage, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + Main.projectile[projectile].timeLeft = randomTime; + Main.projectile[projectile2].timeLeft = randomTime; + Main.projectile[projectile].velocity.X = (float)Main.rand.Next(-50, 51) * 0.125f; + Main.projectile[projectile].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.125f; + Main.projectile[projectile2].velocity.X = (float)Main.rand.Next(-50, 51) * 0.125f; + Main.projectile[projectile2].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.125f; + } + } + } + } + } + npc.damage = expertMode ? 200 : 100; + if (npc.ai[0] == 0f) + { + npc.knockBackResist = 0f; + float scaleFactor6 = num998; + Vector2 center4 = npc.Center; + Vector2 center5 = Main.player[npc.target].Center; + Vector2 vector126 = center5 - center4; + Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; + float num1013 = vector126.Length(); + vector126 = Vector2.Normalize(vector126) * scaleFactor6; + vector127 = Vector2.Normalize(vector127) * scaleFactor6; + bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (npc.ai[3] >= 120f) + { + flag64 = true; + } + float num1014 = 8f; + 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) / num1000; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; + if (!flag64) + { + npc.ai[3] += 1f; + if (npc.ai[3] == 120f) + { + npc.netUpdate = true; + } + } + else + { + npc.ai[3] = 0f; + } + } + else + { + npc.ai[0] = 1f; + npc.ai[2] = vector126.X; + npc.ai[3] = vector126.Y; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + npc.knockBackResist = 0f; + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; + velocity.Normalize(); + velocity *= scaleFactor5; + npc.velocity = velocity; + } + } + else if (npc.ai[0] == 2f) + { + if (Main.netMode != 1) + { + dustTimer--; + if (fireDust && dustTimer <= 0) + { + Main.PlaySound(SoundID.Item20, npc.position); + int damage = expertMode ? 38 : 56; + 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("FlareDust"), damage, 0f, Main.myPlayer, 0f, 0f); //changed + Main.projectile[projectile].timeLeft = 120; + Main.projectile[projectile].velocity.X = 0f; + Main.projectile[projectile].velocity.Y = 0f; + dustTimer = 3; + } + } + npc.damage = expertMode ? 240 : 120; + npc.knockBackResist = 0f; + float num1016 = num1003; + npc.ai[1] += 1f; + bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; + if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + npc.ai[0] = 3f; + } + else + { + Vector2 center6 = npc.Center; + Vector2 center7 = Main.player[npc.target].Center; + Vector2 vec2 = center7 - center6; + vec2.Normalize(); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; + } + } + else if (npc.ai[0] == 3f) + { + npc.ai[1] -= 1f; + if (npc.ai[1] <= 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.98f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + while (npc.ai[0] == 2f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void BossLoot(ref string name, ref int potionType) + { + name = "A Profaned Guardian"; + potionType = ItemID.GreaterHealingPotion; + } + + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProfanedCore")); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 600, true); + } + + 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 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) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs index 7fce549dde..ce3ddaa312 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs @@ -1,256 +1,256 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.ProfanedGuardianBoss -{ - [AutoloadBossHead] - public class ProfanedGuardianBoss2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.damage = 80; - npc.width = 100; //324 - npc.height = 80; //216 - npc.defense = 40; - npc.lifeMax = 40000; - npc.value = 0f; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 400000 : 300000; - } - 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; - aiType = -1; - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); - else - music = MusicID.Boss1; - 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.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } - - 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() - { - bool expertMode = Main.expertMode; - bool isHoly = Main.player[npc.target].ZoneHoly; - bool isHell = Main.player[npc.target].ZoneUnderworldHeight; - npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 40 : 99999; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - int num1009 = (npc.ai[0] == 0f) ? 1 : 2; - int num1010 = (npc.ai[0] == 0f) ? 60 : 80; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 244; - } - else - { - dustType = 160; - } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (!Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.ai[0] == 0f) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - if (num786 > 90f) - { - num786 = 24f / num786; //8f - num784 *= num786; - num785 *= num786; - npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; - return; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 24f) //8f - { - npc.velocity.Y = npc.velocity.Y * 1.15f; //1.05f - npc.velocity.X = npc.velocity.X * 1.15f; //1.05f - } - if (Main.netMode != 1 && ((expertMode && Main.rand.Next(50) == 0) || Main.rand.Next(100) == 0)) - { - npc.TargetClosest(true); - vector96 = new Vector2(npc.Center.X, npc.Center.Y); - num784 = player.Center.X - vector96.X; - num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - num786 = 24f / num786; //8f - npc.velocity.X = num784 * num786; - npc.velocity.Y = num785 * num786; - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - } - else - { - Vector2 value4 = player.Center - npc.Center; - value4.Normalize(); - value4 *= 27f; //9f - npc.velocity = (npc.velocity * 99f + value4) / 100f; - Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); - float num787 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector97.X; - float num788 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); - if (num789 > 700f) - { - npc.ai[0] = 0f; - return; - } - } - if (Main.netMode != 1) - { - npc.localAI[0] += expertMode ? 2f : 1f; - if (npc.localAI[0] >= 420f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Main.PlaySound(SoundID.Item20, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = expertMode ? 33 : 48; - int projectileShot = mod.ProjectileType("ProfanedSpear"); - int i; - for (i = 0; i < 3; i++) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void BossLoot(ref string name, ref int potionType) - { - name = "A Profaned Guardian"; - potionType = ItemID.GreaterHealingPotion; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - 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) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.ProfanedGuardianBoss +{ + [AutoloadBossHead] + public class ProfanedGuardianBoss2 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.aiStyle = -1; + npc.damage = 80; + npc.width = 100; //324 + npc.height = 80; //216 + npc.defense = 40; + npc.lifeMax = 40000; + npc.value = 0f; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 400000 : 300000; + } + 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; + aiType = -1; + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); + else + music = MusicID.Boss1; + 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.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } + + 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() + { + bool expertMode = Main.expertMode; + bool isHoly = Main.player[npc.target].ZoneHoly; + bool isHell = Main.player[npc.target].ZoneUnderworldHeight; + npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 40 : 99999; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + int num1009 = (npc.ai[0] == 0f) ? 1 : 2; + int num1010 = (npc.ai[0] == 0f) ? 60 : 80; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 244; + } + else + { + dustType = 160; + } + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (!Main.npc[CalamityGlobalNPC.doughnutBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.ai[0] == 0f) + { + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; + float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; + float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + if (num786 > 90f) + { + num786 = 24f / num786; //8f + num784 *= num786; + num785 *= num786; + npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; + return; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 24f) //8f + { + npc.velocity.Y = npc.velocity.Y * 1.15f; //1.05f + npc.velocity.X = npc.velocity.X * 1.15f; //1.05f + } + if (Main.netMode != 1 && ((expertMode && Main.rand.Next(50) == 0) || Main.rand.Next(100) == 0)) + { + npc.TargetClosest(true); + vector96 = new Vector2(npc.Center.X, npc.Center.Y); + num784 = player.Center.X - vector96.X; + num785 = player.Center.Y - vector96.Y; + num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + num786 = 24f / num786; //8f + npc.velocity.X = num784 * num786; + npc.velocity.Y = num785 * num786; + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + } + else + { + Vector2 value4 = player.Center - npc.Center; + value4.Normalize(); + value4 *= 27f; //9f + npc.velocity = (npc.velocity * 99f + value4) / 100f; + Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); + float num787 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector97.X; + float num788 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector97.Y; + float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); + if (num789 > 700f) + { + npc.ai[0] = 0f; + return; + } + } + if (Main.netMode != 1) + { + npc.localAI[0] += expertMode ? 2f : 1f; + if (npc.localAI[0] >= 420f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Main.PlaySound(SoundID.Item20, npc.position); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int damage = expertMode ? 33 : 48; + int projectileShot = mod.ProjectileType("ProfanedSpear"); + int i; + for (i = 0; i < 3; i++) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void BossLoot(ref string name, ref int potionType) + { + name = "A Profaned Guardian"; + potionType = ItemID.GreaterHealingPotion; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 600, true); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + 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) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs index eebd2e307e..3393299b01 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs @@ -1,258 +1,258 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.ProfanedGuardianBoss -{ - [AutoloadBossHead] - public class ProfanedGuardianBoss3 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.aiStyle = -1; - npc.damage = 80; - npc.width = 100; //324 - npc.height = 80; //216 - npc.defense = 25; - npc.lifeMax = 25000; - npc.value = 0f; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 240000 : 200000; - } - 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; - aiType = -1; - npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); - else - music = MusicID.Boss1; - 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.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } - - 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() - { - bool expertMode = Main.expertMode; - bool isHoly = Main.player[npc.target].ZoneHoly; - bool isHell = Main.player[npc.target].ZoneUnderworldHeight; - npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 25 : 99999; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - int num1009 = (npc.ai[0] == 0f) ? 1 : 2; - int num1010 = (npc.ai[0] == 0f) ? 60 : 80; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 244; - } - else - { - dustType = 107; - } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (!Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.ai[0] == 0f) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - if (num786 > 90f) - { - num786 = 24f / num786; //8f - num784 *= num786; - num785 *= num786; - npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; - return; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 24f) //8f - { - npc.velocity.Y = npc.velocity.Y * 1.15f; //1.05f - npc.velocity.X = npc.velocity.X * 1.15f; //1.05f - } - if (Main.netMode != 1 && ((expertMode && Main.rand.Next(50) == 0) || Main.rand.Next(100) == 0)) - { - npc.TargetClosest(true); - vector96 = new Vector2(npc.Center.X, npc.Center.Y); - num784 = player.Center.X - vector96.X; - num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - num786 = 24f / num786; //8f - npc.velocity.X = num784 * num786; - npc.velocity.Y = num785 * num786; - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - } - else - { - Vector2 value4 = player.Center - npc.Center; - value4.Normalize(); - value4 *= 27f; //9f - npc.velocity = (npc.velocity * 99f + value4) / 100f; - Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); - float num787 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector97.X; - float num788 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); - if (num789 > 700f) - { - npc.ai[0] = 0f; - return; - } - } - if (Main.netMode != 1) - { - npc.localAI[0] += expertMode ? 2f : 1f; - if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Main.PlaySound(SoundID.Item20, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int damage = 0; - int projectileShot = mod.ProjectileType("HealOrbProv"); - int i; - for (i = 0; i < 3; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void BossLoot(ref string name, ref int potionType) - { - name = "A Profaned Guardian"; - potionType = ItemID.GreaterHealingPotion; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.7f); - } - - 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) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.ProfanedGuardianBoss +{ + [AutoloadBossHead] + public class ProfanedGuardianBoss3 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.aiStyle = -1; + npc.damage = 80; + npc.width = 100; //324 + npc.height = 80; //216 + npc.defense = 25; + npc.lifeMax = 25000; + npc.value = 0f; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 240000 : 200000; + } + 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; + aiType = -1; + npc.boss = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); + else + music = MusicID.Boss1; + 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.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } + + 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() + { + bool expertMode = Main.expertMode; + bool isHoly = Main.player[npc.target].ZoneHoly; + bool isHell = Main.player[npc.target].ZoneUnderworldHeight; + npc.defense = (isHoly || isHell || CalamityWorld.bossRushActive) ? 25 : 99999; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + int num1009 = (npc.ai[0] == 0f) ? 1 : 2; + int num1010 = (npc.ai[0] == 0f) ? 60 : 80; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 244; + } + else + { + dustType = 107; + } + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (!Main.npc[CalamityGlobalNPC.doughnutBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.ai[0] == 0f) + { + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; + float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; + float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + if (num786 > 90f) + { + num786 = 24f / num786; //8f + num784 *= num786; + num785 *= num786; + npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; + return; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 24f) //8f + { + npc.velocity.Y = npc.velocity.Y * 1.15f; //1.05f + npc.velocity.X = npc.velocity.X * 1.15f; //1.05f + } + if (Main.netMode != 1 && ((expertMode && Main.rand.Next(50) == 0) || Main.rand.Next(100) == 0)) + { + npc.TargetClosest(true); + vector96 = new Vector2(npc.Center.X, npc.Center.Y); + num784 = player.Center.X - vector96.X; + num785 = player.Center.Y - vector96.Y; + num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + num786 = 24f / num786; //8f + npc.velocity.X = num784 * num786; + npc.velocity.Y = num785 * num786; + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + } + else + { + Vector2 value4 = player.Center - npc.Center; + value4.Normalize(); + value4 *= 27f; //9f + npc.velocity = (npc.velocity * 99f + value4) / 100f; + Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); + float num787 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector97.X; + float num788 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector97.Y; + float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); + if (num789 > 700f) + { + npc.ai[0] = 0f; + return; + } + } + if (Main.netMode != 1) + { + npc.localAI[0] += expertMode ? 2f : 1f; + if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Main.PlaySound(SoundID.Item20, npc.position); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y)- spread/2; + double deltaAngle = spread/8f; + double offsetAngle; + int damage = 0; + int projectileShot = mod.ProjectileType("HealOrbProv"); + int i; + for (i = 0; i < 3; i++ ) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void BossLoot(ref string name, ref int potionType) + { + name = "A Profaned Guardian"; + potionType = ItemID.GreaterHealingPotion; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 600, true); + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.7f); + } + + 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) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/Providence/ProvScreenShaderData.cs b/NPCs/Providence/ProvScreenShaderData.cs index a0536418ce..bc25ab2aea 100644 --- a/NPCs/Providence/ProvScreenShaderData.cs +++ b/NPCs/Providence/ProvScreenShaderData.cs @@ -1,44 +1,44 @@ -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Providence -{ - public class ProvScreenShaderData : ScreenShaderData - { - private int ProvIndex; - - public ProvScreenShaderData(string passName) - : base(passName) - { - } - - private void UpdatePIndex() - { - int ProvType = ModLoader.GetMod("CalamityMod").NPCType("Providence"); - if (ProvIndex >= 0 && Main.npc[ProvIndex].active && Main.npc[ProvIndex].type == ProvType) - { - return; - } - ProvIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == ProvType) - { - ProvIndex = i; - break; - } - } - } - - public override void Apply() - { - UpdatePIndex(); - if (ProvIndex != -1) - { - UseTargetPosition(Main.npc[ProvIndex].Center); - } - base.Apply(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Providence +{ + public class ProvScreenShaderData : ScreenShaderData + { + private int ProvIndex; + + public ProvScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdatePIndex() + { + int ProvType = ModLoader.GetMod("CalamityMod").NPCType("Providence"); + if (ProvIndex >= 0 && Main.npc[ProvIndex].active && Main.npc[ProvIndex].type == ProvType) + { + return; + } + ProvIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ProvType) + { + ProvIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdatePIndex(); + if (ProvIndex != -1) + { + UseTargetPosition(Main.npc[ProvIndex].Center); + } + base.Apply(); + } + } +} diff --git a/NPCs/Providence/ProvSky.cs b/NPCs/Providence/ProvSky.cs index 9bced7286d..b649d5b61c 100644 --- a/NPCs/Providence/ProvSky.cs +++ b/NPCs/Providence/ProvSky.cs @@ -1,100 +1,100 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Providence -{ - public class ProvSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int ProvIndex = -1; - - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } - - private float GetIntensity() - { - if (this.UpdatePIndex()) - { - float x = 0f; - if (this.ProvIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.ProvIndex].Center); - } - return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.4f; - } - return 0.7f; //0.5 - } - - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } - - private bool UpdatePIndex() - { - int ProvType = ModLoader.GetMod("CalamityMod").NPCType("Providence"); - if (ProvIndex >= 0 && Main.npc[ProvIndex].active && Main.npc[ProvIndex].type == ProvType) - { - return true; - } - ProvIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == ProvType) - { - ProvIndex = i; - break; - } - } - return ProvIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(250, 225, 200) * intensity); - } - } - - public override float GetCloudAlpha() - { - return 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } - - public override void Deactivate(params object[] args) - { - isActive = false; - } - - public override void Reset() - { - isActive = false; - } - - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Providence +{ + public class ProvSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int ProvIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdatePIndex()) + { + float x = 0f; + if (this.ProvIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.ProvIndex].Center); + } + return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.4f; + } + return 0.7f; //0.5 + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdatePIndex() + { + int ProvType = ModLoader.GetMod("CalamityMod").NPCType("Providence"); + if (ProvIndex >= 0 && Main.npc[ProvIndex].active && Main.npc[ProvIndex].type == ProvType) + { + return true; + } + ProvIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ProvType) + { + ProvIndex = i; + break; + } + } + return ProvIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(250, 225, 200) * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 3bfe6582d4..43ac88013f 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -1,197 +1,197 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Providence -{ - public class ProvSpawnDefense : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("A Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.damage = 80; - npc.width = 100; //324 - npc.height = 80; //216 - npc.defense = 40; - npc.lifeMax = 25000; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 360000 : 300000; - } - 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.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } - - 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() - { - CalamityGlobalNPC.holyBossDefender = npc.whoAmI; - bool expertMode = Main.expertMode; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); - if (!Main.npc[CalamityGlobalNPC.holyBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; - - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - int num1009 = (npc.ai[0] == 0f) ? 1 : 2; - int num1010 = (npc.ai[0] == 0f) ? 60 : 80; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 244; - } - else - { - dustType = 160; - } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 0.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (Main.netMode != 1) - { - npc.localAI[0] += expertMode ? 2f : 1f; - if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - Main.PlaySound(SoundID.Item20, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = expertMode ? 40 : 59; - int projectileShot = mod.ProjectileType("ProfanedSpear"); - int i; - for (i = 0; i < 3; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - npc.TargetClosest(true); - float num1372 = 9f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[1] -= 1f; - if (num1375 < 200f || npc.ai[1] > 0f) - { - if (num1375 < 200f) - { - npc.ai[1] = 20f; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - return; - } - - public override bool CheckActive() - { - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); - for (int k = 0; k < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Providence +{ + public class ProvSpawnDefense : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("A Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 1f; + npc.aiStyle = -1; + npc.damage = 80; + npc.width = 100; //324 + npc.height = 80; //216 + npc.defense = 40; + npc.lifeMax = 25000; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 360000 : 300000; + } + 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.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } + + 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() + { + CalamityGlobalNPC.holyBossDefender = npc.whoAmI; + bool expertMode = Main.expertMode; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); + if (!Main.npc[CalamityGlobalNPC.holyBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; + + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + int num1009 = (npc.ai[0] == 0f) ? 1 : 2; + int num1010 = (npc.ai[0] == 0f) ? 60 : 80; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 244; + } + else + { + dustType = 160; + } + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 0.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (Main.netMode != 1) + { + npc.localAI[0] += expertMode ? 2f : 1f; + if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Main.PlaySound(SoundID.Item20, npc.position); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int damage = expertMode ? 40 : 59; + int projectileShot = mod.ProjectileType("ProfanedSpear"); + int i; + for (i = 0; i < 3; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + npc.TargetClosest(true); + float num1372 = 9f; + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + float num1374 = player.Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[1] -= 1f; + if (num1375 < 200f || npc.ai[1] > 0f) + { + if (num1375 < 200f) + { + npc.ai[1] = 20f; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + return; + } + + public override bool CheckActive() + { + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); + for (int k = 0; k < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 0cce3ecebb..1a9ca8c65a 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -1,200 +1,200 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Providence -{ - public class ProvSpawnHealer : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("A Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 100; //324 - npc.height = 80; //216 - npc.defense = 30; - npc.lifeMax = 40000; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 500000 : 400000; - } - 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.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - } - - 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() - { - CalamityGlobalNPC.holyBossHealer = npc.whoAmI; - bool expertMode = Main.expertMode; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); - if (!Main.npc[CalamityGlobalNPC.holyBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; - - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - int num1009 = (npc.ai[0] == 0f) ? 1 : 2; - int num1010 = (npc.ai[0] == 0f) ? 60 : 80; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 244; - } - else - { - dustType = 107; - } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 0.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (npc.ai[0] == 0f) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - if (num786 > 360f) - { - num786 = 8f / num786; //8f - num784 *= num786; - num785 *= num786; - npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; - return; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 8f) //8f - { - npc.velocity.Y = npc.velocity.Y * 1.05f; //1.05f - npc.velocity.X = npc.velocity.X * 1.05f; //1.05f - } - if (Main.netMode != 1 && ((expertMode && Main.rand.Next(2000) == 0) || Main.rand.Next(1000) == 0)) - { - npc.TargetClosest(true); - vector96 = new Vector2(npc.Center.X, npc.Center.Y); - num784 = player.Center.X - vector96.X; - num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - num786 = 24f / num786; //8f - npc.velocity.X = num784 * num786; - npc.velocity.Y = num785 * num786; - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - } - else - { - if (expertMode) - { - Vector2 value4 = player.Center - npc.Center; - value4.Normalize(); - value4 *= 9f; //9f - npc.velocity = (npc.velocity * 99f + value4) / 99f; //100 - } - Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); - float num787 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector97.X; - float num788 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); - if (num789 > 700f || npc.justHit) - { - npc.ai[0] = 0f; - return; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Providence +{ + public class ProvSpawnHealer : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("A Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 1f; + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 100; //324 + npc.height = 80; //216 + npc.defense = 30; + npc.lifeMax = 40000; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 500000 : 400000; + } + 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.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + } + + 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() + { + CalamityGlobalNPC.holyBossHealer = npc.whoAmI; + bool expertMode = Main.expertMode; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); + if (!Main.npc[CalamityGlobalNPC.holyBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; + + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + int num1009 = (npc.ai[0] == 0f) ? 1 : 2; + int num1010 = (npc.ai[0] == 0f) ? 60 : 80; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 244; + } + else + { + dustType = 107; + } + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 0.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (npc.ai[0] == 0f) + { + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num784 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector96.X; + float num785 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector96.Y; + float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + if (num786 > 360f) + { + num786 = 8f / num786; //8f + num784 *= num786; + num785 *= num786; + npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; + return; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 8f) //8f + { + npc.velocity.Y = npc.velocity.Y * 1.05f; //1.05f + npc.velocity.X = npc.velocity.X * 1.05f; //1.05f + } + if (Main.netMode != 1 && ((expertMode && Main.rand.Next(2000) == 0) || Main.rand.Next(1000) == 0)) + { + npc.TargetClosest(true); + vector96 = new Vector2(npc.Center.X, npc.Center.Y); + num784 = player.Center.X - vector96.X; + num785 = player.Center.Y - vector96.Y; + num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + num786 = 24f / num786; //8f + npc.velocity.X = num784 * num786; + npc.velocity.Y = num785 * num786; + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + } + else + { + if (expertMode) + { + Vector2 value4 = player.Center - npc.Center; + value4.Normalize(); + value4 *= 9f; //9f + npc.velocity = (npc.velocity * 99f + value4) / 99f; //100 + } + Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); + float num787 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector97.X; + float num788 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector97.Y; + float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); + if (num789 > 700f || npc.justHit) + { + npc.ai[0] = 0f; + return; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 600, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 4f8309f79d..83de1668da 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -1,347 +1,347 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Providence -{ - public class ProvSpawnOffense : ModNPC - { - public int dustTimer = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("A Profaned Guardian"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - npc.damage = 100; - npc.width = 100; //324 - npc.height = 80; //216 - npc.defense = 30; - npc.lifeMax = 42500; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 500000 : 400000; - } - 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; - 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[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; - } - - 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() - { - CalamityGlobalNPC.holyBossAttacker = npc.whoAmI; - bool fireDust = (double)npc.life <= (double)npc.lifeMax * 0.25; - bool expertMode = Main.expertMode; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); - if (!Main.npc[CalamityGlobalNPC.holyBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; - - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - float num998 = 8f; - float scaleFactor3 = 300f; - float num999 = 800f; - float num1000 = 60f; - float num1001 = 5f; - float scaleFactor4 = 0.8f; - int num1002 = 0; - float scaleFactor5 = 10f; - float num1003 = 30f; - float num1004 = 150f; - float num1005 = 60f; - float num1006 = 0.333333343f; - float num1007 = 8f; - num1006 *= num1005; - int num1009 = (npc.ai[0] == 2f) ? 2 : 1; - int num1010 = (npc.ai[0] == 2f) ? 80 : 60; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 244, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 0.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (Main.netMode != 1) - { - npc.localAI[0] += expertMode ? 2f : 1f; - if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - 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)) - { - Main.PlaySound(SoundID.Item20, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int damage = expertMode ? 40 : 59; - int projectileShot = mod.ProjectileType("ProfanedSpear"); - int i; - for (i = 0; i < 8; i++) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - npc.damage = expertMode ? 200 : 100; - if (npc.ai[0] == 0f) - { - npc.knockBackResist = 0f; - float scaleFactor6 = num998; - Vector2 center4 = npc.Center; - Vector2 center5 = Main.player[npc.target].Center; - Vector2 vector126 = center5 - center4; - Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; - float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - if (npc.ai[3] >= 120f) - { - flag64 = true; - } - float num1014 = 8f; - 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) / num1000; - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; - if (!flag64) - { - npc.ai[3] += 1f; - if (npc.ai[3] == 120f) - { - npc.netUpdate = true; - } - } - else - { - npc.ai[3] = 0f; - } - } - else - { - npc.ai[0] = 1f; - npc.ai[2] = vector126.X; - npc.ai[3] = vector126.Y; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - npc.knockBackResist = 0f; - npc.velocity *= scaleFactor4; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1001) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; - velocity.Normalize(); - velocity *= scaleFactor5; - npc.velocity = velocity; - } - } - else if (npc.ai[0] == 2f) - { - if (Main.netMode != 1) - { - dustTimer--; - if (fireDust && dustTimer <= 0) - { - Main.PlaySound(SoundID.Item20, npc.position); - int damage = expertMode ? 40 : 59; - 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("FlareDust"), damage, 0f, Main.myPlayer, 0f, 0f); //changed - Main.projectile[projectile].timeLeft = 120; - Main.projectile[projectile].velocity.X = 0f; - Main.projectile[projectile].velocity.Y = 0f; - dustTimer = 3; - } - } - npc.damage = expertMode ? 240 : 120; - npc.knockBackResist = 0f; - float num1016 = num1003; - npc.ai[1] += 1f; - bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; - if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.velocity /= 2f; - npc.netUpdate = true; - npc.ai[1] = 45f; - npc.ai[0] = 3f; - } - else - { - Vector2 center6 = npc.Center; - Vector2 center7 = Main.player[npc.target].Center; - Vector2 vec2 = center7 - center6; - vec2.Normalize(); - if (vec2.HasNaNs()) - { - vec2 = new Vector2((float)npc.direction, 0f); - } - npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; - } - } - else if (npc.ai[0] == 3f) - { - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.velocity *= 0.98f; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); - while (npc.ai[0] == 2f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - return false; - } - - public override bool CheckActive() - { - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 180); - } - player.AddBuff(BuffID.OnFire, 600, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); - for (int k = 0; k < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Providence +{ + public class ProvSpawnOffense : ModNPC + { + public int dustTimer = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("A Profaned Guardian"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 1f; + npc.aiStyle = -1; + npc.damage = 100; + npc.width = 100; //324 + npc.height = 80; //216 + npc.defense = 30; + npc.lifeMax = 42500; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 500000 : 400000; + } + 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; + 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[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; + } + + 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() + { + CalamityGlobalNPC.holyBossAttacker = npc.whoAmI; + bool fireDust = (double)npc.life <= (double)npc.lifeMax * 0.25; + bool expertMode = Main.expertMode; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); + if (!Main.npc[CalamityGlobalNPC.holyBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; + + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + float num998 = 8f; + float scaleFactor3 = 300f; + float num999 = 800f; + float num1000 = 60f; + float num1001 = 5f; + float scaleFactor4 = 0.8f; + int num1002 = 0; + float scaleFactor5 = 10f; + float num1003 = 30f; + float num1004 = 150f; + float num1005 = 60f; + float num1006 = 0.333333343f; + float num1007 = 8f; + num1006 *= num1005; + int num1009 = (npc.ai[0] == 2f) ? 2 : 1; + int num1010 = (npc.ai[0] == 2f) ? 80 : 60; + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < num1009) + { + int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 244, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 0.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + if (Main.netMode != 1) + { + npc.localAI[0] += expertMode ? 2f : 1f; + if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + 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)) + { + Main.PlaySound(SoundID.Item20, npc.position); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int damage = expertMode ? 40 : 59; + int projectileShot = mod.ProjectileType("ProfanedSpear"); + int i; + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + npc.damage = expertMode ? 200 : 100; + if (npc.ai[0] == 0f) + { + npc.knockBackResist = 0f; + float scaleFactor6 = num998; + Vector2 center4 = npc.Center; + Vector2 center5 = Main.player[npc.target].Center; + Vector2 vector126 = center5 - center4; + Vector2 vector127 = vector126 - Vector2.UnitY * scaleFactor3; + float num1013 = vector126.Length(); + vector126 = Vector2.Normalize(vector126) * scaleFactor6; + vector127 = Vector2.Normalize(vector127) * scaleFactor6; + bool flag64 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (npc.ai[3] >= 120f) + { + flag64 = true; + } + float num1014 = 8f; + 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) / num1000; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; + if (!flag64) + { + npc.ai[3] += 1f; + if (npc.ai[3] == 120f) + { + npc.netUpdate = true; + } + } + else + { + npc.ai[3] = 0f; + } + } + else + { + npc.ai[0] = 1f; + npc.ai[2] = vector126.X; + npc.ai[3] = vector126.Y; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + npc.knockBackResist = 0f; + npc.velocity *= scaleFactor4; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1001) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2((float)Main.rand.Next(-num1002, num1002 + 1), (float)Main.rand.Next(-num1002, num1002 + 1)) * 0.04f; + velocity.Normalize(); + velocity *= scaleFactor5; + npc.velocity = velocity; + } + } + else if (npc.ai[0] == 2f) + { + if (Main.netMode != 1) + { + dustTimer--; + if (fireDust && dustTimer <= 0) + { + Main.PlaySound(SoundID.Item20, npc.position); + int damage = expertMode ? 40 : 59; + 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("FlareDust"), damage, 0f, Main.myPlayer, 0f, 0f); //changed + Main.projectile[projectile].timeLeft = 120; + Main.projectile[projectile].velocity.X = 0f; + Main.projectile[projectile].velocity.Y = 0f; + dustTimer = 3; + } + } + npc.damage = expertMode ? 240 : 120; + npc.knockBackResist = 0f; + float num1016 = num1003; + npc.ai[1] += 1f; + bool flag65 = Vector2.Distance(npc.Center, Main.player[npc.target].Center) > num1004 && npc.Center.Y > Main.player[npc.target].Center.Y; + if ((npc.ai[1] >= num1016 && flag65) || npc.velocity.Length() < num1007) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.velocity /= 2f; + npc.netUpdate = true; + npc.ai[1] = 45f; + npc.ai[0] = 3f; + } + else + { + Vector2 center6 = npc.Center; + Vector2 center7 = Main.player[npc.target].Center; + Vector2 vec2 = center7 - center6; + vec2.Normalize(); + if (vec2.HasNaNs()) + { + vec2 = new Vector2((float)npc.direction, 0f); + } + npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; + } + } + else if (npc.ai[0] == 3f) + { + npc.ai[1] -= 1f; + if (npc.ai[1] <= 0f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + npc.velocity *= 0.98f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + while (npc.ai[0] == 2f && Lighting.NotRetro && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + return false; + } + + public override bool CheckActive() + { + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 180); + } + player.AddBuff(BuffID.OnFire, 600, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); + for (int k = 0; k < 30; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 26c0963fc9..d8bff8e877 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1,1206 +1,1206 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Providence -{ - [AutoloadBossHead] - public class Providence : ModNPC - { - private bool text = false; - private bool useDefenseFrames = false; - private float bossLife; - private int flightPath = 0; - private int phaseChange = 0; - private int immuneTimer = 300; - private int frameUsed = 0; - private int healTimer = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Providence, the Profaned Goddess"); - Main.npcFrameCount[npc.type] = 3; - } - - public override void SetDefaults() - { - npc.npcSlots = 36f; - npc.damage = 100; - npc.width = 600; - npc.height = 450; - npc.defense = 50; - npc.lifeMax = CalamityWorld.revenge ? 500000 : 440000; - if (CalamityWorld.death) - { - npc.lifeMax = 715000; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.value = Item.buyPrice(0, 50, 0, 0); - npc.boss = true; - 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.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - npc.chaseable = true; - npc.canGhostHeal = false; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"); - else - music = MusicID.LunarBoss; - npc.HitSound = SoundID.NPCHit44; - npc.DeathSound = SoundID.NPCDeath46; - bossBag = mod.ItemType("ProvidenceBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(text); - writer.Write(useDefenseFrames); - writer.Write(phaseChange); - writer.Write(immuneTimer); - writer.Write(frameUsed); - writer.Write(healTimer); - writer.Write(flightPath); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - text = reader.ReadBoolean(); - useDefenseFrames = reader.ReadBoolean(); - phaseChange = reader.ReadInt32(); - immuneTimer = reader.ReadInt32(); - frameUsed = reader.ReadInt32(); - healTimer = reader.ReadInt32(); - flightPath = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - Vector2 vector = npc.Center; - npc.rotation = npc.velocity.X * 0.004f; - CalamityGlobalNPC.holyBoss = npc.whoAmI; - Player player = Main.player[npc.target]; - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool isHoly = player.ZoneHoly; - bool isHell = player.ZoneUnderworldHeight; - bool ignoreGuardianAmt = (double)npc.life <= (double)npc.lifeMax * 0.15; - bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.75; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.5; - - if (Vector2.Distance(player.Center, vector) > 2800f) - { - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("HolyInferno"), 2); - } - - int guardianAmt = 0; - bool healerAlive = false; - if (CalamityGlobalNPC.holyBossAttacker != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBossAttacker].active) - guardianAmt++; - } - if (CalamityGlobalNPC.holyBossDefender != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBossDefender].active) - guardianAmt++; - } - if (CalamityGlobalNPC.holyBossHealer != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBossHealer].active) - { - guardianAmt++; - healerAlive = true; - } - } - bool normalAttackRate = true; - if (guardianAmt > 0) - { - normalAttackRate = ignoreGuardianAmt; - } - npc.chaseable = normalAttackRate && npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f; - - if (Main.raining) - CalamityGlobalNPC.StopRain(); - - if (!isHoly && !isHell && !CalamityWorld.bossRushActive) - { - if (immuneTimer > 0) - immuneTimer--; - } - else - { - immuneTimer = 300; - } - npc.dontTakeDamage = (immuneTimer <= 0); - - if (healerAlive) - { - float heal = revenge ? 90f : 120f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - heal = 30f; - } - switch (guardianAmt) - { - case 1: - heal *= 2f; - break; - case 2: - break; - case 3: - heal *= 0.5f; - break; - } - healTimer++; - if (healTimer >= heal) - { - healTimer = 0; - if (Main.netMode != 1) - { - int healAmt = npc.lifeMax / 200; - if (healAmt > npc.lifeMax - npc.life) - { - healAmt = npc.lifeMax - npc.life; - } - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } - } - } - } - - if ((!Main.dayTime && npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f) || player.dead) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + 0.25f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.25f; - } - npc.velocity.Y = npc.velocity.Y - 0.25f; - } - else if (npc.timeLeft < 3600) - { - npc.timeLeft = 3600; - } - - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.66); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - 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)); - NPC.NewNPC(x - 100, y - 100, mod.NPCType("ProvSpawnDefense"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC(x + 100, y - 100, mod.NPCType("ProvSpawnHealer"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC(x, y + 100, mod.NPCType("ProvSpawnOffense"), 0, 0f, 0f, 0f, 0f, 255); - } - } - } - - if (npc.ai[0] != 2f && npc.ai[0] != 5f) - { - bool firingLaser = npc.ai[0] == 7f; - if (flightPath == 0) - { - npc.TargetClosest(true); - if (npc.Center.X < player.Center.X) - flightPath = 1; - else - flightPath = -1; - } - npc.TargetClosest(true); - int num851 = 800; - float num852 = Math.Abs(npc.Center.X - player.Center.X); - if (npc.Center.X < player.Center.X && flightPath < 0 && num852 > (float)num851) - { - flightPath = 0; - } - if (npc.Center.X > player.Center.X && flightPath > 0 && num852 > (float)num851) - { - flightPath = 0; - } - float num853 = expertMode ? 1.1f : 1.05f; - float num854 = expertMode ? 16f : 15f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num853 = expertMode ? 1.15f : 1.1f; - num854 = expertMode ? 17f : 16f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num853 = expertMode ? 1.2f : 1.15f; - num854 = expertMode ? 18f : 17f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num853 = expertMode ? 1.25f : 1.2f; - num854 = expertMode ? 19f : 18f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num853 = expertMode ? 1.3f : 1.25f; - num854 = expertMode ? 20f : 19f; - } - if (firingLaser) - { - num854 *= (normalAttackRate ? 0.5f : 0.25f); - num853 *= (normalAttackRate ? 0.5f : 0.25f); - } - npc.velocity.X = npc.velocity.X + (float)flightPath * num853; - if (npc.velocity.X > num854) - { - npc.velocity.X = num854; - } - if (npc.velocity.X < -num854) - { - npc.velocity.X = -num854; - } - float num855 = player.position.Y - (npc.position.Y + (float)npc.height); - if (num855 < (firingLaser ? 150f : 200f)) //150 - { - npc.velocity.Y = npc.velocity.Y - 0.2f; - } - if (num855 > (firingLaser ? 200f : 250f)) //200 - { - npc.velocity.Y = npc.velocity.Y + 0.2f; - } - float speedVariance = (normalAttackRate ? 3f : 1.5f); - if (npc.velocity.Y > (firingLaser ? speedVariance : 6f)) //8 - { - npc.velocity.Y = (firingLaser ? speedVariance : 6f); - } - if (npc.velocity.Y < (firingLaser ? -speedVariance : -6f)) //8 - { - npc.velocity.Y = (firingLaser ? -speedVariance : -6f); - } - } - - if (npc.ai[0] == -1f) - { - npc.noGravity = true; - npc.noTileCollide = true; - phaseChange++; - if (phaseChange > 14) - { - phaseChange = 0; - } - int phase = 0; //0 = blasts 1 = holy fire 2 = shell heal 3 = molten blobs 4 = holy bombs 5 = shell spears 6 = crystal 7 = laser - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - switch (phaseChange) - { - case 0: phase = 4; break; //1575 or 1500 - case 1: phase = 5; break; //1875 or 1800 - case 2: phase = 0; break; //2175 or 2100 - case 3: phase = phase2 ? 6 : 1; break; - case 4: phase = 2; break; //600 - case 5: phase = 4; break; //900 - case 6: phase = 1; break; //1200 - case 7: phase = 5; break; //1500 - case 8: - phase = phase3 ? 7 : 3; //1875 or 1800 - if (phase3) - { - npc.TargetClosest(false); - Vector2 v3 = player.Center - npc.Center - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - { - num1219 = 1f; - } - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - { - num1219 = 1f; - } - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; - } - break; - case 9: phase = 3; break; //2175 or 2100 - case 10: phase = phase2 ? 6 : 2; break; - case 11: phase = 4; break; //300 - case 12: - phase = phase3 ? 7 : 4; //675 or 600 - if (phase3) - { - npc.TargetClosest(false); - Vector2 v3 = player.Center - npc.Center - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - { - num1219 = 1f; - } - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - { - num1219 = 1f; - } - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; - } - break; - case 13: phase = 5; break; //975 or 900 - case 14: phase = 0; break; //1275 or 1200 - } - } - else - { - switch (phaseChange) - { - case 0: phase = 0; break; //3375 or 3300 - case 1: - phase = phase3 ? 7 : 1; //3750 or 3600 - if (phase3) - { - npc.TargetClosest(false); - Vector2 v3 = player.Center - npc.Center - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - { - num1219 = 1f; - } - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - { - num1219 = 1f; - } - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; - } - break; - case 2: phase = 3; break; //4050 or 3900 - case 3: phase = 4; break; //4350 or 4200 - case 4: phase = 5; break; //4650 or 4500 - case 5: phase = phase2 ? 6 : 4; break; - case 6: phase = 3; break; //300 - case 7: phase = 1; break; //600 - case 8: phase = 0; break; //900 - case 9: phase = 2; break; //1500 - case 10: phase = 4; break; //1800 - case 11: - phase = phase3 ? 7 : 0; //2175 or 2100 - if (phase3) - { - npc.TargetClosest(false); - Vector2 v3 = player.Center - npc.Center - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - { - num1219 = 1f; - } - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - { - num1219 = 1f; - } - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; - } - break; - case 12: phase = 3; break; //2475 or 2400 - case 13: phase = 1; break; //2775 or 2700 - case 14: phase = 5; break; //3075 or 3000 - } - } - npc.TargetClosest(true); - if (Math.Abs(npc.Center.X - player.Center.X) > 5600f) - { - phase = 0; - } - npc.ai[0] = (float)phase; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (npc.ai[0] == 0f) - { - npc.noGravity = true; - npc.noTileCollide = true; - float num852 = Math.Abs(npc.Center.X - player.Center.X); - if ((num852 < 500f || npc.ai[3] < 0f) && npc.position.Y < player.position.Y) - { - npc.ai[3] += 1f; - int num856 = expertMode ? 25 : 26; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num856 = expertMode ? 23 : 24; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num856 = expertMode ? 21 : 22; - } - if (!normalAttackRate) - { - num856 = expertMode ? 40 : 46; - } - num856++; - if (npc.ai[3] > (float)num856) - { - npc.ai[3] = (float)(-(float)num856); - } - if (npc.ai[3] == 0f && Main.netMode != 1) - { - Vector2 vector112 = new Vector2(npc.Center.X, npc.Center.Y); - vector112.X += npc.velocity.X * 7f; - float num857 = player.position.X + (float)player.width * 0.5f - vector112.X; - float num858 = player.Center.Y - vector112.Y; - float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); - float num860 = expertMode ? 10.25f : 9f; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num860 = expertMode ? 11.5f : 10f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num860 = expertMode ? 12.75f : 11f; - } - if (revenge) - { - num860 *= 1.15f; - } - num859 = num860 / num859; - num857 *= num859; - num858 *= num859; - int holyDamage = expertMode ? 46 : 63; - Projectile.NewProjectile(vector112.X, vector112.Y, num857, num858, mod.ProjectileType("HolyBlast"), holyDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (npc.ai[3] < 0f) - { - npc.ai[3] += 1f; - } - if (Main.netMode != 1) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 300f) - npc.ai[0] = -1f; - } - } - else if (npc.ai[0] == 1f) - { - npc.noGravity = true; - npc.noTileCollide = true; - if (Main.netMode != 1) - { - npc.ai[3] += 1f; - int num864 = expertMode ? 33 : 36; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num864 = expertMode ? 30 : 33; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num864 = expertMode ? 26 : 29; - } - if (!normalAttackRate) - { - num864 = expertMode ? 45 : 52; - } - num864 += 3; - if (npc.ai[3] >= (float)num864) - { - npc.ai[3] = 0f; - Vector2 vector113 = new Vector2(npc.Center.X, npc.position.Y + (float)npc.height - 14f); - float num865 = npc.velocity.Y; - if (num865 < 0f) - { - num865 = 0f; - } - num865 += expertMode ? 4f : 3f; - float speedX2 = npc.velocity.X * 0.25f; - int fireDamage = expertMode ? 40 : 59; //260 200 - Projectile.NewProjectile(vector113.X, vector113.Y, speedX2, num865, mod.ProjectileType("HolyFire"), fireDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - if (Main.netMode != 1) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 300f) - npc.ai[0] = -1f; - } - } - else if (npc.ai[0] == 2f) - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.TargetClosest(true); - Vector2 vector114 = new Vector2(npc.Center.X, npc.Center.Y - 20f); - float num866 = (float)Main.rand.Next(-1000, 1001); - float num867 = (float)Main.rand.Next(-1000, 1001); - float num868 = (float)Math.Sqrt((double)(num866 * num866 + num867 * num867)); - float num869 = 3f; - npc.velocity *= 0.95f; - num868 = num869 / num868; - num866 *= num868; - num867 *= num868; - vector114.X += num866 * 4f; - vector114.Y += num867 * 4f; - npc.ai[3] += 1f; - int num870 = expertMode ? 3 : 4; - if (!normalAttackRate) - { - num870 = expertMode ? 12 : 16; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) - { - num870 -= 2; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num870 -= 2; - } - if (npc.ai[3] > (float)num870) - { - npc.ai[3] = 0f; - if (Main.netMode != 1) - { - if (Main.rand.Next(4) == 0 && !CalamityWorld.death && !CalamityWorld.bossRushActive) - Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, mod.ProjectileType("HolyLight"), 0, 0f, Main.myPlayer, 0f, 0f); - else - Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, mod.ProjectileType("HolyBurnOrb"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.ai[1] += 1f; - if (npc.ai[1] > 450f && !text) - { - text = true; - string key = "Mods.CalamityMod.ProfanedBossText"; - 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); - } - if (npc.ai[1] > 600f) - { - if (Main.netMode != 2) - { - Player player2 = Main.player[Main.myPlayer]; - if (!player2.dead && player2.active && Vector2.Distance(player2.Center, vector) < 2800f) - { - Main.PlaySound(SoundID.Item20, player2.position); - player2.AddBuff(mod.BuffType("ExtremeGravity"), 3000, true); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), - player2.width, player2.height, 244, 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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), - player2.width, player2.height, 244, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), - player2.width, player2.height, 244, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - text = false; - npc.ai[0] = -1f; - } - } - else if (npc.ai[0] == 3f) - { - npc.noGravity = true; - npc.noTileCollide = true; - float num852 = Math.Abs(npc.Center.X - player.Center.X); - if ((num852 < 500f || npc.ai[3] < 0f) && npc.position.Y < player.position.Y) - { - npc.ai[3] += 1f; - int num856 = expertMode ? 10 : 11; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num856 = expertMode ? 9 : 10; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num856 = expertMode ? 8 : 9; - } - if (!normalAttackRate) - { - num856 = expertMode ? 30 : 35; - } - num856++; - if (npc.ai[3] > (float)num856) - { - npc.ai[3] = (float)(-(float)num856); - } - if (npc.ai[3] == 0f && Main.netMode != 1) - { - Vector2 vector112 = new Vector2(npc.Center.X, npc.Center.Y); - vector112.X += npc.velocity.X * 7f; - float num857 = player.position.X + (float)player.width * 0.5f - vector112.X; - float num858 = player.Center.Y - vector112.Y; - float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); - float num860 = expertMode ? 10.25f : 9f; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num860 = expertMode ? 11.5f : 10f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num860 = expertMode ? 12.75f : 11f; - } - if (revenge) - { - num860 *= 1.15f; - } - num859 = num860 / num859; - num857 *= num859; - num858 *= num859; - int holyDamage = expertMode ? 39 : 55; //280 210 - Projectile.NewProjectile(vector112.X, vector112.Y, num857 * 0.1f, num858, mod.ProjectileType("MoltenBlast"), holyDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (npc.ai[3] < 0f) - { - npc.ai[3] += 1f; - } - if (Main.netMode != 1) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 300f) - npc.ai[0] = -1f; - } - } - else if (npc.ai[0] == 4f) - { - npc.noGravity = true; - npc.noTileCollide = true; - if (Main.netMode != 1) - { - npc.ai[3] += 1f; - int num864 = expertMode ? 70 : 74; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num864 = expertMode ? 64 : 70; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num864 = expertMode ? 56 : 64; - } - if (!normalAttackRate) - { - num864 = expertMode ? 148 : 156; - } - num864 += 3; - if (npc.ai[3] >= (float)num864) - { - npc.ai[3] = 0f; - Vector2 vector113 = new Vector2(npc.Center.X, npc.position.Y + (float)npc.height - 14f); - int i2 = (int)(vector113.X / 16f); - int j2 = (int)(vector113.Y / 16f); - if (!WorldGen.SolidTile(i2, j2)) - { - float num865 = npc.velocity.Y; - if (num865 < 0f) - { - num865 = 0f; - } - num865 += expertMode ? 4f : 3f; - float speedX2 = npc.velocity.X * 0.25f; - int fireDamage = expertMode ? 44 : 60; //260 100 - Projectile.NewProjectile(vector113.X, vector113.Y, speedX2, num865, mod.ProjectileType("HolyBomb"), fireDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - if (Main.netMode != 1) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 300f) - npc.ai[0] = -1f; - } - } - else if (npc.ai[0] == 5f) - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.TargetClosest(true); - npc.velocity *= 0.95f; - if (Main.netMode != 1) - { - 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; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - npc.ai[2] += 1f; - } - if (npc.ai[2] > (normalAttackRate ? 24f : 60f)) - { - npc.ai[2] = 0f; - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = 10f; - if (expertMode) - { - num742 = 12f; - } - float num743 = player.position.X + (float)player.width * 0.5f - vector93.X; - float num744 = player.position.Y + (float)player.height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - int num746 = expertMode ? 48 : 65; //288 220 - int num747 = mod.ProjectileType("HolyShot"); - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + (float)Main.rand.Next(-100, 100), 0f, 0f, mod.ProjectileType("HolySpear"), num746, 0f, Main.myPlayer, (float)Main.rand.Next(2), 0f); - } - } - if (Main.netMode != 1) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 300f) - npc.ai[0] = -1f; - } - } - else if (npc.ai[0] == 6f) - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.TargetClosest(true); - npc.velocity *= 0.95f; - if (Main.netMode != 1) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 60f) - { - int damage = expertMode ? 52 : 70; //288 220 - Projectile.NewProjectile(player.Center.X, player.Center.Y - 360f, 0f, 0f, mod.ProjectileType("ProvidenceCrystal"), damage, 0f, player.whoAmI, 0f, 0f); - npc.ai[0] = -1f; - } - } - } - else if (npc.ai[0] == 7f) - { - npc.noGravity = true; - npc.noTileCollide = true; - Vector2 value19 = new Vector2(27f, 59f); - npc.ai[2] += 1f; - if (npc.ai[2] < 180f) - { - npc.localAI[1] -= 0.05f; - if (npc.localAI[1] < 0f) - { - npc.localAI[1] = 0f; - } - if (npc.ai[2] >= 60f) - { - Vector2 center20 = npc.Center; - int num1220 = 0; - if (npc.ai[2] >= 120f) - { - num1220 = 1; - } - int num; - for (int num1221 = 0; num1221 < 1 + num1220; num1221 = num + 1) - { - int num1222 = 244; - float num1223 = 1.2f; - if (num1221 % 2 == 1) - { - num1223 = 2.8f; - } - Vector2 vector199 = center20 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * value19 / 2f; - int num1224 = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, num1222, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default(Color), 1f); - Main.dust[num1224].velocity = Vector2.Normalize(center20 - vector199) * 3.5f * (10f - (float)num1220 * 2f) / 10f; - Main.dust[num1224].noGravity = true; - Main.dust[num1224].scale = num1223; - num = num1221; - } - } - } - else if (npc.ai[2] < 360f) - { - if (npc.ai[2] == 180f) - { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 2800f) - { - Main.PlaySound(29, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 104, 1f, 0f); - } - if (Main.netMode != 1) - { - npc.TargetClosest(false); - Vector2 vector200 = player.Center - npc.Center; - vector200.Normalize(); - float num1225 = -1f; - if (vector200.X < 0f) - { - num1225 = 1f; - } - vector200 = vector200.RotatedBy((double)(-(double)num1225 * 6.28318548f / 6f), default(Vector2)); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 16f, vector200.X, vector200.Y, mod.ProjectileType("ProvidenceHolyRay"), 100, 0f, Main.myPlayer, num1225 * 6.28318548f / 450f, (float)npc.whoAmI); - npc.ai[3] = (vector200.ToRotation() + 9.424778f) * num1225; //3.14159265f - npc.netUpdate = true; - } - } - npc.localAI[1] += 0.05f; - if (npc.localAI[1] > 1f) - { - npc.localAI[1] = 1f; - } - float num1226 = (float)(npc.ai[3] >= 0f).ToDirectionInt(); - float num1227 = npc.ai[3]; - if (num1227 < 0f) - { - num1227 *= -1f; - } - num1227 += -9.424778f; - num1227 += num1226 * 6.28318548f / 540f; - npc.localAI[0] = num1227; - } - else - { - npc.localAI[1] -= 0.07f; //15 - if (npc.localAI[1] < 0f) - npc.localAI[1] = 0f; - } - if (Main.netMode != 1) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 375f) - npc.ai[0] = -1f; - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return false; - } - - public override void NPCLoot() - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProvidenceTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - if (Main.player[npc.target].ZoneUnderworldHeight) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ElysianAegis"), 1, true); - } - else if (Main.player[npc.target].ZoneHoly) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ElysianWings"), 1, true); - } - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(20, 30)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DivineGeode"), Main.rand.Next(10, 16)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RuneofCos")); - if (Main.rand.Next(7) == 0) - { - 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")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HolyCollider")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MoltenAmputator")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurgeGuzzler")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SolarFlare")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TelluricGlare")); - } - } - if (Main.netMode != 1) - { - int num52 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num53 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - int num54 = npc.width / 2 / 16 + 1; - for (int num55 = num52 - num54; num55 <= num52 + num54; num55++) - { - for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) - { - if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55, num56].active()) - { - Main.tile[num55, num56].type = (ushort)mod.TileType("ProfanedRock"); - Main.tile[num55, num56].active(true); - } - Main.tile[num55, num56].lava(false); - Main.tile[num55, num56].liquid = 0; - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num55, num56, 1, TileChangeType.None); - } - else - { - WorldGen.SquareTileFrame(num55, num56, true); - } - } - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SuperHealingPotion; - } - - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - double newDamage = (damage + (int)((double)defense * 0.25)); - float protection = (((npc.ichor || npc.onFire2) ? 0.2f : 0.25f) + - ((npc.ai[0] == 2f || npc.ai[0] == 5f || npc.ai[0] == 7f) ? 0.65f : 0f)); //0.85 or 0.9 - if (newDamage < 1.0) - { - newDamage = 1.0; - } - 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) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = Main.npcTexture[npc.type]; - if (npc.ai[0] == 2f || npc.ai[0] == 5f) - { - if (!useDefenseFrames) - { - texture = mod.GetTexture("NPCs/Providence/ProvidenceDefense"); - } - else - { - texture = mod.GetTexture("NPCs/Providence/ProvidenceDefenseAlt"); - } - } - else - { - if (frameUsed == 0) - { - texture = Main.npcTexture[npc.type]; - } - else if (frameUsed == 1) - { - texture = mod.GetTexture("NPCs/Providence/ProvidenceAlt"); - } - else if (frameUsed == 2) - { - texture = mod.GetTexture("NPCs/Providence/ProvidenceAttack"); - } - else - { - texture = mod.GetTexture("NPCs/Providence/ProvidenceAttackAlt"); - } - } - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); - return false; - } - - public override void FindFrame(int frameHeight) //9 total frames - { - if (npc.ai[0] == 2f || npc.ai[0] == 5f) - { - if (!useDefenseFrames) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 5.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 3) - { - npc.frame.Y = 0; - useDefenseFrames = true; - } - } - else - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 5.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 2) - { - npc.frame.Y = frameHeight * 2; - } - } - } - else - { - if (useDefenseFrames) - { - useDefenseFrames = false; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 5.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y >= frameHeight * 3) //6 - { - npc.frame.Y = 0; - frameUsed++; - } - if (frameUsed > 3) - { - frameUsed = 0; - } - } - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - scale = 2f; - return null; - } - - 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 HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-50, 50) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence4"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 400; - npc.height = 350; - 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 < 60; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 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 < 90; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default(Color), 3f); - 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, 244, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Providence +{ + [AutoloadBossHead] + public class Providence : ModNPC + { + private bool text = false; + private bool useDefenseFrames = false; + private float bossLife; + private int flightPath = 0; + private int phaseChange = 0; + private int immuneTimer = 300; + private int frameUsed = 0; + private int healTimer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Providence, the Profaned Goddess"); + Main.npcFrameCount[npc.type] = 3; + } + + public override void SetDefaults() + { + npc.npcSlots = 36f; + npc.damage = 100; + npc.width = 600; + npc.height = 450; + npc.defense = 50; + npc.lifeMax = CalamityWorld.revenge ? 500000 : 440000; + if (CalamityWorld.death) + { + npc.lifeMax = 715000; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.value = Item.buyPrice(0, 50, 0, 0); + npc.boss = true; + 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.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + npc.chaseable = true; + npc.canGhostHeal = false; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"); + else + music = MusicID.LunarBoss; + npc.HitSound = SoundID.NPCHit44; + npc.DeathSound = SoundID.NPCDeath46; + bossBag = mod.ItemType("ProvidenceBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(text); + writer.Write(useDefenseFrames); + writer.Write(phaseChange); + writer.Write(immuneTimer); + writer.Write(frameUsed); + writer.Write(healTimer); + writer.Write(flightPath); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + text = reader.ReadBoolean(); + useDefenseFrames = reader.ReadBoolean(); + phaseChange = reader.ReadInt32(); + immuneTimer = reader.ReadInt32(); + frameUsed = reader.ReadInt32(); + healTimer = reader.ReadInt32(); + flightPath = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + Vector2 vector = npc.Center; + npc.rotation = npc.velocity.X * 0.004f; + CalamityGlobalNPC.holyBoss = npc.whoAmI; + Player player = Main.player[npc.target]; + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool isHoly = player.ZoneHoly; + bool isHell = player.ZoneUnderworldHeight; + bool ignoreGuardianAmt = (double)npc.life <= (double)npc.lifeMax * 0.15; + bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.75; + bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.5; + + if (Vector2.Distance(player.Center, vector) > 2800f) + { + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("HolyInferno"), 2); + } + + int guardianAmt = 0; + bool healerAlive = false; + if (CalamityGlobalNPC.holyBossAttacker != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBossAttacker].active) + guardianAmt++; + } + if (CalamityGlobalNPC.holyBossDefender != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBossDefender].active) + guardianAmt++; + } + if (CalamityGlobalNPC.holyBossHealer != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBossHealer].active) + { + guardianAmt++; + healerAlive = true; + } + } + bool normalAttackRate = true; + if (guardianAmt > 0) + { + normalAttackRate = ignoreGuardianAmt; + } + npc.chaseable = normalAttackRate && npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f; + + if (Main.raining) + CalamityGlobalNPC.StopRain(); + + if (!isHoly && !isHell && !CalamityWorld.bossRushActive) + { + if (immuneTimer > 0) + immuneTimer--; + } + else + { + immuneTimer = 300; + } + npc.dontTakeDamage = (immuneTimer <= 0); + + if (healerAlive) + { + float heal = revenge ? 90f : 120f; + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + heal = 30f; + } + switch (guardianAmt) + { + case 1: + heal *= 2f; + break; + case 2: + break; + case 3: + heal *= 0.5f; + break; + } + healTimer++; + if (healTimer >= heal) + { + healTimer = 0; + if (Main.netMode != 1) + { + int healAmt = npc.lifeMax / 200; + if (healAmt > npc.lifeMax - npc.life) + { + healAmt = npc.lifeMax - npc.life; + } + if (healAmt > 0) + { + npc.life += healAmt; + npc.HealEffect(healAmt, true); + npc.netUpdate = true; + } + } + } + } + + if ((!Main.dayTime && npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f) || player.dead) + { + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + 0.25f; + } + else + { + npc.velocity.X = npc.velocity.X - 0.25f; + } + npc.velocity.Y = npc.velocity.Y - 0.25f; + } + else if (npc.timeLeft < 3600) + { + npc.timeLeft = 3600; + } + + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.66); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + 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)); + NPC.NewNPC(x - 100, y - 100, mod.NPCType("ProvSpawnDefense"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(x + 100, y - 100, mod.NPCType("ProvSpawnHealer"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(x, y + 100, mod.NPCType("ProvSpawnOffense"), 0, 0f, 0f, 0f, 0f, 255); + } + } + } + + if (npc.ai[0] != 2f && npc.ai[0] != 5f) + { + bool firingLaser = npc.ai[0] == 7f; + if (flightPath == 0) + { + npc.TargetClosest(true); + if (npc.Center.X < player.Center.X) + flightPath = 1; + else + flightPath = -1; + } + npc.TargetClosest(true); + int num851 = 800; + float num852 = Math.Abs(npc.Center.X - player.Center.X); + if (npc.Center.X < player.Center.X && flightPath < 0 && num852 > (float)num851) + { + flightPath = 0; + } + if (npc.Center.X > player.Center.X && flightPath > 0 && num852 > (float)num851) + { + flightPath = 0; + } + float num853 = expertMode ? 1.1f : 1.05f; + float num854 = expertMode ? 16f : 15f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num853 = expertMode ? 1.15f : 1.1f; + num854 = expertMode ? 17f : 16f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num853 = expertMode ? 1.2f : 1.15f; + num854 = expertMode ? 18f : 17f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num853 = expertMode ? 1.25f : 1.2f; + num854 = expertMode ? 19f : 18f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num853 = expertMode ? 1.3f : 1.25f; + num854 = expertMode ? 20f : 19f; + } + if (firingLaser) + { + num854 *= (normalAttackRate ? 0.5f : 0.25f); + num853 *= (normalAttackRate ? 0.5f : 0.25f); + } + npc.velocity.X = npc.velocity.X + (float)flightPath * num853; + if (npc.velocity.X > num854) + { + npc.velocity.X = num854; + } + if (npc.velocity.X < -num854) + { + npc.velocity.X = -num854; + } + float num855 = player.position.Y - (npc.position.Y + (float)npc.height); + if (num855 < (firingLaser ? 150f : 200f)) //150 + { + npc.velocity.Y = npc.velocity.Y - 0.2f; + } + if (num855 > (firingLaser ? 200f : 250f)) //200 + { + npc.velocity.Y = npc.velocity.Y + 0.2f; + } + float speedVariance = (normalAttackRate ? 3f : 1.5f); + if (npc.velocity.Y > (firingLaser ? speedVariance : 6f)) //8 + { + npc.velocity.Y = (firingLaser ? speedVariance : 6f); + } + if (npc.velocity.Y < (firingLaser ? -speedVariance : -6f)) //8 + { + npc.velocity.Y = (firingLaser ? -speedVariance : -6f); + } + } + + if (npc.ai[0] == -1f) + { + npc.noGravity = true; + npc.noTileCollide = true; + phaseChange++; + if (phaseChange > 14) + { + phaseChange = 0; + } + int phase = 0; //0 = blasts 1 = holy fire 2 = shell heal 3 = molten blobs 4 = holy bombs 5 = shell spears 6 = crystal 7 = laser + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + switch (phaseChange) + { + case 0: phase = 4; break; //1575 or 1500 + case 1: phase = 5; break; //1875 or 1800 + case 2: phase = 0; break; //2175 or 2100 + case 3: phase = phase2 ? 6 : 1; break; + case 4: phase = 2; break; //600 + case 5: phase = 4; break; //900 + case 6: phase = 1; break; //1200 + case 7: phase = 5; break; //1500 + case 8: + phase = phase3 ? 7 : 3; //1875 or 1800 + if (phase3) + { + npc.TargetClosest(false); + Vector2 v3 = player.Center - npc.Center - new Vector2(0f, -22f); + float num1219 = v3.Length() / 500f; + if (num1219 > 1f) + { + num1219 = 1f; + } + num1219 = 1f - num1219; + num1219 *= 2f; + if (num1219 > 1f) + { + num1219 = 1f; + } + npc.localAI[0] = v3.ToRotation(); + npc.localAI[1] = num1219; + } + break; + case 9: phase = 3; break; //2175 or 2100 + case 10: phase = phase2 ? 6 : 2; break; + case 11: phase = 4; break; //300 + case 12: + phase = phase3 ? 7 : 4; //675 or 600 + if (phase3) + { + npc.TargetClosest(false); + Vector2 v3 = player.Center - npc.Center - new Vector2(0f, -22f); + float num1219 = v3.Length() / 500f; + if (num1219 > 1f) + { + num1219 = 1f; + } + num1219 = 1f - num1219; + num1219 *= 2f; + if (num1219 > 1f) + { + num1219 = 1f; + } + npc.localAI[0] = v3.ToRotation(); + npc.localAI[1] = num1219; + } + break; + case 13: phase = 5; break; //975 or 900 + case 14: phase = 0; break; //1275 or 1200 + } + } + else + { + switch (phaseChange) + { + case 0: phase = 0; break; //3375 or 3300 + case 1: + phase = phase3 ? 7 : 1; //3750 or 3600 + if (phase3) + { + npc.TargetClosest(false); + Vector2 v3 = player.Center - npc.Center - new Vector2(0f, -22f); + float num1219 = v3.Length() / 500f; + if (num1219 > 1f) + { + num1219 = 1f; + } + num1219 = 1f - num1219; + num1219 *= 2f; + if (num1219 > 1f) + { + num1219 = 1f; + } + npc.localAI[0] = v3.ToRotation(); + npc.localAI[1] = num1219; + } + break; + case 2: phase = 3; break; //4050 or 3900 + case 3: phase = 4; break; //4350 or 4200 + case 4: phase = 5; break; //4650 or 4500 + case 5: phase = phase2 ? 6 : 4; break; + case 6: phase = 3; break; //300 + case 7: phase = 1; break; //600 + case 8: phase = 0; break; //900 + case 9: phase = 2; break; //1500 + case 10: phase = 4; break; //1800 + case 11: + phase = phase3 ? 7 : 0; //2175 or 2100 + if (phase3) + { + npc.TargetClosest(false); + Vector2 v3 = player.Center - npc.Center - new Vector2(0f, -22f); + float num1219 = v3.Length() / 500f; + if (num1219 > 1f) + { + num1219 = 1f; + } + num1219 = 1f - num1219; + num1219 *= 2f; + if (num1219 > 1f) + { + num1219 = 1f; + } + npc.localAI[0] = v3.ToRotation(); + npc.localAI[1] = num1219; + } + break; + case 12: phase = 3; break; //2475 or 2400 + case 13: phase = 1; break; //2775 or 2700 + case 14: phase = 5; break; //3075 or 3000 + } + } + npc.TargetClosest(true); + if (Math.Abs(npc.Center.X - player.Center.X) > 5600f) + { + phase = 0; + } + npc.ai[0] = (float)phase; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (npc.ai[0] == 0f) + { + npc.noGravity = true; + npc.noTileCollide = true; + float num852 = Math.Abs(npc.Center.X - player.Center.X); + if ((num852 < 500f || npc.ai[3] < 0f) && npc.position.Y < player.position.Y) + { + npc.ai[3] += 1f; + int num856 = expertMode ? 25 : 26; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num856 = expertMode ? 23 : 24; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num856 = expertMode ? 21 : 22; + } + if (!normalAttackRate) + { + num856 = expertMode ? 40 : 46; + } + num856++; + if (npc.ai[3] > (float)num856) + { + npc.ai[3] = (float)(-(float)num856); + } + if (npc.ai[3] == 0f && Main.netMode != 1) + { + Vector2 vector112 = new Vector2(npc.Center.X, npc.Center.Y); + vector112.X += npc.velocity.X * 7f; + float num857 = player.position.X + (float)player.width * 0.5f - vector112.X; + float num858 = player.Center.Y - vector112.Y; + float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); + float num860 = expertMode ? 10.25f : 9f; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num860 = expertMode ? 11.5f : 10f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num860 = expertMode ? 12.75f : 11f; + } + if (revenge) + { + num860 *= 1.15f; + } + num859 = num860 / num859; + num857 *= num859; + num858 *= num859; + int holyDamage = expertMode ? 46 : 63; + Projectile.NewProjectile(vector112.X, vector112.Y, num857, num858, mod.ProjectileType("HolyBlast"), holyDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (npc.ai[3] < 0f) + { + npc.ai[3] += 1f; + } + if (Main.netMode != 1) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 300f) + npc.ai[0] = -1f; + } + } + else if (npc.ai[0] == 1f) + { + npc.noGravity = true; + npc.noTileCollide = true; + if (Main.netMode != 1) + { + npc.ai[3] += 1f; + int num864 = expertMode ? 33 : 36; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num864 = expertMode ? 30 : 33; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num864 = expertMode ? 26 : 29; + } + if (!normalAttackRate) + { + num864 = expertMode ? 45 : 52; + } + num864 += 3; + if (npc.ai[3] >= (float)num864) + { + npc.ai[3] = 0f; + Vector2 vector113 = new Vector2(npc.Center.X, npc.position.Y + (float)npc.height - 14f); + float num865 = npc.velocity.Y; + if (num865 < 0f) + { + num865 = 0f; + } + num865 += expertMode ? 4f : 3f; + float speedX2 = npc.velocity.X * 0.25f; + int fireDamage = expertMode ? 40 : 59; //260 200 + Projectile.NewProjectile(vector113.X, vector113.Y, speedX2, num865, mod.ProjectileType("HolyFire"), fireDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + if (Main.netMode != 1) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 300f) + npc.ai[0] = -1f; + } + } + else if (npc.ai[0] == 2f) + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.TargetClosest(true); + Vector2 vector114 = new Vector2(npc.Center.X, npc.Center.Y - 20f); + float num866 = (float)Main.rand.Next(-1000, 1001); + float num867 = (float)Main.rand.Next(-1000, 1001); + float num868 = (float)Math.Sqrt((double)(num866 * num866 + num867 * num867)); + float num869 = 3f; + npc.velocity *= 0.95f; + num868 = num869 / num868; + num866 *= num868; + num867 *= num868; + vector114.X += num866 * 4f; + vector114.Y += num867 * 4f; + npc.ai[3] += 1f; + int num870 = expertMode ? 3 : 4; + if (!normalAttackRate) + { + num870 = expertMode ? 12 : 16; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + { + num870 -= 2; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num870 -= 2; + } + if (npc.ai[3] > (float)num870) + { + npc.ai[3] = 0f; + if (Main.netMode != 1) + { + if (Main.rand.Next(4) == 0 && !CalamityWorld.death && !CalamityWorld.bossRushActive) + Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, mod.ProjectileType("HolyLight"), 0, 0f, Main.myPlayer, 0f, 0f); + else + Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, mod.ProjectileType("HolyBurnOrb"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[1] += 1f; + if (npc.ai[1] > 450f && !text) + { + text = true; + string key = "Mods.CalamityMod.ProfanedBossText"; + 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); + } + if (npc.ai[1] > 600f) + { + if (Main.netMode != 2) + { + Player player2 = Main.player[Main.myPlayer]; + if (!player2.dead && player2.active && Vector2.Distance(player2.Center, vector) < 2800f) + { + Main.PlaySound(SoundID.Item20, player2.position); + player2.AddBuff(mod.BuffType("ExtremeGravity"), 3000, true); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + player2.width, player2.height, 244, 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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + player2.width, player2.height, 244, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + player2.width, player2.height, 244, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + text = false; + npc.ai[0] = -1f; + } + } + else if (npc.ai[0] == 3f) + { + npc.noGravity = true; + npc.noTileCollide = true; + float num852 = Math.Abs(npc.Center.X - player.Center.X); + if ((num852 < 500f || npc.ai[3] < 0f) && npc.position.Y < player.position.Y) + { + npc.ai[3] += 1f; + int num856 = expertMode ? 10 : 11; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num856 = expertMode ? 9 : 10; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num856 = expertMode ? 8 : 9; + } + if (!normalAttackRate) + { + num856 = expertMode ? 30 : 35; + } + num856++; + if (npc.ai[3] > (float)num856) + { + npc.ai[3] = (float)(-(float)num856); + } + if (npc.ai[3] == 0f && Main.netMode != 1) + { + Vector2 vector112 = new Vector2(npc.Center.X, npc.Center.Y); + vector112.X += npc.velocity.X * 7f; + float num857 = player.position.X + (float)player.width * 0.5f - vector112.X; + float num858 = player.Center.Y - vector112.Y; + float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); + float num860 = expertMode ? 10.25f : 9f; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num860 = expertMode ? 11.5f : 10f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num860 = expertMode ? 12.75f : 11f; + } + if (revenge) + { + num860 *= 1.15f; + } + num859 = num860 / num859; + num857 *= num859; + num858 *= num859; + int holyDamage = expertMode ? 39 : 55; //280 210 + Projectile.NewProjectile(vector112.X, vector112.Y, num857 * 0.1f, num858, mod.ProjectileType("MoltenBlast"), holyDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (npc.ai[3] < 0f) + { + npc.ai[3] += 1f; + } + if (Main.netMode != 1) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 300f) + npc.ai[0] = -1f; + } + } + else if (npc.ai[0] == 4f) + { + npc.noGravity = true; + npc.noTileCollide = true; + if (Main.netMode != 1) + { + npc.ai[3] += 1f; + int num864 = expertMode ? 70 : 74; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num864 = expertMode ? 64 : 70; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num864 = expertMode ? 56 : 64; + } + if (!normalAttackRate) + { + num864 = expertMode ? 148 : 156; + } + num864 += 3; + if (npc.ai[3] >= (float)num864) + { + npc.ai[3] = 0f; + Vector2 vector113 = new Vector2(npc.Center.X, npc.position.Y + (float)npc.height - 14f); + int i2 = (int)(vector113.X / 16f); + int j2 = (int)(vector113.Y / 16f); + if (!WorldGen.SolidTile(i2, j2)) + { + float num865 = npc.velocity.Y; + if (num865 < 0f) + { + num865 = 0f; + } + num865 += expertMode ? 4f : 3f; + float speedX2 = npc.velocity.X * 0.25f; + int fireDamage = expertMode ? 44 : 60; //260 100 + Projectile.NewProjectile(vector113.X, vector113.Y, speedX2, num865, mod.ProjectileType("HolyBomb"), fireDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + if (Main.netMode != 1) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 300f) + npc.ai[0] = -1f; + } + } + else if (npc.ai[0] == 5f) + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + if (Main.netMode != 1) + { + 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; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + npc.ai[2] += 1f; + } + if (npc.ai[2] > (normalAttackRate ? 24f : 60f)) + { + npc.ai[2] = 0f; + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = 10f; + if (expertMode) + { + num742 = 12f; + } + float num743 = player.position.X + (float)player.width * 0.5f - vector93.X; + float num744 = player.position.Y + (float)player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + int num746 = expertMode ? 48 : 65; //288 220 + int num747 = mod.ProjectileType("HolyShot"); + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + (float)Main.rand.Next(-100, 100), 0f, 0f, mod.ProjectileType("HolySpear"), num746, 0f, Main.myPlayer, (float)Main.rand.Next(2), 0f); + } + } + if (Main.netMode != 1) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 300f) + npc.ai[0] = -1f; + } + } + else if (npc.ai[0] == 6f) + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + if (Main.netMode != 1) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 60f) + { + int damage = expertMode ? 52 : 70; //288 220 + Projectile.NewProjectile(player.Center.X, player.Center.Y - 360f, 0f, 0f, mod.ProjectileType("ProvidenceCrystal"), damage, 0f, player.whoAmI, 0f, 0f); + npc.ai[0] = -1f; + } + } + } + else if (npc.ai[0] == 7f) + { + npc.noGravity = true; + npc.noTileCollide = true; + Vector2 value19 = new Vector2(27f, 59f); + npc.ai[2] += 1f; + if (npc.ai[2] < 180f) + { + npc.localAI[1] -= 0.05f; + if (npc.localAI[1] < 0f) + { + npc.localAI[1] = 0f; + } + if (npc.ai[2] >= 60f) + { + Vector2 center20 = npc.Center; + int num1220 = 0; + if (npc.ai[2] >= 120f) + { + num1220 = 1; + } + int num; + for (int num1221 = 0; num1221 < 1 + num1220; num1221 = num + 1) + { + int num1222 = 244; + float num1223 = 1.2f; + if (num1221 % 2 == 1) + { + num1223 = 2.8f; + } + Vector2 vector199 = center20 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * value19 / 2f; + int num1224 = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, num1222, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, default(Color), 1f); + Main.dust[num1224].velocity = Vector2.Normalize(center20 - vector199) * 3.5f * (10f - (float)num1220 * 2f) / 10f; + Main.dust[num1224].noGravity = true; + Main.dust[num1224].scale = num1223; + num = num1221; + } + } + } + else if (npc.ai[2] < 360f) + { + if (npc.ai[2] == 180f) + { + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 2800f) + { + Main.PlaySound(29, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 104, 1f, 0f); + } + if (Main.netMode != 1) + { + npc.TargetClosest(false); + Vector2 vector200 = player.Center - npc.Center; + vector200.Normalize(); + float num1225 = -1f; + if (vector200.X < 0f) + { + num1225 = 1f; + } + vector200 = vector200.RotatedBy((double)(-(double)num1225 * 6.28318548f / 6f), default(Vector2)); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 16f, vector200.X, vector200.Y, mod.ProjectileType("ProvidenceHolyRay"), 100, 0f, Main.myPlayer, num1225 * 6.28318548f / 450f, (float)npc.whoAmI); + npc.ai[3] = (vector200.ToRotation() + 9.424778f) * num1225; //3.14159265f + npc.netUpdate = true; + } + } + npc.localAI[1] += 0.05f; + if (npc.localAI[1] > 1f) + { + npc.localAI[1] = 1f; + } + float num1226 = (float)(npc.ai[3] >= 0f).ToDirectionInt(); + float num1227 = npc.ai[3]; + if (num1227 < 0f) + { + num1227 *= -1f; + } + num1227 += -9.424778f; + num1227 += num1226 * 6.28318548f / 540f; + npc.localAI[0] = num1227; + } + else + { + npc.localAI[1] -= 0.07f; //15 + if (npc.localAI[1] < 0f) + npc.localAI[1] = 0f; + } + if (Main.netMode != 1) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 375f) + npc.ai[0] = -1f; + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return false; + } + + public override void NPCLoot() + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProvidenceTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + if (Main.player[npc.target].ZoneUnderworldHeight) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ElysianAegis"), 1, true); + } + else if (Main.player[npc.target].ZoneHoly) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ElysianWings"), 1, true); + } + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(20, 30)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DivineGeode"), Main.rand.Next(10, 16)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RuneofCos")); + if (Main.rand.Next(7) == 0) + { + 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")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HolyCollider")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MoltenAmputator")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurgeGuzzler")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SolarFlare")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TelluricGlare")); + } + } + if (Main.netMode != 1) + { + int num52 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num53 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num54 = npc.width / 2 / 16 + 1; + for (int num55 = num52 - num54; num55 <= num52 + num54; num55++) + { + for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) + { + if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55, num56].active()) + { + Main.tile[num55, num56].type = (ushort)mod.TileType("ProfanedRock"); + Main.tile[num55, num56].active(true); + } + Main.tile[num55, num56].lava(false); + Main.tile[num55, num56].liquid = 0; + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, num55, num56, 1, TileChangeType.None); + } + else + { + WorldGen.SquareTileFrame(num55, num56, true); + } + } + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SuperHealingPotion; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + double newDamage = (damage + (int)((double)defense * 0.25)); + float protection = (((npc.ichor || npc.onFire2) ? 0.2f : 0.25f) + + ((npc.ai[0] == 2f || npc.ai[0] == 5f || npc.ai[0] == 7f) ? 0.65f : 0f)); //0.85 or 0.9 + if (newDamage < 1.0) + { + newDamage = 1.0; + } + 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) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = Main.npcTexture[npc.type]; + if (npc.ai[0] == 2f || npc.ai[0] == 5f) + { + if (!useDefenseFrames) + { + texture = mod.GetTexture("NPCs/Providence/ProvidenceDefense"); + } + else + { + texture = mod.GetTexture("NPCs/Providence/ProvidenceDefenseAlt"); + } + } + else + { + if (frameUsed == 0) + { + texture = Main.npcTexture[npc.type]; + } + else if (frameUsed == 1) + { + texture = mod.GetTexture("NPCs/Providence/ProvidenceAlt"); + } + else if (frameUsed == 2) + { + texture = mod.GetTexture("NPCs/Providence/ProvidenceAttack"); + } + else + { + texture = mod.GetTexture("NPCs/Providence/ProvidenceAttackAlt"); + } + } + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); + return false; + } + + public override void FindFrame(int frameHeight) //9 total frames + { + if (npc.ai[0] == 2f || npc.ai[0] == 5f) + { + if (!useDefenseFrames) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 5.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 3) + { + npc.frame.Y = 0; + useDefenseFrames = true; + } + } + else + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 5.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 2) + { + npc.frame.Y = frameHeight * 2; + } + } + } + else + { + if (useDefenseFrames) + { + useDefenseFrames = false; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 5.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y >= frameHeight * 3) //6 + { + npc.frame.Y = 0; + frameUsed++; + } + if (frameUsed > 3) + { + frameUsed = 0; + } + } + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 2f; + return null; + } + + 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 HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-50, 50) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/Providence4"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 400; + npc.height = 350; + 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 < 60; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 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 < 90; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default(Color), 3f); + 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, 244, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/Scavenger/FlamePillar.cs b/NPCs/Scavenger/FlamePillar.cs index e81c112ff0..f7e6f525a2 100644 --- a/NPCs/Scavenger/FlamePillar.cs +++ b/NPCs/Scavenger/FlamePillar.cs @@ -1,168 +1,168 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Scavenger -{ - public class FlamePillar : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame Pillar"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 1f; - npc.width = 40; //324 - npc.height = 150; //216 - npc.defense = 0; - npc.lifeMax = 100; - npc.alpha = 255; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - } - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - 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() - { - bool provy = CalamityWorld.downedProvidence; - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.dontTakeDamage = false; - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.alpha > 0) - { - npc.alpha -= 3; - if (npc.alpha < 0) - { - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) - { - npc.damage = 400; - } - else - { - npc.damage = Main.expertMode ? 250 : 180; - } - npc.alpha = 0; - } - } - if (npc.ai[0] == 0f) - { - npc.noTileCollide = false; - npc.ai[1] += 1f; - if (npc.ai[1] >= 180f) - { - npc.ai[0] = 1f; - } - } - else if (npc.ai[0] == 1f) - { - if (npc.ai[1] >= 0f) - { - npc.ai[1] -= 1f; - npc.localAI[0] += 1f; - float SpeedX = (float)Main.rand.Next(-6, 7); - float SpeedY = (float)Main.rand.Next(-12, -8); - if (npc.localAI[0] >= 60f) - { - if (Main.netMode != 1) - { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - int damage = Main.expertMode ? 32 : 45; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, SpeedX, SpeedY, mod.ProjectileType("RavagerFlame"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - npc.localAI[0] = 0f; - npc.netUpdate = true; - } - } - else - { - npc.dontTakeDamage = false; - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; - return; - } - } - if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - int distanceFromTarget = 8000; - 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) - { - npc.active = false; - npc.netUpdate = true; - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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 = 180; - 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 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 135, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default(Color), 3f); - 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, 8, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Scavenger +{ + public class FlamePillar : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame Pillar"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 1f; + npc.width = 40; //324 + npc.height = 150; //216 + npc.defense = 0; + npc.lifeMax = 100; + npc.alpha = 255; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + npc.buffImmune[BuffID.Ichor] = false; + } + npc.dontTakeDamage = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + 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() + { + bool provy = CalamityWorld.downedProvidence; + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.dontTakeDamage = false; + npc.life = 0; + HitEffect(npc.direction, 9999); + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.alpha > 0) + { + npc.alpha -= 3; + if (npc.alpha < 0) + { + if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) + { + npc.damage = 400; + } + else + { + npc.damage = Main.expertMode ? 250 : 180; + } + npc.alpha = 0; + } + } + if (npc.ai[0] == 0f) + { + npc.noTileCollide = false; + npc.ai[1] += 1f; + if (npc.ai[1] >= 180f) + { + npc.ai[0] = 1f; + } + } + else if (npc.ai[0] == 1f) + { + if (npc.ai[1] >= 0f) + { + npc.ai[1] -= 1f; + npc.localAI[0] += 1f; + float SpeedX = (float)Main.rand.Next(-6, 7); + float SpeedY = (float)Main.rand.Next(-12, -8); + if (npc.localAI[0] >= 60f) + { + if (Main.netMode != 1) + { + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + int damage = Main.expertMode ? 32 : 45; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, SpeedX, SpeedY, mod.ProjectileType("RavagerFlame"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + npc.localAI[0] = 0f; + npc.netUpdate = true; + } + } + else + { + npc.dontTakeDamage = false; + npc.life = 0; + HitEffect(npc.direction, 9999); + npc.netUpdate = true; + return; + } + } + if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + int distanceFromTarget = 8000; + 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) + { + npc.active = false; + npc.netUpdate = true; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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 = 180; + 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 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 135, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default(Color), 3f); + 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, 8, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/Scavenger/RockPillar.cs b/NPCs/Scavenger/RockPillar.cs index 7dcf4be3cd..c767ef0cd4 100644 --- a/NPCs/Scavenger/RockPillar.cs +++ b/NPCs/Scavenger/RockPillar.cs @@ -1,207 +1,207 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Scavenger -{ - public class RockPillar : ModNPC - { - int tileCollideCounter = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rock Pillar"); - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 1f; - npc.width = 60; //324 - npc.height = 300; //216 - npc.defense = 0; - npc.lifeMax = 100; - npc.alpha = 255; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - } - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override void AI() - { - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.dontTakeDamage = false; - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Math.Abs(npc.velocity.X) > 0.5f) - { - if (tileCollideCounter < 210) - { - tileCollideCounter++; - npc.noTileCollide = true; - } - else - { - npc.noTileCollide = false; - } - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) - { - npc.damage = 400; - } - else - { - npc.damage = Main.expertMode ? 250 : 180; - } - } - else - { - npc.noTileCollide = false; - npc.damage = 0; - } - if (npc.ai[0] == 0f) - { - 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] >= 300f) - { - npc.ai[1] = -20f; - } - else if (npc.ai[1] == -1f) - { - npc.TargetClosest(true); - npc.velocity.X = (float)(4 * npc.direction); - npc.velocity.Y = -24.5f; - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - } - } - else if (npc.ai[0] == 1f) - { - if (npc.velocity.Y == 0f) - { - Main.PlaySound(SoundID.Item14, npc.position); - npc.ai[0] = 0f; - npc.dontTakeDamage = false; - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; - return; - } - 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) - { - npc.velocity.X = npc.velocity.X * 0.9f; - npc.velocity.Y = npc.velocity.Y + 0.2f; - } - 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 random = (float)Main.rand.Next(7); - float velocityX = 6f + random; - if (npc.velocity.X < -velocityX) - { - npc.velocity.X = -velocityX; - } - if (npc.velocity.X > velocityX) - { - npc.velocity.X = velocityX; - } - } - } - } - if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - int distanceFromTarget = 8000; - 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) - { - npc.active = false; - npc.netUpdate = true; - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 80; - npc.height = 360; - 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 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default(Color), 3f); - 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, 8, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Scavenger +{ + public class RockPillar : ModNPC + { + int tileCollideCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rock Pillar"); + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 1f; + npc.width = 60; //324 + npc.height = 300; //216 + npc.defense = 0; + npc.lifeMax = 100; + npc.alpha = 255; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + npc.buffImmune[BuffID.Ichor] = false; + } + npc.dontTakeDamage = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override void AI() + { + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.dontTakeDamage = false; + npc.life = 0; + HitEffect(npc.direction, 9999); + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Math.Abs(npc.velocity.X) > 0.5f) + { + if (tileCollideCounter < 210) + { + tileCollideCounter++; + npc.noTileCollide = true; + } + else + { + npc.noTileCollide = false; + } + if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) + { + npc.damage = 400; + } + else + { + npc.damage = Main.expertMode ? 250 : 180; + } + } + else + { + npc.noTileCollide = false; + npc.damage = 0; + } + if (npc.ai[0] == 0f) + { + 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] >= 300f) + { + npc.ai[1] = -20f; + } + else if (npc.ai[1] == -1f) + { + npc.TargetClosest(true); + npc.velocity.X = (float)(4 * npc.direction); + npc.velocity.Y = -24.5f; + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + } + } + else if (npc.ai[0] == 1f) + { + if (npc.velocity.Y == 0f) + { + Main.PlaySound(SoundID.Item14, npc.position); + npc.ai[0] = 0f; + npc.dontTakeDamage = false; + npc.life = 0; + HitEffect(npc.direction, 9999); + npc.netUpdate = true; + return; + } + 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) + { + npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.Y = npc.velocity.Y + 0.2f; + } + 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 random = (float)Main.rand.Next(7); + float velocityX = 6f + random; + if (npc.velocity.X < -velocityX) + { + npc.velocity.X = -velocityX; + } + if (npc.velocity.X > velocityX) + { + npc.velocity.X = velocityX; + } + } + } + } + if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + int distanceFromTarget = 8000; + 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) + { + npc.active = false; + npc.netUpdate = true; + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 80; + npc.height = 360; + 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 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default(Color), 3f); + 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, 8, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/Scavenger/ScavengerBody.cs b/NPCs/Scavenger/ScavengerBody.cs index daa79ff659..a18069093e 100644 --- a/NPCs/Scavenger/ScavengerBody.cs +++ b/NPCs/Scavenger/ScavengerBody.cs @@ -1,643 +1,643 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Scavenger -{ - [AutoloadBossHead] - public class ScavengerBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - Main.npcFrameCount[npc.type] = 7; - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.npcSlots = 20f; - npc.aiStyle = -1; - npc.damage = 100; - npc.width = 332; //324 - npc.height = 214; //216 - npc.defense = 80; - npc.lifeMax = CalamityWorld.revenge ? 53500 : 42700; - 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.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) - { - npc.defense = 180; - npc.lifeMax = 350000; - npc.value = Item.buyPrice(0, 35, 0, 0); - } - 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 SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - 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) - { - 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); - NPC.NewNPC((int)npc.Center.X + 70, (int)npc.Center.Y + 88, mod.NPCType("ScavengerLegRight"), 0, 0f, 0f, 0f, 0f, 255); - 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); - if (Main.player[npc.target].dead) - { - npc.noTileCollide = true; - } - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 0f; - } - bool leftLegActive = false; - bool rightLegActive = false; - bool headActive = false; - bool rightClawActive = false; - bool leftClawActive = false; - for (int num619 = 0; num619 < 200; num619++) - { - 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")) - { - rightClawActive = true; - } - 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")) - { - rightLegActive = true; - } - 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) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - 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); - Main.dust[rightDust].velocity *= 0.2f; - 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) - { - 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) - { - Main.dust[rightDust].noGravity = true; - Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Dust rightDustExpr2 = Main.dust[rightDust]; - rightDustExpr2.velocity.Y = rightDustExpr2.velocity.Y - 4f; - } - } - if (Main.netMode != 1) - { - npc.localAI[1] += (enrage ? 6f : 1f); - if (npc.localAI[1] >= 600f) - { - npc.localAI[1] = 0f; - 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)) - { - 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); - } - } - } - } - } - 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); - Main.dust[rightDust].velocity *= 0.2f; - 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) - { - 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) - { - Main.dust[rightDust].noGravity = true; - Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Dust rightDustExpr2 = Main.dust[rightDust]; - rightDustExpr2.velocity.X = rightDustExpr2.velocity.X + 4f; - } - } - if (Main.netMode != 1) - { - npc.localAI[2] += (enrage ? 2f : 1f); - if (npc.localAI[2] >= 480f) - { - 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); - } - } - } - 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); - Main.dust[leftDust].velocity *= 0.2f; - Dust leftDustExpr = Main.dust[leftDust]; - leftDustExpr.velocity.X = leftDustExpr.velocity.X - (3f + (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) - { - leftDust = 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) - { - Main.dust[leftDust].noGravity = true; - Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Dust leftDustExpr2 = Main.dust[leftDust]; - leftDustExpr2.velocity.X = leftDustExpr2.velocity.X - 4f; - } - } - if (Main.netMode != 1) - { - npc.localAI[3] += (enrage ? 2f : 1f); - if (npc.localAI[3] >= 480f) - { - 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); - } - } - } - 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); - Main.dust[rightDust].velocity *= 0.2f; - 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) - { - 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) - { - Main.dust[rightDust].noGravity = true; - Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Dust rightDustExpr2 = Main.dust[rightDust]; - rightDustExpr2.velocity.Y = rightDustExpr2.velocity.Y + 1f; - } - } - if (Main.netMode != 1) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - 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); - Main.projectile[fire].timeLeft = 180; - } - } - } - 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); - Main.dust[leftDust].velocity *= 0.2f; - 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) - { - 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) - { - Main.dust[leftDust].noGravity = true; - Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Dust leftDustExpr2 = Main.dust[leftDust]; - leftDustExpr2.velocity.Y = leftDustExpr2.velocity.Y + 1f; - } - } - if (Main.netMode != 1) - { - npc.ai[3] += 1f; - if (npc.ai[3] >= 300f) - { - 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); - Main.projectile[fire].timeLeft = 180; - } - } - } - if (npc.ai[0] == 0f) - { - 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) - { - if ((!rightClawActive && !leftClawActive) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.ai[1] += 1f; - } - if (!headActive || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.ai[1] += 1f; - } - if ((!rightLegActive && !leftLegActive) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.ai[1] += 1f; - } - } - 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 || (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) - { - 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) - { - 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; - } - 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 - { - 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) - { - npc.velocity.X = npc.velocity.X * 0.9f; - npc.velocity.Y = npc.velocity.Y + 0.2f; - } - 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 velocityX = 3f; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - velocityX += 3f; - } - if (!rightClawActive) - { - velocityX += 1f; - } - if (!leftClawActive) - { - velocityX += 1f; - } - if (!headActive) - { - velocityX += 1f; - } - if (!rightLegActive) - { - velocityX += 1f; - } - if (!leftLegActive) - { - velocityX += 1f; - } - if (npc.velocity.X < -velocityX) - { - npc.velocity.X = -velocityX; - } - if (npc.velocity.X > velocityX) - { - npc.velocity.X = velocityX; - } - } - } - } - if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) - { - 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) - { - 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) - { - npc.active = false; - npc.netUpdate = true; - return; - } - } - } - - 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); - 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); - 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); - } - } - - 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 HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 2f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody5"), 1f); - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 2f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - name = "Ravager"; - potionType = ItemID.GreaterHealingPotion; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - 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")); - } - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Scavenger +{ + [AutoloadBossHead] + public class ScavengerBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + Main.npcFrameCount[npc.type] = 7; + } + + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.npcSlots = 20f; + npc.aiStyle = -1; + npc.damage = 100; + npc.width = 332; //324 + npc.height = 214; //216 + npc.defense = 80; + npc.lifeMax = CalamityWorld.revenge ? 53500 : 42700; + 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.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) + { + npc.defense = 180; + npc.lifeMax = 350000; + npc.value = Item.buyPrice(0, 35, 0, 0); + } + 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 SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + 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) + { + 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); + NPC.NewNPC((int)npc.Center.X + 70, (int)npc.Center.Y + 88, mod.NPCType("ScavengerLegRight"), 0, 0f, 0f, 0f, 0f, 255); + 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); + if (Main.player[npc.target].dead) + { + npc.noTileCollide = true; + } + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 0f; + } + bool leftLegActive = false; + bool rightLegActive = false; + bool headActive = false; + bool rightClawActive = false; + bool leftClawActive = false; + for (int num619 = 0; num619 < 200; num619++) + { + 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")) + { + rightClawActive = true; + } + 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")) + { + rightLegActive = true; + } + 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) + { + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + 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); + Main.dust[rightDust].velocity *= 0.2f; + 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) + { + 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) + { + Main.dust[rightDust].noGravity = true; + Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Dust rightDustExpr2 = Main.dust[rightDust]; + rightDustExpr2.velocity.Y = rightDustExpr2.velocity.Y - 4f; + } + } + if (Main.netMode != 1) + { + npc.localAI[1] += (enrage ? 6f : 1f); + if (npc.localAI[1] >= 600f) + { + npc.localAI[1] = 0f; + 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)) + { + 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); + } + } + } + } + } + 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); + Main.dust[rightDust].velocity *= 0.2f; + 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) + { + 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) + { + Main.dust[rightDust].noGravity = true; + Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Dust rightDustExpr2 = Main.dust[rightDust]; + rightDustExpr2.velocity.X = rightDustExpr2.velocity.X + 4f; + } + } + if (Main.netMode != 1) + { + npc.localAI[2] += (enrage ? 2f : 1f); + if (npc.localAI[2] >= 480f) + { + 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); + } + } + } + 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); + Main.dust[leftDust].velocity *= 0.2f; + Dust leftDustExpr = Main.dust[leftDust]; + leftDustExpr.velocity.X = leftDustExpr.velocity.X - (3f + (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) + { + leftDust = 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) + { + Main.dust[leftDust].noGravity = true; + Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Dust leftDustExpr2 = Main.dust[leftDust]; + leftDustExpr2.velocity.X = leftDustExpr2.velocity.X - 4f; + } + } + if (Main.netMode != 1) + { + npc.localAI[3] += (enrage ? 2f : 1f); + if (npc.localAI[3] >= 480f) + { + 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); + } + } + } + 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); + Main.dust[rightDust].velocity *= 0.2f; + 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) + { + 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) + { + Main.dust[rightDust].noGravity = true; + Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Dust rightDustExpr2 = Main.dust[rightDust]; + rightDustExpr2.velocity.Y = rightDustExpr2.velocity.Y + 1f; + } + } + if (Main.netMode != 1) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + 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); + Main.projectile[fire].timeLeft = 180; + } + } + } + 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); + Main.dust[leftDust].velocity *= 0.2f; + 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) + { + 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) + { + Main.dust[leftDust].noGravity = true; + Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; + Dust leftDustExpr2 = Main.dust[leftDust]; + leftDustExpr2.velocity.Y = leftDustExpr2.velocity.Y + 1f; + } + } + if (Main.netMode != 1) + { + npc.ai[3] += 1f; + if (npc.ai[3] >= 300f) + { + 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); + Main.projectile[fire].timeLeft = 180; + } + } + } + if (npc.ai[0] == 0f) + { + 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) + { + if ((!rightClawActive && !leftClawActive) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npc.ai[1] += 1f; + } + if (!headActive || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npc.ai[1] += 1f; + } + if ((!rightLegActive && !leftLegActive) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npc.ai[1] += 1f; + } + } + 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 || (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) + { + 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) + { + 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; + } + 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 + { + 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) + { + npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.Y = npc.velocity.Y + 0.2f; + } + 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 velocityX = 3f; + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + velocityX += 3f; + } + if (!rightClawActive) + { + velocityX += 1f; + } + if (!leftClawActive) + { + velocityX += 1f; + } + if (!headActive) + { + velocityX += 1f; + } + if (!rightLegActive) + { + velocityX += 1f; + } + if (!leftLegActive) + { + velocityX += 1f; + } + if (npc.velocity.X < -velocityX) + { + npc.velocity.X = -velocityX; + } + if (npc.velocity.X > velocityX) + { + npc.velocity.X = velocityX; + } + } + } + } + if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead) + { + 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) + { + 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) + { + npc.active = false; + npc.netUpdate = true; + return; + } + } + } + + 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); + 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); + 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); + } + } + + 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 HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 2f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerBody5"), 1f); + for (int k = 0; k < 50; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 2f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + name = "Ravager"; + potionType = ItemID.GreaterHealingPotion; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + 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")); + } + 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; + } + } + } + } +} diff --git a/NPCs/Scavenger/ScavengerClawLeft.cs b/NPCs/Scavenger/ScavengerClawLeft.cs index 7ce2c679df..9a64e39019 100644 --- a/NPCs/Scavenger/ScavengerClawLeft.cs +++ b/NPCs/Scavenger/ScavengerClawLeft.cs @@ -1,332 +1,332 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Scavenger -{ - public class ScavengerClawLeft : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.damage = 88; - npc.width = 80; //324 - npc.height = 40; //216 - npc.defense = 50; - npc.lifeMax = 11120; - 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.noGravity = true; - npc.canGhostHeal = false; - npc.alpha = 255; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.damage = 200; - npc.defense = 120; - npc.lifeMax = 100000; - } - 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 (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 0f; - } - if (npc.ai[0] == 0f) - { - npc.noTileCollide = true; - float num659 = 14f; - if (npc.life < npc.lifeMax / 2) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 3) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 5) - { - num659 += 1f; - } - Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num661 += 50f; - num660 -= 120f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - 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) - { - npc.ai[1] += 1f; - } - if (npc.life < npc.lifeMax / 3) - { - npc.ai[1] += 1f; - } - if (npc.life < npc.lifeMax / 5) - { - npc.ai[1] += 10f; - } - if (npc.ai[1] >= 60f) - { - npc.TargetClosest(true); - if ((npc.Center.X + 100f > Main.player[npc.target].Center.X)) - { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - return; - } - npc.ai[1] = 0f; - return; - } - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - 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) - { - num663 += 4f; - } - if (npc.life < npc.lifeMax / 3) - { - num663 += 4f; - } - if (npc.life < npc.lifeMax / 5) - { - num663 += 10f; - } - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num664 = Main.player[npc.target].Center.X - vector80.X; - float num665 = Main.player[npc.target].Center.Y - vector80.Y; - float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); - num666 = num663 / num666; - npc.velocity.X = num664 * num666; - 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 (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) - { - npc.noTileCollide = false; - } - } - else - { - 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) - { - npc.noTileCollide = false; - } - } - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); - float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; - float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; - num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; - num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; - num668 += 40f; - num667 -= 110f; - float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); - if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) - { - npc.noTileCollide = true; - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - float num671 = 12f; - float num672 = 0.4f; - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); - float num673 = Main.player[npc.target].Center.X - vector82.X; - float num674 = Main.player[npc.target].Center.Y - vector82.Y; - float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); - num675 = num671 / num675; - num673 *= num675; - num674 *= num675; - if (npc.velocity.X < num673) - { - npc.velocity.X = npc.velocity.X + num672; - 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) - { - npc.velocity.X = npc.velocity.X - num672 * 2f; - } - } - if (npc.velocity.Y < num674) - { - npc.velocity.Y = npc.velocity.Y + num672; - 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) - { - npc.velocity.Y = npc.velocity.Y - num672 * 2f; - } - } - 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); - float drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - drawPositionY += 30f; - drawPositionX -= 70f; - float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; - bool draw = true; - while (draw) - { - float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); - if (totalDrawDistance < 16f) - { - draw = false; - } - else - { - totalDrawDistance = 16f / totalDrawDistance; - drawPositionX *= totalDrawDistance; - drawPositionY *= totalDrawDistance; - center.X += drawPositionX; - center.Y += drawPositionY; - drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - 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, - 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) - { - 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++; - } - } - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Scavenger +{ + public class ScavengerClawLeft : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } + + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = -1; + npc.damage = 88; + npc.width = 80; //324 + npc.height = 40; //216 + npc.defense = 50; + npc.lifeMax = 11120; + 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.noGravity = true; + npc.canGhostHeal = false; + npc.alpha = 255; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.damage = 200; + npc.defense = 120; + npc.lifeMax = 100000; + } + 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 (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 0f; + } + if (npc.ai[0] == 0f) + { + npc.noTileCollide = true; + float num659 = 14f; + if (npc.life < npc.lifeMax / 2) + { + num659 += 1f; + } + if (npc.life < npc.lifeMax / 3) + { + num659 += 1f; + } + if (npc.life < npc.lifeMax / 5) + { + num659 += 1f; + } + Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); + float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; + float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; + num661 += 50f; + num660 -= 120f; + float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + 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) + { + npc.ai[1] += 1f; + } + if (npc.life < npc.lifeMax / 3) + { + npc.ai[1] += 1f; + } + if (npc.life < npc.lifeMax / 5) + { + npc.ai[1] += 10f; + } + if (npc.ai[1] >= 60f) + { + npc.TargetClosest(true); + if ((npc.Center.X + 100f > Main.player[npc.target].Center.X)) + { + npc.ai[1] = 0f; + npc.ai[0] = 1f; + return; + } + npc.ai[1] = 0f; + return; + } + } + else + { + num662 = num659 / num662; + npc.velocity.X = num660 * num662; + 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) + { + num663 += 4f; + } + if (npc.life < npc.lifeMax / 3) + { + num663 += 4f; + } + if (npc.life < npc.lifeMax / 5) + { + num663 += 10f; + } + Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); + float num664 = Main.player[npc.target].Center.X - vector80.X; + float num665 = Main.player[npc.target].Center.Y - vector80.Y; + float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); + num666 = num663 / num666; + npc.velocity.X = num664 * num666; + 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 (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) + { + npc.noTileCollide = false; + } + } + else + { + 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) + { + npc.noTileCollide = false; + } + } + Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); + float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; + float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; + num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; + num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; + num668 += 40f; + num667 -= 110f; + float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); + if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) + { + npc.noTileCollide = true; + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + npc.noTileCollide = true; + float num671 = 12f; + float num672 = 0.4f; + Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); + float num673 = Main.player[npc.target].Center.X - vector82.X; + float num674 = Main.player[npc.target].Center.Y - vector82.Y; + float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); + num675 = num671 / num675; + num673 *= num675; + num674 *= num675; + if (npc.velocity.X < num673) + { + npc.velocity.X = npc.velocity.X + num672; + 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) + { + npc.velocity.X = npc.velocity.X - num672 * 2f; + } + } + if (npc.velocity.Y < num674) + { + npc.velocity.Y = npc.velocity.Y + num672; + 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) + { + npc.velocity.Y = npc.velocity.Y - num672 * 2f; + } + } + 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); + float drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; + float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; + drawPositionY += 30f; + drawPositionX -= 70f; + float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; + bool draw = true; + while (draw) + { + float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); + if (totalDrawDistance < 16f) + { + draw = false; + } + else + { + totalDrawDistance = 16f / totalDrawDistance; + drawPositionX *= totalDrawDistance; + drawPositionY *= totalDrawDistance; + center.X += drawPositionX; + center.Y += drawPositionY; + drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; + drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; + 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, + 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) + { + 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++; + } + } + 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); + } + } + } +} diff --git a/NPCs/Scavenger/ScavengerClawRight.cs b/NPCs/Scavenger/ScavengerClawRight.cs index 62c53e8e8a..2df408d76d 100644 --- a/NPCs/Scavenger/ScavengerClawRight.cs +++ b/NPCs/Scavenger/ScavengerClawRight.cs @@ -1,331 +1,331 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Scavenger -{ - public class ScavengerClawRight : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.aiStyle = -1; - npc.damage = 88; - npc.width = 80; //324 - npc.height = 40; //216 - npc.defense = 50; - npc.lifeMax = 11120; - 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.noGravity = true; - npc.canGhostHeal = false; - npc.alpha = 255; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.damage = 200; - npc.defense = 120; - npc.lifeMax = 100000; - } - 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 (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 0f; - } - if (npc.ai[0] == 0f) - { - npc.noTileCollide = true; - float num659 = 14f; - if (npc.life < npc.lifeMax / 2) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 3) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 5) - { - num659 += 1f; - } - Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num661 += 50f; - num660 += 120f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - 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) - { - npc.ai[1] += 1f; - } - if (npc.life < npc.lifeMax / 3) - { - npc.ai[1] += 1f; - } - if (npc.life < npc.lifeMax / 5) - { - npc.ai[1] += 10f; - } - if (npc.ai[1] >= 60f) - { - npc.TargetClosest(true); - if ((npc.Center.X - 100f < Main.player[npc.target].Center.X)) - { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - return; - } - npc.ai[1] = 0f; - return; - } - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - 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) - { - num663 += 4f; - } - if (npc.life < npc.lifeMax / 3) - { - num663 += 4f; - } - if (npc.life < npc.lifeMax / 5) - { - num663 += 10f; - } - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num664 = Main.player[npc.target].Center.X - vector80.X; - float num665 = Main.player[npc.target].Center.Y - vector80.Y; - float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); - num666 = num663 / num666; - npc.velocity.X = num664 * num666; - 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 (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) - { - npc.noTileCollide = false; - } - } - else - { - 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) - { - npc.noTileCollide = false; - } - } - Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); - float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; - float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; - num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; - num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; - num668 += 40f; - num667 += 110f; - float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); - if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) - { - npc.noTileCollide = true; - npc.ai[0] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - float num671 = 12f; - float num672 = 0.4f; - Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); - float num673 = Main.player[npc.target].Center.X - vector82.X; - float num674 = Main.player[npc.target].Center.Y - vector82.Y; - float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); - num675 = num671 / num675; - num673 *= num675; - num674 *= num675; - if (npc.velocity.X < num673) - { - npc.velocity.X = npc.velocity.X + num672; - 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) - { - npc.velocity.X = npc.velocity.X - num672 * 2f; - } - } - if (npc.velocity.Y < num674) - { - npc.velocity.Y = npc.velocity.Y + num672; - 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) - { - npc.velocity.Y = npc.velocity.Y - num672 * 2f; - } - } - 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); - float drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - drawPositionY += 30f; - drawPositionX += 70f; - float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; - bool draw = true; - while (draw) - { - float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); - if (totalDrawDistance < 16f) - { - draw = false; - } - else - { - totalDrawDistance = 16f / totalDrawDistance; - drawPositionX *= totalDrawDistance; - drawPositionY *= totalDrawDistance; - center.X += drawPositionX; - center.Y += drawPositionY; - drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - 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, - 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) - { - 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++; - } - } - 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 +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Scavenger +{ + public class ScavengerClawRight : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } + + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.aiStyle = -1; + npc.damage = 88; + npc.width = 80; //324 + npc.height = 40; //216 + npc.defense = 50; + npc.lifeMax = 11120; + 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.noGravity = true; + npc.canGhostHeal = false; + npc.alpha = 255; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.damage = 200; + npc.defense = 120; + npc.lifeMax = 100000; + } + 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 (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 0f; + } + if (npc.ai[0] == 0f) + { + npc.noTileCollide = true; + float num659 = 14f; + if (npc.life < npc.lifeMax / 2) + { + num659 += 1f; + } + if (npc.life < npc.lifeMax / 3) + { + num659 += 1f; + } + if (npc.life < npc.lifeMax / 5) + { + num659 += 1f; + } + Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); + float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; + float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; + num661 += 50f; + num660 += 120f; + float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + 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) + { + npc.ai[1] += 1f; + } + if (npc.life < npc.lifeMax / 3) + { + npc.ai[1] += 1f; + } + if (npc.life < npc.lifeMax / 5) + { + npc.ai[1] += 10f; + } + if (npc.ai[1] >= 60f) + { + npc.TargetClosest(true); + if ((npc.Center.X - 100f < Main.player[npc.target].Center.X)) + { + npc.ai[1] = 0f; + npc.ai[0] = 1f; + return; + } + npc.ai[1] = 0f; + return; + } + } + else + { + num662 = num659 / num662; + npc.velocity.X = num660 * num662; + 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) + { + num663 += 4f; + } + if (npc.life < npc.lifeMax / 3) + { + num663 += 4f; + } + if (npc.life < npc.lifeMax / 5) + { + num663 += 10f; + } + Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); + float num664 = Main.player[npc.target].Center.X - vector80.X; + float num665 = Main.player[npc.target].Center.Y - vector80.Y; + float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); + num666 = num663 / num666; + npc.velocity.X = num664 * num666; + 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 (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) + { + npc.noTileCollide = false; + } + } + else + { + 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) + { + npc.noTileCollide = false; + } + } + Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y); + float num667 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector81.X; + float num668 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector81.Y; + num667 += Main.npc[CalamityGlobalNPC.scavenger].velocity.X; + num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; + num668 += 40f; + num667 += 110f; + float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); + if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) + { + npc.noTileCollide = true; + npc.ai[0] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + npc.noTileCollide = true; + float num671 = 12f; + float num672 = 0.4f; + Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y); + float num673 = Main.player[npc.target].Center.X - vector82.X; + float num674 = Main.player[npc.target].Center.Y - vector82.Y; + float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674)); + num675 = num671 / num675; + num673 *= num675; + num674 *= num675; + if (npc.velocity.X < num673) + { + npc.velocity.X = npc.velocity.X + num672; + 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) + { + npc.velocity.X = npc.velocity.X - num672 * 2f; + } + } + if (npc.velocity.Y < num674) + { + npc.velocity.Y = npc.velocity.Y + num672; + 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) + { + npc.velocity.Y = npc.velocity.Y - num672 * 2f; + } + } + 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); + float drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; + float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; + drawPositionY += 30f; + drawPositionX += 70f; + float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; + bool draw = true; + while (draw) + { + float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); + if (totalDrawDistance < 16f) + { + draw = false; + } + else + { + totalDrawDistance = 16f / totalDrawDistance; + drawPositionX *= totalDrawDistance; + drawPositionY *= totalDrawDistance; + center.X += drawPositionX; + center.Y += drawPositionY; + drawPositionX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; + drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; + 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, + 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) + { + 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++; + } + } + 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); + } + } + } +} diff --git a/NPCs/Scavenger/ScavengerHead.cs b/NPCs/Scavenger/ScavengerHead.cs index f87399244f..527fa7e437 100644 --- a/NPCs/Scavenger/ScavengerHead.cs +++ b/NPCs/Scavenger/ScavengerHead.cs @@ -1,158 +1,158 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Scavenger -{ - public class ScavengerHead : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 70; - npc.lifeMax = 32705; - 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.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.alpha = 255; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = null; - if (CalamityWorld.downedProvidence) - { - npc.defense = 150; - npc.lifeMax = 260000; - } - 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]; - if (CalamityGlobalNPC.scavenger < 0 || !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) - { - 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 if (Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("ScavengerHead2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Scavenger +{ + public class ScavengerHead : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 70; + npc.lifeMax = 32705; + 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.noGravity = true; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.alpha = 255; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = null; + if (CalamityWorld.downedProvidence) + { + npc.defense = 150; + npc.lifeMax = 260000; + } + 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]; + if (CalamityGlobalNPC.scavenger < 0 || !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) + { + 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 if (Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, mod.NPCType("ScavengerHead2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + } + } +} diff --git a/NPCs/Scavenger/ScavengerHead2.cs b/NPCs/Scavenger/ScavengerHead2.cs index 44bb8ffbd2..523d320457 100644 --- a/NPCs/Scavenger/ScavengerHead2.cs +++ b/NPCs/Scavenger/ScavengerHead2.cs @@ -1,296 +1,296 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Scavenger -{ - public class ScavengerHead2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 88; - npc.width = 80; //324 - npc.height = 80; //216 - npc.defense = 0; - npc.lifeMax = 100; - npc.knockBackResist = 0f; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontTakeDamage = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.damage = 0; - npc.defense = 99999; - npc.lifeMax = 50000; - } - } - - public override void AI() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.dontTakeDamage = false; - npc.life = 0; - HitEffect(npc.direction, 9999); - npc.netUpdate = true; - return; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - float num = 5f; - float num2 = 0.1f; - 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.ai[1] += 1f; - int nukeTimer = 720; - 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); - float nukeSpeed = 1f; - float playerDistanceX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - shootFromVector.X; - float playerDistanceY = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - shootFromVector.Y; - float totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); - totalPlayerDistance = nukeSpeed / totalPlayerDistance; - playerDistanceX *= totalPlayerDistance; - playerDistanceY *= totalPlayerDistance; - int nukeDamage = Main.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); - } - } - npc.localAI[0] += 1f; - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.3) - { - npc.localAI[0] += 1f; - } - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.1) - { - npc.localAI[0] += 1f; - } - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.5) - { - npc.localAI[1] += 1f; - } - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.25) - { - npc.localAI[1] += 1f; - } - if (Main.netMode != 1 && npc.localAI[0] >= 900f) - { - 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)) - { - Main.PlaySound(SoundID.Item33, npc.position); - int num8 = 42; - if (Main.expertMode) - { - num8 = 30; - } - int num9 = mod.ProjectileType("ScavengerLaser"); - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - if (Main.netMode != 1 && npc.localAI[1] >= 30f) - { - npc.localAI[1] = 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)) - { - int num8 = 50; - int num9 = 259; - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 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 void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead3"), 1f); - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override bool PreNPCLoot() - { - return false; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Scavenger +{ + public class ScavengerHead2 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 88; + npc.width = 80; //324 + npc.height = 80; //216 + npc.defense = 0; + npc.lifeMax = 100; + npc.knockBackResist = 0f; + aiType = -1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontTakeDamage = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.damage = 0; + npc.defense = 99999; + npc.lifeMax = 50000; + } + } + + public override void AI() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.dontTakeDamage = false; + npc.life = 0; + HitEffect(npc.direction, 9999); + npc.netUpdate = true; + return; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + float num = 5f; + float num2 = 0.1f; + 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.ai[1] += 1f; + int nukeTimer = 720; + 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); + float nukeSpeed = 1f; + float playerDistanceX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - shootFromVector.X; + float playerDistanceY = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - shootFromVector.Y; + float totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); + totalPlayerDistance = nukeSpeed / totalPlayerDistance; + playerDistanceX *= totalPlayerDistance; + playerDistanceY *= totalPlayerDistance; + int nukeDamage = Main.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); + } + } + npc.localAI[0] += 1f; + if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.3) + { + npc.localAI[0] += 1f; + } + if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.1) + { + npc.localAI[0] += 1f; + } + if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.5) + { + npc.localAI[1] += 1f; + } + if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.25) + { + npc.localAI[1] += 1f; + } + if (Main.netMode != 1 && npc.localAI[0] >= 900f) + { + 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)) + { + Main.PlaySound(SoundID.Item33, npc.position); + int num8 = 42; + if (Main.expertMode) + { + num8 = 30; + } + int num9 = mod.ProjectileType("ScavengerLaser"); + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + if (Main.netMode != 1 && npc.localAI[1] >= 30f) + { + npc.localAI[1] = 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)) + { + int num8 = 50; + int num9 = 259; + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 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 void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead3"), 1f); + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override bool PreNPCLoot() + { + return false; + } + } +} diff --git a/NPCs/Scavenger/ScavengerLegLeft.cs b/NPCs/Scavenger/ScavengerLegLeft.cs index 446e93961f..9aec1f7a26 100644 --- a/NPCs/Scavenger/ScavengerLegLeft.cs +++ b/NPCs/Scavenger/ScavengerLegLeft.cs @@ -1,159 +1,159 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Scavenger -{ - public class ScavengerLegLeft : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 60; //324 - npc.height = 60; //216 - npc.defense = 60; - npc.lifeMax = 22010; - 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.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.alpha = 255; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.defense = 135; - npc.lifeMax = 200000; - } - 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 (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 0f; - } - if (Main.npc[CalamityGlobalNPC.scavenger].ai[0] == 1f && Main.npc[CalamityGlobalNPC.scavenger].velocity.Y == 0f) - { - if (Main.netMode != 1) - { - int smash = Projectile.NewProjectile((float)center.X, (float)center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), 35 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[smash].timeLeft = 30; - Main.projectile[smash].hostile = true; - Main.projectile[smash].friendly = false; - } - } - if (npc.ai[0] == 0f) - { - float num659 = 14f; - if (npc.life < npc.lifeMax / 2) - { - num659 += 3f; - } - if (npc.life < npc.lifeMax / 3) - { - num659 += 3f; - } - if (npc.life < npc.lifeMax / 5) - { - num659 += 8f; - } - Vector2 vector79 = new Vector2(center.X, center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num661 += 88f; - num660 -= 70f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) - { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - } - } - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft2"), 1f); - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Scavenger +{ + public class ScavengerLegLeft : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 60; //324 + npc.height = 60; //216 + npc.defense = 60; + npc.lifeMax = 22010; + 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.noGravity = true; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.alpha = 255; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.defense = 135; + npc.lifeMax = 200000; + } + 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 (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 0f; + } + if (Main.npc[CalamityGlobalNPC.scavenger].ai[0] == 1f && Main.npc[CalamityGlobalNPC.scavenger].velocity.Y == 0f) + { + if (Main.netMode != 1) + { + int smash = Projectile.NewProjectile((float)center.X, (float)center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), 35 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[smash].timeLeft = 30; + Main.projectile[smash].hostile = true; + Main.projectile[smash].friendly = false; + } + } + if (npc.ai[0] == 0f) + { + float num659 = 14f; + if (npc.life < npc.lifeMax / 2) + { + num659 += 3f; + } + if (npc.life < npc.lifeMax / 3) + { + num659 += 3f; + } + if (npc.life < npc.lifeMax / 5) + { + num659 += 8f; + } + Vector2 vector79 = new Vector2(center.X, center.Y); + float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; + float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; + num661 += 88f; + num660 -= 70f; + float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + if (num662 < 12f + num659) + { + npc.rotation = 0f; + npc.velocity.X = num660; + npc.velocity.Y = num661; + } + else + { + num662 = num659 / num662; + npc.velocity.X = num660 * num662; + npc.velocity.Y = num661 * num662; + } + } + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft2"), 1f); + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/Scavenger/ScavengerLegRight.cs b/NPCs/Scavenger/ScavengerLegRight.cs index 78e826ab11..1712b35541 100644 --- a/NPCs/Scavenger/ScavengerLegRight.cs +++ b/NPCs/Scavenger/ScavengerLegRight.cs @@ -1,159 +1,159 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Scavenger -{ - public class ScavengerLegRight : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.width = 60; //324 - npc.height = 60; //216 - npc.defense = 60; - npc.lifeMax = 21010; - 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.noGravity = true; - npc.canGhostHeal = false; - npc.noTileCollide = true; - npc.alpha = 255; - npc.value = Item.buyPrice(0, 0, 0, 0); - npc.HitSound = SoundID.NPCHit41; - npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) - { - npc.defense = 135; - npc.lifeMax = 200000; - } - 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 (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 0f; - } - if (Main.npc[CalamityGlobalNPC.scavenger].ai[0] == 1f && Main.npc[CalamityGlobalNPC.scavenger].velocity.Y == 0f) - { - if (Main.netMode != 1) - { - int smash = Projectile.NewProjectile((float)center.X, (float)center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), 35 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[smash].timeLeft = 30; - Main.projectile[smash].hostile = true; - Main.projectile[smash].friendly = false; - } - } - if (npc.ai[0] == 0f) - { - float num659 = 14f; - if (npc.life < npc.lifeMax / 2) - { - num659 += 3f; - } - if (npc.life < npc.lifeMax / 3) - { - num659 += 3f; - } - if (npc.life < npc.lifeMax / 5) - { - num659 += 8f; - } - Vector2 vector79 = new Vector2(center.X, center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num661 += 88f; - num660 += 70f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) - { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - } - } - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight2"), 1f); - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Scavenger +{ + public class ScavengerLegRight : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + npc.damage = 0; + npc.width = 60; //324 + npc.height = 60; //216 + npc.defense = 60; + npc.lifeMax = 21010; + 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.noGravity = true; + npc.canGhostHeal = false; + npc.noTileCollide = true; + npc.alpha = 255; + npc.value = Item.buyPrice(0, 0, 0, 0); + npc.HitSound = SoundID.NPCHit41; + npc.DeathSound = SoundID.NPCDeath14; + if (CalamityWorld.downedProvidence) + { + npc.defense = 135; + npc.lifeMax = 200000; + } + 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 (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 0f; + } + if (Main.npc[CalamityGlobalNPC.scavenger].ai[0] == 1f && Main.npc[CalamityGlobalNPC.scavenger].velocity.Y == 0f) + { + if (Main.netMode != 1) + { + int smash = Projectile.NewProjectile((float)center.X, (float)center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), 35 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[smash].timeLeft = 30; + Main.projectile[smash].hostile = true; + Main.projectile[smash].friendly = false; + } + } + if (npc.ai[0] == 0f) + { + float num659 = 14f; + if (npc.life < npc.lifeMax / 2) + { + num659 += 3f; + } + if (npc.life < npc.lifeMax / 3) + { + num659 += 3f; + } + if (npc.life < npc.lifeMax / 5) + { + num659 += 8f; + } + Vector2 vector79 = new Vector2(center.X, center.Y); + float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; + float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; + num661 += 88f; + num660 += 70f; + float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + if (num662 < 12f + num659) + { + npc.rotation = 0f; + npc.velocity.X = num660; + npc.velocity.Y = num661; + } + else + { + num662 = num659 / num662; + npc.velocity.X = num660 * num662; + npc.velocity.Y = num661 * num662; + } + } + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight2"), 1f); + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index f9ad65378d..8ae8dd0ae5 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -1,566 +1,566 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SlimeGod -{ - [AutoloadBossHead] - public class SlimeGod : ModNPC - { - private float bossLife; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ebonian Slime God"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() //dust is 173 - { - npc.damage = 60; - npc.width = 150; - npc.height = 92; - npc.scale = 1.1f; - npc.defense = 15; - npc.lifeMax = CalamityWorld.revenge ? 5500 : 4000; - if (CalamityWorld.death) - { - npc.lifeMax = 7700; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2500000 : 2200000; - } - 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; - npc.knockBackResist = 0f; - animationType = 50; - npc.value = 0f; - npc.alpha = 60; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - else - music = MusicID.Boss1; - } - - public override void AI() - { - CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - Vector2 vector = npc.Center; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5400f) - { - npc.position.X = (float)(Main.player[npc.target].Center.X / 16) * 16f - (float)(npc.width / 2); - npc.position.Y = ((float)(Main.player[npc.target].Center.Y / 16) * 16f - (float)(npc.height / 2)) - 150f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.5 && Main.netMode != 1) - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 1); - Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X - 30, (int)spawnAt.Y, mod.NPCType("SlimeGodSplit")); - NPC.NewNPC((int)spawnAt.X + 30, (int)spawnAt.Y, mod.NPCType("SlimeGodSplit")); - npc.active = false; - npc.netUpdate = true; - return; - } - bool flag100 = false; - bool hyperMode = false; - if (CalamityGlobalNPC.slimeGodRed != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { - flag100 = true; - } - } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) - { - flag100 = false; - hyperMode = true; - } - if (Main.netMode != 1) - { - npc.localAI[0] += flag100 ? 1f : 2f; - if (expertMode && Main.rand.Next(2) == 0) - { - if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - 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 = (CalamityWorld.bossRushActive ? 18f : 8f); - 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 = 24; - int num185 = mod.ProjectileType("AbyssMine"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 3; 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, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - 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 = (CalamityWorld.bossRushActive ? 18f : 8f); - 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 = expertMode ? 19 : 21; - int num185 = mod.ProjectileType("AbyssBallVolley"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 4; 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, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - npc.aiAction = 0; - npc.knockBackResist = 0.2f * Main.knockBackMultiplier; - npc.noTileCollide = false; - npc.noGravity = false; - npc.reflectingProjectiles = false; - if (npc.ai[0] != 7f && Main.player[npc.target].dead) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead) - { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - Vector2 vector271 = Main.player[npc.target].Center - vector; - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - else if (npc.ai[0] == 1f) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 18f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 2f) - { - if ((Main.player[npc.target].Center - vector).Length() > (hyperMode ? 1200f : 2400f)) //1200 - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X * 0.8f; - npc.ai[1] += flag100 ? 1f : 3f; - float num1879 = 15f + 30f * ((float)npc.life / (float)npc.lifeMax); - float num1880 = 3f + 4f * (1f - (float)npc.life / (float)npc.lifeMax); - float num1881 = 8f; - if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - num1881 += 2f; - } - if (npc.ai[1] > num1879) - { - npc.ai[3] += 1f; - if (npc.ai[3] >= 2f) - { - npc.ai[3] = 0f; - num1881 *= 2f; - num1880 /= 2f; - } - npc.ai[1] = 0f; - npc.velocity.Y = npc.velocity.Y - num1881; - npc.velocity.X = num1880 * (float)npc.direction; - } - } - else - { - npc.knockBackResist = 0f; - npc.velocity.X = npc.velocity.X * 0.99f; - if (npc.direction < 0 && npc.velocity.X > -1f) - { - npc.velocity.X = -1f; - } - if (npc.direction > 0 && npc.velocity.X < 1f) - { - npc.velocity.X = 1f; - } - } - npc.ai[2] += 1f; - if ((double)npc.ai[2] > 360.0 && npc.velocity.Y == 0f && Main.netMode != 1) - { - int num1882 = Main.rand.Next(3); - if (num1882 == 0) - { - npc.ai[0] = 3f; - } - else if (num1882 == 1) - { - npc.ai[0] = 4f; - npc.noTileCollide = true; - npc.velocity.Y = -8f; - } - else if (num1882 == 2) - { - npc.ai[0] = 6f; - } - else - { - npc.ai[0] = 2f; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - npc.velocity.X = npc.velocity.X * 0.85f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 80f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 4f) - { - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.TargetClosest(true); - Vector2 center40 = Main.player[npc.target].Center; - center40.Y -= 350f; - Vector2 vector272 = center40 - vector; - if (npc.ai[2] == 1f) - { - npc.ai[1] += 1f; - vector272 = Main.player[npc.target].Center - vector; - vector272.Normalize(); - vector272 *= 8f; - npc.velocity = (npc.velocity * 4f + vector272) / 5f; - if (npc.ai[1] > 6f) - { - npc.ai[1] = 0f; - npc.ai[0] = 4.1f; - npc.ai[2] = 0f; - npc.velocity = vector272; - } - } - else - { - if (Math.Abs(vector.X - Main.player[npc.target].Center.X) < 40f && vector.Y < Main.player[npc.target].Center.Y - 300f) - { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - return; - } - vector272.Normalize(); - vector272 *= 12f; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; - } - } - else if (npc.ai[0] == 4.1f) - { - npc.knockBackResist = 0f; - if (npc.ai[2] == 0f && Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[2] = 1f; - } - if (npc.position.Y + (float)npc.height >= Main.player[npc.target].position.Y || npc.velocity.Y <= 0f) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 5f; - } - } - } - else if (npc.ai[2] == 0f) - { - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 16f) - { - npc.velocity.Y = 16f; - } - } - else - { - if (npc.ai[0] == 5f) - { - npc.localAI[0] += (float)Main.rand.Next(4, 9); - if (npc.velocity.X > 0f) - { - npc.direction = 1; - } - else - { - npc.direction = -1; - } - npc.spriteDirection = npc.direction; - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - Vector2 value74 = Main.player[npc.target].Center - vector; - value74.Y -= 4f; - if (value74.Length() < 200f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (value74.Length() > 10f) - { - value74.Normalize(); - value74 *= 10f; - } - npc.velocity = (npc.velocity * 4f + value74) / 4.8f; //5 - return; - } - if (npc.ai[0] == 6f) - { - npc.knockBackResist = 0f; - if (npc.velocity.Y == 0f) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X * 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 5f) - { - npc.ai[1] = 0f; - npc.velocity.Y = npc.velocity.Y - 4f; - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y) - { - npc.velocity.Y = npc.velocity.Y - 1.25f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 40f) - { - npc.velocity.Y = npc.velocity.Y - 1.5f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 80f) - { - npc.velocity.Y = npc.velocity.Y - 1.75f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 120f) - { - npc.velocity.Y = npc.velocity.Y - 2f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 160f) - { - npc.velocity.Y = npc.velocity.Y - 2.25f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 200f) - { - npc.velocity.Y = npc.velocity.Y - 2.5f; - } - if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.velocity.Y = npc.velocity.Y - 2f; - } - npc.velocity.X = (float)(12 * npc.direction); - npc.ai[2] += 1f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.98f; - if (npc.direction < 0 && npc.velocity.X > -8f) - { - npc.velocity.X = -8f; - } - if (npc.direction > 0 && npc.velocity.X < 8f) - { - npc.velocity.X = 8f; - } - } - if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.ai[0] == 7f) - { - npc.life = npc.lifeMax; - npc.defense = 9999; - npc.noTileCollide = true; - npc.alpha += 7; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - if (npc.alpha > 255) - { - npc.alpha = 255; - } - npc.velocity.X = npc.velocity.X * 0.98f; - } - } - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, 173, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - float num644 = 1f; - if (npc.life > 0) - { - float num659 = (float)npc.life / (float)npc.lifeMax; - num659 = num659 * 0.5f + 0.75f; - num659 *= num644; - if (num659 != npc.scale) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; - } - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.15); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - int num661 = Main.rand.Next(1, 3); - 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("SlimeSpawnCorrupt"); - 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; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == 2 && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - - public override bool CheckActive() - { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - } - - 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.Weak, 180, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SlimeGod +{ + [AutoloadBossHead] + public class SlimeGod : ModNPC + { + private float bossLife; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ebonian Slime God"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() //dust is 173 + { + npc.damage = 60; + npc.width = 150; + npc.height = 92; + npc.scale = 1.1f; + npc.defense = 15; + npc.lifeMax = CalamityWorld.revenge ? 5500 : 4000; + if (CalamityWorld.death) + { + npc.lifeMax = 7700; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2500000 : 2200000; + } + 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; + npc.knockBackResist = 0f; + animationType = 50; + npc.value = 0f; + npc.alpha = 60; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); + else + music = MusicID.Boss1; + } + + public override void AI() + { + CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + Vector2 vector = npc.Center; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5400f) + { + npc.position.X = (float)(Main.player[npc.target].Center.X / 16) * 16f - (float)(npc.width / 2); + npc.position.Y = ((float)(Main.player[npc.target].Center.Y / 16) * 16f - (float)(npc.height / 2)) - 150f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.5 && Main.netMode != 1) + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 1); + Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X - 30, (int)spawnAt.Y, mod.NPCType("SlimeGodSplit")); + NPC.NewNPC((int)spawnAt.X + 30, (int)spawnAt.Y, mod.NPCType("SlimeGodSplit")); + npc.active = false; + npc.netUpdate = true; + return; + } + bool flag100 = false; + bool hyperMode = false; + if (CalamityGlobalNPC.slimeGodRed != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) + { + flag100 = true; + } + } + if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) + { + flag100 = false; + hyperMode = true; + } + if (Main.netMode != 1) + { + npc.localAI[0] += flag100 ? 1f : 2f; + if (expertMode && Main.rand.Next(2) == 0) + { + if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + 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 = (CalamityWorld.bossRushActive ? 18f : 8f); + 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 = 24; + int num185 = mod.ProjectileType("AbyssMine"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 3; 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, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + 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 = (CalamityWorld.bossRushActive ? 18f : 8f); + 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 = expertMode ? 19 : 21; + int num185 = mod.ProjectileType("AbyssBallVolley"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 4; 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, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + npc.aiAction = 0; + npc.knockBackResist = 0.2f * Main.knockBackMultiplier; + npc.noTileCollide = false; + npc.noGravity = false; + npc.reflectingProjectiles = false; + if (npc.ai[0] != 7f && Main.player[npc.target].dead) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead) + { + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + Vector2 vector271 = Main.player[npc.target].Center - vector; + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + else if (npc.ai[0] == 1f) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 18f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 2f) + { + if ((Main.player[npc.target].Center - vector).Length() > (hyperMode ? 1200f : 2400f)) //1200 + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X * 0.8f; + npc.ai[1] += flag100 ? 1f : 3f; + float num1879 = 15f + 30f * ((float)npc.life / (float)npc.lifeMax); + float num1880 = 3f + 4f * (1f - (float)npc.life / (float)npc.lifeMax); + float num1881 = 8f; + if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + num1881 += 2f; + } + if (npc.ai[1] > num1879) + { + npc.ai[3] += 1f; + if (npc.ai[3] >= 2f) + { + npc.ai[3] = 0f; + num1881 *= 2f; + num1880 /= 2f; + } + npc.ai[1] = 0f; + npc.velocity.Y = npc.velocity.Y - num1881; + npc.velocity.X = num1880 * (float)npc.direction; + } + } + else + { + npc.knockBackResist = 0f; + npc.velocity.X = npc.velocity.X * 0.99f; + if (npc.direction < 0 && npc.velocity.X > -1f) + { + npc.velocity.X = -1f; + } + if (npc.direction > 0 && npc.velocity.X < 1f) + { + npc.velocity.X = 1f; + } + } + npc.ai[2] += 1f; + if ((double)npc.ai[2] > 360.0 && npc.velocity.Y == 0f && Main.netMode != 1) + { + int num1882 = Main.rand.Next(3); + if (num1882 == 0) + { + npc.ai[0] = 3f; + } + else if (num1882 == 1) + { + npc.ai[0] = 4f; + npc.noTileCollide = true; + npc.velocity.Y = -8f; + } + else if (num1882 == 2) + { + npc.ai[0] = 6f; + } + else + { + npc.ai[0] = 2f; + } + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + npc.velocity.X = npc.velocity.X * 0.85f; + npc.ai[1] += 1f; + if (npc.ai[1] >= 80f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 4f) + { + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.TargetClosest(true); + Vector2 center40 = Main.player[npc.target].Center; + center40.Y -= 350f; + Vector2 vector272 = center40 - vector; + if (npc.ai[2] == 1f) + { + npc.ai[1] += 1f; + vector272 = Main.player[npc.target].Center - vector; + vector272.Normalize(); + vector272 *= 8f; + npc.velocity = (npc.velocity * 4f + vector272) / 5f; + if (npc.ai[1] > 6f) + { + npc.ai[1] = 0f; + npc.ai[0] = 4.1f; + npc.ai[2] = 0f; + npc.velocity = vector272; + } + } + else + { + if (Math.Abs(vector.X - Main.player[npc.target].Center.X) < 40f && vector.Y < Main.player[npc.target].Center.Y - 300f) + { + npc.ai[1] = 0f; + npc.ai[2] = 1f; + return; + } + vector272.Normalize(); + vector272 *= 12f; + npc.velocity = (npc.velocity * 5f + vector272) / 6f; + } + } + else if (npc.ai[0] == 4.1f) + { + npc.knockBackResist = 0f; + if (npc.ai[2] == 0f && Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[2] = 1f; + } + if (npc.position.Y + (float)npc.height >= Main.player[npc.target].position.Y || npc.velocity.Y <= 0f) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 10f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 5f; + } + } + } + else if (npc.ai[2] == 0f) + { + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 16f) + { + npc.velocity.Y = 16f; + } + } + else + { + if (npc.ai[0] == 5f) + { + npc.localAI[0] += (float)Main.rand.Next(4, 9); + if (npc.velocity.X > 0f) + { + npc.direction = 1; + } + else + { + npc.direction = -1; + } + npc.spriteDirection = npc.direction; + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + Vector2 value74 = Main.player[npc.target].Center - vector; + value74.Y -= 4f; + if (value74.Length() < 200f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + if (value74.Length() > 10f) + { + value74.Normalize(); + value74 *= 10f; + } + npc.velocity = (npc.velocity * 4f + value74) / 4.8f; //5 + return; + } + if (npc.ai[0] == 6f) + { + npc.knockBackResist = 0f; + if (npc.velocity.Y == 0f) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X * 0.8f; + npc.ai[1] += 1f; + if (npc.ai[1] > 5f) + { + npc.ai[1] = 0f; + npc.velocity.Y = npc.velocity.Y - 4f; + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y) + { + npc.velocity.Y = npc.velocity.Y - 1.25f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 40f) + { + npc.velocity.Y = npc.velocity.Y - 1.5f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 80f) + { + npc.velocity.Y = npc.velocity.Y - 1.75f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 120f) + { + npc.velocity.Y = npc.velocity.Y - 2f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 160f) + { + npc.velocity.Y = npc.velocity.Y - 2.25f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 200f) + { + npc.velocity.Y = npc.velocity.Y - 2.5f; + } + if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.velocity.Y = npc.velocity.Y - 2f; + } + npc.velocity.X = (float)(12 * npc.direction); + npc.ai[2] += 1f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.98f; + if (npc.direction < 0 && npc.velocity.X > -8f) + { + npc.velocity.X = -8f; + } + if (npc.direction > 0 && npc.velocity.X < 8f) + { + npc.velocity.X = 8f; + } + } + if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.ai[0] == 7f) + { + npc.life = npc.lifeMax; + npc.defense = 9999; + npc.noTileCollide = true; + npc.alpha += 7; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + if (npc.alpha > 255) + { + npc.alpha = 255; + } + npc.velocity.X = npc.velocity.X * 0.98f; + } + } + int num244 = Dust.NewDust(npc.position, npc.width, npc.height, 173, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); + Main.dust[num244].noGravity = true; + Main.dust[num244].velocity *= 0.5f; + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + float num644 = 1f; + if (npc.life > 0) + { + float num659 = (float)npc.life / (float)npc.lifeMax; + num659 = num659 * 0.5f + 0.75f; + num659 *= num644; + if (num659 != npc.scale) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)npc.height; + npc.scale = num659; + npc.width = (int)(150f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)npc.height; + } + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.15); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + int num661 = Main.rand.Next(1, 3); + 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("SlimeSpawnCorrupt"); + 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; + Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[num664].ai[1] = 0f; + if (Main.netMode == 2 && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + + public override bool CheckActive() + { + if (CalamityGlobalNPC.slimeGod != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGod].active) + return false; + } + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + } + + 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.Weak, 180, true); + } + } +} diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 0369c372db..17fd7cb36c 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -1,375 +1,375 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SlimeGod -{ - [AutoloadBossHead] - public class SlimeGodCore : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Slime God"); - } - - public override void SetDefaults() - { - npc.damage = 60; - npc.npcSlots = 10f; - npc.width = 44; //324 - npc.height = 44; //216 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 3750 : 3000; - if (CalamityWorld.death) - { - npc.lifeMax = 5250; - } - if (CalamityWorld.bossRushActive) - { - 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 - aiType = -1; //new - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 8, 0, 0); - npc.alpha = 80; - animationType = 10; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - else - music = MusicID.Boss1; - bossBag = mod.ItemType("SlimeGodBag"); - } - - public override void AI() - { - CalamityGlobalNPC.slimeGod = npc.whoAmI; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 173; - } - else - { - randomDust = 260; - } - int num658 = Dust.NewDust(npc.position, npc.width, npc.height, randomDust, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); - Main.dust[num658].noGravity = true; - Main.dust[num658].velocity *= 0.5f; - bool flag100 = false; - if (!CalamityWorld.bossRushActive) - { - if (CalamityGlobalNPC.slimeGodRed != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { - flag100 = true; - } - } - if (CalamityGlobalNPC.slimeGodPurple != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { - flag100 = true; - } - } - } - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, 30f); - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int x = 0; x < 200; x++) - { - if (Main.npc[x].type == mod.NPCType("SlimeGod") || Main.npc[x].type == mod.NPCType("SlimeGodSplit") || - Main.npc[x].type == mod.NPCType("SlimeGodRun") || Main.npc[x].type == mod.NPCType("SlimeGodRunSplit")) - { - Main.npc[x].active = false; - Main.npc[x].netUpdate = true; - } - } - npc.active = false; - npc.netUpdate = true; - } - return; - } - } - else if (npc.timeLeft < 2400) - { - npc.timeLeft = 2400; - } - if (!flag100) - { - npc.damage = expertMode ? 128 : 80; - if (Main.netMode != 1) - { - 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) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num179 = revenge ? 2f : 3f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.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 = 24; - int num185 = Main.rand.Next(2); - if (num185 == 0) - { - num185 = mod.ProjectileType("AbyssMine"); - } - else - { - num185 = mod.ProjectileType("AbyssMine2"); - num184 = 22; - } - value9.X += num180; - value9.Y += num182; - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - else if (npc.localAI[1] >= 75f) - { - npc.localAI[1] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num179 = revenge ? 6f : 5f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.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 = expertMode ? 19 : 21; - int num185 = Main.rand.Next(2); - if (num185 == 0) - { - num185 = mod.ProjectileType("AbyssBallVolley"); - } - else - { - num185 = mod.ProjectileType("AbyssBallVolley2"); - num184 = expertMode ? 17 : 19; - } - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-30, 31); - num182 += (float)Main.rand.Next(-30, 31); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - npc.TargetClosest(true); - float num1372 = 6f; - if (!flag100) - { - num1372 = 14f; - } - else if (revenge) - { - num1372 = 10f; - } - if (CalamityWorld.bossRushActive || player.gravDir == -1f) - { - num1372 = 22f; - } - if (npc.GetGlobalNPC(mod).enraged || player.gravDir == -1f || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1372 += 8f; - } - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; - float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; - npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - return false; - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.HealingPotion; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 40; - npc.height = 40; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default(Color), 3f); - 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, 4, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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.VortexDebuff, 240, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 120, true); - player.AddBuff(mod.BuffType("MarkedforDeath"), 120); - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SlimeGod +{ + [AutoloadBossHead] + public class SlimeGodCore : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Slime God"); + } + + public override void SetDefaults() + { + npc.damage = 60; + npc.npcSlots = 10f; + npc.width = 44; //324 + npc.height = 44; //216 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 3750 : 3000; + if (CalamityWorld.death) + { + npc.lifeMax = 5250; + } + if (CalamityWorld.bossRushActive) + { + 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 + aiType = -1; //new + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 8, 0, 0); + npc.alpha = 80; + animationType = 10; + npc.boss = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); + else + music = MusicID.Boss1; + bossBag = mod.ItemType("SlimeGodBag"); + } + + public override void AI() + { + CalamityGlobalNPC.slimeGod = npc.whoAmI; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 173; + } + else + { + randomDust = 260; + } + int num658 = Dust.NewDust(npc.position, npc.width, npc.height, randomDust, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); + Main.dust[num658].noGravity = true; + Main.dust[num658].velocity *= 0.5f; + bool flag100 = false; + if (!CalamityWorld.bossRushActive) + { + if (CalamityGlobalNPC.slimeGodRed != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) + { + flag100 = true; + } + } + if (CalamityGlobalNPC.slimeGodPurple != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) + { + flag100 = true; + } + } + } + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, 30f); + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int x = 0; x < 200; x++) + { + if (Main.npc[x].type == mod.NPCType("SlimeGod") || Main.npc[x].type == mod.NPCType("SlimeGodSplit") || + Main.npc[x].type == mod.NPCType("SlimeGodRun") || Main.npc[x].type == mod.NPCType("SlimeGodRunSplit")) + { + Main.npc[x].active = false; + Main.npc[x].netUpdate = true; + } + } + npc.active = false; + npc.netUpdate = true; + } + return; + } + } + else if (npc.timeLeft < 2400) + { + npc.timeLeft = 2400; + } + if (!flag100) + { + npc.damage = expertMode ? 128 : 80; + if (Main.netMode != 1) + { + 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) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + float num179 = revenge ? 2f : 3f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.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 = 24; + int num185 = Main.rand.Next(2); + if (num185 == 0) + { + num185 = mod.ProjectileType("AbyssMine"); + } + else + { + num185 = mod.ProjectileType("AbyssMine2"); + num184 = 22; + } + value9.X += num180; + value9.Y += num182; + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + else if (npc.localAI[1] >= 75f) + { + npc.localAI[1] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + float num179 = revenge ? 6f : 5f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.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 = expertMode ? 19 : 21; + int num185 = Main.rand.Next(2); + if (num185 == 0) + { + num185 = mod.ProjectileType("AbyssBallVolley"); + } + else + { + num185 = mod.ProjectileType("AbyssBallVolley2"); + num184 = expertMode ? 17 : 19; + } + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 2; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-30, 31); + num182 += (float)Main.rand.Next(-30, 31); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + npc.TargetClosest(true); + float num1372 = 6f; + if (!flag100) + { + num1372 = 14f; + } + else if (revenge) + { + num1372 = 10f; + } + if (CalamityWorld.bossRushActive || player.gravDir == -1f) + { + num1372 = 22f; + } + if (npc.GetGlobalNPC(mod).enraged || player.gravDir == -1f || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num1372 += 8f; + } + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + float num1374 = player.Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.ai[0] -= 1f; + if (num1375 < 200f || npc.ai[0] > 0f) + { + if (num1375 < 200f) + { + npc.ai[0] = 20f; + } + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + return; + } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + if (num1375 < 350f) + { + npc.velocity.X = (npc.velocity.X * 10f + num1373) / 11f; + npc.velocity.Y = (npc.velocity.Y * 10f + num1374) / 11f; + } + if (num1375 < 300f) + { + npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; + npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + return false; + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.HealingPotion; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 40; + npc.height = 40; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default(Color), 3f); + 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, 4, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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.VortexDebuff, 240, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 120, true); + player.AddBuff(mod.BuffType("MarkedforDeath"), 120); + } + } + } +} diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 0394cb1286..e5a0313c77 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -1,594 +1,594 @@ -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 Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SlimeGod -{ - [AutoloadBossHead] - public class SlimeGodRun : ModNPC - { - private float bossLife; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimulan Slime God"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 60; - npc.width = 150; - npc.height = 92; - npc.scale = 1.1f; - npc.defense = 25; - npc.lifeMax = CalamityWorld.revenge ? 4813 : 3500; - if (CalamityWorld.death) - { - npc.lifeMax = 6738; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2000000 : 1600000; - } - 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; - npc.value = 0f; - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - else - music = MusicID.Boss1; - npc.aiStyle = -1; - aiType = -1; - bossBag = mod.ItemType("SlimeGodBag"); - } - - public override void AI() - { - CalamityGlobalNPC.slimeGodRed = npc.whoAmI; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - Vector2 vector = npc.Center; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5400f) - { - npc.position.X = (float)(Main.player[npc.target].Center.X / 16) * 16f - (float)(npc.width / 2); - npc.position.Y = ((float)(Main.player[npc.target].Center.Y / 16) * 16f - (float)(npc.height / 2)) - 150f; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.5 && Main.netMode != 1) - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 1); - Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X - 30, (int)spawnAt.Y, mod.NPCType("SlimeGodRunSplit")); - NPC.NewNPC((int)spawnAt.X + 30, (int)spawnAt.Y, mod.NPCType("SlimeGodRunSplit")); - npc.active = false; - npc.netUpdate = true; - return; - } - bool flag100 = false; - bool hyperMode = false; - if (CalamityGlobalNPC.slimeGodPurple != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { - flag100 = true; - } - } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) - { - hyperMode = true; - flag100 = false; - } - if (!flag100) - { - npc.defense = revenge ? 45 : 30; - } - if (Main.netMode != 1) - { - if (!flag100) - { - npc.localAI[0] += 2f; - } - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - npc.localAI[0] += 1f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.localAI[0] += 1f; - } - if (expertMode && Main.rand.Next(2) == 0) - { - if (npc.localAI[0] >= 450f) - { - npc.localAI[0] = 0f; - 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 = revenge ? 9f : 8f; - if (CalamityWorld.bossRushActive) - num179 += 7f; - 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 = 22; - int num185 = mod.ProjectileType("AbyssMine2"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; 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, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else if (npc.localAI[0] >= 450f) - { - npc.localAI[0] = 0f; - 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 = revenge ? 9f : 8f; - if (CalamityWorld.bossRushActive) - num179 += 7f; - 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 = expertMode ? 17 : 19; - int num185 = mod.ProjectileType("AbyssBallVolley2"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; 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(-30, 31); - num182 += (float)Main.rand.Next(-30, 31); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - npc.aiAction = 0; - npc.knockBackResist = 0.2f * Main.knockBackMultiplier; - npc.noTileCollide = false; - npc.noGravity = false; - npc.reflectingProjectiles = false; - if (npc.ai[0] != 7f && Main.player[npc.target].dead) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead) - { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - Vector2 vector271 = Main.player[npc.target].Center - vector; - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - else if (npc.ai[0] == 1f) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 9f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 2f) - { - if ((Main.player[npc.target].Center - vector).Length() > (hyperMode ? 1200f : 2400f)) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X * 0.85f; - npc.ai[1] += 1f; - float num1879 = 15f + 30f * ((float)npc.life / (float)npc.lifeMax); - float num1880 = 6f + 8f * (1f - (float)npc.life / (float)npc.lifeMax); - float num1881 = 4f; - if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - num1881 += 2f; - } - if (npc.ai[1] > num1879) - { - npc.ai[3] += 1f; - if (npc.ai[3] >= 4f) - { - npc.ai[3] = 0f; - num1881 *= 2f; - num1880 /= 2f; - } - npc.ai[1] = 0f; - npc.velocity.Y = npc.velocity.Y - num1881; - npc.velocity.X = num1880 * (float)npc.direction; - } - } - else - { - npc.knockBackResist = 0f; - npc.velocity.X = npc.velocity.X * 0.99f; - if (npc.direction < 0 && npc.velocity.X > -1f) - { - npc.velocity.X = -1f; - } - if (npc.direction > 0 && npc.velocity.X < 1f) - { - npc.velocity.X = 1f; - } - } - npc.ai[2] += 1f; - if ((double)npc.ai[2] > 300.0 && npc.velocity.Y == 0f && Main.netMode != 1) - { - int num1882 = Main.rand.Next(3); - if (num1882 == 0) - { - npc.ai[0] = 3f; - } - else if (num1882 == 1) - { - npc.ai[0] = 4f; - npc.noTileCollide = true; - npc.velocity.Y = -8f; - } - else if (num1882 == 2) - { - npc.ai[0] = 6f; - } - else - { - npc.ai[0] = 2f; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - npc.velocity.X = npc.velocity.X * 0.85f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 40f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 4f) - { - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.TargetClosest(true); - Vector2 center40 = Main.player[npc.target].Center; - center40.Y -= 350f; - Vector2 vector272 = center40 - vector; - if (npc.ai[2] == 1f) - { - npc.ai[1] += 1f; - vector272 = Main.player[npc.target].Center - vector; - vector272.Normalize(); - vector272 *= 8f; - npc.velocity = (npc.velocity * 4f + vector272) / 5f; - if (npc.ai[1] > 6f) - { - npc.ai[1] = 0f; - npc.ai[0] = 4.1f; - npc.ai[2] = 0f; - npc.velocity = vector272; - } - } - else - { - if (Math.Abs(vector.X - Main.player[npc.target].Center.X) < 40f && vector.Y < Main.player[npc.target].Center.Y - 300f) - { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - return; - } - vector272.Normalize(); - vector272 *= 12f; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; - } - } - else if (npc.ai[0] == 4.1f) - { - npc.knockBackResist = 0f; - if (npc.ai[2] == 0f && Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[2] = 1f; - } - if (npc.position.Y + (float)npc.height >= Main.player[npc.target].position.Y || npc.velocity.Y <= 0f) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 5f; - } - } - } - else if (npc.ai[2] == 0f) - { - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 18f) - { - npc.velocity.Y = 18f; - } - } - else - { - if (npc.ai[0] == 5f) - { - if (npc.velocity.X > 0f) - { - npc.direction = 1; - } - else - { - npc.direction = -1; - } - npc.spriteDirection = npc.direction; - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - Vector2 value74 = Main.player[npc.target].Center - vector; - value74.Y -= 4f; - if (value74.Length() < 300f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (value74.Length() > 10f) - { - value74.Normalize(); - value74 *= 10f; - } - npc.velocity = (npc.velocity * 4f + value74) / 4.8f; //5 - return; - } - if (npc.ai[0] == 6f) - { - npc.knockBackResist = 0f; - if (npc.velocity.Y == 0f) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X * 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 5f) - { - npc.ai[1] = 0f; - npc.velocity.Y = npc.velocity.Y - 4f; - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y) - { - npc.velocity.Y = npc.velocity.Y - 1.25f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 40f) - { - npc.velocity.Y = npc.velocity.Y - 1.5f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 80f) - { - npc.velocity.Y = npc.velocity.Y - 1.75f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 120f) - { - npc.velocity.Y = npc.velocity.Y - 2f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 160f) - { - npc.velocity.Y = npc.velocity.Y - 2.25f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 200f) - { - npc.velocity.Y = npc.velocity.Y - 2.5f; - } - if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.velocity.Y = npc.velocity.Y - 2f; - } - npc.velocity.X = (float)(12 * npc.direction); - npc.ai[2] += 1f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.98f; - if (npc.direction < 0 && npc.velocity.X > -8f) - { - npc.velocity.X = -8f; - } - if (npc.direction > 0 && npc.velocity.X < 8f) - { - npc.velocity.X = 8f; - } - } - if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.ai[0] == 7f) - { - npc.life = npc.lifeMax; - npc.defense = 9999; - npc.noTileCollide = true; - npc.alpha += 7; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - if (npc.alpha > 255) - { - npc.alpha = 255; - } - npc.velocity.X = npc.velocity.X * 0.98f; - } - } - int num658 = Dust.NewDust(npc.position, npc.width, npc.height, 260, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); - Main.dust[num658].noGravity = true; - Main.dust[num658].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - float num644 = 1f; - if (npc.life > 0) - { - float num659 = (float)npc.life / (float)npc.lifeMax; - num659 = num659 * 0.5f + 0.75f; - num659 *= num644; - if (num659 != npc.scale) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; - } - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - int num661 = 1; - 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("SlimeSpawnCrimson"); - if (Main.rand.Next(3) == 0) - { - num663 = mod.NPCType("SlimeSpawnCrimson2"); - } - 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; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == 2 && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - - public override bool CheckActive() - { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - } - - 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.Cursed, 90, true); - } - } -} \ No newline at end of file +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 Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SlimeGod +{ + [AutoloadBossHead] + public class SlimeGodRun : ModNPC + { + private float bossLife; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimulan Slime God"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 60; + npc.width = 150; + npc.height = 92; + npc.scale = 1.1f; + npc.defense = 25; + npc.lifeMax = CalamityWorld.revenge ? 4813 : 3500; + if (CalamityWorld.death) + { + npc.lifeMax = 6738; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2000000 : 1600000; + } + 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; + npc.value = 0f; + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); + else + music = MusicID.Boss1; + npc.aiStyle = -1; + aiType = -1; + bossBag = mod.ItemType("SlimeGodBag"); + } + + public override void AI() + { + CalamityGlobalNPC.slimeGodRed = npc.whoAmI; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + Vector2 vector = npc.Center; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5400f) + { + npc.position.X = (float)(Main.player[npc.target].Center.X / 16) * 16f - (float)(npc.width / 2); + npc.position.Y = ((float)(Main.player[npc.target].Center.Y / 16) * 16f - (float)(npc.height / 2)) - 150f; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.5 && Main.netMode != 1) + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 1); + Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X - 30, (int)spawnAt.Y, mod.NPCType("SlimeGodRunSplit")); + NPC.NewNPC((int)spawnAt.X + 30, (int)spawnAt.Y, mod.NPCType("SlimeGodRunSplit")); + npc.active = false; + npc.netUpdate = true; + return; + } + bool flag100 = false; + bool hyperMode = false; + if (CalamityGlobalNPC.slimeGodPurple != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) + { + flag100 = true; + } + } + if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) + { + hyperMode = true; + flag100 = false; + } + if (!flag100) + { + npc.defense = revenge ? 45 : 30; + } + if (Main.netMode != 1) + { + if (!flag100) + { + npc.localAI[0] += 2f; + } + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + npc.localAI[0] += 1f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.localAI[0] += 1f; + } + if (expertMode && Main.rand.Next(2) == 0) + { + if (npc.localAI[0] >= 450f) + { + npc.localAI[0] = 0f; + 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 = revenge ? 9f : 8f; + if (CalamityWorld.bossRushActive) + num179 += 7f; + 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 = 22; + int num185 = mod.ProjectileType("AbyssMine2"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 2; 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, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else if (npc.localAI[0] >= 450f) + { + npc.localAI[0] = 0f; + 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 = revenge ? 9f : 8f; + if (CalamityWorld.bossRushActive) + num179 += 7f; + 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 = expertMode ? 17 : 19; + int num185 = mod.ProjectileType("AbyssBallVolley2"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 2; 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(-30, 31); + num182 += (float)Main.rand.Next(-30, 31); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + npc.aiAction = 0; + npc.knockBackResist = 0.2f * Main.knockBackMultiplier; + npc.noTileCollide = false; + npc.noGravity = false; + npc.reflectingProjectiles = false; + if (npc.ai[0] != 7f && Main.player[npc.target].dead) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead) + { + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + Vector2 vector271 = Main.player[npc.target].Center - vector; + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + else if (npc.ai[0] == 1f) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 9f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 2f) + { + if ((Main.player[npc.target].Center - vector).Length() > (hyperMode ? 1200f : 2400f)) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X * 0.85f; + npc.ai[1] += 1f; + float num1879 = 15f + 30f * ((float)npc.life / (float)npc.lifeMax); + float num1880 = 6f + 8f * (1f - (float)npc.life / (float)npc.lifeMax); + float num1881 = 4f; + if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + num1881 += 2f; + } + if (npc.ai[1] > num1879) + { + npc.ai[3] += 1f; + if (npc.ai[3] >= 4f) + { + npc.ai[3] = 0f; + num1881 *= 2f; + num1880 /= 2f; + } + npc.ai[1] = 0f; + npc.velocity.Y = npc.velocity.Y - num1881; + npc.velocity.X = num1880 * (float)npc.direction; + } + } + else + { + npc.knockBackResist = 0f; + npc.velocity.X = npc.velocity.X * 0.99f; + if (npc.direction < 0 && npc.velocity.X > -1f) + { + npc.velocity.X = -1f; + } + if (npc.direction > 0 && npc.velocity.X < 1f) + { + npc.velocity.X = 1f; + } + } + npc.ai[2] += 1f; + if ((double)npc.ai[2] > 300.0 && npc.velocity.Y == 0f && Main.netMode != 1) + { + int num1882 = Main.rand.Next(3); + if (num1882 == 0) + { + npc.ai[0] = 3f; + } + else if (num1882 == 1) + { + npc.ai[0] = 4f; + npc.noTileCollide = true; + npc.velocity.Y = -8f; + } + else if (num1882 == 2) + { + npc.ai[0] = 6f; + } + else + { + npc.ai[0] = 2f; + } + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + npc.velocity.X = npc.velocity.X * 0.85f; + npc.ai[1] += 1f; + if (npc.ai[1] >= 40f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 4f) + { + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.TargetClosest(true); + Vector2 center40 = Main.player[npc.target].Center; + center40.Y -= 350f; + Vector2 vector272 = center40 - vector; + if (npc.ai[2] == 1f) + { + npc.ai[1] += 1f; + vector272 = Main.player[npc.target].Center - vector; + vector272.Normalize(); + vector272 *= 8f; + npc.velocity = (npc.velocity * 4f + vector272) / 5f; + if (npc.ai[1] > 6f) + { + npc.ai[1] = 0f; + npc.ai[0] = 4.1f; + npc.ai[2] = 0f; + npc.velocity = vector272; + } + } + else + { + if (Math.Abs(vector.X - Main.player[npc.target].Center.X) < 40f && vector.Y < Main.player[npc.target].Center.Y - 300f) + { + npc.ai[1] = 0f; + npc.ai[2] = 1f; + return; + } + vector272.Normalize(); + vector272 *= 12f; + npc.velocity = (npc.velocity * 5f + vector272) / 6f; + } + } + else if (npc.ai[0] == 4.1f) + { + npc.knockBackResist = 0f; + if (npc.ai[2] == 0f && Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[2] = 1f; + } + if (npc.position.Y + (float)npc.height >= Main.player[npc.target].position.Y || npc.velocity.Y <= 0f) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 10f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 5f; + } + } + } + else if (npc.ai[2] == 0f) + { + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 18f) + { + npc.velocity.Y = 18f; + } + } + else + { + if (npc.ai[0] == 5f) + { + if (npc.velocity.X > 0f) + { + npc.direction = 1; + } + else + { + npc.direction = -1; + } + npc.spriteDirection = npc.direction; + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + Vector2 value74 = Main.player[npc.target].Center - vector; + value74.Y -= 4f; + if (value74.Length() < 300f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + if (value74.Length() > 10f) + { + value74.Normalize(); + value74 *= 10f; + } + npc.velocity = (npc.velocity * 4f + value74) / 4.8f; //5 + return; + } + if (npc.ai[0] == 6f) + { + npc.knockBackResist = 0f; + if (npc.velocity.Y == 0f) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X * 0.8f; + npc.ai[1] += 1f; + if (npc.ai[1] > 5f) + { + npc.ai[1] = 0f; + npc.velocity.Y = npc.velocity.Y - 4f; + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y) + { + npc.velocity.Y = npc.velocity.Y - 1.25f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 40f) + { + npc.velocity.Y = npc.velocity.Y - 1.5f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 80f) + { + npc.velocity.Y = npc.velocity.Y - 1.75f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 120f) + { + npc.velocity.Y = npc.velocity.Y - 2f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 160f) + { + npc.velocity.Y = npc.velocity.Y - 2.25f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 200f) + { + npc.velocity.Y = npc.velocity.Y - 2.5f; + } + if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.velocity.Y = npc.velocity.Y - 2f; + } + npc.velocity.X = (float)(12 * npc.direction); + npc.ai[2] += 1f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.98f; + if (npc.direction < 0 && npc.velocity.X > -8f) + { + npc.velocity.X = -8f; + } + if (npc.direction > 0 && npc.velocity.X < 8f) + { + npc.velocity.X = 8f; + } + } + if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.ai[0] == 7f) + { + npc.life = npc.lifeMax; + npc.defense = 9999; + npc.noTileCollide = true; + npc.alpha += 7; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + if (npc.alpha > 255) + { + npc.alpha = 255; + } + npc.velocity.X = npc.velocity.X * 0.98f; + } + } + int num658 = Dust.NewDust(npc.position, npc.width, npc.height, 260, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); + Main.dust[num658].noGravity = true; + Main.dust[num658].velocity *= 0.5f; + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + float num644 = 1f; + if (npc.life > 0) + { + float num659 = (float)npc.life / (float)npc.lifeMax; + num659 = num659 * 0.5f + 0.75f; + num659 *= num644; + if (num659 != npc.scale) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)npc.height; + npc.scale = num659; + npc.width = (int)(150f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)npc.height; + } + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.05); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + int num661 = 1; + 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("SlimeSpawnCrimson"); + if (Main.rand.Next(3) == 0) + { + num663 = mod.NPCType("SlimeSpawnCrimson2"); + } + 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; + Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[num664].ai[1] = 0f; + if (Main.netMode == 2 && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + + public override bool CheckActive() + { + if (CalamityGlobalNPC.slimeGod != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGod].active) + return false; + } + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + } + + 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.Cursed, 90, true); + } + } +} diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index c26fb057ce..e4da9c6578 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -1,596 +1,596 @@ -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 Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SlimeGod -{ - [AutoloadBossHead] - public class SlimeGodRunSplit : ModNPC - { - private float bossLife; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimulan Slime God"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.lifeMax = CalamityWorld.revenge ? 2407 : 1750; - if (CalamityWorld.death) - { - npc.lifeMax = 3369; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.damage = 50; - npc.width = 150; - npc.height = 92; - npc.scale = 0.8f; - npc.defense = 20; - npc.knockBackResist = 0f; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - animationType = 50; - npc.value = Item.buyPrice(0, 1, 0, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - else - music = MusicID.Boss1; - npc.aiStyle = -1; - aiType = -1; - bossBag = mod.ItemType("SlimeGodBag"); - } - - public override void AI() - { - CalamityGlobalNPC.slimeGodRed = npc.whoAmI; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - Vector2 vector = npc.Center; - bool flag100 = false; - bool hyperMode = false; - if (CalamityGlobalNPC.slimeGodPurple != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { - flag100 = true; - } - } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) - { - hyperMode = true; - flag100 = false; - } - if (!flag100) - { - npc.defense = revenge ? 45 : 30; - } - if (Main.netMode != 1) - { - if (!flag100) - { - npc.localAI[0] += 2f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - npc.localAI[0] += 1f; - } - if (expertMode && Main.rand.Next(2) == 0) - { - if (npc.localAI[0] >= 450f) - { - npc.localAI[0] = 0f; - 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 = revenge ? 9f : 8f; - if (CalamityWorld.bossRushActive) - num179 += 7f; - 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 = 22; - int num185 = mod.ProjectileType("AbyssMine2"); - value9.X += num180; - value9.Y += num182; - 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(-30, 31); - num182 += (float)Main.rand.Next(-30, 31); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - else if (npc.localAI[0] >= 450f) - { - npc.localAI[0] = 0f; - 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 = revenge ? 9f : 8f; - if (CalamityWorld.bossRushActive) - num179 += 7f; - 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 = expertMode ? 17 : 19; - int num185 = mod.ProjectileType("AbyssBallVolley2"); - value9.X += num180; - value9.Y += num182; - 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(-20, 21); - num182 += (float)Main.rand.Next(-20, 21); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - npc.aiAction = 0; - npc.knockBackResist = 0.2f * Main.knockBackMultiplier; - npc.noTileCollide = false; - npc.noGravity = false; - npc.reflectingProjectiles = false; - if (npc.ai[0] != 7f && Main.player[npc.target].dead) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead) - { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - Vector2 vector271 = Main.player[npc.target].Center - vector; - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - else if (npc.ai[0] == 1f) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 6f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 2f) - { - if ((Main.player[npc.target].Center - vector).Length() > (hyperMode ? 1200f : 3600f)) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X * 0.85f; - npc.ai[1] += 1f; - float num1879 = 15f + 30f * ((float)npc.life / (float)npc.lifeMax); - float num1880 = 6f + 8f * (1f - (float)npc.life / (float)npc.lifeMax); - float num1881 = 4f; - if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - num1881 += 2f; - } - if (npc.ai[1] > num1879) - { - npc.ai[3] += 1f; - if (npc.ai[3] >= 2f) - { - npc.ai[3] = 0f; - num1881 *= 2f; - num1880 /= 2f; - } - npc.ai[1] = 0f; - npc.velocity.Y = npc.velocity.Y - num1881; - npc.velocity.X = num1880 * (float)npc.direction; - } - } - else - { - npc.knockBackResist = 0f; - npc.velocity.X = npc.velocity.X * 0.99f; - if (npc.direction < 0 && npc.velocity.X > -1f) - { - npc.velocity.X = -1f; - } - if (npc.direction > 0 && npc.velocity.X < 1f) - { - npc.velocity.X = 1f; - } - } - npc.ai[2] += 1f; - if ((double)npc.ai[2] > 240.0 && npc.velocity.Y == 0f && Main.netMode != 1) - { - int num1882 = Main.rand.Next(3); - if (num1882 == 0) - { - npc.ai[0] = 3f; - } - else if (num1882 == 1) - { - npc.ai[0] = 4f; - npc.noTileCollide = true; - npc.velocity.Y = -8f; - } - else if (num1882 == 2) - { - npc.ai[0] = 6f; - } - else - { - npc.ai[0] = 2f; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - npc.velocity.X = npc.velocity.X * 0.85f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 4f) - { - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.TargetClosest(true); - Vector2 center40 = Main.player[npc.target].Center; - center40.Y -= 350f; - Vector2 vector272 = center40 - vector; - if (npc.ai[2] == 1f) - { - npc.ai[1] += 1f; - vector272 = Main.player[npc.target].Center - vector; - vector272.Normalize(); - vector272 *= 8f; - npc.velocity = (npc.velocity * 4f + vector272) / 5f; - if (npc.ai[1] > 6f) - { - npc.ai[1] = 0f; - npc.ai[0] = 4.1f; - npc.ai[2] = 0f; - npc.velocity = vector272; - } - } - else - { - if (Math.Abs(vector.X - Main.player[npc.target].Center.X) < 40f && vector.Y < Main.player[npc.target].Center.Y - 300f) - { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - return; - } - vector272.Normalize(); - vector272 *= 12f; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; - } - } - else if (npc.ai[0] == 4.1f) - { - npc.knockBackResist = 0f; - if (npc.ai[2] == 0f && Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[2] = 1f; - } - if (npc.position.Y + (float)npc.height >= Main.player[npc.target].position.Y || npc.velocity.Y <= 0f) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 5f; - } - } - } - else if (npc.ai[2] == 0f) - { - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 20f) - { - npc.velocity.Y = 20f; - } - } - else - { - if (npc.ai[0] == 5f) - { - if (npc.velocity.X > 0f) - { - npc.direction = 1; - } - else - { - npc.direction = -1; - } - npc.spriteDirection = npc.direction; - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - Vector2 value74 = Main.player[npc.target].Center - vector; - value74.Y -= 4f; - if (value74.Length() < 250f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (value74.Length() > 10f) - { - value74.Normalize(); - value74 *= 10f; - } - npc.velocity = (npc.velocity * 4f + value74) / 4.7f; //5 - return; - } - if (npc.ai[0] == 6f) - { - npc.knockBackResist = 0f; - if (npc.velocity.Y == 0f) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X * 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 5f) - { - npc.ai[1] = 0f; - npc.velocity.Y = npc.velocity.Y - 4f; - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y) - { - npc.velocity.Y = npc.velocity.Y - 1.25f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 40f) - { - npc.velocity.Y = npc.velocity.Y - 1.5f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 80f) - { - npc.velocity.Y = npc.velocity.Y - 1.75f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 120f) - { - npc.velocity.Y = npc.velocity.Y - 2f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 160f) - { - npc.velocity.Y = npc.velocity.Y - 2.25f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 200f) - { - npc.velocity.Y = npc.velocity.Y - 2.5f; - } - if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.velocity.Y = npc.velocity.Y - 2f; - } - npc.velocity.X = (float)(12 * npc.direction); - npc.ai[2] += 1f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.98f; - if (npc.direction < 0 && npc.velocity.X > -8f) - { - npc.velocity.X = -8f; - } - if (npc.direction > 0 && npc.velocity.X < 8f) - { - npc.velocity.X = 8f; - } - } - if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.ai[0] == 7f) - { - npc.life = npc.lifeMax; - npc.defense = 9999; - npc.noTileCollide = true; - npc.alpha += 7; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - if (npc.alpha > 255) - { - npc.alpha = 255; - } - npc.velocity.X = npc.velocity.X * 0.98f; - } - } - int num658 = Dust.NewDust(npc.position, npc.width, npc.height, 260, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); - Main.dust[num658].noGravity = true; - Main.dust[num658].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - float num644 = 1f; - if (npc.life > 0) - { - float num659 = (float)npc.life / (float)npc.lifeMax; - num659 = num659 * 0.5f + 0.75f; - num659 *= num644; - if (num659 != npc.scale) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659 * 0.75f; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; - } - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - int num661 = 1; - 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("SlimeSpawnCrimson"); - if (Main.rand.Next(3) == 0) - { - num663 = mod.NPCType("SlimeSpawnCrimson2"); - } - 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; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == 2 && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - - public override bool CheckActive() - { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default(Color), 3f); - 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, 4, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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.Cursed, 90, true); - } - } -} \ No newline at end of file +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 Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SlimeGod +{ + [AutoloadBossHead] + public class SlimeGodRunSplit : ModNPC + { + private float bossLife; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimulan Slime God"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.lifeMax = CalamityWorld.revenge ? 2407 : 1750; + if (CalamityWorld.death) + { + npc.lifeMax = 3369; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.damage = 50; + npc.width = 150; + npc.height = 92; + npc.scale = 0.8f; + npc.defense = 20; + npc.knockBackResist = 0f; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + animationType = 50; + npc.value = Item.buyPrice(0, 1, 0, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); + else + music = MusicID.Boss1; + npc.aiStyle = -1; + aiType = -1; + bossBag = mod.ItemType("SlimeGodBag"); + } + + public override void AI() + { + CalamityGlobalNPC.slimeGodRed = npc.whoAmI; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + Vector2 vector = npc.Center; + bool flag100 = false; + bool hyperMode = false; + if (CalamityGlobalNPC.slimeGodPurple != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) + { + flag100 = true; + } + } + if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) + { + hyperMode = true; + flag100 = false; + } + if (!flag100) + { + npc.defense = revenge ? 45 : 30; + } + if (Main.netMode != 1) + { + if (!flag100) + { + npc.localAI[0] += 2f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + npc.localAI[0] += 1f; + } + if (expertMode && Main.rand.Next(2) == 0) + { + if (npc.localAI[0] >= 450f) + { + npc.localAI[0] = 0f; + 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 = revenge ? 9f : 8f; + if (CalamityWorld.bossRushActive) + num179 += 7f; + 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 = 22; + int num185 = mod.ProjectileType("AbyssMine2"); + value9.X += num180; + value9.Y += num182; + 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(-30, 31); + num182 += (float)Main.rand.Next(-30, 31); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + else if (npc.localAI[0] >= 450f) + { + npc.localAI[0] = 0f; + 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 = revenge ? 9f : 8f; + if (CalamityWorld.bossRushActive) + num179 += 7f; + 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 = expertMode ? 17 : 19; + int num185 = mod.ProjectileType("AbyssBallVolley2"); + value9.X += num180; + value9.Y += num182; + 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(-20, 21); + num182 += (float)Main.rand.Next(-20, 21); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + npc.aiAction = 0; + npc.knockBackResist = 0.2f * Main.knockBackMultiplier; + npc.noTileCollide = false; + npc.noGravity = false; + npc.reflectingProjectiles = false; + if (npc.ai[0] != 7f && Main.player[npc.target].dead) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead) + { + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + Vector2 vector271 = Main.player[npc.target].Center - vector; + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + else if (npc.ai[0] == 1f) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 6f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 2f) + { + if ((Main.player[npc.target].Center - vector).Length() > (hyperMode ? 1200f : 3600f)) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X * 0.85f; + npc.ai[1] += 1f; + float num1879 = 15f + 30f * ((float)npc.life / (float)npc.lifeMax); + float num1880 = 6f + 8f * (1f - (float)npc.life / (float)npc.lifeMax); + float num1881 = 4f; + if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + num1881 += 2f; + } + if (npc.ai[1] > num1879) + { + npc.ai[3] += 1f; + if (npc.ai[3] >= 2f) + { + npc.ai[3] = 0f; + num1881 *= 2f; + num1880 /= 2f; + } + npc.ai[1] = 0f; + npc.velocity.Y = npc.velocity.Y - num1881; + npc.velocity.X = num1880 * (float)npc.direction; + } + } + else + { + npc.knockBackResist = 0f; + npc.velocity.X = npc.velocity.X * 0.99f; + if (npc.direction < 0 && npc.velocity.X > -1f) + { + npc.velocity.X = -1f; + } + if (npc.direction > 0 && npc.velocity.X < 1f) + { + npc.velocity.X = 1f; + } + } + npc.ai[2] += 1f; + if ((double)npc.ai[2] > 240.0 && npc.velocity.Y == 0f && Main.netMode != 1) + { + int num1882 = Main.rand.Next(3); + if (num1882 == 0) + { + npc.ai[0] = 3f; + } + else if (num1882 == 1) + { + npc.ai[0] = 4f; + npc.noTileCollide = true; + npc.velocity.Y = -8f; + } + else if (num1882 == 2) + { + npc.ai[0] = 6f; + } + else + { + npc.ai[0] = 2f; + } + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + npc.velocity.X = npc.velocity.X * 0.85f; + npc.ai[1] += 1f; + if (npc.ai[1] >= 30f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 4f) + { + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.TargetClosest(true); + Vector2 center40 = Main.player[npc.target].Center; + center40.Y -= 350f; + Vector2 vector272 = center40 - vector; + if (npc.ai[2] == 1f) + { + npc.ai[1] += 1f; + vector272 = Main.player[npc.target].Center - vector; + vector272.Normalize(); + vector272 *= 8f; + npc.velocity = (npc.velocity * 4f + vector272) / 5f; + if (npc.ai[1] > 6f) + { + npc.ai[1] = 0f; + npc.ai[0] = 4.1f; + npc.ai[2] = 0f; + npc.velocity = vector272; + } + } + else + { + if (Math.Abs(vector.X - Main.player[npc.target].Center.X) < 40f && vector.Y < Main.player[npc.target].Center.Y - 300f) + { + npc.ai[1] = 0f; + npc.ai[2] = 1f; + return; + } + vector272.Normalize(); + vector272 *= 12f; + npc.velocity = (npc.velocity * 5f + vector272) / 6f; + } + } + else if (npc.ai[0] == 4.1f) + { + npc.knockBackResist = 0f; + if (npc.ai[2] == 0f && Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[2] = 1f; + } + if (npc.position.Y + (float)npc.height >= Main.player[npc.target].position.Y || npc.velocity.Y <= 0f) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 10f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 5f; + } + } + } + else if (npc.ai[2] == 0f) + { + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 20f) + { + npc.velocity.Y = 20f; + } + } + else + { + if (npc.ai[0] == 5f) + { + if (npc.velocity.X > 0f) + { + npc.direction = 1; + } + else + { + npc.direction = -1; + } + npc.spriteDirection = npc.direction; + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + Vector2 value74 = Main.player[npc.target].Center - vector; + value74.Y -= 4f; + if (value74.Length() < 250f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + if (value74.Length() > 10f) + { + value74.Normalize(); + value74 *= 10f; + } + npc.velocity = (npc.velocity * 4f + value74) / 4.7f; //5 + return; + } + if (npc.ai[0] == 6f) + { + npc.knockBackResist = 0f; + if (npc.velocity.Y == 0f) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X * 0.8f; + npc.ai[1] += 1f; + if (npc.ai[1] > 5f) + { + npc.ai[1] = 0f; + npc.velocity.Y = npc.velocity.Y - 4f; + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y) + { + npc.velocity.Y = npc.velocity.Y - 1.25f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 40f) + { + npc.velocity.Y = npc.velocity.Y - 1.5f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 80f) + { + npc.velocity.Y = npc.velocity.Y - 1.75f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 120f) + { + npc.velocity.Y = npc.velocity.Y - 2f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 160f) + { + npc.velocity.Y = npc.velocity.Y - 2.25f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 200f) + { + npc.velocity.Y = npc.velocity.Y - 2.5f; + } + if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.velocity.Y = npc.velocity.Y - 2f; + } + npc.velocity.X = (float)(12 * npc.direction); + npc.ai[2] += 1f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.98f; + if (npc.direction < 0 && npc.velocity.X > -8f) + { + npc.velocity.X = -8f; + } + if (npc.direction > 0 && npc.velocity.X < 8f) + { + npc.velocity.X = 8f; + } + } + if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.ai[0] == 7f) + { + npc.life = npc.lifeMax; + npc.defense = 9999; + npc.noTileCollide = true; + npc.alpha += 7; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + if (npc.alpha > 255) + { + npc.alpha = 255; + } + npc.velocity.X = npc.velocity.X * 0.98f; + } + } + int num658 = Dust.NewDust(npc.position, npc.width, npc.height, 260, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.5f); + Main.dust[num658].noGravity = true; + Main.dust[num658].velocity *= 0.5f; + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + float num644 = 1f; + if (npc.life > 0) + { + float num659 = (float)npc.life / (float)npc.lifeMax; + num659 = num659 * 0.5f + 0.75f; + num659 *= num644; + if (num659 != npc.scale) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)npc.height; + npc.scale = num659 * 0.75f; + npc.width = (int)(150f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)npc.height; + } + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.05); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + int num661 = 1; + 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("SlimeSpawnCrimson"); + if (Main.rand.Next(3) == 0) + { + num663 = mod.NPCType("SlimeSpawnCrimson2"); + } + 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; + Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[num664].ai[1] = 0f; + if (Main.netMode == 2 && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + + public override bool CheckActive() + { + if (CalamityGlobalNPC.slimeGod != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGod].active) + return false; + } + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default(Color), 3f); + 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, 4, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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.Cursed, 90, true); + } + } +} diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 1e27e0da14..b7b1d31790 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -1,579 +1,579 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SlimeGod -{ - [AutoloadBossHead] - public class SlimeGodSplit : ModNPC - { - private float bossLife; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ebonian Slime God"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.lifeMax = CalamityWorld.revenge ? 2750 : 2000; - if (CalamityWorld.death) - { - npc.lifeMax = 3850; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1250000 : 1100000; - } - double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.damage = 50; - npc.width = 150; - npc.height = 92; - npc.scale = 0.8f; - npc.defense = 10; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.buffImmune[mod.BuffType("GlacialState")] = true; - npc.buffImmune[mod.BuffType("TemporalSadness")] = true; - animationType = 50; - npc.value = Item.buyPrice(0, 1, 0, 0); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - else - music = MusicID.Boss1; - bossBag = mod.ItemType("SlimeGodBag"); - } - - public override void AI() - { - CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - Vector2 vector = npc.Center; - bool flag100 = false; - bool hyperMode = false; - if (CalamityGlobalNPC.slimeGodRed != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { - flag100 = true; - } - } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) - { - hyperMode = true; - flag100 = false; - } - if (Main.netMode != 1) - { - npc.localAI[0] += flag100 ? 1f : 2f; - if (expertMode && Main.rand.Next(2) == 0) - { - if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - 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 = (CalamityWorld.bossRushActive ? 18f : 8f); - 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 = 24; - int num185 = mod.ProjectileType("AbyssMine"); - value9.X += num180; - value9.Y += num182; - 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(-30, 31); - num182 += (float)Main.rand.Next(-30, 31); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - if (npc.localAI[0] >= 600f) - { - npc.localAI[0] = 0f; - 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 = (CalamityWorld.bossRushActive ? 18f : 8f); - 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 = expertMode ? 19 : 21; - int num185 = mod.ProjectileType("AbyssBallVolley"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; 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(-20, 21); - num182 += (float)Main.rand.Next(-20, 21); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - npc.aiAction = 0; - npc.knockBackResist = 0.2f * Main.knockBackMultiplier; - npc.noTileCollide = false; - npc.noGravity = false; - npc.reflectingProjectiles = false; - if (npc.ai[0] != 7f && Main.player[npc.target].dead) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead) - { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - Vector2 vector271 = Main.player[npc.target].Center - vector; - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - else if (npc.ai[0] == 1f) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 12f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 2f) - { - if ((Main.player[npc.target].Center - vector).Length() > (hyperMode ? 1200f : 3600f)) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (npc.velocity.Y == 0f) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X * 0.8f; - npc.ai[1] += flag100 ? 1f : 3f; - float num1879 = 15f + 30f * ((float)npc.life / (float)npc.lifeMax); - float num1880 = 3f + 4f * (1f - (float)npc.life / (float)npc.lifeMax); - float num1881 = 8f; - if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - num1881 += 2f; - } - if (npc.ai[1] > num1879) - { - npc.ai[3] += 1f; - if (npc.ai[3] >= 1f) - { - npc.ai[3] = 0f; - num1881 *= 2f; - num1880 /= 2f; - } - npc.ai[1] = 0f; - npc.velocity.Y = npc.velocity.Y - num1881; - npc.velocity.X = num1880 * (float)npc.direction; - } - } - else - { - npc.knockBackResist = 0f; - npc.velocity.X = npc.velocity.X * 0.99f; - if (npc.direction < 0 && npc.velocity.X > -1f) - { - npc.velocity.X = -1f; - } - if (npc.direction > 0 && npc.velocity.X < 1f) - { - npc.velocity.X = 1f; - } - } - npc.ai[2] += 1f; - if ((double)npc.ai[2] > 150.0 && npc.velocity.Y == 0f && Main.netMode != 1) - { - int num1882 = Main.rand.Next(3); - if (num1882 == 0) - { - npc.ai[0] = 3f; - } - else if (num1882 == 1) - { - npc.ai[0] = 4f; - npc.noTileCollide = true; - npc.velocity.Y = -8f; - } - else if (num1882 == 2) - { - npc.ai[0] = 6f; - } - else - { - npc.ai[0] = 2f; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.ai[0] == 3f) - { - npc.velocity.X = npc.velocity.X * 0.85f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 40f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 4f) - { - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.TargetClosest(true); - Vector2 center40 = Main.player[npc.target].Center; - center40.Y -= 350f; - Vector2 vector272 = center40 - vector; - if (npc.ai[2] == 1f) - { - npc.ai[1] += 1f; - vector272 = Main.player[npc.target].Center - vector; - vector272.Normalize(); - vector272 *= 8f; - npc.velocity = (npc.velocity * 4f + vector272) / 5f; - if (npc.ai[1] > 6f) - { - npc.ai[1] = 0f; - npc.ai[0] = 4.1f; - npc.ai[2] = 0f; - npc.velocity = vector272; - } - } - else - { - if (Math.Abs(vector.X - Main.player[npc.target].Center.X) < 40f && vector.Y < Main.player[npc.target].Center.Y - 300f) - { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - return; - } - vector272.Normalize(); - vector272 *= 12f; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; - } - } - else if (npc.ai[0] == 4.1f) - { - npc.knockBackResist = 0f; - if (npc.ai[2] == 0f && Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[2] = 1f; - } - if (npc.position.Y + (float)npc.height >= Main.player[npc.target].position.Y || npc.velocity.Y <= 0f) - { - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 5f; - } - } - } - else if (npc.ai[2] == 0f) - { - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - } - npc.velocity.Y = npc.velocity.Y + 0.2f; - if (npc.velocity.Y > 16f) - { - npc.velocity.Y = 16f; - } - } - else - { - if (npc.ai[0] == 5f) - { - npc.localAI[0] += (float)Main.rand.Next(4, 9); - if (npc.velocity.X > 0f) - { - npc.direction = 1; - } - else - { - npc.direction = -1; - } - npc.spriteDirection = npc.direction; - npc.noTileCollide = true; - npc.noGravity = true; - npc.knockBackResist = 0f; - Vector2 value74 = Main.player[npc.target].Center - vector; - value74.Y -= 4f; - if (value74.Length() < 200f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (value74.Length() > 10f) - { - value74.Normalize(); - value74 *= 10f; - } - npc.velocity = (npc.velocity * 4f + value74) / 4.7f; - return; - } - if (npc.ai[0] == 6f) - { - npc.knockBackResist = 0f; - if (npc.velocity.Y == 0f) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X * 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 5f) - { - npc.ai[1] = 0f; - npc.velocity.Y = npc.velocity.Y - 4f; - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y) - { - npc.velocity.Y = npc.velocity.Y - 1.25f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 40f) - { - npc.velocity.Y = npc.velocity.Y - 1.5f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 80f) - { - npc.velocity.Y = npc.velocity.Y - 1.75f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 120f) - { - npc.velocity.Y = npc.velocity.Y - 2f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 160f) - { - npc.velocity.Y = npc.velocity.Y - 2.25f; - } - if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 200f) - { - npc.velocity.Y = npc.velocity.Y - 2.5f; - } - if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.velocity.Y = npc.velocity.Y - 2f; - } - npc.velocity.X = (float)(12 * npc.direction); - npc.ai[2] += 1f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.98f; - if (npc.direction < 0 && npc.velocity.X > -8f) - { - npc.velocity.X = -8f; - } - if (npc.direction > 0 && npc.velocity.X < 8f) - { - npc.velocity.X = 8f; - } - } - if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else if (npc.ai[0] == 7f) - { - npc.life = npc.lifeMax; - npc.defense = 9999; - npc.noTileCollide = true; - npc.alpha += 7; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - if (npc.alpha > 255) - { - npc.alpha = 255; - } - npc.velocity.X = npc.velocity.X * 0.98f; - } - } - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, 173, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - float num644 = 1f; - if (npc.life > 0) - { - float num659 = (float)npc.life / (float)npc.lifeMax; - num659 = num659 * 0.5f + 0.75f; - num659 *= num644; - if (num659 != npc.scale) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)npc.height; - npc.scale = num659 * 0.75f; - npc.width = (int)(150f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)npc.height; - } - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.15); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - int num661 = 1; - 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("SlimeSpawnCorrupt"); - 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; - Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); - Main.npc[num664].ai[1] = 0f; - if (Main.netMode == 2 && num664 < 200) - { - NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - } - } - - public override bool CheckActive() - { - if (CalamityGlobalNPC.slimeGod != -1) - { - if (Main.npc[CalamityGlobalNPC.slimeGod].active) - return false; - } - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default(Color), 3f); - 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, 4, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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.Weak, 180, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SlimeGod +{ + [AutoloadBossHead] + public class SlimeGodSplit : ModNPC + { + private float bossLife; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ebonian Slime God"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.lifeMax = CalamityWorld.revenge ? 2750 : 2000; + if (CalamityWorld.death) + { + npc.lifeMax = 3850; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1250000 : 1100000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.damage = 50; + npc.width = 150; + npc.height = 92; + npc.scale = 0.8f; + npc.defense = 10; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.buffImmune[mod.BuffType("GlacialState")] = true; + npc.buffImmune[mod.BuffType("TemporalSadness")] = true; + animationType = 50; + npc.value = Item.buyPrice(0, 1, 0, 0); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); + else + music = MusicID.Boss1; + bossBag = mod.ItemType("SlimeGodBag"); + } + + public override void AI() + { + CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + Vector2 vector = npc.Center; + bool flag100 = false; + bool hyperMode = false; + if (CalamityGlobalNPC.slimeGodRed != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) + { + flag100 = true; + } + } + if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) + { + hyperMode = true; + flag100 = false; + } + if (Main.netMode != 1) + { + npc.localAI[0] += flag100 ? 1f : 2f; + if (expertMode && Main.rand.Next(2) == 0) + { + if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + 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 = (CalamityWorld.bossRushActive ? 18f : 8f); + 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 = 24; + int num185 = mod.ProjectileType("AbyssMine"); + value9.X += num180; + value9.Y += num182; + 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(-30, 31); + num182 += (float)Main.rand.Next(-30, 31); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + if (npc.localAI[0] >= 600f) + { + npc.localAI[0] = 0f; + 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 = (CalamityWorld.bossRushActive ? 18f : 8f); + 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 = expertMode ? 19 : 21; + int num185 = mod.ProjectileType("AbyssBallVolley"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 2; 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(-20, 21); + num182 += (float)Main.rand.Next(-20, 21); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + npc.aiAction = 0; + npc.knockBackResist = 0.2f * Main.knockBackMultiplier; + npc.noTileCollide = false; + npc.noGravity = false; + npc.reflectingProjectiles = false; + if (npc.ai[0] != 7f && Main.player[npc.target].dead) + { + npc.TargetClosest(true); + if (Main.player[npc.target].dead) + { + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + if (npc.ai[0] == 0f) + { + npc.TargetClosest(true); + Vector2 vector271 = Main.player[npc.target].Center - vector; + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + else if (npc.ai[0] == 1f) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 12f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 2f) + { + if ((Main.player[npc.target].Center - vector).Length() > (hyperMode ? 1200f : 3600f)) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + if (npc.velocity.Y == 0f) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X * 0.8f; + npc.ai[1] += flag100 ? 1f : 3f; + float num1879 = 15f + 30f * ((float)npc.life / (float)npc.lifeMax); + float num1880 = 3f + 4f * (1f - (float)npc.life / (float)npc.lifeMax); + float num1881 = 8f; + if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + num1881 += 2f; + } + if (npc.ai[1] > num1879) + { + npc.ai[3] += 1f; + if (npc.ai[3] >= 1f) + { + npc.ai[3] = 0f; + num1881 *= 2f; + num1880 /= 2f; + } + npc.ai[1] = 0f; + npc.velocity.Y = npc.velocity.Y - num1881; + npc.velocity.X = num1880 * (float)npc.direction; + } + } + else + { + npc.knockBackResist = 0f; + npc.velocity.X = npc.velocity.X * 0.99f; + if (npc.direction < 0 && npc.velocity.X > -1f) + { + npc.velocity.X = -1f; + } + if (npc.direction > 0 && npc.velocity.X < 1f) + { + npc.velocity.X = 1f; + } + } + npc.ai[2] += 1f; + if ((double)npc.ai[2] > 150.0 && npc.velocity.Y == 0f && Main.netMode != 1) + { + int num1882 = Main.rand.Next(3); + if (num1882 == 0) + { + npc.ai[0] = 3f; + } + else if (num1882 == 1) + { + npc.ai[0] = 4f; + npc.noTileCollide = true; + npc.velocity.Y = -8f; + } + else if (num1882 == 2) + { + npc.ai[0] = 6f; + } + else + { + npc.ai[0] = 2f; + } + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.ai[0] == 3f) + { + npc.velocity.X = npc.velocity.X * 0.85f; + npc.ai[1] += 1f; + if (npc.ai[1] >= 40f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + } + } + else if (npc.ai[0] == 4f) + { + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + if (npc.velocity.X < 0f) + { + npc.direction = -1; + } + else + { + npc.direction = 1; + } + npc.spriteDirection = npc.direction; + npc.TargetClosest(true); + Vector2 center40 = Main.player[npc.target].Center; + center40.Y -= 350f; + Vector2 vector272 = center40 - vector; + if (npc.ai[2] == 1f) + { + npc.ai[1] += 1f; + vector272 = Main.player[npc.target].Center - vector; + vector272.Normalize(); + vector272 *= 8f; + npc.velocity = (npc.velocity * 4f + vector272) / 5f; + if (npc.ai[1] > 6f) + { + npc.ai[1] = 0f; + npc.ai[0] = 4.1f; + npc.ai[2] = 0f; + npc.velocity = vector272; + } + } + else + { + if (Math.Abs(vector.X - Main.player[npc.target].Center.X) < 40f && vector.Y < Main.player[npc.target].Center.Y - 300f) + { + npc.ai[1] = 0f; + npc.ai[2] = 1f; + return; + } + vector272.Normalize(); + vector272 *= 12f; + npc.velocity = (npc.velocity * 5f + vector272) / 6f; + } + } + else if (npc.ai[0] == 4.1f) + { + npc.knockBackResist = 0f; + if (npc.ai[2] == 0f && Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[2] = 1f; + } + if (npc.position.Y + (float)npc.height >= Main.player[npc.target].position.Y || npc.velocity.Y <= 0f) + { + npc.ai[1] += 1f; + if (npc.ai[1] > 10f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 5f; + } + } + } + else if (npc.ai[2] == 0f) + { + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + } + npc.velocity.Y = npc.velocity.Y + 0.2f; + if (npc.velocity.Y > 16f) + { + npc.velocity.Y = 16f; + } + } + else + { + if (npc.ai[0] == 5f) + { + npc.localAI[0] += (float)Main.rand.Next(4, 9); + if (npc.velocity.X > 0f) + { + npc.direction = 1; + } + else + { + npc.direction = -1; + } + npc.spriteDirection = npc.direction; + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + Vector2 value74 = Main.player[npc.target].Center - vector; + value74.Y -= 4f; + if (value74.Length() < 200f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + if (value74.Length() > 10f) + { + value74.Normalize(); + value74 *= 10f; + } + npc.velocity = (npc.velocity * 4f + value74) / 4.7f; + return; + } + if (npc.ai[0] == 6f) + { + npc.knockBackResist = 0f; + if (npc.velocity.Y == 0f) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X * 0.8f; + npc.ai[1] += 1f; + if (npc.ai[1] > 5f) + { + npc.ai[1] = 0f; + npc.velocity.Y = npc.velocity.Y - 4f; + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y) + { + npc.velocity.Y = npc.velocity.Y - 1.25f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 40f) + { + npc.velocity.Y = npc.velocity.Y - 1.5f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 80f) + { + npc.velocity.Y = npc.velocity.Y - 1.75f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 120f) + { + npc.velocity.Y = npc.velocity.Y - 2f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 160f) + { + npc.velocity.Y = npc.velocity.Y - 2.25f; + } + if (Main.player[npc.target].position.Y + (float)Main.player[npc.target].height < vector.Y - 200f) + { + npc.velocity.Y = npc.velocity.Y - 2.5f; + } + if (!Collision.CanHit(vector, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.velocity.Y = npc.velocity.Y - 2f; + } + npc.velocity.X = (float)(12 * npc.direction); + npc.ai[2] += 1f; + } + } + else + { + npc.velocity.X = npc.velocity.X * 0.98f; + if (npc.direction < 0 && npc.velocity.X > -8f) + { + npc.velocity.X = -8f; + } + if (npc.direction > 0 && npc.velocity.X < 8f) + { + npc.velocity.X = 8f; + } + } + if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else if (npc.ai[0] == 7f) + { + npc.life = npc.lifeMax; + npc.defense = 9999; + npc.noTileCollide = true; + npc.alpha += 7; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + if (npc.alpha > 255) + { + npc.alpha = 255; + } + npc.velocity.X = npc.velocity.X * 0.98f; + } + } + int num244 = Dust.NewDust(npc.position, npc.width, npc.height, 173, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); + Main.dust[num244].noGravity = true; + Main.dust[num244].velocity *= 0.5f; + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + float num644 = 1f; + if (npc.life > 0) + { + float num659 = (float)npc.life / (float)npc.lifeMax; + num659 = num659 * 0.5f + 0.75f; + num659 *= num644; + if (num659 != npc.scale) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)npc.height; + npc.scale = num659 * 0.75f; + npc.width = (int)(150f * npc.scale); + npc.height = (int)(92f * npc.scale); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)npc.height; + } + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.15); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + int num661 = 1; + 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("SlimeSpawnCorrupt"); + 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; + Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); + Main.npc[num664].ai[1] = 0f; + if (Main.netMode == 2 && num664 < 200) + { + NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + } + } + + public override bool CheckActive() + { + if (CalamityGlobalNPC.slimeGod != -1) + { + if (Main.npc[CalamityGlobalNPC.slimeGod].active) + return false; + } + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default(Color), 3f); + 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, 4, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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.Weak, 180, true); + } + } +} diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs index e3cb8c6322..7be2f6e122 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs @@ -1,76 +1,76 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SlimeGod -{ - public class SlimeSpawnCorrupt : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corrupt Slime Spawn"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.aiStyle = 14; - npc.damage = 30; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 10; - npc.lifeMax = 160; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 100000; - } - npc.knockBackResist = 0f; - animationType = 121; - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - } - - public override void AI() - { - float speedMult = 1.002f; - npc.velocity.X *= speedMult; - npc.velocity.Y *= speedMult; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (Main.netMode != 1 && npc.life <= 0) - { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("SlimeSpawnCorrupt2")); - } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Weak, 90, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SlimeGod +{ + public class SlimeSpawnCorrupt : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrupt Slime Spawn"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.aiStyle = 14; + npc.damage = 30; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 10; + npc.lifeMax = 160; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 100000; + } + npc.knockBackResist = 0f; + animationType = 121; + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + } + + public override void AI() + { + float speedMult = 1.002f; + npc.velocity.X *= speedMult; + npc.velocity.Y *= speedMult; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (Main.netMode != 1 && npc.life <= 0) + { + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, mod.NPCType("SlimeSpawnCorrupt2")); + } + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Weak, 90, true); + } + } +} diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs index dbe30f2b48..359457208e 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs @@ -1,71 +1,71 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SlimeGod -{ - public class SlimeSpawnCorrupt2 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corrupt Slime Spawn"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 30; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 10; - npc.lifeMax = 90; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } - npc.knockBackResist = 0f; - animationType = 81; - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Weak, 90, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SlimeGod +{ + public class SlimeSpawnCorrupt2 : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corrupt Slime Spawn"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 30; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 10; + npc.lifeMax = 90; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 50000; + } + npc.knockBackResist = 0f; + animationType = 81; + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Weak, 90, true); + } + } +} diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson.cs b/NPCs/SlimeGod/SlimeSpawnCrimson.cs index e0c7d54bb1..4ee192f9bb 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson.cs @@ -1,81 +1,81 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SlimeGod -{ - public class SlimeSpawnCrimson : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimson Slime Spawn"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 30; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 10; - npc.lifeMax = 110; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 100000; - } - npc.knockBackResist = 0f; - animationType = 81; - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - if (Main.expertMode) - { - if (Main.rand.Next(50) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); - } - } - else if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Cursed, 60, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SlimeGod +{ + public class SlimeSpawnCrimson : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimson Slime Spawn"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 30; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 10; + npc.lifeMax = 110; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 100000; + } + npc.knockBackResist = 0f; + animationType = 81; + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + if (Main.expertMode) + { + if (Main.rand.Next(50) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); + } + } + else if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Cursed, 60, true); + } + } +} diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs index f271c30404..2d37cdff62 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs @@ -1,137 +1,137 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SlimeGod -{ - public class SlimeSpawnCrimson2 : ModNPC - { - public float spikeTimer = 60f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spiked Crimson Slime Spawn"); - Main.npcFrameCount[npc.type] = 2; - } - - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 30; - npc.width = 40; //324 - npc.height = 30; //216 - npc.defense = 10; - npc.lifeMax = 130; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 120000; - } - npc.knockBackResist = 0f; - animationType = 81; - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; - } - - public override void AI() - { - if (spikeTimer > 0f) - { - spikeTimer -= 1f; - } - if (!npc.wet) - { - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; - float num15 = Main.player[npc.target].position.Y - vector3.Y; - float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if (Main.expertMode && num16 < 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) - { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - if (Main.netMode != 1 && spikeTimer == 0f) - { - for (int n = 0; n < 5; n++) - { - Vector2 vector4 = new Vector2((float)(n - 2), -4f); - vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; - vector4.Normalize(); - vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; - Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, mod.ProjectileType("CrimsonSpike"), 13, 0f, Main.myPlayer, 0f, 0f); - spikeTimer = 30f; - } - } - } - else if (num16 < 360f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) - { - npc.ai[0] = -40f; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - if (Main.netMode != 1 && spikeTimer == 0f) - { - num15 = Main.player[npc.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); - num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - num16 = 6.5f / num16; - num14 *= num16; - num15 *= num16; - spikeTimer = 50f; - Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, mod.ProjectileType("CrimsonSpike"), 12, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - - public override void NPCLoot() - { - if (Main.expertMode) - { - if (Main.rand.Next(50) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); - } - } - else if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Cursed, 60, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SlimeGod +{ + public class SlimeSpawnCrimson2 : ModNPC + { + public float spikeTimer = 60f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spiked Crimson Slime Spawn"); + Main.npcFrameCount[npc.type] = 2; + } + + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 30; + npc.width = 40; //324 + npc.height = 30; //216 + npc.defense = 10; + npc.lifeMax = 130; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 120000; + } + npc.knockBackResist = 0f; + animationType = 81; + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.buffImmune[24] = true; + } + + public override void AI() + { + if (spikeTimer > 0f) + { + spikeTimer -= 1f; + } + if (!npc.wet) + { + Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; + float num15 = Main.player[npc.target].position.Y - vector3.Y; + float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + if (Main.expertMode && num16 < 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + if (Main.netMode != 1 && spikeTimer == 0f) + { + for (int n = 0; n < 5; n++) + { + Vector2 vector4 = new Vector2((float)(n - 2), -4f); + vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; + vector4.Normalize(); + vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; + Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, mod.ProjectileType("CrimsonSpike"), 13, 0f, Main.myPlayer, 0f, 0f); + spikeTimer = 30f; + } + } + } + else if (num16 < 360f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && npc.velocity.Y == 0f) + { + npc.ai[0] = -40f; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.9f; + } + if (Main.netMode != 1 && spikeTimer == 0f) + { + num15 = Main.player[npc.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); + num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + num16 = 6.5f / num16; + num14 *= num16; + num15 *= num16; + spikeTimer = 50f; + Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, mod.ProjectileType("CrimsonSpike"), 12, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + + public override void NPCLoot() + { + if (Main.expertMode) + { + if (Main.rand.Next(50) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); + } + } + else if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Cursed, 60, true); + } + } +} diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs index 49bafb5632..98431b90cc 100644 --- a/NPCs/StormWeaver/StasisProbe.cs +++ b/NPCs/StormWeaver/StasisProbe.cs @@ -1,288 +1,288 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.StormWeaver -{ - public class StasisProbe : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stasis Probe"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.npcSlots = 10f; - npc.damage = 70; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 100; - npc.lifeMax = 1200; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 25000; - } - npc.knockBackResist = 0.9f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.buffImmune[24] = true; - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = revenge ? 12f : 9f; - float num2 = revenge ? 0.15f : 0.12f; - 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 (npc.justHit) - { - npc.localAI[0] = 0f; - } - 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)) - { - int num8 = 70; - if (Main.expertMode) - { - num8 = 50; - } - int num9 = 84; - int beam = Projectile.NewProjectile(vector.X, vector.Y, num4 * 0.75f, num5 * 0.75f, num9, num8, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[beam].timeLeft = 200; - } - } - 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 bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - 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 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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 bool PreNPCLoot() - { - return false; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.StormWeaver +{ + public class StasisProbe : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stasis Probe"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.npcSlots = 10f; + npc.damage = 70; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 100; + npc.lifeMax = 1200; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 25000; + } + npc.knockBackResist = 0.9f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.buffImmune[24] = true; + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = revenge ? 12f : 9f; + float num2 = revenge ? 0.15f : 0.12f; + 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 (npc.justHit) + { + npc.localAI[0] = 0f; + } + 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)) + { + int num8 = 70; + if (Main.expertMode) + { + num8 = 50; + } + int num9 = 84; + int beam = Projectile.NewProjectile(vector.X, vector.Y, num4 * 0.75f, num5 * 0.75f, num9, num8, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[beam].timeLeft = 200; + } + } + 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 bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + 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 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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 bool PreNPCLoot() + { + return false; + } + } +} diff --git a/NPCs/StormWeaver/StasisProbeNaked.cs b/NPCs/StormWeaver/StasisProbeNaked.cs index 2dbcfeba98..5e5275b0d2 100644 --- a/NPCs/StormWeaver/StasisProbeNaked.cs +++ b/NPCs/StormWeaver/StasisProbeNaked.cs @@ -1,288 +1,288 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.StormWeaver -{ - public class StasisProbeNaked : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stasis Probe"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.npcSlots = 10f; - npc.damage = 80; - npc.width = 30; //324 - npc.height = 30; //216 - npc.defense = 10; - npc.lifeMax = 1500; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 25000; - } - npc.knockBackResist = 0.925f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath19; - npc.buffImmune[24] = true; - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = revenge ? 14f : 10f; - float num2 = revenge ? 0.18f : 0.15f; - 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 (npc.justHit) - { - npc.localAI[0] = 0f; - } - if (Main.netMode != 1 && npc.localAI[0] >= 180f) - { - 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)) - { - int num8 = 70; - if (Main.expertMode) - { - num8 = 50; - } - int num9 = 84; - int beam = Projectile.NewProjectile(vector.X, vector.Y, num4 * 0.75f, num5 * 0.75f, num9, num8, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[beam].timeLeft = 200; - } - } - 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 bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - 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 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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 bool PreNPCLoot() - { - return false; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.StormWeaver +{ + public class StasisProbeNaked : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stasis Probe"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.npcSlots = 10f; + npc.damage = 80; + npc.width = 30; //324 + npc.height = 30; //216 + npc.defense = 10; + npc.lifeMax = 1500; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 25000; + } + npc.knockBackResist = 0.925f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath19; + npc.buffImmune[24] = true; + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = revenge ? 14f : 10f; + float num2 = revenge ? 0.18f : 0.15f; + 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 (npc.justHit) + { + npc.localAI[0] = 0f; + } + if (Main.netMode != 1 && npc.localAI[0] >= 180f) + { + 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)) + { + int num8 = 70; + if (Main.expertMode) + { + num8 = 50; + } + int num9 = 84; + int beam = Projectile.NewProjectile(vector.X, vector.Y, num4 * 0.75f, num5 * 0.75f, num9, num8, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[beam].timeLeft = 200; + } + } + 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 bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + 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 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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 bool PreNPCLoot() + { + return false; + } + } +} diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index a658738952..87686c41da 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -1,200 +1,200 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.StormWeaver -{ - public class StormWeaverBody : ModNPC - { - public int spawn = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } - - public override void SetDefaults() - { - npc.damage = 100; //70 - npc.npcSlots = 5f; - npc.width = 40; //324 - npc.height = 40; //216 - npc.defense = 99999; - npc.lifeMax = 20000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 170000; - } - 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.alpha = 255; - npc.boss = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.chaseable = false; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - if (npc.defense < 99999 && CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.defense = 99999; - } - else - { - npc.defense = 0; - } - 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; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - 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) - { - damage = 1; - return false; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor4"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - if (NPC.CountNPCS(mod.NPCType("StasisProbe")) < 3) - { - if (npc.life > 0 && Main.netMode != 1 && spawn == 0 && Main.rand.Next(15) == 0) - { - spawn = 1; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("StasisProbe"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.StormWeaver +{ + public class StormWeaverBody : ModNPC + { + public int spawn = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } + + public override void SetDefaults() + { + npc.damage = 100; //70 + npc.npcSlots = 5f; + npc.width = 40; //324 + npc.height = 40; //216 + npc.defense = 99999; + npc.lifeMax = 20000; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 170000; + } + 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.alpha = 255; + npc.boss = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.chaseable = false; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + if (npc.defense < 99999 && CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.defense = 99999; + } + else + { + npc.defense = 0; + } + 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; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + 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) + { + damage = 1; + return false; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.penetrate == -1 && !projectile.minion) + { + projectile.penetrate = 1; + } + else if (projectile.penetrate >= 1) + { + projectile.penetrate = 1; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor4"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + if (NPC.CountNPCS(mod.NPCType("StasisProbe")) < 3) + { + if (npc.life > 0 && Main.netMode != 1 && spawn == 0 && Main.rand.Next(15) == 0) + { + spawn = 1; + int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("StasisProbe"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index 0dbe6bc746..a7267bf765 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -1,261 +1,261 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.StormWeaver -{ - public class StormWeaverBodyNaked : ModNPC - { - public int spawn = 14; - public int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } - - public override void SetDefaults() - { - npc.damage = 120; //70 - npc.npcSlots = 5f; - npc.width = 40; //324 - npc.height = 40; //216 - npc.defense = 0; - npc.lifeMax = 100000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 600000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 3300000; - } - 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.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.boss = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - 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.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - if (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = expertMode ? 192 : 120; - npc.dontTakeDamage = false; - } - 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; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.penetrate == -1) - { - damage /= 5; - } - else if (projectile.penetrate >= 4) - { - damage /= 4; - } - else if (projectile.penetrate == 3) - { - damage /= 3; - } - else if (projectile.penetrate == 2) - { - damage /= 2; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude4"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - if (NPC.CountNPCS(mod.NPCType("StasisProbeNaked")) < 3) - { - spawn--; - if (npc.life > 0 && Main.netMode != 1 && spawn <= 0) - { - spawn = 14; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("StasisProbeNaked"), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == 2) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.StormWeaver +{ + public class StormWeaverBodyNaked : ModNPC + { + public int spawn = 14; + public int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } + + public override void SetDefaults() + { + npc.damage = 120; //70 + npc.npcSlots = 5f; + npc.width = 40; //324 + npc.height = 40; //216 + npc.defense = 0; + npc.lifeMax = 100000; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 600000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 3300000; + } + 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.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.boss = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + 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.dontCountMe = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + if (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = expertMode ? 192 : 120; + npc.dontTakeDamage = false; + } + 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; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.penetrate == -1) + { + damage /= 5; + } + else if (projectile.penetrate >= 4) + { + damage /= 4; + } + else if (projectile.penetrate == 3) + { + damage /= 3; + } + else if (projectile.penetrate == 2) + { + damage /= 2; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude4"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + if (NPC.CountNPCS(mod.NPCType("StasisProbeNaked")) < 3) + { + spawn--; + if (npc.life > 0 && Main.netMode != 1 && spawn <= 0) + { + spawn = 14; + int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), mod.NPCType("StasisProbeNaked"), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == 2) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 31e02a4c30..e300b90013 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -1,657 +1,657 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.StormWeaver -{ - [AutoloadBossHead] - public class StormWeaverHead : ModNPC - { - private const float BoltAngleSpread = 170; - private int BoltCountdown = 0; - private bool flies = true; - private const float speed = 10f; - private const float turnSpeed = 0.3f; - private bool tail = false; - private const int minLength = 30; - private const int maxLength = 31; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } - - public override void SetDefaults() - { - npc.damage = 140; //150 - npc.npcSlots = 5f; - npc.width = 74; //324 - npc.height = 74; //216 - npc.defense = 99999; - npc.lifeMax = 20000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 170000; - } - 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.boss = true; - npc.value = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(BoltCountdown); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - BoltCountdown = reader.ReadInt32(); - } - - public override void AI() - { - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - if (npc.defense < 99999 && CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.defense = 99999; - } - else - { - npc.defense = 0; - } - if (!Main.raining && !CalamityWorld.bossRushActive) - { - RainStart(); - } - int BoltProjectiles = 1; - 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) - { - 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.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 12; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != 1) - { - if (!tail && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverBody"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverTail"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - npc.netUpdate = true; - Previous = lol; - } - tail = true; - } - if (!npc.active && Main.netMode == 2) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 360f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - int damage = expertMode ? 50 : 70; - float xPos = (Main.rand.Next(2) == 0 ? npc.position.X + 300f : npc.position.X - 300f); - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } - if (BoltCountdown == 0) - { - BoltCountdown = 600; - } - if (BoltCountdown > 0) - { - BoltCountdown--; - if (BoltCountdown == 0) - { - int speed2 = revenge ? 8 : 7; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed2 += 1; - } - float spawnX2 = (float)Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; - float spawnY2 = -1000f + Main.player[npc.target].Center.Y; - Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); - Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; - int damage = expertMode ? 50 : 70; - for (int i = 0; i < BoltProjectiles; i++) - { - Vector2 spawn2 = baseSpawn; - spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Vector2 vector94 = Main.player[npc.target].Center - spawn2; - float ai = (float)Main.rand.Next(100); - Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); - } - } - } - } - 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; - } - npc.localAI[1] = 0f; - bool canFly = flies; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - canFly = true; - npc.velocity.Y = npc.velocity.Y - 10f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 10f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - /*else if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 3600f) - { - if (Main.player[npc.target].velocity.X >= 0f) - { - npc.position.X = Main.player[npc.target].position.X + 800f; - } - else - { - npc.position.X = Main.player[npc.target].position.X - 800f; - } - npc.position.Y = Main.player[npc.target].position.Y; - }*/ - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 800); - if (Main.player[npc.target].position.Y > num47) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 600f; - } - else - { - num191 = Main.player[npc.target].Center.X - 600f; - } - } - } - } - else - { - 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; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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; - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - private void RainStart() - { - int num = 86400; - int num2 = num / 24; - Main.rainTime = Main.rand.Next(num2 * 8, num); - if (Main.rand.Next(3) == 0) - { - Main.rainTime += Main.rand.Next(0, num2); - } - if (Main.rand.Next(4) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.Next(5) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.Next(6) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 3); - } - if (Main.rand.Next(7) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 4); - } - if (Main.rand.Next(8) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 5); - } - float num3 = 1f; - if (Main.rand.Next(2) == 0) - { - num3 += 0.05f; - } - if (Main.rand.Next(3) == 0) - { - num3 += 0.1f; - } - if (Main.rand.Next(4) == 0) - { - num3 += 0.15f; - } - if (Main.rand.Next(5) == 0) - { - num3 += 0.2f; - } - Main.rainTime = (int)((float)Main.rainTime * num3); - Main.raining = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - - 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) - { - damage = 0; - return false; - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckDead() - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - if (Main.netMode != 1) - { - NPC.SpawnOnPlayer(Main.LocalPlayer.whoAmI, mod.NPCType("StormWeaverHeadNaked")); - } - return true; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.StormWeaver +{ + [AutoloadBossHead] + public class StormWeaverHead : ModNPC + { + private const float BoltAngleSpread = 170; + private int BoltCountdown = 0; + private bool flies = true; + private const float speed = 10f; + private const float turnSpeed = 0.3f; + private bool tail = false; + private const int minLength = 30; + private const int maxLength = 31; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } + + public override void SetDefaults() + { + npc.damage = 140; //150 + npc.npcSlots = 5f; + npc.width = 74; //324 + npc.height = 74; //216 + npc.defense = 99999; + npc.lifeMax = 20000; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 170000; + } + 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.boss = true; + npc.value = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(BoltCountdown); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + BoltCountdown = reader.ReadInt32(); + } + + public override void AI() + { + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (npc.defense < 99999 && CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.defense = 99999; + } + else + { + npc.defense = 0; + } + if (!Main.raining && !CalamityWorld.bossRushActive) + { + RainStart(); + } + int BoltProjectiles = 1; + 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) + { + 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.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 12; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != 1) + { + if (!tail && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverBody"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverTail"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + npc.netUpdate = true; + Previous = lol; + } + tail = true; + } + if (!npc.active && Main.netMode == 2) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 360f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + int damage = expertMode ? 50 : 70; + float xPos = (Main.rand.Next(2) == 0 ? npc.position.X + 300f : npc.position.X - 300f); + Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + if (BoltCountdown == 0) + { + BoltCountdown = 600; + } + if (BoltCountdown > 0) + { + BoltCountdown--; + if (BoltCountdown == 0) + { + int speed2 = revenge ? 8 : 7; + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed2 += 1; + } + float spawnX2 = (float)Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; + float spawnY2 = -1000f + Main.player[npc.target].Center.Y; + Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); + Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity = baseVelocity * speed2; + int damage = expertMode ? 50 : 70; + for (int i = 0; i < BoltProjectiles; i++) + { + Vector2 spawn2 = baseSpawn; + spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + Vector2 vector94 = Main.player[npc.target].Center - spawn2; + float ai = (float)Main.rand.Next(100); + Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + } + } + } + } + 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; + } + npc.localAI[1] = 0f; + bool canFly = flies; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + canFly = true; + npc.velocity.Y = npc.velocity.Y - 10f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 10f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + /*else if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 3600f) + { + if (Main.player[npc.target].velocity.X >= 0f) + { + npc.position.X = Main.player[npc.target].position.X + 800f; + } + else + { + npc.position.X = Main.player[npc.target].position.X - 800f; + } + npc.position.Y = Main.player[npc.target].position.Y; + }*/ + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 800); + if (Main.player[npc.target].position.Y > num47) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 600f; + } + else + { + num191 = Main.player[npc.target].Center.X - 600f; + } + } + } + } + else + { + 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; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (num42 > 0) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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; + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + private void RainStart() + { + int num = 86400; + int num2 = num / 24; + Main.rainTime = Main.rand.Next(num2 * 8, num); + if (Main.rand.Next(3) == 0) + { + Main.rainTime += Main.rand.Next(0, num2); + } + if (Main.rand.Next(4) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.Next(5) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.Next(6) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 3); + } + if (Main.rand.Next(7) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 4); + } + if (Main.rand.Next(8) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 5); + } + float num3 = 1f; + if (Main.rand.Next(2) == 0) + { + num3 += 0.05f; + } + if (Main.rand.Next(3) == 0) + { + num3 += 0.1f; + } + if (Main.rand.Next(4) == 0) + { + num3 += 0.15f; + } + if (Main.rand.Next(5) == 0) + { + num3 += 0.2f; + } + Main.rainTime = (int)((float)Main.rainTime * num3); + Main.raining = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + + 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) + { + damage = 0; + return false; + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool CheckDead() + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + if (Main.netMode != 1) + { + NPC.SpawnOnPlayer(Main.LocalPlayer.whoAmI, mod.NPCType("StormWeaverHeadNaked")); + } + return true; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } + } +} diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 8c7720ef90..e6889c06eb 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -1,684 +1,684 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.StormWeaver -{ - [AutoloadBossHead] - public class StormWeaverHeadNaked : ModNPC - { - private const float BoltAngleSpread = 280; - private int BoltCountdown = 0; - private bool flies = true; - private const float speed = 13f; - private const float turnSpeed = 0.35f; - private bool tail = false; - private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 20 : 30; - private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 21 : 31; - private int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } - - public override void SetDefaults() - { - npc.damage = 180; //150 - npc.npcSlots = 5f; - npc.width = 74; //324 - npc.height = 74; //216 - npc.defense = 0; - npc.lifeMax = 100000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.value = Item.buyPrice(0, 35, 0, 0); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 600000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 3300000; - } - 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.boss = true; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - 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; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(BoltCountdown); - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - BoltCountdown = reader.ReadInt32(); - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override void AI() - { - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - if (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = expertMode ? 360 : 180; - npc.dontTakeDamage = false; - } - if (!Main.raining && !CalamityWorld.bossRushActive) - { - RainStart(); - } - double lifeRatio = (double)npc.life / (double)npc.lifeMax; - int lifePercentage = (int)(100.0 * lifeRatio); - int BoltProjectiles = 2; - if (lifePercentage < 33) - { - BoltProjectiles = 4; - } - else if (lifePercentage < 66) - { - BoltProjectiles = 3; - } - 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) - { - 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.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 12; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Main.netMode != 1) - { - if (!tail && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverBodyNaked"), npc.whoAmI); - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverTailNaked"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - npc.netUpdate = true; - Previous = lol; - } - tail = true; - } - if (!npc.active && Main.netMode == 2) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - npc.localAI[0] += 1f; - if (npc.localAI[0] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 180f : 360f)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - int damage = expertMode ? 50 : 70; - float xPos = (Main.rand.Next(2) == 0 ? npc.position.X + 300f : npc.position.X - 300f); - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } - if (BoltCountdown == 0) - { - BoltCountdown = 600; - } - if (BoltCountdown > 0) - { - BoltCountdown--; - if (BoltCountdown == 0) - { - int speed2 = revenge ? 8 : 7; - if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed2 += 1; - } - float spawnX2 = (float)Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; - float spawnY2 = -1000f + Main.player[npc.target].Center.Y; - Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); - Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity = baseVelocity * speed2; - int damage = expertMode ? 50 : 70; - for (int i = 0; i < BoltProjectiles; i++) - { - Vector2 spawn2 = baseSpawn; - spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Vector2 vector94 = Main.player[npc.target].Center - spawn2; - float ai = (float)Main.rand.Next(100); - Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); - } - } - } - } - 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; - } - bool canFly = flies; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - canFly = true; - npc.velocity.Y = npc.velocity.Y - 10f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 10f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - /*else if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 3600f) - { - if (Main.player[npc.target].velocity.X >= 0f) - { - npc.position.X = Main.player[npc.target].position.X + 800f; - } - else - { - npc.position.X = Main.player[npc.target].position.X - 800f; - } - npc.position.Y = Main.player[npc.target].position.Y; - }*/ - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) - { - CalamityWorld.DoGSecondStageCountdown = 0; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - num188 = revenge ? 17f : 16f; - num189 = revenge ? 0.5f : 0.45f; - if (!Main.player[npc.target].ZoneSkyHeight) - { - num188 = 36f; //24 - num189 = 0.8f; //0.6 - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - 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; - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - private void RainStart() - { - int num = 86400; - int num2 = num / 24; - Main.rainTime = Main.rand.Next(num2 * 8, num); - if (Main.rand.Next(3) == 0) - { - Main.rainTime += Main.rand.Next(0, num2); - } - if (Main.rand.Next(4) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.Next(5) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.Next(6) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 3); - } - if (Main.rand.Next(7) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 4); - } - if (Main.rand.Next(8) == 0) - { - Main.rainTime += Main.rand.Next(0, num2 * 5); - } - float num3 = 1f; - if (Main.rand.Next(2) == 0) - { - num3 += 0.05f; - } - if (Main.rand.Next(3) == 0) - { - num3 += 0.1f; - } - if (Main.rand.Next(4) == 0) - { - num3 += 0.15f; - } - if (Main.rand.Next(5) == 0) - { - num3 += 0.2f; - } - Main.rainTime = (int)((float)Main.rainTime * num3); - Main.raining = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); - } - } - - public override bool CheckDead() - { - for (int num569 = 0; num569 < 200; num569++) - { - if (Main.npc[num569].active && (Main.npc[num569].type == mod.NPCType("StormWeaverBodyNaked") || Main.npc[num569].type == mod.NPCType("StormWeaverTailNaked"))) - { - Main.npc[num569].active = false; - } - } - return true; - } - - public override void NPCLoot() - { - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ArmoredShell"), Main.rand.Next(5, 9), true); - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WeaverTrophy")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheStorm")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormDragoon")); - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.SuperHealingPotion; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.StormWeaver +{ + [AutoloadBossHead] + public class StormWeaverHeadNaked : ModNPC + { + private const float BoltAngleSpread = 280; + private int BoltCountdown = 0; + private bool flies = true; + private const float speed = 13f; + private const float turnSpeed = 0.35f; + private bool tail = false; + private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 20 : 30; + private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 21 : 31; + private int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } + + public override void SetDefaults() + { + npc.damage = 180; //150 + npc.npcSlots = 5f; + npc.width = 74; //324 + npc.height = 74; //216 + npc.defense = 0; + npc.lifeMax = 100000; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.value = Item.buyPrice(0, 35, 0, 0); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 600000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 3300000; + } + 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.boss = true; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + 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; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(BoltCountdown); + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + BoltCountdown = reader.ReadInt32(); + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void AI() + { + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + if (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = expertMode ? 360 : 180; + npc.dontTakeDamage = false; + } + if (!Main.raining && !CalamityWorld.bossRushActive) + { + RainStart(); + } + double lifeRatio = (double)npc.life / (double)npc.lifeMax; + int lifePercentage = (int)(100.0 * lifeRatio); + int BoltProjectiles = 2; + if (lifePercentage < 33) + { + BoltProjectiles = 4; + } + else if (lifePercentage < 66) + { + BoltProjectiles = 3; + } + 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) + { + 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.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 12; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Main.netMode != 1) + { + if (!tail && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverBodyNaked"), npc.whoAmI); + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverTailNaked"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + npc.netUpdate = true; + Previous = lol; + } + tail = true; + } + if (!npc.active && Main.netMode == 2) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + npc.localAI[0] += 1f; + if (npc.localAI[0] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 180f : 360f)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + int damage = expertMode ? 50 : 70; + float xPos = (Main.rand.Next(2) == 0 ? npc.position.X + 300f : npc.position.X - 300f); + Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + if (BoltCountdown == 0) + { + BoltCountdown = 600; + } + if (BoltCountdown > 0) + { + BoltCountdown--; + if (BoltCountdown == 0) + { + int speed2 = revenge ? 8 : 7; + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed2 += 1; + } + float spawnX2 = (float)Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; + float spawnY2 = -1000f + Main.player[npc.target].Center.Y; + Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); + Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity = baseVelocity * speed2; + int damage = expertMode ? 50 : 70; + for (int i = 0; i < BoltProjectiles; i++) + { + Vector2 spawn2 = baseSpawn; + spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); + Vector2 velocity = baseVelocity; + velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + Vector2 vector94 = Main.player[npc.target].Center - spawn2; + float ai = (float)Main.rand.Next(100); + Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + } + } + } + } + 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; + } + bool canFly = flies; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + canFly = true; + npc.velocity.Y = npc.velocity.Y - 10f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 10f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + /*else if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 3600f) + { + if (Main.player[npc.target].velocity.X >= 0f) + { + npc.position.X = Main.player[npc.target].position.X + 800f; + } + else + { + npc.position.X = Main.player[npc.target].position.X - 800f; + } + npc.position.Y = Main.player[npc.target].position.Y; + }*/ + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) + { + CalamityWorld.DoGSecondStageCountdown = 0; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + num188 = revenge ? 17f : 16f; + num189 = revenge ? 0.5f : 0.45f; + if (!Main.player[npc.target].ZoneSkyHeight) + { + num188 = 36f; //24 + num189 = 0.8f; //0.6 + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + 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; + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + private void RainStart() + { + int num = 86400; + int num2 = num / 24; + Main.rainTime = Main.rand.Next(num2 * 8, num); + if (Main.rand.Next(3) == 0) + { + Main.rainTime += Main.rand.Next(0, num2); + } + if (Main.rand.Next(4) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.Next(5) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.Next(6) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 3); + } + if (Main.rand.Next(7) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 4); + } + if (Main.rand.Next(8) == 0) + { + Main.rainTime += Main.rand.Next(0, num2 * 5); + } + float num3 = 1f; + if (Main.rand.Next(2) == 0) + { + num3 += 0.05f; + } + if (Main.rand.Next(3) == 0) + { + num3 += 0.1f; + } + if (Main.rand.Next(4) == 0) + { + num3 += 0.15f; + } + if (Main.rand.Next(5) == 0) + { + num3 += 0.2f; + } + Main.rainTime = (int)((float)Main.rainTime * num3); + Main.raining = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + } + } + + public override bool CheckDead() + { + for (int num569 = 0; num569 < 200; num569++) + { + if (Main.npc[num569].active && (Main.npc[num569].type == mod.NPCType("StormWeaverBodyNaked") || Main.npc[num569].type == mod.NPCType("StormWeaverTailNaked"))) + { + Main.npc[num569].active = false; + } + } + return true; + } + + public override void NPCLoot() + { + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ArmoredShell"), Main.rand.Next(5, 9), true); + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WeaverTrophy")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheStorm")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormDragoon")); + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.SuperHealingPotion; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } + } +} diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 82fc14a21d..8812d74186 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -1,160 +1,160 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.StormWeaver -{ - public class StormWeaverTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } - - public override void SetDefaults() - { - npc.damage = 80; - npc.npcSlots = 5f; - npc.width = 48; //324 - npc.height = 80; //216 - npc.defense = 0; - npc.lifeMax = 20000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 100000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 170000; - } - 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.alpha = 255; - npc.boss = true; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - npc.takenDamageMultiplier = CalamityWorld.death ? 3f : 10f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - 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; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.StormWeaver +{ + public class StormWeaverTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } + + public override void SetDefaults() + { + npc.damage = 80; + npc.npcSlots = 5f; + npc.width = 48; //324 + npc.height = 80; //216 + npc.defense = 0; + npc.lifeMax = 20000; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 100000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 170000; + } + 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.alpha = 255; + npc.boss = true; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.takenDamageMultiplier = CalamityWorld.death ? 3f : 10f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } + + 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; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWArmor5"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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); + } + } +} diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index 105907c868..8b5e6b3711 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -1,227 +1,227 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.StormWeaver -{ - public class StormWeaverTailNaked : ModNPC - { - public int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Storm Weaver"); - } - - public override void SetDefaults() - { - npc.damage = 100; - npc.npcSlots = 5f; - npc.width = 48; //324 - npc.height = 80; //216 - npc.defense = 0; - npc.lifeMax = 100000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - npc.lifeMax = 600000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 3300000; - } - 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.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.boss = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - 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.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = Main.expertMode ? 160 : 100; - npc.dontTakeDamage = false; - } - 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; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.StormWeaver +{ + public class StormWeaverTailNaked : ModNPC + { + public int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Storm Weaver"); + } + + public override void SetDefaults() + { + npc.damage = 100; + npc.npcSlots = 5f; + npc.width = 48; //324 + npc.height = 80; //216 + npc.defense = 0; + npc.lifeMax = 100000; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); + else + music = MusicID.Boss3; + npc.lifeMax = 600000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 3300000; + } + 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.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.boss = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + 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.dontCountMe = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + if (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = Main.expertMode ? 160 : 100; + npc.dontTakeDamage = false; + } + 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; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNude5"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 30; + npc.height = 30; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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); + } + } +} diff --git a/NPCs/SunkenSeaNPCs/BlindedAngler.cs b/NPCs/SunkenSeaNPCs/BlindedAngler.cs index f704ed3b25..1ac58bf6de 100644 --- a/NPCs/SunkenSeaNPCs/BlindedAngler.cs +++ b/NPCs/SunkenSeaNPCs/BlindedAngler.cs @@ -1,284 +1,284 @@ -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; - -namespace CalamityMod.NPCs.SunkenSeaNPCs -{ - public class BlindedAngler : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blinded Angler"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = 150; - npc.width = 56; - npc.height = 44; - npc.defense = 30; - npc.lifeMax = 750; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 0, 40, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.1f; - banner = npc.type; - bannerItem = mod.ItemType("BlindedAnglerBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } - - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f); - 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; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - (Main.player[npc.target].Center - npc.Center).Length() < 100f) - { - flag14 = true; - } - else - { - flag14 = 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.1f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; - if (npc.velocity.X > 3f) - { - npc.velocity.X = 3f; - } - if (npc.velocity.X < -3f) - { - npc.velocity.X = -3f; - } - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } - if (npc.velocity.Y < -3f) - { - npc.velocity.Y = -3f; - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -1.5f || npc.velocity.X > 1.5f) - { - 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.2) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.2) - { - 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) - { - 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 > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (npc.wet ? 0.15f : 0f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - 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/SunkenSeaNPCs/BlindedAnglerGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/BlindedAnglerGlow").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.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/BlindedAnglerGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (Main.hardMode && spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.45f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EutrophicScimitar")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PrismShard"), Main.rand.Next(5, 10)); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore4"), 1f); - } - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.NPCs.SunkenSeaNPCs +{ + public class BlindedAngler : ModNPC + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blinded Angler"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 150; + npc.width = 56; + npc.height = 44; + npc.defense = 30; + npc.lifeMax = 750; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 0, 40, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.1f; + banner = npc.type; + bannerItem = mod.ItemType("BlindedAnglerBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } + + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f); + 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; + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + (Main.player[npc.target].Center - npc.Center).Length() < 100f) + { + flag14 = true; + } + else + { + flag14 = 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.1f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.1f; + if (npc.velocity.X > 3f) + { + npc.velocity.X = 3f; + } + if (npc.velocity.X < -3f) + { + npc.velocity.X = -3f; + } + if (npc.velocity.Y > 3f) + { + npc.velocity.Y = 3f; + } + if (npc.velocity.Y < -3f) + { + npc.velocity.Y = -3f; + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -1.5f || npc.velocity.X > 1.5f) + { + 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.2) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.2) + { + 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) + { + 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 > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (npc.wet ? 0.15f : 0f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + 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/SunkenSeaNPCs/BlindedAnglerGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/BlindedAnglerGlow").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.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/BlindedAnglerGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.45f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EutrophicScimitar")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PrismShard"), Main.rand.Next(5, 10)); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BlindedAngler/BlindAnglerGore4"), 1f); + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/Clam.cs b/NPCs/SunkenSeaNPCs/Clam.cs index 3987280d18..0f079ff292 100644 --- a/NPCs/SunkenSeaNPCs/Clam.cs +++ b/NPCs/SunkenSeaNPCs/Clam.cs @@ -1,229 +1,229 @@ -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; - -namespace CalamityMod.NPCs.SunkenSeaNPCs -{ - public class Clam : ModNPC - { - private int hitAmount = 0; - private bool hasBeenHit = false; - private bool statChange = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Clam"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.damage = 30; - npc.width = 56; - npc.height = 38; - npc.defense = 9999; - npc.lifeMax = Main.hardMode ? 300 : 150; - if (Main.expertMode) - { - npc.lifeMax *= 2; - } - npc.aiStyle = -1; - aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 10, 0) : Item.buyPrice(0, 0, 1, 0); - npc.HitSound = SoundID.NPCHit4; - npc.knockBackResist = 0.05f; - banner = npc.type; - bannerItem = mod.ItemType("ClamBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hitAmount); - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - writer.Write(statChange); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hitAmount = reader.ReadInt32(); - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - statChange = reader.ReadBoolean(); - } - - public override void AI() - { - npc.TargetClosest(true); - if (Main.player[npc.target].GetModPlayer(mod).clamity) - { - hitAmount = 3; - hasBeenHit = true; - } - if (npc.justHit && hitAmount < 3) - { - ++hitAmount; - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (hitAmount == 3) - { - if (!statChange) - { - npc.defense = 6; - npc.damage = Main.expertMode ? 60 : 30; - if (Main.hardMode) - { - npc.defense = 15; - npc.damage = Main.expertMode ? 120 : 60; - } - statChange = true; - } - if (npc.ai[0] == 0f) - { - if (Main.netMode != 1) - { - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) - { - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - npc.ai[0] = 1f; - npc.netUpdate = true; - return; - } - } - else if (npc.velocity.Y == 0f) - { - npc.ai[2] += 1f; - int num321 = 20; - if (npc.ai[1] == 0f) - { - num321 = 12; - } - 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) - { - 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) - { - float multiplierX = (float)Main.rand.Next(3, 7); - npc.velocity.X = (float)npc.direction * multiplierX; - npc.velocity.Y = -8f; - npc.ai[1] = 0f; - } - else - { - float multiplierX = (float)Main.rand.Next(5, 9); - npc.velocity.X = (float)npc.direction * multiplierX; - npc.velocity.Y = -4f; - } - } - npc.netUpdate = true; - return; - } - else - { - 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) - { - npc.velocity.X = npc.velocity.X - 0.1f; - return; - } - } - } - else - { - npc.damage = 0; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (hitAmount < 3) - { - npc.frame.Y = frameHeight * 4; - } - else - { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water) - { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; - } - return 0f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, 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, 37, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam3"), 1f); - } - } - 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")); - } - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.NPCs.SunkenSeaNPCs +{ + public class Clam : ModNPC + { + private int hitAmount = 0; + private bool hasBeenHit = false; + private bool statChange = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clam"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.damage = 30; + npc.width = 56; + npc.height = 38; + npc.defense = 9999; + npc.lifeMax = Main.hardMode ? 300 : 150; + if (Main.expertMode) + { + npc.lifeMax *= 2; + } + npc.aiStyle = -1; + aiType = -1; + npc.value = Main.hardMode ? Item.buyPrice(0, 0, 10, 0) : Item.buyPrice(0, 0, 1, 0); + npc.HitSound = SoundID.NPCHit4; + npc.knockBackResist = 0.05f; + banner = npc.type; + bannerItem = mod.ItemType("ClamBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hitAmount); + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + writer.Write(statChange); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hitAmount = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + statChange = reader.ReadBoolean(); + } + + public override void AI() + { + npc.TargetClosest(true); + if (Main.player[npc.target].GetModPlayer(mod).clamity) + { + hitAmount = 3; + hasBeenHit = true; + } + if (npc.justHit && hitAmount < 3) + { + ++hitAmount; + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (hitAmount == 3) + { + if (!statChange) + { + npc.defense = 6; + npc.damage = Main.expertMode ? 60 : 30; + if (Main.hardMode) + { + npc.defense = 15; + npc.damage = Main.expertMode ? 120 : 60; + } + statChange = true; + } + if (npc.ai[0] == 0f) + { + if (Main.netMode != 1) + { + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) + { + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + npc.ai[0] = 1f; + npc.netUpdate = true; + return; + } + } + else if (npc.velocity.Y == 0f) + { + npc.ai[2] += 1f; + int num321 = 20; + if (npc.ai[1] == 0f) + { + num321 = 12; + } + 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) + { + 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) + { + float multiplierX = (float)Main.rand.Next(3, 7); + npc.velocity.X = (float)npc.direction * multiplierX; + npc.velocity.Y = -8f; + npc.ai[1] = 0f; + } + else + { + float multiplierX = (float)Main.rand.Next(5, 9); + npc.velocity.X = (float)npc.direction * multiplierX; + npc.velocity.Y = -4f; + } + } + npc.netUpdate = true; + return; + } + else + { + 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) + { + npc.velocity.X = npc.velocity.X - 0.1f; + return; + } + } + } + else + { + npc.damage = 0; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (hitAmount < 3) + { + npc.frame.Y = frameHeight * 4; + } + else + { + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.2f; + } + return 0f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, 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, 37, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Clam/Clam3"), 1f); + } + } + 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/EutrophicRay.cs b/NPCs/SunkenSeaNPCs/EutrophicRay.cs index cce39f5f90..d1e21fc006 100644 --- a/NPCs/SunkenSeaNPCs/EutrophicRay.cs +++ b/NPCs/SunkenSeaNPCs/EutrophicRay.cs @@ -1,222 +1,222 @@ -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; - -namespace CalamityMod.NPCs.SunkenSeaNPCs -{ - public class EutrophicRay : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eutrophic Ray"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.damage = 20; - npc.width = 116; - npc.height = 36; - npc.defense = Main.hardMode ? 15 : 5; - npc.lifeMax = Main.hardMode ? 500 : 150; - npc.aiStyle = -1; - aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath55; - npc.knockBackResist = 0f; - banner = npc.type; - bannerItem = mod.ItemType("EutrophicRayBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } - - public override void AI() - { - npc.TargetClosest(true); - if (npc.velocity.X > 0.25f) - { - npc.spriteDirection = 1; - } - else if (npc.velocity.X < 0.25f) - { - npc.spriteDirection = -1; - } - if (npc.justHit && !hasBeenHit) - { - hasBeenHit = true; - npc.damage = Main.expertMode ? 40 : 20; - if (Main.hardMode) - { - npc.damage = Main.expertMode ? 100 : 50; - } - npc.noTileCollide = true; - npc.noGravity = true; - if ((npc.Center.X) < Main.player[npc.target].Center.X) - { - npc.ai[0] = 1f; - } - else - { - npc.ai[0] = 2f; - } - } - npc.chaseable = hasBeenHit; - if (hasBeenHit) - { - float AccelerationY = Main.hardMode ? 0.4f : 0.2f; - float MaxSpeedY = Main.hardMode ? 4f : 2.5f; - float Rotation = 0; - if ((npc.Center.Y + 0.4f) > Main.player[npc.target].Center.Y) - { - npc.velocity.Y -= AccelerationY; - if (npc.velocity.Y < -MaxSpeedY) - { - npc.velocity.Y = -MaxSpeedY; - } - } - else if ((npc.Center.Y - 0.4f) < Main.player[npc.target].Center.Y) - { - npc.velocity.Y += AccelerationY; - if (npc.velocity.Y > MaxSpeedY) - { - npc.velocity.Y = MaxSpeedY; - } - } - float AccelerationX = Main.hardMode ? 0.4f : 0.25f; - float MaxSpeedX = Main.hardMode ? 6f : 4f; - - if (npc.ai[0] == 1f) - { - Rotation = -0.05f; - npc.velocity.X -= AccelerationX; - if (npc.velocity.X < -MaxSpeedX) - { - npc.velocity.X = -MaxSpeedX; - } - - if ((npc.Center.X + 300f) < Main.player[npc.target].Center.X) - { - npc.ai[0] = 2f; - } - } - else if (npc.ai[0] == 2f) - { - Rotation = 0.05f; - npc.velocity.X += AccelerationX; - if (npc.velocity.X > MaxSpeedX) - { - npc.velocity.X = MaxSpeedX; - } - - if ((npc.Center.X - 300f) > Main.player[npc.target].Center.X) - { - npc.ai[0] = 1f; - } - } - - npc.rotation = npc.velocity.Y * Rotation; - if ((double)npc.rotation < -0.1) - { - npc.rotation = -0.1f; - } - if ((double)npc.rotation > 0.1) - { - npc.rotation = 0.1f; - return; - } - } - else - { - npc.damage = 0; - } - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - 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/SunkenSeaNPCs/EutrophicRayGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/EutrophicRayGlow").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.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/EutrophicRayGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - 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("EutrophicShank")); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore4"), 1f); - } - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.NPCs.SunkenSeaNPCs +{ + public class EutrophicRay : ModNPC + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eutrophic Ray"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.damage = 20; + npc.width = 116; + npc.height = 36; + npc.defense = Main.hardMode ? 15 : 5; + npc.lifeMax = Main.hardMode ? 500 : 150; + npc.aiStyle = -1; + aiType = -1; + npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath55; + npc.knockBackResist = 0f; + banner = npc.type; + bannerItem = mod.ItemType("EutrophicRayBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } + + public override void AI() + { + npc.TargetClosest(true); + if (npc.velocity.X > 0.25f) + { + npc.spriteDirection = 1; + } + else if (npc.velocity.X < 0.25f) + { + npc.spriteDirection = -1; + } + if (npc.justHit && !hasBeenHit) + { + hasBeenHit = true; + npc.damage = Main.expertMode ? 40 : 20; + if (Main.hardMode) + { + npc.damage = Main.expertMode ? 100 : 50; + } + npc.noTileCollide = true; + npc.noGravity = true; + if ((npc.Center.X) < Main.player[npc.target].Center.X) + { + npc.ai[0] = 1f; + } + else + { + npc.ai[0] = 2f; + } + } + npc.chaseable = hasBeenHit; + if (hasBeenHit) + { + float AccelerationY = Main.hardMode ? 0.4f : 0.2f; + float MaxSpeedY = Main.hardMode ? 4f : 2.5f; + float Rotation = 0; + if ((npc.Center.Y + 0.4f) > Main.player[npc.target].Center.Y) + { + npc.velocity.Y -= AccelerationY; + if (npc.velocity.Y < -MaxSpeedY) + { + npc.velocity.Y = -MaxSpeedY; + } + } + else if ((npc.Center.Y - 0.4f) < Main.player[npc.target].Center.Y) + { + npc.velocity.Y += AccelerationY; + if (npc.velocity.Y > MaxSpeedY) + { + npc.velocity.Y = MaxSpeedY; + } + } + float AccelerationX = Main.hardMode ? 0.4f : 0.25f; + float MaxSpeedX = Main.hardMode ? 6f : 4f; + + if (npc.ai[0] == 1f) + { + Rotation = -0.05f; + npc.velocity.X -= AccelerationX; + if (npc.velocity.X < -MaxSpeedX) + { + npc.velocity.X = -MaxSpeedX; + } + + if ((npc.Center.X + 300f) < Main.player[npc.target].Center.X) + { + npc.ai[0] = 2f; + } + } + else if (npc.ai[0] == 2f) + { + Rotation = 0.05f; + npc.velocity.X += AccelerationX; + if (npc.velocity.X > MaxSpeedX) + { + npc.velocity.X = MaxSpeedX; + } + + if ((npc.Center.X - 300f) > Main.player[npc.target].Center.X) + { + npc.ai[0] = 1f; + } + } + + npc.rotation = npc.velocity.Y * Rotation; + if ((double)npc.rotation < -0.1) + { + npc.rotation = -0.1f; + } + if ((double)npc.rotation > 0.1) + { + npc.rotation = 0.1f; + return; + } + } + else + { + npc.damage = 0; + } + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + 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/SunkenSeaNPCs/EutrophicRayGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/EutrophicRayGlow").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.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/EutrophicRayGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + 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("EutrophicShank")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/EutrophicRay/RayGore4"), 1f); + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/GhostBell.cs b/NPCs/SunkenSeaNPCs/GhostBell.cs index 402529f273..163bf677ca 100644 --- a/NPCs/SunkenSeaNPCs/GhostBell.cs +++ b/NPCs/SunkenSeaNPCs/GhostBell.cs @@ -1,164 +1,164 @@ -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.SunkenSeaNPCs -{ - public class GhostBell : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ghost Bell"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.aiStyle = -1; - aiType = -1; - npc.damage = Main.hardMode ? 75 : 25; - npc.width = 54; - npc.height = 76; - npc.defense = Main.hardMode ? 10 : 0; - npc.lifeMax = Main.hardMode ? 400 : 120; - npc.knockBackResist = 0f; - npc.alpha = 100; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 20, 0) : Item.buyPrice(0, 0, 2, 0); - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; - bannerItem = mod.ItemType("GhostBellBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } - - public override void AI() - { - Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 1.5f) / 255f, ((255 - npc.alpha) * 1.5f) / 255f); - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.velocity.Y = -6f; - npc.netUpdate = true; - } - if (npc.wet) - { - npc.noGravity = true; - if (npc.localAI[2] > 0f) - { - npc.localAI[2] -= 1f; - } - if (npc.localAI[2] <= 0f) - { - if (npc.velocity.Y == 0f) - { - npc.localAI[1] += 1f; - } - else - { - npc.localAI[1] = 0f; - } - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 3f || npc.localAI[1] >= 6f) - { - npc.velocity.Y = -3f; - } - } - } - else - { - npc.noGravity = false; - npc.velocity.Y = 2f; - npc.localAI[2] = 75f; - npc.netUpdate = true; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; - } - return 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/SunkenSeaNPCs/GhostBellGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellGlow").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.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Electrified, 120, true); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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.SunkenSeaNPCs +{ + public class GhostBell : ModNPC + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghost Bell"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.aiStyle = -1; + aiType = -1; + npc.damage = Main.hardMode ? 75 : 25; + npc.width = 54; + npc.height = 76; + npc.defense = Main.hardMode ? 10 : 0; + npc.lifeMax = Main.hardMode ? 400 : 120; + npc.knockBackResist = 0f; + npc.alpha = 100; + npc.value = Main.hardMode ? Item.buyPrice(0, 0, 20, 0) : Item.buyPrice(0, 0, 2, 0); + npc.HitSound = SoundID.NPCHit25; + npc.DeathSound = SoundID.NPCDeath28; + banner = npc.type; + bannerItem = mod.ItemType("GhostBellBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } + + public override void AI() + { + Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 1.5f) / 255f, ((255 - npc.alpha) * 1.5f) / 255f); + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.velocity.Y = -6f; + npc.netUpdate = true; + } + if (npc.wet) + { + npc.noGravity = true; + if (npc.localAI[2] > 0f) + { + npc.localAI[2] -= 1f; + } + if (npc.localAI[2] <= 0f) + { + if (npc.velocity.Y == 0f) + { + npc.localAI[1] += 1f; + } + else + { + npc.localAI[1] = 0f; + } + npc.velocity.Y += 0.1f; + if (npc.velocity.Y > 3f || npc.localAI[1] >= 6f) + { + npc.velocity.Y = -3f; + } + } + } + else + { + npc.noGravity = false; + npc.velocity.Y = 2f; + npc.localAI[2] = 75f; + npc.netUpdate = true; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.1f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.9f; + } + return 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/SunkenSeaNPCs/GhostBellGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellGlow").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.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 120, true); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/GhostBellSmall.cs b/NPCs/SunkenSeaNPCs/GhostBellSmall.cs index 3da5f3edec..cbd32eed75 100644 --- a/NPCs/SunkenSeaNPCs/GhostBellSmall.cs +++ b/NPCs/SunkenSeaNPCs/GhostBellSmall.cs @@ -1,139 +1,139 @@ -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.SunkenSeaNPCs -{ - public class GhostBellSmall : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Baby Ghost Bell"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.1f; - npc.noGravity = true; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 28; - npc.height = 36; - npc.defense = 0; - npc.lifeMax = 5; - npc.knockBackResist = 1f; - npc.alpha = 100; - npc.HitSound = SoundID.NPCHit25; - npc.DeathSound = SoundID.NPCDeath28; - banner = npc.type; - bannerItem = mod.ItemType("GhostBellSmallBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } - - public override void AI() - { - Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 1f) / 255f, ((255 - npc.alpha) * 1f) / 255f); - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.velocity.Y = -3f; - npc.netUpdate = true; - } - if (npc.wet) - { - npc.noGravity = true; - if (npc.velocity.Y < 0f) - { - npc.velocity.Y += 0.1f; - } - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.noGravity = false; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - 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 float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 1.5f; - } - return 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/SunkenSeaNPCs/GhostBellSmallGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellSmallGlow").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.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellSmallGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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.SunkenSeaNPCs +{ + public class GhostBellSmall : ModNPC + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Baby Ghost Bell"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.1f; + npc.noGravity = true; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 0; + npc.width = 28; + npc.height = 36; + npc.defense = 0; + npc.lifeMax = 5; + npc.knockBackResist = 1f; + npc.alpha = 100; + npc.HitSound = SoundID.NPCHit25; + npc.DeathSound = SoundID.NPCDeath28; + banner = npc.type; + bannerItem = mod.ItemType("GhostBellSmallBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } + + public override void AI() + { + Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 1f) / 255f, ((255 - npc.alpha) * 1f) / 255f); + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.velocity.Y = -3f; + npc.netUpdate = true; + } + if (npc.wet) + { + npc.noGravity = true; + if (npc.velocity.Y < 0f) + { + npc.velocity.Y += 0.1f; + } + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.noGravity = false; + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + 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 float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 1.5f; + } + return 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/SunkenSeaNPCs/GhostBellSmallGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellSmallGlow").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.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GhostBellSmallGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/GiantClam.cs b/NPCs/SunkenSeaNPCs/GiantClam.cs index e8671e8da3..982736e8db 100644 --- a/NPCs/SunkenSeaNPCs/GiantClam.cs +++ b/NPCs/SunkenSeaNPCs/GiantClam.cs @@ -1,437 +1,437 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SunkenSeaNPCs -{ - public class GiantClam : ModNPC - { - 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() - { - DisplayName.SetDefault("Giant Clam"); - Main.npcFrameCount[npc.type] = 12; - } - - public override void SetDefaults() - { - npc.lavaImmune = true; - npc.npcSlots = 5f; - npc.damage = 50; - npc.width = 160; - npc.height = 120; - 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); - npc.HitSound = SoundID.NPCHit4; - npc.knockBackResist = 0f; - npc.rarity = 2; - banner = npc.type; - bannerItem = mod.ItemType("GiantClamBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hitAmount); - writer.Write(attack); - writer.Write(attackAnim); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - writer.Write(statChange); - writer.Write(hide); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hitAmount = reader.ReadInt32(); - attack = reader.ReadInt32(); - attackAnim = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - statChange = reader.ReadBoolean(); - hide = reader.ReadBoolean(); - } - - public override void AI() - { - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - if (npc.justHit && hitAmount < 5) - { - ++hitAmount; - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (hitAmount == 5) - { - if (Main.netMode != 2) - { - if (!Main.player[npc.target].dead && Main.player[npc.target].active) - { - player.AddBuff(mod.BuffType("Clamity"), 2); //CLAM INVASION - } - } - - if (!hide) - Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 2.5f) / 255f, ((255 - npc.alpha) * 2.5f) / 255f); - - if (!statChange) - { - npc.defense = 10; - npc.damage = Main.expertMode ? 100 : 50; - if (Main.hardMode) - { - npc.defense = 35; - npc.damage = Main.expertMode ? 200 : 100; - } - statChange = true; - } - - if (npc.ai[0] < 240f) - { - npc.ai[0] += 1f; - hide = false; - } - else - { - if (attack == -1) - { - attack = Main.rand.Next(2); - if (attack == 0) - { - attack = Main.rand.Next(2); //rarer chance of doing the hiding clam - } - } - else if (attack == 0) - { - hide = true; - npc.defense = 9999; - npc.ai[1] += 1f; - if (npc.ai[1] >= 90f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - hide = false; - attack = -1; - npc.defense = Main.hardMode ? 35 : 10; - NPC.NewNPC((int)(npc.Center.X + 5), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)(npc.Center.X), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)(npc.Center.X - 5), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); - } - } - else if (attack == 1) - { - if (npc.ai[2] == 0f) - { - if (Main.netMode != 1) - { - npc.TargetClosest(true); - npc.ai[2] = 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 1f) - { - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.alpha += Main.hardMode ? 8 : 5; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.position.X = player.Center.X - (float)(npc.width / 2); - npc.position.Y = player.Center.Y - (float)(npc.height / 2) + player.gfxOffY - 200f; - npc.position.X = npc.position.X - 15f; - npc.position.Y = npc.position.Y - 100f; - npc.ai[2] = 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - if (Main.rand.Next(2) == 0) - { - int num5 = Dust.NewDust(npc.position, npc.width, npc.height, 226, 0f, 0f, 200, default(Color), 1.5f); - 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(-200, 201), (float)Main.rand.Next(-200, 201)); - vector.Normalize(); - vector *= (float)Main.rand.Next(100, 200) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = npc.Center - vector; - } - npc.alpha -= Main.hardMode ? 7 : 4; - if (npc.alpha <= 0) - { - npc.damage = Main.expertMode ? 100 : 50; - if (Main.hardMode) - { - npc.damage = Main.expertMode ? 200 : 100; - } - npc.chaseable = true; - npc.dontTakeDamage = false; - npc.alpha = 0; - npc.ai[2] = 3f; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 3f) - { - npc.velocity.Y += 0.8f; - attackAnim = true; - if ((npc.Center.Y) > (player.Center.Y - (float)(npc.height / 2) + player.gfxOffY - 15f)) - { - npc.noTileCollide = false; - npc.ai[2] = 4f; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 4f) - { - if (npc.velocity.Y == 0f) - { - npc.ai[2] = 0f; - npc.ai[0] = 0f; - npc.netUpdate = true; - npc.noGravity = false; - attack = -1; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)npc.position.X, (int)npc.position.Y); - for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) - { - for (int stompDustAmount = 0; stompDustAmount < 5; stompDustAmount++) - { - int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + (float)npc.height), npc.width + 30, 4, 33, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[stompDust].velocity *= 0.2f; - } - 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; - } - } - npc.velocity.Y += 0.8f; - } - } - } - - if (npc.ai[3] < 180f && Main.hardMode) - { - npc.ai[3] += 1f; - } - else if (Main.hardMode) - { - if (attack == -1) - { - attack = Main.rand.Next(2, 4); - } - else if (attack == 2) - { - Main.PlaySound(SoundID.Item67, npc.position); - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int projectileShot = mod.ProjectileType("PearlBurst"); - int damage = Main.expertMode ? 50 : 75; - 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(-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; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - for (int i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 3f), (float)(-Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - } - attack = -1; - npc.ai[3] = 0f; - } - else if (attack == 3) - { - if (Main.netMode != 1) - { - Main.PlaySound(SoundID.Item68, npc.position); - int damage = Main.expertMode ? 30 : 50; - float shotSpacing = 750f; - for (int i = 0; i < 11; i++) - { - Projectile.NewProjectile(player.Center.X + shotSpacing, player.Center.Y - 750f, 0f, 8f, mod.ProjectileType("PearlRain"), damage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing -= 150f; - } - } - attack = -1; - npc.ai[3] = 0f; - } - } - } - } - - public override bool CheckActive() - { - return Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f; - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > (attackAnim ? 2.0 : 5.0)) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (hitAmount < 5 || hide) - { - npc.frame.Y = frameHeight * 11; - } - else if (attackAnim) - { - if (npc.frame.Y < frameHeight * 3) - { - npc.frame.Y = frameHeight * 3; - } - if (npc.frame.Y > frameHeight * 10) - { - hide = true; - attackAnim = false; - } - } - else - { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GiantClam"))) - { - return SpawnCondition.CaveJellyfish.Chance * 0.12f; - } - return 0f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, 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, 37, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam5"), 1f); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Texture2D texture = Main.npcTexture[npc.type]; - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); - return false; - } - - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - 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/SunkenSeaNPCs/GiantClamGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GiantClamGlow").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.LightBlue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GiantClamGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void NPCLoot() - { - int seahoe = NPC.FindFirstNPC(mod.NPCType("SEAHOE")); - if (seahoe == -1 && Main.netMode != 1 && CalamityWorld.downedDesertScourge) - { - 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")); - } - if (CalamityWorld.revenge && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AmidiasPendant")); - } - if (Main.hardMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MolluskHusk"), Main.rand.Next(6, 12)); - - int itemChoice = Main.rand.Next(4); - switch (itemChoice) - { - case 0: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Poseidon")); - break; - case 1: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ClamCrusher")); - break; - case 2: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ClamorRifle")); - break; - case 3: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ShellfishStaff")); - break; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SunkenSeaNPCs +{ + public class GiantClam : ModNPC + { + 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() + { + DisplayName.SetDefault("Giant Clam"); + Main.npcFrameCount[npc.type] = 12; + } + + public override void SetDefaults() + { + npc.lavaImmune = true; + npc.npcSlots = 5f; + npc.damage = 50; + npc.width = 160; + npc.height = 120; + 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); + npc.HitSound = SoundID.NPCHit4; + npc.knockBackResist = 0f; + npc.rarity = 2; + banner = npc.type; + bannerItem = mod.ItemType("GiantClamBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(hitAmount); + writer.Write(attack); + writer.Write(attackAnim); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + writer.Write(statChange); + writer.Write(hide); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + hitAmount = reader.ReadInt32(); + attack = reader.ReadInt32(); + attackAnim = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + statChange = reader.ReadBoolean(); + hide = reader.ReadBoolean(); + } + + public override void AI() + { + npc.TargetClosest(true); + Player player = Main.player[npc.target]; + if (npc.justHit && hitAmount < 5) + { + ++hitAmount; + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (hitAmount == 5) + { + if (Main.netMode != 2) + { + if (!Main.player[npc.target].dead && Main.player[npc.target].active) + { + player.AddBuff(mod.BuffType("Clamity"), 2); //CLAM INVASION + } + } + + if (!hide) + Lighting.AddLight(npc.Center, 0f, ((255 - npc.alpha) * 2.5f) / 255f, ((255 - npc.alpha) * 2.5f) / 255f); + + if (!statChange) + { + npc.defense = 10; + npc.damage = Main.expertMode ? 100 : 50; + if (Main.hardMode) + { + npc.defense = 35; + npc.damage = Main.expertMode ? 200 : 100; + } + statChange = true; + } + + if (npc.ai[0] < 240f) + { + npc.ai[0] += 1f; + hide = false; + } + else + { + if (attack == -1) + { + attack = Main.rand.Next(2); + if (attack == 0) + { + attack = Main.rand.Next(2); //rarer chance of doing the hiding clam + } + } + else if (attack == 0) + { + hide = true; + npc.defense = 9999; + npc.ai[1] += 1f; + if (npc.ai[1] >= 90f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + hide = false; + attack = -1; + npc.defense = Main.hardMode ? 35 : 10; + NPC.NewNPC((int)(npc.Center.X + 5), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)(npc.Center.X), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)(npc.Center.X - 5), (int)npc.Center.Y, mod.NPCType("Clam"), 0, 0f, 0f, 0f, 0f, 255); + } + } + else if (attack == 1) + { + if (npc.ai[2] == 0f) + { + if (Main.netMode != 1) + { + npc.TargetClosest(true); + npc.ai[2] = 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 1f) + { + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.alpha += Main.hardMode ? 8 : 5; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.position.X = player.Center.X - (float)(npc.width / 2); + npc.position.Y = player.Center.Y - (float)(npc.height / 2) + player.gfxOffY - 200f; + npc.position.X = npc.position.X - 15f; + npc.position.Y = npc.position.Y - 100f; + npc.ai[2] = 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 2f) + { + if (Main.rand.Next(2) == 0) + { + int num5 = Dust.NewDust(npc.position, npc.width, npc.height, 226, 0f, 0f, 200, default(Color), 1.5f); + 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(-200, 201), (float)Main.rand.Next(-200, 201)); + vector.Normalize(); + vector *= (float)Main.rand.Next(100, 200) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = npc.Center - vector; + } + npc.alpha -= Main.hardMode ? 7 : 4; + if (npc.alpha <= 0) + { + npc.damage = Main.expertMode ? 100 : 50; + if (Main.hardMode) + { + npc.damage = Main.expertMode ? 200 : 100; + } + npc.chaseable = true; + npc.dontTakeDamage = false; + npc.alpha = 0; + npc.ai[2] = 3f; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 3f) + { + npc.velocity.Y += 0.8f; + attackAnim = true; + if ((npc.Center.Y) > (player.Center.Y - (float)(npc.height / 2) + player.gfxOffY - 15f)) + { + npc.noTileCollide = false; + npc.ai[2] = 4f; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 4f) + { + if (npc.velocity.Y == 0f) + { + npc.ai[2] = 0f; + npc.ai[0] = 0f; + npc.netUpdate = true; + npc.noGravity = false; + attack = -1; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)npc.position.X, (int)npc.position.Y); + for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) + { + for (int stompDustAmount = 0; stompDustAmount < 5; stompDustAmount++) + { + int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + (float)npc.height), npc.width + 30, 4, 33, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[stompDust].velocity *= 0.2f; + } + 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; + } + } + npc.velocity.Y += 0.8f; + } + } + } + + if (npc.ai[3] < 180f && Main.hardMode) + { + npc.ai[3] += 1f; + } + else if (Main.hardMode) + { + if (attack == -1) + { + attack = Main.rand.Next(2, 4); + } + else if (attack == 2) + { + Main.PlaySound(SoundID.Item67, npc.position); + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int projectileShot = mod.ProjectileType("PearlBurst"); + int damage = Main.expertMode ? 50 : 75; + 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(-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; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + for (int i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(value9.X, value9.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, (float)(-Math.Sin(offsetAngle) * 3f), (float)(-Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + } + attack = -1; + npc.ai[3] = 0f; + } + else if (attack == 3) + { + if (Main.netMode != 1) + { + Main.PlaySound(SoundID.Item68, npc.position); + int damage = Main.expertMode ? 30 : 50; + float shotSpacing = 750f; + for (int i = 0; i < 11; i++) + { + Projectile.NewProjectile(player.Center.X + shotSpacing, player.Center.Y - 750f, 0f, 8f, mod.ProjectileType("PearlRain"), damage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing -= 150f; + } + } + attack = -1; + npc.ai[3] = 0f; + } + } + } + } + + public override bool CheckActive() + { + return Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f; + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > (attackAnim ? 2.0 : 5.0)) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (hitAmount < 5 || hide) + { + npc.frame.Y = frameHeight * 11; + } + else if (attackAnim) + { + if (npc.frame.Y < frameHeight * 3) + { + npc.frame.Y = frameHeight * 3; + } + if (npc.frame.Y > frameHeight * 10) + { + hide = true; + attackAnim = false; + } + } + else + { + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("GiantClam"))) + { + return SpawnCondition.CaveJellyfish.Chance * 0.12f; + } + return 0f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, 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, 37, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantClam/GiantClam5"), 1f); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Texture2D texture = Main.npcTexture[npc.type]; + CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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/SunkenSeaNPCs/GiantClamGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/GiantClamGlow").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.LightBlue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/SunkenSeaNPCs/GiantClamGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void NPCLoot() + { + int seahoe = NPC.FindFirstNPC(mod.NPCType("SEAHOE")); + if (seahoe == -1 && Main.netMode != 1 && CalamityWorld.downedDesertScourge) + { + 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")); + } + if (CalamityWorld.revenge && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AmidiasPendant")); + } + if (Main.hardMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MolluskHusk"), Main.rand.Next(6, 12)); + + int itemChoice = Main.rand.Next(4); + switch (itemChoice) + { + case 0: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Poseidon")); + break; + case 1: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ClamCrusher")); + break; + case 2: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ClamorRifle")); + break; + case 3: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ShellfishStaff")); + break; + } + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/PrismTurtle.cs b/NPCs/SunkenSeaNPCs/PrismTurtle.cs index 35b7cdfa7f..779f55fe0c 100644 --- a/NPCs/SunkenSeaNPCs/PrismTurtle.cs +++ b/NPCs/SunkenSeaNPCs/PrismTurtle.cs @@ -1,292 +1,292 @@ -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.World; - -namespace CalamityMod.NPCs.SunkenSeaNPCs -{ - public class PrismTurtle : ModNPC - { - public bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prism-Back"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.noGravity = true; - npc.damage = Main.hardMode ? 40 : 20; //normal damage - npc.width = 72; - npc.height = 58; - npc.defense = Main.hardMode ? 25 : 10; - npc.lifeMax = Main.hardMode ? 1000 : 350; - npc.aiStyle = -1; - aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit24; - npc.DeathSound = SoundID.NPCDeath27; - npc.knockBackResist = 0.15f; - banner = npc.type; - bannerItem = mod.ItemType("PrismTurtleBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } - - public override void AI() - { - if ((npc.Center.Y + 10f) > Main.player[npc.target].Center.Y) - { - if (CalamityWorld.death) //gotta do damage scaling directly - { - npc.damage = Main.hardMode ? 240 : 120; - } - else if (CalamityWorld.revenge) - { - npc.damage = Main.hardMode ? 168 : 84; - } - else if (Main.expertMode) - { - npc.damage = Main.hardMode ? 160 : 80; - } - else - { - npc.damage = Main.hardMode ? 80 : 40; - } - } - else - { - if (CalamityWorld.death) //gotta do damage scaling directly - { - npc.damage = Main.hardMode ? 120 : 60; - } - else if (CalamityWorld.revenge) - { - npc.damage = Main.hardMode ? 84 : 42; - } - else if (Main.expertMode) - { - npc.damage = Main.hardMode ? 80 : 40; - } - else - { - npc.damage = Main.hardMode ? 40 : 20; - } - } - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f); - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - if (npc.collideX || npc.velocity.X == 0f) - { - 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; - } - } - 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.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.1f; - if (npc.velocity.Y < -1f) - { - npc.velocity.Y = -1f; - ++npc.ai[1]; - if (npc.ai[1] >= 120) - { - npc.ai[1] = 0; - npc.ai[0] = 1f; - } - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.1f; - if (npc.velocity.Y > 1f) - { - npc.velocity.Y = 1f; - ++npc.ai[1]; - if (npc.ai[1] >= 120) - { - npc.ai[1] = 0; - 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) - { - 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.4f; - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = 12f; - } - npc.ai[0] = 1f; - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) - { - npc.rotation = -0.2f; - } - if ((double)npc.rotation > 0.2) - { - npc.rotation = 0.2f; - return; - } - } - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (npc.wet ? 0.1f : 0f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - 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/SunkenSeaNPCs/PrismTurtleGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/PrismTurtleGlow").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/SunkenSeaNPCs/PrismTurtleGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; - } - return 0f; - } - - public override void NPCLoot() - { - if (CalamityWorld.downedDesertScourge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PrismShard"), Main.rand.Next(1, 4)); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore5"), 1f); - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file +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.World; + +namespace CalamityMod.NPCs.SunkenSeaNPCs +{ + public class PrismTurtle : ModNPC + { + public bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism-Back"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = Main.hardMode ? 40 : 20; //normal damage + npc.width = 72; + npc.height = 58; + npc.defense = Main.hardMode ? 25 : 10; + npc.lifeMax = Main.hardMode ? 1000 : 350; + npc.aiStyle = -1; + aiType = -1; + npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit24; + npc.DeathSound = SoundID.NPCDeath27; + npc.knockBackResist = 0.15f; + banner = npc.type; + bannerItem = mod.ItemType("PrismTurtleBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } + + public override void AI() + { + if ((npc.Center.Y + 10f) > Main.player[npc.target].Center.Y) + { + if (CalamityWorld.death) //gotta do damage scaling directly + { + npc.damage = Main.hardMode ? 240 : 120; + } + else if (CalamityWorld.revenge) + { + npc.damage = Main.hardMode ? 168 : 84; + } + else if (Main.expertMode) + { + npc.damage = Main.hardMode ? 160 : 80; + } + else + { + npc.damage = Main.hardMode ? 80 : 40; + } + } + else + { + if (CalamityWorld.death) //gotta do damage scaling directly + { + npc.damage = Main.hardMode ? 120 : 60; + } + else if (CalamityWorld.revenge) + { + npc.damage = Main.hardMode ? 84 : 42; + } + else if (Main.expertMode) + { + npc.damage = Main.hardMode ? 80 : 40; + } + else + { + npc.damage = Main.hardMode ? 40 : 20; + } + } + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f, ((255 - npc.alpha) * 0.75f) / 255f); + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + if (npc.collideX || npc.velocity.X == 0f) + { + 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; + } + } + 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.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.1f; + if (npc.velocity.Y < -1f) + { + npc.velocity.Y = -1f; + ++npc.ai[1]; + if (npc.ai[1] >= 120) + { + npc.ai[1] = 0; + npc.ai[0] = 1f; + } + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.1f; + if (npc.velocity.Y > 1f) + { + npc.velocity.Y = 1f; + ++npc.ai[1]; + if (npc.ai[1] >= 120) + { + npc.ai[1] = 0; + 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) + { + 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.4f; + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = 12f; + } + npc.ai[0] = 1f; + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.2) + { + npc.rotation = -0.2f; + } + if ((double)npc.rotation > 0.2) + { + npc.rotation = 0.2f; + return; + } + } + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (npc.wet ? 0.1f : 0f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + 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/SunkenSeaNPCs/PrismTurtleGlow").Width, (float)(mod.GetTexture("NPCs/SunkenSeaNPCs/PrismTurtleGlow").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/SunkenSeaNPCs/PrismTurtleGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.9f; + } + return 0f; + } + + public override void NPCLoot() + { + if (CalamityWorld.downedDesertScourge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PrismShard"), Main.rand.Next(1, 4)); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/PrismTurtle/PrismTurtleGore5"), 1f); + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/SeaFloaty.cs b/NPCs/SunkenSeaNPCs/SeaFloaty.cs index 8317054408..33771d6ab8 100644 --- a/NPCs/SunkenSeaNPCs/SeaFloaty.cs +++ b/NPCs/SunkenSeaNPCs/SeaFloaty.cs @@ -1,157 +1,157 @@ -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.SunkenSeaNPCs -{ - public class SeaFloaty : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Floaty"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.5f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 5; - npc.width = 72; - npc.height = 22; - npc.defense = 0; - npc.lifeMax = 50; - npc.knockBackResist = 0.5f; - npc.value = Item.buyPrice(0, 0, 0, 50); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("SeaFloatyBanner"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); - writer.Write(hasBeenHit); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - } - - public override void AI() - { - if (npc.velocity.X > 0.25f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X < 0.25f) - { - npc.spriteDirection = 1; - } - if (npc.ai[0] == 0f) - { - npc.direction = 1; - npc.ai[0] = 1f; - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - - if (npc.justHit && !hasBeenHit) - { - hasBeenHit = true; - npc.noTileCollide = true; - npc.noGravity = true; - } - npc.chaseable = hasBeenHit; - if (hasBeenHit) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X - (float)npc.direction * 0.5f; - npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * 0.3f; - if (npc.velocity.X > 10f) - { - npc.velocity.X = 10f; - } - if (npc.velocity.X < -10f) - { - npc.velocity.X = -10f; - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - if (npc.velocity.Y < -10f) - { - npc.velocity.Y = -10f; - } - npc.direction *= -1; - npc.rotation = npc.velocity.X * 0.1f; - if ((double)npc.rotation < -0.3) - { - npc.rotation = -0.3f; - } - if ((double)npc.rotation > 0.3) - { - npc.rotation = 0.3f; - return; - } - } - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.3f : 0.15f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.45f; - } - return 0f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore3"), 1f); - } - } - } -} \ No newline at end of file +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.SunkenSeaNPCs +{ + public class SeaFloaty : ModNPC + { + private bool hasBeenHit = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Floaty"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.5f; + npc.aiStyle = -1; + aiType = -1; + npc.damage = 5; + npc.width = 72; + npc.height = 22; + npc.defense = 0; + npc.lifeMax = 50; + npc.knockBackResist = 0.5f; + npc.value = Item.buyPrice(0, 0, 0, 50); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("SeaFloatyBanner"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(hasBeenHit); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + } + + public override void AI() + { + if (npc.velocity.X > 0.25f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X < 0.25f) + { + npc.spriteDirection = 1; + } + if (npc.ai[0] == 0f) + { + npc.direction = 1; + npc.ai[0] = 1f; + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + + if (npc.justHit && !hasBeenHit) + { + hasBeenHit = true; + npc.noTileCollide = true; + npc.noGravity = true; + } + npc.chaseable = hasBeenHit; + if (hasBeenHit) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X - (float)npc.direction * 0.5f; + npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * 0.3f; + if (npc.velocity.X > 10f) + { + npc.velocity.X = 10f; + } + if (npc.velocity.X < -10f) + { + npc.velocity.X = -10f; + } + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + if (npc.velocity.Y < -10f) + { + npc.velocity.Y = -10f; + } + npc.direction *= -1; + npc.rotation = npc.velocity.X * 0.1f; + if ((double)npc.rotation < -0.3) + { + npc.rotation = -0.3f; + } + if ((double)npc.rotation > 0.3) + { + npc.rotation = 0.3f; + return; + } + } + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.3f : 0.15f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.45f; + } + return 0f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaFloaty/SeaFloatyGore3"), 1f); + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/SeaMinnow.cs b/NPCs/SunkenSeaNPCs/SeaMinnow.cs index cec02c720e..72306a7a16 100644 --- a/NPCs/SunkenSeaNPCs/SeaMinnow.cs +++ b/NPCs/SunkenSeaNPCs/SeaMinnow.cs @@ -1,220 +1,220 @@ -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.SunkenSeaNPCs -{ - public class SeaMinnow : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Minnow"); - Main.npcFrameCount[npc.type] = 4; - } - - public override void SetDefaults() - { - npc.npcSlots = 0.1f; - npc.noGravity = true; - npc.damage = 0; - npc.width = 36; - npc.height = 22; - npc.defense = 0; - npc.lifeMax = 5; - npc.aiStyle = -1; - aiType = -1; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = mod.ItemType("SeaMinnowBanner"); - } - - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - bool flag14 = false; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.wet) - { - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - (Main.player[npc.target].Center - npc.Center).Length() < 150f) - { - flag14 = true; - } - if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX || npc.velocity.X == 0f) - { - npc.velocity.X = npc.velocity.X * -3f; - 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) * -3f; - 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.25f; - npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * 0.15f; - 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; - } - npc.direction *= -1; - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { - 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) - { - 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 > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.X * 0.05f; - if ((double)npc.rotation < -0.1) - { - npc.rotation = -0.1f; - } - if ((double)npc.rotation > 0.1) - { - npc.rotation = 0.1f; - return; - } - } - - public override void FindFrame(int frameHeight) - { - if (!npc.wet) - { - npc.frameCounter = 0.0; - return; - } - npc.frameCounter += 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.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); - } - } - } -} \ No newline at end of file +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.SunkenSeaNPCs +{ + public class SeaMinnow : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Minnow"); + Main.npcFrameCount[npc.type] = 4; + } + + public override void SetDefaults() + { + npc.npcSlots = 0.1f; + npc.noGravity = true; + npc.damage = 0; + npc.width = 36; + npc.height = 22; + npc.defense = 0; + npc.lifeMax = 5; + npc.aiStyle = -1; + aiType = -1; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = mod.ItemType("SeaMinnowBanner"); + } + + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + bool flag14 = false; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.wet) + { + npc.TargetClosest(false); + if (Main.player[npc.target].wet && !Main.player[npc.target].dead && + (Main.player[npc.target].Center - npc.Center).Length() < 150f) + { + flag14 = true; + } + if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX || npc.velocity.X == 0f) + { + npc.velocity.X = npc.velocity.X * -3f; + 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) * -3f; + 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.25f; + npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * 0.15f; + 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; + } + npc.direction *= -1; + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) + { + 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) + { + 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 > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.X * 0.05f; + if ((double)npc.rotation < -0.1) + { + npc.rotation = -0.1f; + } + if ((double)npc.rotation > 0.1) + { + npc.rotation = 0.1f; + return; + } + } + + public override void FindFrame(int frameHeight) + { + if (!npc.wet) + { + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += 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.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && !spawnInfo.player.GetModPlayer(mod).clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default(Color), 1f); + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent1.cs b/NPCs/SunkenSeaNPCs/SeaSerpent1.cs index 8e4f64a2fe..0266bf927c 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent1.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent1.cs @@ -1,433 +1,433 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; - -namespace CalamityMod.NPCs.SunkenSeaNPCs -{ - public class SeaSerpent1 : ModNPC - { - public bool flies = true; - public const int maxLength = 9; - public float speed = 6f; - public float turnSpeed = 0.125f; - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Serpent"); - } - - public override void SetDefaults() - { - npc.damage = 50; - npc.width = 50; //42 - npc.height = 24; //32 - npc.defense = 10; - npc.lifeMax = 3000; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 20, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - banner = npc.type; - bannerItem = mod.ItemType("SeaSerpentBanner"); - } - - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); - 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 (Main.netMode != 1) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int segment = 0; segment < maxLength; segment++) - { - int lol = 0; - if (segment == 0 || segment == 1 || segment == 4 || segment == 5) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent2"), npc.whoAmI); - } - else if (segment == 2 || segment == 3 || segment == 6) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent3"), npc.whoAmI); - } - else if (segment == 7) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent4"), npc.whoAmI); - } - else if (segment == 8) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent5"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - } - 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 (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - npc.localAI[1] = 0f; - bool canFly = flies; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(mod.NPCType("SeaSerpent5"))) - { - npc.active = 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 200); //800 - if ((Main.player[npc.target].Center - npc.Center).Length() > 250f) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 300f; - } - else - { - num191 = Main.player[npc.target].Center.X - 300f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if ((Main.player[npc.target].Center - npc.Center).Length() > 250f) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (Main.hardMode && spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && - !NPC.AnyNPCs(mod.NPCType("SeaSerpent1")) && !spawnInfo.player.GetModPlayer(mod).clamity && !spawnInfo.playerSafe) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - return 0f; - } - - public override void NPCLoot() - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Serpentine")); - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore1"), 1f); - } - } - - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != 1) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == 2) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; + +namespace CalamityMod.NPCs.SunkenSeaNPCs +{ + public class SeaSerpent1 : ModNPC + { + public bool flies = true; + public const int maxLength = 9; + public float speed = 6f; + public float turnSpeed = 0.125f; + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Serpent"); + } + + public override void SetDefaults() + { + npc.damage = 50; + npc.width = 50; //42 + npc.height = 24; //32 + npc.defense = 10; + npc.lifeMax = 3000; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 20, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + banner = npc.type; + bannerItem = mod.ItemType("SeaSerpentBanner"); + } + + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); + 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 (Main.netMode != 1) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int segment = 0; segment < maxLength; segment++) + { + int lol = 0; + if (segment == 0 || segment == 1 || segment == 4 || segment == 5) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent2"), npc.whoAmI); + } + else if (segment == 2 || segment == 3 || segment == 6) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent3"), npc.whoAmI); + } + else if (segment == 7) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent4"), npc.whoAmI); + } + else if (segment == 8) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SeaSerpent5"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + 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 (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + npc.localAI[1] = 0f; + bool canFly = flies; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(mod.NPCType("SeaSerpent5"))) + { + npc.active = 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 200); //800 + if ((Main.player[npc.target].Center - npc.Center).Length() > 250f) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 300f; + } + else + { + num191 = Main.player[npc.target].Center.X - 300f; + } + } + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if ((Main.player[npc.target].Center - npc.Center).Length() > 250f) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.player.GetModPlayer(mod).ZoneSunkenSea && spawnInfo.water && + !NPC.AnyNPCs(mod.NPCType("SeaSerpent1")) && !spawnInfo.player.GetModPlayer(mod).clamity && !spawnInfo.playerSafe) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + return 0f; + } + + public override void NPCLoot() + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Serpentine")); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore1"), 1f); + } + } + + public override bool CheckActive() + { + if (npc.timeLeft <= 0 && Main.netMode != 1) + { + for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) + { + if (Main.npc[k].active) + { + Main.npc[k].active = false; + if (Main.netMode == 2) + { + Main.npc[k].life = 0; + Main.npc[k].netSkip = -1; + NetMessage.SendData(23, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); + } + } + } + } + return true; + } + } +} diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent2.cs b/NPCs/SunkenSeaNPCs/SeaSerpent2.cs index 0cbe7ce823..0eae210da3 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent2.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent2.cs @@ -1,298 +1,298 @@ -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.SunkenSeaNPCs -{ - public class SeaSerpent2 : ModNPC - { - public float speed = 6f; - public float turnSpeed = 0.125f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Serpent"); - } - - public override void SetDefaults() - { - npc.damage = 40; - npc.width = 24; //42 - npc.height = 16; //24 - npc.defense = 20; - npc.lifeMax = 3000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - banner = mod.NPCType("SeaSerpent1"); - bannerItem = mod.ItemType("SeaSerpentBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); - 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("SeaSerpent1"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore2"), 1f); - } - } - } -} \ No newline at end of file +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.SunkenSeaNPCs +{ + public class SeaSerpent2 : ModNPC + { + public float speed = 6f; + public float turnSpeed = 0.125f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Serpent"); + } + + public override void SetDefaults() + { + npc.damage = 40; + npc.width = 24; //42 + npc.height = 16; //24 + npc.defense = 20; + npc.lifeMax = 3000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + banner = mod.NPCType("SeaSerpent1"); + bannerItem = mod.ItemType("SeaSerpentBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); + 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("SeaSerpent1"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore2"), 1f); + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent3.cs b/NPCs/SunkenSeaNPCs/SeaSerpent3.cs index 4f3c7760df..69e3b16ae2 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent3.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent3.cs @@ -1,298 +1,298 @@ -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.SunkenSeaNPCs -{ - public class SeaSerpent3 : ModNPC - { - public float speed = 6f; - public float turnSpeed = 0.125f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Serpent"); - } - - public override void SetDefaults() - { - npc.damage = 40; - npc.width = 24; //42 - npc.height = 16; //24 - npc.defense = 20; - npc.lifeMax = 3000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - banner = mod.NPCType("SeaSerpent1"); - bannerItem = mod.ItemType("SeaSerpentBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); - 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("SeaSerpent1"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore3"), 1f); - } - } - } -} \ No newline at end of file +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.SunkenSeaNPCs +{ + public class SeaSerpent3 : ModNPC + { + public float speed = 6f; + public float turnSpeed = 0.125f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Serpent"); + } + + public override void SetDefaults() + { + npc.damage = 40; + npc.width = 24; //42 + npc.height = 16; //24 + npc.defense = 20; + npc.lifeMax = 3000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + banner = mod.NPCType("SeaSerpent1"); + bannerItem = mod.ItemType("SeaSerpentBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); + 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("SeaSerpent1"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore3"), 1f); + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent4.cs b/NPCs/SunkenSeaNPCs/SeaSerpent4.cs index 0d36745a53..13398863a5 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent4.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent4.cs @@ -1,298 +1,298 @@ -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.SunkenSeaNPCs -{ - public class SeaSerpent4 : ModNPC - { - public float speed = 6f; - public float turnSpeed = 0.125f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Serpent"); - } - - public override void SetDefaults() - { - npc.damage = 30; - npc.width = 28; //42 - npc.height = 24; //34 - npc.defense = 20; - npc.lifeMax = 3000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - banner = mod.NPCType("SeaSerpent1"); - bannerItem = mod.ItemType("SeaSerpentBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); - 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("SeaSerpent1"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore4"), 1f); - } - } - } -} \ No newline at end of file +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.SunkenSeaNPCs +{ + public class SeaSerpent4 : ModNPC + { + public float speed = 6f; + public float turnSpeed = 0.125f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Serpent"); + } + + public override void SetDefaults() + { + npc.damage = 30; + npc.width = 28; //42 + npc.height = 24; //34 + npc.defense = 20; + npc.lifeMax = 3000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + banner = mod.NPCType("SeaSerpent1"); + bannerItem = mod.ItemType("SeaSerpentBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); + 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("SeaSerpent1"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore4"), 1f); + } + } + } +} diff --git a/NPCs/SunkenSeaNPCs/SeaSerpent5.cs b/NPCs/SunkenSeaNPCs/SeaSerpent5.cs index 736a97d2b2..79fc3bfd70 100644 --- a/NPCs/SunkenSeaNPCs/SeaSerpent5.cs +++ b/NPCs/SunkenSeaNPCs/SeaSerpent5.cs @@ -1,298 +1,298 @@ -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.SunkenSeaNPCs -{ - public class SeaSerpent5 : ModNPC - { - public float speed = 6f; - public float turnSpeed = 0.125f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea Serpent"); - } - - public override void SetDefaults() - { - npc.damage = 20; - npc.width = 36; //42 - npc.height = 30; //40 - npc.defense = 30; - npc.lifeMax = 3000; - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.netAlways = true; - npc.dontCountMe = true; - npc.chaseable = false; - banner = mod.NPCType("SeaSerpent1"); - bannerItem = mod.ItemType("SeaSerpentBanner"); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); - 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("SeaSerpent1"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - 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 CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore5"), 1f); - } - } - } -} \ No newline at end of file +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.SunkenSeaNPCs +{ + public class SeaSerpent5 : ModNPC + { + public float speed = 6f; + public float turnSpeed = 0.125f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea Serpent"); + } + + public override void SetDefaults() + { + npc.damage = 20; + npc.width = 36; //42 + npc.height = 30; //40 + npc.defense = 30; + npc.lifeMax = 3000; + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + banner = mod.NPCType("SeaSerpent1"); + bannerItem = mod.ItemType("SeaSerpentBanner"); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + Lighting.AddLight(npc.Center, ((255 - npc.alpha) * 0f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f, ((255 - npc.alpha) * 0.30f) / 255f); + 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("SeaSerpent1"))) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + 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 CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 37, hitDirection, -1f, 0, default(Color), 1f); + } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore5"), 1f); + } + } + } +} diff --git a/NPCs/SupremeCalamitas/SCalScreenShaderData.cs b/NPCs/SupremeCalamitas/SCalScreenShaderData.cs index 3ccbb9b065..f397096078 100644 --- a/NPCs/SupremeCalamitas/SCalScreenShaderData.cs +++ b/NPCs/SupremeCalamitas/SCalScreenShaderData.cs @@ -1,44 +1,44 @@ -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - public class SCalScreenShaderData : ScreenShaderData - { - private int SCalIndex; - - public SCalScreenShaderData(string passName) - : base(passName) - { - } - - private void UpdateSCalIndex() - { - int SCalType = ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"); - if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) - { - return; - } - SCalIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == SCalType) - { - SCalIndex = i; - break; - } - } - } - - public override void Apply() - { - UpdateSCalIndex(); - if (SCalIndex != -1) - { - UseTargetPosition(Main.npc[SCalIndex].Center); - } - base.Apply(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SCalScreenShaderData : ScreenShaderData + { + private int SCalIndex; + + public SCalScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateSCalIndex() + { + int SCalType = ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"); + if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) + { + return; + } + SCalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == SCalType) + { + SCalIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateSCalIndex(); + if (SCalIndex != -1) + { + UseTargetPosition(Main.npc[SCalIndex].Center); + } + base.Apply(); + } + } +} diff --git a/NPCs/SupremeCalamitas/SCalSky.cs b/NPCs/SupremeCalamitas/SCalSky.cs index 92ec2ef37c..2d585e1354 100644 --- a/NPCs/SupremeCalamitas/SCalSky.cs +++ b/NPCs/SupremeCalamitas/SCalSky.cs @@ -1,101 +1,101 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - public class SCalSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int SCalIndex = -1; - - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } - - private float GetIntensity() - { - if (this.UpdateSCalIndex()) - { - float x = 0f; - if (this.SCalIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); - } - return 1f - Utils.SmoothStep(3000f, 6000f, x); - } - return 0f; - } - - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } - - private bool UpdateSCalIndex() - { - int SCalType = ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"); - if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) - { - return true; - } - SCalIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == SCalType) - { - SCalIndex = i; - break; - } - } - //this.DoGIndex = DoGIndex; - return SCalIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); - } - } - - public override float GetCloudAlpha() - { - return 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } - - public override void Deactivate(params object[] args) - { - isActive = false; - } - - public override void Reset() - { - isActive = false; - } - - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SCalSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int SCalIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdateSCalIndex()) + { + float x = 0f; + if (this.SCalIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); + } + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateSCalIndex() + { + int SCalType = ModLoader.GetMod("CalamityMod").NPCType("SupremeCalamitas"); + if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) + { + return true; + } + SCalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == SCalType) + { + SCalIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return SCalIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} diff --git a/NPCs/SupremeCalamitas/SCalWormBody.cs b/NPCs/SupremeCalamitas/SCalWormBody.cs index 5d0d67f8ba..0c956e76ed 100644 --- a/NPCs/SupremeCalamitas/SCalWormBody.cs +++ b/NPCs/SupremeCalamitas/SCalWormBody.cs @@ -1,148 +1,148 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - public class SCalWormBody : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sepulcher"); - } - - public override void SetDefaults() - { - npc.damage = 0; //70 - npc.npcSlots = 5f; - npc.width = 26; //28 - npc.height = 18; //28 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; - if (CalamityWorld.death) - { - npc.lifeMax = 2000000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - npc.chaseable = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.localAI[3]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.localAI[3] = reader.ReadSingle(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - 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"); - CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor); - return false; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 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); - 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SCalWormBody : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sepulcher"); + } + + public override void SetDefaults() + { + npc.damage = 0; //70 + npc.npcSlots = 5f; + npc.width = 26; //28 + npc.height = 18; //28 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; + if (CalamityWorld.death) + { + npc.lifeMax = 2000000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + npc.chaseable = false; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[3]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.localAI[3] = reader.ReadSingle(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + 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"); + CalamityMod.DrawTexture(spriteBatch, (npc.localAI[3] == 1f ? texture : Main.npcTexture[npc.type]), 0, npc, drawColor); + return false; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 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); + 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs index e4bd5f0903..3921dea24b 100644 --- a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs +++ b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs @@ -1,121 +1,121 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - public class SCalWormBodyWeak : ModNPC - { - public double damageTaken = 0.0; - public int invinceTime = 360; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Heart"); - } - - public override void SetDefaults() - { - npc.damage = 0; //70 - npc.npcSlots = 5f; - npc.width = 14; //324 - npc.height = 12; //216 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; - if (CalamityWorld.death) - { - npc.lifeMax = 2000000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - npc.chaseable = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.netMode != 1) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 900f) - { - npc.localAI[0] = 0f; - int damage = Main.expertMode ? 150 : 200; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 1f, 1f, mod.ProjectileType("BrimstoneBarrage"), damage, 0f, npc.target, 0f, 0f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, -1f, 1f, mod.ProjectileType("BrimstoneBarrage"), damage, 0f, npc.target, 0f, 0f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 1f, -1f, mod.ProjectileType("BrimstoneBarrage"), damage, 0f, npc.target, 0f, 0f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, -1f, -1f, mod.ProjectileType("BrimstoneBarrage"), damage, 0f, npc.target, 0f, 0f); - npc.netUpdate = true; - } - } - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - 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; - } - - public override bool PreNPCLoot() - { - return false; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SCalWormBodyWeak : ModNPC + { + public double damageTaken = 0.0; + public int invinceTime = 360; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Heart"); + } + + public override void SetDefaults() + { + npc.damage = 0; //70 + npc.npcSlots = 5f; + npc.width = 14; //324 + npc.height = 12; //216 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; + if (CalamityWorld.death) + { + npc.lifeMax = 2000000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + npc.chaseable = false; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath13; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.netMode != 1) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 900f) + { + npc.localAI[0] = 0f; + int damage = Main.expertMode ? 150 : 200; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 1f, 1f, mod.ProjectileType("BrimstoneBarrage"), damage, 0f, npc.target, 0f, 0f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, -1f, 1f, mod.ProjectileType("BrimstoneBarrage"), damage, 0f, npc.target, 0f, 0f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 1f, -1f, mod.ProjectileType("BrimstoneBarrage"), damage, 0f, npc.target, 0f, 0f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, -1f, -1f, mod.ProjectileType("BrimstoneBarrage"), damage, 0f, npc.target, 0f, 0f); + npc.netUpdate = true; + } + } + if (!Main.npc[(int)npc.ai[1]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + 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; + } + + public override bool PreNPCLoot() + { + return false; + } + } +} diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index 4ab76fceaf..5eb981be3f 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -1,472 +1,472 @@ -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; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - public class SCalWormHead : ModNPC - { - private bool flies = true; - private const int minLength = 51; - private const int maxLength = 52; - private float speed = 10f; - private float turnSpeed = 0.15f; - private float passedVar = 0f; - private bool TailSpawned = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sepulcher"); - } - - public override void SetDefaults() - { - npc.damage = 0; //150 - npc.npcSlots = 5f; - npc.width = 56; //324 - npc.height = 62; //216 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; - if (CalamityWorld.death) - { - npc.lifeMax = 2000000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.chaseable = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.localAI[0] = reader.ReadSingle(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - CalamityGlobalNPC.SCalWorm = npc.whoAmI; - if (!NPC.AnyNPCs(mod.NPCType("SCalWormHeart")) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = 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 (Main.netMode != 1) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) - { - int lol = 0; - if (num36 >= 0 && num36 < minLength && num36 % 2 == 0) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormBodyWeak"), npc.whoAmI); - Main.npc[lol].localAI[0] += passedVar; - passedVar += 36f; - } - else if (num36 >= 0 && num36 < minLength) - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormBody"), npc.whoAmI); - if (npc.localAI[0] % 2 == 0) - { - Main.npc[lol].localAI[3] = 1f; - npc.localAI[0] = 1f; - } - else - { - npc.localAI[0] = 2f; - } - } - else - { - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormTail"), npc.whoAmI); - } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - Previous = lol; - } - TailSpawned = true; - } - if (!npc.active && Main.netMode == 2) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - 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; - } - bool canFly = flies; - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - canFly = false; - npc.alpha += 5; - if (npc.alpha >= 255) - { - npc.alpha = 255; - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - else - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 400); //800 - if (Main.player[npc.target].position.Y > num47) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 600f; - } - else - { - num191 = Main.player[npc.target].Center.X - 600f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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; - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } - - 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; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 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); - 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +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; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SCalWormHead : ModNPC + { + private bool flies = true; + private const int minLength = 51; + private const int maxLength = 52; + private float speed = 10f; + private float turnSpeed = 0.15f; + private float passedVar = 0f; + private bool TailSpawned = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sepulcher"); + } + + public override void SetDefaults() + { + npc.damage = 0; //150 + npc.npcSlots = 5f; + npc.width = 56; //324 + npc.height = 62; //216 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; + if (CalamityWorld.death) + { + npc.lifeMax = 2000000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.chaseable = false; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.localAI[0] = reader.ReadSingle(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + CalamityGlobalNPC.SCalWorm = npc.whoAmI; + if (!NPC.AnyNPCs(mod.NPCType("SCalWormHeart")) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = 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 (Main.netMode != 1) + { + if (!TailSpawned && npc.ai[0] == 0f) + { + int Previous = npc.whoAmI; + for (int num36 = 0; num36 < maxLength; num36++) + { + int lol = 0; + if (num36 >= 0 && num36 < minLength && num36 % 2 == 0) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormBodyWeak"), npc.whoAmI); + Main.npc[lol].localAI[0] += passedVar; + passedVar += 36f; + } + else if (num36 >= 0 && num36 < minLength) + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormBody"), npc.whoAmI); + if (npc.localAI[0] % 2 == 0) + { + Main.npc[lol].localAI[3] = 1f; + npc.localAI[0] = 1f; + } + else + { + npc.localAI[0] = 2f; + } + } + else + { + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormTail"), npc.whoAmI); + } + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[2] = (float)npc.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + Previous = lol; + } + TailSpawned = true; + } + if (!npc.active && Main.netMode == 2) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + } + 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; + } + bool canFly = flies; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + canFly = false; + npc.alpha += 5; + if (npc.alpha >= 255) + { + npc.alpha = 255; + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = false; + } + } + } + } + else + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) + { + for (int num957 = 0; num957 < 200; num957++) + { + if (Main.npc[num957].aiStyle == npc.aiStyle) + { + Main.npc[num957].active = 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 400); //800 + if (Main.player[npc.target].position.Y > num47) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 600f; + } + else + { + num191 = Main.player[npc.target].Center.X - 600f; + } + } + } + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (num42 > 0) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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; + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + } + + 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; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 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); + 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/SupremeCalamitas/SCalWormHeart.cs b/NPCs/SupremeCalamitas/SCalWormHeart.cs index b33275a59e..8f5d4b4bbf 100644 --- a/NPCs/SupremeCalamitas/SCalWormHeart.cs +++ b/NPCs/SupremeCalamitas/SCalWormHeart.cs @@ -1,84 +1,84 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - public class SCalWormHeart : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Heart"); - } - - public override void SetDefaults() - { - npc.damage = 0; //70 - npc.width = 24; //324 - npc.height = 24; //216 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 180000 : 160000; - if (CalamityWorld.death) - { - npc.lifeMax = 240000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 120000 : 90000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } - - public override void AI() - { - if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("Celestus2")) - { - damage = (int)((double)damage * 0.66); - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SCalWormHeart : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Heart"); + } + + public override void SetDefaults() + { + npc.damage = 0; //70 + npc.width = 24; //324 + npc.height = 24; //216 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 180000 : 160000; + if (CalamityWorld.death) + { + npc.lifeMax = 240000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 120000 : 90000; + } + npc.aiStyle = -1; //new + aiType = -1; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + } + + public override void AI() + { + if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("Celestus2")) + { + damage = (int)((double)damage * 0.66); + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + } +} diff --git a/NPCs/SupremeCalamitas/SCalWormTail.cs b/NPCs/SupremeCalamitas/SCalWormTail.cs index 896400ea3a..a188aaf888 100644 --- a/NPCs/SupremeCalamitas/SCalWormTail.cs +++ b/NPCs/SupremeCalamitas/SCalWormTail.cs @@ -1,130 +1,130 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - public class SCalWormTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sepulcher"); - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 26; //324 - npc.height = 46; //216 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; - if (CalamityWorld.death) - { - npc.lifeMax = 2000000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - npc.chaseable = false; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - 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) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - 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) - { - 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; - 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 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SCalWormTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sepulcher"); + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 5f; + npc.width = 26; //324 + npc.height = 46; //216 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; + if (CalamityWorld.death) + { + npc.lifeMax = 2000000; + } + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.scale = 1.2f; + if (Main.expertMode) + { + npc.scale = 1.35f; + } + npc.alpha = 255; + npc.chaseable = false; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + 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) + { + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + 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) + { + 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; + 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 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + } +} diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 11cd56db17..2e4f993110 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -1,159 +1,159 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - public class SoulSeekerSupreme : ModNPC - { - private int timer = 0; - private bool start = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Seeker"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 40; - npc.height = 40; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.damage = 0; - npc.defense = 100; - npc.lifeMax = Main.expertMode ? 90000 : 50000; - if (CalamityWorld.revenge) - { - npc.lifeMax = CalamityWorld.death ? 100000 : 170000; - } - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override bool PreAI() - { - bool expertMode = Main.expertMode; - if (start) - { - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 2f); - } - npc.ai[1] = npc.ai[0]; - start = false; - } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= 9f; - npc.rotation = direction.ToRotation(); - timer++; - if (timer > 180) - { - if (Main.netMode != 1) - { - int damage = expertMode ? 150 : 200; //600 500 - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("BrimstoneBarrage"), damage, 1f, npc.target); - } - timer = 0; - } - if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - NPC parent = Main.npc[NPC.FindFirstNPC(mod.NPCType("SupremeCalamitas"))]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 300; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 0.5f; //2 - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 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); - 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - if (npc.velocity != Vector2.Zero) - { - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); - for (int i = 1; i < npc.oldPos.Length; ++i) - { - Vector2 vector2_2 = npc.oldPos[i]; - Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; - color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); - color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); - color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); - color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), - npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); - } - } - return true; - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SoulSeekerSupreme : ModNPC + { + private int timer = 0; + private bool start = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Seeker"); + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 40; + npc.height = 40; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.damage = 0; + npc.defense = 100; + npc.lifeMax = Main.expertMode ? 90000 : 50000; + if (CalamityWorld.revenge) + { + npc.lifeMax = CalamityWorld.death ? 100000 : 170000; + } + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override bool PreAI() + { + bool expertMode = Main.expertMode; + if (start) + { + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 2f); + } + npc.ai[1] = npc.ai[0]; + start = false; + } + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= 9f; + npc.rotation = direction.ToRotation(); + timer++; + if (timer > 180) + { + if (Main.netMode != 1) + { + int damage = expertMode ? 150 : 200; //600 500 + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, mod.ProjectileType("BrimstoneBarrage"), damage, 1f, npc.target); + } + timer = 0; + } + if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + Player player = Main.player[npc.target]; + NPC parent = Main.npc[NPC.FindFirstNPC(mod.NPCType("SupremeCalamitas"))]; + double deg = (double)npc.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 300; + npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.ai[1] += 0.5f; //2 + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 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); + 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.velocity != Vector2.Zero) + { + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + for (int i = 1; i < npc.oldPos.Length; ++i) + { + Vector2 vector2_2 = npc.oldPos[i]; + Microsoft.Xna.Framework.Color color2 = Color.White * npc.Opacity; + color2.R = (byte)(0.5 * (double)color2.R * (double)(10 - i) / 20.0); + color2.G = (byte)(0.5 * (double)color2.G * (double)(10 - i) / 20.0); + color2.B = (byte)(0.5 * (double)color2.B * (double)(10 - i) / 20.0); + color2.A = (byte)(0.5 * (double)color2.A * (double)(10 - i) / 20.0); + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(npc.oldPos[i].X - Main.screenPosition.X + (npc.width / 2), + npc.oldPos[i].Y - Main.screenPosition.Y + npc.height / 2), new Rectangle?(npc.frame), color2, npc.oldRot[i], origin, npc.scale, SpriteEffects.None, 0.0f); + } + } + return true; + } + } +} diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index fdd899cfa8..1ece7f40ac 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1,2357 +1,2357 @@ -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.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - [AutoloadBossHead] - public class SupremeCalamitas : ModNPC - { - private float bossLife; - private float uDieLul = 1f; - private float passedVar = 0f; - - private bool protectionBoost = false; - private bool canDespawn = false; - private bool despawnProj = false; - private bool startText = false; - private bool startBattle = false; //100% - private bool startSecondAttack = false; //80% - private bool startThirdAttack = false; //60% - private bool halfLife = false; //40% - private bool startFourthAttack = false; //30% - private bool secondStage = false; //20% - private bool startFifthAttack = false; //10% - private bool gettingTired = false; //8% - private bool gettingTired2 = false; //6% - private bool gettingTired3 = false; //4% - private bool gettingTired4 = false; //2% - private bool gettingTired5 = false; //1% - private bool willCharge = false; - private bool canFireSplitingFireball = true; - private bool spawnArena = false; - - private int giveUpCounter = 1200; - private int lootTimer = 0; //900 * 5 = 4500 - private int phaseChange = 0; - private int spawnX = 0; - private int spawnX2 = 0; - private int spawnXReset = 0; - private int spawnXReset2 = 0; - private int spawnXAdd = 200; - private int spawnY = 0; - private int spawnYReset = 0; - private int spawnYAdd = 0; - private int bulletHellCounter = 0; - private int bulletHellCounter2 = 0; - - private Rectangle safeBox = default(Rectangle); - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Supreme Calamitas"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 350; - npc.npcSlots = 50f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 0; - npc.value = Item.buyPrice(10, 0, 0, 0); - npc.lifeMax = CalamityWorld.revenge ? 5500000 : 5000000; - if (CalamityWorld.death) - { - npc.lifeMax = 6250000; - } - if (CalamityWorld.bossRushActive) - { - 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; - 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[BuffID.CursedInferno] = false; - npc.dontTakeDamage = false; - npc.chaseable = true; - npc.boss = true; - npc.canGhostHeal = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCG"); - else - music = MusicID.Boss2; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(protectionBoost); - writer.Write(canDespawn); - writer.Write(despawnProj); - writer.Write(startText); - writer.Write(startBattle); - writer.Write(startSecondAttack); - writer.Write(startThirdAttack); - writer.Write(startFourthAttack); - writer.Write(startFifthAttack); - writer.Write(halfLife); - writer.Write(secondStage); - writer.Write(gettingTired); - writer.Write(gettingTired2); - writer.Write(gettingTired3); - writer.Write(gettingTired4); - writer.Write(gettingTired5); - writer.Write(willCharge); - writer.Write(canFireSplitingFireball); - writer.Write(spawnArena); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - - writer.Write(giveUpCounter); - writer.Write(lootTimer); - writer.Write(phaseChange); - writer.Write(spawnX); - writer.Write(spawnX2); - writer.Write(spawnXReset); - writer.Write(spawnXReset2); - writer.Write(spawnXAdd); - writer.Write(spawnY); - writer.Write(spawnYReset); - writer.Write(spawnYAdd); - writer.Write(bulletHellCounter); - writer.Write(bulletHellCounter2); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - protectionBoost = reader.ReadBoolean(); - canDespawn = reader.ReadBoolean(); - despawnProj = reader.ReadBoolean(); - startText = reader.ReadBoolean(); - startBattle = reader.ReadBoolean(); - startSecondAttack = reader.ReadBoolean(); - startThirdAttack = reader.ReadBoolean(); - startFourthAttack = reader.ReadBoolean(); - startFifthAttack = reader.ReadBoolean(); - halfLife = reader.ReadBoolean(); - secondStage = reader.ReadBoolean(); - gettingTired = reader.ReadBoolean(); - gettingTired2 = reader.ReadBoolean(); - gettingTired3 = reader.ReadBoolean(); - gettingTired4 = reader.ReadBoolean(); - gettingTired5 = reader.ReadBoolean(); - willCharge = reader.ReadBoolean(); - canFireSplitingFireball = reader.ReadBoolean(); - spawnArena = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - - giveUpCounter = reader.ReadInt32(); - lootTimer = reader.ReadInt32(); - phaseChange = reader.ReadInt32(); - spawnX = reader.ReadInt32(); - spawnX2 = reader.ReadInt32(); - spawnXReset = reader.ReadInt32(); - spawnXReset2 = reader.ReadInt32(); - spawnXAdd = reader.ReadInt32(); - spawnY = reader.ReadInt32(); - spawnYReset = reader.ReadInt32(); - spawnYAdd = reader.ReadInt32(); - bulletHellCounter = reader.ReadInt32(); - bulletHellCounter2 = reader.ReadInt32(); - } - - public override void AI() - { - #region StartUp - CalamityGlobalNPC.SCal = npc.whoAmI; - lootTimer++; - - bool wormAlive = false; - if (CalamityGlobalNPC.SCalWorm != -1) - { - wormAlive = Main.npc[CalamityGlobalNPC.SCalWorm].active; - } - bool cataclysmAlive = false; - if (CalamityGlobalNPC.SCalCataclysm != -1) - { - cataclysmAlive = Main.npc[CalamityGlobalNPC.SCalCataclysm].active; - } - bool catastropheAlive = false; - if (CalamityGlobalNPC.SCalCatastrophe != -1) - { - catastropheAlive = Main.npc[CalamityGlobalNPC.SCalCatastrophe].active; - } - - if (Main.slimeRain) - { - Main.StopSlimeRain(true); - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (Main.raining) - CalamityGlobalNPC.StopRain(); - - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - if (!startText) - { - if (Main.LocalPlayer.GetModPlayer(mod).sCalKillCount == 4) - { - string key = "Mods.CalamityMod.SupremeBossText12"; //kill SCal 4 times - 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); - } - } - else if (Main.LocalPlayer.GetModPlayer(mod).sCalKillCount == 1) - { - string key = "Mods.CalamityMod.SupremeBossText11"; //kill SCal once - 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); - } - } - if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount < 51) - { - if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount == 50) - { - string key = "Mods.CalamityMod.SupremeBossText15"; //die 50 or more times - 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); - } - } - else if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount > 19) - { - string key = "Mods.CalamityMod.SupremeBossText14"; //die 20 or more times - 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); - } - } - else if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount > 4) - { - string key = "Mods.CalamityMod.SupremeBossText13"; //die 5 or more times - 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); - } - } - } - startText = true; - } - #endregion - #region ArenaCreation - if (!spawnArena) - { - spawnArena = true; - Vector2 vectorPlayer = new Vector2(player.position.X, player.position.Y); - if (CalamityWorld.bossRushActive) - { - safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1250f); - spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1250f); - safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1250f); - safeBox.Width = 2500; - safeBox.Height = 2500; - spawnYAdd = 125; - } - else if (CalamityWorld.death) - { - safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1000f); - spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1000f); - safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1000f); - safeBox.Width = 2000; - safeBox.Height = 2000; - spawnYAdd = 100; - } - else - { - safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1500f); - spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1500f); - safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1500f); - safeBox.Width = 3000; - safeBox.Height = 3000; - spawnYAdd = 150; - } - if (Main.netMode != 1) - { - int num52 = (int)(safeBox.X + (float)(safeBox.Width / 2)) / 16; - int num53 = (int)(safeBox.Y + (float)(safeBox.Height / 2)) / 16; - int num54 = safeBox.Width / 2 / 16 + 1; - for (int num55 = num52 - num54; num55 <= num52 + num54; num55++) - { - for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) - { - if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55, num56].active()) - { - Main.tile[num55, num56].type = (ushort)mod.TileType("ArenaTile"); - Main.tile[num55, num56].active(true); - } - Main.tile[num55, num56].lava(false); - Main.tile[num55, num56].liquid = 0; - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num55, num56, 1, TileChangeType.None); - } - else - { - WorldGen.SquareTileFrame(num55, num56, true); - } - } - } - } - } - if (!player.Hitbox.Intersects(safeBox)) - { - if (uDieLul < 3f) - { - uDieLul *= 1.01f; - } - else if (uDieLul > 3f) - { - uDieLul = 3f; - } - protectionBoost = true; - } - else - { - if (uDieLul > 1f) - { - uDieLul *= 0.99f; - } - else if (uDieLul < 1f) - { - uDieLul = 1f; - } - protectionBoost = false; - } - #endregion - #region Despawn - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -50f); - canDespawn = true; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else - { - canDespawn = false; - } - #endregion - #region FirstAttack - if (bulletHellCounter2 < 900) - { - despawnProj = true; - bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - 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; - if (Main.netMode != 1) - { - bulletHellCounter += 1; - if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 4 : 6)) - { - bulletHellCounter = 0; - int damage = expertMode ? 200 : 250; //800 500 - if (bulletHellCounter2 < 300) //blasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (bulletHellCounter2 < 600) //blasts from left and right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else //blasts from above, left, and right - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - return; - } - else if (!startBattle) - { - string key = "Mods.CalamityMod.SupremeBossText3"; - 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); - } - if (Main.netMode != 1) - { - spawnY += 300; - if (CalamityWorld.bossRushActive) - { - spawnY -= 50; - } - else if (CalamityWorld.death) - { - spawnY -= 100; - } - for (int x = 0; x < 5; x++) - { - NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX += spawnXAdd; - NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX2 -= spawnXAdd; - spawnY += spawnYAdd; - } - spawnX = spawnXReset; - spawnX2 = spawnXReset2; - spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); - } - startBattle = true; - } - #endregion - #region SecondAttack - if (bulletHellCounter2 < 1800 && startSecondAttack) - { - despawnProj = true; - bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - 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; - if (Main.netMode != 1) - { - int damage = expertMode ? 150 : 200; //600 400 - if (bulletHellCounter2 < 1200) - { - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (bulletHellCounter2 < 1500 && bulletHellCounter2 > 1200) - { - if (bulletHellCounter2 % 180 == 0) //blasts from right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -5f * uDieLul, 0f, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (bulletHellCounter2 > 1500) - { - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - bulletHellCounter += 1; - if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 6 : 9)) - { - bulletHellCounter = 0; - if (bulletHellCounter2 < 1200) //blasts from below - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (bulletHellCounter2 < 1500) //blasts from left - { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else //blasts from left and right - { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - return; - } - if (!startSecondAttack && ((double)npc.life <= (double)npc.lifeMax * 0.75)) - { - string key = "Mods.CalamityMod.SupremeBossText4"; - 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); - } - startSecondAttack = true; - return; - } - #endregion - #region ThirdAttack - if (bulletHellCounter2 < 2700 && startThirdAttack) - { - despawnProj = true; - bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - 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; - if (Main.netMode != 1) - { - int damage = expertMode ? 150 : 200; - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (bulletHellCounter2 % 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, 1f, 0f); - } - bulletHellCounter += 1; - if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 9 : 11)) - { - bulletHellCounter = 0; - if (bulletHellCounter2 < 2100) //blasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (bulletHellCounter2 < 2400) //blasts from right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else //blasts from left and right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - return; - } - if (!startThirdAttack && ((double)npc.life <= (double)npc.lifeMax * 0.5)) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCL"); - else - music = MusicID.Boss3; - string key = "Mods.CalamityMod.SupremeBossText5"; - 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); - } - startThirdAttack = true; - return; - } - #endregion - #region FourthAttack - if (bulletHellCounter2 < 3600 && startFourthAttack) - { - despawnProj = true; - bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - 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; - if (Main.netMode != 1) //more clustered attack - { - int damage = expertMode ? 150 : 200; - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (bulletHellCounter2 % 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, 1f, 0f); - } - if (bulletHellCounter2 % 450 == 0) //giant homing fireballs - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, mod.ProjectileType("BrimstoneMonster"), damage, 0f, Main.myPlayer, 0f, passedVar); - passedVar += 1f; - } - bulletHellCounter += 1; - if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 12 : 15)) - { - bulletHellCounter = 0; - if (bulletHellCounter2 < 3000) //blasts from below - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (bulletHellCounter2 < 3300) //blasts from left - { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else //blasts from left and right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - return; - } - if (!startFourthAttack && ((double)npc.life <= (double)npc.lifeMax * 0.3)) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCE"); - else - music = MusicID.LunarBoss; - string key = "Mods.CalamityMod.SupremeBossText7"; - 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); - } - startFourthAttack = true; - return; - } - #endregion - #region FifthAttack - if (bulletHellCounter2 < 4500 && startFifthAttack) - { - despawnProj = true; - bulletHellCounter2 += 1; - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - 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; - if (Main.netMode != 1) - { - int damage = expertMode ? 150 : 200; - if (bulletHellCounter2 % 240 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (bulletHellCounter2 % 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, 1f, 0f); - } - if (bulletHellCounter2 % 450 == 0) //giant homing fireballs - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, mod.ProjectileType("BrimstoneMonster"), damage, 0f, Main.myPlayer, 0f, passedVar); - passedVar += 1f; - } - if (bulletHellCounter2 % 30 == 0) //projectiles that move in wave pattern - { - 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); - } - bulletHellCounter += 1; - if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 15 : 18)) - { - bulletHellCounter = 0; - if (bulletHellCounter2 < 3900) //blasts from above - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (bulletHellCounter2 < 4200) //blasts from left and right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - else //blasts from above, left, and right - { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - return; - } - } - return; - } - if (!startFifthAttack && ((double)npc.life <= (double)npc.lifeMax * 0.1)) - { - string key = "Mods.CalamityMod.SupremeBossText9"; - 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); - } - startFifthAttack = true; - return; - } - #endregion - #region EndSections - if (startFifthAttack) - { - if (gettingTired5) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCA"); - else - music = MusicID.Eerie; - npc.noGravity = false; - npc.noTileCollide = false; - npc.damage = 0; - npc.velocity.X *= 0.98f; - Vector2 vector2 = new Vector2(npc.Center.X, npc.Center.Y); - float num = player.Center.X - vector2.X; - float num1 = player.Center.Y - vector2.Y; - npc.rotation = (float)Math.Atan2((double)num1, (double)num) - 1.57f; - if (CalamityWorld.downedSCal) //after first time you kill her - { - if (giveUpCounter == 900) - { - string key = "Mods.CalamityMod.SupremeBossText27"; - 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); - } - } - giveUpCounter--; - npc.chaseable = (giveUpCounter < 900) ? true : false; - npc.dontTakeDamage = (giveUpCounter < 900) ? false : true; - return; - } - if (giveUpCounter == 600) - { - string key = "Mods.CalamityMod.SupremeBossText25"; - 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); - } - } - if (giveUpCounter == 300) - { - string key = "Mods.CalamityMod.SupremeBossText26"; - 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); - } - } - if (giveUpCounter <= 0) - { - npc.chaseable = true; - npc.dontTakeDamage = false; - return; - } - giveUpCounter--; - npc.chaseable = false; - npc.dontTakeDamage = true; - return; - } - if (!gettingTired5 && ((double)npc.life <= (double)npc.lifeMax * 0.01)) - { - string key = "Mods.CalamityMod.SupremeBossText24"; - 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); - } - gettingTired5 = true; - return; - } - else if (!gettingTired4 && ((double)npc.life <= (double)npc.lifeMax * 0.02)) - { - string key = "Mods.CalamityMod.SupremeBossText23"; - 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); - } - gettingTired4 = true; - return; - } - else if (!gettingTired3 && ((double)npc.life <= (double)npc.lifeMax * 0.04)) - { - string key = "Mods.CalamityMod.SupremeBossText22"; - 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); - } - gettingTired3 = true; - return; - } - else if (!gettingTired2 && ((double)npc.life <= (double)npc.lifeMax * 0.06)) - { - string key = "Mods.CalamityMod.SupremeBossText21"; - 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); - } - gettingTired2 = true; - return; - } - else if (!gettingTired && ((double)npc.life <= (double)npc.lifeMax * 0.08)) - { - string key = "Mods.CalamityMod.SupremeBossText20"; - 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); - } - if (Main.netMode != 1) - { - spawnY += 300; - if (CalamityWorld.bossRushActive) - { - spawnY -= 50; - } - else if (CalamityWorld.death) - { - spawnY -= 100; - } - for (int x = 0; x < 5; x++) - { - NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX += spawnXAdd; - NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); - spawnX2 -= spawnXAdd; - spawnY += spawnYAdd; - } - spawnX = spawnXReset; - spawnX2 = spawnXReset2; - spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); - } - gettingTired = true; - return; - } - } - #endregion - #region DespawnProjectiles - if (bulletHellCounter2 % 900 == 0 && despawnProj) - { - int proj; - for (int x = 0; x < 1000; x = proj + 1) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == mod.ProjectileType("BrimstoneHellblast2") || - projectile.type == mod.ProjectileType("BrimstoneBarrage") || - projectile.type == mod.ProjectileType("BrimstoneWave")) - { - projectile.Kill(); - } - else if (projectile.type == mod.ProjectileType("BrimstoneGigaBlast") || - projectile.type == mod.ProjectileType("BrimstoneFireblast")) - { - projectile.active = false; - } - } - proj = x; - } - despawnProj = false; - } - #endregion - #region TransformSeekerandBrotherTriggers - if (!halfLife && ((double)npc.life <= (double)npc.lifeMax * 0.4)) - { - string key = "Mods.CalamityMod.SupremeBossText"; - 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); - } - halfLife = true; - } - if ((double)npc.life <= (double)npc.lifeMax * 0.2) - { - if (secondStage == false) - { - string key = "Mods.CalamityMod.SupremeBossText8"; - 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); - } - if (Main.netMode != 1) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 20; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 18) * 300)), (int)(npc.Center.Y + (Math.Cos(I * 18) * 300)), mod.NPCType("SoulSeekerSupreme"), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 18; - Eye.ai[3] = I * 18; - } - } - secondStage = true; - } - } - if (bossLife == 0f && npc.life > 0) - { - bossLife = (float)npc.lifeMax; - } - if (npc.life > 0) - { - if (Main.netMode != 1) - { - int num660 = (int)((double)npc.lifeMax * 0.55); - if ((float)(npc.life + num660) < bossLife) - { - bossLife = (float)npc.life; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SupremeCataclysm")); - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SupremeCatastrophe")); - string key = "Mods.CalamityMod.SupremeBossText6"; - 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; - } - } - } - #endregion - #region TargetandRotation - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - } - float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); - float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); - float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; - if (num803 < 0f) - { - num803 += 6.283f; - } - else if ((double)num803 > 6.283) - { - num803 -= 6.283f; - } - float num804 = 0.1f; - if (npc.rotation < num803) - { - if ((double)(num803 - npc.rotation) > 3.1415) - { - npc.rotation -= num804; - } - else - { - npc.rotation += num804; - } - } - else if (npc.rotation > num803) - { - if ((double)(npc.rotation - num803) > 3.1415) - { - npc.rotation += num804; - } - else - { - npc.rotation -= num804; - } - } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - { - npc.rotation = num803; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.283f; - } - else if ((double)npc.rotation > 6.283) - { - npc.rotation -= 6.283f; - } - if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) - { - npc.rotation = num803; - } - #endregion - #region FirstStage - if (npc.ai[0] == 0f) - { - npc.damage = expertMode ? 720 : 450; - if (wormAlive) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - } - else - { - if (cataclysmAlive || catastropheAlive) - { - 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 - { - npc.dontTakeDamage = false; - npc.chaseable = true; - } - } - if (npc.ai[1] == 0f) - { - float num823 = 12f; - float num824 = 0.12f; - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - 550f - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; - if (npc.velocity.X < num825) - { - npc.velocity.X = npc.velocity.X + num824; - if (npc.velocity.X < 0f && num825 > 0f) - { - npc.velocity.X = npc.velocity.X + num824; - } - } - else if (npc.velocity.X > num825) - { - npc.velocity.X = npc.velocity.X - num824; - if (npc.velocity.X > 0f && num825 < 0f) - { - npc.velocity.X = npc.velocity.X - num824; - } - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y = npc.velocity.Y + num824; - if (npc.velocity.Y < 0f && num826 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num824; - } - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y = npc.velocity.Y - num824; - if (npc.velocity.Y > 0f && num826 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num824; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[1] = -1f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; - if (Main.netMode != 1) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 90f) - { - npc.localAI[1] = 0f; - float num828 = 10f * uDieLul; - int num829 = expertMode ? 150 : 200; //600 400 - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num828 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; - int randomShot = Main.rand.Next(6); //0 to 5 - if (randomShot == 0 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = mod.ProjectileType("BrimstoneFireblast"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else if (randomShot == 1 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = mod.ProjectileType("BrimstoneGigaBlast"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else - { - canFireSplitingFireball = true; - randomShot = mod.ProjectileType("BrimstoneBarrage"); - for (int num186 = 1; num186 <= 8; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - float speedBoost = (float)(num186 > 4 ? -(num186 - 4) : num186); - num183 = (8f + speedBoost) / num183; - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - } - return; - } - } - } - else if (npc.ai[1] == 1f) - { - npc.rotation = num803; //change - float num383 = wormAlive ? 26f : 30f; - if ((double)npc.life < (double)npc.lifeMax * 0.95) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.85) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.7) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.6) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num383 += 1f; - } - Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num384 = player.position.X + (float)(player.width / 2) - vector37.X; - float num385 = player.position.Y + (float)(player.height / 2) - vector37.Y; - float num386 = (float)Math.Sqrt((double)(num384 * num384 + num385 * num385)); - num386 = num383 / num386; - npc.velocity.X = num384 * num386; - npc.velocity.Y = num385 * num386; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 25f) - { - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.Y = npc.velocity.Y * 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - if (npc.ai[2] >= 70f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num803; - if (npc.ai[3] >= 2f) - { - npc.ai[1] = -1f; - } - else - { - npc.ai[1] = 1f; - } - } - } - else if (npc.ai[1] == 3f) - { - npc.TargetClosest(true); - float num412 = 32f; - float num413 = 1.2f; - int num414 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num414 = -1; - } - Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 600) - vector40.X; - float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num412 / num417; - num415 *= num417; - num416 *= num417; - if (npc.velocity.X < num415) - { - npc.velocity.X = npc.velocity.X + num413; - if (npc.velocity.X < 0f && num415 > 0f) - { - npc.velocity.X = npc.velocity.X + num413; - } - } - else if (npc.velocity.X > num415) - { - npc.velocity.X = npc.velocity.X - num413; - if (npc.velocity.X > 0f && num415 < 0f) - { - npc.velocity.X = npc.velocity.X - num413; - } - } - if (npc.velocity.Y < num416) - { - npc.velocity.Y = npc.velocity.Y + num413; - if (npc.velocity.Y < 0f && num416 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num413; - } - } - else if (npc.velocity.Y > num416) - { - npc.velocity.Y = npc.velocity.Y - num413; - if (npc.velocity.Y > 0f && num416 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num413; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 480f) - { - npc.ai[1] = -1f; - npc.target = 255; - npc.netUpdate = true; - } - else - { - if (!player.dead) - { - npc.ai[3] += wormAlive ? 0.5f : 1f; - } - if (npc.ai[3] >= 20f) - { - npc.ai[3] = 0f; - vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num415 = player.position.X + (float)(player.width / 2) - vector40.X; - num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - if (Main.netMode != 1) - { - float num418 = 10f * uDieLul; - int num419 = expertMode ? 150 : 200; //600 500 - int num420 = mod.ProjectileType("BrimstoneHellblast"); - num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num418 / num417; - num415 *= num417; - num416 *= num417; - vector40.X += num415 * 4f; - vector40.Y += num416 * 4f; - Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else if (npc.ai[1] == 4f) - { - int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num831 = -1; - } - float num832 = 32f; - float num833 = 1.2f; - Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 750) - vector83.X; //600 - float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num832 / num836; - num834 *= num836; - num835 *= num836; - if (npc.velocity.X < num834) - { - npc.velocity.X = npc.velocity.X + num833; - if (npc.velocity.X < 0f && num834 > 0f) - { - npc.velocity.X = npc.velocity.X + num833; - } - } - else if (npc.velocity.X > num834) - { - npc.velocity.X = npc.velocity.X - num833; - if (npc.velocity.X > 0f && num834 < 0f) - { - npc.velocity.X = npc.velocity.X - num833; - } - } - if (npc.velocity.Y < num835) - { - npc.velocity.Y = npc.velocity.Y + num833; - if (npc.velocity.Y < 0f && num835 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num833; - } - } - else if (npc.velocity.Y > num835) - { - npc.velocity.Y = npc.velocity.Y - num833; - if (npc.velocity.Y > 0f && num835 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num833; - } - } - vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; - if (Main.netMode != 1) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 140f) - { - npc.localAI[1] = 0f; - float num837 = 5f * uDieLul; - int num838 = expertMode ? 150 : 200; //600 500 - int num839 = mod.ProjectileType("BrimstoneFireblast"); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 15f; - vector83.Y += num835 * 15f; - Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[1] = -1f; - npc.TargetClosest(true); - npc.netUpdate = true; - return; - } - } - if (npc.ai[1] == -1f) - { - phaseChange++; - if (phaseChange > 23) - { - phaseChange = 0; - } - int phase = 0; //0 = shots above 1 = charge 2 = nothing 3 = hellblasts 4 = fireblasts - switch (phaseChange) - { - case 0: phase = 0; willCharge = false; break; //0341 - case 1: phase = 3; break; - case 2: phase = 4; willCharge = true; break; - case 3: phase = 1; break; - case 4: phase = 1; break; //1430 - case 5: phase = 4; willCharge = false; break; - case 6: phase = 3; break; - case 7: phase = 0; willCharge = true; break; - case 8: phase = 1; break; //1034 - case 9: phase = 0; willCharge = false; break; - case 10: phase = 3; break; - case 11: phase = 4; break; - case 12: phase = 4; break; //4310 - case 13: phase = 3; willCharge = true; break; - case 14: phase = 1; break; - case 15: phase = 0; willCharge = false; break; - case 16: phase = 4; break; //4411 - case 17: phase = 4; willCharge = true; break; - case 18: phase = 1; break; - case 19: phase = 1; break; - case 20: phase = 0; break; //0101 - case 21: phase = 1; break; - case 22: phase = 0; break; - case 23: phase = 1; break; - } - npc.ai[1] = (float)phase; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } - if ((double)npc.life < (double)npc.lifeMax * 0.4) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - #endregion - #region Transition - else if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - { - npc.ai[2] = 0.5f; - } - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - { - npc.ai[2] = 0f; - } - } - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (npc.ai[1] == 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - { - npc.ai[2] = 0f; - } - else - { - for (int num388 = 0; num388 < 50; num388++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f); - } - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - } - } - Dust.NewDust(npc.position, npc.width, npc.height, 235, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f); - npc.velocity.X = npc.velocity.X * 0.98f; - npc.velocity.Y = npc.velocity.Y * 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - return; - } - } - #endregion - #region LastStage - else - { - npc.damage = expertMode ? 720 : 450; - if (wormAlive) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - } - else - { - if (NPC.AnyNPCs(mod.NPCType("SoulSeekerSupreme"))) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - } - else - { - npc.dontTakeDamage = false; - npc.chaseable = true; - } - } - if (npc.ai[1] == 0f) - { - float num823 = 12f; - float num824 = 0.12f; - Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num825 = player.position.X + (float)(player.width / 2) - vector82.X; - float num826 = player.position.Y + (float)(player.height / 2) - 550f - vector82.Y; - float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; - if (npc.velocity.X < num825) - { - npc.velocity.X = npc.velocity.X + num824; - if (npc.velocity.X < 0f && num825 > 0f) - { - npc.velocity.X = npc.velocity.X + num824; - } - } - else if (npc.velocity.X > num825) - { - npc.velocity.X = npc.velocity.X - num824; - if (npc.velocity.X > 0f && num825 < 0f) - { - npc.velocity.X = npc.velocity.X - num824; - } - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y = npc.velocity.Y + num824; - if (npc.velocity.Y < 0f && num826 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num824; - } - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y = npc.velocity.Y - num824; - if (npc.velocity.Y > 0f && num826 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num824; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 240f) - { - npc.ai[1] = -1f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num825 = player.position.X + (float)(player.width / 2) - vector82.X; - num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; - npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; - if (Main.netMode != 1) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 60f) - { - npc.localAI[1] = 0f; - float num828 = 10f * uDieLul; - int num829 = expertMode ? 150 : 200; //600 500 - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = player.position.X + (float)player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num828 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; - int randomShot = Main.rand.Next(6); - if (randomShot == 0 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = mod.ProjectileType("BrimstoneFireblast"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else if (randomShot == 1 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = mod.ProjectileType("BrimstoneGigaBlast"); - num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else - { - canFireSplitingFireball = true; - randomShot = mod.ProjectileType("BrimstoneBarrage"); - for (int num186 = 1; num186 <= 8; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - float speedBoost = (float)(num186 > 4 ? -(num186 - 4) : num186); - num183 = (8f + speedBoost) / num183; - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - } - return; - } - } - } - else if (npc.ai[1] == 1f) - { - npc.rotation = num803; //change - float num383 = wormAlive ? 31f : 35f; - if ((double)npc.life < (double)npc.lifeMax * 0.3) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.2) - { - num383 += 1f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num383 += 1f; - } - Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num384 = player.position.X + (float)(player.width / 2) - vector37.X; - float num385 = player.position.Y + (float)(player.height / 2) - vector37.Y; - float num386 = (float)Math.Sqrt((double)(num384 * num384 + num385 * num385)); - num386 = num383 / num386; - npc.velocity.X = num384 * num386; - npc.velocity.Y = num385 * num386; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 25f) - { - npc.velocity.X = npc.velocity.X * 0.96f; - npc.velocity.Y = npc.velocity.Y * 0.96f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = 0f; - } - } - else - { - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - } - if (npc.ai[2] >= 70f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num803; //change - if (npc.ai[3] >= 1f) - { - npc.ai[1] = -1f; - } - else - { - npc.ai[1] = 1f; - } - } - } - else if (npc.ai[1] == 3f) - { - npc.TargetClosest(true); - float num412 = 32f; - float num413 = 1.2f; - int num414 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num414 = -1; - } - Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 600) - vector40.X; - float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num412 / num417; - num415 *= num417; - num416 *= num417; - if (npc.velocity.X < num415) - { - npc.velocity.X = npc.velocity.X + num413; - if (npc.velocity.X < 0f && num415 > 0f) - { - npc.velocity.X = npc.velocity.X + num413; - } - } - else if (npc.velocity.X > num415) - { - npc.velocity.X = npc.velocity.X - num413; - if (npc.velocity.X > 0f && num415 < 0f) - { - npc.velocity.X = npc.velocity.X - num413; - } - } - if (npc.velocity.Y < num416) - { - npc.velocity.Y = npc.velocity.Y + num413; - if (npc.velocity.Y < 0f && num416 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num413; - } - } - else if (npc.velocity.Y > num416) - { - npc.velocity.Y = npc.velocity.Y - num413; - if (npc.velocity.Y > 0f && num416 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num413; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[1] = -1f; - npc.target = 255; - npc.netUpdate = true; - } - else - { - if (!player.dead) - { - npc.ai[3] += wormAlive ? 0.5f : 1f; - } - if (npc.ai[3] >= 24f) - { - npc.ai[3] = 0f; - vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num415 = player.position.X + (float)(player.width / 2) - vector40.X; - num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - if (Main.netMode != 1) - { - float num418 = 10f * uDieLul; - int num419 = expertMode ? 150 : 200; //600 500 - int num420 = mod.ProjectileType("BrimstoneHellblast"); - num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); - num417 = num418 / num417; - num415 *= num417; - num416 *= num417; - vector40.X += num415 * 4f; - vector40.Y += num416 * 4f; - Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else if (npc.ai[1] == 4f) - { - int num831 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) - { - num831 = -1; - } - float num832 = 32f; - float num833 = 1.2f; - Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 750) - vector83.X; //600 - float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num832 / num836; - num834 *= num836; - num835 *= num836; - if (npc.velocity.X < num834) - { - npc.velocity.X = npc.velocity.X + num833; - if (npc.velocity.X < 0f && num834 > 0f) - { - npc.velocity.X = npc.velocity.X + num833; - } - } - else if (npc.velocity.X > num834) - { - npc.velocity.X = npc.velocity.X - num833; - if (npc.velocity.X > 0f && num834 < 0f) - { - npc.velocity.X = npc.velocity.X - num833; - } - } - if (npc.velocity.Y < num835) - { - npc.velocity.Y = npc.velocity.Y + num833; - if (npc.velocity.Y < 0f && num835 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num833; - } - } - else if (npc.velocity.Y > num835) - { - npc.velocity.Y = npc.velocity.Y - num833; - if (npc.velocity.Y > 0f && num835 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num833; - } - } - vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num834 = player.position.X + (float)(player.width / 2) - vector83.X; - num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; - if (Main.netMode != 1) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 100f) - { - npc.localAI[1] = 0f; - float num837 = 5f * uDieLul; - int num838 = expertMode ? 150 : 200; //600 500 - int num839 = mod.ProjectileType("BrimstoneFireblast"); - num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 15f; - vector83.Y += num835 * 15f; - int shot = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= 240f) - { - npc.ai[1] = -1f; - npc.TargetClosest(true); - npc.netUpdate = true; - return; - } - } - if (npc.ai[1] == -1f) - { - phaseChange++; - if (phaseChange > 23) - { - phaseChange = 0; - } - int phase = 0; //0 = shots above 1 = charge 2 = nothing 3 = hellblasts 4 = fireblasts - switch (phaseChange) - { - case 0: phase = 0; willCharge = false; break; //0341 - case 1: phase = 3; break; - case 2: phase = 4; willCharge = true; break; - case 3: phase = 1; break; - case 4: phase = 1; break; //1430 - case 5: phase = 4; willCharge = false; break; - case 6: phase = 3; break; - case 7: phase = 0; willCharge = true; break; - case 8: phase = 1; break; //1034 - case 9: phase = 0; willCharge = false; break; - case 10: phase = 3; break; - case 11: phase = 4; break; - case 12: phase = 4; break; //4310 - case 13: phase = 3; willCharge = true; break; - case 14: phase = 1; break; - case 15: phase = 0; willCharge = false; break; - case 16: phase = 4; break; //4411 - case 17: phase = 4; willCharge = true; break; - case 18: phase = 1; break; - case 19: phase = 1; break; - case 20: phase = 0; break; //0101 - case 21: phase = 1; break; - case 22: phase = 0; break; - case 23: phase = 1; break; - } - npc.ai[1] = (float)phase; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } - } - #endregion - } - - #region Loot - public override void NPCLoot() - { - if (lootTimer < 6000) //75 seconds for bullet hells + 25 seconds for normal phases - { - 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); - } - return; - } - if (Main.player[npc.target].GetModPlayer(mod).sCalKillCount == 0) //first time you kill her - { - if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount == 0) - { - string key = "Mods.CalamityMod.SupremeBossText16"; //die no times - 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); - } - } - else if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount == 1) - { - string key = "Mods.CalamityMod.SupremeBossText17"; //die one time - 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); - } - } - else if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount == 2) - { - string key = "Mods.CalamityMod.SupremeBossText18"; //die two times - 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); - } - } - else if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount == 3) - { - string key = "Mods.CalamityMod.SupremeBossText19"; //die three times - 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); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CheatTestThing")); - } - else //die however many times - { - string key = "Mods.CalamityMod.SupremeBossText10"; - 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); - } - } - } - else //all times after first kill - { - string key = "Mods.CalamityMod.SupremeBossText10"; - 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); - } - } - if (Main.player[npc.target].GetModPlayer(mod).sCalKillCount < 5) - { - Main.player[npc.target].GetModPlayer(mod).sCalKillCount++; - } - if (Main.expertMode) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("CalamitousEssence"), Main.rand.Next(30, 41), true); - if (CalamityWorld.revenge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Vehemenc")); - } - int itemChoice = Main.rand.Next(14); - if (itemChoice == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Animus")); //done - } - else if (itemChoice == 1) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Azathoth")); //done - } - else if (itemChoice == 2) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Contagion")); //done - } - else if (itemChoice == 3) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraconicDestruction")); //done - } - else if (itemChoice == 4) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Earth")); //done - } - else if (itemChoice == 5) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Megafleet")); //done - } - else if (itemChoice == 6) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RedSun")); //done - } - else if (itemChoice == 7) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RoyalKnives")); //done - } - else if (itemChoice == 8) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RoyalKnivesMelee")); //done - } - else if (itemChoice == 9) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Svantechnical")); //done - } - else if (itemChoice == 10) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TriactisTruePaladinianMageHammerofMight")); //done - } - else if (itemChoice == 11) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TriactisTruePaladinianMageHammerofMightMelee")); //done - } - else if (itemChoice == 12) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Svantechnical")); //done - } - else if (itemChoice == 13) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrystylCrusher")); //done - } - } - else - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("CalamitousEssence"), Main.rand.Next(20, 31), true); - } - } - #endregion - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = mod.ItemType("OmegaHealingPotion"); - } - - 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 / 10) - { - 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 (startFifthAttack) - { - protection *= 1.2f; //90% or 84% - } - if (protectionBoost) - { - protection = 0.99f; //99% - } - 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 CheckActive() - { - return canDespawn; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - scale = 1.5f; - return null; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - 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 PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D texture = Main.npcTexture[npc.type]; - if (npc.ai[0] > 1f) - { - texture = mod.GetTexture("NPCs/SupremeCalamitas/SupremeCalamitas2"); - } - else - { - texture = Main.npcTexture[npc.type]; - } - Color newColor = (willCharge ? new Color(100, 0, 0, 0) : drawColor); - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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("VulnerabilityHex"), 600, true); - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("Horror"), 600, true); - } - } - } -} \ No newline at end of file +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.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + [AutoloadBossHead] + public class SupremeCalamitas : ModNPC + { + private float bossLife; + private float uDieLul = 1f; + private float passedVar = 0f; + + private bool protectionBoost = false; + private bool canDespawn = false; + private bool despawnProj = false; + private bool startText = false; + private bool startBattle = false; //100% + private bool startSecondAttack = false; //80% + private bool startThirdAttack = false; //60% + private bool halfLife = false; //40% + private bool startFourthAttack = false; //30% + private bool secondStage = false; //20% + private bool startFifthAttack = false; //10% + private bool gettingTired = false; //8% + private bool gettingTired2 = false; //6% + private bool gettingTired3 = false; //4% + private bool gettingTired4 = false; //2% + private bool gettingTired5 = false; //1% + private bool willCharge = false; + private bool canFireSplitingFireball = true; + private bool spawnArena = false; + + private int giveUpCounter = 1200; + private int lootTimer = 0; //900 * 5 = 4500 + private int phaseChange = 0; + private int spawnX = 0; + private int spawnX2 = 0; + private int spawnXReset = 0; + private int spawnXReset2 = 0; + private int spawnXAdd = 200; + private int spawnY = 0; + private int spawnYReset = 0; + private int spawnYAdd = 0; + private int bulletHellCounter = 0; + private int bulletHellCounter2 = 0; + + private Rectangle safeBox = default(Rectangle); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Supreme Calamitas"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 350; + npc.npcSlots = 50f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 0; + npc.value = Item.buyPrice(10, 0, 0, 0); + npc.lifeMax = CalamityWorld.revenge ? 5500000 : 5000000; + if (CalamityWorld.death) + { + npc.lifeMax = 6250000; + } + if (CalamityWorld.bossRushActive) + { + 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; + 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[BuffID.CursedInferno] = false; + npc.dontTakeDamage = false; + npc.chaseable = true; + npc.boss = true; + npc.canGhostHeal = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCG"); + else + music = MusicID.Boss2; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(protectionBoost); + writer.Write(canDespawn); + writer.Write(despawnProj); + writer.Write(startText); + writer.Write(startBattle); + writer.Write(startSecondAttack); + writer.Write(startThirdAttack); + writer.Write(startFourthAttack); + writer.Write(startFifthAttack); + writer.Write(halfLife); + writer.Write(secondStage); + writer.Write(gettingTired); + writer.Write(gettingTired2); + writer.Write(gettingTired3); + writer.Write(gettingTired4); + writer.Write(gettingTired5); + writer.Write(willCharge); + writer.Write(canFireSplitingFireball); + writer.Write(spawnArena); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + + writer.Write(giveUpCounter); + writer.Write(lootTimer); + writer.Write(phaseChange); + writer.Write(spawnX); + writer.Write(spawnX2); + writer.Write(spawnXReset); + writer.Write(spawnXReset2); + writer.Write(spawnXAdd); + writer.Write(spawnY); + writer.Write(spawnYReset); + writer.Write(spawnYAdd); + writer.Write(bulletHellCounter); + writer.Write(bulletHellCounter2); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + protectionBoost = reader.ReadBoolean(); + canDespawn = reader.ReadBoolean(); + despawnProj = reader.ReadBoolean(); + startText = reader.ReadBoolean(); + startBattle = reader.ReadBoolean(); + startSecondAttack = reader.ReadBoolean(); + startThirdAttack = reader.ReadBoolean(); + startFourthAttack = reader.ReadBoolean(); + startFifthAttack = reader.ReadBoolean(); + halfLife = reader.ReadBoolean(); + secondStage = reader.ReadBoolean(); + gettingTired = reader.ReadBoolean(); + gettingTired2 = reader.ReadBoolean(); + gettingTired3 = reader.ReadBoolean(); + gettingTired4 = reader.ReadBoolean(); + gettingTired5 = reader.ReadBoolean(); + willCharge = reader.ReadBoolean(); + canFireSplitingFireball = reader.ReadBoolean(); + spawnArena = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + + giveUpCounter = reader.ReadInt32(); + lootTimer = reader.ReadInt32(); + phaseChange = reader.ReadInt32(); + spawnX = reader.ReadInt32(); + spawnX2 = reader.ReadInt32(); + spawnXReset = reader.ReadInt32(); + spawnXReset2 = reader.ReadInt32(); + spawnXAdd = reader.ReadInt32(); + spawnY = reader.ReadInt32(); + spawnYReset = reader.ReadInt32(); + spawnYAdd = reader.ReadInt32(); + bulletHellCounter = reader.ReadInt32(); + bulletHellCounter2 = reader.ReadInt32(); + } + + public override void AI() + { + #region StartUp + CalamityGlobalNPC.SCal = npc.whoAmI; + lootTimer++; + + bool wormAlive = false; + if (CalamityGlobalNPC.SCalWorm != -1) + { + wormAlive = Main.npc[CalamityGlobalNPC.SCalWorm].active; + } + bool cataclysmAlive = false; + if (CalamityGlobalNPC.SCalCataclysm != -1) + { + cataclysmAlive = Main.npc[CalamityGlobalNPC.SCalCataclysm].active; + } + bool catastropheAlive = false; + if (CalamityGlobalNPC.SCalCatastrophe != -1) + { + catastropheAlive = Main.npc[CalamityGlobalNPC.SCalCatastrophe].active; + } + + if (Main.slimeRain) + { + Main.StopSlimeRain(true); + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (Main.raining) + CalamityGlobalNPC.StopRain(); + + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + if (!startText) + { + if (Main.LocalPlayer.GetModPlayer(mod).sCalKillCount == 4) + { + string key = "Mods.CalamityMod.SupremeBossText12"; //kill SCal 4 times + 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); + } + } + else if (Main.LocalPlayer.GetModPlayer(mod).sCalKillCount == 1) + { + string key = "Mods.CalamityMod.SupremeBossText11"; //kill SCal once + 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); + } + } + if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount < 51) + { + if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount == 50) + { + string key = "Mods.CalamityMod.SupremeBossText15"; //die 50 or more times + 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); + } + } + else if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount > 19) + { + string key = "Mods.CalamityMod.SupremeBossText14"; //die 20 or more times + 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); + } + } + else if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount > 4) + { + string key = "Mods.CalamityMod.SupremeBossText13"; //die 5 or more times + 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); + } + } + } + startText = true; + } + #endregion + #region ArenaCreation + if (!spawnArena) + { + spawnArena = true; + Vector2 vectorPlayer = new Vector2(player.position.X, player.position.Y); + if (CalamityWorld.bossRushActive) + { + safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1250f); + spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1250f); + safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1250f); + safeBox.Width = 2500; + safeBox.Height = 2500; + spawnYAdd = 125; + } + else if (CalamityWorld.death) + { + safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1000f); + spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1000f); + safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1000f); + safeBox.Width = 2000; + safeBox.Height = 2000; + spawnYAdd = 100; + } + else + { + safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1500f); + spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1500f); + safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1500f); + safeBox.Width = 3000; + safeBox.Height = 3000; + spawnYAdd = 150; + } + if (Main.netMode != 1) + { + int num52 = (int)(safeBox.X + (float)(safeBox.Width / 2)) / 16; + int num53 = (int)(safeBox.Y + (float)(safeBox.Height / 2)) / 16; + int num54 = safeBox.Width / 2 / 16 + 1; + for (int num55 = num52 - num54; num55 <= num52 + num54; num55++) + { + for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) + { + if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55, num56].active()) + { + Main.tile[num55, num56].type = (ushort)mod.TileType("ArenaTile"); + Main.tile[num55, num56].active(true); + } + Main.tile[num55, num56].lava(false); + Main.tile[num55, num56].liquid = 0; + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, num55, num56, 1, TileChangeType.None); + } + else + { + WorldGen.SquareTileFrame(num55, num56, true); + } + } + } + } + } + if (!player.Hitbox.Intersects(safeBox)) + { + if (uDieLul < 3f) + { + uDieLul *= 1.01f; + } + else if (uDieLul > 3f) + { + uDieLul = 3f; + } + protectionBoost = true; + } + else + { + if (uDieLul > 1f) + { + uDieLul *= 0.99f; + } + else if (uDieLul < 1f) + { + uDieLul = 1f; + } + protectionBoost = false; + } + #endregion + #region Despawn + if (!player.active || player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.velocity = new Vector2(0f, -50f); + canDespawn = true; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else + { + canDespawn = false; + } + #endregion + #region FirstAttack + if (bulletHellCounter2 < 900) + { + despawnProj = true; + bulletHellCounter2 += 1; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + 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; + if (Main.netMode != 1) + { + bulletHellCounter += 1; + if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 4 : 6)) + { + bulletHellCounter = 0; + int damage = expertMode ? 200 : 250; //800 500 + if (bulletHellCounter2 < 300) //blasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (bulletHellCounter2 < 600) //blasts from left and right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else //blasts from above, left, and right + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + return; + } + else if (!startBattle) + { + string key = "Mods.CalamityMod.SupremeBossText3"; + 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); + } + if (Main.netMode != 1) + { + spawnY += 300; + if (CalamityWorld.bossRushActive) + { + spawnY -= 50; + } + else if (CalamityWorld.death) + { + spawnY -= 100; + } + for (int x = 0; x < 5; x++) + { + NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX += spawnXAdd; + NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX2 -= spawnXAdd; + spawnY += spawnYAdd; + } + spawnX = spawnXReset; + spawnX2 = spawnXReset2; + spawnY = spawnYReset; + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); + } + startBattle = true; + } + #endregion + #region SecondAttack + if (bulletHellCounter2 < 1800 && startSecondAttack) + { + despawnProj = true; + bulletHellCounter2 += 1; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + 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; + if (Main.netMode != 1) + { + int damage = expertMode ? 150 : 200; //600 400 + if (bulletHellCounter2 < 1200) + { + if (bulletHellCounter2 % 180 == 0) //blasts from top + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (bulletHellCounter2 < 1500 && bulletHellCounter2 > 1200) + { + if (bulletHellCounter2 % 180 == 0) //blasts from right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -5f * uDieLul, 0f, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (bulletHellCounter2 > 1500) + { + if (bulletHellCounter2 % 180 == 0) //blasts from top + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + bulletHellCounter += 1; + if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 6 : 9)) + { + bulletHellCounter = 0; + if (bulletHellCounter2 < 1200) //blasts from below + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (bulletHellCounter2 < 1500) //blasts from left + { + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else //blasts from left and right + { + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + return; + } + if (!startSecondAttack && ((double)npc.life <= (double)npc.lifeMax * 0.75)) + { + string key = "Mods.CalamityMod.SupremeBossText4"; + 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); + } + startSecondAttack = true; + return; + } + #endregion + #region ThirdAttack + if (bulletHellCounter2 < 2700 && startThirdAttack) + { + despawnProj = true; + bulletHellCounter2 += 1; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + 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; + if (Main.netMode != 1) + { + int damage = expertMode ? 150 : 200; + if (bulletHellCounter2 % 180 == 0) //blasts from top + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + if (bulletHellCounter2 % 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, 1f, 0f); + } + bulletHellCounter += 1; + if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 9 : 11)) + { + bulletHellCounter = 0; + if (bulletHellCounter2 < 2100) //blasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (bulletHellCounter2 < 2400) //blasts from right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else //blasts from left and right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + return; + } + if (!startThirdAttack && ((double)npc.life <= (double)npc.lifeMax * 0.5)) + { + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCL"); + else + music = MusicID.Boss3; + string key = "Mods.CalamityMod.SupremeBossText5"; + 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); + } + startThirdAttack = true; + return; + } + #endregion + #region FourthAttack + if (bulletHellCounter2 < 3600 && startFourthAttack) + { + despawnProj = true; + bulletHellCounter2 += 1; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + 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; + if (Main.netMode != 1) //more clustered attack + { + int damage = expertMode ? 150 : 200; + if (bulletHellCounter2 % 180 == 0) //blasts from top + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + if (bulletHellCounter2 % 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, 1f, 0f); + } + if (bulletHellCounter2 % 450 == 0) //giant homing fireballs + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, mod.ProjectileType("BrimstoneMonster"), damage, 0f, Main.myPlayer, 0f, passedVar); + passedVar += 1f; + } + bulletHellCounter += 1; + if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 12 : 15)) + { + bulletHellCounter = 0; + if (bulletHellCounter2 < 3000) //blasts from below + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (bulletHellCounter2 < 3300) //blasts from left + { + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else //blasts from left and right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + return; + } + if (!startFourthAttack && ((double)npc.life <= (double)npc.lifeMax * 0.3)) + { + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCE"); + else + music = MusicID.LunarBoss; + string key = "Mods.CalamityMod.SupremeBossText7"; + 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); + } + startFourthAttack = true; + return; + } + #endregion + #region FifthAttack + if (bulletHellCounter2 < 4500 && startFifthAttack) + { + despawnProj = true; + bulletHellCounter2 += 1; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + 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; + if (Main.netMode != 1) + { + int damage = expertMode ? 150 : 200; + if (bulletHellCounter2 % 240 == 0) //blasts from top + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, mod.ProjectileType("BrimstoneGigaBlast"), damage, 0f, Main.myPlayer, 0f, 0f); + } + if (bulletHellCounter2 % 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, 1f, 0f); + } + if (bulletHellCounter2 % 450 == 0) //giant homing fireballs + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, mod.ProjectileType("BrimstoneMonster"), damage, 0f, Main.myPlayer, 0f, passedVar); + passedVar += 1f; + } + if (bulletHellCounter2 % 30 == 0) //projectiles that move in wave pattern + { + 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); + } + bulletHellCounter += 1; + if (bulletHellCounter > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 15 : 18)) + { + bulletHellCounter = 0; + if (bulletHellCounter2 < 3900) //blasts from above + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else if (bulletHellCounter2 < 4200) //blasts from left and right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + else //blasts from above, left, and right + { + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, mod.ProjectileType("BrimstoneHellblast2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + return; + } + } + return; + } + if (!startFifthAttack && ((double)npc.life <= (double)npc.lifeMax * 0.1)) + { + string key = "Mods.CalamityMod.SupremeBossText9"; + 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); + } + startFifthAttack = true; + return; + } + #endregion + #region EndSections + if (startFifthAttack) + { + if (gettingTired5) + { + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCA"); + else + music = MusicID.Eerie; + npc.noGravity = false; + npc.noTileCollide = false; + npc.damage = 0; + npc.velocity.X *= 0.98f; + Vector2 vector2 = new Vector2(npc.Center.X, npc.Center.Y); + float num = player.Center.X - vector2.X; + float num1 = player.Center.Y - vector2.Y; + npc.rotation = (float)Math.Atan2((double)num1, (double)num) - 1.57f; + if (CalamityWorld.downedSCal) //after first time you kill her + { + if (giveUpCounter == 900) + { + string key = "Mods.CalamityMod.SupremeBossText27"; + 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); + } + } + giveUpCounter--; + npc.chaseable = (giveUpCounter < 900) ? true : false; + npc.dontTakeDamage = (giveUpCounter < 900) ? false : true; + return; + } + if (giveUpCounter == 600) + { + string key = "Mods.CalamityMod.SupremeBossText25"; + 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); + } + } + if (giveUpCounter == 300) + { + string key = "Mods.CalamityMod.SupremeBossText26"; + 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); + } + } + if (giveUpCounter <= 0) + { + npc.chaseable = true; + npc.dontTakeDamage = false; + return; + } + giveUpCounter--; + npc.chaseable = false; + npc.dontTakeDamage = true; + return; + } + if (!gettingTired5 && ((double)npc.life <= (double)npc.lifeMax * 0.01)) + { + string key = "Mods.CalamityMod.SupremeBossText24"; + 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); + } + gettingTired5 = true; + return; + } + else if (!gettingTired4 && ((double)npc.life <= (double)npc.lifeMax * 0.02)) + { + string key = "Mods.CalamityMod.SupremeBossText23"; + 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); + } + gettingTired4 = true; + return; + } + else if (!gettingTired3 && ((double)npc.life <= (double)npc.lifeMax * 0.04)) + { + string key = "Mods.CalamityMod.SupremeBossText22"; + 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); + } + gettingTired3 = true; + return; + } + else if (!gettingTired2 && ((double)npc.life <= (double)npc.lifeMax * 0.06)) + { + string key = "Mods.CalamityMod.SupremeBossText21"; + 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); + } + gettingTired2 = true; + return; + } + else if (!gettingTired && ((double)npc.life <= (double)npc.lifeMax * 0.08)) + { + string key = "Mods.CalamityMod.SupremeBossText20"; + 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); + } + if (Main.netMode != 1) + { + spawnY += 300; + if (CalamityWorld.bossRushActive) + { + spawnY -= 50; + } + else if (CalamityWorld.death) + { + spawnY -= 100; + } + for (int x = 0; x < 5; x++) + { + NPC.NewNPC(spawnX + 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX += spawnXAdd; + NPC.NewNPC(spawnX2 - 50, spawnY, mod.NPCType("SCalWormHeart"), 0, 0f, 0f, 0f, 0f, 255); + spawnX2 -= spawnXAdd; + spawnY += spawnYAdd; + } + spawnX = spawnXReset; + spawnX2 = spawnXReset2; + spawnY = spawnYReset; + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SCalWormHead")); + } + gettingTired = true; + return; + } + } + #endregion + #region DespawnProjectiles + if (bulletHellCounter2 % 900 == 0 && despawnProj) + { + int proj; + for (int x = 0; x < 1000; x = proj + 1) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == mod.ProjectileType("BrimstoneHellblast2") || + projectile.type == mod.ProjectileType("BrimstoneBarrage") || + projectile.type == mod.ProjectileType("BrimstoneWave")) + { + projectile.Kill(); + } + else if (projectile.type == mod.ProjectileType("BrimstoneGigaBlast") || + projectile.type == mod.ProjectileType("BrimstoneFireblast")) + { + projectile.active = false; + } + } + proj = x; + } + despawnProj = false; + } + #endregion + #region TransformSeekerandBrotherTriggers + if (!halfLife && ((double)npc.life <= (double)npc.lifeMax * 0.4)) + { + string key = "Mods.CalamityMod.SupremeBossText"; + 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); + } + halfLife = true; + } + if ((double)npc.life <= (double)npc.lifeMax * 0.2) + { + if (secondStage == false) + { + string key = "Mods.CalamityMod.SupremeBossText8"; + 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); + } + if (Main.netMode != 1) + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); + for (int I = 0; I < 20; I++) + { + int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 18) * 300)), (int)(npc.Center.Y + (Math.Cos(I * 18) * 300)), mod.NPCType("SoulSeekerSupreme"), npc.whoAmI, 0, 0, 0, -1); + NPC Eye = Main.npc[FireEye]; + Eye.ai[0] = I * 18; + Eye.ai[3] = I * 18; + } + } + secondStage = true; + } + } + if (bossLife == 0f && npc.life > 0) + { + bossLife = (float)npc.lifeMax; + } + if (npc.life > 0) + { + if (Main.netMode != 1) + { + int num660 = (int)((double)npc.lifeMax * 0.55); + if ((float)(npc.life + num660) < bossLife) + { + bossLife = (float)npc.life; + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SupremeCataclysm")); + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("SupremeCatastrophe")); + string key = "Mods.CalamityMod.SupremeBossText6"; + 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; + } + } + } + #endregion + #region TargetandRotation + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + } + float num801 = npc.position.X + (float)(npc.width / 2) - player.position.X - (float)(player.width / 2); + float num802 = npc.position.Y + (float)npc.height - 59f - player.position.Y - (float)(player.height / 2); + float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; + if (num803 < 0f) + { + num803 += 6.283f; + } + else if ((double)num803 > 6.283) + { + num803 -= 6.283f; + } + float num804 = 0.1f; + if (npc.rotation < num803) + { + if ((double)(num803 - npc.rotation) > 3.1415) + { + npc.rotation -= num804; + } + else + { + npc.rotation += num804; + } + } + else if (npc.rotation > num803) + { + if ((double)(npc.rotation - num803) > 3.1415) + { + npc.rotation += num804; + } + else + { + npc.rotation -= num804; + } + } + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + { + npc.rotation = num803; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.283f; + } + else if ((double)npc.rotation > 6.283) + { + npc.rotation -= 6.283f; + } + if (npc.rotation > num803 - num804 && npc.rotation < num803 + num804) + { + npc.rotation = num803; + } + #endregion + #region FirstStage + if (npc.ai[0] == 0f) + { + npc.damage = expertMode ? 720 : 450; + if (wormAlive) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + } + else + { + if (cataclysmAlive || catastropheAlive) + { + 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 + { + npc.dontTakeDamage = false; + npc.chaseable = true; + } + } + if (npc.ai[1] == 0f) + { + float num823 = 12f; + float num824 = 0.12f; + Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num825 = player.position.X + (float)(player.width / 2) - vector82.X; + float num826 = player.position.Y + (float)(player.height / 2) - 550f - vector82.Y; + float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; + if (npc.velocity.X < num825) + { + npc.velocity.X = npc.velocity.X + num824; + if (npc.velocity.X < 0f && num825 > 0f) + { + npc.velocity.X = npc.velocity.X + num824; + } + } + else if (npc.velocity.X > num825) + { + npc.velocity.X = npc.velocity.X - num824; + if (npc.velocity.X > 0f && num825 < 0f) + { + npc.velocity.X = npc.velocity.X - num824; + } + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y = npc.velocity.Y + num824; + if (npc.velocity.Y < 0f && num826 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num824; + } + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y = npc.velocity.Y - num824; + if (npc.velocity.Y > 0f && num826 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num824; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[1] = -1f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num825 = player.position.X + (float)(player.width / 2) - vector82.X; + num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; + if (Main.netMode != 1) + { + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 90f) + { + npc.localAI[1] = 0f; + float num828 = 10f * uDieLul; + int num829 = expertMode ? 150 : 200; //600 400 + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num828 / num183; + num180 *= num183; + num182 *= num183; + value9.X += num180; + value9.Y += num182; + int randomShot = Main.rand.Next(6); //0 to 5 + if (randomShot == 0 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = mod.ProjectileType("BrimstoneFireblast"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 15f; + vector82.Y += num826 * 15f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + else if (randomShot == 1 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = mod.ProjectileType("BrimstoneGigaBlast"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 15f; + vector82.Y += num826 * 15f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + else + { + canFireSplitingFireball = true; + randomShot = mod.ProjectileType("BrimstoneBarrage"); + for (int num186 = 1; num186 <= 8; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + float speedBoost = (float)(num186 > 4 ? -(num186 - 4) : num186); + num183 = (8f + speedBoost) / num183; + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + } + return; + } + } + } + else if (npc.ai[1] == 1f) + { + npc.rotation = num803; //change + float num383 = wormAlive ? 26f : 30f; + if ((double)npc.life < (double)npc.lifeMax * 0.95) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.85) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.7) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.6) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num383 += 1f; + } + Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num384 = player.position.X + (float)(player.width / 2) - vector37.X; + float num385 = player.position.Y + (float)(player.height / 2) - vector37.Y; + float num386 = (float)Math.Sqrt((double)(num384 * num384 + num385 * num385)); + num386 = num383 / num386; + npc.velocity.X = num384 * num386; + npc.velocity.Y = num385 * num386; + npc.ai[1] = 2f; + } + else if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 25f) + { + npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.Y = npc.velocity.Y * 0.96f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + if (npc.ai[2] >= 70f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num803; + if (npc.ai[3] >= 2f) + { + npc.ai[1] = -1f; + } + else + { + npc.ai[1] = 1f; + } + } + } + else if (npc.ai[1] == 3f) + { + npc.TargetClosest(true); + float num412 = 32f; + float num413 = 1.2f; + int num414 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num414 = -1; + } + Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 600) - vector40.X; + float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num412 / num417; + num415 *= num417; + num416 *= num417; + if (npc.velocity.X < num415) + { + npc.velocity.X = npc.velocity.X + num413; + if (npc.velocity.X < 0f && num415 > 0f) + { + npc.velocity.X = npc.velocity.X + num413; + } + } + else if (npc.velocity.X > num415) + { + npc.velocity.X = npc.velocity.X - num413; + if (npc.velocity.X > 0f && num415 < 0f) + { + npc.velocity.X = npc.velocity.X - num413; + } + } + if (npc.velocity.Y < num416) + { + npc.velocity.Y = npc.velocity.Y + num413; + if (npc.velocity.Y < 0f && num416 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num413; + } + } + else if (npc.velocity.Y > num416) + { + npc.velocity.Y = npc.velocity.Y - num413; + if (npc.velocity.Y > 0f && num416 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num413; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 480f) + { + npc.ai[1] = -1f; + npc.target = 255; + npc.netUpdate = true; + } + else + { + if (!player.dead) + { + npc.ai[3] += wormAlive ? 0.5f : 1f; + } + if (npc.ai[3] >= 20f) + { + npc.ai[3] = 0f; + vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num415 = player.position.X + (float)(player.width / 2) - vector40.X; + num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + if (Main.netMode != 1) + { + float num418 = 10f * uDieLul; + int num419 = expertMode ? 150 : 200; //600 500 + int num420 = mod.ProjectileType("BrimstoneHellblast"); + num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num418 / num417; + num415 *= num417; + num416 *= num417; + vector40.X += num415 * 4f; + vector40.Y += num416 * 4f; + Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else if (npc.ai[1] == 4f) + { + int num831 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num831 = -1; + } + float num832 = 32f; + float num833 = 1.2f; + Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 750) - vector83.X; //600 + float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num832 / num836; + num834 *= num836; + num835 *= num836; + if (npc.velocity.X < num834) + { + npc.velocity.X = npc.velocity.X + num833; + if (npc.velocity.X < 0f && num834 > 0f) + { + npc.velocity.X = npc.velocity.X + num833; + } + } + else if (npc.velocity.X > num834) + { + npc.velocity.X = npc.velocity.X - num833; + if (npc.velocity.X > 0f && num834 < 0f) + { + npc.velocity.X = npc.velocity.X - num833; + } + } + if (npc.velocity.Y < num835) + { + npc.velocity.Y = npc.velocity.Y + num833; + if (npc.velocity.Y < 0f && num835 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num833; + } + } + else if (npc.velocity.Y > num835) + { + npc.velocity.Y = npc.velocity.Y - num833; + if (npc.velocity.Y > 0f && num835 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num833; + } + } + vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num834 = player.position.X + (float)(player.width / 2) - vector83.X; + num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; + if (Main.netMode != 1) + { + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 140f) + { + npc.localAI[1] = 0f; + float num837 = 5f * uDieLul; + int num838 = expertMode ? 150 : 200; //600 500 + int num839 = mod.ProjectileType("BrimstoneFireblast"); + num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 15f; + vector83.Y += num835 * 15f; + Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[1] = -1f; + npc.TargetClosest(true); + npc.netUpdate = true; + return; + } + } + if (npc.ai[1] == -1f) + { + phaseChange++; + if (phaseChange > 23) + { + phaseChange = 0; + } + int phase = 0; //0 = shots above 1 = charge 2 = nothing 3 = hellblasts 4 = fireblasts + switch (phaseChange) + { + case 0: phase = 0; willCharge = false; break; //0341 + case 1: phase = 3; break; + case 2: phase = 4; willCharge = true; break; + case 3: phase = 1; break; + case 4: phase = 1; break; //1430 + case 5: phase = 4; willCharge = false; break; + case 6: phase = 3; break; + case 7: phase = 0; willCharge = true; break; + case 8: phase = 1; break; //1034 + case 9: phase = 0; willCharge = false; break; + case 10: phase = 3; break; + case 11: phase = 4; break; + case 12: phase = 4; break; //4310 + case 13: phase = 3; willCharge = true; break; + case 14: phase = 1; break; + case 15: phase = 0; willCharge = false; break; + case 16: phase = 4; break; //4411 + case 17: phase = 4; willCharge = true; break; + case 18: phase = 1; break; + case 19: phase = 1; break; + case 20: phase = 0; break; //0101 + case 21: phase = 1; break; + case 22: phase = 0; break; + case 23: phase = 1; break; + } + npc.ai[1] = (float)phase; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return; + } + if ((double)npc.life < (double)npc.lifeMax * 0.4) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + #endregion + #region Transition + else if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + if (npc.ai[0] == 1f) + { + npc.ai[2] += 0.005f; + if ((double)npc.ai[2] > 0.5) + { + npc.ai[2] = 0.5f; + } + } + else + { + npc.ai[2] -= 0.005f; + if (npc.ai[2] < 0f) + { + npc.ai[2] = 0f; + } + } + npc.rotation += npc.ai[2]; + npc.ai[1] += 1f; + if (npc.ai[1] == 100f) + { + npc.ai[0] += 1f; + npc.ai[1] = 0f; + if (npc.ai[0] == 3f) + { + npc.ai[2] = 0f; + } + else + { + for (int num388 = 0; num388 < 50; num388++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f); + } + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + } + } + Dust.NewDust(npc.position, npc.width, npc.height, 235, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f); + npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.Y = npc.velocity.Y * 0.98f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + return; + } + } + #endregion + #region LastStage + else + { + npc.damage = expertMode ? 720 : 450; + if (wormAlive) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + } + else + { + if (NPC.AnyNPCs(mod.NPCType("SoulSeekerSupreme"))) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + } + else + { + npc.dontTakeDamage = false; + npc.chaseable = true; + } + } + if (npc.ai[1] == 0f) + { + float num823 = 12f; + float num824 = 0.12f; + Vector2 vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num825 = player.position.X + (float)(player.width / 2) - vector82.X; + float num826 = player.position.Y + (float)(player.height / 2) - 550f - vector82.Y; + float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; + if (npc.velocity.X < num825) + { + npc.velocity.X = npc.velocity.X + num824; + if (npc.velocity.X < 0f && num825 > 0f) + { + npc.velocity.X = npc.velocity.X + num824; + } + } + else if (npc.velocity.X > num825) + { + npc.velocity.X = npc.velocity.X - num824; + if (npc.velocity.X > 0f && num825 < 0f) + { + npc.velocity.X = npc.velocity.X - num824; + } + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y = npc.velocity.Y + num824; + if (npc.velocity.Y < 0f && num826 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num824; + } + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y = npc.velocity.Y - num824; + if (npc.velocity.Y > 0f && num826 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num824; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 240f) + { + npc.ai[1] = -1f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + vector82 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num825 = player.position.X + (float)(player.width / 2) - vector82.X; + num826 = player.position.Y + (float)(player.height / 2) - vector82.Y; + npc.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; + if (Main.netMode != 1) + { + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 60f) + { + npc.localAI[1] = 0f; + float num828 = 10f * uDieLul; + int num829 = expertMode ? 150 : 200; //600 500 + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = player.position.X + (float)player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + (float)player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num828 / num183; + num180 *= num183; + num182 *= num183; + value9.X += num180; + value9.Y += num182; + int randomShot = Main.rand.Next(6); + if (randomShot == 0 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = mod.ProjectileType("BrimstoneFireblast"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 15f; + vector82.Y += num826 * 15f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + else if (randomShot == 1 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = mod.ProjectileType("BrimstoneGigaBlast"); + num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 15f; + vector82.Y += num826 * 15f; + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + else + { + canFireSplitingFireball = true; + randomShot = mod.ProjectileType("BrimstoneBarrage"); + for (int num186 = 1; num186 <= 8; num186++) + { + num180 = player.position.X + (float)player.width * 0.5f - value9.X; + num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + float speedBoost = (float)(num186 > 4 ? -(num186 - 4) : num186); + num183 = (8f + speedBoost) / num183; + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); + } + } + return; + } + } + } + else if (npc.ai[1] == 1f) + { + npc.rotation = num803; //change + float num383 = wormAlive ? 31f : 35f; + if ((double)npc.life < (double)npc.lifeMax * 0.3) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.2) + { + num383 += 1f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1) + { + num383 += 1f; + } + Vector2 vector37 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num384 = player.position.X + (float)(player.width / 2) - vector37.X; + float num385 = player.position.Y + (float)(player.height / 2) - vector37.Y; + float num386 = (float)Math.Sqrt((double)(num384 * num384 + num385 * num385)); + num386 = num383 / num386; + npc.velocity.X = num384 * num386; + npc.velocity.Y = num385 * num386; + npc.ai[1] = 2f; + } + else if (npc.ai[1] == 2f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 25f) + { + npc.velocity.X = npc.velocity.X * 0.96f; + npc.velocity.Y = npc.velocity.Y * 0.96f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = 0f; + } + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + if (npc.ai[2] >= 70f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.target = 255; + npc.rotation = num803; //change + if (npc.ai[3] >= 1f) + { + npc.ai[1] = -1f; + } + else + { + npc.ai[1] = 1f; + } + } + } + else if (npc.ai[1] == 3f) + { + npc.TargetClosest(true); + float num412 = 32f; + float num413 = 1.2f; + int num414 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num414 = -1; + } + Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 600) - vector40.X; + float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num412 / num417; + num415 *= num417; + num416 *= num417; + if (npc.velocity.X < num415) + { + npc.velocity.X = npc.velocity.X + num413; + if (npc.velocity.X < 0f && num415 > 0f) + { + npc.velocity.X = npc.velocity.X + num413; + } + } + else if (npc.velocity.X > num415) + { + npc.velocity.X = npc.velocity.X - num413; + if (npc.velocity.X > 0f && num415 < 0f) + { + npc.velocity.X = npc.velocity.X - num413; + } + } + if (npc.velocity.Y < num416) + { + npc.velocity.Y = npc.velocity.Y + num413; + if (npc.velocity.Y < 0f && num416 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num413; + } + } + else if (npc.velocity.Y > num416) + { + npc.velocity.Y = npc.velocity.Y - num413; + if (npc.velocity.Y > 0f && num416 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num413; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[1] = -1f; + npc.target = 255; + npc.netUpdate = true; + } + else + { + if (!player.dead) + { + npc.ai[3] += wormAlive ? 0.5f : 1f; + } + if (npc.ai[3] >= 24f) + { + npc.ai[3] = 0f; + vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num415 = player.position.X + (float)(player.width / 2) - vector40.X; + num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + if (Main.netMode != 1) + { + float num418 = 10f * uDieLul; + int num419 = expertMode ? 150 : 200; //600 500 + int num420 = mod.ProjectileType("BrimstoneHellblast"); + num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = num418 / num417; + num415 *= num417; + num416 *= num417; + vector40.X += num415 * 4f; + vector40.Y += num416 * 4f; + Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else if (npc.ai[1] == 4f) + { + int num831 = 1; + if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + { + num831 = -1; + } + float num832 = 32f; + float num833 = 1.2f; + Vector2 vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num834 = player.position.X + (float)(player.width / 2) + (float)(num831 * 750) - vector83.X; //600 + float num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num832 / num836; + num834 *= num836; + num835 *= num836; + if (npc.velocity.X < num834) + { + npc.velocity.X = npc.velocity.X + num833; + if (npc.velocity.X < 0f && num834 > 0f) + { + npc.velocity.X = npc.velocity.X + num833; + } + } + else if (npc.velocity.X > num834) + { + npc.velocity.X = npc.velocity.X - num833; + if (npc.velocity.X > 0f && num834 < 0f) + { + npc.velocity.X = npc.velocity.X - num833; + } + } + if (npc.velocity.Y < num835) + { + npc.velocity.Y = npc.velocity.Y + num833; + if (npc.velocity.Y < 0f && num835 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num833; + } + } + else if (npc.velocity.Y > num835) + { + npc.velocity.Y = npc.velocity.Y - num833; + if (npc.velocity.Y > 0f && num835 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num833; + } + } + vector83 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num834 = player.position.X + (float)(player.width / 2) - vector83.X; + num835 = player.position.Y + (float)(player.height / 2) - vector83.Y; + npc.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; + if (Main.netMode != 1) + { + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 100f) + { + npc.localAI[1] = 0f; + float num837 = 5f * uDieLul; + int num838 = expertMode ? 150 : 200; //600 500 + int num839 = mod.ProjectileType("BrimstoneFireblast"); + num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 15f; + vector83.Y += num835 * 15f; + int shot = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 240f) + { + npc.ai[1] = -1f; + npc.TargetClosest(true); + npc.netUpdate = true; + return; + } + } + if (npc.ai[1] == -1f) + { + phaseChange++; + if (phaseChange > 23) + { + phaseChange = 0; + } + int phase = 0; //0 = shots above 1 = charge 2 = nothing 3 = hellblasts 4 = fireblasts + switch (phaseChange) + { + case 0: phase = 0; willCharge = false; break; //0341 + case 1: phase = 3; break; + case 2: phase = 4; willCharge = true; break; + case 3: phase = 1; break; + case 4: phase = 1; break; //1430 + case 5: phase = 4; willCharge = false; break; + case 6: phase = 3; break; + case 7: phase = 0; willCharge = true; break; + case 8: phase = 1; break; //1034 + case 9: phase = 0; willCharge = false; break; + case 10: phase = 3; break; + case 11: phase = 4; break; + case 12: phase = 4; break; //4310 + case 13: phase = 3; willCharge = true; break; + case 14: phase = 1; break; + case 15: phase = 0; willCharge = false; break; + case 16: phase = 4; break; //4411 + case 17: phase = 4; willCharge = true; break; + case 18: phase = 1; break; + case 19: phase = 1; break; + case 20: phase = 0; break; //0101 + case 21: phase = 1; break; + case 22: phase = 0; break; + case 23: phase = 1; break; + } + npc.ai[1] = (float)phase; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + return; + } + } + #endregion + } + + #region Loot + public override void NPCLoot() + { + if (lootTimer < 6000) //75 seconds for bullet hells + 25 seconds for normal phases + { + 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); + } + return; + } + if (Main.player[npc.target].GetModPlayer(mod).sCalKillCount == 0) //first time you kill her + { + if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount == 0) + { + string key = "Mods.CalamityMod.SupremeBossText16"; //die no times + 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); + } + } + else if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount == 1) + { + string key = "Mods.CalamityMod.SupremeBossText17"; //die one time + 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); + } + } + else if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount == 2) + { + string key = "Mods.CalamityMod.SupremeBossText18"; //die two times + 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); + } + } + else if (Main.LocalPlayer.GetModPlayer(mod).sCalDeathCount == 3) + { + string key = "Mods.CalamityMod.SupremeBossText19"; //die three times + 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); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CheatTestThing")); + } + else //die however many times + { + string key = "Mods.CalamityMod.SupremeBossText10"; + 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); + } + } + } + else //all times after first kill + { + string key = "Mods.CalamityMod.SupremeBossText10"; + 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); + } + } + if (Main.player[npc.target].GetModPlayer(mod).sCalKillCount < 5) + { + Main.player[npc.target].GetModPlayer(mod).sCalKillCount++; + } + if (Main.expertMode) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("CalamitousEssence"), Main.rand.Next(30, 41), true); + if (CalamityWorld.revenge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Vehemenc")); + } + int itemChoice = Main.rand.Next(14); + if (itemChoice == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Animus")); //done + } + else if (itemChoice == 1) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Azathoth")); //done + } + else if (itemChoice == 2) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Contagion")); //done + } + else if (itemChoice == 3) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraconicDestruction")); //done + } + else if (itemChoice == 4) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Earth")); //done + } + else if (itemChoice == 5) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Megafleet")); //done + } + else if (itemChoice == 6) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RedSun")); //done + } + else if (itemChoice == 7) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RoyalKnives")); //done + } + else if (itemChoice == 8) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RoyalKnivesMelee")); //done + } + else if (itemChoice == 9) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Svantechnical")); //done + } + else if (itemChoice == 10) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TriactisTruePaladinianMageHammerofMight")); //done + } + else if (itemChoice == 11) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TriactisTruePaladinianMageHammerofMightMelee")); //done + } + else if (itemChoice == 12) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Svantechnical")); //done + } + else if (itemChoice == 13) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrystylCrusher")); //done + } + } + else + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("CalamitousEssence"), Main.rand.Next(20, 31), true); + } + } + #endregion + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = mod.ItemType("OmegaHealingPotion"); + } + + 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 / 10) + { + 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 (startFifthAttack) + { + protection *= 1.2f; //90% or 84% + } + if (protectionBoost) + { + protection = 0.99f; //99% + } + 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 CheckActive() + { + return canDespawn; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 1.5f; + return null; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + 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 PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D texture = Main.npcTexture[npc.type]; + if (npc.ai[0] > 1f) + { + texture = mod.GetTexture("NPCs/SupremeCalamitas/SupremeCalamitas2"); + } + else + { + texture = Main.npcTexture[npc.type]; + } + Color newColor = (willCharge ? new Color(100, 0, 0, 0) : drawColor); + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(newColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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("VulnerabilityHex"), 600, true); + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("Horror"), 600, true); + } + } + } +} diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 5b079c941d..147524070d 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -1,323 +1,323 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - [AutoloadBossHead] - public class SupremeCataclysm : ModNPC - { - private int distanceY = -375; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclysm"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 150; - npc.lifeMax = CalamityWorld.revenge ? 1400000 : 1200000; - if (CalamityWorld.death) - { - npc.lifeMax = 1000000; - } - 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; - NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(distanceY); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - distanceY = reader.ReadInt32(); - } - - 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() - { - CalamityGlobalNPC.SCalCataclysm = npc.whoAmI; - bool expertMode = Main.expertMode; - if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.TargetClosest(true); - float num676 = 60f; - float num677 = 1.5f; - float distanceX = 750f; - if (npc.ai[3] < 750f) - { - npc.ai[3] += 1f; - distanceY += 1; - } - else if (npc.ai[3] < 1500f) - { - npc.ai[3] += 1f; - distanceY -= 1; - } - if (npc.ai[3] >= 1500f) - { - npc.ai[3] = 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 + (float)distanceY; - npc.rotation = 1.57f; - float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); - num680 = num676 / num680; - num678 *= num680; - num679 *= num680; - if (npc.velocity.X < num678) - { - npc.velocity.X = npc.velocity.X + num677; - if (npc.velocity.X < 0f && num678 > 0f) - { - npc.velocity.X = npc.velocity.X + num677; - } - } - else if (npc.velocity.X > num678) - { - npc.velocity.X = npc.velocity.X - num677; - if (npc.velocity.X > 0f && num678 < 0f) - { - npc.velocity.X = npc.velocity.X - num677; - } - } - if (npc.velocity.Y < num679) - { - npc.velocity.Y = npc.velocity.Y + num677; - 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) - { - npc.velocity.Y = npc.velocity.Y - num677; - } - } - if (npc.localAI[0] < 120f) - { - npc.localAI[0] += 1f; - } - if (npc.localAI[0] >= 120f) - { - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f) - { - 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; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + [AutoloadBossHead] + public class SupremeCataclysm : ModNPC + { + private int distanceY = -375; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclysm"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 5f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 150; + npc.lifeMax = CalamityWorld.revenge ? 1400000 : 1200000; + if (CalamityWorld.death) + { + npc.lifeMax = 1000000; + } + 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; + NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(distanceY); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + distanceY = reader.ReadInt32(); + } + + 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() + { + CalamityGlobalNPC.SCalCataclysm = npc.whoAmI; + bool expertMode = Main.expertMode; + if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.TargetClosest(true); + float num676 = 60f; + float num677 = 1.5f; + float distanceX = 750f; + if (npc.ai[3] < 750f) + { + npc.ai[3] += 1f; + distanceY += 1; + } + else if (npc.ai[3] < 1500f) + { + npc.ai[3] += 1f; + distanceY -= 1; + } + if (npc.ai[3] >= 1500f) + { + npc.ai[3] = 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 + (float)distanceY; + npc.rotation = 1.57f; + float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); + num680 = num676 / num680; + num678 *= num680; + num679 *= num680; + if (npc.velocity.X < num678) + { + npc.velocity.X = npc.velocity.X + num677; + if (npc.velocity.X < 0f && num678 > 0f) + { + npc.velocity.X = npc.velocity.X + num677; + } + } + else if (npc.velocity.X > num678) + { + npc.velocity.X = npc.velocity.X - num677; + if (npc.velocity.X > 0f && num678 < 0f) + { + npc.velocity.X = npc.velocity.X - num677; + } + } + if (npc.velocity.Y < num679) + { + npc.velocity.Y = npc.velocity.Y + num677; + 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) + { + npc.velocity.Y = npc.velocity.Y - num677; + } + } + if (npc.localAI[0] < 120f) + { + npc.localAI[0] += 1f; + } + if (npc.localAI[0] >= 120f) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 60f) + { + 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; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index b3e9057f58..9514c0a98d 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -1,323 +1,323 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - [AutoloadBossHead] - public class SupremeCatastrophe : ModNPC - { - private int distanceY = 375; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastrophe"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.npcSlots = 5f; - npc.width = 120; //324 - npc.height = 120; //216 - npc.defense = 150; - npc.lifeMax = CalamityWorld.revenge ? 1400000 : 1200000; - if (CalamityWorld.death) - { - npc.lifeMax = 1000000; - } - 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; - npc.noTileCollide = true; - 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.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(distanceY); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - distanceY = reader.ReadInt32(); - } - - 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() - { - CalamityGlobalNPC.SCalCatastrophe = npc.whoAmI; - bool expertMode = Main.expertMode; - if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.TargetClosest(true); - float num676 = 60f; - float num677 = 1.5f; - float distanceX = 750f; - if (npc.ai[3] < 750f) - { - npc.ai[3] += 1f; - distanceY -= 1; - } - else if (npc.ai[3] < 1500f) - { - npc.ai[3] += 1f; - distanceY += 1; - } - if (npc.ai[3] >= 1500f) - { - npc.ai[3] = 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 + (float)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) - { - npc.velocity.X = npc.velocity.X + num677; - if (npc.velocity.X < 0f && num678 > 0f) - { - npc.velocity.X = npc.velocity.X + num677; - } - } - else if (npc.velocity.X > num678) - { - npc.velocity.X = npc.velocity.X - num677; - if (npc.velocity.X > 0f && num678 < 0f) - { - npc.velocity.X = npc.velocity.X - num677; - } - } - if (npc.velocity.Y < num679) - { - npc.velocity.Y = npc.velocity.Y + num677; - 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) - { - npc.velocity.Y = npc.velocity.Y - num677; - } - } - 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) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) - { - Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - 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; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + [AutoloadBossHead] + public class SupremeCatastrophe : ModNPC + { + private int distanceY = 375; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.npcSlots = 5f; + npc.width = 120; //324 + npc.height = 120; //216 + npc.defense = 150; + npc.lifeMax = CalamityWorld.revenge ? 1400000 : 1200000; + if (CalamityWorld.death) + { + npc.lifeMax = 1000000; + } + 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; + npc.noTileCollide = true; + 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.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(distanceY); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + distanceY = reader.ReadInt32(); + } + + 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() + { + CalamityGlobalNPC.SCalCatastrophe = npc.whoAmI; + bool expertMode = Main.expertMode; + if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.TargetClosest(true); + float num676 = 60f; + float num677 = 1.5f; + float distanceX = 750f; + if (npc.ai[3] < 750f) + { + npc.ai[3] += 1f; + distanceY -= 1; + } + else if (npc.ai[3] < 1500f) + { + npc.ai[3] += 1f; + distanceY += 1; + } + if (npc.ai[3] >= 1500f) + { + npc.ai[3] = 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 + (float)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) + { + npc.velocity.X = npc.velocity.X + num677; + if (npc.velocity.X < 0f && num678 > 0f) + { + npc.velocity.X = npc.velocity.X + num677; + } + } + else if (npc.velocity.X > num678) + { + npc.velocity.X = npc.velocity.X - num677; + if (npc.velocity.X > 0f && num678 < 0f) + { + npc.velocity.X = npc.velocity.X - num677; + } + } + if (npc.velocity.Y < num679) + { + npc.velocity.Y = npc.velocity.Y + num677; + 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) + { + npc.velocity.Y = npc.velocity.Y - num677; + } + } + 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) + { + SpriteEffects spriteEffects = SpriteEffects.None; + Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.npcTexture[npc.type]; + int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && Lighting.NotRetro) + { + Microsoft.Xna.Framework.Color color26 = npc.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + return false; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + 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; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 3f); + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs index 73de5be6e5..639b9a13f8 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs @@ -1,226 +1,226 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - public class DevourerofGodsBody : ModNPC - { - private int invinceTime = 360; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } - - public override void SetDefaults() - { - npc.damage = 180; //70 - npc.npcSlots = 5f; - 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; - } - 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.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - 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/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - npc.dontCountMe = true; - if (Main.expertMode) - { - npc.scale = 1.5f; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 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 (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.netMode != 1) - { - float shootTimer = 2f + (expertMode ? 1f : 0f); - npc.localAI[0] += shootTimer; - 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; - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - 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.075; - damage = (int)((double)damage * protection); - return true; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody3"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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); - player.AddBuff(mod.BuffType("WhisperingDeath"), 300, true); - player.AddBuff(BuffID.Frostburn, 240, true); - player.AddBuff(BuffID.Darkness, 240, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DevourerofGodsBody : ModNPC + { + private int invinceTime = 360; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } + + public override void SetDefaults() + { + npc.damage = 180; //70 + npc.npcSlots = 5f; + 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; + } + 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.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + 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/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + npc.dontCountMe = true; + if (Main.expertMode) + { + npc.scale = 1.5f; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 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 (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (Main.netMode != 1) + { + float shootTimer = 2f + (expertMode ? 1f : 0f); + npc.localAI[0] += shootTimer; + 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; + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + 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.075; + damage = (int)((double)damage * protection); + return true; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody3"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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); + player.AddBuff(mod.BuffType("WhisperingDeath"), 300, true); + player.AddBuff(BuffID.Frostburn, 240, true); + player.AddBuff(BuffID.Darkness, 240, true); + } + } +} diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs index 3e5092ad3b..d771339eb3 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs @@ -1,168 +1,168 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - public class DevourerofGodsBody2 : ModNPC - { - public int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Guardian"); - } - - public override void SetDefaults() - { - npc.damage = 130; //70 - npc.npcSlots = 5f; - npc.width = 34; //38 - npc.height = 34; //30 - npc.defense = 0; - npc.lifeMax = 100000; //192000 - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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 (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = Main.expertMode ? 260 : 130; - 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) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - damage = (int)((double)damage * 0.5); - return true; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT5"), 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; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 120, true); - player.AddBuff(BuffID.Frostburn, 120, true); - player.AddBuff(BuffID.Darkness, 120, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DevourerofGodsBody2 : ModNPC + { + public int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Guardian"); + } + + public override void SetDefaults() + { + npc.damage = 130; //70 + npc.npcSlots = 5f; + npc.width = 34; //38 + npc.height = 34; //30 + npc.defense = 0; + npc.lifeMax = 100000; //192000 + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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 (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = Main.expertMode ? 260 : 130; + 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) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + damage = (int)((double)damage * 0.5); + return true; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT5"), 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; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 120, true); + player.AddBuff(BuffID.Frostburn, 120, true); + player.AddBuff(BuffID.Darkness, 120, true); + } + } +} diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs index 3748b09d97..f3c3a6beee 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs @@ -1,456 +1,456 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - [AutoloadBossHead] - public class DevourerofGodsBodyS : ModNPC - { - private int invinceTime = 360; - private bool setAlpha = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } - - public override void SetDefaults() - { - npc.damage = 220; //70 - npc.npcSlots = 5f; - npc.width = 54; //34 - npc.height = 54; //34 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 1875000 : 1650000; //720000 672000 - if (CalamityWorld.death) - { - npc.lifeMax = 3060000; - } - if (CalamityWorld.bossRushActive) - { - 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.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - 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; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(setAlpha); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - setAlpha = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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() - { - 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 (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) - { - npc.alpha -= 42; - if (npc.alpha <= 0 && invinceTime <= 0) - { - setAlpha = true; - npc.alpha = 0; - } - } - else - { - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } - 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 = 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; - } - double protection = CalamityWorld.death ? 0.03 : 0.045; - damage = (int)((double)damage * protection); - return true; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS5"), 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; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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); - player.AddBuff(mod.BuffType("WhisperingDeath"), 300, true); - player.AddBuff(BuffID.Frostburn, 240, true); - player.AddBuff(BuffID.Darkness, 240, true); - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + [AutoloadBossHead] + public class DevourerofGodsBodyS : ModNPC + { + private int invinceTime = 360; + private bool setAlpha = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } + + public override void SetDefaults() + { + npc.damage = 220; //70 + npc.npcSlots = 5f; + npc.width = 54; //34 + npc.height = 54; //34 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 1875000 : 1650000; //720000 672000 + if (CalamityWorld.death) + { + npc.lifeMax = 3060000; + } + if (CalamityWorld.bossRushActive) + { + 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.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(setAlpha); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + setAlpha = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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() + { + 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 (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) + { + npc.alpha -= 42; + if (npc.alpha <= 0 && invinceTime <= 0) + { + setAlpha = true; + npc.alpha = 0; + } + } + else + { + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + 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 = 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; + } + double protection = CalamityWorld.death ? 0.03 : 0.045; + damage = (int)((double)damage * protection); + return true; + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGS5"), 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; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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); + player.AddBuff(mod.BuffType("WhisperingDeath"), 300, true); + player.AddBuff(BuffID.Frostburn, 240, true); + player.AddBuff(BuffID.Darkness, 240, true); + } + } +} diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs index 6fd70eff12..37edb6b894 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs @@ -1,989 +1,989 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -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 int phaseSwitch = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } - - public override void SetDefaults() - { - npc.damage = 250; //150 - npc.npcSlots = 5f; - 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; - } - 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 - npc.knockBackResist = 0f; - npc.scale = 1.4f; - npc.boss = true; - npc.value = Item.buyPrice(0, 75, 0, 0); - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = 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) - { - npc.scale = 1.5f; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(halfLife); - writer.Write(halfLife2); - writer.Write(spawnDoGCountdown); - writer.Write(phaseSwitch); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - halfLife = reader.ReadBoolean(); - halfLife2 = reader.ReadBoolean(); - spawnDoGCountdown = reader.ReadInt32(); - phaseSwitch = reader.ReadInt32(); - } - - 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); - if (playerRunAcceleration <= 1f) - playerRunAcceleration = 1f; - - if (Main.raining) - CalamityGlobalNPC.StopRain(); - - 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 - 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 - bool speedBoost5 = (double)npc.life <= (double)npc.lifeMax * 0.1; //speed increase - if (speedBoost4) - { - if (!halfLife) - { - if (CalamityWorld.revenge) - { - spawnDoGCountdown = 10; - } - string key = "Mods.CalamityMod.EdgyBossText"; - Color messageColor = Color.Cyan; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - halfLife = true; - } - if (spawnDoGCountdown > 0) - { - spawnDoGCountdown--; - if (spawnDoGCountdown == 0 && Main.netMode != 1) - { - 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")); - } - } - } - 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) - { - 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.alpha != 0) - { - for (int spawnDust = 0; spawnDust < 2; spawnDust++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 12; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - 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("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) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - if (Main.player[npc.target].dead) - { - flies = true; - npc.velocity.Y = npc.velocity.Y - 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 3f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].aiStyle == npc.aiStyle) - { - 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; - 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 (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); - } - } - phaseSwitch += 1; - 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 += 9; - } - 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); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 800); - if (Main.player[npc.target].position.Y > num47) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 600f; - } - else - { - num191 = Main.player[npc.target].Center.X - 600f; - } - } - } - } - else - { - num188 = homingSpeed; - num189 = homingTurnSpeed; - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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; - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (phaseSwitch > 900) - { - npc.ai[2] = 1f; - phaseSwitch = 0; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[2] == 1f) - { - 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); - } - } - phaseSwitch += 1; - 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++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flies = true; - break; - } - } - } - } - } - if (!flies) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 1000; - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flies = true; - } - } - } - 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); - 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; - } - else - { - if (!flies) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + turnSpeed; //turnspeed * 0.5f - if (npc.velocity.Y > num188) //speed - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - 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 == num188) - { - 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; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - 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; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - 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; - } - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flies) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (phaseSwitch > 900) - { - npc.ai[2] = 0f; - phaseSwitch = 0; - npc.netUpdate = true; - return; - } - 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; - } - } - } - - 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") || 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) - { - string key = "Mods.CalamityMod.EdgyBossText2"; - Color messageColor = Color.Cyan; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - damage = 0; - return false; - } - 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) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGHead"), 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; - 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, 173, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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"), 300, true); - player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); - if (CalamityWorld.death) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - int num = Main.rand.Next(5); - string key = "Mods.CalamityMod.EdgyBossText3"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText3"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText4"; - } - else if (num == 2) - { - key = "Mods.CalamityMod.EdgyBossText5"; - } - else if (num == 3) - { - key = "Mods.CalamityMod.EdgyBossText6"; - } - else if (num == 4) - { - key = "Mods.CalamityMod.EdgyBossText7"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - player.AddBuff(BuffID.Frostburn, 300, true); - player.AddBuff(BuffID.Darkness, 300, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +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 int phaseSwitch = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } + + public override void SetDefaults() + { + npc.damage = 250; //150 + npc.npcSlots = 5f; + 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; + } + 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 + npc.knockBackResist = 0f; + npc.scale = 1.4f; + npc.boss = true; + npc.value = Item.buyPrice(0, 75, 0, 0); + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = 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) + { + npc.scale = 1.5f; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(halfLife); + writer.Write(halfLife2); + writer.Write(spawnDoGCountdown); + writer.Write(phaseSwitch); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + halfLife = reader.ReadBoolean(); + halfLife2 = reader.ReadBoolean(); + spawnDoGCountdown = reader.ReadInt32(); + phaseSwitch = reader.ReadInt32(); + } + + 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); + if (playerRunAcceleration <= 1f) + playerRunAcceleration = 1f; + + if (Main.raining) + CalamityGlobalNPC.StopRain(); + + 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 + 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 + bool speedBoost5 = (double)npc.life <= (double)npc.lifeMax * 0.1; //speed increase + if (speedBoost4) + { + if (!halfLife) + { + if (CalamityWorld.revenge) + { + spawnDoGCountdown = 10; + } + string key = "Mods.CalamityMod.EdgyBossText"; + Color messageColor = Color.Cyan; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + halfLife = true; + } + if (spawnDoGCountdown > 0) + { + spawnDoGCountdown--; + if (spawnDoGCountdown == 0 && Main.netMode != 1) + { + 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")); + } + } + } + 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) + { + 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.alpha != 0) + { + for (int spawnDust = 0; spawnDust < 2; spawnDust++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 12; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + 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("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) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + } + if (Main.player[npc.target].dead) + { + flies = true; + npc.velocity.Y = npc.velocity.Y - 3f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 3f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].aiStyle == npc.aiStyle) + { + 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; + 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 (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); + } + } + phaseSwitch += 1; + 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 += 9; + } + 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); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 800); + if (Main.player[npc.target].position.Y > num47) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 600f; + } + else + { + num191 = Main.player[npc.target].Center.X - 600f; + } + } + } + } + else + { + num188 = homingSpeed; + num189 = homingTurnSpeed; + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (num42 > 0) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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; + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (phaseSwitch > 900) + { + npc.ai[2] = 1f; + phaseSwitch = 0; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[2] == 1f) + { + 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); + } + } + phaseSwitch += 1; + 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++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flies = true; + break; + } + } + } + } + } + if (!flies) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 1000; + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flies = true; + } + } + } + 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); + 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; + } + else + { + if (!flies) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + turnSpeed; //turnspeed * 0.5f + if (npc.velocity.Y > num188) //speed + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + 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 == num188) + { + 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; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + 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; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + 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; + } + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flies) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + if (phaseSwitch > 900) + { + npc.ai[2] = 0f; + phaseSwitch = 0; + npc.netUpdate = true; + return; + } + 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; + } + } + } + + 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") || 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) + { + string key = "Mods.CalamityMod.EdgyBossText2"; + Color messageColor = Color.Cyan; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + damage = 0; + return false; + } + 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) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGHead"), 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; + 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, 173, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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"), 300, true); + player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); + if (CalamityWorld.death) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + int num = Main.rand.Next(5); + string key = "Mods.CalamityMod.EdgyBossText3"; + if (num == 0) + { + key = "Mods.CalamityMod.EdgyBossText3"; + } + else if (num == 1) + { + key = "Mods.CalamityMod.EdgyBossText4"; + } + else if (num == 2) + { + key = "Mods.CalamityMod.EdgyBossText5"; + } + else if (num == 3) + { + key = "Mods.CalamityMod.EdgyBossText6"; + } + else if (num == 4) + { + key = "Mods.CalamityMod.EdgyBossText7"; + } + Color messageColor = Color.Cyan; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + player.AddBuff(BuffID.Frostburn, 300, true); + player.AddBuff(BuffID.Darkness, 300, true); + } + } +} diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs index 6e4f02d0dd..e078a302bd 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs @@ -1,522 +1,522 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - public class DevourerofGodsHead2 : ModNPC - { - private bool tail = false; - private bool flies = false; - private const int minLength = 15; - private const int maxLength = 16; - private int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Guardian"); - } - - public override void SetDefaults() - { - npc.damage = 180; //150 - npc.npcSlots = 5f; - npc.width = 64; //324 - npc.height = 76; //216 - npc.defense = 0; - npc.lifeMax = 100000; //192000 - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - public override void AI() - { - 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; - } - if (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = expertMode ? 360 : 180; - npc.dontTakeDamage = false; - } - Vector2 vector = npc.Center; - 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) - { - 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.alpha != 0) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - npc.alpha -= 12; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - 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("DevourerofGodsBody2"), npc.whoAmI); - } - else - { - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTail2"), 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) - { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) - { - for (int num569 = 0; num569 < 200; num569++) - { - if (Main.npc[num569].active && (Main.npc[num569].type == mod.NPCType("DevourerofGodsHead2") || Main.npc[num569].type == mod.NPCType("DevourerofGodsBody2") || Main.npc[num569].type == mod.NPCType("DevourerofGodsTail2"))) - { - Main.npc[num569].active = false; - } - } - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - flies = true; - npc.velocity.Y = npc.velocity.Y - 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 3f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int a = 0; a < 200; a++) - { - if (Main.npc[a].aiStyle == npc.aiStyle) - { - 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; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - float speed = playerRunAcceleration * 16f; - float turnSpeed = playerRunAcceleration * 0.23f; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 3000f) //RAGE - { - speed = playerRunAcceleration * 60f; - turnSpeed = playerRunAcceleration * 0.8f; - } - if (!flies) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flies = true; - break; - } - } - } - } - } - if (!flies) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 1000; - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flies = true; - } - } - } - 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; - } - else - { - if (!flies) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.5f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - 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 == num188) - { - 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; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - 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; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - 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; - } - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flies) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - 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 void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.None; - } - - 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) - { - scale = 1.5f; - 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/DoT"), 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; - 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, 173, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); - player.AddBuff(BuffID.Frostburn, 180, true); - player.AddBuff(BuffID.Darkness, 180, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DevourerofGodsHead2 : ModNPC + { + private bool tail = false; + private bool flies = false; + private const int minLength = 15; + private const int maxLength = 16; + private int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Guardian"); + } + + public override void SetDefaults() + { + npc.damage = 180; //150 + npc.npcSlots = 5f; + npc.width = 64; //324 + npc.height = 76; //216 + npc.defense = 0; + npc.lifeMax = 100000; //192000 + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void AI() + { + 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; + } + if (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = expertMode ? 360 : 180; + npc.dontTakeDamage = false; + } + Vector2 vector = npc.Center; + 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) + { + 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.alpha != 0) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + npc.alpha -= 12; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + 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("DevourerofGodsBody2"), npc.whoAmI); + } + else + { + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTail2"), 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) + { + NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + } + if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) + { + for (int num569 = 0; num569 < 200; num569++) + { + if (Main.npc[num569].active && (Main.npc[num569].type == mod.NPCType("DevourerofGodsHead2") || Main.npc[num569].type == mod.NPCType("DevourerofGodsBody2") || Main.npc[num569].type == mod.NPCType("DevourerofGodsTail2"))) + { + Main.npc[num569].active = false; + } + } + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + flies = true; + npc.velocity.Y = npc.velocity.Y - 3f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 3f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].aiStyle == npc.aiStyle) + { + 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; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + float speed = playerRunAcceleration * 16f; + float turnSpeed = playerRunAcceleration * 0.23f; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 3000f) //RAGE + { + speed = playerRunAcceleration * 60f; + turnSpeed = playerRunAcceleration * 0.8f; + } + if (!flies) + { + for (int num952 = num180; num952 < num181; num952++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flies = true; + break; + } + } + } + } + } + if (!flies) + { + npc.localAI[1] = 1f; + Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num954 = 1000; + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flies = true; + } + } + } + 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; + } + else + { + if (!flies) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.5f); + if (npc.velocity.Y > num188) + { + npc.velocity.Y = num188; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) + { + 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 == num188) + { + 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; + } + } + } + else + { + if (!flies && npc.behindTiles && npc.soundDelay == 0) + { + float num195 = num193 / 40f; + if (num195 < 10f) + { + num195 = 10f; + } + if (num195 > 20f) + { + num195 = 20f; + } + npc.soundDelay = (int)num195; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); + } + 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; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + 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; + } + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flies) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + 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 void BossLoot(ref string name, ref int potionType) + { + potionType = ItemID.None; + } + + 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) + { + scale = 1.5f; + 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/DoT"), 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; + 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, 173, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); + player.AddBuff(BuffID.Frostburn, 180, true); + player.AddBuff(BuffID.Darkness, 180, true); + } + } +} diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs index 81950b117d..e6d5cedf37 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs @@ -1,1227 +1,1227 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using CalamityMod.Tiles; -using CalamityMod.World; - -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 int phaseSwitch = 0; - private int[] shotSpacing = new int[4] { 1050, 1050, 1050, 1050 }; - private const int spacingVar = 105; - private const int totalShots = 20; - private int idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; - public int laserWallPhase = 0; - private int laserWallCounter = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } - - public override void SetDefaults() - { - npc.damage = 300; //150 - npc.npcSlots = 5f; - npc.width = 100; //130 - npc.height = 144; //150 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 1875000 : 1650000; //720000 672000 - if (CalamityWorld.death) - { - npc.lifeMax = 3060000; - } - if (CalamityWorld.bossRushActive) - { - 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.knockBackResist = 0f; - npc.boss = true; - npc.value = Item.buyPrice(1, 0, 0, 0); - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = 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"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(halfLife); - writer.Write(flameTimer); - writer.Write(laserShoot); - writer.Write(phaseSwitch); - writer.Write(shotSpacing[0]); - writer.Write(shotSpacing[1]); - writer.Write(shotSpacing[2]); - writer.Write(shotSpacing[3]); - writer.Write(idleCounter); - writer.Write(laserWallPhase); - writer.Write(laserWallCounter); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - halfLife = reader.ReadBoolean(); - flameTimer = reader.ReadInt32(); - laserShoot = reader.ReadInt32(); - phaseSwitch = reader.ReadInt32(); - shotSpacing[0] = reader.ReadInt32(); - shotSpacing[1] = reader.ReadInt32(); - shotSpacing[2] = reader.ReadInt32(); - shotSpacing[3] = reader.ReadInt32(); - idleCounter = reader.ReadInt32(); - laserWallPhase = reader.ReadInt32(); - laserWallCounter = reader.ReadInt32(); - } - - public override void BossHeadRotation(ref float rotation) - { - 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 (laserWallPhase == 0) //start laser wall phase - { - if (Main.netMode != 1) - { - laserWallCounter += 1; - if (laserWallCounter >= 720) - { - laserWallCounter = 0; - laserWallPhase = 1; - } - } - } - else if (laserWallPhase == 1) //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) - { - laserWallPhase = 2; - idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; - } - } - } - else if (laserWallPhase == 2) //turn visible - { - npc.alpha -= 1; - if (npc.alpha <= 0) - { - if (flameTimer < 270) - { - flameTimer = 270; - } - npc.alpha = 0; - laserWallPhase = 0; - } - } - } - else - { - npc.alpha -= 6; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (laserWallPhase > 0) - { - laserWallPhase = 0; - } - } - if (speedBoost4) - { - if (!halfLife) - { - string key = "Mods.CalamityMod.EdgyBossText11"; - Color messageColor = Color.Cyan; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - halfLife = 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 (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 (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 && (laserWallPhase == 1 || 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 + (float)shotSpacing[0], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + (float)shotSpacing[0], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - 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 + (float)shotSpacing[3], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + (float)shotSpacing[3], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[3] -= (Main.rand.Next(2) == 0 ? 180 : 200); - } - shotSpacing[3] = 1050; - } - shotSpacing[0] = 1050; - } - 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 + (float)shotSpacing[1], Main.player[npc.target].position.Y + 1000f, 0f, -speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[1] -= spacingVar; //105 - } - shotSpacing[1] = 1050; - } - 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 + (float)shotSpacing[2], Main.player[npc.target].position.Y - 1000f, 0f, speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[2] -= spacingVar; //105 - } - shotSpacing[2] = 1050; - } - } - } - if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsTailS"))) - { - npc.active = false; - } - float fallSpeed = 16f; - if (Main.player[npc.target].dead) - { - flies = true; - npc.velocity.Y = npc.velocity.Y - 3f; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - npc.velocity.Y = npc.velocity.Y - 3f; - fallSpeed = 32f; - } - if ((double)npc.position.Y < Main.topWorld + 16f) - { - 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; - 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 (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); - } - } - phaseSwitch += 1; - 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 += 9; - } - 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); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 800); - if (Main.player[npc.target].position.Y > num47) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 600f; - } - else - { - num191 = Main.player[npc.target].Center.X - 600f; - } - } - } - } - else - { - num188 = homingSpeed; - num189 = homingTurnSpeed; - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - 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 - { - 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; - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (phaseSwitch > ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 600 : 900)) - { - npc.ai[2] = 1f; - phaseSwitch = 0; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[2] == 1f) - { - 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); - } - } - phaseSwitch += 1; - 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++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flies = true; - break; - } - } - } - } - } - if (!flies) - { - 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; - } - bool flag95 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - 1000, (int)Main.player[num955].position.Y - 1000, 2000, num954); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flies = true; - } - } - } - 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); - 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 - { - if (!flies) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + turnSpeed; //turnspeed * 0.5f - if (npc.velocity.Y > fallSpeed) - { - npc.velocity.Y = fallSpeed; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 2.2) //max speed - { - 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; - } - } - } - 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; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flies) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (phaseSwitch > ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 600 : 900)) - { - npc.ai[2] = 0f; - phaseSwitch = 0; - npc.netUpdate = true; - return; - } - 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; - } - } - } - - 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") || 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) - { - string key = "Mods.CalamityMod.EdgyBossText2"; - Color messageColor = Color.Cyan; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - damage = 0; - return false; - } - return true; - } - - 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); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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"), 300, true); - player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); - if ((CalamityWorld.death || CalamityWorld.bossRushActive) && npc.alpha <= 0) - { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } - int num = Main.rand.Next(5); - string key = "Mods.CalamityMod.EdgyBossText3"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText3"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText4"; - } - else if (num == 2) - { - key = "Mods.CalamityMod.EdgyBossText5"; - } - else if (num == 3) - { - key = "Mods.CalamityMod.EdgyBossText6"; - } - else if (num == 4) - { - key = "Mods.CalamityMod.EdgyBossText7"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - player.AddBuff(BuffID.Frostburn, 300, true); - player.AddBuff(BuffID.Darkness, 300, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.World; + +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 int phaseSwitch = 0; + private int[] shotSpacing = new int[4] { 1050, 1050, 1050, 1050 }; + private const int spacingVar = 105; + private const int totalShots = 20; + private int idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; + public int laserWallPhase = 0; + private int laserWallCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } + + public override void SetDefaults() + { + npc.damage = 300; //150 + npc.npcSlots = 5f; + npc.width = 100; //130 + npc.height = 144; //150 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 1875000 : 1650000; //720000 672000 + if (CalamityWorld.death) + { + npc.lifeMax = 3060000; + } + if (CalamityWorld.bossRushActive) + { + 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.knockBackResist = 0f; + npc.boss = true; + npc.value = Item.buyPrice(1, 0, 0, 0); + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = 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"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(halfLife); + writer.Write(flameTimer); + writer.Write(laserShoot); + writer.Write(phaseSwitch); + writer.Write(shotSpacing[0]); + writer.Write(shotSpacing[1]); + writer.Write(shotSpacing[2]); + writer.Write(shotSpacing[3]); + writer.Write(idleCounter); + writer.Write(laserWallPhase); + writer.Write(laserWallCounter); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + halfLife = reader.ReadBoolean(); + flameTimer = reader.ReadInt32(); + laserShoot = reader.ReadInt32(); + phaseSwitch = reader.ReadInt32(); + shotSpacing[0] = reader.ReadInt32(); + shotSpacing[1] = reader.ReadInt32(); + shotSpacing[2] = reader.ReadInt32(); + shotSpacing[3] = reader.ReadInt32(); + idleCounter = reader.ReadInt32(); + laserWallPhase = reader.ReadInt32(); + laserWallCounter = reader.ReadInt32(); + } + + public override void BossHeadRotation(ref float rotation) + { + 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 (laserWallPhase == 0) //start laser wall phase + { + if (Main.netMode != 1) + { + laserWallCounter += 1; + if (laserWallCounter >= 720) + { + laserWallCounter = 0; + laserWallPhase = 1; + } + } + } + else if (laserWallPhase == 1) //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) + { + laserWallPhase = 2; + idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; + } + } + } + else if (laserWallPhase == 2) //turn visible + { + npc.alpha -= 1; + if (npc.alpha <= 0) + { + if (flameTimer < 270) + { + flameTimer = 270; + } + npc.alpha = 0; + laserWallPhase = 0; + } + } + } + else + { + npc.alpha -= 6; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (laserWallPhase > 0) + { + laserWallPhase = 0; + } + } + if (speedBoost4) + { + if (!halfLife) + { + string key = "Mods.CalamityMod.EdgyBossText11"; + Color messageColor = Color.Cyan; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + halfLife = 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 (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 (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 && (laserWallPhase == 1 || 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 + (float)shotSpacing[0], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + (float)shotSpacing[0], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + 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 + (float)shotSpacing[3], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + (float)shotSpacing[3], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[3] -= (Main.rand.Next(2) == 0 ? 180 : 200); + } + shotSpacing[3] = 1050; + } + shotSpacing[0] = 1050; + } + 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 + (float)shotSpacing[1], Main.player[npc.target].position.Y + 1000f, 0f, -speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[1] -= spacingVar; //105 + } + shotSpacing[1] = 1050; + } + 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 + (float)shotSpacing[2], Main.player[npc.target].position.Y - 1000f, 0f, speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[2] -= spacingVar; //105 + } + shotSpacing[2] = 1050; + } + } + } + if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsTailS"))) + { + npc.active = false; + } + float fallSpeed = 16f; + if (Main.player[npc.target].dead) + { + flies = true; + npc.velocity.Y = npc.velocity.Y - 3f; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + npc.velocity.Y = npc.velocity.Y - 3f; + fallSpeed = 32f; + } + if ((double)npc.position.Y < Main.topWorld + 16f) + { + 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; + 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 (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); + } + } + phaseSwitch += 1; + 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 += 9; + } + 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); + int num42 = -1; + int num43 = (int)(Main.player[npc.target].Center.X / 16f); + int num44 = (int)(Main.player[npc.target].Center.Y / 16f); + for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) + { + for (int num46 = num44; num46 <= num44 + 15; num46++) + { + if (WorldGen.SolidTile2(num45, num46)) + { + num42 = num46; + break; + } + } + if (num42 > 0) + { + break; + } + } + if (num42 > 0) + { + num42 *= 16; + float num47 = (float)(num42 - 800); + if (Main.player[npc.target].position.Y > num47) + { + num192 = num47; + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) + { + if (npc.velocity.X > 0f) + { + num191 = Main.player[npc.target].Center.X + 600f; + } + else + { + num191 = Main.player[npc.target].Center.X - 600f; + } + } + } + } + else + { + num188 = homingSpeed; + num189 = homingTurnSpeed; + } + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + if (num42 > 0) + { + for (int num51 = 0; num51 < 200; num51++) + { + if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) + { + Vector2 vector3 = Main.npc[num51].Center - npc.Center; + if (vector3.Length() < 400f) + { + vector3.Normalize(); + vector3 *= 1000f; + num191 -= vector3.X; + num192 -= vector3.Y; + } + } + } + } + else + { + for (int num52 = 0; num52 < 200; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + } + 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 + { + 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; + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (phaseSwitch > ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 600 : 900)) + { + npc.ai[2] = 1f; + phaseSwitch = 0; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[2] == 1f) + { + 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); + } + } + phaseSwitch += 1; + 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++) + { + for (int num953 = num182; num953 < num183; num953++) + { + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + { + Vector2 vector105; + vector105.X = (float)(num952 * 16); + vector105.Y = (float)(num953 * 16); + if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + { + flies = true; + break; + } + } + } + } + } + if (!flies) + { + 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; + } + bool flag95 = true; + if (npc.position.Y > Main.player[npc.target].position.Y) + { + for (int num955 = 0; num955 < 255; num955++) + { + if (Main.player[num955].active) + { + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - 1000, (int)Main.player[num955].position.Y - 1000, 2000, num954); + if (rectangle12.Intersects(rectangle13)) + { + flag95 = false; + break; + } + } + } + if (flag95) + { + flies = true; + } + } + } + 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); + 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 + { + if (!flies) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + turnSpeed; //turnspeed * 0.5f + if (npc.velocity.Y > fallSpeed) + { + npc.velocity.Y = fallSpeed; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 2.2) //max speed + { + 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; + } + } + } + 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; + } + } + } + } + } + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flies) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 0f; + } + if (phaseSwitch > ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 600 : 900)) + { + npc.ai[2] = 0f; + phaseSwitch = 0; + npc.netUpdate = true; + return; + } + 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; + } + } + } + + 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") || 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) + { + string key = "Mods.CalamityMod.EdgyBossText2"; + Color messageColor = Color.Cyan; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + damage = 0; + return false; + } + return true; + } + + 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); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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"), 300, true); + player.AddBuff(mod.BuffType("WhisperingDeath"), 420, true); + if ((CalamityWorld.death || CalamityWorld.bossRushActive) && npc.alpha <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + int num = Main.rand.Next(5); + string key = "Mods.CalamityMod.EdgyBossText3"; + if (num == 0) + { + key = "Mods.CalamityMod.EdgyBossText3"; + } + else if (num == 1) + { + key = "Mods.CalamityMod.EdgyBossText4"; + } + else if (num == 2) + { + key = "Mods.CalamityMod.EdgyBossText5"; + } + else if (num == 3) + { + key = "Mods.CalamityMod.EdgyBossText6"; + } + else if (num == 4) + { + key = "Mods.CalamityMod.EdgyBossText7"; + } + Color messageColor = Color.Cyan; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + player.AddBuff(BuffID.Frostburn, 300, true); + player.AddBuff(BuffID.Darkness, 300, true); + } + } +} diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs index 2413b744e2..73581b1e46 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs @@ -1,200 +1,200 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - [AutoloadBossHead] - public class DevourerofGodsTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } - - public override void SetDefaults() - { - npc.damage = 150; - npc.npcSlots = 5f; - 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; - } - 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.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - 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; - 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; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - if (npc.alpha != 0) - { - for (int num934 = 0; num934 < 2; num934++) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - 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") || projectile.type == mod.ProjectileType("EidolicWail")) - { - damage /= 4; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGTail"), 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; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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; - } - - 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); - player.AddBuff(mod.BuffType("WhisperingDeath"), 240, true); - int num = Main.rand.Next(2); - string key = "Mods.CalamityMod.EdgyBossText8"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText8"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText9"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - player.AddBuff(BuffID.Frostburn, 180, true); - player.AddBuff(BuffID.Darkness, 180, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + [AutoloadBossHead] + public class DevourerofGodsTail : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } + + public override void SetDefaults() + { + npc.damage = 150; + npc.npcSlots = 5f; + 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; + } + 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.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + 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; + 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; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + 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") || projectile.type == mod.ProjectileType("EidolicWail")) + { + damage /= 4; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGTail"), 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; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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; + } + + 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); + player.AddBuff(mod.BuffType("WhisperingDeath"), 240, true); + int num = Main.rand.Next(2); + string key = "Mods.CalamityMod.EdgyBossText8"; + if (num == 0) + { + key = "Mods.CalamityMod.EdgyBossText8"; + } + else if (num == 1) + { + key = "Mods.CalamityMod.EdgyBossText9"; + } + Color messageColor = Color.Cyan; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + player.AddBuff(BuffID.Frostburn, 180, true); + player.AddBuff(BuffID.Darkness, 180, true); + } + } +} diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs index ea68c1c2fd..cef8419870 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs @@ -1,163 +1,163 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - public class DevourerofGodsTail2 : ModNPC - { - public int invinceTime = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Guardian"); - } - - public override void SetDefaults() - { - npc.damage = 100; - npc.npcSlots = 5f; - npc.width = 30; //42 - npc.height = 50; //42 - npc.defense = 0; - npc.lifeMax = 100000; //192000 - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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 (invinceTime > 0) - { - invinceTime--; - npc.damage = 0; - npc.dontTakeDamage = true; - } - else - { - npc.damage = Main.expertMode ? 200 : 100; - 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) - { - int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT3"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT4"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT5"), 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; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(mod.BuffType("GodSlayerInferno"), 90, true); - player.AddBuff(BuffID.Frostburn, 90, true); - player.AddBuff(BuffID.Darkness, 90, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DevourerofGodsTail2 : ModNPC + { + public int invinceTime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Guardian"); + } + + public override void SetDefaults() + { + npc.damage = 100; + npc.npcSlots = 5f; + npc.width = 30; //42 + npc.height = 50; //42 + npc.defense = 0; + npc.lifeMax = 100000; //192000 + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new + npc.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.dontCountMe = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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 (invinceTime > 0) + { + invinceTime--; + npc.damage = 0; + npc.dontTakeDamage = true; + } + else + { + npc.damage = Main.expertMode ? 200 : 100; + 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) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default(Color), 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + npc.alpha -= 42; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT4"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoT5"), 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; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override bool CheckActive() + { + return false; + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(mod.BuffType("GodSlayerInferno"), 90, true); + player.AddBuff(BuffID.Frostburn, 90, true); + player.AddBuff(BuffID.Darkness, 90, true); + } + } +} diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs index 0157b3bd96..2d92e8582b 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs @@ -1,519 +1,519 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - [AutoloadBossHead] - public class DevourerofGodsTailS : ModNPC - { - private int beamPortal = 0; - private int invinceTime = 360; - private bool setAlpha = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - } - - public override void SetDefaults() - { - npc.damage = 180; - npc.npcSlots = 5f; - npc.width = 80; //90 - npc.height = 98; //90 - npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 1875000 : 1650000; //720000 672000 - if (CalamityWorld.death) - { - npc.lifeMax = 3060000; - } - if (CalamityWorld.bossRushActive) - { - 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.knockBackResist = 0f; - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - 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; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(beamPortal); - writer.Write(setAlpha); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - beamPortal = reader.ReadInt32(); - setAlpha = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); - } - - 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() - { - 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 (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) - { - npc.active = false; - } - if (Main.netMode != 1) - { - beamPortal += expertMode ? 2 : 1; - if (beamPortal >= 1800) - { - beamPortal = 0; - 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[1]].alpha < 128 && !setAlpha) - { - npc.alpha -= 42; - if (npc.alpha <= 0 && invinceTime <= 0) - { - setAlpha = true; - npc.alpha = 0; - } - } - else - { - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } - 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 = 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); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); - 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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 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() - { - 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); - player.AddBuff(mod.BuffType("WhisperingDeath"), 240, true); - int num = Main.rand.Next(2); - string key = "Mods.CalamityMod.EdgyBossText8"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText8"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText9"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - player.AddBuff(BuffID.Frostburn, 180, true); - player.AddBuff(BuffID.Darkness, 180, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + [AutoloadBossHead] + public class DevourerofGodsTailS : ModNPC + { + private int beamPortal = 0; + private int invinceTime = 360; + private bool setAlpha = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } + + public override void SetDefaults() + { + npc.damage = 180; + npc.npcSlots = 5f; + npc.width = 80; //90 + npc.height = 98; //90 + npc.defense = 0; + npc.lifeMax = CalamityWorld.revenge ? 1875000 : 1650000; //720000 672000 + if (CalamityWorld.death) + { + npc.lifeMax = 3060000; + } + if (CalamityWorld.bossRushActive) + { + 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.knockBackResist = 0f; + npc.alpha = 255; + npc.behindTiles = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit4; + 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(invinceTime); + writer.Write(beamPortal); + writer.Write(setAlpha); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + invinceTime = reader.ReadInt32(); + beamPortal = reader.ReadInt32(); + setAlpha = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + 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() + { + 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 (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) + { + npc.active = false; + } + if (Main.netMode != 1) + { + beamPortal += expertMode ? 2 : 1; + if (beamPortal >= 1800) + { + beamPortal = 0; + 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[1]].alpha < 128 && !setAlpha) + { + npc.alpha -= 42; + if (npc.alpha <= 0 && invinceTime <= 0) + { + setAlpha = true; + npc.alpha = 0; + } + } + else + { + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + 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 = 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); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 50; + npc.height = 50; + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 3f); + 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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 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() + { + 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); + player.AddBuff(mod.BuffType("WhisperingDeath"), 240, true); + int num = Main.rand.Next(2); + string key = "Mods.CalamityMod.EdgyBossText8"; + if (num == 0) + { + key = "Mods.CalamityMod.EdgyBossText8"; + } + else if (num == 1) + { + key = "Mods.CalamityMod.EdgyBossText9"; + } + Color messageColor = Color.Cyan; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + player.AddBuff(BuffID.Frostburn, 180, true); + player.AddBuff(BuffID.Darkness, 180, true); + } + } +} diff --git a/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs b/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs index 5b7e42616c..005e931c60 100644 --- a/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs +++ b/NPCs/TheDevourerofGods/DoGSCreenShaderDataS.cs @@ -1,44 +1,44 @@ -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - public class DoGScreenShaderDataS : ScreenShaderData - { - private int DoGIndex; - - public DoGScreenShaderDataS(string passName) - : base(passName) - { - } - - private void UpdateDoGIndex() - { - int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHeadS"); - if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) - { - return; - } - DoGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == DoGType) - { - DoGIndex = i; - break; - } - } - } - - public override void Apply() - { - UpdateDoGIndex(); - if (DoGIndex != -1) - { - UseTargetPosition(Main.npc[DoGIndex].Center); - } - base.Apply(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DoGScreenShaderDataS : ScreenShaderData + { + private int DoGIndex; + + public DoGScreenShaderDataS(string passName) + : base(passName) + { + } + + private void UpdateDoGIndex() + { + int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHeadS"); + if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) + { + return; + } + DoGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == DoGType) + { + DoGIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateDoGIndex(); + if (DoGIndex != -1) + { + UseTargetPosition(Main.npc[DoGIndex].Center); + } + base.Apply(); + } + } +} diff --git a/NPCs/TheDevourerofGods/DoGScreenShaderData.cs b/NPCs/TheDevourerofGods/DoGScreenShaderData.cs index 187af65d27..2a0487febf 100644 --- a/NPCs/TheDevourerofGods/DoGScreenShaderData.cs +++ b/NPCs/TheDevourerofGods/DoGScreenShaderData.cs @@ -1,44 +1,44 @@ -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - public class DoGScreenShaderData : ScreenShaderData - { - private int DoGIndex; - - public DoGScreenShaderData(string passName) - : base(passName) - { - } - - private void UpdateDoGIndex() - { - int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHead"); - if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) - { - return; - } - DoGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == DoGType) - { - DoGIndex = i; - break; - } - } - } - - public override void Apply() - { - UpdateDoGIndex(); - if (DoGIndex != -1) - { - UseTargetPosition(Main.npc[DoGIndex].Center); - } - base.Apply(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DoGScreenShaderData : ScreenShaderData + { + private int DoGIndex; + + public DoGScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateDoGIndex() + { + int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHead"); + if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) + { + return; + } + DoGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == DoGType) + { + DoGIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateDoGIndex(); + if (DoGIndex != -1) + { + UseTargetPosition(Main.npc[DoGIndex].Center); + } + base.Apply(); + } + } +} diff --git a/NPCs/TheDevourerofGods/DoGSky.cs b/NPCs/TheDevourerofGods/DoGSky.cs index 3b3e75ea86..22b36ce26a 100644 --- a/NPCs/TheDevourerofGods/DoGSky.cs +++ b/NPCs/TheDevourerofGods/DoGSky.cs @@ -1,113 +1,113 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - public class DoGSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int DoGIndex = -1; - - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } - - private float GetIntensity() - { - if (this.UpdateDoGIndex()) - { - float x = 0f; - if (this.DoGIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.DoGIndex].Center); - } - return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.5f; - } - return 0.5f; - } - - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } - - private bool UpdateDoGIndex() - { - int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHead"); - if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) - { - return true; - } - DoGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == DoGType) - { - DoGIndex = i; - break; - } - } - return DoGIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead != -1) - { - if (Main.npc[CalamityGlobalNPC.DoGHead].active) - { - float intensity = this.GetIntensity(); - if ((double)Main.npc[CalamityGlobalNPC.DoGHead].life < (double)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax * 0.15 || CalamityWorld.death) - { - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), - Color.Black * (intensity + 0.5f)); - } - else - { - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), - (Main.npc[CalamityGlobalNPC.DoGHead].ai[2] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); - } - } - } - } - - public override float GetCloudAlpha() - { - return 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } - - public override void Deactivate(params object[] args) - { - isActive = false; - } - - public override void Reset() - { - isActive = false; - } - - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DoGSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int DoGIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdateDoGIndex()) + { + float x = 0f; + if (this.DoGIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.DoGIndex].Center); + } + return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.5f; + } + return 0.5f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateDoGIndex() + { + int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHead"); + if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) + { + return true; + } + DoGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == DoGType) + { + DoGIndex = i; + break; + } + } + return DoGIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead != -1) + { + if (Main.npc[CalamityGlobalNPC.DoGHead].active) + { + float intensity = this.GetIntensity(); + if ((double)Main.npc[CalamityGlobalNPC.DoGHead].life < (double)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax * 0.15 || CalamityWorld.death) + { + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), + Color.Black * (intensity + 0.5f)); + } + else + { + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), + (Main.npc[CalamityGlobalNPC.DoGHead].ai[2] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); + } + } + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} diff --git a/NPCs/TheDevourerofGods/DoGSkyS.cs b/NPCs/TheDevourerofGods/DoGSkyS.cs index 2ffd922e88..88147a7030 100644 --- a/NPCs/TheDevourerofGods/DoGSkyS.cs +++ b/NPCs/TheDevourerofGods/DoGSkyS.cs @@ -1,113 +1,113 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TheDevourerofGods -{ - public class DoGSkyS : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int DoGIndex = -1; - - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } - - private float GetIntensity() - { - if (this.UpdateDoGIndex()) - { - float x = 0f; - if (this.DoGIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.DoGIndex].Center); - } - return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.5f; - } - return 0.5f; - } - - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } - - private bool UpdateDoGIndex() - { - int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHeadS"); - if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) - { - return true; - } - DoGIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == DoGType) - { - DoGIndex = i; - break; - } - } - return DoGIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead != -1) - { - if (Main.npc[CalamityGlobalNPC.DoGHead].active) - { - float intensity = this.GetIntensity(); - if ((double)Main.npc[CalamityGlobalNPC.DoGHead].life < (double)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax * 0.15 || CalamityWorld.death) - { - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), - Color.Black * (intensity + 0.5f)); - } - else - { - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), - (Main.npc[CalamityGlobalNPC.DoGHead].ai[2] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); - } - } - } - } - - public override float GetCloudAlpha() - { - return 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } - - public override void Deactivate(params object[] args) - { - isActive = false; - } - - public override void Reset() - { - isActive = false; - } - - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TheDevourerofGods +{ + public class DoGSkyS : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int DoGIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdateDoGIndex()) + { + float x = 0f; + if (this.DoGIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.DoGIndex].Center); + } + return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.5f; + } + return 0.5f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateDoGIndex() + { + int DoGType = ModLoader.GetMod("CalamityMod").NPCType("DevourerofGodsHeadS"); + if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType) + { + return true; + } + DoGIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == DoGType) + { + DoGIndex = i; + break; + } + } + return DoGIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead != -1) + { + if (Main.npc[CalamityGlobalNPC.DoGHead].active) + { + float intensity = this.GetIntensity(); + if ((double)Main.npc[CalamityGlobalNPC.DoGHead].life < (double)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax * 0.15 || CalamityWorld.death) + { + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), + Color.Black * (intensity + 0.5f)); + } + else + { + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), + (Main.npc[CalamityGlobalNPC.DoGHead].ai[2] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); + } + } + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index 08e95eda6c..a3c07f1d2d 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -1,190 +1,190 @@ -using System.Collections.Generic; -using Terraria; -using Terraria.GameContent.Events; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TownNPCs -{ - [AutoloadHead] - public class DILF : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Archmage"); - - Main.npcFrameCount[npc.type] = 25; - NPCID.Sets.ExtraFramesCount[npc.type] = 9; - NPCID.Sets.AttackFrameCount[npc.type] = 4; - NPCID.Sets.DangerDetectRange[npc.type] = 700; - NPCID.Sets.AttackType[npc.type] = 0; - NPCID.Sets.AttackTime[npc.type] = 90; - NPCID.Sets.AttackAverageChance[npc.type] = 30; - } - - public override void SetDefaults() - { - npc.townNPC = true; - npc.friendly = true; - npc.lavaImmune = true; - npc.width = 18; - npc.height = 40; - npc.aiStyle = 7; - npc.damage = 10; - npc.defense = 15; - npc.lifeMax = 20000; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.8f; - animationType = NPCID.Guide; - } - - public override bool CanTownNPCSpawn(int numTownNPCs, int money) - { - return CalamityWorld.downedCryogen; - } - - public override string TownNPCName() - { - return "Permafrost"; - } - - public override string GetChat() - { - if (npc.homeless) //not sure how to check if he has ever found a home before (to make this dialogue only run when he first spawns) - { - if (Main.rand.Next(2) == 0) - return "I deeply appreciate you rescuing me from being trapped within my frozen castle…. It's been many, many years..."; - else - return "Thank you for saving me...though now I admit I am without a home since mine got destroyed."; - } - - IList dialogue = new List(); - - if (Main.dayTime) - { - dialogue.Add("I must admit...I am not quite used to this weather. It's too warm for my taste..."); - dialogue.Add("My dear! What is it you would like to talk about today?"); - dialogue.Add("Why...I don't have to worry about any time of the day! If it is hot...then I can use my ice magic to cool down!"); - dialogue.Add("I do usually prefer a spot of humidity for my ice magic. It likes to come out as steam when it's too hot and dry..."); - dialogue.Add("Magic is a skill that must be learned and practiced! You seem to have an inherent talent for it at your age. I have spent all of my life honing it..."); - dialogue.Add("Why ice magic, you ask? Well, my parents were both pyromaniacs..."); - } - else - { - dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); - dialogue.Add("You could break the icy stillness in the air tonight."); - dialogue.Add("Hmm...some would say that an unforeseen outside force is the root of the blood moon..."); - dialogue.Add("I was once the greatest Archmage of ice that ever hailed the lands. Whether or not that is still applicable, I am not sure..."); - dialogue.Add("There used to be other Archmages of other elements. I wonder where they are now...if they are also alive..."); - dialogue.Add("Oh...I wish I could tell you all about my life and the lessons I have learned, but it appears you have a great many things to do..."); - } - - dialogue.Add("I assure you, I will do my best to act as the cool grandfather figure you always wanted."); - - if (BirthdayParty.PartyIsUp) - dialogue.Add("Sometimes...I feel like all I'm good for during these events is making ice cubes and slushies."); - - if (NPC.downedMoonlord) - { - dialogue.Add("Tread carefully, my friend... Now that the Moon Lord has been defeated, many powerful creatures will crawl out to challenge you..."); - dialogue.Add("I feel the balance of nature tilting farther than ever before. Is it due to you, or because of the events leading to now...?"); - } - - if (CalamityWorld.downedPolterghast) - dialogue.Add("I felt a sudden chill down my spine. I sense something dangerous stirring in the Abyss..."); - - if (CalamityWorld.downedYharon) - dialogue.Add("...Where is Lord Yharim? He must be up to something..."); - - int dryad = NPC.FindFirstNPC(NPCID.Dryad); - if (dryad != -1) - dialogue.Add("Yes, I am older than " + Main.npc[dryad].GivenName + ". You can stop asking now..."); - - if (Main.player[Main.myPlayer].GetModPlayer().chibii) - dialogue.Add("What an adorable tiny companion you have! Where in the world did you find such a...creature...? Actually, I'd rather not know."); - - if (Main.player[Main.myPlayer].GetModPlayer().cryogenSoul) - dialogue.Add(Main.player[Main.myPlayer].name + "...just between us, I think I forgot my soul in the ice castle. If you see it, please do let me know."); - - if (CalamityWorld.spawnAstralMeteor) - dialogue.Add("It wouldn't be the first time something unknown and powerful dropped from the heavens...I would tread carefully if I were you..."); - - return dialogue[Main.rand.Next(dialogue.Count)]; - } - - public override void SetChatButtons(ref string button, ref string button2) - { - button = Language.GetTextValue("LegacyInterface.28"); - } - - public override void OnChatButtonClicked(bool firstButton, ref bool shop) - { - if (firstButton) - shop = true; - } - - public override void SetupShop(Chest shop, ref int nextSlot) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("ColdheartIcicle")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("AbsoluteZero")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("FrostbiteBlaster")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("EternalBlizzard")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("WintersFury")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("ArcticBearPaw")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("IcicleTrident")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("FrostyFlare")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("CryogenicStaff")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("PermafrostsConcoction")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("IcyBullet")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("IcicleArrow")); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.SuperManaPotion); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("DeliciousMeat")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("EnchantedMetal")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("BearEye")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("Popo")); - nextSlot++; - } - - public override void TownNPCAttackStrength(ref int damage, ref float knockback) - { - damage = 20; - knockback = 9f; - } - - public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) - { - cooldown = 10; - randExtraCooldown = 50; - } - - public override void TownNPCAttackProj(ref int projType, ref int attackDelay) - { - projType = mod.ProjectileType("DarkIce"); - attackDelay = 1; - } - - public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) - { - multiplier = 2f; - } - } -} +using System.Collections.Generic; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TownNPCs +{ + [AutoloadHead] + public class DILF : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Archmage"); + + Main.npcFrameCount[npc.type] = 25; + NPCID.Sets.ExtraFramesCount[npc.type] = 9; + NPCID.Sets.AttackFrameCount[npc.type] = 4; + NPCID.Sets.DangerDetectRange[npc.type] = 700; + NPCID.Sets.AttackType[npc.type] = 0; + NPCID.Sets.AttackTime[npc.type] = 90; + NPCID.Sets.AttackAverageChance[npc.type] = 30; + } + + public override void SetDefaults() + { + npc.townNPC = true; + npc.friendly = true; + npc.lavaImmune = true; + npc.width = 18; + npc.height = 40; + npc.aiStyle = 7; + npc.damage = 10; + npc.defense = 15; + npc.lifeMax = 20000; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.8f; + animationType = NPCID.Guide; + } + + public override bool CanTownNPCSpawn(int numTownNPCs, int money) + { + return CalamityWorld.downedCryogen; + } + + public override string TownNPCName() + { + return "Permafrost"; + } + + public override string GetChat() + { + if (npc.homeless) //not sure how to check if he has ever found a home before (to make this dialogue only run when he first spawns) + { + if (Main.rand.Next(2) == 0) + return "I deeply appreciate you rescuing me from being trapped within my frozen castle…. It's been many, many years..."; + else + return "Thank you for saving me...though now I admit I am without a home since mine got destroyed."; + } + + IList dialogue = new List(); + + if (Main.dayTime) + { + dialogue.Add("I must admit...I am not quite used to this weather. It's too warm for my taste..."); + dialogue.Add("My dear! What is it you would like to talk about today?"); + dialogue.Add("Why...I don't have to worry about any time of the day! If it is hot...then I can use my ice magic to cool down!"); + dialogue.Add("I do usually prefer a spot of humidity for my ice magic. It likes to come out as steam when it's too hot and dry..."); + dialogue.Add("Magic is a skill that must be learned and practiced! You seem to have an inherent talent for it at your age. I have spent all of my life honing it..."); + dialogue.Add("Why ice magic, you ask? Well, my parents were both pyromaniacs..."); + } + else + { + dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); + dialogue.Add("You could break the icy stillness in the air tonight."); + dialogue.Add("Hmm...some would say that an unforeseen outside force is the root of the blood moon..."); + dialogue.Add("I was once the greatest Archmage of ice that ever hailed the lands. Whether or not that is still applicable, I am not sure..."); + dialogue.Add("There used to be other Archmages of other elements. I wonder where they are now...if they are also alive..."); + dialogue.Add("Oh...I wish I could tell you all about my life and the lessons I have learned, but it appears you have a great many things to do..."); + } + + dialogue.Add("I assure you, I will do my best to act as the cool grandfather figure you always wanted."); + + if (BirthdayParty.PartyIsUp) + dialogue.Add("Sometimes...I feel like all I'm good for during these events is making ice cubes and slushies."); + + if (NPC.downedMoonlord) + { + dialogue.Add("Tread carefully, my friend... Now that the Moon Lord has been defeated, many powerful creatures will crawl out to challenge you..."); + dialogue.Add("I feel the balance of nature tilting farther than ever before. Is it due to you, or because of the events leading to now...?"); + } + + if (CalamityWorld.downedPolterghast) + dialogue.Add("I felt a sudden chill down my spine. I sense something dangerous stirring in the Abyss..."); + + if (CalamityWorld.downedYharon) + dialogue.Add("...Where is Lord Yharim? He must be up to something..."); + + int dryad = NPC.FindFirstNPC(NPCID.Dryad); + if (dryad != -1) + dialogue.Add("Yes, I am older than " + Main.npc[dryad].GivenName + ". You can stop asking now..."); + + if (Main.player[Main.myPlayer].GetModPlayer().chibii) + dialogue.Add("What an adorable tiny companion you have! Where in the world did you find such a...creature...? Actually, I'd rather not know."); + + if (Main.player[Main.myPlayer].GetModPlayer().cryogenSoul) + dialogue.Add(Main.player[Main.myPlayer].name + "...just between us, I think I forgot my soul in the ice castle. If you see it, please do let me know."); + + if (CalamityWorld.spawnAstralMeteor) + dialogue.Add("It wouldn't be the first time something unknown and powerful dropped from the heavens...I would tread carefully if I were you..."); + + return dialogue[Main.rand.Next(dialogue.Count)]; + } + + public override void SetChatButtons(ref string button, ref string button2) + { + button = Language.GetTextValue("LegacyInterface.28"); + } + + public override void OnChatButtonClicked(bool firstButton, ref bool shop) + { + if (firstButton) + shop = true; + } + + public override void SetupShop(Chest shop, ref int nextSlot) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("ColdheartIcicle")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("AbsoluteZero")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("FrostbiteBlaster")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("EternalBlizzard")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("WintersFury")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("ArcticBearPaw")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("IcicleTrident")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("FrostyFlare")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("CryogenicStaff")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("PermafrostsConcoction")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("IcyBullet")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("IcicleArrow")); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.SuperManaPotion); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("DeliciousMeat")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("EnchantedMetal")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("BearEye")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("Popo")); + nextSlot++; + } + + public override void TownNPCAttackStrength(ref int damage, ref float knockback) + { + damage = 20; + knockback = 9f; + } + + public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) + { + cooldown = 10; + randExtraCooldown = 50; + } + + public override void TownNPCAttackProj(ref int projType, ref int attackDelay) + { + projType = mod.ProjectileType("DarkIce"); + attackDelay = 1; + } + + public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) + { + multiplier = 2f; + } + } +} diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index a4b34edd50..9ff3d049ee 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -1,372 +1,372 @@ -using System.Collections.Generic; -using Terraria; -using Terraria.GameContent.Events; -using Terraria.Localization; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TownNPCs -{ - [AutoloadHead] - public class FAP : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Drunk Princess"); - - Main.npcFrameCount[npc.type] = 25; - NPCID.Sets.ExtraFramesCount[npc.type] = 9; - NPCID.Sets.AttackFrameCount[npc.type] = 4; - NPCID.Sets.DangerDetectRange[npc.type] = 400; - NPCID.Sets.AttackType[npc.type] = 0; - NPCID.Sets.AttackTime[npc.type] = 60; - NPCID.Sets.AttackAverageChance[npc.type] = 15; - } - - public override void SetDefaults() - { - npc.townNPC = true; - npc.friendly = true; - npc.lavaImmune = true; - npc.width = 18; - npc.height = 40; - npc.aiStyle = 7; - npc.damage = 10; - npc.defense = 15; - npc.lifeMax = 20000; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath6; - npc.knockBackResist = 0.5f; - animationType = NPCID.Guide; - } - - public override bool CanTownNPCSpawn(int numTownNPCs, int money) - { - for (int k = 0; k < 255; k++) - { - Player player = Main.player[k]; - if (player.active) - { - for (int j = 0; j < player.inventory.Length; j++) - { - if (player.inventory[j].type == mod.ItemType("FabsolsVodka")) - { - return Main.hardMode; - } - } - } - } - return false; - } - - public override string TownNPCName() - { - return "Cirrus"; - } - - public override string GetChat() - { - if (CalamityWorld.bossRushActive) - return "We expect you to turn in a perfect performance!"; - - if (npc.homeless) - { - if (Main.rand.Next(2) == 0) - return "I could smell my vodka from MILES away!"; - else - return "Have any spare rooms available? Preferably candle-lit with a hefty supply of booze."; - } - - if (Main.bloodMoon) - { - int random = Main.rand.Next(4); - if (random == 0) - { - return "Hey! Nice night. I'm gonna make some Bloody Marys. Celery included. Want one?"; - } - else if (random == 1) - { - return "More blood for the blood gods!"; - } - else if (random == 2) - { - return "Everyone else is so rude tonight. If they don't get over it soon I'll break down their doors and make them!"; - } - else - { - Main.player[Main.myPlayer].Hurt(PlayerDeathReason.ByOther(4), Main.player[Main.myPlayer].statLife / 2, -Main.player[Main.myPlayer].direction, false, false, false, -1); - return "Being drunk I have no moral compass atm."; - } - } - - if (CalamityGlobalNPC.AnyBossNPCS()) - return "Nothard/10, if I fight bosses I wanna feel like screaming 'OH YES DADDY!' while I die repeatedly."; - - IList dialogue = new List(); - - if (Main.dayTime) - { - dialogue.Add("Like I always say, when you're drunk you can put up with a lot more."); - dialogue.Add("I'm literally balls drunk off my sass right now."); - dialogue.Add("I'm either laughing because I'm drunk or because I've lost my mind. Probably both."); - dialogue.Add("When I'm drunk I'm way happier...at least until the talking worms start to appear."); - dialogue.Add("I should reprogram the whole game while drunk and send it back to the testers."); - dialogue.Add("What a great day, might just drink so much that I get poisoned again."); - } - else - { - dialogue.Add("Now I want to get alcohol, first drinks are on me!"); - dialogue.Add("Here's a challenge...take a drink whenever you take a hit. Oh wait, you'd die."); - dialogue.Add("Well I was planning to light some candles in order to relax...ah well, time to program while drunk."); - dialogue.Add("Yes, everyone knows the mechworm is buggy."); - dialogue.Add("That's west, " + Main.player[Main.myPlayer].name + ". You're fired again."); - dialogue.Add("Are you sure you're 21? ...alright, fine, but don't tell anyone I sold you this."); - } - - dialogue.Add("Drink something that turns you into a magical flying unicorn so you can be super gay."); - dialogue.Add("Did anyone ever tell you that large assets cause back pain? Well, they were right."); - - if (BirthdayParty.PartyIsUp) - dialogue.Add("You'll always find me at parties where booze is involved...well, you'll always find booze where I'm involved."); - - if (Main.invasionType == 4) - dialogue.Add("Shoot down the space invaders! Sexy time will be postponed if we are invaded by UFOs!"); - - if (CalamityWorld.downedCryogen) - dialogue.Add("God I can't wait to beat on some ice again!"); - - if (CalamityWorld.downedLeviathan) - dialogue.Add("Only things I am attracted to are fish women, women, men who look like women, and that's it."); - - if (NPC.downedMoonlord) - { - dialogue.Add("I'll always be watching."); - dialogue.Add("Why did one creature need that many tentacles? ...actually, don't answer that."); - if (Main.raining) - { - dialogue.Add("There's chemicals in the water...and it's turning the frogs gay!"); - } - } - - if (CalamityWorld.downedPolterghast) - dialogue.Add("I saw a ghost down by the old train tracks once flailing wildly at the lily pads, those were the days."); - - if (CalamityWorld.downedDoG) - dialogue.Add("I hear it's amazing when the famous purple-stuffed worm out in flap-jaw space with the tuning fork does a raw blink on Hara-kiri rock. I need scissors! 61!"); - - int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); - if (tavernKeep != -1) - { - dialogue.Add("Tell " + Main.npc[tavernKeep].GivenName + " to stop calling me. He’s not wanted."); - dialogue.Add("My booze will always be better than " + Main.npc[tavernKeep].GivenName + "'s and nobody can convince me otherwise."); - } - - int dryad = NPC.FindFirstNPC(NPCID.Dryad); - if (dryad != -1) - dialogue.Add(Main.npc[dryad].GivenName + " is cool too but she'd outlive me."); - - int permadong = NPC.FindFirstNPC(mod.NPCType("DILF")); - if (permadong != -1) - dialogue.Add("I never realized how well-endowed " + Main.npc[permadong].GivenName + " was. It had to be the largest icicle I had ever seen."); - - int waifu = NPC.FindFirstNPC(NPCID.Stylist); - if (waifu != -1) - { - dialogue.Add("You still can't stop me from selling alcohol and trying to move in with " + Main.npc[waifu].GivenName + "."); - dialogue.Add("I love it when " + Main.npc[waifu].GivenName + "'s hands get sticky from all that...wax."); - dialogue.Add(Main.npc[waifu].GivenName + " works wonders for my hair...among other things."); - } - - if (Main.player[Main.myPlayer].GetModPlayer().chibii) - dialogue.Add("Is that a toy? Looks like something I'd carry around if I was 5 years old."); - - if ((Main.player[Main.myPlayer].GetModPlayer().sirenBoobs && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsHide) || - (Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAlt && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAltHide)) - dialogue.Add("Nice...scales...did it get hot in here?"); - - if (Main.player[Main.myPlayer].GetModPlayer().fabsolVodka) - dialogue.Add("Oh yeah now you're drinking the good stuff! Do you like it? I created the recipe by mixing fairy dust, crystals, and other magical crap."); - - if (Main.player[Main.myPlayer].GetModPlayer().fab) - { - dialogue.Add("...so, you're riding me huh? That's not weird at all."); - dialogue.Add("Are you coming on to me?"); - 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."); - } - - 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 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; - } - else - { - shop = false; - Main.npcChatText = Death(); - } - } - - public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original item value - { - shop.item[nextSlot].SetDefaults(mod.ItemType("GrapeBeer")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("RedWine")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 3, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("Moonshine")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("Vodka")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("Whiskey")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("Tequila")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 7, 50, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("Rum")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 7, 50, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("Fireball")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("Everclear")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("FabsolsVodka")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); - nextSlot++; - - if (Main.bloodMoon) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("BloodyMary")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); - nextSlot++; - } - - if (CalamityWorld.downedAstrageldon && !Main.dayTime) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("StarBeamRye")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); - nextSlot++; - } - - shop.item[nextSlot].SetDefaults(mod.ItemType("Screwdriver")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("MoscowMule")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("WhiteWine")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("EvergreenGin")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("CinnamonRoll")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("TequilaSunrise")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("CaribbeanRum")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("Margarita")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 35, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("BlueCandle")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("PinkCandle")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("PurpleCandle")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("YellowCandle")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); - nextSlot++; - - shop.item[nextSlot].SetDefaults(mod.ItemType("OddMushroom")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(3, 0, 0, 0); - nextSlot++; - } - - public override void TownNPCAttackStrength(ref int damage, ref float knockback) - { - damage = 15; - knockback = 2f; - } - - public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) - { - cooldown = 180; - randExtraCooldown = 60; - } - - public override void TownNPCAttackProj(ref int projType, ref int attackDelay) - { - projType = mod.ProjectileType("FabRay"); - attackDelay = 1; - } - - public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) - { - multiplier = 2f; - } - } -} +using System.Collections.Generic; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.Localization; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TownNPCs +{ + [AutoloadHead] + public class FAP : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Drunk Princess"); + + Main.npcFrameCount[npc.type] = 25; + NPCID.Sets.ExtraFramesCount[npc.type] = 9; + NPCID.Sets.AttackFrameCount[npc.type] = 4; + NPCID.Sets.DangerDetectRange[npc.type] = 400; + NPCID.Sets.AttackType[npc.type] = 0; + NPCID.Sets.AttackTime[npc.type] = 60; + NPCID.Sets.AttackAverageChance[npc.type] = 15; + } + + public override void SetDefaults() + { + npc.townNPC = true; + npc.friendly = true; + npc.lavaImmune = true; + npc.width = 18; + npc.height = 40; + npc.aiStyle = 7; + npc.damage = 10; + npc.defense = 15; + npc.lifeMax = 20000; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.knockBackResist = 0.5f; + animationType = NPCID.Guide; + } + + public override bool CanTownNPCSpawn(int numTownNPCs, int money) + { + for (int k = 0; k < 255; k++) + { + Player player = Main.player[k]; + if (player.active) + { + for (int j = 0; j < player.inventory.Length; j++) + { + if (player.inventory[j].type == mod.ItemType("FabsolsVodka")) + { + return Main.hardMode; + } + } + } + } + return false; + } + + public override string TownNPCName() + { + return "Cirrus"; + } + + public override string GetChat() + { + if (CalamityWorld.bossRushActive) + return "We expect you to turn in a perfect performance!"; + + if (npc.homeless) + { + if (Main.rand.Next(2) == 0) + return "I could smell my vodka from MILES away!"; + else + return "Have any spare rooms available? Preferably candle-lit with a hefty supply of booze."; + } + + if (Main.bloodMoon) + { + int random = Main.rand.Next(4); + if (random == 0) + { + return "Hey! Nice night. I'm gonna make some Bloody Marys. Celery included. Want one?"; + } + else if (random == 1) + { + return "More blood for the blood gods!"; + } + else if (random == 2) + { + return "Everyone else is so rude tonight. If they don't get over it soon I'll break down their doors and make them!"; + } + else + { + Main.player[Main.myPlayer].Hurt(PlayerDeathReason.ByOther(4), Main.player[Main.myPlayer].statLife / 2, -Main.player[Main.myPlayer].direction, false, false, false, -1); + return "Being drunk I have no moral compass atm."; + } + } + + if (CalamityGlobalNPC.AnyBossNPCS()) + return "Nothard/10, if I fight bosses I wanna feel like screaming 'OH YES DADDY!' while I die repeatedly."; + + IList dialogue = new List(); + + if (Main.dayTime) + { + dialogue.Add("Like I always say, when you're drunk you can put up with a lot more."); + dialogue.Add("I'm literally balls drunk off my sass right now."); + dialogue.Add("I'm either laughing because I'm drunk or because I've lost my mind. Probably both."); + dialogue.Add("When I'm drunk I'm way happier...at least until the talking worms start to appear."); + dialogue.Add("I should reprogram the whole game while drunk and send it back to the testers."); + dialogue.Add("What a great day, might just drink so much that I get poisoned again."); + } + else + { + dialogue.Add("Now I want to get alcohol, first drinks are on me!"); + dialogue.Add("Here's a challenge...take a drink whenever you take a hit. Oh wait, you'd die."); + dialogue.Add("Well I was planning to light some candles in order to relax...ah well, time to program while drunk."); + dialogue.Add("Yes, everyone knows the mechworm is buggy."); + dialogue.Add("That's west, " + Main.player[Main.myPlayer].name + ". You're fired again."); + dialogue.Add("Are you sure you're 21? ...alright, fine, but don't tell anyone I sold you this."); + } + + dialogue.Add("Drink something that turns you into a magical flying unicorn so you can be super gay."); + dialogue.Add("Did anyone ever tell you that large assets cause back pain? Well, they were right."); + + if (BirthdayParty.PartyIsUp) + dialogue.Add("You'll always find me at parties where booze is involved...well, you'll always find booze where I'm involved."); + + if (Main.invasionType == 4) + dialogue.Add("Shoot down the space invaders! Sexy time will be postponed if we are invaded by UFOs!"); + + if (CalamityWorld.downedCryogen) + dialogue.Add("God I can't wait to beat on some ice again!"); + + if (CalamityWorld.downedLeviathan) + dialogue.Add("Only things I am attracted to are fish women, women, men who look like women, and that's it."); + + if (NPC.downedMoonlord) + { + dialogue.Add("I'll always be watching."); + dialogue.Add("Why did one creature need that many tentacles? ...actually, don't answer that."); + if (Main.raining) + { + dialogue.Add("There's chemicals in the water...and it's turning the frogs gay!"); + } + } + + if (CalamityWorld.downedPolterghast) + dialogue.Add("I saw a ghost down by the old train tracks once flailing wildly at the lily pads, those were the days."); + + if (CalamityWorld.downedDoG) + dialogue.Add("I hear it's amazing when the famous purple-stuffed worm out in flap-jaw space with the tuning fork does a raw blink on Hara-kiri rock. I need scissors! 61!"); + + int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); + if (tavernKeep != -1) + { + dialogue.Add("Tell " + Main.npc[tavernKeep].GivenName + " to stop calling me. He’s not wanted."); + dialogue.Add("My booze will always be better than " + Main.npc[tavernKeep].GivenName + "'s and nobody can convince me otherwise."); + } + + int dryad = NPC.FindFirstNPC(NPCID.Dryad); + if (dryad != -1) + dialogue.Add(Main.npc[dryad].GivenName + " is cool too but she'd outlive me."); + + int permadong = NPC.FindFirstNPC(mod.NPCType("DILF")); + if (permadong != -1) + dialogue.Add("I never realized how well-endowed " + Main.npc[permadong].GivenName + " was. It had to be the largest icicle I had ever seen."); + + int waifu = NPC.FindFirstNPC(NPCID.Stylist); + if (waifu != -1) + { + dialogue.Add("You still can't stop me from selling alcohol and trying to move in with " + Main.npc[waifu].GivenName + "."); + dialogue.Add("I love it when " + Main.npc[waifu].GivenName + "'s hands get sticky from all that...wax."); + dialogue.Add(Main.npc[waifu].GivenName + " works wonders for my hair...among other things."); + } + + if (Main.player[Main.myPlayer].GetModPlayer().chibii) + dialogue.Add("Is that a toy? Looks like something I'd carry around if I was 5 years old."); + + if ((Main.player[Main.myPlayer].GetModPlayer().sirenBoobs && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsHide) || + (Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAlt && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAltHide)) + dialogue.Add("Nice...scales...did it get hot in here?"); + + if (Main.player[Main.myPlayer].GetModPlayer().fabsolVodka) + dialogue.Add("Oh yeah now you're drinking the good stuff! Do you like it? I created the recipe by mixing fairy dust, crystals, and other magical crap."); + + if (Main.player[Main.myPlayer].GetModPlayer().fab) + { + dialogue.Add("...so, you're riding me huh? That's not weird at all."); + dialogue.Add("Are you coming on to me?"); + 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."); + } + + 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 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; + } + else + { + shop = false; + Main.npcChatText = Death(); + } + } + + public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original item value + { + shop.item[nextSlot].SetDefaults(mod.ItemType("GrapeBeer")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("RedWine")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 3, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("Moonshine")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("Vodka")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("Whiskey")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("Tequila")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 7, 50, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("Rum")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 7, 50, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("Fireball")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("Everclear")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("FabsolsVodka")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); + nextSlot++; + + if (Main.bloodMoon) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("BloodyMary")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); + nextSlot++; + } + + if (CalamityWorld.downedAstrageldon && !Main.dayTime) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("StarBeamRye")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); + nextSlot++; + } + + shop.item[nextSlot].SetDefaults(mod.ItemType("Screwdriver")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("MoscowMule")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("WhiteWine")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("EvergreenGin")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("CinnamonRoll")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("TequilaSunrise")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("CaribbeanRum")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("Margarita")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 35, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("BlueCandle")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("PinkCandle")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("PurpleCandle")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("YellowCandle")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(mod.ItemType("OddMushroom")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(3, 0, 0, 0); + nextSlot++; + } + + public override void TownNPCAttackStrength(ref int damage, ref float knockback) + { + damage = 15; + knockback = 2f; + } + + public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) + { + cooldown = 180; + randExtraCooldown = 60; + } + + public override void TownNPCAttackProj(ref int projType, ref int attackDelay) + { + projType = mod.ProjectileType("FabRay"); + attackDelay = 1; + } + + public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) + { + multiplier = 2f; + } + } +} diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index c1d0415a7d..7bcf94b078 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -1,305 +1,305 @@ -using System.Collections.Generic; -using Terraria; -using Terraria.GameContent.Events; -using Terraria.Localization; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.NPCs.TownNPCs -{ - [AutoloadHead] - public class SEAHOE : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sea King"); - - Main.npcFrameCount[npc.type] = 25; - NPCID.Sets.ExtraFramesCount[npc.type] = 5; - NPCID.Sets.AttackFrameCount[npc.type] = 4; - NPCID.Sets.DangerDetectRange[npc.type] = 700; - NPCID.Sets.AttackType[npc.type] = 0; - NPCID.Sets.AttackTime[npc.type] = 90; - NPCID.Sets.AttackAverageChance[npc.type] = 30; - } - - public override void SetDefaults() - { - npc.townNPC = true; - npc.friendly = true; - npc.width = 30; - npc.height = 58; - npc.aiStyle = 7; - npc.damage = 10; - npc.defense = 25; - npc.lifeMax = 7500; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.65f; - animationType = NPCID.Guide; - } - - public override bool CanTownNPCSpawn(int numTownNPCs, int money) - { - return CalamityWorld.downedCLAM && CalamityWorld.downedDesertScourge; - } - - public override string TownNPCName() - { - return "Amidias"; - } - - public override void AI() - { - npc.breath += 2; - } - - public override string GetChat() - { - IList dialogue = new List(); - Player player = Main.player[Main.myPlayer]; - - if (npc.homeless) - { - if (Main.rand.Next(2) == 0) - return "Is this...what the world is like now? It seems so much more lifeless than when I saw it before I disappeared."; - else - return "Thank you for your service, my child, but I am afraid I am without a home now."; - } - if (Main.dayTime) - { - dialogue.Add("My homeland may have dried up but the memories of my people still remain. I will not let them be in vain."); - dialogue.Add("There is a lot that you do not know about this world, specifically regarding the past. Much of it has been lost to history due to the many wars that plagued it."); - dialogue.Add("How can I survive on land? Ah, that is a secret. No, actually...I can breathe air like you!"); - dialogue.Add("Why do you ask if it's the males that carry the young? Don't your males carry their young?"); - } - else - { - dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); - dialogue.Add("Most creatures look up at the moon and admire it. I look up and fear it."); - dialogue.Add("Oh, me? I don't sleep, it's part of my nature."); - } - - int partyGirl = NPC.FindFirstNPC(NPCID.PartyGirl); - if (partyGirl != -1) - { - dialogue.Add(Main.npc[partyGirl].GivenName + " asked if my nose could be used as a vuvuzela. What is a vuvuzela?"); - } - - int lilBitch = NPC.FindFirstNPC(NPCID.Angler); - if (lilBitch != -1) - { - dialogue.Add("Meet me at " + Main.npc[lilBitch].GivenName + "'s house at night. We're going to throw him to the Trashers."); - 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."); - } - - /* - int yharim = NPC.FindFirstNPC(NPCID.Yharim); - if (yharim != -1) - { - dialogue.Add("Oh, Yharim... did he ever realize what he was doing? He seems so...calm, as if his rage had been satiated."); - }*/ - - if (Main.player[Main.myPlayer].GetModPlayer().sirenPet) - { - dialogue.Add("Ah, nice duds, my child!"); - } - - if ((Main.player[Main.myPlayer].GetModPlayer().sirenBoobs && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsHide) || - (Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAlt && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAltHide)) - { - dialogue.Add("Shouldn't you be wearing a clam bra?"); - } - - if (Main.hardMode) - { - dialogue.Add("The balance between light and dark is tipping. Stay strong, my child."); - dialogue.Add("Ah, you are starting to realize just how complicated this world is now. You are learning the story of what became of him."); - } - - if (NPC.downedMoonlord) - { - dialogue.Add("Do you ever get the feeling that something out there is watching you very carefully? Whatever it is, it's very small and sly, I think."); - dialogue.Add("I must admit, I am quite shaken up now. Never would I have imagined that I would see one of the dark gods again. Not in this lifetime anyhow."); - dialogue.Add("Times like this I wish my home was still in one piece instead of evaporated away. I don't blame the witch for anything, it's just...oh, never mind."); - } - - if (CalamityWorld.downedDoG) - { - dialogue.Add("I suppose that witch was mistaken. Defeating the Ceaseless Void and the Devourer has not caused our world to collapse… but I would not lower my guard if I were you."); - } - - /*if (CalamityWorld.downedYharon) - { - dialogue.Add("I'm worried for Lord Yharim. He was not in a particular good mood once we found out you defeated his close friend."); - }*/ - - return dialogue[Main.rand.Next(dialogue.Count)]; - } - - public string Lore() - { - IList dialogue = new List(); - string worldEvil = WorldGen.crimson ? "Crimson" : "Corruption"; - - if (CalamityWorld.downedYharon) - { - dialogue.Add("Pockets of ore have appeared once more in the land. This will allow you to create the most powerful weaponry and armor imagined!"); - dialogue.Add("Lord Yharim possesses god-like strength. He may not even fight you at full power which is fortunate for you. His attacks may just kill you in one hit, so be careful."); - dialogue.Add("Draedon's style of confrontation is very...alien and hands-off. You may be more likely to fight any one of his mechs before taking him down."); - } - else if (CalamityWorld.downedDoG) - { - dialogue.Add("The Devourer of God’s cosmic armor is unique in that it is capable of not only protecting his body from tearing itself apart when ripping through the fabric of space and time, but also allows him to control his powers."); - dialogue.Add("With the cosmic steel you can fashion many of your weapons into much more powerful forms."); - dialogue.Add("The Devourer of Gods is extremely powerful. However, he is young, foolhardy, and very lazy. Perhaps if he had been given time to develop he would have turned into quite the threat."); - dialogue.Add("Ah, the dragon Yharon is fickle. You may find that he will refuse to use his full power unless you are strong enough to unleash the power of the Dark Sun."); - } - else if (CalamityWorld.downedProvidence) - { - dialogue.Add("The Rune of Kos holds a significant portion of Providence’s brand of magic, easily distinguishable from all others. Activating it in certain places would have some...risky consequences."); - dialogue.Add("Ironic, is it not, that Statis was defeated by the very Sentinel his people fashioned their art of stealth from. Fate so often weaves cruel tales."); - dialogue.Add("The Dungeon seems to be more active now. You may hear the faint whisperings of angry spirits who have not left to the Void...I would recommend searching there before taking on the Sentinels."); - } - else if (NPC.downedMoonlord) - { - dialogue.Add("Your adventure focuses to the jungle it seems. Clearing out the infestation of Bumblebirbs that have cropped up is an excellent idea."); - dialogue.Add("Ah...I can sense a powerful change in the weather. You may want to venture to the Sulphurous Seas once more during the rain to experience it."); - dialogue.Add("Profaned creatures now lurk in the Hallow and in Hell. If you destroy enough and gather their essence together you shall be able to capture the attention of the Profaned Guardians."); - dialogue.Add("The Profaned Guardians will do anything to protect their goddess. Makes sense they would die for her since they can be revived just as quickly."); - dialogue.Add("Touching Providence's offerings is usually a death wish. Shame that Yharim didn't think to just mess with her things to get her out of hiding."); - dialogue.Add("Providence is as much the sun goddess as much as the Moon Lord is the moon god. They are two sides of the same coin, choosing to remain neutral amongst our petty squabbles."); - dialogue.Add("The stories have it that when Providence faced and defeated Yharim and his forces she lost a lot of energy and reverted to a more skeletal form. She's merely a fraction of the power she was before."); - } - else if (NPC.downedGolemBoss) - { - dialogue.Add("The men at the front of the dungeon are performing a ritual to keep the Moon Lord contained in his prison. In order to gain Yharim's attention, however, you may need to defeat them."); - dialogue.Add("The Abyss has become far more active than before. You might be able to mine some of the volcanic rubble contained within."); - dialogue.Add("The plague was just one of the many experiments authorized by Yharim to raze towns to the ground. This is probably one of the few he shelved for being too terrible."); - } - else if (CalamityWorld.downedCryogen) - { - dialogue.Add("You will find more ores have been unlocked due to the magic sealing them away being dispelled. Some of them may require more than just the ore itself to create."); - dialogue.Add("I would recommend saving some of your old items. You never know if you can engineer them into stronger weapons in the future."); - dialogue.Add("Once those mechanical creations have been defeated you would do well to seek out the crippled clone of the witch, Calamitas. It might provide some useful weaponry."); - dialogue.Add("If you take an idol down to the Brimstone Crags you might be able to see just what is lurking in the shadows."); - dialogue.Add("The Brimstone Crags...Yharim despised that place, and did everything he could to raze it to the ground. It might explain a few things about him."); - dialogue.Add("The witch just might offer you an opportunity for a challenge if you are willing to fight during the night."); - dialogue.Add("If you’ve gathered the souls used to power those automatons head once more to the jungle. You will find a powerful enemy to fight, which will unleash the full fervor of the jungle once defeated. Do not underestimate it!"); - dialogue.Add("Be careful when defeating Plantera and the Golem. You might accidentally unleash a new threat in the jungle that needs to be quelled."); - dialogue.Add("When exploring the jungle temple be careful. You may not wish to disturb the Lihzard’s idol, the Golem. It’s quite the destructive force."); - } - else if (Main.hardMode) - { - dialogue.Add("Have you heard of the story of Archmage Permafrost? Rumor has it he's been locked away in an icy prison by Lord Yharim. Perhaps you would be able to free him if Cryogen was destroyed."); - } - else - { - dialogue.Add("There are rumors of ores that lay in latency. When you defeat certain bosses you will undo the ancient magic which conceals those materials."); - dialogue.Add("Have you heard of the Brimstone Crags? It was once a grand kingdom, not too different from my own. However, it also met a similar fate. I would not advise going down there, unless you seek a painful death."); - dialogue.Add("Ah yes, the Abyss. That trench is full of powerful creatures that could devour you in a heartbeat. I would explore the dungeon first."); - dialogue.Add("The Sulphurous Seas are dangerous. The toxic waters will burn your skin, but if you can brave them you will be able to reach the Abyss, where there are powerful weapons and dangers aplenty."); - dialogue.Add("The Sulphurous Seas were created long ago, when Yharim’s dungeon could no longer hold as many corpses as it needed to. Many of the bodies were dumped into the ocean. This, along with severe pollution from the heydays of Draedon's experiments have turned a paradise into a wasteland."); - dialogue.Add("Be careful what you attack in the " + worldEvil + ". You might just unveil a greater threat than what was there before."); - dialogue.Add("Scattered across the lands are shrines dedicated to the gods. You can take whatever is in them, but a few items you may not be able to use until much later."); - dialogue.Add("I’m assuming you’ve heard the legends that speak of the ninja, Statis? There are some who say that if you were able to defeat the gods which his clan once worshipped you would be able to harness some of his powers."); - dialogue.Add("The dungeon is a dark place. None of us know of its true purpose, however, the ancient Eidolist cultists used it for worship before Lord Yharim took it over."); - dialogue.Add("The " + worldEvil + " used to be easily manageable and controlled by nature. However, the recent wars and pollution have tipped the balance out of favor."); - } - - return dialogue[Main.rand.Next(dialogue.Count)]; - - } - - public override void SetChatButtons(ref string button, ref string button2) - { - button = Language.GetTextValue("LegacyInterface.28"); - button2 = "Help"; - } - - public override void OnChatButtonClicked(bool firstButton, ref bool shop) - { - if (firstButton) - { - shop = true; - } - else - { - shop = false; - Main.npcChatText = Lore(); - Player player = Main.player[Main.myPlayer]; - player.AddBuff(mod.BuffType("AmidiasBlessing"), 36000); - } - } - - public override void SetupShop(Chest shop, ref int nextSlot) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("Shellshooter")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("SnapClam")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("SandDollar")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("Waywasher")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("CoralCannon")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("UrchinFlail")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("AmidiasTrident")); - nextSlot++; - shop.item[nextSlot].SetDefaults(mod.ItemType("MagicalConch")); - nextSlot++; - if (NPC.downedFishron) - { - shop.item[nextSlot].SetDefaults(ItemID.TruffleWorm); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 40, 0, 0); - nextSlot++; - } - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias4"), 1f); - } - } - - public override void TownNPCAttackStrength(ref int damage, ref float knockback) - { - damage = 30; - knockback = 2f; - } - - public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) - { - cooldown = 5; - } - - public override void TownNPCAttackProj(ref int projType, ref int attackDelay) - { - projType = mod.ProjectileType("SnapClamProj"); - attackDelay = 1; - } - - public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) - { - multiplier = 16f; - gravityCorrection = 10f; - } - } -} \ No newline at end of file +using System.Collections.Generic; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.Localization; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.NPCs.TownNPCs +{ + [AutoloadHead] + public class SEAHOE : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sea King"); + + Main.npcFrameCount[npc.type] = 25; + NPCID.Sets.ExtraFramesCount[npc.type] = 5; + NPCID.Sets.AttackFrameCount[npc.type] = 4; + NPCID.Sets.DangerDetectRange[npc.type] = 700; + NPCID.Sets.AttackType[npc.type] = 0; + NPCID.Sets.AttackTime[npc.type] = 90; + NPCID.Sets.AttackAverageChance[npc.type] = 30; + } + + public override void SetDefaults() + { + npc.townNPC = true; + npc.friendly = true; + npc.width = 30; + npc.height = 58; + npc.aiStyle = 7; + npc.damage = 10; + npc.defense = 25; + npc.lifeMax = 7500; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.65f; + animationType = NPCID.Guide; + } + + public override bool CanTownNPCSpawn(int numTownNPCs, int money) + { + return CalamityWorld.downedCLAM && CalamityWorld.downedDesertScourge; + } + + public override string TownNPCName() + { + return "Amidias"; + } + + public override void AI() + { + npc.breath += 2; + } + + public override string GetChat() + { + IList dialogue = new List(); + Player player = Main.player[Main.myPlayer]; + + if (npc.homeless) + { + if (Main.rand.Next(2) == 0) + return "Is this...what the world is like now? It seems so much more lifeless than when I saw it before I disappeared."; + else + return "Thank you for your service, my child, but I am afraid I am without a home now."; + } + if (Main.dayTime) + { + dialogue.Add("My homeland may have dried up but the memories of my people still remain. I will not let them be in vain."); + dialogue.Add("There is a lot that you do not know about this world, specifically regarding the past. Much of it has been lost to history due to the many wars that plagued it."); + dialogue.Add("How can I survive on land? Ah, that is a secret. No, actually...I can breathe air like you!"); + dialogue.Add("Why do you ask if it's the males that carry the young? Don't your males carry their young?"); + } + else + { + dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); + dialogue.Add("Most creatures look up at the moon and admire it. I look up and fear it."); + dialogue.Add("Oh, me? I don't sleep, it's part of my nature."); + } + + int partyGirl = NPC.FindFirstNPC(NPCID.PartyGirl); + if (partyGirl != -1) + { + dialogue.Add(Main.npc[partyGirl].GivenName + " asked if my nose could be used as a vuvuzela. What is a vuvuzela?"); + } + + int lilBitch = NPC.FindFirstNPC(NPCID.Angler); + if (lilBitch != -1) + { + dialogue.Add("Meet me at " + Main.npc[lilBitch].GivenName + "'s house at night. We're going to throw him to the Trashers."); + 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."); + } + + /* + int yharim = NPC.FindFirstNPC(NPCID.Yharim); + if (yharim != -1) + { + dialogue.Add("Oh, Yharim... did he ever realize what he was doing? He seems so...calm, as if his rage had been satiated."); + }*/ + + if (Main.player[Main.myPlayer].GetModPlayer().sirenPet) + { + dialogue.Add("Ah, nice duds, my child!"); + } + + if ((Main.player[Main.myPlayer].GetModPlayer().sirenBoobs && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsHide) || + (Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAlt && !Main.player[Main.myPlayer].GetModPlayer().sirenBoobsAltHide)) + { + dialogue.Add("Shouldn't you be wearing a clam bra?"); + } + + if (Main.hardMode) + { + dialogue.Add("The balance between light and dark is tipping. Stay strong, my child."); + dialogue.Add("Ah, you are starting to realize just how complicated this world is now. You are learning the story of what became of him."); + } + + if (NPC.downedMoonlord) + { + dialogue.Add("Do you ever get the feeling that something out there is watching you very carefully? Whatever it is, it's very small and sly, I think."); + dialogue.Add("I must admit, I am quite shaken up now. Never would I have imagined that I would see one of the dark gods again. Not in this lifetime anyhow."); + dialogue.Add("Times like this I wish my home was still in one piece instead of evaporated away. I don't blame the witch for anything, it's just...oh, never mind."); + } + + if (CalamityWorld.downedDoG) + { + dialogue.Add("I suppose that witch was mistaken. Defeating the Ceaseless Void and the Devourer has not caused our world to collapse… but I would not lower my guard if I were you."); + } + + /*if (CalamityWorld.downedYharon) + { + dialogue.Add("I'm worried for Lord Yharim. He was not in a particular good mood once we found out you defeated his close friend."); + }*/ + + return dialogue[Main.rand.Next(dialogue.Count)]; + } + + public string Lore() + { + IList dialogue = new List(); + string worldEvil = WorldGen.crimson ? "Crimson" : "Corruption"; + + if (CalamityWorld.downedYharon) + { + dialogue.Add("Pockets of ore have appeared once more in the land. This will allow you to create the most powerful weaponry and armor imagined!"); + dialogue.Add("Lord Yharim possesses god-like strength. He may not even fight you at full power which is fortunate for you. His attacks may just kill you in one hit, so be careful."); + dialogue.Add("Draedon's style of confrontation is very...alien and hands-off. You may be more likely to fight any one of his mechs before taking him down."); + } + else if (CalamityWorld.downedDoG) + { + dialogue.Add("The Devourer of God’s cosmic armor is unique in that it is capable of not only protecting his body from tearing itself apart when ripping through the fabric of space and time, but also allows him to control his powers."); + dialogue.Add("With the cosmic steel you can fashion many of your weapons into much more powerful forms."); + dialogue.Add("The Devourer of Gods is extremely powerful. However, he is young, foolhardy, and very lazy. Perhaps if he had been given time to develop he would have turned into quite the threat."); + dialogue.Add("Ah, the dragon Yharon is fickle. You may find that he will refuse to use his full power unless you are strong enough to unleash the power of the Dark Sun."); + } + else if (CalamityWorld.downedProvidence) + { + dialogue.Add("The Rune of Kos holds a significant portion of Providence’s brand of magic, easily distinguishable from all others. Activating it in certain places would have some...risky consequences."); + dialogue.Add("Ironic, is it not, that Statis was defeated by the very Sentinel his people fashioned their art of stealth from. Fate so often weaves cruel tales."); + dialogue.Add("The Dungeon seems to be more active now. You may hear the faint whisperings of angry spirits who have not left to the Void...I would recommend searching there before taking on the Sentinels."); + } + else if (NPC.downedMoonlord) + { + dialogue.Add("Your adventure focuses to the jungle it seems. Clearing out the infestation of Bumblebirbs that have cropped up is an excellent idea."); + dialogue.Add("Ah...I can sense a powerful change in the weather. You may want to venture to the Sulphurous Seas once more during the rain to experience it."); + dialogue.Add("Profaned creatures now lurk in the Hallow and in Hell. If you destroy enough and gather their essence together you shall be able to capture the attention of the Profaned Guardians."); + dialogue.Add("The Profaned Guardians will do anything to protect their goddess. Makes sense they would die for her since they can be revived just as quickly."); + dialogue.Add("Touching Providence's offerings is usually a death wish. Shame that Yharim didn't think to just mess with her things to get her out of hiding."); + dialogue.Add("Providence is as much the sun goddess as much as the Moon Lord is the moon god. They are two sides of the same coin, choosing to remain neutral amongst our petty squabbles."); + dialogue.Add("The stories have it that when Providence faced and defeated Yharim and his forces she lost a lot of energy and reverted to a more skeletal form. She's merely a fraction of the power she was before."); + } + else if (NPC.downedGolemBoss) + { + dialogue.Add("The men at the front of the dungeon are performing a ritual to keep the Moon Lord contained in his prison. In order to gain Yharim's attention, however, you may need to defeat them."); + dialogue.Add("The Abyss has become far more active than before. You might be able to mine some of the volcanic rubble contained within."); + dialogue.Add("The plague was just one of the many experiments authorized by Yharim to raze towns to the ground. This is probably one of the few he shelved for being too terrible."); + } + else if (CalamityWorld.downedCryogen) + { + dialogue.Add("You will find more ores have been unlocked due to the magic sealing them away being dispelled. Some of them may require more than just the ore itself to create."); + dialogue.Add("I would recommend saving some of your old items. You never know if you can engineer them into stronger weapons in the future."); + dialogue.Add("Once those mechanical creations have been defeated you would do well to seek out the crippled clone of the witch, Calamitas. It might provide some useful weaponry."); + dialogue.Add("If you take an idol down to the Brimstone Crags you might be able to see just what is lurking in the shadows."); + dialogue.Add("The Brimstone Crags...Yharim despised that place, and did everything he could to raze it to the ground. It might explain a few things about him."); + dialogue.Add("The witch just might offer you an opportunity for a challenge if you are willing to fight during the night."); + dialogue.Add("If you’ve gathered the souls used to power those automatons head once more to the jungle. You will find a powerful enemy to fight, which will unleash the full fervor of the jungle once defeated. Do not underestimate it!"); + dialogue.Add("Be careful when defeating Plantera and the Golem. You might accidentally unleash a new threat in the jungle that needs to be quelled."); + dialogue.Add("When exploring the jungle temple be careful. You may not wish to disturb the Lihzard’s idol, the Golem. It’s quite the destructive force."); + } + else if (Main.hardMode) + { + dialogue.Add("Have you heard of the story of Archmage Permafrost? Rumor has it he's been locked away in an icy prison by Lord Yharim. Perhaps you would be able to free him if Cryogen was destroyed."); + } + else + { + dialogue.Add("There are rumors of ores that lay in latency. When you defeat certain bosses you will undo the ancient magic which conceals those materials."); + dialogue.Add("Have you heard of the Brimstone Crags? It was once a grand kingdom, not too different from my own. However, it also met a similar fate. I would not advise going down there, unless you seek a painful death."); + dialogue.Add("Ah yes, the Abyss. That trench is full of powerful creatures that could devour you in a heartbeat. I would explore the dungeon first."); + dialogue.Add("The Sulphurous Seas are dangerous. The toxic waters will burn your skin, but if you can brave them you will be able to reach the Abyss, where there are powerful weapons and dangers aplenty."); + dialogue.Add("The Sulphurous Seas were created long ago, when Yharim’s dungeon could no longer hold as many corpses as it needed to. Many of the bodies were dumped into the ocean. This, along with severe pollution from the heydays of Draedon's experiments have turned a paradise into a wasteland."); + dialogue.Add("Be careful what you attack in the " + worldEvil + ". You might just unveil a greater threat than what was there before."); + dialogue.Add("Scattered across the lands are shrines dedicated to the gods. You can take whatever is in them, but a few items you may not be able to use until much later."); + dialogue.Add("I’m assuming you’ve heard the legends that speak of the ninja, Statis? There are some who say that if you were able to defeat the gods which his clan once worshipped you would be able to harness some of his powers."); + dialogue.Add("The dungeon is a dark place. None of us know of its true purpose, however, the ancient Eidolist cultists used it for worship before Lord Yharim took it over."); + dialogue.Add("The " + worldEvil + " used to be easily manageable and controlled by nature. However, the recent wars and pollution have tipped the balance out of favor."); + } + + return dialogue[Main.rand.Next(dialogue.Count)]; + + } + + public override void SetChatButtons(ref string button, ref string button2) + { + button = Language.GetTextValue("LegacyInterface.28"); + button2 = "Help"; + } + + public override void OnChatButtonClicked(bool firstButton, ref bool shop) + { + if (firstButton) + { + shop = true; + } + else + { + shop = false; + Main.npcChatText = Lore(); + Player player = Main.player[Main.myPlayer]; + player.AddBuff(mod.BuffType("AmidiasBlessing"), 36000); + } + } + + public override void SetupShop(Chest shop, ref int nextSlot) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("Shellshooter")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("SnapClam")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("SandDollar")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("Waywasher")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("CoralCannon")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("UrchinFlail")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("AmidiasTrident")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("MagicalConch")); + nextSlot++; + if (NPC.downedFishron) + { + shop.item[nextSlot].SetDefaults(ItemID.TruffleWorm); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 40, 0, 0); + nextSlot++; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Amidias/Amidias4"), 1f); + } + } + + public override void TownNPCAttackStrength(ref int damage, ref float knockback) + { + damage = 30; + knockback = 2f; + } + + public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) + { + cooldown = 5; + } + + public override void TownNPCAttackProj(ref int projType, ref int attackDelay) + { + projType = mod.ProjectileType("SnapClamProj"); + attackDelay = 1; + } + + public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) + { + multiplier = 16f; + gravityCorrection = 10f; + } + } +} diff --git a/NPCs/Yharon/DetonatingFlare.cs b/NPCs/Yharon/DetonatingFlare.cs index c80f85054e..b8c023d36f 100644 --- a/NPCs/Yharon/DetonatingFlare.cs +++ b/NPCs/Yharon/DetonatingFlare.cs @@ -1,243 +1,243 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Yharon -{ - public class DetonatingFlare : ModNPC - { - float num = 0f; - float num2 = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Detonating Flame"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 100; - npc.width = 50; //324 - npc.height = 50; //216 - npc.defense = 150; - npc.lifeMax = 10000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.alpha = 255; - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - npc.alpha -= 3; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - if (npc.localAI[1] == 0f) - { - switch (Main.rand.Next(8)) - { - case 0: num = 5f; num2 = 0.15f; break; - case 1: num = 5.5f; num2 = 0.16f; break; - case 2: num = 6f; num2 = 0.17f; break; - case 3: num = 6.5f; num2 = 0.18f; break; - case 4: num = 7f; num2 = 0.19f; break; - case 5: num = 7.5f; num2 = 0.20f; break; - case 6: num = 8f; num2 = 0.21f; break; - case 7: num = 8.5f; num2 = 0.22f; break; - } - npc.localAI[1] = 1f; - } - 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; - } - int shoot = revenge ? 4 : 3; - npc.localAI[0] += (float)(Main.rand.Next(shoot)); - 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)) - { - int num8 = 90; - if (Main.expertMode) - { - num8 = 75; //600 - } - int num9 = 467; - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 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 bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - 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 PreNPCLoot() - { - return false; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Yharon +{ + public class DetonatingFlare : ModNPC + { + float num = 0f; + float num2 = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Detonating Flame"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 100; + npc.width = 50; //324 + npc.height = 50; //216 + npc.defense = 150; + npc.lifeMax = 10000; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + npc.alpha = 255; + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + npc.alpha -= 3; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + if (npc.localAI[1] == 0f) + { + switch (Main.rand.Next(8)) + { + case 0: num = 5f; num2 = 0.15f; break; + case 1: num = 5.5f; num2 = 0.16f; break; + case 2: num = 6f; num2 = 0.17f; break; + case 3: num = 6.5f; num2 = 0.18f; break; + case 4: num = 7f; num2 = 0.19f; break; + case 5: num = 7.5f; num2 = 0.20f; break; + case 6: num = 8f; num2 = 0.21f; break; + case 7: num = 8.5f; num2 = 0.22f; break; + } + npc.localAI[1] = 1f; + } + 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; + } + int shoot = revenge ? 4 : 3; + npc.localAI[0] += (float)(Main.rand.Next(shoot)); + 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)) + { + int num8 = 90; + if (Main.expertMode) + { + num8 = 75; //600 + } + int num9 = 467; + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 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 bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + 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 PreNPCLoot() + { + return false; + } + } +} diff --git a/NPCs/Yharon/DetonatingFlare2.cs b/NPCs/Yharon/DetonatingFlare2.cs index 01964ec293..30e766acb3 100644 --- a/NPCs/Yharon/DetonatingFlare2.cs +++ b/NPCs/Yharon/DetonatingFlare2.cs @@ -1,106 +1,106 @@ -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; -using CalamityMod.World; - -namespace CalamityMod.NPCs.Yharon -{ - public class DetonatingFlare2 : ModNPC - { - float speed = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Detonating Flame"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 220; - npc.width = 50; //324 - npc.height = 50; //216 - npc.defense = 150; - npc.lifeMax = 13000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.alpha = 255; - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - npc.alpha -= 3; - npc.TargetClosest(true); - Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); - float num790 = Main.player[npc.target].Center.X - vector98.X; - float num791 = Main.player[npc.target].Center.Y - vector98.Y; - float num792 = (float)Math.Sqrt((double)(num790 * num790 + num791 * num791)); - if (npc.localAI[3] == 0f) - { - switch (Main.rand.Next(6)) - { - case 0: speed = 10f; break; - case 1: speed = 11.5f; break; - case 2: speed = 13f; break; - case 3: speed = 14.5f; break; - case 4: speed = 16f; break; - case 5: speed = 17.5f; break; - } - npc.localAI[3] = 1f; - } - float num793 = speed + (revenge ? 1f : 0f); - num792 = num793 / num792; - num790 *= num792; - num791 *= num792; - npc.velocity.X = (npc.velocity.X * 100f + num790) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num791) / 101f; - npc.rotation = (float)Math.Atan2((double)num791, (double)num790) - 1.57f; - return; - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(255, Main.DiscoG, 53, 0); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(mod.BuffType("MarkedforDeath"), 300); - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - 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 PreNPCLoot() - { - return false; - } - } -} \ No newline at end of file +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; +using CalamityMod.World; + +namespace CalamityMod.NPCs.Yharon +{ + public class DetonatingFlare2 : ModNPC + { + float speed = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Detonating Flame"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.damage = 220; + npc.width = 50; //324 + npc.height = 50; //216 + npc.defense = 150; + npc.lifeMax = 13000; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.canGhostHeal = false; + npc.HitSound = SoundID.NPCHit52; + npc.DeathSound = SoundID.NPCDeath55; + npc.alpha = 255; + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + npc.alpha -= 3; + npc.TargetClosest(true); + Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y); + float num790 = Main.player[npc.target].Center.X - vector98.X; + float num791 = Main.player[npc.target].Center.Y - vector98.Y; + float num792 = (float)Math.Sqrt((double)(num790 * num790 + num791 * num791)); + if (npc.localAI[3] == 0f) + { + switch (Main.rand.Next(6)) + { + case 0: speed = 10f; break; + case 1: speed = 11.5f; break; + case 2: speed = 13f; break; + case 3: speed = 14.5f; break; + case 4: speed = 16f; break; + case 5: speed = 17.5f; break; + } + npc.localAI[3] = 1f; + } + float num793 = speed + (revenge ? 1f : 0f); + num792 = num793 / num792; + num790 *= num792; + num791 *= num792; + npc.velocity.X = (npc.velocity.X * 100f + num790) / 101f; + npc.velocity.Y = (npc.velocity.Y * 100f + num791) / 101f; + npc.rotation = (float)Math.Atan2((double)num791, (double)num790) - 1.57f; + return; + } + + public override Color? GetAlpha(Color drawColor) + { + return new Color(255, Main.DiscoG, 53, 0); + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (CalamityWorld.revenge) + { + player.AddBuff(mod.BuffType("MarkedforDeath"), 300); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + 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 PreNPCLoot() + { + return false; + } + } +} diff --git a/NPCs/Yharon/YScreenShader.cs b/NPCs/Yharon/YScreenShader.cs index 34ea34350e..d3ab0b4012 100644 --- a/NPCs/Yharon/YScreenShader.cs +++ b/NPCs/Yharon/YScreenShader.cs @@ -1,44 +1,44 @@ -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Yharon -{ - public class YScreenShaderData : ScreenShaderData - { - private int YIndex; - - public YScreenShaderData(string passName) - : base(passName) - { - } - - private void UpdateYIndex() - { - int YType = ModLoader.GetMod("CalamityMod").NPCType("Yharon"); - if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) - { - return; - } - YIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == YType) - { - YIndex = i; - break; - } - } - } - - public override void Apply() - { - UpdateYIndex(); - if (YIndex != -1) - { - UseTargetPosition(Main.npc[YIndex].Center); - } - base.Apply(); - } - } -} \ No newline at end of file +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Yharon +{ + public class YScreenShaderData : ScreenShaderData + { + private int YIndex; + + public YScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateYIndex() + { + int YType = ModLoader.GetMod("CalamityMod").NPCType("Yharon"); + if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) + { + return; + } + YIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == YType) + { + YIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateYIndex(); + if (YIndex != -1) + { + UseTargetPosition(Main.npc[YIndex].Center); + } + base.Apply(); + } + } +} diff --git a/NPCs/Yharon/YSky.cs b/NPCs/Yharon/YSky.cs index 22d38c1b26..6b914c0a45 100644 --- a/NPCs/Yharon/YSky.cs +++ b/NPCs/Yharon/YSky.cs @@ -1,101 +1,101 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Yharon -{ - public class YSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int YIndex = -1; - - public override void Update(GameTime gameTime) - { - if (isActive && intensity < 1f) - { - intensity += 0.01f; - } - else if (!isActive && intensity > 0f) - { - intensity -= 0.01f; - } - } - - private float GetIntensity() - { - if (this.UpdateYIndex()) - { - float x = 0f; - if (this.YIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.YIndex].Center); - } - return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.66f; - } - return 0.66f; - } - - public override Color OnTileColor(Color inColor) - { - float intensity = this.GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } - - private bool UpdateYIndex() - { - int YType = ModLoader.GetMod("CalamityMod").NPCType("Yharon"); - if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) - { - return true; - } - YIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == YType) - { - YIndex = i; - break; - } - } - //this.DoGIndex = DoGIndex; - return YIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(77, 19, 0) * intensity); - } - } - - public override float GetCloudAlpha() - { - return 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } - - public override void Deactivate(params object[] args) - { - isActive = false; - } - - public override void Reset() - { - isActive = false; - } - - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Yharon +{ + public class YSky : CustomSky + { + private bool isActive = false; + private float intensity = 0f; + private int YIndex = -1; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + } + + private float GetIntensity() + { + if (this.UpdateYIndex()) + { + float x = 0f; + if (this.YIndex != -1) + { + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.YIndex].Center); + } + return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.66f; + } + return 0.66f; + } + + public override Color OnTileColor(Color inColor) + { + float intensity = this.GetIntensity(); + return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); + } + + private bool UpdateYIndex() + { + int YType = ModLoader.GetMod("CalamityMod").NPCType("Yharon"); + if (YIndex >= 0 && Main.npc[YIndex].active && Main.npc[YIndex].type == YType) + { + return true; + } + YIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == YType) + { + YIndex = i; + break; + } + } + //this.DoGIndex = DoGIndex; + return YIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = this.GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(77, 19, 0) * intensity); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 3c74a36b36..1cb108330e 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -1,3113 +1,3113 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Utilities; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using CalamityMod.Projectiles; -using CalamityMod.World; - -/*Possibly add in a final phase for AI 2 that is similar to Sif's final phase in Dark Souls*/ - -namespace CalamityMod.NPCs.Yharon -{ - [AutoloadBossHead] - public class Yharon : ModNPC - { - private Rectangle safeBox = default(Rectangle); - private bool protectionBoost = false; - private bool moveCloser = false; - private bool phaseOneLoot = false; - private bool dropLoot = false; - private bool useTornado = true; - private int healCounter = 0; - private int secondPhasePhase = 1; - private int teleportLocation = 0; - private bool startSecondAI = false; - private bool spawnArena = false; - private int invincibilityCounter = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Jungle Dragon, Yharon"); - Main.npcFrameCount[npc.type] = 7; - } - - public override void SetDefaults() - { - npc.npcSlots = 50f; - npc.damage = 330; - npc.width = 200; //200 - npc.height = 200; //200 - npc.defense = 200; - npc.lifeMax = CalamityWorld.revenge ? 2525000 : 2275000; - if (CalamityWorld.death) - { - npc.lifeMax = 3025000; - } - if (CalamityWorld.bossRushActive) - { - 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 - npc.value = Item.buyPrice(1, 50, 0, 0); - npc.boss = true; - 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[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.noGravity = true; - npc.noTileCollide = true; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARON"); - else - music = MusicID.Boss1; - if (CalamityWorld.downedBuffedMothron || CalamityWorld.bossRushActive) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARONREBIRTH"); - else - music = MusicID.Boss3; - } - npc.HitSound = SoundID.NPCHit56; - npc.DeathSound = SoundID.NPCDeath60; - bossBag = mod.ItemType("YharonBag"); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(protectionBoost); - writer.Write(moveCloser); - writer.Write(phaseOneLoot); - writer.Write(dropLoot); - writer.Write(useTornado); - writer.Write(healCounter); - writer.Write(secondPhasePhase); - writer.Write(teleportLocation); - writer.Write(startSecondAI); - writer.Write(spawnArena); - writer.Write(invincibilityCounter); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - protectionBoost = reader.ReadBoolean(); - moveCloser = reader.ReadBoolean(); - phaseOneLoot = reader.ReadBoolean(); - dropLoot = reader.ReadBoolean(); - useTornado = reader.ReadBoolean(); - healCounter = reader.ReadInt32(); - secondPhasePhase = reader.ReadInt32(); - teleportLocation = reader.ReadInt32(); - startSecondAI = reader.ReadBoolean(); - spawnArena = reader.ReadBoolean(); - invincibilityCounter = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - #region StartupOrSwitchToAI2 - dropLoot = (double)npc.life <= (double)npc.lifeMax * 0.1; - - if (Main.raining) - CalamityGlobalNPC.StopRain(); - - if (startSecondAI) - { - if (!CalamityWorld.downedBuffedMothron && !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.DargonBossText2"; - 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); - } - startSecondAI = false; - npc.boss = false; - npc.life = 0; - if (dropLoot) - { - npc.NPCLoot(); - } - npc.active = false; - npc.netUpdate = true; - } - return; - } - phaseOneLoot = false; - Yharon_AI2(); - return; - } - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = Main.expertMode; - bool phase2Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.85 : 0.7); //Check for phase 2. In phase 1 for 15% or 30% - bool phase3Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.6 : 0.4); //Check for phase 3. In phase 2 for 25% or 30% - bool phase4Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.25 : 0.2); //Check for phase 4. In phase 3 for 35% or 20% - if (CalamityWorld.death && !CalamityWorld.bossRushActive) - { - phase2Check = (double)npc.life <= (double)npc.lifeMax * 0.9; //Check for phase 2. In phase 1 for 10% - phase3Check = (double)npc.life <= (double)npc.lifeMax * 0.8; //Check for phase 3. In phase 2 for 10% - phase4Check = (double)npc.life <= (double)npc.lifeMax * 0.3; //Check for phase 4. In phase 3 for 50% - } - bool phase5Check = (double)npc.life <= (double)npc.lifeMax * 0.1; //Check for phase 5. In phase 4 for 15% or 10% or 20% - bool phase2Change = npc.ai[0] > 5f; //Phase 2 stuff - bool phase3Change = npc.ai[0] > 12f; //Phase 3 stuff - bool phase4Change = npc.ai[0] > 20f; //Phase 4 stuff - int flareCount = 3; - bool isCharging = npc.ai[3] < 20f; //10 - if (!spawnArena) - { - spawnArena = true; - Vector2 vectorPlayer = new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y); - safeBox.X = (int)(vectorPlayer.X - (revenge ? 3000f : 3500f)); - safeBox.Y = (int)(vectorPlayer.Y - (revenge ? 9000f : 10500f)); - safeBox.Width = revenge ? 6000 : 7000; - safeBox.Height = revenge ? 18000 : 21000; - if (Main.netMode != 1) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + (revenge ? 3000f : 3500f), Main.player[npc.target].position.Y + 100f, 0f, 0f, mod.ProjectileType("SkyFlareRevenge"), 0, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(Main.player[npc.target].position.X - (revenge ? 3000f : 3500f), Main.player[npc.target].position.Y + 100f, 0f, 0f, mod.ProjectileType("SkyFlareRevenge"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - #endregion - #region SpeedOrDamageChecks - if (phase4Change) - { - npc.defense = 140; - } - else if (phase3Change) - { - npc.defense = 160; - } - else if (phase2Change) - { - npc.defense = 180; - } - else - { - npc.defense = 200; - } - int aiChangeRate = expertMode ? 36 : 38; - float npcVelocity = expertMode ? 0.7f : 0.69f; - float scaleFactor = expertMode ? 11f : 10.8f; - if (phase4Change || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npcVelocity = 0.95f; - scaleFactor = 14f; - aiChangeRate = 25; - } - else if (phase3Change) - { - npcVelocity = 0.9f; - scaleFactor = 13f; - aiChangeRate = 25; - } - else if (phase2Change && isCharging) - { - npcVelocity = (expertMode ? 0.8f : 0.78f); - scaleFactor = (expertMode ? 12.2f : 12f); - aiChangeRate = (expertMode ? 36 : 38); - } - else if (isCharging && !phase2Change && !phase3Change && !phase4Change) - { - aiChangeRate = 25; - } - int chargeTime = expertMode ? 38 : 40; - 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) //phase 4 - { - chargeTime = 28; - chargeSpeed = 31f; //27 - } - else if (phase3Change) //phase 3 - { - chargeTime = 32; - chargeTime2 = 27; - chargeSpeed = 25f; //27 - chargeSpeed2 = 41f; - } - else if (isCharging && phase2Change) //phase 2 - { - chargeTime = expertMode ? 35 : 37; - chargeTime2 = expertMode ? 31 : 33; - if (expertMode) - { - chargeSpeed = 24f; //21 - chargeSpeed2 = 39f; - } - } - #endregion - #region VariablesForChargingEtc - int xPos = (npc.direction == 1 ? 25 : -25); - int num1454 = 80; - int num1455 = 4; - float num1456 = 0.3f; - float scaleFactor11 = 5f; - int num1457 = 90; - int num1458 = 180; - int num1459 = 180; - int num1460 = 30; - int num1461 = 120; - int num1462 = 4; - float scaleFactor13 = 20f; - float num1463 = 6.28318548f / (float)(num1461 / 2); - int num1464 = 75; - #endregion - #region DespawnOrEnrage - Vector2 vectorCenter = 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) - { - npc.velocity.Y = npc.velocity.Y - 0.4f; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - if (npc.ai[0] > 12f) - { - npc.ai[0] = 13f; - } - else if (npc.ai[0] > 5f) - { - npc.ai[0] = 6f; - } - else - { - npc.ai[0] = 0f; - } - npc.ai[2] = 0f; - } - else if (npc.timeLeft < 3600) - { - npc.timeLeft = 3600; - } - if (!Main.player[npc.target].Hitbox.Intersects(safeBox)) - { - aiChangeRate = 15; - protectionBoost = true; - npc.damage = npc.defDamage * 5; - chargeSpeed += 25f; - } - else - { - npc.damage = expertMode ? 528 : 330; - protectionBoost = false; - } - #endregion - #region Rotation - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != 1) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - float npcRotation = (float)Math.Atan2((double)(player.Center.Y - vectorCenter.Y), (double)(player.Center.X - vectorCenter.X)); - if (npc.spriteDirection == 1) - { - npcRotation += 3.14159274f; - } - if (npcRotation < 0f) - { - npcRotation += 6.28318548f; - } - if (npcRotation > 6.28318548f) - { - npcRotation -= 6.28318548f; - } - if (npc.ai[0] == -1f) //spawn - { - npcRotation = 0f; - } - if (npc.ai[0] == 3f) //tornado - { - npcRotation = 0f; - } - if (npc.ai[0] == 4f) //enter new phase - { - npcRotation = 0f; - } - if (npc.ai[0] == 9f) //tornado - { - npcRotation = 0f; - } - if (npc.ai[0] == 10f) //enter new phase - { - npcRotation = 0f; - } - if (npc.ai[0] == 16f) //tornado - { - npcRotation = 0f; - } - if (npc.ai[0] == 20f) //tornado - { - npcRotation = 0f; - } - float npcRotationSpeed = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f) //charge - { - npcRotationSpeed = 0f; - } - if (npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f) //circle - { - npcRotationSpeed = 0f; - } - if (npc.ai[0] == 3f) //tornado - { - npcRotationSpeed = 0.01f; - } - if (npc.ai[0] == 4f) //enter new phase - { - npcRotationSpeed = 0.01f; - } - if (npc.ai[0] == 9f || npc.ai[0] == 16f || npc.ai[0] == 20f) //tornado - { - npcRotationSpeed = 0.01f; - } - if (npc.rotation < npcRotation) - { - if ((double)(npcRotation - npc.rotation) > 3.1415926535897931) - { - npc.rotation -= npcRotationSpeed; - } - else - { - npc.rotation += npcRotationSpeed; - } - } - if (npc.rotation > npcRotation) - { - if ((double)(npc.rotation - npcRotation) > 3.1415926535897931) - { - npc.rotation += npcRotationSpeed; - } - else - { - npc.rotation -= npcRotationSpeed; - } - } - if (npc.rotation > npcRotation - npcRotationSpeed && npc.rotation < npcRotation + npcRotationSpeed) - { - npc.rotation = npcRotation; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.28318548f; - } - if (npc.rotation > 6.28318548f) - { - npc.rotation -= 6.28318548f; - } - if (npc.rotation > npcRotation - npcRotationSpeed && npc.rotation < npcRotation + npcRotationSpeed) - { - npc.rotation = npcRotation; - } - #endregion - #region AlphaAndInitialSpawnEffects - if (npc.ai[0] != -1f && npc.ai[0] < 9f) - { - bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); - if (colliding) - { - npc.alpha += 15; - } - else - { - npc.alpha -= 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - if (npc.ai[0] == -1f) //initial spawn effects - { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity *= 0.98f; - int num1467 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1467 != 0) - { - npc.direction = num1467; - npc.spriteDirection = -npc.direction; - } - if (npc.ai[2] > 20f) - { - npc.velocity.Y = -2f; - npc.alpha -= 5; - bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); - if (colliding) - { - npc.alpha += 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - if (npc.ai[2] == (float)(num1457 - 30)) - { - int num1468 = 72; - for (int num1469 = 0; num1469 < num1468; num1469++) - { - Vector2 vector169 = Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f; - vector169 = vector169.RotatedBy((double)((float)(num1469 - (num1468 / 2 - 1)) * 6.28318548f / (float)num1468), default(Vector2)) + npc.Center; - Vector2 value16 = vector169 - npc.Center; - int num1470 = Dust.NewDust(vector169 + value16, 0, 0, 244, value16.X * 2f, value16.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num1470].noGravity = true; - Main.dust[num1470].noLight = true; - Main.dust[num1470].velocity = Vector2.Normalize(value16) * 3f; - } - 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] >= (float)num1464) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - #endregion - #region Phase1 - else if (npc.ai[0] == 0f && !player.dead) - { - npc.dontTakeDamage = false; - npc.chaseable = true; - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value17 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector170.X) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - if (npc.velocity.X < 0f && vector170.X > 0f) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - } - } - else if (npc.velocity.X > vector170.X) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - if (npc.velocity.X > 0f && vector170.X < 0f) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - } - } - if (npc.velocity.Y < vector170.Y) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - if (npc.velocity.Y < 0f && vector170.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - } - } - else if (npc.velocity.Y > vector170.Y) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - if (npc.velocity.Y > 0f && vector170.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - } - } - int num1471 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1471 != 0) - { - if (npc.ai[2] == 0f && num1471 != npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.direction = num1471; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) - { - int aiState = 0; - switch ((int)npc.ai[3]) //0 2 4 6 1 3 5 7 repeat - { - case 0: - case 1: - case 2: - case 3: - case 4: - aiState = 1; //normal charges - break; - case 5: - aiState = 5; //fast charge - break; - case 6: - npc.ai[3] = 1f; - aiState = 2; //fireball attack - break; - case 7: - npc.ai[3] = 0f; - aiState = 3; //tornadoes - break; - } - if (phase2Check) - { - aiState = 4; - } - if (aiState == 1) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1471 != 0) - { - npc.direction = num1471; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 2) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 3) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 4) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 5) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1471 != 0) - { - npc.direction = num1471; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) //charge attack - { - 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)) + vectorCenter; - 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; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) //fireball attack - { - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value19 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector172 = Vector2.Normalize(value19 - npc.velocity) * scaleFactor11; - if (npc.velocity.X < vector172.X) - { - npc.velocity.X = npc.velocity.X + num1456; - if (npc.velocity.X < 0f && vector172.X > 0f) - { - npc.velocity.X = npc.velocity.X + num1456; - } - } - else if (npc.velocity.X > vector172.X) - { - npc.velocity.X = npc.velocity.X - num1456; - if (npc.velocity.X > 0f && vector172.X < 0f) - { - npc.velocity.X = npc.velocity.X - num1456; - } - } - if (npc.velocity.Y < vector172.Y) - { - npc.velocity.Y = npc.velocity.Y + num1456; - if (npc.velocity.Y < 0f && vector172.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num1456; - } - } - else if (npc.velocity.Y > vector172.Y) - { - npc.velocity.Y = npc.velocity.Y - num1456; - if (npc.velocity.Y > 0f && vector172.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - num1456; - } - } - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[2] % (float)num1455 == 0f) //fire flare bombs from mouth - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != 1) - { - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - if (NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) - { - NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, mod.NPCType("DetonatingFlare"), 0, 0f, 0f, 0f, 0f, 255); - } - int damage = expertMode ? 75 : 90; //700 - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, 0f, 0f, mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - int num1476 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1476 != 0) - { - npc.direction = num1476; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1454) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) //Fire small flares - { - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (Main.netMode != 1 && npc.ai[2] == (float)(num1457 - 30)) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); //changed - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(-(float)npc.direction * 2), 8f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 0f, 0f); //changed - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) //enter phase 2 - { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1458 - 60)) - { - 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] >= (float)num1458) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 5f) - { - int num1473 = 14; - 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)) + vectorCenter; - 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); //changed - Main.dust[num1475].noGravity = true; - Main.dust[num1475].noLight = true; - Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime2) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - #endregion - #region Phase2 - else if (npc.ai[0] == 6f && !player.dead) //phase 2 - { - npc.dontTakeDamage = false; - npc.chaseable = true; - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector175.X) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - if (npc.velocity.X < 0f && vector175.X > 0f) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - } - } - else if (npc.velocity.X > vector175.X) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - if (npc.velocity.X > 0f && vector175.X < 0f) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - } - } - if (npc.velocity.Y < vector175.Y) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - if (npc.velocity.Y < 0f && vector175.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - } - } - else if (npc.velocity.Y > vector175.Y) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - if (npc.velocity.Y > 0f && vector175.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - } - } - int num1477 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1477 != 0) - { - if (npc.ai[2] == 0f && num1477 != npc.direction) - { - npc.rotation = 3.14159274f; - } - npc.direction = num1477; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) - { - int aiState = 0; - switch ((int)npc.ai[3]) //0 2 4 6 8 1 3 5 7 9 repeat - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - aiState = 1; - break; - case 6: - aiState = 5; - break; - case 7: - aiState = 6; - break; - case 8: - npc.ai[3] = 1f; - aiState = 2; - break; - case 9: - npc.ai[3] = 0f; - aiState = 3; - break; - } - if (phase3Check) - { - aiState = 4; - } - if (aiState == 1) - { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 2) - { - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 3) - { - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 4) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 5) - { - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 6) - { - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 7f) //charge - { - int num1479 = 7; - for (int num1480 = 0; num1480 < num1479; num1480++) - { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default(Vector2)) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default(Color), 1.4f); //changed - Main.dust[num1481].noGravity = true; - Main.dust[num1481].noLight = true; - Main.dust[num1481].velocity /= 4f; - Main.dust[num1481].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 8f) - { - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[2] % (float)num1462 == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != 1) - { - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount) - { - NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, mod.NPCType("DetonatingFlare2"), 0, 0f, 0f, 0f, 0f, 255); - } - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-400, 401) * 0.13f, (float)Main.rand.Next(-30, 31) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); //changed - } - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default(Vector2)); - npc.rotation -= num1463 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 9f) - { - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (Main.netMode != 1 && npc.ai[2] == (float)(num1457 - 30)) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 10f) //start phase 3 - { - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1459 - 60)) - { - 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] >= (float)num1459) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 11f) - { - int num1479 = 14; - for (int num1480 = 0; num1480 < num1479; num1480++) - { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default(Vector2)) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default(Color), 1.4f); //changed - Main.dust[num1481].noGravity = true; - Main.dust[num1481].noLight = true; - Main.dust[num1481].velocity /= 4f; - Main.dust[num1481].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime2) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 12f) - { - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[2] % (float)num1462 == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != 1) - { - int damage = expertMode ? 75 : 90; //700 - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - 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 = player.position.X + (float)player.width * 0.5f - vectorShoot.X; - float playerY = player.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 + xPos, (int)vector173.Y - 15, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default(Vector2)); - npc.rotation -= num1463 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - #endregion - #region Phase3 - else if (npc.ai[0] == 13f && !player.dead) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector175.X) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - if (npc.velocity.X < 0f && vector175.X > 0f) - { - npc.velocity.X = npc.velocity.X + npcVelocity; - } - } - else if (npc.velocity.X > vector175.X) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - if (npc.velocity.X > 0f && vector175.X < 0f) - { - npc.velocity.X = npc.velocity.X - npcVelocity; - } - } - if (npc.velocity.Y < vector175.Y) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - if (npc.velocity.Y < 0f && vector175.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + npcVelocity; - } - } - else if (npc.velocity.Y > vector175.Y) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - if (npc.velocity.Y > 0f && vector175.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - npcVelocity; - } - } - int num1477 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1477 != 0) - { - if (npc.ai[2] == 0f && num1477 != npc.direction) - { - npc.rotation = 3.14159274f; - } - npc.direction = num1477; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) - { - int aiState = 0; - switch ((int)npc.ai[3]) //0 2 4 6 8 9 1 3 5 7 10 repeat - { - case 0: - case 1: - case 2: - case 3: - aiState = ((CalamityWorld.death && !CalamityWorld.bossRushActive) ? 5 : 1); //normal charges - break; - case 4: - case 5: - case 6: - aiState = 5; //fast charges - break; - case 7: - aiState = 3; //big tornado - break; - case 8: - aiState = 6; //slow flare bombs - break; - case 9: - npc.ai[3] = 1f; - aiState = 7; //small tornado - break; - case 10: - npc.ai[3] = 0f; - aiState = 2; //flare circle - break; - } - if (phase4Check) - { - aiState = 4; - } - if (aiState == 1) - { - npc.ai[0] = 14f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 2) - { - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 15f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 3) - { - npc.ai[0] = 16f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 4) - { - npc.ai[0] = 17f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 5) - { - npc.ai[0] = 18f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 6) - { - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 19f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 7) - { - npc.ai[0] = 20f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 14f) //charge - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - int num1479 = 7; - for (int num1480 = 0; num1480 < num1479; num1480++) - { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default(Vector2)) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num1481].noGravity = true; - Main.dust[num1481].noLight = true; - Main.dust[num1481].velocity /= 4f; - Main.dust[num1481].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 15f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[2] % (float)num1462 == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != 1) - { - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount && NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) - { - NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, (Main.rand.Next(2) == 0 ? mod.NPCType("DetonatingFlare") : mod.NPCType("DetonatingFlare2")), 0, 0f, 0f, 0f, 0f, 255); - } - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-401, 401) * 0.13f, (float)Main.rand.Next(-31, 31) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); //changed - Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-31, 31) * 0.13f, (float)Main.rand.Next(-151, 151) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); //changed - } - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default(Vector2)); - npc.rotation -= num1463 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 16f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (Main.netMode != 1 && npc.ai[2] == (float)(num1457 - 30)) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 3f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 17f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - if (npc.ai[2] < (float)(num1459 - 90)) - { - bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); - if (colliding) - { - npc.alpha += 15; - } - else - { - npc.alpha -= 15; - } - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.alpha > 150) - { - npc.alpha = 150; - } - } - else if (npc.alpha < 255) - { - npc.alpha += 4; - 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] == (float)(num1459 - 60)) - { - 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] >= (float)num1459) - { - npc.ai[0] = 21f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 18f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - int num1479 = 14; - for (int num1480 = 0; num1480 < num1479; num1480++) - { - Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default(Vector2)) + vectorCenter; - Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num1481].noGravity = true; - Main.dust[num1481].noLight = true; - Main.dust[num1481].velocity /= 4f; - Main.dust[num1481].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime2) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 19f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[2] % (float)num1462 == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != 1) - { - int damage = expertMode ? 75 : 90; //700 - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - 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 = player.position.X + (float)player.width * 0.5f - vectorShoot.X; - float playerY = player.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 + xPos, (int)vector173.Y - 15, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default(Vector2)); - npc.rotation -= num1463 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 20f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1457 - 30)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (CalamityWorld.death && !CalamityWorld.bossRushActive) - { - if (Main.netMode != 1 && npc.ai[2] == (float)(num1457 - 30)) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - } - else - { - if (Main.netMode != 1 && npc.ai[2] == (float)(num1457 - 30)) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1457) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - #endregion - #region Phase4 - else if (npc.ai[0] == 21f && !player.dead) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = false; - if (npc.alpha < 255) - { - npc.alpha += 25; - if (npc.alpha > 255) - { - npc.alpha = 255; - } - } - if (npc.ai[1] == 0f) - { - teleportLocation = (Main.rand.Next(2) == 0 ? (revenge ? 500 : 600) : (revenge ? -500 : -600)); - npc.ai[1] = (float)(360 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 value7 = player.Center + new Vector2(npc.ai[1], (float)teleportLocation) - vectorCenter; //teleport distance - Vector2 desiredVelocity = Vector2.Normalize(value7 - npc.velocity) * scaleFactor; - npc.SimpleFlyMovement(desiredVelocity, npcVelocity); - int num32 = Math.Sign(player.Center.X - vectorCenter.X); - if (num32 != 0) - { - if (npc.ai[2] == 0f && num32 != npc.direction) - { - npc.rotation = 3.14159274f; - } - npc.direction = num32; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)aiChangeRate) - { - int aiState = 0; - switch ((int)npc.ai[3]) - { - case 0: //skip 1 - case 2: - case 3: //skip 4 - case 5: - case 6: - case 7: //skip 8 - case 9: - case 10: - case 11: - case 12: //skip 13 - case 14: - case 15: - case 16: - case 17: - case 18: //skip 19 - aiState = 1; - break; - case 1: //+3 - case 4: //+4 - case 8: //+5 - case 13: //+6 - case 19: - aiState = 2; - break; - } - if (phase5Check) - { - aiState = 4; - } - if (aiState == 1) - { - npc.ai[0] = 22f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num32 != 0) - { - npc.direction = num32; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - else if (aiState == 2) - { - npc.ai[0] = 23f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 3) - { - npc.ai[0] = 24f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (aiState == 4) - { - npc.ai[0] = 25f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 22f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - npc.alpha -= 25; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - int num34 = 7; - for (int m = 0; m < num34; m++) - { - Vector2 vector11 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; - vector11 = vector11.RotatedBy((double)(m - (num34 / 2 - 1)) * 3.1415926535897931 / (double)((float)num34), default(Vector2)) + vectorCenter; - Vector2 value8 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num35 = Dust.NewDust(vector11 + value8, 0, 0, 244, value8.X * 2f, value8.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num35].noGravity = true; - Main.dust[num35].noLight = true; - Main.dust[num35].velocity /= 4f; - Main.dust[num35].velocity -= npc.velocity; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) - { - npc.ai[0] = 21f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 23f) - { - npc.dontTakeDamage = true; - npc.chaseable = false; - 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] == (float)(num1460 / 2)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - if (Main.netMode != 1 && npc.ai[2] == (float)(num1460 / 2)) - { - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); - } - Vector2 center = player.Center + new Vector2(-npc.ai[1], teleportLocation); //teleport distance - vectorCenter = (npc.Center = center); - int num36 = Math.Sign(player.Center.X - vectorCenter.X); - if (num36 != 0) - { - if (npc.ai[2] == 0f && num36 != npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.direction = num36; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1460) - { - npc.ai[0] = 21f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - if (npc.ai[3] == 5f && Main.netMode != 1) - { - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); - } - if (npc.ai[3] >= 20f) //14 - { - npc.ai[3] = 0f; - } - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 24f) - { - npc.dontTakeDamage = phase5Check; - npc.chaseable = true; - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default(Vector2)); - npc.rotation -= num1463 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num1461) - { - npc.ai[0] = 21f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 25f) //start phase 5 - { - npc.alpha = 0; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num1459 - 60)) - { - 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] >= (float)num1459) - { - startSecondAI = true; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - #endregion - } - - #region AI2 - public void Yharon_AI2() - { - bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool expertMode = Main.expertMode; - 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) - { - 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; - } - npc.defense = 100; - if (npc.ai[0] != 8f) - { - npc.alpha -= 25; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (!moveCloser) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DragonGod"); - else - music = MusicID.LunarBoss; - moveCloser = true; - string key = "Mods.CalamityMod.FlameText"; - 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); - } - } - if (invincibilityCounter < 900) - { - phase2 = phase3 = phase4 = false; - invincibilityCounter += 1; - int heal = 5; //900 / 5 = 180 - healCounter += 1; - if (healCounter >= heal) - { - healCounter = 0; - if (Main.netMode != 1) - { - int healAmt = npc.lifeMax / 200; - if (healAmt > npc.lifeMax - npc.life) - { - healAmt = npc.lifeMax - npc.life; - } - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } - } - } - } - else - { - npc.dontTakeDamage = npc.ai[0] == 9f; - npc.chaseable = npc.ai[0] < 8f; - } - NPCUtils.TargetClosestBetsy(npc, false, null); - NPCAimedTarget targetData = npc.GetTargetData(true); - if (!targetData.Hitbox.Intersects(safeBox)) - { - protectionBoost = true; - npc.damage = npc.defDamage * 5; - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - } - else - { - npc.damage = expertMode ? 528 : 330; - if (phase4) - { - npc.damage = (int)((double)npc.damage * 1.25); - } - protectionBoost = false; - if (npc.timeLeft < 3600) - { - npc.timeLeft = 3600; - } - } - int num = -1; - float num2 = 1f; - 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 = 80f; - float num13 = num11 + num12; - float num15 = 60f; - float scaleFactor3 = 14f; - float scaleFactor4 = revenge ? 16f : 15f; //12 - int num16 = 10; - int num17 = 6 * num16; - float num18 = 60f; - float num19 = num15 + (float)num17 + num18; - float num20 = 60f; - float num21 = 1f; - float num22 = 6.28318548f * (num21 / num20); - float scaleFactor5 = revenge ? 38f : 36.5f; //32 - 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; - chargeSpeed = 32f; - chargeSpeed2 = 45f; - scaleFactor4 = 18f; - scaleFactor5 = 40f; - } - float num25 = 20f; - float arg_F9_0 = npc.ai[0]; - float num26; - if (npc.ai[0] == 0f) - { - float[] expr_115_cp_0 = npc.ai; - 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 >= 10f) - { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - if (npc.ai[2] == 0f) - { - npc.ai[2] = (float)((npc.Center.X < targetData.Center.X) ? 1 : -1); - } - Vector2 destination = targetData.Center + new Vector2(-npc.ai[2] * 300f, -200f); - Vector2 desiredVelocity = npc.DirectionTo(destination) * scaleFactor; - npc.SimpleFlyMovement(desiredVelocity, num6); - int num27 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.direction = (npc.spriteDirection = num27); - float[] expr_225_cp_0 = npc.ai; - 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 >= 30f) - { - int num28 = 1; - 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]) - { - case 0: - num28 = 6; //tornado - break; - case 1: - num28 = 7; //fast charge - break; - case 2: - num28 = 8; //teleport - break; - case 3: - num28 = 7; //fast charge - break; - case 4: - 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 = 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; - } - } - else if (phase2) - { - switch ((int)npc.ai[3]) - { - case 0: - num28 = 6; //tornado - break; - case 1: - num28 = 7; //fast charge - break; - case 2: - num28 = 2; //charge - break; - case 3: - num28 = 5; //fire circle - break; - case 4: - num28 = 4; //fireballs - break; - case 5: - num28 = 7; //fast charge - break; - case 6: - num28 = 2; //charge - break; - case 7: - num28 = 3; //fireballs - break; - case 8: - num28 = 7; //fast charge - break; - case 9: - num28 = 2; //charge - break; - case 10: - num28 = 5; //fire circle - break; - } - } - else - { - switch ((int)npc.ai[3]) - { - case 0: - num28 = 6; //tornado - break; - case 1: - case 2: - num28 = 2; //charge - break; - case 3: - num28 = 3; //fireballs - break; - case 4: - case 5: - num28 = 2; //charge - break; - case 6: - num28 = 4; //fireballs - break; - case 7: - case 8: - num28 = 2; //charge - break; - case 9: - num28 = 5; //fire circle - break; - } - } - npc.ai[0] = (float)num28; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - switch (secondPhasePhase) - { - 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) - { - npc.ai[3] = 0f; - } - switch (num28) - { - case 2: //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 * chargeSpeed; - break; - } - case 3: //fireballs - { - Vector2 vector2 = new Vector2((float)((targetData.Center.X > npc.Center.X) ? 1 : -1), 0f); - npc.spriteDirection = ((vector2.X > 0f) ? 1 : -1); - npc.velocity = vector2 * -2f; - break; - } - case 5: //spin move - { - Vector2 vector3 = npc.DirectionTo(targetData.Center); - npc.spriteDirection = ((vector3.X > 0f) ? 1 : -1); - npc.rotation = vector3.ToRotation(); - if (npc.spriteDirection == -1) - { - npc.rotation += 3.14159274f; - } - 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] == 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 >= chargeTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - 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 * -600f, -250f); - Vector2 value = npc.DirectionTo(vector4) * 12f; - if (npc.Distance(vector4) < 12f) - { - npc.Center = vector4; - } - else - { - npc.position += value; - } - if (Vector2.Distance(vector4, npc.Center) < 16f) - { - npc.ai[1] = num11 - 1f; - } - num2 = 1.5f; - } - if (npc.ai[1] == num11) - { - int num30 = (targetData.Center.X > npc.Center.X) ? 1 : -1; - npc.velocity = new Vector2((float)num30, 0f) * 22f; //10f - npc.direction = (npc.spriteDirection = num30); - } - if (npc.ai[1] >= num11) - { - if (npc.ai[1] % 8 == 0 && Main.netMode != 1) - { - float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, - default(Vector2)); - 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) - { - npc.velocity.X = npc.velocity.X + (float)Math.Sign(npc.velocity.X) * 0.5f; - } - } - if (npc.ai[1] >= num13) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - 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 * -1500f, -350f); - Vector2 value2 = npc.DirectionTo(vector5) * scaleFactor3; - 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) - { - npc.ai[1] = num15 - 1f; - } - num2 = 1.5f; - } - else if (npc.ai[1] == num15) - { - Vector2 vector6 = npc.DirectionTo(targetData.Center); - vector6.Y *= 0.25f; - vector6 = vector6.SafeNormalize(Vector2.UnitX * (float)npc.direction); - npc.spriteDirection = ((vector6.X > 0f) ? 1 : -1); - npc.rotation = vector6.ToRotation(); - if (npc.spriteDirection == -1) - { - npc.rotation += 3.14159274f; - } - npc.velocity = vector6 * scaleFactor4; - } - else - { - npc.position.X = npc.position.X + npc.DirectionTo(targetData.Center).X * 7f; - npc.position.Y = npc.position.Y + npc.DirectionTo(targetData.Center + new Vector2(0f, -400f)).Y * 6f; - if (npc.ai[1] <= num19 - num18) - { - num2 = 1.5f; - } - float num33 = 30f; - 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); - } - } - if (npc.ai[1] > num19 - num18) - { - npc.velocity.Y = npc.velocity.Y - 0.1f; - } - npc.ai[1] += 1f; - if (npc.ai[1] >= num19) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - 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 - 0.1f; - npc.position += npc.DirectionTo(targetData.Center) * 10f; - npc.rotation -= num22 * (float)npc.direction; - num2 *= 0.7f; - if (npc.ai[1] == 1f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - } - float[] expr_B0F_cp_0 = npc.ai; - 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 (Main.netMode != 1) - { - 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) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity /= 2f; - } - } - else if (npc.ai[0] == 6f) //flare spawn - { - if (npc.ai[1] == 0f) - { - Vector2 destination2 = targetData.Center + new Vector2(0f, -200f); - Vector2 desiredVelocity2 = npc.DirectionTo(destination2) * scaleFactor * 2f; - npc.SimpleFlyMovement(desiredVelocity2, num6 * 2f); - int num35 = (npc.Center.X < targetData.Center.X) ? 1 : -1; - npc.direction = (npc.spriteDirection = num35); - npc.ai[2] += 1f; - if (npc.Distance(targetData.Center) < 1000f || npc.ai[2] >= 180f) //450f - { - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } - else - { - if (npc.ai[1] == 1f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.ai[1] < num25) - { - npc.velocity *= 0.95f; - } - else - { - npc.velocity *= 0.98f; - } - if (npc.ai[1] == num25) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y / 3f; - } - npc.velocity.Y = npc.velocity.Y - 3f; - } - num2 *= 0.85f; - bool flag3 = npc.ai[1] == 20f || npc.ai[1] == 45f || npc.ai[1] == 70f; - int flareCount = NPC.CountNPCS(mod.NPCType("DetonatingFlare")) + NPC.CountNPCS(mod.NPCType("DetonatingFlare2")); - if (flareCount > 5) - { - flag3 = false; - } - if (flag3 && Main.netMode != 1) - { - Vector2 vector7 = npc.Center + (6.28318548f * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 100f * (0.6f + Main.rand.NextFloat() * 0.4f); - if (Vector2.Distance(vector7, targetData.Center) > 100f) - { - Point point2 = vector7.ToPoint(); - 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("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] >= 90f) - { - if (Main.netMode != 1) - { - 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); - } - npc.ai[0] = 1f; - npc.ai[1] = 0f; - 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)); - } - teleportLocation = (Main.rand.Next(2) == 0 ? (revenge ? 600 : 700) : (revenge ? -600 : -700)); - Vector2 center = targetData.Center + new Vector2(-npc.ai[1], (float)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.timeLeft >= 300) - projectile.active = false; - else 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) - { - npc.localAI[0] = 0f; - } - if (num != -1) - { - npc.localAI[0] = (float)(num * 4); - } - float[] expr_11FC_cp_0 = npc.localAI; - int expr_11FC_cp_1 = 1; - num26 = expr_11FC_cp_0[expr_11FC_cp_1] + 1f; - expr_11FC_cp_0[expr_11FC_cp_1] = num26; - if (num26 >= 60f) - { - npc.localAI[1] = 0f; - } - float num42 = npc.DirectionTo(targetData.Center).ToRotation(); - float num43 = 0.04f; - switch ((int)npc.ai[0]) - { - case 2: - case 5: - case 7: - case 8: - case 9: - num43 = 0f; - break; - case 3: - num43 = 0.01f; - num42 = 0f; - if (npc.spriteDirection == -1) - { - num42 -= 3.14159274f; - } - if (npc.ai[1] >= num11) - { - num42 += (float)npc.spriteDirection * 3.14159274f / 12f; - num43 = 0.05f; - } - break; - case 4: - num43 = 0.01f; - num42 = 3.14159274f; - if (npc.spriteDirection == 1) - { - num42 += 3.14159274f; - } - break; - case 6: - num43 = 0.02f; - num42 = 0f; - if (npc.spriteDirection == -1) - { - num42 -= 3.14159274f; - } - break; - } - if (npc.spriteDirection == -1) - { - num42 += 3.14159274f; - } - if (num43 != 0f) - { - npc.rotation = npc.rotation.AngleTowards(num42, num43); - } - } - #endregion - - #region Drawing - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Texture2D texture = Main.npcTexture[npc.type]; - Microsoft.Xna.Framework.Rectangle frame6 = npc.frame; - Microsoft.Xna.Framework.Color color9 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - int num156 = texture.Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - if (startSecondAI && !phaseOneLoot) - { - 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 (invincibilityCounter < 900) - { - color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - } - Microsoft.Xna.Framework.Color alpha16 = npc.GetAlpha(color9); - while (drawAfterImage2 && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - goto IL_6899; - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - alpha16 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); //1.5 - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), alpha16, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects2.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects2, 0f); - goto IL_6881; - } - Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), npc.GetAlpha(color9), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects2, 0); - return false; - } - Microsoft.Xna.Framework.Color alpha15 = npc.GetAlpha(color9); - bool drawAfterImage = (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 8f || npc.ai[0] == 11f || npc.ai[0] == 12f || - npc.ai[0] == 14f || npc.ai[0] == 15f || npc.ai[0] == 18f || npc.ai[0] == 19f || npc.ai[0] == 22f) && Lighting.NotRetro; - while (drawAfterImage && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) - { - goto IL_6899; - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - alpha15 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); //1.5 - Vector2 value4 = (npc.oldPos[num161]); - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), alpha15, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), npc.GetAlpha(color9), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); - return false; - } - #endregion - - #region Loot - public override void NPCLoot() - { - if (!dropLoot) - { - return; - } - if (startSecondAI) - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharonTrophy")); - } - if (Main.rand.Next(40) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VoidVortex")); - } - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharimsCrystal")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BossRush")); - string key = "Mods.CalamityMod.AuricOreText"; - Color messageColor = Color.Gold; - if (!CalamityWorld.downedYharon) - { - CalamityWorld.downedYharon = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - 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(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - else - { - if (!CalamityWorld.buffedEclipse) - { - CalamityWorld.buffedEclipse = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - string key = "Mods.CalamityMod.DargonBossText"; - 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); - } - } - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - if (startSecondAI) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HellcasterFragment"), Main.rand.Next(22, 29), true); - } - npc.DropBossBags(); - } - else - { - if (startSecondAI) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HellcasterFragment"), Main.rand.Next(15, 23), true); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ForgottenDragonEgg")); - } - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharonMask")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AngryChickenStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PhoenixFlameBarrage")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DragonsBreath")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DragonRage")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProfanedTrident")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheBurningSky")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ChickenCannon")); - } - } - } - - public override void BossLoot(ref string name, ref int potionType) - { - potionType = mod.ItemType("OmegaHealingPotion"); - } - #endregion - - #region DamageFormula - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - if (damage > npc.lifeMax / 10 || (!startSecondAI && dropLoot)) - { - damage = 0; - return false; - } - double newDamage = (damage + (int)((double)defense * 0.25)); - if (newDamage < 1.0) - { - newDamage = 1.0; - } - if (newDamage >= 1.0) - { - if (startSecondAI) - { - float protection = (((npc.ichor || npc.onFire2) ? 0.17f : 0.22f) + - (protectionBoost ? 0.68f : 0f)); //0.85 or 0.9 - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - } - else - { - float protection = (((npc.ichor || npc.onFire2) ? 0.12f : 0.17f) + - (protectionBoost ? 0.73f : 0f)); //0.85 or 0.9 - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - } - if (newDamage < 1.0) - { - newDamage = 1.0; - } - } - damage = newDamage; - return true; - } - #endregion - - #region HPBarCooldownSlotandStats - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - scale = 2f; - return null; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - #endregion - - #region FindFrame - public override void FindFrame(int frameHeight) - { - if ((!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) || - (startSecondAI && (npc.ai[0] == 5f || npc.ai[0] < 2f))) //idle - { - int num84 = 4; //5 - if (!startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) //Phase ai switch - { - num84 = 3; //4 - } - npc.frameCounter += 1.0; - if (npc.frameCounter > (double)num84) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y >= frameHeight * 5) //6 - { - npc.frame.Y = 0; - } - } - if ((!startSecondAI && (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)) || - (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f))) //Charging or birb spawn - { - npc.frame.Y = frameHeight * 5; //6 - } - if ((!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 23f)) || - (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f || npc.ai[0] == 8f))) //Fireball spit, teleport, circle, flamethrower - { - npc.frame.Y = frameHeight * 5; //6 - } - if (!startSecondAI && (npc.ai[0] == 3f || npc.ai[0] == 9f || npc.ai[0] == -1f || npc.ai[0] == 16f || npc.ai[0] == 20f || npc.ai[0] == 24f)) //Summon tornadoes - { - int num85 = 90; - if (npc.ai[2] < (float)(num85 - 30) || npc.ai[2] > (float)(num85 - 10)) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) //5 - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y >= frameHeight * 5) //6 - { - npc.frame.Y = 0; - } - } - else - { - npc.frame.Y = frameHeight * 5; //6 - if (npc.ai[2] > (float)(num85 - 20) && npc.ai[2] < (float)(num85 - 15)) - { - npc.frame.Y = frameHeight * 6; //7 - } - } - } - if ((!startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f || npc.ai[0] == 25f)) || - (startSecondAI && npc.ai[0] == 9f)) //Enter new phase - { - int num86 = 180; - if (npc.ai[2] < (float)(num86 - 60) || npc.ai[2] > (float)(num86 - 20)) - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 4.0) //5 - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y >= frameHeight * 5) //6 - { - npc.frame.Y = 0; - } - } - else - { - npc.frame.Y = frameHeight * 5; //6 - if (npc.ai[2] > (float)(num86 - 50) && npc.ai[2] < (float)(num86 - 25)) - { - npc.frame.Y = frameHeight * 6; //7 - } - } - } - } - #endregion - - #region Boom - public void Boom(int timeLeft, int damage) - { - if (Main.netMode != 1) - { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; - for (iBoom = 0; iBoom < 25; iBoom++) - { - offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 5f), (float)(Math.Cos(offsetAngleBoom) * 5f), mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 5f), (float)(-Math.Cos(offsetAngleBoom) * 5f), mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[boom1].timeLeft = timeLeft; - Main.projectile[boom2].timeLeft = timeLeft; - } - } - } - #endregion - - #region HitEffect - 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) - { - Boom(150, 1000); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 300; - npc.height = 280; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default(Color), 3f); - 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, 244, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - #endregion - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Utilities; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using CalamityMod.Projectiles; +using CalamityMod.World; + +/*Possibly add in a final phase for AI 2 that is similar to Sif's final phase in Dark Souls*/ + +namespace CalamityMod.NPCs.Yharon +{ + [AutoloadBossHead] + public class Yharon : ModNPC + { + private Rectangle safeBox = default(Rectangle); + private bool protectionBoost = false; + private bool moveCloser = false; + private bool phaseOneLoot = false; + private bool dropLoot = false; + private bool useTornado = true; + private int healCounter = 0; + private int secondPhasePhase = 1; + private int teleportLocation = 0; + private bool startSecondAI = false; + private bool spawnArena = false; + private int invincibilityCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Jungle Dragon, Yharon"); + Main.npcFrameCount[npc.type] = 7; + } + + public override void SetDefaults() + { + npc.npcSlots = 50f; + npc.damage = 330; + npc.width = 200; //200 + npc.height = 200; //200 + npc.defense = 200; + npc.lifeMax = CalamityWorld.revenge ? 2525000 : 2275000; + if (CalamityWorld.death) + { + npc.lifeMax = 3025000; + } + if (CalamityWorld.bossRushActive) + { + 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 + npc.value = Item.buyPrice(1, 50, 0, 0); + npc.boss = true; + 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[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.noGravity = true; + npc.noTileCollide = true; + npc.netAlways = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARON"); + else + music = MusicID.Boss1; + if (CalamityWorld.downedBuffedMothron || CalamityWorld.bossRushActive) + { + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARONREBIRTH"); + else + music = MusicID.Boss3; + } + npc.HitSound = SoundID.NPCHit56; + npc.DeathSound = SoundID.NPCDeath60; + bossBag = mod.ItemType("YharonBag"); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(protectionBoost); + writer.Write(moveCloser); + writer.Write(phaseOneLoot); + writer.Write(dropLoot); + writer.Write(useTornado); + writer.Write(healCounter); + writer.Write(secondPhasePhase); + writer.Write(teleportLocation); + writer.Write(startSecondAI); + writer.Write(spawnArena); + writer.Write(invincibilityCounter); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + protectionBoost = reader.ReadBoolean(); + moveCloser = reader.ReadBoolean(); + phaseOneLoot = reader.ReadBoolean(); + dropLoot = reader.ReadBoolean(); + useTornado = reader.ReadBoolean(); + healCounter = reader.ReadInt32(); + secondPhasePhase = reader.ReadInt32(); + teleportLocation = reader.ReadInt32(); + startSecondAI = reader.ReadBoolean(); + spawnArena = reader.ReadBoolean(); + invincibilityCounter = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + #region StartupOrSwitchToAI2 + dropLoot = (double)npc.life <= (double)npc.lifeMax * 0.1; + + if (Main.raining) + CalamityGlobalNPC.StopRain(); + + if (startSecondAI) + { + if (!CalamityWorld.downedBuffedMothron && !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.DargonBossText2"; + 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); + } + startSecondAI = false; + npc.boss = false; + npc.life = 0; + if (dropLoot) + { + npc.NPCLoot(); + } + npc.active = false; + npc.netUpdate = true; + } + return; + } + phaseOneLoot = false; + Yharon_AI2(); + return; + } + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = Main.expertMode; + bool phase2Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.85 : 0.7); //Check for phase 2. In phase 1 for 15% or 30% + bool phase3Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.6 : 0.4); //Check for phase 3. In phase 2 for 25% or 30% + bool phase4Check = (double)npc.life <= (double)npc.lifeMax * (revenge ? 0.25 : 0.2); //Check for phase 4. In phase 3 for 35% or 20% + if (CalamityWorld.death && !CalamityWorld.bossRushActive) + { + phase2Check = (double)npc.life <= (double)npc.lifeMax * 0.9; //Check for phase 2. In phase 1 for 10% + phase3Check = (double)npc.life <= (double)npc.lifeMax * 0.8; //Check for phase 3. In phase 2 for 10% + phase4Check = (double)npc.life <= (double)npc.lifeMax * 0.3; //Check for phase 4. In phase 3 for 50% + } + bool phase5Check = (double)npc.life <= (double)npc.lifeMax * 0.1; //Check for phase 5. In phase 4 for 15% or 10% or 20% + bool phase2Change = npc.ai[0] > 5f; //Phase 2 stuff + bool phase3Change = npc.ai[0] > 12f; //Phase 3 stuff + bool phase4Change = npc.ai[0] > 20f; //Phase 4 stuff + int flareCount = 3; + bool isCharging = npc.ai[3] < 20f; //10 + if (!spawnArena) + { + spawnArena = true; + Vector2 vectorPlayer = new Vector2(Main.player[npc.target].position.X, Main.player[npc.target].position.Y); + safeBox.X = (int)(vectorPlayer.X - (revenge ? 3000f : 3500f)); + safeBox.Y = (int)(vectorPlayer.Y - (revenge ? 9000f : 10500f)); + safeBox.Width = revenge ? 6000 : 7000; + safeBox.Height = revenge ? 18000 : 21000; + if (Main.netMode != 1) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + (revenge ? 3000f : 3500f), Main.player[npc.target].position.Y + 100f, 0f, 0f, mod.ProjectileType("SkyFlareRevenge"), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Main.player[npc.target].position.X - (revenge ? 3000f : 3500f), Main.player[npc.target].position.Y + 100f, 0f, 0f, mod.ProjectileType("SkyFlareRevenge"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + #endregion + #region SpeedOrDamageChecks + if (phase4Change) + { + npc.defense = 140; + } + else if (phase3Change) + { + npc.defense = 160; + } + else if (phase2Change) + { + npc.defense = 180; + } + else + { + npc.defense = 200; + } + int aiChangeRate = expertMode ? 36 : 38; + float npcVelocity = expertMode ? 0.7f : 0.69f; + float scaleFactor = expertMode ? 11f : 10.8f; + if (phase4Change || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + npcVelocity = 0.95f; + scaleFactor = 14f; + aiChangeRate = 25; + } + else if (phase3Change) + { + npcVelocity = 0.9f; + scaleFactor = 13f; + aiChangeRate = 25; + } + else if (phase2Change && isCharging) + { + npcVelocity = (expertMode ? 0.8f : 0.78f); + scaleFactor = (expertMode ? 12.2f : 12f); + aiChangeRate = (expertMode ? 36 : 38); + } + else if (isCharging && !phase2Change && !phase3Change && !phase4Change) + { + aiChangeRate = 25; + } + int chargeTime = expertMode ? 38 : 40; + 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 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) //phase 4 + { + chargeTime = 28; + chargeSpeed = 31f; //27 + } + else if (phase3Change) //phase 3 + { + chargeTime = 32; + chargeTime2 = 27; + chargeSpeed = 25f; //27 + chargeSpeed2 = 41f; + } + else if (isCharging && phase2Change) //phase 2 + { + chargeTime = expertMode ? 35 : 37; + chargeTime2 = expertMode ? 31 : 33; + if (expertMode) + { + chargeSpeed = 24f; //21 + chargeSpeed2 = 39f; + } + } + #endregion + #region VariablesForChargingEtc + int xPos = (npc.direction == 1 ? 25 : -25); + int num1454 = 80; + int num1455 = 4; + float num1456 = 0.3f; + float scaleFactor11 = 5f; + int num1457 = 90; + int num1458 = 180; + int num1459 = 180; + int num1460 = 30; + int num1461 = 120; + int num1462 = 4; + float scaleFactor13 = 20f; + float num1463 = 6.28318548f / (float)(num1461 / 2); + int num1464 = 75; + #endregion + #region DespawnOrEnrage + Vector2 vectorCenter = 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) + { + npc.velocity.Y = npc.velocity.Y - 0.4f; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + if (npc.ai[0] > 12f) + { + npc.ai[0] = 13f; + } + else if (npc.ai[0] > 5f) + { + npc.ai[0] = 6f; + } + else + { + npc.ai[0] = 0f; + } + npc.ai[2] = 0f; + } + else if (npc.timeLeft < 3600) + { + npc.timeLeft = 3600; + } + if (!Main.player[npc.target].Hitbox.Intersects(safeBox)) + { + aiChangeRate = 15; + protectionBoost = true; + npc.damage = npc.defDamage * 5; + chargeSpeed += 25f; + } + else + { + npc.damage = expertMode ? 528 : 330; + protectionBoost = false; + } + #endregion + #region Rotation + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != 1) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + float npcRotation = (float)Math.Atan2((double)(player.Center.Y - vectorCenter.Y), (double)(player.Center.X - vectorCenter.X)); + if (npc.spriteDirection == 1) + { + npcRotation += 3.14159274f; + } + if (npcRotation < 0f) + { + npcRotation += 6.28318548f; + } + if (npcRotation > 6.28318548f) + { + npcRotation -= 6.28318548f; + } + if (npc.ai[0] == -1f) //spawn + { + npcRotation = 0f; + } + if (npc.ai[0] == 3f) //tornado + { + npcRotation = 0f; + } + if (npc.ai[0] == 4f) //enter new phase + { + npcRotation = 0f; + } + if (npc.ai[0] == 9f) //tornado + { + npcRotation = 0f; + } + if (npc.ai[0] == 10f) //enter new phase + { + npcRotation = 0f; + } + if (npc.ai[0] == 16f) //tornado + { + npcRotation = 0f; + } + if (npc.ai[0] == 20f) //tornado + { + npcRotation = 0f; + } + float npcRotationSpeed = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f) //charge + { + npcRotationSpeed = 0f; + } + if (npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f) //circle + { + npcRotationSpeed = 0f; + } + if (npc.ai[0] == 3f) //tornado + { + npcRotationSpeed = 0.01f; + } + if (npc.ai[0] == 4f) //enter new phase + { + npcRotationSpeed = 0.01f; + } + if (npc.ai[0] == 9f || npc.ai[0] == 16f || npc.ai[0] == 20f) //tornado + { + npcRotationSpeed = 0.01f; + } + if (npc.rotation < npcRotation) + { + if ((double)(npcRotation - npc.rotation) > 3.1415926535897931) + { + npc.rotation -= npcRotationSpeed; + } + else + { + npc.rotation += npcRotationSpeed; + } + } + if (npc.rotation > npcRotation) + { + if ((double)(npc.rotation - npcRotation) > 3.1415926535897931) + { + npc.rotation += npcRotationSpeed; + } + else + { + npc.rotation -= npcRotationSpeed; + } + } + if (npc.rotation > npcRotation - npcRotationSpeed && npc.rotation < npcRotation + npcRotationSpeed) + { + npc.rotation = npcRotation; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.28318548f; + } + if (npc.rotation > 6.28318548f) + { + npc.rotation -= 6.28318548f; + } + if (npc.rotation > npcRotation - npcRotationSpeed && npc.rotation < npcRotation + npcRotationSpeed) + { + npc.rotation = npcRotation; + } + #endregion + #region AlphaAndInitialSpawnEffects + if (npc.ai[0] != -1f && npc.ai[0] < 9f) + { + bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); + if (colliding) + { + npc.alpha += 15; + } + else + { + npc.alpha -= 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + if (npc.ai[0] == -1f) //initial spawn effects + { + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.velocity *= 0.98f; + int num1467 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1467 != 0) + { + npc.direction = num1467; + npc.spriteDirection = -npc.direction; + } + if (npc.ai[2] > 20f) + { + npc.velocity.Y = -2f; + npc.alpha -= 5; + bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); + if (colliding) + { + npc.alpha += 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + if (npc.ai[2] == (float)(num1457 - 30)) + { + int num1468 = 72; + for (int num1469 = 0; num1469 < num1468; num1469++) + { + Vector2 vector169 = Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f; + vector169 = vector169.RotatedBy((double)((float)(num1469 - (num1468 / 2 - 1)) * 6.28318548f / (float)num1468), default(Vector2)) + npc.Center; + Vector2 value16 = vector169 - npc.Center; + int num1470 = Dust.NewDust(vector169 + value16, 0, 0, 244, value16.X * 2f, value16.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num1470].noGravity = true; + Main.dust[num1470].noLight = true; + Main.dust[num1470].velocity = Vector2.Normalize(value16) * 3f; + } + 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] >= (float)num1464) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + #endregion + #region Phase1 + else if (npc.ai[0] == 0f && !player.dead) + { + npc.dontTakeDamage = false; + npc.chaseable = true; + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value17 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; + Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector170.X) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + if (npc.velocity.X < 0f && vector170.X > 0f) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + } + } + else if (npc.velocity.X > vector170.X) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + if (npc.velocity.X > 0f && vector170.X < 0f) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + } + } + if (npc.velocity.Y < vector170.Y) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + if (npc.velocity.Y < 0f && vector170.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + } + } + else if (npc.velocity.Y > vector170.Y) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + if (npc.velocity.Y > 0f && vector170.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + } + } + int num1471 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1471 != 0) + { + if (npc.ai[2] == 0f && num1471 != npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.direction = num1471; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)aiChangeRate) + { + int aiState = 0; + switch ((int)npc.ai[3]) //0 2 4 6 1 3 5 7 repeat + { + case 0: + case 1: + case 2: + case 3: + case 4: + aiState = 1; //normal charges + break; + case 5: + aiState = 5; //fast charge + break; + case 6: + npc.ai[3] = 1f; + aiState = 2; //fireball attack + break; + case 7: + npc.ai[3] = 0f; + aiState = 3; //tornadoes + break; + } + if (phase2Check) + { + aiState = 4; + } + if (aiState == 1) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1471 != 0) + { + npc.direction = num1471; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 2) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 3) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 4) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 5) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1471 != 0) + { + npc.direction = num1471; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) //charge attack + { + 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)) + vectorCenter; + 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; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) //fireball attack + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value19 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; + Vector2 vector172 = Vector2.Normalize(value19 - npc.velocity) * scaleFactor11; + if (npc.velocity.X < vector172.X) + { + npc.velocity.X = npc.velocity.X + num1456; + if (npc.velocity.X < 0f && vector172.X > 0f) + { + npc.velocity.X = npc.velocity.X + num1456; + } + } + else if (npc.velocity.X > vector172.X) + { + npc.velocity.X = npc.velocity.X - num1456; + if (npc.velocity.X > 0f && vector172.X < 0f) + { + npc.velocity.X = npc.velocity.X - num1456; + } + } + if (npc.velocity.Y < vector172.Y) + { + npc.velocity.Y = npc.velocity.Y + num1456; + if (npc.velocity.Y < 0f && vector172.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num1456; + } + } + else if (npc.velocity.Y > vector172.Y) + { + npc.velocity.Y = npc.velocity.Y - num1456; + if (npc.velocity.Y > 0f && vector172.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - num1456; + } + } + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[2] % (float)num1455 == 0f) //fire flare bombs from mouth + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != 1) + { + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + if (NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) + { + NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, mod.NPCType("DetonatingFlare"), 0, 0f, 0f, 0f, 0f, 255); + } + int damage = expertMode ? 75 : 90; //700 + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, 0f, 0f, mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + int num1476 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1476 != 0) + { + npc.direction = num1476; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1454) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) //Fire small flares + { + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1457 - 30)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (Main.netMode != 1 && npc.ai[2] == (float)(num1457 - 30)) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); //changed + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, (float)(-(float)npc.direction * 2), 8f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 0f, 0f); //changed + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1457) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) //enter phase 2 + { + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1458 - 60)) + { + 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] >= (float)num1458) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 5f) + { + int num1473 = 14; + 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)) + vectorCenter; + 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); //changed + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime2) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + #endregion + #region Phase2 + else if (npc.ai[0] == 6f && !player.dead) //phase 2 + { + npc.dontTakeDamage = false; + npc.chaseable = true; + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; + Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector175.X) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + if (npc.velocity.X < 0f && vector175.X > 0f) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + } + } + else if (npc.velocity.X > vector175.X) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + if (npc.velocity.X > 0f && vector175.X < 0f) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + } + } + if (npc.velocity.Y < vector175.Y) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + if (npc.velocity.Y < 0f && vector175.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + } + } + else if (npc.velocity.Y > vector175.Y) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + if (npc.velocity.Y > 0f && vector175.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + } + } + int num1477 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1477 != 0) + { + if (npc.ai[2] == 0f && num1477 != npc.direction) + { + npc.rotation = 3.14159274f; + } + npc.direction = num1477; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)aiChangeRate) + { + int aiState = 0; + switch ((int)npc.ai[3]) //0 2 4 6 8 1 3 5 7 9 repeat + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + aiState = 1; + break; + case 6: + aiState = 5; + break; + case 7: + aiState = 6; + break; + case 8: + npc.ai[3] = 1f; + aiState = 2; + break; + case 9: + npc.ai[3] = 0f; + aiState = 3; + break; + } + if (phase3Check) + { + aiState = 4; + } + if (aiState == 1) + { + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 2) + { + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 8f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 3) + { + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 4) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 5) + { + npc.ai[0] = 11f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 6) + { + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 12f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 7f) //charge + { + int num1479 = 7; + for (int num1480 = 0; num1480 < num1479; num1480++) + { + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default(Vector2)) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default(Color), 1.4f); //changed + Main.dust[num1481].noGravity = true; + Main.dust[num1481].noLight = true; + Main.dust[num1481].velocity /= 4f; + Main.dust[num1481].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 8f) + { + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[2] % (float)num1462 == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != 1) + { + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount) + { + NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, mod.NPCType("DetonatingFlare2"), 0, 0f, 0f, 0f, 0f, 255); + } + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-400, 401) * 0.13f, (float)Main.rand.Next(-30, 31) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); //changed + } + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default(Vector2)); + npc.rotation -= num1463 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1461) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 9f) + { + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1457 - 30)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (Main.netMode != 1 && npc.ai[2] == (float)(num1457 - 30)) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1457) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 10f) //start phase 3 + { + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1459 - 60)) + { + 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] >= (float)num1459) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 11f) + { + int num1479 = 14; + for (int num1480 = 0; num1480 < num1479; num1480++) + { + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default(Vector2)) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default(Color), 1.4f); //changed + Main.dust[num1481].noGravity = true; + Main.dust[num1481].noLight = true; + Main.dust[num1481].velocity /= 4f; + Main.dust[num1481].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime2) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 12f) + { + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[2] % (float)num1462 == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != 1) + { + int damage = expertMode ? 75 : 90; //700 + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + 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 = player.position.X + (float)player.width * 0.5f - vectorShoot.X; + float playerY = player.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 + xPos, (int)vector173.Y - 15, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default(Vector2)); + npc.rotation -= num1463 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1461) + { + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + #endregion + #region Phase3 + else if (npc.ai[0] == 13f && !player.dead) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; + Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector175.X) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + if (npc.velocity.X < 0f && vector175.X > 0f) + { + npc.velocity.X = npc.velocity.X + npcVelocity; + } + } + else if (npc.velocity.X > vector175.X) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + if (npc.velocity.X > 0f && vector175.X < 0f) + { + npc.velocity.X = npc.velocity.X - npcVelocity; + } + } + if (npc.velocity.Y < vector175.Y) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + if (npc.velocity.Y < 0f && vector175.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + npcVelocity; + } + } + else if (npc.velocity.Y > vector175.Y) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + if (npc.velocity.Y > 0f && vector175.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - npcVelocity; + } + } + int num1477 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1477 != 0) + { + if (npc.ai[2] == 0f && num1477 != npc.direction) + { + npc.rotation = 3.14159274f; + } + npc.direction = num1477; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)aiChangeRate) + { + int aiState = 0; + switch ((int)npc.ai[3]) //0 2 4 6 8 9 1 3 5 7 10 repeat + { + case 0: + case 1: + case 2: + case 3: + aiState = ((CalamityWorld.death && !CalamityWorld.bossRushActive) ? 5 : 1); //normal charges + break; + case 4: + case 5: + case 6: + aiState = 5; //fast charges + break; + case 7: + aiState = 3; //big tornado + break; + case 8: + aiState = 6; //slow flare bombs + break; + case 9: + npc.ai[3] = 1f; + aiState = 7; //small tornado + break; + case 10: + npc.ai[3] = 0f; + aiState = 2; //flare circle + break; + } + if (phase4Check) + { + aiState = 4; + } + if (aiState == 1) + { + npc.ai[0] = 14f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 2) + { + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 15f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 3) + { + npc.ai[0] = 16f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 4) + { + npc.ai[0] = 17f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 5) + { + npc.ai[0] = 18f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed2; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 6) + { + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * scaleFactor13; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num1477 != 0) + { + npc.direction = num1477; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 19f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 7) + { + npc.ai[0] = 20f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 14f) //charge + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + int num1479 = 7; + for (int num1480 = 0; num1480 < num1479; num1480++) + { + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default(Vector2)) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num1481].noGravity = true; + Main.dust[num1481].noLight = true; + Main.dust[num1481].velocity /= 4f; + Main.dust[num1481].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 15f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[2] % (float)num1462 == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != 1) + { + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + if (NPC.CountNPCS(mod.NPCType("DetonatingFlare2")) < flareCount && NPC.CountNPCS(mod.NPCType("DetonatingFlare")) < flareCount) + { + NPC.NewNPC((int)vector.X + xPos, (int)vector.Y - 15, (Main.rand.Next(2) == 0 ? mod.NPCType("DetonatingFlare") : mod.NPCType("DetonatingFlare2")), 0, 0f, 0f, 0f, 0f, 255); + } + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-401, 401) * 0.13f, (float)Main.rand.Next(-31, 31) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); //changed + Projectile.NewProjectile((int)vector.X + xPos, (int)vector.Y - 15, (float)Main.rand.Next(-31, 31) * 0.13f, (float)Main.rand.Next(-151, 151) * 0.13f, mod.ProjectileType("FlareDust"), 0, 0f, Main.myPlayer, 0f, 0f); //changed + } + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default(Vector2)); + npc.rotation -= num1463 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1461) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 16f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1457 - 30)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (Main.netMode != 1 && npc.ai[2] == (float)(num1457 - 30)) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1457) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 3f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 17f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + if (npc.ai[2] < (float)(num1459 - 90)) + { + bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); + if (colliding) + { + npc.alpha += 15; + } + else + { + npc.alpha -= 15; + } + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.alpha > 150) + { + npc.alpha = 150; + } + } + else if (npc.alpha < 255) + { + npc.alpha += 4; + 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] == (float)(num1459 - 60)) + { + 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] >= (float)num1459) + { + npc.ai[0] = 21f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 18f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + int num1479 = 14; + for (int num1480 = 0; num1480 < num1479; num1480++) + { + Vector2 vector176 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector176 = vector176.RotatedBy((double)(num1480 - (num1479 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1479), default(Vector2)) + vectorCenter; + Vector2 value21 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1481 = Dust.NewDust(vector176 + value21, 0, 0, 244, value21.X * 2f, value21.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num1481].noGravity = true; + Main.dust[num1481].noLight = true; + Main.dust[num1481].velocity /= 4f; + Main.dust[num1481].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime2) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 19f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[2] % (float)num1462 == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != 1) + { + int damage = expertMode ? 75 : 90; //700 + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; + 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 = player.position.X + (float)player.width * 0.5f - vectorShoot.X; + float playerY = player.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 + xPos, (int)vector173.Y - 15, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default(Vector2)); + npc.rotation -= num1463 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1461) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 20f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1457 - 30)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (CalamityWorld.death && !CalamityWorld.bossRushActive) + { + if (Main.netMode != 1 && npc.ai[2] == (float)(num1457 - 30)) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + } + else + { + if (Main.netMode != 1 && npc.ai[2] == (float)(num1457 - 30)) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("Flare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1457) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + #endregion + #region Phase4 + else if (npc.ai[0] == 21f && !player.dead) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = false; + if (npc.alpha < 255) + { + npc.alpha += 25; + if (npc.alpha > 255) + { + npc.alpha = 255; + } + } + if (npc.ai[1] == 0f) + { + teleportLocation = (Main.rand.Next(2) == 0 ? (revenge ? 500 : 600) : (revenge ? -500 : -600)); + npc.ai[1] = (float)(360 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 value7 = player.Center + new Vector2(npc.ai[1], (float)teleportLocation) - vectorCenter; //teleport distance + Vector2 desiredVelocity = Vector2.Normalize(value7 - npc.velocity) * scaleFactor; + npc.SimpleFlyMovement(desiredVelocity, npcVelocity); + int num32 = Math.Sign(player.Center.X - vectorCenter.X); + if (num32 != 0) + { + if (npc.ai[2] == 0f && num32 != npc.direction) + { + npc.rotation = 3.14159274f; + } + npc.direction = num32; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)aiChangeRate) + { + int aiState = 0; + switch ((int)npc.ai[3]) + { + case 0: //skip 1 + case 2: + case 3: //skip 4 + case 5: + case 6: + case 7: //skip 8 + case 9: + case 10: + case 11: + case 12: //skip 13 + case 14: + case 15: + case 16: + case 17: + case 18: //skip 19 + aiState = 1; + break; + case 1: //+3 + case 4: //+4 + case 8: //+5 + case 13: //+6 + case 19: + aiState = 2; + break; + } + if (phase5Check) + { + aiState = 4; + } + if (aiState == 1) + { + npc.ai[0] = 22f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num32 != 0) + { + npc.direction = num32; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + else if (aiState == 2) + { + npc.ai[0] = 23f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 3) + { + npc.ai[0] = 24f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else if (aiState == 4) + { + npc.ai[0] = 25f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 22f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + npc.alpha -= 25; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + int num34 = 7; + for (int m = 0; m < num34; m++) + { + Vector2 vector11 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector11 = vector11.RotatedBy((double)(m - (num34 / 2 - 1)) * 3.1415926535897931 / (double)((float)num34), default(Vector2)) + vectorCenter; + Vector2 value8 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num35 = Dust.NewDust(vector11 + value8, 0, 0, 244, value8.X * 2f, value8.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num35].noGravity = true; + Main.dust[num35].noLight = true; + Main.dust[num35].velocity /= 4f; + Main.dust[num35].velocity -= npc.velocity; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)chargeTime) + { + npc.ai[0] = 21f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 23f) + { + npc.dontTakeDamage = true; + npc.chaseable = false; + 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] == (float)(num1460 / 2)) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (Main.netMode != 1 && npc.ai[2] == (float)(num1460 / 2)) + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vectorCenter - player.Center).X)); + } + Vector2 center = player.Center + new Vector2(-npc.ai[1], teleportLocation); //teleport distance + vectorCenter = (npc.Center = center); + int num36 = Math.Sign(player.Center.X - vectorCenter.X); + if (num36 != 0) + { + if (npc.ai[2] == 0f && num36 != npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.direction = num36; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1460) + { + npc.ai[0] = 21f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + if (npc.ai[3] == 5f && Main.netMode != 1) + { + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, 0f, 0f, mod.ProjectileType("BigFlare"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } + if (npc.ai[3] >= 20f) //14 + { + npc.ai[3] = 0f; + } + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 24f) + { + npc.dontTakeDamage = phase5Check; + npc.chaseable = true; + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + npc.velocity = npc.velocity.RotatedBy((double)(-(double)num1463 * (float)npc.direction), default(Vector2)); + npc.rotation -= num1463 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num1461) + { + npc.ai[0] = 21f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 25f) //start phase 5 + { + npc.alpha = 0; + npc.dontTakeDamage = true; + npc.chaseable = false; + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num1459 - 60)) + { + 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] >= (float)num1459) + { + startSecondAI = true; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + #endregion + } + + #region AI2 + public void Yharon_AI2() + { + bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool expertMode = Main.expertMode; + 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) + { + 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; + } + npc.defense = 100; + if (npc.ai[0] != 8f) + { + npc.alpha -= 25; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + } + if (!moveCloser) + { + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DragonGod"); + else + music = MusicID.LunarBoss; + moveCloser = true; + string key = "Mods.CalamityMod.FlameText"; + 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); + } + } + if (invincibilityCounter < 900) + { + phase2 = phase3 = phase4 = false; + invincibilityCounter += 1; + int heal = 5; //900 / 5 = 180 + healCounter += 1; + if (healCounter >= heal) + { + healCounter = 0; + if (Main.netMode != 1) + { + int healAmt = npc.lifeMax / 200; + if (healAmt > npc.lifeMax - npc.life) + { + healAmt = npc.lifeMax - npc.life; + } + if (healAmt > 0) + { + npc.life += healAmt; + npc.HealEffect(healAmt, true); + npc.netUpdate = true; + } + } + } + } + else + { + npc.dontTakeDamage = npc.ai[0] == 9f; + npc.chaseable = npc.ai[0] < 8f; + } + NPCUtils.TargetClosestBetsy(npc, false, null); + NPCAimedTarget targetData = npc.GetTargetData(true); + if (!targetData.Hitbox.Intersects(safeBox)) + { + protectionBoost = true; + npc.damage = npc.defDamage * 5; + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + } + else + { + npc.damage = expertMode ? 528 : 330; + if (phase4) + { + npc.damage = (int)((double)npc.damage * 1.25); + } + protectionBoost = false; + if (npc.timeLeft < 3600) + { + npc.timeLeft = 3600; + } + } + int num = -1; + float num2 = 1f; + 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 = 80f; + float num13 = num11 + num12; + float num15 = 60f; + float scaleFactor3 = 14f; + float scaleFactor4 = revenge ? 16f : 15f; //12 + int num16 = 10; + int num17 = 6 * num16; + float num18 = 60f; + float num19 = num15 + (float)num17 + num18; + float num20 = 60f; + float num21 = 1f; + float num22 = 6.28318548f * (num21 / num20); + float scaleFactor5 = revenge ? 38f : 36.5f; //32 + 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; + chargeSpeed = 32f; + chargeSpeed2 = 45f; + scaleFactor4 = 18f; + scaleFactor5 = 40f; + } + float num25 = 20f; + float arg_F9_0 = npc.ai[0]; + float num26; + if (npc.ai[0] == 0f) + { + float[] expr_115_cp_0 = npc.ai; + 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 >= 10f) + { + npc.ai[1] = 0f; + npc.ai[0] = 1f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + if (npc.ai[2] == 0f) + { + npc.ai[2] = (float)((npc.Center.X < targetData.Center.X) ? 1 : -1); + } + Vector2 destination = targetData.Center + new Vector2(-npc.ai[2] * 300f, -200f); + Vector2 desiredVelocity = npc.DirectionTo(destination) * scaleFactor; + npc.SimpleFlyMovement(desiredVelocity, num6); + int num27 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + npc.direction = (npc.spriteDirection = num27); + float[] expr_225_cp_0 = npc.ai; + 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 >= 30f) + { + int num28 = 1; + 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]) + { + case 0: + num28 = 6; //tornado + break; + case 1: + num28 = 7; //fast charge + break; + case 2: + num28 = 8; //teleport + break; + case 3: + num28 = 7; //fast charge + break; + case 4: + 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 = 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; + } + } + else if (phase2) + { + switch ((int)npc.ai[3]) + { + case 0: + num28 = 6; //tornado + break; + case 1: + num28 = 7; //fast charge + break; + case 2: + num28 = 2; //charge + break; + case 3: + num28 = 5; //fire circle + break; + case 4: + num28 = 4; //fireballs + break; + case 5: + num28 = 7; //fast charge + break; + case 6: + num28 = 2; //charge + break; + case 7: + num28 = 3; //fireballs + break; + case 8: + num28 = 7; //fast charge + break; + case 9: + num28 = 2; //charge + break; + case 10: + num28 = 5; //fire circle + break; + } + } + else + { + switch ((int)npc.ai[3]) + { + case 0: + num28 = 6; //tornado + break; + case 1: + case 2: + num28 = 2; //charge + break; + case 3: + num28 = 3; //fireballs + break; + case 4: + case 5: + num28 = 2; //charge + break; + case 6: + num28 = 4; //fireballs + break; + case 7: + case 8: + num28 = 2; //charge + break; + case 9: + num28 = 5; //fire circle + break; + } + } + npc.ai[0] = (float)num28; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + switch (secondPhasePhase) + { + 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) + { + npc.ai[3] = 0f; + } + switch (num28) + { + case 2: //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 * chargeSpeed; + break; + } + case 3: //fireballs + { + Vector2 vector2 = new Vector2((float)((targetData.Center.X > npc.Center.X) ? 1 : -1), 0f); + npc.spriteDirection = ((vector2.X > 0f) ? 1 : -1); + npc.velocity = vector2 * -2f; + break; + } + case 5: //spin move + { + Vector2 vector3 = npc.DirectionTo(targetData.Center); + npc.spriteDirection = ((vector3.X > 0f) ? 1 : -1); + npc.rotation = vector3.ToRotation(); + if (npc.spriteDirection == -1) + { + npc.rotation += 3.14159274f; + } + 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] == 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 >= chargeTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + 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 * -600f, -250f); + Vector2 value = npc.DirectionTo(vector4) * 12f; + if (npc.Distance(vector4) < 12f) + { + npc.Center = vector4; + } + else + { + npc.position += value; + } + if (Vector2.Distance(vector4, npc.Center) < 16f) + { + npc.ai[1] = num11 - 1f; + } + num2 = 1.5f; + } + if (npc.ai[1] == num11) + { + int num30 = (targetData.Center.X > npc.Center.X) ? 1 : -1; + npc.velocity = new Vector2((float)num30, 0f) * 22f; //10f + npc.direction = (npc.spriteDirection = num30); + } + if (npc.ai[1] >= num11) + { + if (npc.ai[1] % 8 == 0 && Main.netMode != 1) + { + float num33 = 30f; + Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, + default(Vector2)); + 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) + { + npc.velocity.X = npc.velocity.X + (float)Math.Sign(npc.velocity.X) * 0.5f; + } + } + if (npc.ai[1] >= num13) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + 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 * -1500f, -350f); + Vector2 value2 = npc.DirectionTo(vector5) * scaleFactor3; + 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) + { + npc.ai[1] = num15 - 1f; + } + num2 = 1.5f; + } + else if (npc.ai[1] == num15) + { + Vector2 vector6 = npc.DirectionTo(targetData.Center); + vector6.Y *= 0.25f; + vector6 = vector6.SafeNormalize(Vector2.UnitX * (float)npc.direction); + npc.spriteDirection = ((vector6.X > 0f) ? 1 : -1); + npc.rotation = vector6.ToRotation(); + if (npc.spriteDirection == -1) + { + npc.rotation += 3.14159274f; + } + npc.velocity = vector6 * scaleFactor4; + } + else + { + npc.position.X = npc.position.X + npc.DirectionTo(targetData.Center).X * 7f; + npc.position.Y = npc.position.Y + npc.DirectionTo(targetData.Center + new Vector2(0f, -400f)).Y * 6f; + if (npc.ai[1] <= num19 - num18) + { + num2 = 1.5f; + } + float num33 = 30f; + 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); + } + } + if (npc.ai[1] > num19 - num18) + { + npc.velocity.Y = npc.velocity.Y - 0.1f; + } + npc.ai[1] += 1f; + if (npc.ai[1] >= num19) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + 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 - 0.1f; + npc.position += npc.DirectionTo(targetData.Center) * 10f; + npc.rotation -= num22 * (float)npc.direction; + num2 *= 0.7f; + if (npc.ai[1] == 1f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + float[] expr_B0F_cp_0 = npc.ai; + 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 (Main.netMode != 1) + { + 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) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity /= 2f; + } + } + else if (npc.ai[0] == 6f) //flare spawn + { + if (npc.ai[1] == 0f) + { + Vector2 destination2 = targetData.Center + new Vector2(0f, -200f); + Vector2 desiredVelocity2 = npc.DirectionTo(destination2) * scaleFactor * 2f; + npc.SimpleFlyMovement(desiredVelocity2, num6 * 2f); + int num35 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + npc.direction = (npc.spriteDirection = num35); + npc.ai[2] += 1f; + if (npc.Distance(targetData.Center) < 1000f || npc.ai[2] >= 180f) //450f + { + npc.ai[1] = 1f; + npc.netUpdate = true; + } + } + else + { + if (npc.ai[1] == 1f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.ai[1] < num25) + { + npc.velocity *= 0.95f; + } + else + { + npc.velocity *= 0.98f; + } + if (npc.ai[1] == num25) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y / 3f; + } + npc.velocity.Y = npc.velocity.Y - 3f; + } + num2 *= 0.85f; + bool flag3 = npc.ai[1] == 20f || npc.ai[1] == 45f || npc.ai[1] == 70f; + int flareCount = NPC.CountNPCS(mod.NPCType("DetonatingFlare")) + NPC.CountNPCS(mod.NPCType("DetonatingFlare2")); + if (flareCount > 5) + { + flag3 = false; + } + if (flag3 && Main.netMode != 1) + { + Vector2 vector7 = npc.Center + (6.28318548f * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 100f * (0.6f + Main.rand.NextFloat() * 0.4f); + if (Vector2.Distance(vector7, targetData.Center) > 100f) + { + Point point2 = vector7.ToPoint(); + 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("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] >= 90f) + { + if (Main.netMode != 1) + { + 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); + } + npc.ai[0] = 1f; + npc.ai[1] = 0f; + 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)); + } + teleportLocation = (Main.rand.Next(2) == 0 ? (revenge ? 600 : 700) : (revenge ? -600 : -700)); + Vector2 center = targetData.Center + new Vector2(-npc.ai[1], (float)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.timeLeft >= 300) + projectile.active = false; + else 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) + { + npc.localAI[0] = 0f; + } + if (num != -1) + { + npc.localAI[0] = (float)(num * 4); + } + float[] expr_11FC_cp_0 = npc.localAI; + int expr_11FC_cp_1 = 1; + num26 = expr_11FC_cp_0[expr_11FC_cp_1] + 1f; + expr_11FC_cp_0[expr_11FC_cp_1] = num26; + if (num26 >= 60f) + { + npc.localAI[1] = 0f; + } + float num42 = npc.DirectionTo(targetData.Center).ToRotation(); + float num43 = 0.04f; + switch ((int)npc.ai[0]) + { + case 2: + case 5: + case 7: + case 8: + case 9: + num43 = 0f; + break; + case 3: + num43 = 0.01f; + num42 = 0f; + if (npc.spriteDirection == -1) + { + num42 -= 3.14159274f; + } + if (npc.ai[1] >= num11) + { + num42 += (float)npc.spriteDirection * 3.14159274f / 12f; + num43 = 0.05f; + } + break; + case 4: + num43 = 0.01f; + num42 = 3.14159274f; + if (npc.spriteDirection == 1) + { + num42 += 3.14159274f; + } + break; + case 6: + num43 = 0.02f; + num42 = 0f; + if (npc.spriteDirection == -1) + { + num42 -= 3.14159274f; + } + break; + } + if (npc.spriteDirection == -1) + { + num42 += 3.14159274f; + } + if (num43 != 0f) + { + npc.rotation = npc.rotation.AngleTowards(num42, num43); + } + } + #endregion + + #region Drawing + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Texture2D texture = Main.npcTexture[npc.type]; + Microsoft.Xna.Framework.Rectangle frame6 = npc.frame; + Microsoft.Xna.Framework.Color color9 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); + int num156 = texture.Height / Main.npcFrameCount[npc.type]; + int y3 = num156 * (int)npc.frameCounter; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture.Width, num156); + Vector2 origin2 = rectangle.Size() / 2f; + int num157 = 8; + int num158 = 2; + int num159 = 1; + float num160 = 0f; + int num161 = num159; + if (startSecondAI && !phaseOneLoot) + { + 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 (invincibilityCounter < 900) + { + color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + } + Microsoft.Xna.Framework.Color alpha16 = npc.GetAlpha(color9); + while (drawAfterImage2 && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + goto IL_6899; + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + alpha16 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); //1.5 + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), alpha16, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects2.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects2, 0f); + goto IL_6881; + } + Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), npc.GetAlpha(color9), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects2, 0); + return false; + } + Microsoft.Xna.Framework.Color alpha15 = npc.GetAlpha(color9); + bool drawAfterImage = (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 8f || npc.ai[0] == 11f || npc.ai[0] == 12f || + npc.ai[0] == 14f || npc.ai[0] == 15f || npc.ai[0] == 18f || npc.ai[0] == 19f || npc.ai[0] == 22f) && Lighting.NotRetro; + while (drawAfterImage && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) + { + goto IL_6899; + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + alpha15 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); //1.5 + Vector2 value4 = (npc.oldPos[num161]); + float num165 = npc.rotation; + Main.spriteBatch.Draw(texture, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), alpha15, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); + goto IL_6881; + } + Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame6), npc.GetAlpha(color9), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + return false; + } + #endregion + + #region Loot + public override void NPCLoot() + { + if (!dropLoot) + { + return; + } + if (startSecondAI) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharonTrophy")); + } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VoidVortex")); + } + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharimsCrystal")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BossRush")); + string key = "Mods.CalamityMod.AuricOreText"; + Color messageColor = Color.Gold; + if (!CalamityWorld.downedYharon) + { + CalamityWorld.downedYharon = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + 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(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + } + else + { + if (!CalamityWorld.buffedEclipse) + { + CalamityWorld.buffedEclipse = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + string key = "Mods.CalamityMod.DargonBossText"; + 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); + } + } + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + if (startSecondAI) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HellcasterFragment"), Main.rand.Next(22, 29), true); + } + npc.DropBossBags(); + } + else + { + if (startSecondAI) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HellcasterFragment"), Main.rand.Next(15, 23), true); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ForgottenDragonEgg")); + } + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharonMask")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AngryChickenStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PhoenixFlameBarrage")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DragonsBreath")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DragonRage")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProfanedTrident")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheBurningSky")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ChickenCannon")); + } + } + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = mod.ItemType("OmegaHealingPotion"); + } + #endregion + + #region DamageFormula + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (damage > npc.lifeMax / 10 || (!startSecondAI && dropLoot)) + { + damage = 0; + return false; + } + double newDamage = (damage + (int)((double)defense * 0.25)); + if (newDamage < 1.0) + { + newDamage = 1.0; + } + if (newDamage >= 1.0) + { + if (startSecondAI) + { + float protection = (((npc.ichor || npc.onFire2) ? 0.17f : 0.22f) + + (protectionBoost ? 0.68f : 0f)); //0.85 or 0.9 + newDamage = (double)((int)((double)(1f - protection) * newDamage)); + } + else + { + float protection = (((npc.ichor || npc.onFire2) ? 0.12f : 0.17f) + + (protectionBoost ? 0.73f : 0f)); //0.85 or 0.9 + newDamage = (double)((int)((double)(1f - protection) * newDamage)); + } + if (newDamage < 1.0) + { + newDamage = 1.0; + } + } + damage = newDamage; + return true; + } + #endregion + + #region HPBarCooldownSlotandStats + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 2f; + return null; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + #endregion + + #region FindFrame + public override void FindFrame(int frameHeight) + { + if ((!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) || + (startSecondAI && (npc.ai[0] == 5f || npc.ai[0] < 2f))) //idle + { + int num84 = 4; //5 + if (!startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) //Phase ai switch + { + num84 = 3; //4 + } + npc.frameCounter += 1.0; + if (npc.frameCounter > (double)num84) + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y >= frameHeight * 5) //6 + { + npc.frame.Y = 0; + } + } + if ((!startSecondAI && (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)) || + (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f))) //Charging or birb spawn + { + npc.frame.Y = frameHeight * 5; //6 + } + if ((!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 23f)) || + (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f || npc.ai[0] == 8f))) //Fireball spit, teleport, circle, flamethrower + { + npc.frame.Y = frameHeight * 5; //6 + } + if (!startSecondAI && (npc.ai[0] == 3f || npc.ai[0] == 9f || npc.ai[0] == -1f || npc.ai[0] == 16f || npc.ai[0] == 20f || npc.ai[0] == 24f)) //Summon tornadoes + { + int num85 = 90; + if (npc.ai[2] < (float)(num85 - 30) || npc.ai[2] > (float)(num85 - 10)) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) //5 + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y >= frameHeight * 5) //6 + { + npc.frame.Y = 0; + } + } + else + { + npc.frame.Y = frameHeight * 5; //6 + if (npc.ai[2] > (float)(num85 - 20) && npc.ai[2] < (float)(num85 - 15)) + { + npc.frame.Y = frameHeight * 6; //7 + } + } + } + if ((!startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f || npc.ai[0] == 25f)) || + (startSecondAI && npc.ai[0] == 9f)) //Enter new phase + { + int num86 = 180; + if (npc.ai[2] < (float)(num86 - 60) || npc.ai[2] > (float)(num86 - 20)) + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 4.0) //5 + { + npc.frameCounter = 0.0; + npc.frame.Y = npc.frame.Y + frameHeight; + } + if (npc.frame.Y >= frameHeight * 5) //6 + { + npc.frame.Y = 0; + } + } + else + { + npc.frame.Y = frameHeight * 5; //6 + if (npc.ai[2] > (float)(num86 - 50) && npc.ai[2] < (float)(num86 - 25)) + { + npc.frame.Y = frameHeight * 6; //7 + } + } + } + } + #endregion + + #region Boom + public void Boom(int timeLeft, int damage) + { + if (Main.netMode != 1) + { + Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + for (iBoom = 0; iBoom < 25; iBoom++) + { + offsetAngleBoom = (startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f) + 32f * iBoom; + int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 5f), (float)(Math.Cos(offsetAngleBoom) * 5f), mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 5f), (float)(-Math.Cos(offsetAngleBoom) * 5f), mod.ProjectileType("FlareBomb"), damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[boom1].timeLeft = timeLeft; + Main.projectile[boom2].timeLeft = timeLeft; + } + } + } + #endregion + + #region HitEffect + 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) + { + Boom(150, 1000); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.width = 300; + npc.height = 280; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default(Color), 3f); + 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, 244, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + #endregion + } +} diff --git a/Projectiles/Amidias/AmidiasTridentProj.cs b/Projectiles/Amidias/AmidiasTridentProj.cs index ec62d2fa43..24f033a5f6 100644 --- a/Projectiles/Amidias/AmidiasTridentProj.cs +++ b/Projectiles/Amidias/AmidiasTridentProj.cs @@ -1,72 +1,72 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Amidias -{ - public class AmidiasTridentProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trident"); - } - - public override void SetDefaults() - { - projectile.width = 70; - projectile.aiStyle = 19; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.height = 70; - 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] -= 1f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner && NPC.downedBoss3) - { - 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 * 0.8f, projectile.velocity.Y * 0.8f, mod.ProjectileType("AmidiasWhirlpool"), projectile.damage, projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); - } - } - else - { - projectile.ai[0] += 0.75f; - } - - 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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Amidias +{ + public class AmidiasTridentProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trident"); + } + + public override void SetDefaults() + { + projectile.width = 70; + projectile.aiStyle = 19; + projectile.melee = true; + projectile.timeLeft = 90; + projectile.height = 70; + 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] -= 1f; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner && NPC.downedBoss3) + { + 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 * 0.8f, projectile.velocity.Y * 0.8f, mod.ProjectileType("AmidiasWhirlpool"), projectile.damage, projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + } + } + else + { + projectile.ai[0] += 0.75f; + } + + 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; + } + } + } +} diff --git a/Projectiles/Amidias/AmidiasWhirlpool.cs b/Projectiles/Amidias/AmidiasWhirlpool.cs index 8d2690d0d5..4108f0e64e 100644 --- a/Projectiles/Amidias/AmidiasWhirlpool.cs +++ b/Projectiles/Amidias/AmidiasWhirlpool.cs @@ -1,158 +1,158 @@ -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.Amidias -{ - public class AmidiasWhirlpool : ModProjectile - { - 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 = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.extraUpdates = 1; - projectile.alpha = 100; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; - } - - public override void AI() - { - for (int num105 = 0; num105 < 2; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; - } - float[] var_2_2DDF8_cp_0 = projectile.ai; - int var_2_2DDF8_cp_1 = 0; - float num73 = var_2_2DDF8_cp_0[var_2_2DDF8_cp_1]; - var_2_2DDF8_cp_0[var_2_2DDF8_cp_1] = num73 + 1f; - int num1013 = 0; - if (projectile.velocity.Length() <= 8f) //4 - { - num1013 = 1; - } - if (num1013 == 0) - { - projectile.rotation -= 0.104719758f; - - if (projectile.ai[0] >= 30f) - { - projectile.velocity *= 0.98f; - projectile.rotation -= 0.0174532924f; - } - if (projectile.velocity.Length() < 8.2f) //4.1 - { - projectile.velocity.Normalize(); - projectile.velocity *= 4f; - projectile.ai[0] = 0f; - } - } - else if (num1013 == 1) - { - int num3; - projectile.rotation -= 0.104719758f; - Vector2 vector145 = projectile.Center; - float num1015 = 300f; - bool flag59 = false; - int num1016 = 0; - if (projectile.ai[1] == 0f) - { - for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) - { - if (Main.npc[num1017].CanBeChasedBy(projectile, false)) - { - Vector2 center13 = Main.npc[num1017].Center; - if (projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) - { - num1015 = projectile.Distance(center13); - vector145 = center13; - flag59 = true; - num1016 = num1017; - } - } - num3 = num1017; - } - if (flag59) - { - if (projectile.ai[1] != (float)(num1016 + 1)) - { - projectile.netUpdate = true; - } - projectile.ai[1] = (float)(num1016 + 1); - } - flag59 = false; - } - if (projectile.ai[1] != 0f) - { - int num1018 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(projectile, true) && projectile.Distance(Main.npc[num1018].Center) < 1000f) - { - flag59 = true; - vector145 = Main.npc[num1018].Center; - } - } - if (!projectile.friendly) - { - flag59 = false; - } - if (flag59) - { - float num1019 = 24f; - int num1020 = 10; - Vector2 vector146 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num1021 = vector145.X - vector146.X; - float num1022 = vector145.Y - vector146.Y; - float num1023 = (float)Math.Sqrt((double)(num1021 * num1021 + num1022 * num1022)); - num1023 = num1019 / num1023; - num1021 *= num1023; - num1022 *= num1023; - projectile.velocity.X = (projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; - } - } - Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.9f); - if (projectile.ai[0] >= 120f) - { - projectile.Kill(); - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(30, 255, 253); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 20; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X, projectile.oldVelocity.Y, 0, new Color(0, 142, 255), 1f); - } - } - } -} \ No newline at end of file +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.Amidias +{ + public class AmidiasWhirlpool : ModProjectile + { + 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 = 58; + projectile.height = 58; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.extraUpdates = 1; + projectile.alpha = 100; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.melee = true; + } + + public override void AI() + { + for (int num105 = 0; num105 < 2; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + } + float[] var_2_2DDF8_cp_0 = projectile.ai; + int var_2_2DDF8_cp_1 = 0; + float num73 = var_2_2DDF8_cp_0[var_2_2DDF8_cp_1]; + var_2_2DDF8_cp_0[var_2_2DDF8_cp_1] = num73 + 1f; + int num1013 = 0; + if (projectile.velocity.Length() <= 8f) //4 + { + num1013 = 1; + } + if (num1013 == 0) + { + projectile.rotation -= 0.104719758f; + + if (projectile.ai[0] >= 30f) + { + projectile.velocity *= 0.98f; + projectile.rotation -= 0.0174532924f; + } + if (projectile.velocity.Length() < 8.2f) //4.1 + { + projectile.velocity.Normalize(); + projectile.velocity *= 4f; + projectile.ai[0] = 0f; + } + } + else if (num1013 == 1) + { + int num3; + projectile.rotation -= 0.104719758f; + Vector2 vector145 = projectile.Center; + float num1015 = 300f; + bool flag59 = false; + int num1016 = 0; + if (projectile.ai[1] == 0f) + { + for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) + { + if (Main.npc[num1017].CanBeChasedBy(projectile, false)) + { + Vector2 center13 = Main.npc[num1017].Center; + if (projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) + { + num1015 = projectile.Distance(center13); + vector145 = center13; + flag59 = true; + num1016 = num1017; + } + } + num3 = num1017; + } + if (flag59) + { + if (projectile.ai[1] != (float)(num1016 + 1)) + { + projectile.netUpdate = true; + } + projectile.ai[1] = (float)(num1016 + 1); + } + flag59 = false; + } + if (projectile.ai[1] != 0f) + { + int num1018 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(projectile, true) && projectile.Distance(Main.npc[num1018].Center) < 1000f) + { + flag59 = true; + vector145 = Main.npc[num1018].Center; + } + } + if (!projectile.friendly) + { + flag59 = false; + } + if (flag59) + { + float num1019 = 24f; + int num1020 = 10; + Vector2 vector146 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num1021 = vector145.X - vector146.X; + float num1022 = vector145.Y - vector146.Y; + float num1023 = (float)Math.Sqrt((double)(num1021 * num1021 + num1022 * num1022)); + num1023 = num1019 / num1023; + num1021 *= num1023; + num1022 *= num1023; + projectile.velocity.X = (projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; + } + } + Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.9f); + if (projectile.ai[0] >= 120f) + { + projectile.Kill(); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(30, 255, 253); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 20; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X, projectile.oldVelocity.Y, 0, new Color(0, 142, 255), 1f); + } + } + } +} diff --git a/Projectiles/Amidias/BigCoral.cs b/Projectiles/Amidias/BigCoral.cs index 6434801961..8f29298d3c 100644 --- a/Projectiles/Amidias/BigCoral.cs +++ b/Projectiles/Amidias/BigCoral.cs @@ -1,59 +1,59 @@ -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.Amidias -{ - public class BigCoral : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Coral"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 34; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - } - - public override void AI() - { - projectile.velocity.X *= 0.999f; - projectile.velocity.Y = projectile.velocity.Y + 0.025f; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 18; - projectile.height = 34; - 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 < 10; num621++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 51, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.rarity != 2 && !target.boss) - { - target.AddBuff(mod.BuffType("SilvaStun"), 15); - } - } - } -} \ No newline at end of file +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.Amidias +{ + public class BigCoral : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Coral"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 34; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + } + + public override void AI() + { + projectile.velocity.X *= 0.999f; + projectile.velocity.Y = projectile.velocity.Y + 0.025f; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 18; + projectile.height = 34; + 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 < 10; num621++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 51, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.rarity != 2 && !target.boss) + { + target.AddBuff(mod.BuffType("SilvaStun"), 15); + } + } + } +} diff --git a/Projectiles/Amidias/HermitCrab.cs b/Projectiles/Amidias/HermitCrab.cs index cfaf819868..88d65e0538 100644 --- a/Projectiles/Amidias/HermitCrab.cs +++ b/Projectiles/Amidias/HermitCrab.cs @@ -1,353 +1,353 @@ -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.Amidias -{ - public class HermitCrab : ModProjectile - { - private int playerStill = 0; - private bool fly = false; - private bool spawnDust = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hermit Crab"); - Main.projFrames[projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 36; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } - - public override void AI() - { - if (spawnDust) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 20; - 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, 33, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - spawnDust = false; - } - 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; - } - bool flag64 = projectile.type == mod.ProjectileType("HermitCrab"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("HermitCrab"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.hCrab = false; - } - if (modPlayer.hCrab) - { - projectile.timeLeft = 2; - } - } - Vector2 vector46 = projectile.position; - if (!fly) - { - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 205f && projectile.position.X == projectile.oldPosition.X))) - { - projectile.velocity.Y = -10f; - } - projectile.velocity.Y += 0.6f; - if (projectile.velocity.X != 0f) - { - projectile.frameCounter++; - } - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num633 = 600f; - bool chaseNPC = false; - float npcPositionX = 0f; - for (int num645 = 0; num645 < 200; num645++) - { - NPC npcTarget = Main.npc[num645]; - if (npcTarget.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC)) - { - num633 = num646; - vector46 = npcTarget.Center; - npcPositionX = npcTarget.position.X; - chaseNPC = true; - } - } - } - if (chaseNPC) - { - if (npcPositionX - projectile.position.X > 0f) - { - switch (Main.rand.Next(1, 2)) - { - - case 1: - projectile.velocity.X += 0.10f; - break; - - case 2: - projectile.velocity.X += 0.15f; - break; - } - - if (projectile.velocity.X > 9f) - { - projectile.velocity.X = 9f; - } - } - else - { - switch (Main.rand.Next(1, 2)) - { - - case 1: - projectile.velocity.X -= 0.10f; - break; - - case 2: - projectile.velocity.X -= 0.15f; - break; - } - - if (projectile.velocity.X < -9f) - { - projectile.velocity.X = -9f; - } - } - } - else - { - if (playerDistance > 600f) - { - fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; - } - if (playerDistance > 200f) - { - if (player.position.X - projectile.position.X > 0f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X += 0.05f; - break; - - case 2: - projectile.velocity.X += 0.10f; - break; - - case 3: - projectile.velocity.X += 0.15f; - break; - } - - if (projectile.velocity.X > 9f) - { - projectile.velocity.X = 9f; - } - } - else - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X -= 0.05f; - break; - - case 2: - projectile.velocity.X -= 0.10f; - break; - - case 3: - projectile.velocity.X -= 0.15f; - break; - } - - if (projectile.velocity.X < -9f) - { - projectile.velocity.X = -9f; - } - } - } - if (playerDistance < 200f) - { - if (projectile.velocity.X != 0f) - { - if (projectile.velocity.X > 0.5f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X -= 0.05f; - break; - - case 2: - projectile.velocity.X -= 0.10f; - break; - - case 3: - projectile.velocity.X -= 0.15f; - break; - } - } - else if (projectile.velocity.X < -0.5f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X += 0.05f; - break; - - case 2: - projectile.velocity.X += 0.10f; - break; - - case 3: - projectile.velocity.X += 0.15f; - break; - } - } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) - { - projectile.velocity.X = 0f; - } - } - } - } - } - else if (fly) - { - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); - float playerDistance = vector48.Length(); - vector48.Normalize(); - vector48 *= 8f; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - - projectile.rotation = projectile.velocity.X * 0.03f; - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 4; - } - 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) - { - if (player.velocity.Y == 0f) - { - ++playerStill; - } - else - { - playerStill = 0; - } - if (playerStill > 30 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - fly = false; - projectile.tileCollide = true; - projectile.rotation = 0; - } - } - } - if ((double)projectile.velocity.X > 0.25) - { - projectile.spriteDirection = 1; - } - else if ((double)projectile.velocity.X < -0.25) - { - 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; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } -} \ No newline at end of file +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.Amidias +{ + public class HermitCrab : ModProjectile + { + private int playerStill = 0; + private bool fly = false; + private bool spawnDust = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hermit Crab"); + Main.projFrames[projectile.type] = 8; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 36; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override void AI() + { + if (spawnDust) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 20; + 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, 33, 0f, 0f, 0, default(Color), 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + spawnDust = false; + } + 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; + } + bool flag64 = projectile.type == mod.ProjectileType("HermitCrab"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("HermitCrab"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.hCrab = false; + } + if (modPlayer.hCrab) + { + projectile.timeLeft = 2; + } + } + Vector2 vector46 = projectile.position; + if (!fly) + { + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 205f && projectile.position.X == projectile.oldPosition.X))) + { + projectile.velocity.Y = -10f; + } + projectile.velocity.Y += 0.6f; + if (projectile.velocity.X != 0f) + { + projectile.frameCounter++; + } + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num633 = 600f; + bool chaseNPC = false; + float npcPositionX = 0f; + for (int num645 = 0; num645 < 200; num645++) + { + NPC npcTarget = Main.npc[num645]; + if (npcTarget.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC)) + { + num633 = num646; + vector46 = npcTarget.Center; + npcPositionX = npcTarget.position.X; + chaseNPC = true; + } + } + } + if (chaseNPC) + { + if (npcPositionX - projectile.position.X > 0f) + { + switch (Main.rand.Next(1, 2)) + { + + case 1: + projectile.velocity.X += 0.10f; + break; + + case 2: + projectile.velocity.X += 0.15f; + break; + } + + if (projectile.velocity.X > 9f) + { + projectile.velocity.X = 9f; + } + } + else + { + switch (Main.rand.Next(1, 2)) + { + + case 1: + projectile.velocity.X -= 0.10f; + break; + + case 2: + projectile.velocity.X -= 0.15f; + break; + } + + if (projectile.velocity.X < -9f) + { + projectile.velocity.X = -9f; + } + } + } + else + { + if (playerDistance > 600f) + { + fly = true; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + projectile.tileCollide = false; + } + if (playerDistance > 200f) + { + if (player.position.X - projectile.position.X > 0f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X += 0.05f; + break; + + case 2: + projectile.velocity.X += 0.10f; + break; + + case 3: + projectile.velocity.X += 0.15f; + break; + } + + if (projectile.velocity.X > 9f) + { + projectile.velocity.X = 9f; + } + } + else + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X -= 0.05f; + break; + + case 2: + projectile.velocity.X -= 0.10f; + break; + + case 3: + projectile.velocity.X -= 0.15f; + break; + } + + if (projectile.velocity.X < -9f) + { + projectile.velocity.X = -9f; + } + } + } + if (playerDistance < 200f) + { + if (projectile.velocity.X != 0f) + { + if (projectile.velocity.X > 0.5f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X -= 0.05f; + break; + + case 2: + projectile.velocity.X -= 0.10f; + break; + + case 3: + projectile.velocity.X -= 0.15f; + break; + } + } + else if (projectile.velocity.X < -0.5f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X += 0.05f; + break; + + case 2: + projectile.velocity.X += 0.10f; + break; + + case 3: + projectile.velocity.X += 0.15f; + break; + } + } + else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + { + projectile.velocity.X = 0f; + } + } + } + } + } + else if (fly) + { + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); + float playerDistance = vector48.Length(); + vector48.Normalize(); + vector48 *= 8f; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + + projectile.rotation = projectile.velocity.X * 0.03f; + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 4; + } + 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) + { + if (player.velocity.Y == 0f) + { + ++playerStill; + } + else + { + playerStill = 0; + } + if (playerStill > 30 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + fly = false; + projectile.tileCollide = true; + projectile.rotation = 0; + } + } + } + if ((double)projectile.velocity.X > 0.25) + { + projectile.spriteDirection = 1; + } + else if ((double)projectile.velocity.X < -0.25) + { + 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; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} diff --git a/Projectiles/Amidias/SandDollarProj.cs b/Projectiles/Amidias/SandDollarProj.cs index 2b5f0dc6b4..40bc6aa6f2 100644 --- a/Projectiles/Amidias/SandDollarProj.cs +++ b/Projectiles/Amidias/SandDollarProj.cs @@ -1,45 +1,45 @@ -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.Amidias -{ - public class SandDollarProj : ModProjectile - { - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand Dollar"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 28; - projectile.GetGlobalProjectile(mod).rogue = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; - aiType = 272; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - 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 +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.Amidias +{ + public class SandDollarProj : ModProjectile + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Dollar"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 28; + projectile.GetGlobalProjectile(mod).rogue = true; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 300; + aiType = 272; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + } +} diff --git a/Projectiles/Amidias/Shell.cs b/Projectiles/Amidias/Shell.cs index 0f2b663f84..d29143c667 100644 --- a/Projectiles/Amidias/Shell.cs +++ b/Projectiles/Amidias/Shell.cs @@ -1,50 +1,50 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Amidias -{ - public class Shell : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shell"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 18; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.aiStyle = 1; - } - - public override void AI() - { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y *= 0.9995f; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 34; - projectile.height = 18; - 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 < 10; num621++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(0, 255, 255), 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Amidias +{ + public class Shell : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shell"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 18; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 5; + projectile.aiStyle = 1; + } + + public override void AI() + { + projectile.velocity.X *= 0.9995f; + projectile.velocity.Y *= 0.9995f; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 34; + projectile.height = 18; + 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 < 10; num621++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(0, 255, 255), 1.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + } + } + } +} diff --git a/Projectiles/Amidias/SmallCoral.cs b/Projectiles/Amidias/SmallCoral.cs index 08ef07b262..219ce4de5b 100644 --- a/Projectiles/Amidias/SmallCoral.cs +++ b/Projectiles/Amidias/SmallCoral.cs @@ -1,51 +1,51 @@ -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.Amidias -{ - public class SmallCoral : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Small Coral"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 22; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - } - - public override void AI() - { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 16; - projectile.height = 22; - 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 num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 51, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; - } - } - } -} \ No newline at end of file +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.Amidias +{ + public class SmallCoral : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Small Coral"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 22; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + } + + public override void AI() + { + projectile.velocity.X *= 0.9995f; + projectile.velocity.Y = projectile.velocity.Y + 0.01f; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 16; + projectile.height = 22; + 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 num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 51, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Amidias/SnapClamProj.cs b/Projectiles/Amidias/SnapClamProj.cs index 4820799c63..2a36f89a13 100644 --- a/Projectiles/Amidias/SnapClamProj.cs +++ b/Projectiles/Amidias/SnapClamProj.cs @@ -1,216 +1,216 @@ -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.Amidias -{ - public class SnapClamProj : ModProjectile - { - public int clamCounter = 0; - public bool openClam = true; - public bool onEnemy = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Snap Clam"); - Main.projFrames[projectile.type] = 2; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 13; - projectile.friendly = true; - projectile.GetGlobalProjectile(mod).rogue = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - } - - public override void AI() - { - if (openClam && !onEnemy) - { - ++clamCounter; - if (clamCounter >= 30) - { - openClam = false; - projectile.damage = (int)(projectile.damage * 0.8); - } - } - if (projectile.ai[0] == 0f) - { - float[] var0 = projectile.ai; - int var1 = 1; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - projectile.ai[1] = 45f; - projectile.velocity.X = projectile.velocity.X * 0.99f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - projectile.rotation += 0.4f * (float)projectile.direction; - projectile.spriteDirection = projectile.direction; - } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 6; - bool flag54 = false; - bool flag55 = false; - float[] var0 = projectile.localAI; - int var1 = 0; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } - if (openClam && !onEnemy) - { - projectile.frame = 1; - } - else - { - projectile.frame = 0; - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (openClam) - { - onEnemy = true; - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && - ((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)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 6; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 13; - projectile.height = 20; - 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 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("SnapClamDebuff"), 240); - } - } -} \ No newline at end of file +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.Amidias +{ + public class SnapClamProj : ModProjectile + { + public int clamCounter = 0; + public bool openClam = true; + public bool onEnemy = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snap Clam"); + Main.projFrames[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 13; + projectile.friendly = true; + projectile.GetGlobalProjectile(mod).rogue = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + } + + public override void AI() + { + if (openClam && !onEnemy) + { + ++clamCounter; + if (clamCounter >= 30) + { + openClam = false; + projectile.damage = (int)(projectile.damage * 0.8); + } + } + if (projectile.ai[0] == 0f) + { + float[] var0 = projectile.ai; + int var1 = 1; + float num73 = var0[var1]; + var0[var1] = num73 + 1f; + projectile.ai[1] = 45f; + projectile.velocity.X = projectile.velocity.X * 0.99f; + projectile.velocity.Y = projectile.velocity.Y + 0.15f; + projectile.rotation += 0.4f * (float)projectile.direction; + projectile.spriteDirection = projectile.direction; + } + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + int num988 = 6; + bool flag54 = false; + bool flag55 = false; + float[] var0 = projectile.localAI; + int var1 = 0; + float num73 = var0[var1]; + var0[var1] = num73 + 1f; + if (projectile.localAI[0] % 30f == 0f) + { + flag55 = true; + } + int num989 = (int)projectile.ai[1]; + if (projectile.localAI[0] >= (float)(60 * num988)) + { + flag54 = true; + } + else if (num989 < 0 || num989 >= 200) + { + flag54 = true; + } + else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) + { + projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[num989].gfxOffY; + if (flag55) + { + Main.npc[num989].HitEffect(0, 1.0); + } + } + else + { + flag54 = true; + } + if (flag54) + { + projectile.Kill(); + } + } + if (openClam && !onEnemy) + { + projectile.frame = 1; + } + else + { + projectile.frame = 0; + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (openClam) + { + onEnemy = true; + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + ((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)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[0] = 1f; + projectile.ai[1] = (float)i; + projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; + projectile.netUpdate = true; + projectile.StatusNPC(i); + projectile.damage = 0; + int num28 = 6; + Point[] array2 = new Point[num28]; + int num29 = 0; + for (int l = 0; l < 1000; l++) + { + if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) + { + array2[num29++] = new Point(l, Main.projectile[l].timeLeft); + if (num29 >= array2.Length) + { + break; + } + } + } + if (num29 >= array2.Length) + { + int num30 = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[num30].Y) + { + num30 = m; + } + } + Main.projectile[array2[num30].X].Kill(); + } + } + } + } + } + } + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 13; + projectile.height = 20; + 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 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("SnapClamDebuff"), 240); + } + } +} diff --git a/Projectiles/Amidias/UrchinBall.cs b/Projectiles/Amidias/UrchinBall.cs index 97e14bf016..4d3e6c55a9 100644 --- a/Projectiles/Amidias/UrchinBall.cs +++ b/Projectiles/Amidias/UrchinBall.cs @@ -1,159 +1,159 @@ -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.Amidias -{ - public class UrchinBall : ModProjectile - { - public bool spike = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("UrchinBall"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - projectile.GetGlobalProjectile(mod).trueMelee = true; - } - - public override void AI() - { - Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; - projectile.rotation = vector62.ToRotation() - 1.57f; - if (Main.player[projectile.owner].dead) - { - projectile.Kill(); - return; - } - Main.player[projectile.owner].itemAnimation = 10; - Main.player[projectile.owner].itemTime = 10; - float arg_1DC8F_0 = vector62.X; - if (vector62.X < 0f) - { - Main.player[projectile.owner].ChangeDir(1); - projectile.direction = 1; - } - else - { - Main.player[projectile.owner].ChangeDir(-1); - projectile.direction = -1; - } - Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); - if (projectile.ai[0] == 0f && vector62.Length() > 400f) - { - projectile.ai[0] = 1f; - } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) - { - if (spike) - { - spike = false; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("UrchinBallSpike"), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); - } - projectile.usesLocalNPCImmunity = false; - float num693 = vector62.Length(); - if (num693 > 1500f) - { - projectile.Kill(); - return; - } - if (num693 > 600f) - { - projectile.ai[0] = 2f; - } - projectile.tileCollide = false; - float num694 = 20f; - if (projectile.ai[0] == 2f) - { - num694 = 40f; - } - projectile.velocity = Vector2.Normalize(vector62) * num694; - if (vector62.Length() < num694) - { - projectile.Kill(); - return; - } - } - float[] var_2_1DE21_cp_0 = projectile.ai; - int var_2_1DE21_cp_1 = 1; - float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; - var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; - if (projectile.ai[1] > 5f) - { - projectile.alpha = 0; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/UrchinFlailChain"); - Vector2 vector17 = projectile.Center; - Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) - { - flag13 = false; - } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) - { - flag13 = false; - } - while (flag13) - { - if (vector18.Length() < num91 + 1f) - { - flag13 = false; - } - else - { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); - } - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - spike = true; - projectile.ai[0] = 1f; - projectile.netUpdate = true; - target.AddBuff(BuffID.Venom, 300); - } - } -} \ No newline at end of file +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.Amidias +{ + public class UrchinBall : ModProjectile + { + public bool spike = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("UrchinBall"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.melee = true; + projectile.alpha = 255; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + projectile.GetGlobalProjectile(mod).trueMelee = true; + } + + public override void AI() + { + Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; + projectile.rotation = vector62.ToRotation() - 1.57f; + if (Main.player[projectile.owner].dead) + { + projectile.Kill(); + return; + } + Main.player[projectile.owner].itemAnimation = 10; + Main.player[projectile.owner].itemTime = 10; + float arg_1DC8F_0 = vector62.X; + if (vector62.X < 0f) + { + Main.player[projectile.owner].ChangeDir(1); + projectile.direction = 1; + } + else + { + Main.player[projectile.owner].ChangeDir(-1); + projectile.direction = -1; + } + Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); + projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); + if (projectile.ai[0] == 0f && vector62.Length() > 400f) + { + projectile.ai[0] = 1f; + } + if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + { + if (spike) + { + spike = false; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("UrchinBallSpike"), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + } + projectile.usesLocalNPCImmunity = false; + float num693 = vector62.Length(); + if (num693 > 1500f) + { + projectile.Kill(); + return; + } + if (num693 > 600f) + { + projectile.ai[0] = 2f; + } + projectile.tileCollide = false; + float num694 = 20f; + if (projectile.ai[0] == 2f) + { + num694 = 40f; + } + projectile.velocity = Vector2.Normalize(vector62) * num694; + if (vector62.Length() < num694) + { + projectile.Kill(); + return; + } + } + float[] var_2_1DE21_cp_0 = projectile.ai; + int var_2_1DE21_cp_1 = 1; + float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; + var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; + if (projectile.ai[1] > 5f) + { + projectile.alpha = 0; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + projectile.ai[0] = 1f; + projectile.netUpdate = true; + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; + Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/UrchinFlailChain"); + Vector2 vector17 = projectile.Center; + Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; + Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); + float num91 = (float)texture2D2.Height; + Vector2 vector18 = mountedCenter - vector17; + float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; + bool flag13 = true; + if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + { + flag13 = false; + } + if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + { + flag13 = false; + } + while (flag13) + { + if (vector18.Length() < num91 + 1f) + { + flag13 = false; + } + else + { + Vector2 value2 = vector18; + value2.Normalize(); + vector17 += value2 * num91; + vector18 = mountedCenter - vector17; + Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); + } + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + spike = true; + projectile.ai[0] = 1f; + projectile.netUpdate = true; + target.AddBuff(BuffID.Venom, 300); + } + } +} diff --git a/Projectiles/Amidias/UrchinBallSpike.cs b/Projectiles/Amidias/UrchinBallSpike.cs index f82cc3ae94..91e34aa7da 100644 --- a/Projectiles/Amidias/UrchinBallSpike.cs +++ b/Projectiles/Amidias/UrchinBallSpike.cs @@ -1,190 +1,190 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Amidias -{ - public class UrchinBallSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 18; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = -1; - aiType = 598; - } - - public override void AI() - { - if (projectile.ai[0] == 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.99f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - projectile.rotation += 0.4f * (float)projectile.direction; - projectile.spriteDirection = projectile.direction; - } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 6; - bool flag54 = false; - bool flag55 = false; - float[] var0 = projectile.localAI; - int var1 = 0; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && - ((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)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 6; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 13; - projectile.height = 20; - 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 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.KingSlime || target.type == NPCID.WallofFlesh || target.type == NPCID.WallofFleshEye || - target.type == NPCID.SkeletronHead || target.type == NPCID.SkeletronHand) - { - target.buffImmune[BuffID.Venom] = false; - } - target.AddBuff(BuffID.Venom, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Amidias +{ + public class UrchinBallSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 18; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.penetrate = -1; + aiType = 598; + } + + public override void AI() + { + if (projectile.ai[0] == 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.99f; + projectile.velocity.Y = projectile.velocity.Y + 0.15f; + projectile.rotation += 0.4f * (float)projectile.direction; + projectile.spriteDirection = projectile.direction; + } + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + int num988 = 6; + bool flag54 = false; + bool flag55 = false; + float[] var0 = projectile.localAI; + int var1 = 0; + float num73 = var0[var1]; + var0[var1] = num73 + 1f; + if (projectile.localAI[0] % 30f == 0f) + { + flag55 = true; + } + int num989 = (int)projectile.ai[1]; + if (projectile.localAI[0] >= (float)(60 * num988)) + { + flag54 = true; + } + else if (num989 < 0 || num989 >= 200) + { + flag54 = true; + } + else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) + { + projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[num989].gfxOffY; + if (flag55) + { + Main.npc[num989].HitEffect(0, 1.0); + } + } + else + { + flag54 = true; + } + if (flag54) + { + projectile.Kill(); + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + ((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)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[0] = 1f; + projectile.ai[1] = (float)i; + projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; + projectile.netUpdate = true; + projectile.StatusNPC(i); + projectile.damage = 0; + int num28 = 6; + Point[] array2 = new Point[num28]; + int num29 = 0; + for (int l = 0; l < 1000; l++) + { + if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) + { + array2[num29++] = new Point(l, Main.projectile[l].timeLeft); + if (num29 >= array2.Length) + { + break; + } + } + } + if (num29 >= array2.Length) + { + int num30 = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[num30].Y) + { + num30 = m; + } + } + Main.projectile[array2[num30].X].Kill(); + } + } + } + } + } + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 13; + projectile.height = 20; + 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 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 1f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.KingSlime || target.type == NPCID.WallofFlesh || target.type == NPCID.WallofFleshEye || + target.type == NPCID.SkeletronHead || target.type == NPCID.SkeletronHand) + { + target.buffImmune[BuffID.Venom] = false; + } + target.AddBuff(BuffID.Venom, 300); + } + } +} diff --git a/Projectiles/Amidias/WaywasherProj.cs b/Projectiles/Amidias/WaywasherProj.cs index e9782c69bb..387f722a80 100644 --- a/Projectiles/Amidias/WaywasherProj.cs +++ b/Projectiles/Amidias/WaywasherProj.cs @@ -1,77 +1,77 @@ -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.Amidias -{ - public class WaywasherProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Waywasher Blast"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.timeLeft = 300; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); - for (int num105 = 0; num105 < 2; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; - } - if (Main.rand.Next(5) == 0) - { - int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); - } - } - } -} \ No newline at end of file +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.Amidias +{ + public class WaywasherProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Waywasher Blast"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 2; + projectile.timeLeft = 300; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); + for (int num105 = 0; num105 < 2; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.2f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + } + if (Main.rand.Next(5) == 0) + { + int num103 = 4; + int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 0.6f); + Main.dust[num104].velocity *= 0.25f; + Main.dust[num104].velocity += projectile.velocity * 0.5f; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); + } + } + } +} diff --git a/Projectiles/Astral/AstralCannonExplosion.cs b/Projectiles/Astral/AstralCannonExplosion.cs index af6c3ccdc4..dcf65e9426 100644 --- a/Projectiles/Astral/AstralCannonExplosion.cs +++ b/Projectiles/Astral/AstralCannonExplosion.cs @@ -1,34 +1,34 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Astral -{ - public class AstralCannonExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 150; - projectile.height = 150; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 10; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Astral +{ + public class AstralCannonExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 150; + projectile.height = 150; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 10; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120); + } + } +} diff --git a/Projectiles/Astral/AstralCannonProjectile.cs b/Projectiles/Astral/AstralCannonProjectile.cs index edb612e368..cb18eeb505 100644 --- a/Projectiles/Astral/AstralCannonProjectile.cs +++ b/Projectiles/Astral/AstralCannonProjectile.cs @@ -1,106 +1,106 @@ -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.Astral -{ - 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; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 5; - } - else - { - 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; - } - - 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 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; - } - } - } -} \ No newline at end of file +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.Astral +{ + 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; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 5; + } + else + { + 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; + } + + 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 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; + } + } + } +} diff --git a/Projectiles/Astral/AstralScytheProjectile.cs b/Projectiles/Astral/AstralScytheProjectile.cs index 19ffc242f0..c3cfd1f68b 100644 --- a/Projectiles/Astral/AstralScytheProjectile.cs +++ b/Projectiles/Astral/AstralScytheProjectile.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Astral -{ - public class AstralScytheProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Ring"); - Main.projFrames[projectile.type] = 3; - } - - public override void SetDefaults() - { - projectile.width = 72; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.timeLeft = 300; - projectile.penetrate = 8; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - projectile.velocity *= 1.03f; - - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - if (projectile.frame > 2) - { - projectile.frame = 0; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item1, projectile.Center); - - for (int i = 0; i < 60; i++) - { - float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); - Vector2 angleVec = angle.ToRotationVector2(); - float distance = Main.rand.NextFloat(14f, 36f); - Vector2 off = angleVec * distance; - off.Y *= ((float)projectile.height / projectile.width); - Vector2 pos = projectile.Center + off; - Dust d = Dust.NewDustPerfect(pos, mod.DustType("AstralBlue"), angleVec * Main.rand.NextFloat(2f, 4f)); - d.customData = true; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Astral +{ + public class AstralScytheProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Ring"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 72; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.timeLeft = 300; + projectile.penetrate = 8; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + projectile.velocity *= 1.03f; + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame > 2) + { + projectile.frame = 0; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item1, projectile.Center); + + for (int i = 0; i < 60; i++) + { + float angle = MathHelper.TwoPi * Main.rand.NextFloat(0f, 1f); + Vector2 angleVec = angle.ToRotationVector2(); + float distance = Main.rand.NextFloat(14f, 36f); + Vector2 off = angleVec * distance; + off.Y *= ((float)projectile.height / projectile.width); + Vector2 pos = projectile.Center + off; + Dust d = Dust.NewDustPerfect(pos, mod.DustType("AstralBlue"), angleVec * Main.rand.NextFloat(2f, 4f)); + d.customData = true; + } + } + } +} diff --git a/Projectiles/Astral/AstralachneaFang.cs b/Projectiles/Astral/AstralachneaFang.cs index 564ed03b60..ff2c48d49a 100644 --- a/Projectiles/Astral/AstralachneaFang.cs +++ b/Projectiles/Astral/AstralachneaFang.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Astral -{ - public class AstralachneaFang : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fang"); - } - - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.magic = true; - projectile.tileCollide = true; - projectile.timeLeft = 240; - } - - public override void AI() - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - 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); - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 250f; - bool homeIn = 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; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 13f; - 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 * 25f + num484) / 26f; - projectile.velocity.Y = (projectile.velocity.Y * 25f + num485) / 26f; - return; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f); - } - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Astral +{ + public class AstralachneaFang : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fang"); + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.magic = true; + projectile.tileCollide = true; + projectile.timeLeft = 240; + } + + public override void AI() + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + 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); + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 250f; + bool homeIn = 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; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 13f; + 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 * 25f + num484) / 26f; + projectile.velocity.Y = (projectile.velocity.Y * 25f + num485) / 26f; + return; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f); + } + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); + } + } +} diff --git a/Projectiles/Astral/HeavenfallenEnergy.cs b/Projectiles/Astral/HeavenfallenEnergy.cs index 52a2b7f20c..c0331866b6 100644 --- a/Projectiles/Astral/HeavenfallenEnergy.cs +++ b/Projectiles/Astral/HeavenfallenEnergy.cs @@ -1,51 +1,51 @@ -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.Astral -{ - public class HeavenfallenEnergy : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heavenfallen Energy"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - int num154 = 14; - int coolDust; - projectile.ai[0] += 1; - if (projectile.ai[0] % 2 == 0) - { - if (projectile.ai[0] % 4 == 0) - { - coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, mod.DustType("AstralBlue"), 0f, 0f, 100, default(Color), 1.5f); - } - else - { - coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.5f); - } - Main.dust[coolDust].noGravity = true; - Main.dust[coolDust].velocity *= 0.1f; - Main.dust[coolDust].velocity += projectile.velocity * 0.5f; - } - - } - } -} \ No newline at end of file +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.Astral +{ + public class HeavenfallenEnergy : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heavenfallen Energy"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + int num154 = 14; + int coolDust; + projectile.ai[0] += 1; + if (projectile.ai[0] % 2 == 0) + { + if (projectile.ai[0] % 4 == 0) + { + coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, mod.DustType("AstralBlue"), 0f, 0f, 100, default(Color), 1.5f); + } + else + { + coolDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.5f); + } + Main.dust[coolDust].noGravity = true; + Main.dust[coolDust].velocity *= 0.1f; + Main.dust[coolDust].velocity += projectile.velocity * 0.5f; + } + + } + } +} diff --git a/Projectiles/Astral/HeavenfallenStardisk.cs b/Projectiles/Astral/HeavenfallenStardisk.cs index 993f163b3f..ed16991701 100644 --- a/Projectiles/Astral/HeavenfallenStardisk.cs +++ b/Projectiles/Astral/HeavenfallenStardisk.cs @@ -1,174 +1,174 @@ -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.Astral -{ - public class HeavenfallenStardisk : ModProjectile - { - - public bool explode = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heavenfallen Stardisk"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 20; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - - for (int i = 0; i < 2; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - for (int i = 0; i < 2; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - - projectile.rotation += 0.5f; - - if (Main.player[projectile.owner].position.Y != Main.player[projectile.owner].oldPosition.Y && projectile.ai[0] == 0f) - { - explode = true; - } - - projectile.ai[0] += 1f; - - if (Main.myPlayer == projectile.owner && projectile.ai[0] == 20f) - { - if (Main.player[projectile.owner].channel) - { - float num115 = 20f; - Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; - } - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (num118 > num115) - { - num118 = num115 / num118; - num116 *= num118; - num117 *= num118; - int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); - int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); - if (num119 != num120 || num121 != num122) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - else - { - int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); - int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); - if (num123 != num124 || num125 != num126) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - } - else if (projectile.ai[0] == 20f) - { - projectile.netUpdate = true; - float num127 = 20f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; - } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) - { - vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int i = 0; i < 10; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - for (int i = 0; i < 10; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - - if (explode && Main.player[projectile.owner].position.Y != Main.player[projectile.owner].oldPosition.Y) - { - if (projectile.owner == Main.myPlayer) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.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(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), mod.ProjectileType("HeavenfallenEnergy"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), mod.ProjectileType("HeavenfallenEnergy"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } -} +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.Astral +{ + public class HeavenfallenStardisk : ModProjectile + { + + public bool explode = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heavenfallen Stardisk"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.netImportant = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 20; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + + for (int i = 0; i < 2; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + for (int i = 0; i < 2; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + + projectile.rotation += 0.5f; + + if (Main.player[projectile.owner].position.Y != Main.player[projectile.owner].oldPosition.Y && projectile.ai[0] == 0f) + { + explode = true; + } + + projectile.ai[0] += 1f; + + if (Main.myPlayer == projectile.owner && projectile.ai[0] == 20f) + { + if (Main.player[projectile.owner].channel) + { + float num115 = 20f; + Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; + float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; + if (Main.player[projectile.owner].gravDir == -1f) + { + num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; + } + float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + if (num118 > num115) + { + num118 = num115 / num118; + num116 *= num118; + num117 *= num118; + int num119 = (int)(num116 * 1000f); + int num120 = (int)(projectile.velocity.X * 1000f); + int num121 = (int)(num117 * 1000f); + int num122 = (int)(projectile.velocity.Y * 1000f); + if (num119 != num120 || num121 != num122) + { + projectile.netUpdate = true; + } + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + else + { + int num123 = (int)(num116 * 1000f); + int num124 = (int)(projectile.velocity.X * 1000f); + int num125 = (int)(num117 * 1000f); + int num126 = (int)(projectile.velocity.Y * 1000f); + if (num123 != num124 || num125 != num126) + { + projectile.netUpdate = true; + } + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + } + else if (projectile.ai[0] == 20f) + { + projectile.netUpdate = true; + float num127 = 20f; + Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; + float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + if (Main.player[projectile.owner].gravDir == -1f) + { + num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + } + float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + if (num130 == 0f || projectile.ai[0] < 0f) + { + vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); + num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; + num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + } + num130 = num127 / num130; + num128 *= num130; + num129 *= num130; + projectile.velocity.X = num128; + projectile.velocity.Y = num129; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int i = 0; i < 10; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + for (int i = 0; i < 10; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + + if (explode && Main.player[projectile.owner].position.Y != Main.player[projectile.owner].oldPosition.Y) + { + if (projectile.owner == Main.myPlayer) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.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(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), mod.ProjectileType("HeavenfallenEnergy"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), mod.ProjectileType("HeavenfallenEnergy"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } +} diff --git a/Projectiles/Astral/Hive.cs b/Projectiles/Astral/Hive.cs index a4e2ffc032..d6469663fc 100644 --- a/Projectiles/Astral/Hive.cs +++ b/Projectiles/Astral/Hive.cs @@ -6,97 +6,97 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral -{ - public class Hive : ModProjectile - { - +{ + public class Hive : ModProjectile + { + public override void SetStaticDefaults() { - DisplayName.SetDefault("Hive"); + DisplayName.SetDefault("Hive"); Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 60; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; - } - - 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 > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - projectile.velocity.Y += 0.5f; - + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 60; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.sentry = true; + projectile.timeLeft = Projectile.SentryLifeTime; + projectile.penetrate = -1; + } + + 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 > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + projectile.velocity.Y += 0.5f; + if (projectile.velocity.Y > 10f) { projectile.velocity.Y = 10f; - } - - 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; - } - } - } - } + } + + 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) @@ -110,22 +110,22 @@ 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, (float)target, 0f); - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; + } + } } - public override bool CanDamage() - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + + public override bool CanDamage() + { + return false; + } } } diff --git a/Projectiles/Astral/Hiveling.cs b/Projectiles/Astral/Hiveling.cs index fb0bed027b..3293ef9088 100644 --- a/Projectiles/Astral/Hiveling.cs +++ b/Projectiles/Astral/Hiveling.cs @@ -87,4 +87,4 @@ namespace CalamityMod.Projectiles.Astral } } } -} \ No newline at end of file +} diff --git a/Projectiles/Astral/Quasar.cs b/Projectiles/Astral/Quasar.cs index 7139ad96a4..f6bd40bfa4 100644 --- a/Projectiles/Astral/Quasar.cs +++ b/Projectiles/Astral/Quasar.cs @@ -104,4 +104,4 @@ namespace CalamityMod.Projectiles.Astral } } } -} \ No newline at end of file +} diff --git a/Projectiles/Astral/Quasar2.cs b/Projectiles/Astral/Quasar2.cs index 753ed1ef1f..17b35a0073 100644 --- a/Projectiles/Astral/Quasar2.cs +++ b/Projectiles/Astral/Quasar2.cs @@ -82,4 +82,4 @@ namespace CalamityMod.Projectiles.Astral } } } -} \ No newline at end of file +} diff --git a/Projectiles/Astral/RadiantExplosion.cs b/Projectiles/Astral/RadiantExplosion.cs index 96c758efd7..d02062fdb9 100644 --- a/Projectiles/Astral/RadiantExplosion.cs +++ b/Projectiles/Astral/RadiantExplosion.cs @@ -1,82 +1,82 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Astral -{ - public class RadiantExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 150; - projectile.height = 150; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 10; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int i = 0; i < 5; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - for (int i = 0; i < 5; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - 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 = ProjectileID.HallowStar; - } - else - { - projectileType = ProjectileID.FallingStar; - } - 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, (int)((double)projectile.damage * 0.75), 5f, projectile.owner, 2f, 0f); - Main.projectile[num17].ranged = false; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Astral +{ + public class RadiantExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 150; + projectile.height = 150; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 10; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int i = 0; i < 5; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + for (int i = 0; i < 5; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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 = ProjectileID.HallowStar; + } + else + { + projectileType = ProjectileID.FallingStar; + } + 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, (int)((double)projectile.damage * 0.75), 5f, projectile.owner, 2f, 0f); + Main.projectile[num17].ranged = false; + } + } + } +} diff --git a/Projectiles/Astral/RadiantStar.cs b/Projectiles/Astral/RadiantStar.cs index 0fdfc828bb..65ea724112 100644 --- a/Projectiles/Astral/RadiantStar.cs +++ b/Projectiles/Astral/RadiantStar.cs @@ -1,111 +1,111 @@ -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.Astral -{ - 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; - 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; - } - 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, - (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; - } - } - } - - 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 +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.Astral +{ + 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; + 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; + } + 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, + (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; + } + } + } + + 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); + } + } + } +} diff --git a/Projectiles/Astral/RadiantStar2.cs b/Projectiles/Astral/RadiantStar2.cs index 22c7757927..230563425f 100644 --- a/Projectiles/Astral/RadiantStar2.cs +++ b/Projectiles/Astral/RadiantStar2.cs @@ -1,124 +1,124 @@ -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.Astral -{ - 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; - 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; - } - 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++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) - { - 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; - } - } - } - } - } - else - { - 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); - } - } - } -} \ No newline at end of file +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.Astral +{ + 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; + 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; + } + 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++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + { + 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; + } + } + } + } + } + else + { + 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); + } + } + } +} diff --git a/Projectiles/Astral/StellarKnife.cs b/Projectiles/Astral/StellarKnife.cs index bf3f047603..0b7256c6ff 100644 --- a/Projectiles/Astral/StellarKnife.cs +++ b/Projectiles/Astral/StellarKnife.cs @@ -1,101 +1,101 @@ -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.Astral -{ - public class StellarKnife : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stellar Knife"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 34; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.ai[1] += 0.75f; - if (projectile.ai[1] <= 60f) - { - projectile.rotation += 1f; - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - } - else - { - 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 (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 = 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 *= 0.92f; - projectile.velocity.Y *= 0.92f; - } - } - } - - 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 +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.Astral +{ + public class StellarKnife : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stellar Knife"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 34; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.ai[1] += 0.75f; + if (projectile.ai[1] <= 60f) + { + projectile.rotation += 1f; + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + } + else + { + 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 (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 = 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 *= 0.92f; + projectile.velocity.Y *= 0.92f; + } + } + } + + 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); + } + } + } +} diff --git a/Projectiles/Boss/AbyssBallVolley.cs b/Projectiles/Boss/AbyssBallVolley.cs index f8e1681651..4a66624bc5 100644 --- a/Projectiles/Boss/AbyssBallVolley.cs +++ b/Projectiles/Boss/AbyssBallVolley.cs @@ -1,54 +1,54 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class AbyssBallVolley : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Ball Volley"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.alpha = 60; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 120; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } - if (Main.rand.Next(2) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Weak, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AbyssBallVolley : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Ball Volley"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.alpha = 60; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 120; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } + if (Main.rand.Next(2) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Weak, 120); + } + } +} diff --git a/Projectiles/Boss/AbyssBallVolley2.cs b/Projectiles/Boss/AbyssBallVolley2.cs index 89c769c00d..b39e5d6d73 100644 --- a/Projectiles/Boss/AbyssBallVolley2.cs +++ b/Projectiles/Boss/AbyssBallVolley2.cs @@ -1,56 +1,56 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class AbyssBallVolley2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Ball Volley"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.alpha = 60; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } - if (Main.rand.Next(2) == 0) - { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); - Main.dust[dust].noGravity = true; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); - Main.dust[dust].noGravity = true; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Cursed, 90); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AbyssBallVolley2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Ball Volley"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.alpha = 60; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } + if (Main.rand.Next(2) == 0) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); + Main.dust[dust].noGravity = true; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); + Main.dust[dust].noGravity = true; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Cursed, 90); + } + } +} diff --git a/Projectiles/Boss/AbyssMine.cs b/Projectiles/Boss/AbyssMine.cs index e92e79b635..043e71bada 100644 --- a/Projectiles/Boss/AbyssMine.cs +++ b/Projectiles/Boss/AbyssMine.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class AbyssMine : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Mine"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.alpha = 60; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = Main.expertMode ? 3000 : 2400; - } - - public override void AI() - { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } - if (Main.rand.Next(6) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); - } - } - - public override void Kill(int timeLeft) - { - 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 = 150; - projectile.height = 150; - 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 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.7f); - Main.dust[num624].velocity *= 5f; - 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; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Weak, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AbyssMine : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Mine"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.alpha = 60; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = Main.expertMode ? 3000 : 2400; + } + + public override void AI() + { + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } + if (Main.rand.Next(6) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); + } + } + + public override void Kill(int timeLeft) + { + 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 = 150; + projectile.height = 150; + 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 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.7f); + Main.dust[num624].velocity *= 5f; + 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; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Weak, 120); + } + } +} diff --git a/Projectiles/Boss/AbyssMine2.cs b/Projectiles/Boss/AbyssMine2.cs index 63ba72f11a..17e1e4a4bd 100644 --- a/Projectiles/Boss/AbyssMine2.cs +++ b/Projectiles/Boss/AbyssMine2.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class AbyssMine2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Mine"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.alpha = 60; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = Main.expertMode ? 3000 : 2400; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } - if (Main.rand.Next(6) == 0) - { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); - Main.dust[dust].noGravity = true; - } - } - - public override void Kill(int timeLeft) - { - 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 = 150; - projectile.height = 150; - 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 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - 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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1.7f); - 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, 127, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Cursed, 90); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AbyssMine2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Mine"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.alpha = 60; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = Main.expertMode ? 3000 : 2400; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } + if (Main.rand.Next(6) == 0) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); + Main.dust[dust].noGravity = true; + } + } + + public override void Kill(int timeLeft) + { + 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 = 150; + projectile.height = 150; + 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 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + 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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1.7f); + 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, 127, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Cursed, 90); + } + } +} diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index f2b1a8bf06..8180fe2099 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -1,131 +1,131 @@ -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.Boss -{ - public class AstralFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Homing Flame"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 480; - } - - public override void AI() - { - 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); - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - if (vector11.Length() < 60f) - { - projectile.Kill(); - return; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 15f) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 0.8f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - if (projectile.alpha > 0) - { - projectile.alpha -= 5; - } - } - if (projectile.ai[0] >= 120f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] < 120f) - { - float scaleFactor2 = projectile.velocity.Length(); - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - } - } - } - - 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 OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120); - } - - 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); - 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, 173, 0f, 0f, 50, default(Color), 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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.Boss +{ + public class AstralFlame : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Homing Flame"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 480; + } + + public override void AI() + { + 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); + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + if (vector11.Length() < 60f) + { + projectile.Kill(); + return; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 15f) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 0.8f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + if (projectile.alpha > 0) + { + projectile.alpha -= 5; + } + } + if (projectile.ai[0] >= 120f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] < 120f) + { + float scaleFactor2 = projectile.velocity.Length(); + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + } + } + } + + 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 OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120); + } + + 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); + 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, 173, 0f, 0f, 50, default(Color), 1f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index c63c6ebd77..a7fd25554a 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -1,91 +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.Boss -{ - public class AstralLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Laser Volley"); - Main.projFrames[projectile.type] = 3; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - 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.3f, 0f); - projectile.ai[0] += 1f; - if (projectile.ai[0] > 9f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 5; - } - } - } - - 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) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 60); - } - } -} \ No newline at end of file +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.Boss +{ + public class AstralLaser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Laser Volley"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + 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.3f, 0f); + projectile.ai[0] += 1f; + if (projectile.ai[0] > 9f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 5; + } + } + } + + 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) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 60); + } + } +} diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index 46e9dced48..42003936a7 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -1,68 +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.Boss -{ - public class AstralShot2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Laser"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 120); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, projectile.alpha); - } - } -} \ No newline at end of file +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.Boss +{ + public class AstralShot2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Laser"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + } +} diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs index b6d8dce7c3..10f96817c5 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -1,170 +1,170 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class BigFlare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Flare"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 100; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 600; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - 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, 244, value15.X * 2f, value15.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - 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++) - { - 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, 244, 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; - } - if (projectile.owner == Main.myPlayer) - { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); - int num233 = 100; - if (num232 < 10) - { - num232 = 10; - } - if (num232 > Main.maxTilesX - 10) - { - num232 = Main.maxTilesX - 10; - } - if (num231 < 10) - { - num231 = 10; - } - if (num231 > Main.maxTilesY - num233 - 10) - { - num231 = Main.maxTilesY - num233 - 10; - } - int spawnAreaY = Main.maxTilesY - num231; - for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) - { - Tile tile = Main.tile[num232, num234 + 10]; - if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) - { - num231 = num234; - break; - } - } - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado"), 0, 4f, Main.myPlayer, 11f, 20f + (revenge ? 2f : 0f)); - Main.projectile[num236].netUpdate = true; - } - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class BigFlare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Flare"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 100; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 600; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + 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, 244, value15.X * 2f, value15.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + 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++) + { + 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, 244, 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; + } + if (projectile.owner == Main.myPlayer) + { + int num231 = (int)(projectile.Center.Y / 16f); + int num232 = (int)(projectile.Center.X / 16f); + int num233 = 100; + if (num232 < 10) + { + num232 = 10; + } + if (num232 > Main.maxTilesX - 10) + { + num232 = Main.maxTilesX - 10; + } + if (num231 < 10) + { + num231 = 10; + } + if (num231 > Main.maxTilesY - num233 - 10) + { + num231 = Main.maxTilesY - num233 - 10; + } + int spawnAreaY = Main.maxTilesY - num231; + for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) + { + Tile tile = Main.tile[num232, num234 + 10]; + if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num231 = num234; + break; + } + } + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado"), 0, 4f, Main.myPlayer, 11f, 20f + (revenge ? 2f : 0f)); + Main.projectile[num236].netUpdate = true; + } + } + } +} diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index b7ffa3561a..eeb418eeb8 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -165,4 +165,4 @@ namespace CalamityMod.Projectiles.Boss } } } -} \ No newline at end of file +} diff --git a/Projectiles/Boss/BloodClot.cs b/Projectiles/Boss/BloodClot.cs index 10792f95d9..5f877c7e5c 100644 --- a/Projectiles/Boss/BloodClot.cs +++ b/Projectiles/Boss/BloodClot.cs @@ -1,41 +1,41 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class BloodClot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Clot"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - aiType = 1; - } - - public override void AI() - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.25f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BurningBlood"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BloodClot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Clot"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + aiType = 1; + } + + public override void AI() + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.25f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BurningBlood"), 120); + } + } +} diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index 398422463f..6ccd6b3e54 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class BloodGeyser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Geyser"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - if (CalamityWorld.death) - { - projectile.tileCollide = false; - } - projectile.timeLeft = 300; - projectile.penetrate = 1; - projectile.aiStyle = 1; - aiType = 1; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BurningBlood"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class BloodGeyser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Geyser"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + if (CalamityWorld.death) + { + projectile.tileCollide = false; + } + projectile.timeLeft = 300; + projectile.penetrate = 1; + projectile.aiStyle = 1; + aiType = 1; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BurningBlood"), 120); + } + } +} diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs index b95cb35ca7..158f19efdc 100644 --- a/Projectiles/Boss/BrimstoneBall.cs +++ b/Projectiles/Boss/BrimstoneBall.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Fireball"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.penetrate = 6; - projectile.aiStyle = 14; - aiType = 277; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - - 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; - } - projectile.velocity *= 0.98f; - } - return false; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneBall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Fireball"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.penetrate = 6; + projectile.aiStyle = 14; + aiType = 277; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + + 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; + } + projectile.velocity *= 0.98f; + } + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + } +} diff --git a/Projectiles/Boss/BrimstoneBall2.cs b/Projectiles/Boss/BrimstoneBall2.cs index 8bb932fdf9..10b11d0f1b 100644 --- a/Projectiles/Boss/BrimstoneBall2.cs +++ b/Projectiles/Boss/BrimstoneBall2.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneBall2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Fireball"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.penetrate = 3; - projectile.aiStyle = 14; - aiType = 277; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - - 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; - } - projectile.velocity *= 2f; - } - return false; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneBall2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Fireball"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.penetrate = 3; + projectile.aiStyle = 14; + aiType = 277; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + + 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; + } + projectile.velocity *= 2f; + } + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } +} diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 3a5ad9eabe..f051d6a4cf 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -1,71 +1,71 @@ -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.Boss -{ - public class BrimstoneBarrage : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Dart"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void AI() - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < (projectile.ai[1] == 1f ? 12f : 16f)) - { - projectile.velocity *= 1.01f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 180); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); - } - - 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 +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.Boss +{ + public class BrimstoneBarrage : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Dart"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void AI() + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < (projectile.ai[1] == 1f ? 12f : 16f)) + { + projectile.velocity *= 1.01f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 180); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); + } + + 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; + } + } +} diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs index d336bbd6d6..378bce5590 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 235; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 1.5f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 1.5f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 90; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 90) + { + projectile.timeLeft = 90; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 235; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 1.5f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 1.5f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + } +} diff --git a/Projectiles/Boss/BrimstoneFireblast.cs b/Projectiles/Boss/BrimstoneFireblast.cs index c1ce7f34b1..c130be7edb 100644 --- a/Projectiles/Boss/BrimstoneFireblast.cs +++ b/Projectiles/Boss/BrimstoneFireblast.cs @@ -1,116 +1,116 @@ -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.Boss -{ - public class BrimstoneFireblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Gigablast"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 120; - cooldownSlot = 1; - } - - public override void AI() - { - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = true; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - projectile.alpha -= 1; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 220f && projectile.ai[1] > 20f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } - - 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(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 180, true); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - float spread = 12f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 30f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 30; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - } - } - for (int dust = 0; dust <= 10; dust++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); - } - } - } -} \ No newline at end of file +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.Boss +{ + public class BrimstoneFireblast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Gigablast"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.alpha = 120; + cooldownSlot = 1; + } + + public override void AI() + { + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = true; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + projectile.alpha -= 1; + if (projectile.alpha <= 0) + { + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 220f && projectile.ai[1] > 20f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + } + + 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(250, 50, 50, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 180, true); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + float spread = 12f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 30f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) + { + for (i = 0; i < 30; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + } + } + for (int dust = 0; dust <= 10; dust++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Boss/BrimstoneGigaBlast.cs b/Projectiles/Boss/BrimstoneGigaBlast.cs index bac821fb66..847e17fdf5 100644 --- a/Projectiles/Boss/BrimstoneGigaBlast.cs +++ b/Projectiles/Boss/BrimstoneGigaBlast.cs @@ -1,121 +1,121 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneGigaBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Fireblast"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 36; - projectile.height = 36; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 50; - projectile.timeLeft = 150; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - bool revenge = CalamityWorld.revenge; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - float num953 = revenge ? 100f : 80f; //100 - float scaleFactor12 = revenge ? 20f : 15f; //5 - float num954 = 40f; - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - } - } - - 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(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 240); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 180, true); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - float spread = 45f * 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) - { - for (i = 0; i < 8; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 7f), (float)(-Math.Cos(offsetAngle) * 7f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - } - } - for (int dust = 0; dust <= 5; dust++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneGigaBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Fireblast"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 36; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.alpha = 50; + projectile.timeLeft = 150; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + bool revenge = CalamityWorld.revenge; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + float num953 = revenge ? 100f : 80f; //100 + float scaleFactor12 = revenge ? 20f : 15f; //5 + float num954 = 40f; + int num959 = (int)projectile.ai[0]; + if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + { + if (projectile.Distance(Main.player[num959].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + } + } + + 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(250, 50, 50, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 240); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 180, true); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + float spread = 45f * 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) + { + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 7f), (float)(-Math.Cos(offsetAngle) * 7f), mod.ProjectileType("BrimstoneBarrage"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + } + } + for (int dust = 0; dust <= 5; dust++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index 956560f26a..8e88a41224 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -1,95 +1,95 @@ -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.Boss -{ - public class BrimstoneHellblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Hellblast"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 255; - projectile.alpha = 0; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.alpha += 1; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.velocity.X *= 1.03f; - projectile.velocity.Y *= 1.03f; - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 180); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int dust = 0; dust <= 5; dust++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); - } - } - } -} \ No newline at end of file +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.Boss +{ + public class BrimstoneHellblast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Hellblast"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 255; + projectile.alpha = 0; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.alpha += 1; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.velocity.X *= 1.03f; + projectile.velocity.Y *= 1.03f; + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 180); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int dust = 0; dust <= 5; dust++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index c478c475c8..e11bb85d2a 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -1,80 +1,80 @@ -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.Boss -{ - public class BrimstoneHellblast2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Hellblast"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 1500; - projectile.alpha = 0; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.alpha += 1; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 180); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); - } - } -} \ No newline at end of file +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.Boss +{ + public class BrimstoneHellblast2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Hellblast"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 1500; + projectile.alpha = 0; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.alpha += 1; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 180); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); + } + } +} diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index e5d84ac723..40d09eb5c1 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -1,59 +1,59 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneHellfireball : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Hellfireball"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.velocity.Y *= 1.01f; - projectile.velocity.X *= 1.01f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.ai[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.ai[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneHellfireball : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Hellfireball"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.velocity.Y *= 1.01f; + projectile.velocity.X *= 1.01f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.ai[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.ai[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } +} diff --git a/Projectiles/Boss/BrimstoneLaser.cs b/Projectiles/Boss/BrimstoneLaser.cs index d97116e886..d4fe3f91d7 100644 --- a/Projectiles/Boss/BrimstoneLaser.cs +++ b/Projectiles/Boss/BrimstoneLaser.cs @@ -1,76 +1,76 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneLaser : ModProjectile - { - private int splitTimer = 60; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Laser"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 120; - aiType = 100; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(splitTimer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - splitTimer = reader.ReadInt32(); - } - - public override void AI() - { - splitTimer--; - if (splitTimer <= 0) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneLaserSplit"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneLaser : ModProjectile + { + private int splitTimer = 60; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Laser"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.aiStyle = 1; + projectile.hostile = true; + projectile.scale = 2f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.alpha = 120; + aiType = 100; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(splitTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + splitTimer = reader.ReadInt32(); + } + + public override void AI() + { + splitTimer--; + if (splitTimer <= 0) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneLaserSplit"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + } +} diff --git a/Projectiles/Boss/BrimstoneLaserSplit.cs b/Projectiles/Boss/BrimstoneLaserSplit.cs index 82870f823f..c19f0e8ccf 100644 --- a/Projectiles/Boss/BrimstoneLaserSplit.cs +++ b/Projectiles/Boss/BrimstoneLaserSplit.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneLaserSplit : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Homing Laser"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 480; - projectile.alpha = 120; - } - - public override void AI() - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 150f && projectile.ai[1] > 90f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - else if (projectile.ai[1] >= 150f) - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0.3f, 0f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneLaserSplit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Homing Laser"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.hostile = true; + projectile.scale = 2f; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 480; + projectile.alpha = 120; + } + + public override void AI() + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 150f && projectile.ai[1] > 90f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + else if (projectile.ai[1] >= 150f) + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0.3f, 0f, 0f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + } +} diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 17af0a5381..3bc68e3601 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -1,156 +1,156 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneMonster : ModProjectile - { - private float speedAdd = 0f; - private float speedLimit = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Monster"); - } - - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 320; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 36000; - projectile.alpha = 50; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(speedAdd); - writer.Write(projectile.localAI[0]); - writer.Write(speedLimit); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - speedAdd = reader.ReadSingle(); - projectile.localAI[0] = reader.ReadSingle(); - speedLimit = reader.ReadSingle(); - } - - public override void AI() - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - projectile.active = false; - projectile.netUpdate = true; - return; - } - int choice = (int)projectile.ai[1]; - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] += 1f; - if (choice == 0) - { - speedLimit = 10f; - } - else if (choice == 1) - { - speedLimit = 20f; - } - else if (choice == 2) - { - speedLimit = 30f; - } - else - { - speedLimit = 40f; - } - } - if (speedAdd < speedLimit) - { - speedAdd += 0.04f; - } - bool revenge = CalamityWorld.revenge; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - float num953 = (revenge ? 5f : 4.5f) + speedAdd; //100 - float scaleFactor12 = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f); //5 - float num954 = 40f; - if (projectile.timeLeft > 30 && projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha = 128; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); - - float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; - - return minDist <= 170f; - } - - 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 Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 900); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 300, true); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneMonster : ModProjectile + { + private float speedAdd = 0f; + private float speedLimit = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Monster"); + } + + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 320; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 36000; + projectile.alpha = 50; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(speedAdd); + writer.Write(projectile.localAI[0]); + writer.Write(speedLimit); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + speedAdd = reader.ReadSingle(); + projectile.localAI[0] = reader.ReadSingle(); + speedLimit = reader.ReadSingle(); + } + + public override void AI() + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + int choice = (int)projectile.ai[1]; + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] += 1f; + if (choice == 0) + { + speedLimit = 10f; + } + else if (choice == 1) + { + speedLimit = 20f; + } + else if (choice == 2) + { + speedLimit = 30f; + } + else + { + speedLimit = 40f; + } + } + if (speedAdd < speedLimit) + { + speedAdd += 0.04f; + } + bool revenge = CalamityWorld.revenge; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + float num953 = (revenge ? 5f : 4.5f) + speedAdd; //100 + float scaleFactor12 = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f); //5 + float num954 = 40f; + if (projectile.timeLeft > 30 && projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha = 128; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int num959 = (int)projectile.ai[0]; + if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + { + if (projectile.Distance(Main.player[num959].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) minDist = dist2; + if (dist3 < minDist) minDist = dist3; + if (dist4 < minDist) minDist = dist4; + + return minDist <= 170f; + } + + 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 Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 900); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 300, true); + } + } +} diff --git a/Projectiles/Boss/BrimstoneShot.cs b/Projectiles/Boss/BrimstoneShot.cs index 38f2117cef..61c34dfc17 100644 --- a/Projectiles/Boss/BrimstoneShot.cs +++ b/Projectiles/Boss/BrimstoneShot.cs @@ -1,59 +1,59 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneShot : ModProjectile - { - public int splitTimer = 60; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Laser"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 60; - cooldownSlot = 1; - } - - public override void AI() - { - splitTimer--; - if (splitTimer <= 0) - { - int numProj = 3; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneLaserSplit"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 150); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneShot : ModProjectile + { + public int splitTimer = 60; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Laser"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.hostile = true; + projectile.scale = 2f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.alpha = 60; + cooldownSlot = 1; + } + + public override void AI() + { + splitTimer--; + if (splitTimer <= 0) + { + int numProj = 3; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneLaserSplit"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.velocity.X *= 1.05f; + projectile.velocity.Y *= 1.05f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 150); + } + } +} diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index 7187c405e8..8813f16145 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -1,90 +1,90 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneWave : ModProjectile - { - private int x; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Flame Skull"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(x); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - x = reader.ReadInt32(); - } - - public override void AI() - { - x++; - projectile.velocity.Y = (float)(10.0 * Math.Sin(x / 20)); - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = 1; - } - else - { - projectile.spriteDirection = -1; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("AbyssalFlames"), 180); - target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BrimstoneWave : ModProjectile + { + private int x; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Flame Skull"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 30; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(x); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + x = reader.ReadInt32(); + } + + public override void AI() + { + x++; + projectile.velocity.Y = (float)(10.0 * Math.Sin(x / 20)); + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = 1; + } + else + { + projectile.spriteDirection = -1; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("AbyssalFlames"), 180); + target.AddBuff(mod.BuffType("VulnerabilityHex"), 120, true); + } + } +} diff --git a/Projectiles/Boss/CosmicFlameBurst.cs b/Projectiles/Boss/CosmicFlameBurst.cs index 0449ead1aa..e8e78db97f 100644 --- a/Projectiles/Boss/CosmicFlameBurst.cs +++ b/Projectiles/Boss/CosmicFlameBurst.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class CosmicFlameBurst : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Flame"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - aiType = 348; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - cooldownSlot = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); - 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, 74); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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, 173, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class CosmicFlameBurst : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Flame"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + aiType = 348; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + cooldownSlot = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); + 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, 74); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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, 173, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index e6ca4b50b6..1e2d636fcf 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -1,73 +1,73 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DarkEnergyBall : ModProjectile - { - private double timeElapsed = 0.0; - private double circleSize = 1.0; - private double circleGrowth = 0.02; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 80; - projectile.height = 80; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(timeElapsed); - writer.Write(circleSize); - writer.Write(circleGrowth); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - timeElapsed = reader.ReadDouble(); - circleSize = reader.ReadDouble(); - circleGrowth = reader.ReadDouble(); - } - - 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; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 90, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DarkEnergyBall : ModProjectile + { + private double timeElapsed = 0.0; + private double circleSize = 1.0; + private double circleGrowth = 0.02; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Energy"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 80; + projectile.height = 80; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(timeElapsed); + writer.Write(circleSize); + writer.Write(circleGrowth); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + timeElapsed = reader.ReadDouble(); + circleSize = reader.ReadDouble(); + circleGrowth = reader.ReadDouble(); + } + + 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; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 90, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Boss/DestroyerHomingLaser.cs b/Projectiles/Boss/DestroyerHomingLaser.cs index 4bae2ed8f2..aec8919233 100644 --- a/Projectiles/Boss/DestroyerHomingLaser.cs +++ b/Projectiles/Boss/DestroyerHomingLaser.cs @@ -1,88 +1,88 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DestroyerHomingLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Homing Laser"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.scale = 1.8f; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.alpha > 0) - { - projectile.alpha -= 125; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[1] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 120f) - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 360f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.alpha < 200) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } - return Color.Transparent; - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DestroyerHomingLaser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Homing Laser"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.scale = 1.8f; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.alpha > 0) + { + projectile.alpha -= 125; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 120f) + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[0] += 1f; + if (projectile.ai[0] < 360f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + } + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha < 200) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + return Color.Transparent; + } + } +} diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index f8e35e9557..3a103d2137 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -1,136 +1,136 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DeusMine : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Mine"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 1200; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - } - } - - public override bool CanDamage() - { - if (projectile.timeLeft > 1100) - { - return false; - } - return true; - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft > 1115) - { - projectile.localAI[1] += 1f; - byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - 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 = 150; - projectile.height = 150; - 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 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.7f); - 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 240); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DeusMine : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Mine"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 1200; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + } + } + + public override bool CanDamage() + { + if (projectile.timeLeft > 1100) + { + return false; + } + return true; + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft > 1115) + { + projectile.localAI[1] += 1f; + byte b2 = (byte)(((int)projectile.localAI[1]) * 3); + byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + 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 = 150; + projectile.height = 150; + 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 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.7f); + 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 240); + } + } +} diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index 6c179b9eea..449ab01b0d 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -1,74 +1,74 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DoGBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Portal Laser"); - Main.projFrames[projectile.type] = 2; - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 960; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 120f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 20f + vector11) / 21f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft > 950) - { - return new Color(0, 0, 0, 0); - } - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DoGBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Portal Laser"); + Main.projFrames[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.scale = 2f; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 960; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 120f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 20f + vector11) / 21f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft > 950) + { + return new Color(0, 0, 0, 0); + } + 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); + } + } +} diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index 27ef7c175c..3137565af6 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -1,142 +1,142 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class DoGBeamPortal : ModProjectile - { - private int beamTimer = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam Portal"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 80; - projectile.height = 80; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.penetrate = 1; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(beamTimer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - beamTimer = reader.ReadInt32(); - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.95f) / 255f, ((255 - projectile.alpha) * 1.15f) / 255f); - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - beamTimer--; - if (beamTimer <= 0) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); - float spread = 30f * 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) - { - for (i = 0; i < 4; i++) - { - float speed = 4f; - int projectileDamage = Main.expertMode ? 64 : 75; - if (CalamityWorld.death) - { - speed = 7f; - } - else if (CalamityWorld.revenge) - { - speed = 6f; - } - else if (Main.expertMode) - { - speed = 5f; - } - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), mod.ProjectileType("DoGBeam"), projectileDamage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), mod.ProjectileType("DoGBeam"), projectileDamage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - beamTimer = 180; - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - if (Vector2.Distance(Main.player[num103].Center, projectile.Center) > 2000f) - { - projectile.position.X = (float)(Main.player[num103].Center.X / 16) * 16f - (float)(projectile.width / 2); - projectile.position.Y = ((float)(Main.player[num103].Center.Y / 16) * 16f - (float)(projectile.height / 2)) - 250f; - projectile.ai[1] = 0f; - beamTimer = 90; - } - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.7f); - 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, 173, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } - - 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 +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class DoGBeamPortal : ModProjectile + { + private int beamTimer = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam Portal"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 80; + projectile.height = 80; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 600; + projectile.penetrate = 1; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(beamTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + beamTimer = reader.ReadInt32(); + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.95f) / 255f, ((255 - projectile.alpha) * 1.15f) / 255f); + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + beamTimer--; + if (beamTimer <= 0) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + float spread = 30f * 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) + { + for (i = 0; i < 4; i++) + { + float speed = 4f; + int projectileDamage = Main.expertMode ? 64 : 75; + if (CalamityWorld.death) + { + speed = 7f; + } + else if (CalamityWorld.revenge) + { + speed = 6f; + } + else if (Main.expertMode) + { + speed = 5f; + } + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), mod.ProjectileType("DoGBeam"), projectileDamage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), mod.ProjectileType("DoGBeam"), projectileDamage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + beamTimer = 180; + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + if (Vector2.Distance(Main.player[num103].Center, projectile.Center) > 2000f) + { + projectile.position.X = (float)(Main.player[num103].Center.X / 16) * 16f - (float)(projectile.width / 2); + projectile.position.Y = ((float)(Main.player[num103].Center.Y / 16) * 16f - (float)(projectile.height / 2)) - 250f; + projectile.ai[1] = 0f; + beamTimer = 90; + } + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.7f); + 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, 173, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } + + 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); + } + } +} diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 9e94b134ef..4e2745ebe9 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -1,55 +1,55 @@ -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.Boss -{ - public class DoGDeath : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Death Beam"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - cooldownSlot = 1; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, projectile.alpha); - } - } -} \ No newline at end of file +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.Boss +{ + public class DoGDeath : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death Beam"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + cooldownSlot = 1; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + } +} diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 0ca44ffd5f..5e7ed402ae 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -1,118 +1,118 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DoGFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Death Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - cooldownSlot = 1; - } - - public override void AI() - { - if (projectile.scale <= 1.5f) - { - projectile.scale *= 1.01f; - } - if (projectile.ai[1] == 0f) - { - if (projectile.timeLeft > 60) - { - projectile.timeLeft = 60; - } - } - else if (projectile.ai[1] == 1f) - { - if (projectile.timeLeft > 12) - { - projectile.timeLeft = 12; - } - } - else - { - if (projectile.timeLeft > 80) - { - projectile.timeLeft = 80; - } - } - if (projectile.ai[0] > 5f) - { - float num296 = 1f; - if (projectile.ai[0] == 6f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 7f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 8f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 173; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 600); - target.AddBuff(BuffID.Frostburn, 600, true); - target.AddBuff(BuffID.Darkness, 600, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DoGFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + cooldownSlot = 1; + } + + public override void AI() + { + if (projectile.scale <= 1.5f) + { + projectile.scale *= 1.01f; + } + if (projectile.ai[1] == 0f) + { + if (projectile.timeLeft > 60) + { + projectile.timeLeft = 60; + } + } + else if (projectile.ai[1] == 1f) + { + if (projectile.timeLeft > 12) + { + projectile.timeLeft = 12; + } + } + else + { + if (projectile.timeLeft > 80) + { + projectile.timeLeft = 80; + } + } + if (projectile.ai[0] > 5f) + { + float num296 = 1f; + if (projectile.ai[0] == 6f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 7f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 8f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 173; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 600); + target.AddBuff(BuffID.Frostburn, 600, true); + target.AddBuff(BuffID.Darkness, 600, true); + } + } +} diff --git a/Projectiles/Boss/DoGNebulaShot.cs b/Projectiles/Boss/DoGNebulaShot.cs index 30f83c6d50..b2e10d3740 100644 --- a/Projectiles/Boss/DoGNebulaShot.cs +++ b/Projectiles/Boss/DoGNebulaShot.cs @@ -1,116 +1,116 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DoGNebulaShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Death Laser"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 4; - projectile.timeLeft = 180; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 100, 255, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DoGNebulaShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death Laser"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 4; + projectile.timeLeft = 180; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 50f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 100, 255, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 50f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + } +} diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index fefb380a35..c1e98c0e2b 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -1,70 +1,70 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class EssenceDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Dust"); - } - - public override void SetDefaults() - { - projectile.width = 46; - projectile.height = 46; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.975f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.85f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 0.5f); - 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, 74); - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); - 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, 173, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class EssenceDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Dust"); + } + + public override void SetDefaults() + { + projectile.width = 46; + projectile.height = 46; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.975f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.85f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 0.5f); + 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, 74); + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); + 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, 173, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index c33acfc285..dfe0a788f8 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -1,169 +1,169 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class Flare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 100; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 600; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - 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, 244, value15.X * 2f, value15.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - 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++) - { - 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, 244, 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; - } - if (projectile.owner == Main.myPlayer) - { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); - int num233 = 100; - if (num232 < 10) - { - num232 = 10; - } - if (num232 > Main.maxTilesX - 10) - { - num232 = Main.maxTilesX - 10; - } - if (num231 < 10) - { - num231 = 10; - } - if (num231 > Main.maxTilesY - num233 - 10) - { - num231 = Main.maxTilesY - num233 - 10; - } - for (int num234 = num231; num234 < num231 + num233; num234++) - { - Tile tile = Main.tile[num232, num234]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) - { - num231 = num234; - break; - } - } - int num235 = Main.expertMode ? 84 : 100; //600 - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Flarenado"), num235, 4f, Main.myPlayer, 11f, 8f + (revenge ? 2f : 0f)); - Main.projectile[num236].netUpdate = true; - } - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class Flare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 100; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 600; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + 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, 244, value15.X * 2f, value15.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + 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++) + { + 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, 244, 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; + } + if (projectile.owner == Main.myPlayer) + { + int num231 = (int)(projectile.Center.Y / 16f); + int num232 = (int)(projectile.Center.X / 16f); + int num233 = 100; + if (num232 < 10) + { + num232 = 10; + } + if (num232 > Main.maxTilesX - 10) + { + num232 = Main.maxTilesX - 10; + } + if (num231 < 10) + { + num231 = 10; + } + if (num231 > Main.maxTilesY - num233 - 10) + { + num231 = Main.maxTilesY - num233 - 10; + } + for (int num234 = num231; num234 < num231 + num233; num234++) + { + Tile tile = Main.tile[num232, num234]; + if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num231 = num234; + break; + } + } + int num235 = Main.expertMode ? 84 : 100; //600 + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Flarenado"), num235, 4f, Main.myPlayer, 11f, 8f + (revenge ? 2f : 0f)); + Main.projectile[num236].netUpdate = true; + } + } + } +} diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index a4f94214f1..4cee2d7363 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -1,175 +1,175 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class FlareBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare Bomb"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.scale = 1.5f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 50; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - float num953 = revenge ? 110f : 100f; //100 - float scaleFactor12 = revenge ? 27f : 25f; //5 - float num954 = 40f; - if (projectile.timeLeft > 30 && projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha = 128; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - 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(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 = 50; - projectile.height = 50; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class FlareBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare Bomb"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.scale = 1.5f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.alpha = 50; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + float num953 = revenge ? 110f : 100f; //100 + float scaleFactor12 = revenge ? 27f : 25f; //5 + float num954 = 40f; + if (projectile.timeLeft > 30 && projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha = 128; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); + int num959 = (int)projectile.ai[0]; + if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + { + if (projectile.Distance(Main.player[num959].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + 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(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 = 50; + projectile.height = 50; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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; + } + } + } +} diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 354e7852c8..2f63d0cb67 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -1,128 +1,128 @@ -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.Boss -{ - public class FlareDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare Dust"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1.5f; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 120; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - 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(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - 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 num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); - 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, 244, 0f, 0f, 100, default(Color), 1f); - 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; - } - projectile.damage = Main.expertMode ? 75 : 90; - projectile.Damage(); - } - } -} \ No newline at end of file +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.Boss +{ + public class FlareDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare Dust"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.scale = 1.5f; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 120; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + 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(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + 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 num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); + 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, 244, 0f, 0f, 100, default(Color), 1f); + 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; + } + projectile.damage = Main.expertMode ? 75 : 90; + projectile.Damage(); + } + } +} diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index bd469f8e00..fcdec0ab6c 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -1,140 +1,140 @@ -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.Boss -{ - public class FlareDust2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare Bomb"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1.5f; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 840; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - 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, 0.5f, 0.5f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - 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(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 = 400; - projectile.height = 400; - 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, 244, 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; - } - } - for (int num623 = 0; num623 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); - 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, 244, 0f, 0f, 100, default(Color), 1f); - 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; - } - } - } -} \ No newline at end of file +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.Boss +{ + public class FlareDust2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare Bomb"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.scale = 1.5f; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 840; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + 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, 0.5f, 0.5f, 0f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + 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(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 = 400; + projectile.height = 400; + 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, 244, 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; + } + } + for (int num623 = 0; num623 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); + 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, 244, 0f, 0f, 100, default(Color), 1f); + 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; + } + } + } +} diff --git a/Projectiles/Boss/FlareExplosionHuge.cs b/Projectiles/Boss/FlareExplosionHuge.cs index cd708916b1..eff783591a 100644 --- a/Projectiles/Boss/FlareExplosionHuge.cs +++ b/Projectiles/Boss/FlareExplosionHuge.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class FlareExplosionHuge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 400; - projectile.height = 400; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - cooldownSlot = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 3f, 3f, 0f); - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 0.35f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class FlareExplosionHuge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 400; + projectile.height = 400; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 60; + cooldownSlot = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 3f, 3f, 0f); + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 0.35f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 60); + } + } +} diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 854c3423d6..bc58698e1f 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -1,151 +1,151 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class Flarenado : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flarenado"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 88; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - int num613 = 10; - int num614 = 15; - float num615 = 1.5f; - int num616 = 320; - int num617 = 88; - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.timeLeft < 300) - { - projectile.velocity.X = ((projectile.ai[1] % 2 == 0) ? 10f : -10f); - return; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - } - } - - public override bool CanDamage() - { - if (projectile.timeLeft > 480) - { - return false; - } - return true; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 53, projectile.alpha); - } - - 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 +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class Flarenado : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flarenado"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 88; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + int num613 = 10; + int num614 = 15; + float num615 = 1.5f; + int num616 = 320; + int num617 = 88; + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.timeLeft < 300) + { + projectile.velocity.X = ((projectile.ai[1] % 2 == 0) ? 10f : -10f); + return; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + } + } + + public override bool CanDamage() + { + if (projectile.timeLeft > 480) + { + return false; + } + return true; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 53, projectile.alpha); + } + + 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; + } + } +} diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index 81ac016ab8..d64f79e0f6 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -1,148 +1,148 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class FrostMist : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frost Mist"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 30); - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 16f) - { - projectile.localAI[1] = 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, 187, 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.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 10; - if (projectile.alpha >= 100) - { - projectile.alpha = 100; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 10; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.velocity.Length() < 12f) - { - projectile.velocity *= 1.02f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - } - - 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(200, 200, 200, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 240, true); - target.AddBuff(BuffID.Chilled, 120, true); - target.AddBuff(BuffID.Frozen, 30, true); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class FrostMist : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frost Mist"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 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; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 30); + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 16f) + { + projectile.localAI[1] = 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, 187, 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.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 10; + if (projectile.alpha >= 100) + { + projectile.alpha = 100; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 10; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.velocity.Length() < 12f) + { + projectile.velocity *= 1.02f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + } + + 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(200, 200, 200, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 240, true); + target.AddBuff(BuffID.Chilled, 120, true); + target.AddBuff(BuffID.Frozen, 30, true); + } + } +} diff --git a/Projectiles/Boss/GigaFlare.cs b/Projectiles/Boss/GigaFlare.cs index dec9f770d5..80a1b5cdf0 100644 --- a/Projectiles/Boss/GigaFlare.cs +++ b/Projectiles/Boss/GigaFlare.cs @@ -1,126 +1,126 @@ -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.Boss -{ - public class GigaFlare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fireball"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - 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(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 = 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, 244, 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 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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; - } - } - } -} \ No newline at end of file +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.Boss +{ + public class GigaFlare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fireball"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + 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(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 = 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, 244, 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 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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; + } + } + } +} diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index 3d15c0ae0d..47e32321f5 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -1,85 +1,85 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class GreatSandBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Great Sand Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.aiStyle = 1; - projectile.alpha = 255; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.tileCollide = projectile.timeLeft < 240; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - projectile.alpha -= 50; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 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, 14); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 20); - 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.velocity.X *= 0.5f; - target.velocity.Y *= 0.5f; - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class GreatSandBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Great Sand Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.aiStyle = 1; + projectile.alpha = 255; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.tileCollide = projectile.timeLeft < 240; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + projectile.alpha -= 50; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 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, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 20); + 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.velocity.X *= 0.5f; + target.velocity.Y *= 0.5f; + } + } +} diff --git a/Projectiles/Boss/HealOrbProv.cs b/Projectiles/Boss/HealOrbProv.cs index b037e8fd34..0dcb8eaa44 100644 --- a/Projectiles/Boss/HealOrbProv.cs +++ b/Projectiles/Boss/HealOrbProv.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; - -namespace CalamityMod.Projectiles.Boss -{ - public class HealOrbProv : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.extraUpdates = 3; - } - - public override void AI() - { - int num487 = (int)projectile.ai[0]; - float num488 = 2.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = -32; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - if (Main.player[num487].statLife < 0) - { - Main.player[num487].KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Projectiles.Boss +{ + public class HealOrbProv : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.extraUpdates = 3; + } + + public override void AI() + { + int num487 = (int)projectile.ai[0]; + float num488 = 2.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = -32; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + if (Main.player[num487].statLife < 0) + { + Main.player[num487].KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + return; + } + } +} diff --git a/Projectiles/Boss/HellfireExplosion.cs b/Projectiles/Boss/HellfireExplosion.cs index 80cbb3f4d7..16bfa57460 100644 --- a/Projectiles/Boss/HellfireExplosion.cs +++ b/Projectiles/Boss/HellfireExplosion.cs @@ -1,110 +1,110 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class HellfireExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Hellfire Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 130; - projectile.height = 130; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); - 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); - 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++; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HellfireExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Hellfire Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 130; + projectile.height = 130; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 180; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); + 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++; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + } + } +} diff --git a/Projectiles/Boss/HiveBombExplosionHostile.cs b/Projectiles/Boss/HiveBombExplosionHostile.cs index 4053137946..36d5af23df 100644 --- a/Projectiles/Boss/HiveBombExplosionHostile.cs +++ b/Projectiles/Boss/HiveBombExplosionHostile.cs @@ -1,33 +1,33 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class HiveBombExplosionHostile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Bomb Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 100; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 500); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HiveBombExplosionHostile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Bomb Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 100; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 500); + } + } +} diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 0adfdba899..83e681a0e0 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -1,167 +1,167 @@ -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.Boss -{ - public class HiveBombGoliath : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Bomb"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (Math.Abs(projectile.velocity.X) >= 3f || Math.Abs(projectile.velocity.Y) >= 3f) - { - float num247 = 0f; - float num248 = 0f; - if (Main.rand.Next(2) == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.25f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - else if (Main.rand.Next(4) == 0) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - } - 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 Color? GetAlpha(Color lightColor) - { - return new Color(50, 250, 50, 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("HiveBombExplosionHostile"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - 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 = 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 < 8; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.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 < 10; 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, 89, 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 OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 300); - } - } -} \ No newline at end of file +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.Boss +{ + public class HiveBombGoliath : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hive Bomb"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (Math.Abs(projectile.velocity.X) >= 3f || Math.Abs(projectile.velocity.Y) >= 3f) + { + float num247 = 0f; + float num248 = 0f; + if (Main.rand.Next(2) == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.25f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + else if (Main.rand.Next(4) == 0) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + } + 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 Color? GetAlpha(Color lightColor) + { + return new Color(50, 250, 50, 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("HiveBombExplosionHostile"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + 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 = 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 < 8; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.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 < 10; 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, 89, 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 OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + } + } +} diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index f840cbf039..0bec636352 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -1,126 +1,126 @@ -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.Boss -{ - public class HolyBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Blast"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 180; - projectile.height = 180; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.wet || projectile.lavaWet) - { - projectile.Kill(); - } - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - 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); - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } - - 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) - { - if (projectile.owner == Main.myPlayer) - { - Vector2 shootFromVector = new Vector2(projectile.Center.X, projectile.Center.Y); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.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) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyFire2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyFire2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int num193 = 0; num193 < 6; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default(Color), 1.5f); - } - for (int num194 = 0; num194 < 60; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 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, 244, 0f, 0f, 50, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 240); - } - } -} \ No newline at end of file +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.Boss +{ + public class HolyBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Blast"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 180; + projectile.height = 180; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.wet || projectile.lavaWet) + { + projectile.Kill(); + } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + 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); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + 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) + { + if (projectile.owner == Main.myPlayer) + { + Vector2 shootFromVector = new Vector2(projectile.Center.X, projectile.Center.Y); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.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) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyFire2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("HolyFire2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int num193 = 0; num193 < 6; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 60; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 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, 244, 0f, 0f, 50, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 240); + } + } +} diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 860a5c1b41..a3b70256c8 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -1,124 +1,124 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class HolyBomb : ModProjectile - { - private int flareShootTimer = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Bomb"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.timeLeft = 250; - projectile.penetrate = -1; - projectile.tileCollide = false; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(flareShootTimer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - flareShootTimer = reader.ReadInt32(); - } - - public override void AI() - { - flareShootTimer--; - if (flareShootTimer <= 0) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -2f, mod.ProjectileType("HolyFlare"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - flareShootTimer = 60; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } - - 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(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - 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 < 3; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default(Color), 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 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, 244, 0f, 0f, 50, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 180); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HolyBomb : ModProjectile + { + private int flareShootTimer = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Bomb"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.timeLeft = 250; + projectile.penetrate = -1; + projectile.tileCollide = false; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(flareShootTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + flareShootTimer = reader.ReadInt32(); + } + + public override void AI() + { + flareShootTimer--; + if (flareShootTimer <= 0) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -2f, mod.ProjectileType("HolyFlare"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + flareShootTimer = 60; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + 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(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + 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 < 3; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 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, 244, 0f, 0f, 50, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 180); + } + } +} diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index f2a854b098..6344084d5d 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -1,114 +1,114 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class HolyBurnOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Orb"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.scale = 1.5f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - projectile.alpha -= 2; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - int num487 = (int)Player.FindClosest(projectile.position, projectile.width, projectile.height); - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - int num492 = expertMode ? -150 : -100; - if (CalamityWorld.death) - { - num492 = -300; - } - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - if (Main.player[num487].statLife < 0 || CalamityWorld.armageddon) - { - Main.player[num487].KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - projectile.Kill(); - } - } - - public override void Kill(int timeLeft) - { - 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 = 50; - projectile.height = 50; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 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, 246, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class HolyBurnOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Orb"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.scale = 1.5f; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + projectile.alpha -= 2; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + int num487 = (int)Player.FindClosest(projectile.position, projectile.width, projectile.height); + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + int num492 = expertMode ? -150 : -100; + if (CalamityWorld.death) + { + num492 = -300; + } + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + if (Main.player[num487].statLife < 0 || CalamityWorld.armageddon) + { + Main.player[num487].KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0, false); + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + projectile.Kill(); + } + } + + public override void Kill(int timeLeft) + { + 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 = 50; + projectile.height = 50; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 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, 246, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 60); + } + } +} diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index b7ecb3b638..21992d5937 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -1,118 +1,118 @@ -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.Boss -{ - public class HolyFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Fire"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.tileCollide = false; - cooldownSlot = 1; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.alpha -= 5; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } - - 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 randomShot = Main.rand.Next(2); - if (randomShot == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0.01f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0.01f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - else - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0.05f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0.05f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - 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, 244, 0f, 0f, 100, default(Color), 2f); - 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +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.Boss +{ + public class HolyFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Fire"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.aiStyle = 1; + projectile.tileCollide = false; + cooldownSlot = 1; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.alpha -= 5; + if (projectile.alpha <= 0) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + 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 randomShot = Main.rand.Next(2); + if (randomShot == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0.01f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0.01f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + else + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0.05f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0.05f, 0f, mod.ProjectileType("HolyFire2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + 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, 244, 0f, 0f, 100, default(Color), 2f); + 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 0cfb35186e..642f4b4b65 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -1,106 +1,106 @@ -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.Boss -{ - public class HolyFire2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Fire"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (Math.Abs(projectile.velocity.X) < 7f) - { - projectile.velocity.X *= 1.05f; - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 180f && projectile.ai[1] > 60f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } - - 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(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - 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, 244, 0f, 0f, 100, default(Color), 2f); - 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +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.Boss +{ + public class HolyFire2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Fire"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (Math.Abs(projectile.velocity.X) < 7f) + { + projectile.velocity.X *= 1.05f; + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 180f && projectile.ai[1] > 60f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + 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(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + 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, 244, 0f, 0f, 100, default(Color), 2f); + 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index ac9d91e5e6..fef3420bb1 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -1,118 +1,118 @@ -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.Boss -{ - public class HolyFlare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Flare"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity.Y = projectile.velocity.Y + 0.02f; - if (projectile.velocity.Y > 1f) - { - projectile.velocity.Y = 1f; - } - if (projectile.position.X + (float)projectile.width < player.position.X) - { - if (projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.98f; - } - projectile.velocity.X = projectile.velocity.X + 0.025f; - } - else if (projectile.position.X > player.position.X + (float)player.width) - { - if (projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.98f; - } - projectile.velocity.X = projectile.velocity.X - 0.025f; - } - if (projectile.velocity.X > 5f || projectile.velocity.X < -5f) - { - projectile.velocity.X = projectile.velocity.X * 0.97f; - } - projectile.rotation = projectile.velocity.X * 0.05f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } - - 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(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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, 244, 0f, 0f, 100, default(Color), 2f); - 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +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.Boss +{ + public class HolyFlare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Flare"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity.Y = projectile.velocity.Y + 0.02f; + if (projectile.velocity.Y > 1f) + { + projectile.velocity.Y = 1f; + } + if (projectile.position.X + (float)projectile.width < player.position.X) + { + if (projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.98f; + } + projectile.velocity.X = projectile.velocity.X + 0.025f; + } + else if (projectile.position.X > player.position.X + (float)player.width) + { + if (projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.98f; + } + projectile.velocity.X = projectile.velocity.X - 0.025f; + } + if (projectile.velocity.X > 5f || projectile.velocity.X < -5f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + projectile.rotation = projectile.velocity.X * 0.05f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + 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(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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, 244, 0f, 0f, 100, default(Color), 2f); + 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index be8cb73582..3e442061ec 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -1,98 +1,98 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class HolyLight : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Light"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - bool expertMode = Main.expertMode; - projectile.alpha -= 2; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - int num487 = (int)Player.FindClosest(projectile.position, projectile.width, projectile.height); - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - int num492 = expertMode ? 50 : 35; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - projectile.Kill(); - } - } - - public override void Kill(int timeLeft) - { - 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 = 50; - projectile.height = 50; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 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, 246, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HolyLight : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Light"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + projectile.alpha -= 2; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + int num487 = (int)Player.FindClosest(projectile.position, projectile.width, projectile.height); + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + int num492 = expertMode ? 50 : 35; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + projectile.Kill(); + } + } + + public override void Kill(int timeLeft) + { + 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 = 50; + projectile.height = 50; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 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, 246, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Boss/HolyShot.cs b/Projectiles/Boss/HolyShot.cs index 926c1c8806..19cff34696 100644 --- a/Projectiles/Boss/HolyShot.cs +++ b/Projectiles/Boss/HolyShot.cs @@ -1,81 +1,81 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class HolyShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Spear"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 900; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.velocity.X *= 1.03f; - projectile.velocity.Y *= 1.03f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft > 883) - { - projectile.localAI[1] += 5f; - byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - 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 OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HolyShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Spear"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 900; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.velocity.X *= 1.03f; + projectile.velocity.Y *= 1.03f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft > 883) + { + projectile.localAI[1] += 5f; + byte b2 = (byte)(((int)projectile.localAI[1]) * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + 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 OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 25235e3668..ed505ffb84 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -1,110 +1,110 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class HolySpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Spear"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 900; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - if (projectile.timeLeft > 815) - { - if (projectile.ai[0] == 0f) - { - projectile.velocity.X = 1f; - } - else - { - projectile.velocity.X = -1f; - } - } - else - { - if (projectile.ai[0] == 0f) - { - projectile.velocity.X = 15f; - } - else - { - projectile.velocity.X = -15f; - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - if (projectile.localAI[0] == 0f && projectile.timeLeft < 815) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - } - - public override bool CanDamage() - { - if (projectile.timeLeft > 815 || projectile.timeLeft < 85) - { - return false; - } - return true; - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft > 815) - { - projectile.localAI[1] += 1f; - byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - 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 OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HolySpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Spear"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 900; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.timeLeft > 815) + { + if (projectile.ai[0] == 0f) + { + projectile.velocity.X = 1f; + } + else + { + projectile.velocity.X = -1f; + } + } + else + { + if (projectile.ai[0] == 0f) + { + projectile.velocity.X = 15f; + } + else + { + projectile.velocity.X = -15f; + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + if (projectile.localAI[0] == 0f && projectile.timeLeft < 815) + { + projectile.localAI[0] = 1f; + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); + } + } + + public override bool CanDamage() + { + if (projectile.timeLeft > 815 || projectile.timeLeft < 85) + { + return false; + } + return true; + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft > 815) + { + projectile.localAI[1] += 1f; + byte b2 = (byte)(((int)projectile.localAI[1]) * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + 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 OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index 9cb8e0cc78..92ee5d7667 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -1,84 +1,84 @@ -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.Boss -{ - public class IceBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.penetrate = -1; - projectile.hostile = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - int num3; - for (int num322 = 0; num322 < 2; num322 = num3 + 1) - { - int num323 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, projectile.velocity.X, projectile.velocity.Y, 50, default(Color), 0.6f); - Main.dust[num323].noGravity = true; - Dust dust = Main.dust[num323]; - dust.velocity *= 0.3f; - num3 = num322; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item28, projectile.position); - } - } - - public override void Kill(int timeLeft) - { - int num497 = 10; - Main.PlaySound(SoundID.Item27, projectile.position); - int num3; - for (int num498 = 0; num498 < num497; num498 = num3 + 1) - { - int num499 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, 0f, 0f, 0, default(Color), 1f); - if (Main.rand.Next(3) != 0) - { - Dust dust = Main.dust[num499]; - dust.velocity *= 2f; - Main.dust[num499].noGravity = true; - dust = Main.dust[num499]; - dust.scale *= 1.75f; - } - else - { - Dust dust = Main.dust[num499]; - dust.scale *= 0.5f; - } - num3 = num498; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 90, true); - target.AddBuff(BuffID.Chilled, 60, true); - target.AddBuff(BuffID.Frozen, 30, 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 +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.Boss +{ + public class IceBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.penetrate = -1; + projectile.hostile = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + int num3; + for (int num322 = 0; num322 < 2; num322 = num3 + 1) + { + int num323 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, projectile.velocity.X, projectile.velocity.Y, 50, default(Color), 0.6f); + Main.dust[num323].noGravity = true; + Dust dust = Main.dust[num323]; + dust.velocity *= 0.3f; + num3 = num322; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item28, projectile.position); + } + } + + public override void Kill(int timeLeft) + { + int num497 = 10; + Main.PlaySound(SoundID.Item27, projectile.position); + int num3; + for (int num498 = 0; num498 < num497; num498 = num3 + 1) + { + int num499 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, 0f, 0f, 0, default(Color), 1f); + if (Main.rand.Next(3) != 0) + { + Dust dust = Main.dust[num499]; + dust.velocity *= 2f; + Main.dust[num499].noGravity = true; + dust = Main.dust[num499]; + dust.scale *= 1.75f; + } + else + { + Dust dust = Main.dust[num499]; + dust.scale *= 0.5f; + } + num3 = num498; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 90, true); + target.AddBuff(BuffID.Chilled, 60, true); + target.AddBuff(BuffID.Frozen, 30, 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; + } + } +} diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index c730ab62d1..3aa74639ef 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class IceBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 50; - projectile.penetrate = 1; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - float spread = 60f * 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) - { - for (i = 0; i < 3; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("IceRain"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("IceRain"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - for (int k = 0; k < 3; 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 OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120, true); - target.AddBuff(BuffID.Chilled, 90, true); - target.AddBuff(mod.BuffType("GlacialState"), 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class IceBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 50; + projectile.penetrate = 1; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + float spread = 60f * 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) + { + for (i = 0; i < 3; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("IceRain"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("IceRain"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + for (int k = 0; k < 3; 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 OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120, true); + target.AddBuff(BuffID.Chilled, 90, true); + target.AddBuff(mod.BuffType("GlacialState"), 60); + } + } +} diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index 1d8a95156f..44d8db103e 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -1,87 +1,87 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class IceRain : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Rain"); - } - - public override void SetDefaults() - { - projectile.aiStyle = 1; - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.penetrate = -1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - if (projectile.localAI[0] == 0f || projectile.localAI[0] == 2f) - { - projectile.scale += 0.01f; - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.localAI[0] = 1f; - projectile.alpha = 0; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.01f; - projectile.alpha += 50; - if (projectile.alpha >= 255) - { - projectile.localAI[0] = 2f; - projectile.alpha = 255; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item27, projectile.position); - int num3; - for (int num373 = 0; num373 < 3; num373 = num3 + 1) - { - int num374 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 76, 0f, 0f, 0, default(Color), 1f); - Main.dust[num374].noGravity = true; - Main.dust[num374].noLight = true; - Main.dust[num374].scale = 0.7f; - num3 = num373; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 60, true); - target.AddBuff(BuffID.Chilled, 30, true); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class IceRain : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Rain"); + } + + public override void SetDefaults() + { + projectile.aiStyle = 1; + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.penetrate = -1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + if (projectile.localAI[0] == 0f || projectile.localAI[0] == 2f) + { + projectile.scale += 0.01f; + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.localAI[0] = 1f; + projectile.alpha = 0; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.01f; + projectile.alpha += 50; + if (projectile.alpha >= 255) + { + projectile.localAI[0] = 2f; + projectile.alpha = 255; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + int num3; + for (int num373 = 0; num373 < 3; num373 = num3 + 1) + { + int num374 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 76, 0f, 0f, 0, default(Color), 1f); + Main.dust[num374].noGravity = true; + Main.dust[num374].noLight = true; + Main.dust[num374].scale = 0.7f; + num3 = num373; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 60, true); + target.AddBuff(BuffID.Chilled, 30, true); + } + } +} diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index 73c5dbbe29..f841c2f5f1 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -1,52 +1,52 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class IchorShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ichor Shot"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.timeLeft = 420; - projectile.penetrate = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - projectile.velocity.Y = projectile.velocity.Y + 0.06f; - projectile.velocity.X *= 0.995f; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Ichor, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class IchorShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ichor Shot"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.timeLeft = 420; + projectile.penetrate = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + projectile.velocity.Y = projectile.velocity.Y + 0.06f; + projectile.velocity.X *= 0.995f; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Ichor, 180); + } + } +} diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index e75c9aa727..f1455d368a 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -1,156 +1,156 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class Infernado : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 88; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - int num613 = 30; - int num614 = 30; - float num615 = 3f; //2.5 - int num616 = 320; - int num617 = 88; - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - if (projectile.ai[1] % 2 == 0) - { - projectile.damage = 0; - projectile.timeLeft /= 10; - } - else - { - projectile.damage = Main.expertMode ? 130 : 150; - } - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - } - } - - public override bool CanDamage() - { - if (projectile.timeLeft > 480) - { - return false; - } - return true; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 53, projectile.alpha); - } - - 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 +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class Infernado : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernado"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 88; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + int num613 = 30; + int num614 = 30; + float num615 = 3f; //2.5 + int num616 = 320; + int num617 = 88; + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + if (projectile.ai[1] % 2 == 0) + { + projectile.damage = 0; + projectile.timeLeft /= 10; + } + else + { + projectile.damage = Main.expertMode ? 130 : 150; + } + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 11f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + num623 *= 2f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + } + } + + public override bool CanDamage() + { + if (projectile.timeLeft > 480) + { + return false; + } + return true; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 53, projectile.alpha); + } + + 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; + } + } +} diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index 0b7c82c23f..bbbf0a1948 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -145,4 +145,4 @@ namespace CalamityMod.Projectiles.Boss return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs index 7b410d5ba7..c9271c583f 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -1,152 +1,152 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Projectiles.Boss -{ - public class InfernadoRevenge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 88; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 360000; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - projectile.active = false; - projectile.netUpdate = true; - return; - } - int num613 = 35; - int num614 = 35; - float num615 = 3.5f; - int num616 = 320; - int num617 = 88; - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - return; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - } - - 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 OnHitPlayer(Player target, int damage, bool crit) - { - target.KillMe(PlayerDeathReason.ByOther(11), 1000.0, 0, false); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Projectiles.Boss +{ + public class InfernadoRevenge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernado"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 88; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 360000; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + int num613 = 35; + int num614 = 35; + float num615 = 3.5f; + int num616 = 320; + int num617 = 88; + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + num623 *= 2f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + return; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + } + + 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 OnHitPlayer(Player target, int damage, bool crit) + { + target.KillMe(PlayerDeathReason.ByOther(11), 1000.0, 0, false); + } + } +} diff --git a/Projectiles/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs index 46be97bdc5..b8ea79c36e 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -1,100 +1,100 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class LeviathanBomb : ModProjectile - { - private bool visible = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Meteor Vomit"); - } - - public override void SetDefaults() - { - projectile.width = 170; - projectile.height = 170; - projectile.scale = 0.75f; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 120; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(visible); - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - visible = reader.ReadBoolean(); - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.velocity.X *= 1.005f; - projectile.velocity.Y *= 1.005f; - projectile.rotation += 0.1f; - if (visible && projectile.alpha > 0) - projectile.alpha -= 15; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 12f) - { - visible = 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; - } - - public override void Kill(int timeLeft) - { - 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 = 150; - projectile.height = 150; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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, 244, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class LeviathanBomb : ModProjectile + { + private bool visible = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Meteor Vomit"); + } + + public override void SetDefaults() + { + projectile.width = 170; + projectile.height = 170; + projectile.scale = 0.75f; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 120; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(visible); + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + visible = reader.ReadBoolean(); + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.velocity.X *= 1.005f; + projectile.velocity.Y *= 1.005f; + projectile.rotation += 0.1f; + if (visible && projectile.alpha > 0) + projectile.alpha -= 15; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 12f) + { + visible = 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; + } + + public override void Kill(int timeLeft) + { + 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 = 150; + projectile.height = 150; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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, 244, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index e8df6d5637..f0f9966518 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -1,143 +1,143 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class MoltenBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Molten Blast"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 90; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.wet || projectile.lavaWet) - { - projectile.Kill(); - } - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) - { - 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, 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.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } - - 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 num251 = Main.rand.Next(5, 10); - if (projectile.owner == Main.myPlayer) - { - 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, 121) * 0.1f; //70 101 - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("MoltenBlob"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int num193 = 0; num193 < 3; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default(Color), 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 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, 244, 0f, 0f, 50, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 180); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class MoltenBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Molten Blast"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 90; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.wet || projectile.lavaWet) + { + projectile.Kill(); + } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 30f) + { + 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, 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.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + 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 num251 = Main.rand.Next(5, 10); + if (projectile.owner == Main.myPlayer) + { + 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, 121) * 0.1f; //70 101 + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("MoltenBlob"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int num193 = 0; num193 < 3; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 50, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 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, 244, 0f, 0f, 50, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 180); + } + } +} diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 9b4fc0a8bb..63de670f56 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -1,107 +1,107 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class MoltenBlob : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Molten Blob"); - Main.projFrames[projectile.type] = 2; - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - projectile.scale = 1.5f; - cooldownSlot = 0; - } - - public override void AI() - { - projectile.velocity.X *= 0.95f; - if (projectile.wet || projectile.lavaWet) - { - projectile.velocity.Y = 0f; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + 0.1f; - if (projectile.velocity.Y > 5f) - { - projectile.velocity.Y = 5f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - 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 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); - 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 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 90); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class MoltenBlob : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Molten Blob"); + Main.projFrames[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.timeLeft = 1200; + projectile.scale = 1.5f; + cooldownSlot = 0; + } + + public override void AI() + { + projectile.velocity.X *= 0.95f; + if (projectile.wet || projectile.lavaWet) + { + projectile.velocity.Y = 0f; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + 0.1f; + if (projectile.velocity.Y > 5f) + { + projectile.velocity.Y = 5f; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 10; + projectile.height = 10; + 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 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); + 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 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 90); + } + } +} diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 27820a83cb..3896866024 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -1,78 +1,78 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class MushBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mushroom Shot"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 480; - projectile.aiStyle = 1; - aiType = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.timeLeft < 90) - { - projectile.tileCollide = true; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f); - projectile.velocity.X *= 0.99f; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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 < 7; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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, 56, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class MushBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mushroom Shot"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 480; + projectile.aiStyle = 1; + aiType = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.timeLeft < 90) + { + projectile.tileCollide = true; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f); + projectile.velocity.X *= 0.99f; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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 < 7; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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, 56, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 9938b1b4ca..fdeece2d1d 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class MushBombFall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Falling Mushroom"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 480; - projectile.aiStyle = 1; - aiType = 1; - } - - public override void AI() - { - projectile.velocity.Y = 5f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.timeLeft < 90) - { - projectile.tileCollide = true; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f); - projectile.velocity.X *= 0.99f; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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 < 7; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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, 56, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class MushBombFall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Falling Mushroom"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 480; + projectile.aiStyle = 1; + aiType = 1; + } + + public override void AI() + { + projectile.velocity.Y = 5f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.timeLeft < 90) + { + projectile.tileCollide = true; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f); + projectile.velocity.X *= 0.99f; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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 < 7; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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, 56, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Boss/Mushmash.cs b/Projectiles/Boss/Mushmash.cs index 68b219dff7..7278d44053 100644 --- a/Projectiles/Boss/Mushmash.cs +++ b/Projectiles/Boss/Mushmash.cs @@ -1,27 +1,27 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Achievements; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class Mushmash : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mushmash"); - } - - public override void SetDefaults() - { - projectile.width = 200; - projectile.height = 200; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 10; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.GameContent.Achievements; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class Mushmash : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mushmash"); + } + + public override void SetDefaults() + { + projectile.width = 200; + projectile.height = 200; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 10; + } + } +} diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index 14c0d7ae99..5815b199d5 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -1,134 +1,134 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class PhantomBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Blast"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] >= 30f) - { - projectile.ai[0] = 30f; - projectile.velocity.Y = projectile.velocity.Y + 0.035f; - } - float scaleFactor3 = 22f; - int num189 = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector20 = Main.player[num189].Center - projectile.Center; - vector20.Normalize(); - vector20 *= scaleFactor3; - int num190 = 80; - projectile.velocity = (projectile.velocity * (float)(num190 - 1) + vector20) / (float)num190; - if (projectile.velocity.Length() < 14f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 14f; - } - if (projectile.timeLeft > 180) - { - projectile.timeLeft = 180; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 24f) - { - projectile.localAI[1] = 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, 180, 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) - { - return new Color(100, 250, 250, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - 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 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1.7f); - 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, 180, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class PhantomBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Blast"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.tileCollide = false; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] >= 30f) + { + projectile.ai[0] = 30f; + projectile.velocity.Y = projectile.velocity.Y + 0.035f; + } + float scaleFactor3 = 22f; + int num189 = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector20 = Main.player[num189].Center - projectile.Center; + vector20.Normalize(); + vector20 *= scaleFactor3; + int num190 = 80; + projectile.velocity = (projectile.velocity * (float)(num190 - 1) + vector20) / (float)num190; + if (projectile.velocity.Length() < 14f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 14f; + } + if (projectile.timeLeft > 180) + { + projectile.timeLeft = 180; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 24f) + { + projectile.localAI[1] = 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, 180, 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) + { + return new Color(100, 250, 250, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + 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 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1.7f); + 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, 180, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index e5180bcfc0..0a5df89656 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -1,134 +1,134 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class PhantomBlast2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Potent Phantom Blast"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] >= 30f) - { - projectile.ai[0] = 30f; - projectile.velocity.Y = projectile.velocity.Y + 0.035f; - } - float scaleFactor3 = 25f; - int num189 = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector20 = Main.player[num189].Center - projectile.Center; - vector20.Normalize(); - vector20 *= scaleFactor3; - int num190 = 90; - projectile.velocity = (projectile.velocity * (float)(num190 - 1) + vector20) / (float)num190; - if (projectile.velocity.Length() < 14f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 14f; - } - if (projectile.timeLeft > 180) - { - projectile.timeLeft = 180; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 24f) - { - projectile.localAI[1] = 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, 60, 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) - { - return new Color(250, 100, 100, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - 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 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.7f); - 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, 60, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class PhantomBlast2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Potent Phantom Blast"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.tileCollide = false; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] >= 30f) + { + projectile.ai[0] = 30f; + projectile.velocity.Y = projectile.velocity.Y + 0.035f; + } + float scaleFactor3 = 25f; + int num189 = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector20 = Main.player[num189].Center - projectile.Center; + vector20.Normalize(); + vector20 *= scaleFactor3; + int num190 = 90; + projectile.velocity = (projectile.velocity * (float)(num190 - 1) + vector20) / (float)num190; + if (projectile.velocity.Length() < 14f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 14f; + } + if (projectile.timeLeft > 180) + { + projectile.timeLeft = 180; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 24f) + { + projectile.localAI[1] = 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, 60, 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) + { + return new Color(250, 100, 100, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + 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 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.7f); + 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, 60, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Boss/PhantomGhostShot.cs b/Projectiles/Boss/PhantomGhostShot.cs index 56966a30a3..475f710012 100644 --- a/Projectiles/Boss/PhantomGhostShot.cs +++ b/Projectiles/Boss/PhantomGhostShot.cs @@ -1,78 +1,78 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class PhantomGhostShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Potent Phantom Spirit Shot"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.extraUpdates = 2; - projectile.penetrate = -1; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 6f) - { - for (int num151 = 0; num151 < 40; num151++) - { - int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1f); - Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += projectile.velocity * 0.75f; - Main.dust[num152].scale *= 1.2f; - Main.dust[num152].noGravity = true; - } - } - if (projectile.localAI[0] > 9f) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 250, 250, projectile.alpha); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class PhantomGhostShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Potent Phantom Spirit Shot"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.extraUpdates = 2; + projectile.penetrate = -1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 6f) + { + for (int num151 = 0; num151 < 40; num151++) + { + int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1f); + Main.dust[num152].velocity *= 3f; + Main.dust[num152].velocity += projectile.velocity * 0.75f; + Main.dust[num152].scale *= 1.2f; + Main.dust[num152].noGravity = true; + } + } + if (projectile.localAI[0] > 9f) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 250, 250, projectile.alpha); + } + } +} diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index c753a161e2..d17615d1d7 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -1,78 +1,78 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class PhantomHookShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Hook Shot"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.extraUpdates = 2; - projectile.penetrate = -1; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item20, projectile.position); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 6f) - { - for (int num151 = 0; num151 < 40; num151++) - { - int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1f); - Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += projectile.velocity * 0.75f; - Main.dust[num152].scale *= 1.2f; - Main.dust[num152].noGravity = true; - } - } - if (projectile.localAI[0] > 9f) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 250, 250, projectile.alpha); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class PhantomHookShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Hook Shot"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.extraUpdates = 2; + projectile.penetrate = -1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item20, projectile.position); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 6f) + { + for (int num151 = 0; num151 < 40; num151++) + { + int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1f); + Main.dust[num152].velocity *= 3f; + Main.dust[num152].velocity += projectile.velocity * 0.75f; + Main.dust[num152].scale *= 1.2f; + Main.dust[num152].noGravity = true; + } + } + if (projectile.localAI[0] > 9f) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 250, 250, projectile.alpha); + } + } +} diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index bc1716557b..240ba8f896 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class PhantomMine : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Orb"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 480; - cooldownSlot = 1; - } - - public override void AI() - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 12f) - { - projectile.velocity *= 1.05f; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - 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 = 150; - projectile.height = 150; - 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 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1.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, 180, 0f, 0f, 100, default(Color), 1.7f); - 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, 60, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class PhantomMine : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Orb"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 480; + cooldownSlot = 1; + } + + public override void AI() + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 12f) + { + projectile.velocity *= 1.05f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + 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 = 150; + projectile.height = 150; + 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 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1.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, 180, 0f, 0f, 100, default(Color), 1.7f); + 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, 60, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index 87a7fa35dc..642ac0cbc1 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -1,102 +1,102 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class PhantomShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom Shot"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 4; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - projectile.localAI[1] -= 180f; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - 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) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 250, 250, projectile.alpha); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class PhantomShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Shot"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = 4; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + projectile.localAI[1] -= 180f; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + 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) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 250, 250, projectile.alpha); + } + } +} diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index f5a669b029..e0c9b6a05f 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -1,102 +1,102 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class PhantomShot2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Potent Phantom Shot"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 5; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - projectile.localAI[1] -= 120f; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - 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) - { - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 100, 100, projectile.alpha); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class PhantomShot2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Potent Phantom Shot"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = 5; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + projectile.localAI[1] -= 120f; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + 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) + { + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 100, 100, projectile.alpha); + } + } +} diff --git a/Projectiles/Boss/PhoenixFire.cs b/Projectiles/Boss/PhoenixFire.cs index e80b43da3d..f2dec8a2de 100644 --- a/Projectiles/Boss/PhoenixFire.cs +++ b/Projectiles/Boss/PhoenixFire.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class PhoenixFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phoenix Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 360; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.velocity.X *= 1.005f; - projectile.velocity.Y *= 1.005f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 0.7f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class PhoenixFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phoenix Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 360; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.velocity.X *= 1.005f; + projectile.velocity.Y *= 1.005f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 0.7f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + } +} diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index 85b3dbc0fb..0d93a652fd 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -1,94 +1,94 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class PlagueExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Stinger Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default(Color), 0.5f); - 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++; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class PlagueExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Stinger Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 60; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default(Color), 0.5f); + 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++; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 240); + } + } +} diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index 7d847556d1..f09d31292a 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -1,57 +1,57 @@ -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.Boss -{ - public class PlagueStingerGoliath : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Homing Stinger"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 1; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.timeLeft = 300; - aiType = 270; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 180); - } - - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow").Width, (float)(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); - Main.spriteBatch.Draw(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow"), vector, - null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); - } - } -} \ No newline at end of file +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.Boss +{ + public class PlagueStingerGoliath : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Homing Stinger"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 1; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.tileCollide = true; + projectile.timeLeft = 300; + aiType = 270; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 180); + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow").Width, (float)(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Main.spriteBatch.Draw(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathGlow"), vector, + null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); + } + } +} diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index 239f975b28..96e3b6e7b8 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -1,67 +1,67 @@ -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.Boss -{ - public class PlagueStingerGoliathV2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Exploding Plague Stinger"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 0; - aiType = 55; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.tileCollide = true; - projectile.timeLeft = 1200; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 180); - } - - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, (float)(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); - Main.spriteBatch.Draw(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow"), vector, - null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +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.Boss +{ + public class PlagueStingerGoliathV2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exploding Plague Stinger"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 0; + aiType = 55; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.extraUpdates = 2; + projectile.tileCollide = true; + projectile.timeLeft = 1200; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 180); + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, (float)(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Main.spriteBatch.Draw(mod.GetTexture("Projectiles/Boss/PlagueStingerGoliathV2Glow"), vector, + null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index a572f5889b..b93685a82f 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -1,87 +1,87 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class ProfanedSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Spear"); - } - - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 38; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.alpha -= 3; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 20f) - { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - } - else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) - { - projectile.velocity.X *= 1.1f; - projectile.velocity.Y *= 1.1f; - } - else if (projectile.ai[1] == 40f) - { - projectile.ai[1] = 0f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) - { - 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, 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 Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ProfanedSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Spear"); + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 38; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.alpha -= 3; + projectile.ai[1] += 1f; + if (projectile.ai[1] <= 20f) + { + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.95f; + } + else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) + { + projectile.velocity.X *= 1.1f; + projectile.velocity.Y *= 1.1f; + } + else if (projectile.ai[1] == 40f) + { + projectile.ai[1] = 0f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 30f) + { + 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, 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 Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index f222e7341f..60bbc64cda 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -1,138 +1,138 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class ProvidenceCrystal : ModProjectile - { - private float speedX = -15f; - private float speedY = -3f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Crystal"); - } - - public override void SetDefaults() - { - projectile.width = 160; - projectile.height = 160; - projectile.ignoreWater = true; - projectile.timeLeft = CalamityWorld.death ? 2100 : 3600; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.penetrate = -1; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(speedX); - writer.Write(speedY); - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - speedX = reader.ReadSingle(); - speedY = reader.ReadSingle(); - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - if (player.dead || NPC.CountNPCS(mod.NPCType("Providence")) < 1) - { - projectile.active = false; - projectile.netUpdate = true; - return; - } - 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) + Main.player[projectile.owner].gfxOffY - 360f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 400f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - projectile.velocity = Vector2.Zero; - projectile.alpha -= 5; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.direction == 0) - { - projectile.direction = Main.player[projectile.owner].direction; - } - if (projectile.alpha == 0 && Main.rand.Next(15) == 0) - { - Dust dust34 = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(255, 200, Main.DiscoB), 1f)]; - dust34.velocity.X = 0f; - dust34.noGravity = true; - dust34.fadeIn = 1f; - dust34.position = projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); - dust34.scale = 0.5f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 300f) - { - projectile.localAI[0] = 0f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 109); - projectile.netUpdate = true; - if (projectile.owner == Main.myPlayer) - { - int num31; - for (int num1083 = 0; num1083 < 10; num1083 = num31 + 1) - { - float x4 = Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, mod.ProjectileType("ProvidenceCrystalShard"), projectile.damage, projectile.knockBack, projectile.owner, x4, (float)projectile.whoAmI); - num31 = num1083; - speedX += 3f; - } - } - speedX = -15f; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin11 = rectangle17.Size() / 2f; - float scaleFactor5 = (float)Math.Cos((double)(6.28318548f * (projectile.localAI[0] / 60f))) + 3f + 3f; - for (float num286 = 0f; num286 < 4f; num286 += 1f) - { - SpriteBatch arg_F907_0 = Main.spriteBatch; - Texture2D arg_F907_1 = texture2D34; - Vector2 arg_F8CE_0 = vector59; - Vector2 arg_F8BE_0 = Vector2.UnitY; - double arg_F8BE_1 = (double)(num286 * 1.57079637f); - Vector2 center = default(Vector2); - arg_F907_0.Draw(arg_F907_1, arg_F8CE_0 + arg_F8BE_0.RotatedBy(arg_F8BE_1, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, projectile.rotation, origin11, projectile.scale, SpriteEffects.None, 0f); - } - return false; - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class ProvidenceCrystal : ModProjectile + { + private float speedX = -15f; + private float speedY = -3f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Crystal"); + } + + public override void SetDefaults() + { + projectile.width = 160; + projectile.height = 160; + projectile.ignoreWater = true; + projectile.timeLeft = CalamityWorld.death ? 2100 : 3600; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.penetrate = -1; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(speedX); + writer.Write(speedY); + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + speedX = reader.ReadSingle(); + speedY = reader.ReadSingle(); + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (player.dead || NPC.CountNPCS(mod.NPCType("Providence")) < 1) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } + 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) + Main.player[projectile.owner].gfxOffY - 360f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 400f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + projectile.velocity = Vector2.Zero; + projectile.alpha -= 5; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.direction == 0) + { + projectile.direction = Main.player[projectile.owner].direction; + } + if (projectile.alpha == 0 && Main.rand.Next(15) == 0) + { + Dust dust34 = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(255, 200, Main.DiscoB), 1f)]; + dust34.velocity.X = 0f; + dust34.noGravity = true; + dust34.fadeIn = 1f; + dust34.position = projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); + dust34.scale = 0.5f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 300f) + { + projectile.localAI[0] = 0f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 109); + projectile.netUpdate = true; + if (projectile.owner == Main.myPlayer) + { + int num31; + for (int num1083 = 0; num1083 < 10; num1083 = num31 + 1) + { + float x4 = Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, mod.ProjectileType("ProvidenceCrystalShard"), projectile.damage, projectile.knockBack, projectile.owner, x4, (float)projectile.whoAmI); + num31 = num1083; + speedX += 3f; + } + } + speedX = -15f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D34 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin11 = rectangle17.Size() / 2f; + float scaleFactor5 = (float)Math.Cos((double)(6.28318548f * (projectile.localAI[0] / 60f))) + 3f + 3f; + for (float num286 = 0f; num286 < 4f; num286 += 1f) + { + SpriteBatch arg_F907_0 = Main.spriteBatch; + Texture2D arg_F907_1 = texture2D34; + Vector2 arg_F8CE_0 = vector59; + Vector2 arg_F8BE_0 = Vector2.UnitY; + double arg_F8BE_1 = (double)(num286 * 1.57079637f); + Vector2 center = default(Vector2); + arg_F907_0.Draw(arg_F907_1, arg_F8CE_0 + arg_F8BE_0.RotatedBy(arg_F8BE_1, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, projectile.rotation, origin11, projectile.scale, SpriteEffects.None, 0f); + } + return false; + } + } +} diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 9329834a97..a350c5d340 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -1,200 +1,200 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class ProvidenceCrystalShard : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Crystal Shard"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - if (projectile.timeLeft < 480) - { - projectile.tileCollide = true; - } - Color newColor2 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor2.ToVector3() * 0.5f); - } - projectile.velocity.X *= 0.995f; - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y *= 0.98f; - } - else - { - projectile.velocity.Y *= 1.06f; - if (projectile.velocity.Y > 3f) - { - projectile.velocity.Y = 3f; - } - } - if (projectile.velocity.Y > -0.5f && projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - projectile.velocity.Y = 0.5f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - int num3; - for (int num979 = 0; num979 < 2; num979 = num3 + 1) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); - Dust dust24 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust24.noGravity = true; - dust24.noLight = true; - dust24.scale = projectile.Opacity * projectile.localAI[0]; - dust24.position = projectile.Center; - dust24.velocity = value55 * 2.5f; - } - num3 = num979; - } - for (int num980 = 0; num980 < 2; num980 = num3 + 1) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default(Vector2)); - Dust dust25 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust25.noGravity = true; - dust25.noLight = true; - dust25.scale = projectile.Opacity * projectile.localAI[0]; - dust25.position = projectile.Center; - dust25.velocity = value56 * 2.5f; - } - num3 = num980; - } - if (Main.rand.Next(10) == 0) - { - float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; - float fadeIn = 1f + Main.rand.NextFloat(); - float num981 = 1f + Main.rand.NextFloat(); - Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector136 != Vector2.Zero) - { - vector136.Normalize(); - } - vector136 *= 20f + Main.rand.NextFloat() * 100f; - Vector2 vector137 = projectile.Center + vector136; - Point point3 = vector137.ToTileCoordinates(); - bool flag52 = true; - if (!WorldGen.InWorld(point3.X, point3.Y, 0)) - { - flag52 = false; - } - if (flag52 && WorldGen.SolidTile(point3.X, point3.Y)) - { - flag52 = false; - } - if (flag52) - { - Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; - dust26.noGravity = true; - dust26.position = vector137; - dust26.velocity = -Vector2.UnitY * scaleFactor13 * (Main.rand.NextFloat() * 0.9f + 1.6f); - dust26.fadeIn = fadeIn; - dust26.scale = num981; - dust26.noLight = true; - Dust dust27 = Dust.CloneDust(dust26); - Dust dust = dust27; - dust.scale *= 0.65f; - dust = dust27; - dust.fadeIn *= 0.65f; - dust27.color = new Color(255, 255, 255, 255); - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); - float num69 = (float)Main.rand.Next(7, 13); - Vector2 value5 = new Vector2(2.1f, 2f); - Color newColor = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); - newColor.A = 255; - float num72; - for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) - { - int num71 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num71].position = projectile.Center; - Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default(Vector2)) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Main.dust[num71].noGravity = true; - Main.dust[num71].scale = 2f; - Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust11 = Dust.CloneDust(num71); - Dust dust = dust11; - dust.scale /= 2f; - dust = dust11; - dust.fadeIn /= 2f; - dust11.color = new Color(255, 255, 255, 255); - num72 = num70; - } - for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) - { - int num74 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num74].position = projectile.Center; - Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default(Vector2)) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Dust dust = Main.dust[num74]; - dust.velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[num74].noGravity = true; - Main.dust[num74].scale = Main.rand.NextFloat() * 1f; - Main.dust[num74].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust12 = Dust.CloneDust(num74); - dust = dust12; - dust.scale /= 2f; - dust = dust12; - dust.fadeIn /= 2f; - dust12.color = new Color(255, 255, 255, 255); - num72 = num73; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ProvidenceCrystalShard : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Crystal Shard"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.timeLeft < 480) + { + projectile.tileCollide = true; + } + Color newColor2 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor2.ToVector3() * 0.5f); + } + projectile.velocity.X *= 0.995f; + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y *= 0.98f; + } + else + { + projectile.velocity.Y *= 1.06f; + if (projectile.velocity.Y > 3f) + { + projectile.velocity.Y = 3f; + } + } + if (projectile.velocity.Y > -0.5f && projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + projectile.velocity.Y = 0.5f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + int num3; + for (int num979 = 0; num979 < 2; num979 = num3 + 1) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); + Dust dust24 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + dust24.noGravity = true; + dust24.noLight = true; + dust24.scale = projectile.Opacity * projectile.localAI[0]; + dust24.position = projectile.Center; + dust24.velocity = value55 * 2.5f; + } + num3 = num979; + } + for (int num980 = 0; num980 < 2; num980 = num3 + 1) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default(Vector2)); + Dust dust25 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + dust25.noGravity = true; + dust25.noLight = true; + dust25.scale = projectile.Opacity * projectile.localAI[0]; + dust25.position = projectile.Center; + dust25.velocity = value56 * 2.5f; + } + num3 = num980; + } + if (Main.rand.Next(10) == 0) + { + float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; + float fadeIn = 1f + Main.rand.NextFloat(); + float num981 = 1f + Main.rand.NextFloat(); + Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f); + if (vector136 != Vector2.Zero) + { + vector136.Normalize(); + } + vector136 *= 20f + Main.rand.NextFloat() * 100f; + Vector2 vector137 = projectile.Center + vector136; + Point point3 = vector137.ToTileCoordinates(); + bool flag52 = true; + if (!WorldGen.InWorld(point3.X, point3.Y, 0)) + { + flag52 = false; + } + if (flag52 && WorldGen.SolidTile(point3.X, point3.Y)) + { + flag52 = false; + } + if (flag52) + { + Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; + dust26.noGravity = true; + dust26.position = vector137; + dust26.velocity = -Vector2.UnitY * scaleFactor13 * (Main.rand.NextFloat() * 0.9f + 1.6f); + dust26.fadeIn = fadeIn; + dust26.scale = num981; + dust26.noLight = true; + Dust dust27 = Dust.CloneDust(dust26); + Dust dust = dust27; + dust.scale *= 0.65f; + dust = dust27; + dust.fadeIn *= 0.65f; + dust27.color = new Color(255, 255, 255, 255); + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); + float num69 = (float)Main.rand.Next(7, 13); + Vector2 value5 = new Vector2(2.1f, 2f); + Color newColor = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); + newColor.A = 255; + float num72; + for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) + { + int num71 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num71].position = projectile.Center; + Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default(Vector2)) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[num71].noGravity = true; + Main.dust[num71].scale = 2f; + Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust11 = Dust.CloneDust(num71); + Dust dust = dust11; + dust.scale /= 2f; + dust = dust11; + dust.fadeIn /= 2f; + dust11.color = new Color(255, 255, 255, 255); + num72 = num70; + } + for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) + { + int num74 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num74].position = projectile.Center; + Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default(Vector2)) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Dust dust = Main.dust[num74]; + dust.velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[num74].noGravity = true; + Main.dust[num74].scale = Main.rand.NextFloat() * 1f; + Main.dust[num74].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust12 = Dust.CloneDust(num74); + dust = dust12; + dust.scale /= 2f; + dust = dust12; + dust.fadeIn /= 2f; + dust12.color = new Color(255, 255, 255, 255); + num72 = num73; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + } +} diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 9d2dfcf8d8..1f6858fe0a 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -1,194 +1,194 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Enums; -using Terraria.Graphics.Effects; - -namespace CalamityMod.Projectiles.Boss -{ - public class ProvidenceHolyRay : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Ray"); - } - - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 48; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - Vector2? vector78 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == mod.NPCType("Providence")) - { - Vector2 value21 = new Vector2(27f, 59f); - Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X, Main.npc[(int)projectile.ai[1]].Center.Y - 16f); - Vector2 value22 = Utils.Vector2FromElipse(Main.npc[(int)projectile.ai[1]].localAI[0].ToRotationVector2(), value21 * Main.npc[(int)projectile.ai[1]].localAI[1]); - projectile.position = fireFrom + value22 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - } - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - float num801 = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 180f) - { - projectile.Kill(); - return; - } - projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * 3.14159274f / 180f)) * 10f * num801; - if (projectile.scale > num801) - { - projectile.scale = num801; - } - float num804 = projectile.velocity.ToRotation(); - num804 += projectile.ai[0]; - projectile.rotation = num804 - 1.57079637f; - projectile.velocity = num804.ToRotationVector2(); - float num805 = 3f; //3f - float num806 = (float)projectile.width; - Vector2 samplingPoint = projectile.Center; - if (vector78.HasValue) - { - samplingPoint = vector78.Value; - } - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); - float num807 = 0f; //0f - int num3; - for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) - { - num807 += array3[num808]; - num3 = num808; - } - num807 /= num805; - float amount = 0.5f; //0.5f - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation - Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); - for (int num809 = 0; num809 < 2; num809 = num3 + 1) - { - float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; - float num811 = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); - int num812 = Dust.NewDust(vector79, 0, 0, 244, vector80.X, vector80.Y, 0, default(Color), 1f); - Main.dust[num812].noGravity = true; - Main.dust[num812].scale = 1.7f; - num3 = num809; - } - if (Main.rand.Next(5) == 0) - { - Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; - int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, default(Color), 1.5f); - Dust dust = Main.dust[num813]; - dust.velocity *= 0.5f; - Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); - } - DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.velocity == Vector2.Zero) - { - return false; - } - Texture2D texture2D19 = Main.projectileTexture[projectile.type]; - Texture2D texture2D20 = mod.GetTexture("ExtraTextures/Lasers/ProvidenceHolyRayMid"); - Texture2D texture2D21 = mod.GetTexture("ExtraTextures/Lasers/ProvidenceHolyRayEnd"); - float num223 = projectile.localAI[1]; //length of laser - Microsoft.Xna.Framework.Color color44 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.9f; - SpriteBatch arg_ABD8_0 = Main.spriteBatch; - Texture2D arg_ABD8_1 = texture2D19; - Vector2 arg_ABD8_2 = projectile.Center - Main.screenPosition; - Microsoft.Xna.Framework.Rectangle? sourceRectangle2 = null; - arg_ABD8_0.Draw(arg_ABD8_1, arg_ABD8_2, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; - Vector2 value20 = projectile.Center; - value20 += projectile.velocity * projectile.scale * (float)texture2D19.Height / 2f; - if (num223 > 0f) - { - float num224 = 0f; - Microsoft.Xna.Framework.Rectangle rectangle7 = new Microsoft.Xna.Framework.Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); - while (num224 + 1f < num223) - { - if (num223 - num224 < (float)rectangle7.Height) - { - rectangle7.Height = (int)(num223 - num224); - } - Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num224 += (float)rectangle7.Height * projectile.scale; - value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale; - rectangle7.Y += 16; - if (rectangle7.Y + rectangle7.Height > texture2D20.Height) - { - rectangle7.Y = 0; - } - } - } - SpriteBatch arg_AE2D_0 = Main.spriteBatch; - Texture2D arg_AE2D_1 = texture2D21; - Vector2 arg_AE2D_2 = value20 - Main.screenPosition; - sourceRectangle2 = null; - arg_AE2D_0.Draw(arg_AE2D_1, arg_AE2D_2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) - { - return true; - } - return false; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; +using Terraria.Graphics.Effects; + +namespace CalamityMod.Projectiles.Boss +{ + public class ProvidenceHolyRay : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Ray"); + } + + public override void SetDefaults() + { + projectile.width = 48; + projectile.height = 48; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + Vector2? vector78 = null; + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == mod.NPCType("Providence")) + { + Vector2 value21 = new Vector2(27f, 59f); + Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X, Main.npc[(int)projectile.ai[1]].Center.Y - 16f); + Vector2 value22 = Utils.Vector2FromElipse(Main.npc[(int)projectile.ai[1]].localAI[0].ToRotationVector2(), value21 * Main.npc[(int)projectile.ai[1]].localAI[1]); + projectile.position = fireFrom + value22 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + } + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + float num801 = 1f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 180f) + { + projectile.Kill(); + return; + } + projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * 3.14159274f / 180f)) * 10f * num801; + if (projectile.scale > num801) + { + projectile.scale = num801; + } + float num804 = projectile.velocity.ToRotation(); + num804 += projectile.ai[0]; + projectile.rotation = num804 - 1.57079637f; + projectile.velocity = num804.ToRotationVector2(); + float num805 = 3f; //3f + float num806 = (float)projectile.width; + Vector2 samplingPoint = projectile.Center; + if (vector78.HasValue) + { + samplingPoint = vector78.Value; + } + float[] array3 = new float[(int)num805]; + Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); + float num807 = 0f; //0f + int num3; + for (int num808 = 0; num808 < array3.Length; num808 = num3 + 1) + { + num807 += array3[num808]; + num3 = num808; + } + num807 /= num805; + float amount = 0.5f; //0.5f + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation + Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); + for (int num809 = 0; num809 < 2; num809 = num3 + 1) + { + float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; + float num811 = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); + int num812 = Dust.NewDust(vector79, 0, 0, 244, vector80.X, vector80.Y, 0, default(Color), 1f); + Main.dust[num812].noGravity = true; + Main.dust[num812].scale = 1.7f; + num3 = num809; + } + if (Main.rand.Next(5) == 0) + { + Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, default(Color), 1.5f); + Dust dust = Main.dust[num813]; + dust.velocity *= 0.5f; + Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); + } + DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D texture2D19 = Main.projectileTexture[projectile.type]; + Texture2D texture2D20 = mod.GetTexture("ExtraTextures/Lasers/ProvidenceHolyRayMid"); + Texture2D texture2D21 = mod.GetTexture("ExtraTextures/Lasers/ProvidenceHolyRayEnd"); + float num223 = projectile.localAI[1]; //length of laser + Microsoft.Xna.Framework.Color color44 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.9f; + SpriteBatch arg_ABD8_0 = Main.spriteBatch; + Texture2D arg_ABD8_1 = texture2D19; + Vector2 arg_ABD8_2 = projectile.Center - Main.screenPosition; + Microsoft.Xna.Framework.Rectangle? sourceRectangle2 = null; + arg_ABD8_0.Draw(arg_ABD8_1, arg_ABD8_2, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; + Vector2 value20 = projectile.Center; + value20 += projectile.velocity * projectile.scale * (float)texture2D19.Height / 2f; + if (num223 > 0f) + { + float num224 = 0f; + Microsoft.Xna.Framework.Rectangle rectangle7 = new Microsoft.Xna.Framework.Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); + while (num224 + 1f < num223) + { + if (num223 - num224 < (float)rectangle7.Height) + { + rectangle7.Height = (int)(num223 - num224); + } + Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num224 += (float)rectangle7.Height * projectile.scale; + value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale; + rectangle7.Y += 16; + if (rectangle7.Y + rectangle7.Height > texture2D20.Height) + { + rectangle7.Y = 0; + } + } + } + SpriteBatch arg_AE2D_0 = Main.spriteBatch; + Texture2D arg_AE2D_1 = texture2D21; + Vector2 arg_AE2D_2 = value20 - Main.screenPosition; + sourceRectangle2 = null; + arg_AE2D_0.Draw(arg_AE2D_1, arg_AE2D_2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num6 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + { + return true; + } + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } +} diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index b2dc5df21c..cc2fd9e6ab 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -1,51 +1,51 @@ -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.Boss -{ - public class RavagerFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blue Flame"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.aiStyle = 1; - } - - public override void AI() - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default(Color), 3f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 180); - } - } -} \ No newline at end of file +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.Boss +{ + public class RavagerFlame : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blue Flame"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.aiStyle = 1; + } + + public override void AI() + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default(Color), 3f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 180); + } + } +} diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index f196ea2dbb..75b908c50f 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -1,112 +1,112 @@ -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.Boss -{ - public class RedLightningFeather : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lightning Feather"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 1200; - cooldownSlot = 1; - } - - public override void AI() - { - 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.7f, 0f, 0f); - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 150f) - { - projectile.extraUpdates = 1; - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 180f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - } - } - } - - 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(2, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 6; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); - } - for (int num194 = 0; num194 < 10; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 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, 60, 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 +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.Boss +{ + public class RedLightningFeather : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lightning Feather"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 1200; + cooldownSlot = 1; + } + + public override void AI() + { + 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.7f, 0f, 0f); + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 150f) + { + projectile.extraUpdates = 1; + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 180f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + } + } + } + + 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(2, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 6; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 10; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 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, 60, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index 136a8e4780..e699ed8d75 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class SandBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.alpha -= 50; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 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, 14); - for (int dust = 0; dust <= 10; dust++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default(Color), 1.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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class SandBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 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; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.alpha -= 50; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 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, 14); + for (int dust = 0; dust <= 10; dust++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default(Color), 1.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; + } + } + } +} diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index 4d8b09bf0a..9eca3fbe6e 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class SandPoisonCloud : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Toxic Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.99f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= (CalamityWorld.death ? 2100f : 1500f)) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class SandPoisonCloud : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxic Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity *= 0.99f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= (CalamityWorld.death ? 2100f : 1500f)) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + } + } +} diff --git a/Projectiles/Boss/SandTooth.cs b/Projectiles/Boss/SandTooth.cs index 0452f51de1..5b8f7efc1a 100644 --- a/Projectiles/Boss/SandTooth.cs +++ b/Projectiles/Boss/SandTooth.cs @@ -1,59 +1,59 @@ -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.Boss -{ - public class SandTooth : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sand Tooth"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 450; - } - - public override void AI() - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 250f && projectile.ai[1] > 60f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) //18 - { - projectile.velocity *= 1.01f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - } - - 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 +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.Boss +{ + public class SandTooth : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Tooth"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 450; + } + + public override void AI() + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 250f && projectile.ai[1] > 60f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) //18 + { + projectile.velocity *= 1.01f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + } + + 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; + } + } +} diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index 1739b3d070..16a771c7df 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -1,200 +1,200 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class ScavengerLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Homing Dart"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 600; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - projectile.alpha -= 40; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[0] == 0f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 45f) - { - 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) - { - if (Main.player[(int)projectile.ai[1]].Center.Y < projectile.Center.Y) - { - projectile.tileCollide = true; - } - float speed = revenge ? 9f : 6f; - Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; - if (vector70.Length() < 30f) - { - 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.4f; - 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, 244, -projectile.velocity.X / 3f, -projectile.velocity.Y / 3f, 150, Color.Transparent, 0.6f); - Main.dust[num805].noGravity = true; - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 50, 50, projectile.alpha); - } - - 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 = 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, 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, 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, 244, 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 +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class ScavengerLaser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Homing Dart"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 600; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + projectile.alpha -= 40; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.ai[0] == 0f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 45f) + { + 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) + { + if (Main.player[(int)projectile.ai[1]].Center.Y < projectile.Center.Y) + { + projectile.tileCollide = true; + } + float speed = revenge ? 9f : 6f; + Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; + if (vector70.Length() < 30f) + { + 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.4f; + 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, 244, -projectile.velocity.X / 3f, -projectile.velocity.Y / 3f, 150, Color.Transparent, 0.6f); + Main.dust[num805].noGravity = true; + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire, 180); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 50, 50, projectile.alpha); + } + + 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 = 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, 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, 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, 244, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 48f6d7c7e6..de20aa1db0 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -1,172 +1,172 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class ScavengerNuke : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Homing Nuke"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 44; - projectile.height = 44; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 720; - } - - public override void AI() - { - bool revenge = CalamityWorld.revenge; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 480) - { - projectile.tileCollide = true; - } - projectile.frameCounter++; - if (projectile.frameCounter > 18) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - float num953 = revenge ? 75f : 60f; //100 - float scaleFactor12 = revenge ? 15f : 12f; //5 - float num954 = 40f; - if (projectile.alpha > 0) - { - projectile.alpha -= 10; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - return; - } - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FlareExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[boom].friendly = false; - Main.projectile[boom].hostile = true; - } - 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 = 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 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class ScavengerNuke : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Homing Nuke"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 44; + projectile.height = 44; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 720; + } + + public override void AI() + { + bool revenge = CalamityWorld.revenge; + projectile.ai[1] += 1f; + if (projectile.ai[1] > 480) + { + projectile.tileCollide = true; + } + projectile.frameCounter++; + if (projectile.frameCounter > 18) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + float num953 = revenge ? 75f : 60f; //100 + float scaleFactor12 = revenge ? 15f : 12f; //5 + float num954 = 40f; + if (projectile.alpha > 0) + { + projectile.alpha -= 10; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); + int num959 = (int)projectile.ai[0]; + if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + { + if (projectile.Distance(Main.player[num959].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + return; + } + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("FlareExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[boom].friendly = false; + Main.projectile[boom].hostile = true; + } + 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 = 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 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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; + } + } + } +} diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index b8d28223da..92b6082c3d 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class ShadeNimbusHostile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shade Nimbus"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 54; - projectile.height = 28; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 360; - projectile.penetrate = -1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 5) - { - projectile.frame = 0; - } - } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 300f) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - else - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 8f) - { - projectile.ai[0] = 0f; - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("ShaderainHostile"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ShadeNimbusHostile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shade Nimbus"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 54; + projectile.height = 28; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 360; + projectile.penetrate = -1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 5) + { + projectile.frame = 0; + } + } + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 300f) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + else + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 8f) + { + projectile.ai[0] = 0f; + int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); + int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("ShaderainHostile"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index 0e460d480e..d267483ab6 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -1,54 +1,54 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class ShaderainHostile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cursed Rain"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 40; - projectile.hostile = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.alpha = 50; - } - - public override void Kill(int timeLeft) - { - int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default(Color), 1f); - Dust expr_A0A0_cp_0 = Main.dust[num310]; - expr_A0A0_cp_0.position.X = expr_A0A0_cp_0.position.X - 2f; - Main.dust[num310].alpha = 38; - Main.dust[num310].velocity *= 0.1f; - Main.dust[num310].velocity += -projectile.oldVelocity * 0.25f; - Main.dust[num310].scale = 0.95f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(102, 255, 102, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ShaderainHostile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cursed Rain"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 40; + projectile.hostile = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.alpha = 50; + } + + public override void Kill(int timeLeft) + { + int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default(Color), 1f); + Dust expr_A0A0_cp_0 = Main.dust[num310]; + expr_A0A0_cp_0.position.X = expr_A0A0_cp_0.position.X - 2f; + Main.dust[num310].alpha = 38; + Main.dust[num310].velocity *= 0.1f; + Main.dust[num310].velocity += -projectile.oldVelocity * 0.25f; + Main.dust[num310].scale = 0.95f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(102, 255, 102, projectile.alpha); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + } +} diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index 062fad8a0e..bf83b2797f 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -146,4 +146,4 @@ namespace CalamityMod.Projectiles.Boss } } } -} \ No newline at end of file +} diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index c7dcd954ea..21ad11faa5 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -1,77 +1,77 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class SirenSong : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Musical Note"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 58; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 1800; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.01f; - if (projectile.scale >= 1.1f) - { - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.01f; - if (projectile.scale <= 0.9f) - { - projectile.localAI[0] = 0f; - } - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; - Main.harpNote = soundPitch; - Main.PlaySound(SoundID.Item26, projectile.position); - } - Lighting.AddLight(projectile.Center, 0.7f, 0.5f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, 0); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Confused, 120); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class SirenSong : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Musical Note"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 58; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 1800; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.01f; + if (projectile.scale >= 1.1f) + { + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.01f; + if (projectile.scale <= 0.9f) + { + projectile.localAI[0] = 0f; + } + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; + Main.harpNote = soundPitch; + Main.PlaySound(SoundID.Item26, projectile.position); + } + Lighting.AddLight(projectile.Center, 0.7f, 0.5f, 0f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, 0); + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Confused, 120); + } + } +} diff --git a/Projectiles/Boss/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs index cb02453bc2..c9a7b5605e 100644 --- a/Projectiles/Boss/SkyFlare.cs +++ b/Projectiles/Boss/SkyFlare.cs @@ -1,128 +1,128 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Boss -{ - public class SkyFlare : ModProjectile - { - public int blowTimer = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sky Flare"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 1; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y *= 0.9995f; - int addStuff = Main.rand.Next(5); - blowTimer += addStuff; - if (blowTimer >= 900) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - 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) - { - 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++) - { - 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, 244, 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; - } - if (projectile.owner == Main.myPlayer) - { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); - int num233 = 100; - if (num232 < 10) - { - num232 = 10; - } - if (num232 > Main.maxTilesX - 10) - { - num232 = Main.maxTilesX - 10; - } - if (num231 < 10) - { - num231 = 10; - } - if (num231 > Main.maxTilesY - num233 - 10) - { - num231 = Main.maxTilesY - num233 - 10; - } - for (int num234 = num231; num234 < num231 + num233; num234++) - { - Tile tile = Main.tile[num232, num234]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) - { - num231 = num234; - break; - } - } - int tornadoType = Main.rand.Next(6); - if (tornadoType < 5) - { - int num235 = Main.expertMode ? 180 : 300; //720 - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Flarenado"), num235, 4f, Main.myPlayer, 16f, 15f + (revenge ? 4f : 0f)); - Main.projectile[num236].netUpdate = true; - } - else - { - int num235 = Main.expertMode ? 230 : 400; //920 - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado"), num235, 4f, Main.myPlayer, 16f, 16f + (revenge ? 4f : 0f)); - Main.projectile[num236].netUpdate = true; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Boss +{ + public class SkyFlare : ModProjectile + { + public int blowTimer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sky Flare"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.penetrate = 1; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.velocity.X *= 0.9995f; + projectile.velocity.Y *= 0.9995f; + int addStuff = Main.rand.Next(5); + blowTimer += addStuff; + if (blowTimer >= 900) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + 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) + { + 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++) + { + 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, 244, 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; + } + if (projectile.owner == Main.myPlayer) + { + int num231 = (int)(projectile.Center.Y / 16f); + int num232 = (int)(projectile.Center.X / 16f); + int num233 = 100; + if (num232 < 10) + { + num232 = 10; + } + if (num232 > Main.maxTilesX - 10) + { + num232 = Main.maxTilesX - 10; + } + if (num231 < 10) + { + num231 = 10; + } + if (num231 > Main.maxTilesY - num233 - 10) + { + num231 = Main.maxTilesY - num233 - 10; + } + for (int num234 = num231; num234 < num231 + num233; num234++) + { + Tile tile = Main.tile[num232, num234]; + if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num231 = num234; + break; + } + } + int tornadoType = Main.rand.Next(6); + if (tornadoType < 5) + { + int num235 = Main.expertMode ? 180 : 300; //720 + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Flarenado"), num235, 4f, Main.myPlayer, 16f, 15f + (revenge ? 4f : 0f)); + Main.projectile[num236].netUpdate = true; + } + else + { + int num235 = Main.expertMode ? 230 : 400; //920 + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado"), num235, 4f, Main.myPlayer, 16f, 16f + (revenge ? 4f : 0f)); + Main.projectile[num236].netUpdate = true; + } + } + } + } +} diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index 5d5697205f..52f8d96a28 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -1,79 +1,79 @@ -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.Boss -{ - public class SkyFlareRevenge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sky Flare"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 10; - cooldownSlot = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 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; - } - - 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.Center.X, (int)projectile.Center.Y, 20); - 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, 244, 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; - } - if (projectile.owner == Main.myPlayer) - { - int num235 = 100; - int num236 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("InfernadoRevenge"), num235, 4f, Main.myPlayer, 16f, 50f); - Main.projectile[num236].netUpdate = true; - } - } - } -} \ No newline at end of file +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.Boss +{ + public class SkyFlareRevenge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sky Flare"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 10; + cooldownSlot = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 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; + } + + 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.Center.X, (int)projectile.Center.Y, 20); + 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, 244, 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; + } + if (projectile.owner == Main.myPlayer) + { + int num235 = 100; + int num236 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("InfernadoRevenge"), num235, 4f, Main.myPlayer, 16f, 50f); + Main.projectile[num236].netUpdate = true; + } + } + } +} diff --git a/Projectiles/Boss/VileClot.cs b/Projectiles/Boss/VileClot.cs index ce69b2131a..9c33021307 100644 --- a/Projectiles/Boss/VileClot.cs +++ b/Projectiles/Boss/VileClot.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class VileClot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vile Clot"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 3f) - { - int num104 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), - projectile.width, projectile.height, 75, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 100, default(Color), 1f); - Main.dust[num104].noGravity = true; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class VileClot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vile Clot"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 3f) + { + int num104 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), + projectile.width, projectile.height, 75, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 100, default(Color), 1f); + Main.dust[num104].noGravity = true; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 60); + } + } +} diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index e9e4e82056..302c8662c2 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -1,108 +1,108 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class WaterSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water Spear"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.velocity.X *= 1.005f; - projectile.velocity.Y *= 1.005f; - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 20; 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 10; - if (projectile.alpha >= 100) - { - projectile.alpha = 100; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 10; - 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; - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 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; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Wet, 240); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class WaterSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water Spear"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.velocity.X *= 1.005f; + projectile.velocity.Y *= 1.005f; + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 20; 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; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 10; + if (projectile.alpha >= 100) + { + projectile.alpha = 100; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 10; + 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; + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 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; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Wet, 240); + } + } +} diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index 9b32e6cb84..2429c597f6 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -1,109 +1,109 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class YharonFireball : ModProjectile - { - private float speedX = -3f; - private float speedX2 = -5f; - - 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; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(speedX); - writer.Write(projectile.localAI[0]); - writer.Write(speedX2); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - speedX = reader.ReadSingle(); - projectile.localAI[0] = reader.ReadSingle(); - speedX2 = reader.ReadSingle(); - } - - 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 void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - 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 +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class YharonFireball : ModProjectile + { + private float speedX = -3f; + private float speedX2 = -5f; + + 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; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(speedX); + writer.Write(projectile.localAI[0]); + writer.Write(speedX2); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + speedX = reader.ReadSingle(); + projectile.localAI[0] = reader.ReadSingle(); + speedX2 = reader.ReadSingle(); + } + + 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 void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + 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; + } + } + } +} diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index 6d0a804638..041d0a59bb 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -1,145 +1,145 @@ -using System; -using System.IO; -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 YharonFireball2 : ModProjectile - { - 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 = 3600; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y *= 0.97f; - } - else - { - projectile.velocity.Y *= 1.03f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - if (projectile.velocity.Y > -1f && projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - projectile.velocity.Y = 1f; - } - projectile.velocity.X *= 0.995f; - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - if (projectile.ai[0] >= 2f) - { - projectile.alpha -= 25; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (Main.rand.Next(16) == 0) - { - Dust expr_733B = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 200, default(Color), 1f); - expr_733B.scale *= 0.7f; - expr_733B.velocity += projectile.velocity * 0.25f; - } - if (Main.rand.Next(12) == 0 && projectile.oldPos[9] != Vector2.Zero) - { - Dust expr_73D4 = Dust.NewDustDirect(projectile.oldPos[9], projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1f); - expr_73D4.scale *= 0.85f; - expr_73D4.velocity += projectile.velocity * 0.15f; - expr_73D4.color = Color.Purple; - } - 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; - } - } - } - - 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); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 0.5f, 0f); - 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, 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, 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, 100, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } -} \ No newline at end of file +using System; +using System.IO; +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 YharonFireball2 : ModProjectile + { + 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 = 3600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y *= 0.97f; + } + else + { + projectile.velocity.Y *= 1.03f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + if (projectile.velocity.Y > -1f && projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + projectile.velocity.Y = 1f; + } + projectile.velocity.X *= 0.995f; + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); + } + if (projectile.ai[0] >= 2f) + { + projectile.alpha -= 25; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (Main.rand.Next(16) == 0) + { + Dust expr_733B = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 200, default(Color), 1f); + expr_733B.scale *= 0.7f; + expr_733B.velocity += projectile.velocity * 0.25f; + } + if (Main.rand.Next(12) == 0 && projectile.oldPos[9] != Vector2.Zero) + { + Dust expr_73D4 = Dust.NewDustDirect(projectile.oldPos[9], projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1f); + expr_73D4.scale *= 0.85f; + expr_73D4.velocity += projectile.velocity * 0.15f; + expr_73D4.color = Color.Purple; + } + 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; + } + } + } + + 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); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 0.5f, 0f); + 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, 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, 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, 100, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 1a1bc31ae5..2c329110c9 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,1136 +1,1136 @@ -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.ModLoader; -using CalamityMod; -using CalamityMod.NPCs; -using CalamityMod.World; -using CalamityMod.NPCs.TheDevourerofGods; -using CalamityMod.Items.Armor; -using CalamityMod.Items.CalamityCustomThrowingDamage; - -namespace CalamityMod.Projectiles -{ - public class CalamityGlobalProjectile : GlobalProjectile - { - public override bool InstancePerEntity - { - get - { - return true; - } - } - - //Class Types - public bool rogue = false; - public bool trueMelee = false; - - //Force Class Types - public bool forceMelee = false; - public bool forceRanged = false; - public bool forceMagic = false; - public bool forceRogue = false; - public bool forceMinion = false; - - //Damage Adjusters - private bool setDamageValues = true; - public float spawnedPlayerMinionDamageValue = 1f; - public int spawnedPlayerMinionProjectileDamageValue = 0; - private int defDamage = 0; - - //Counters and Timers - private int counter = 0; - private int counter2 = 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) - { - spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - spawnedPlayerMinionProjectileDamageValue = projectile.damage; - setDamageValues = false; - } - if (Main.player[projectile.owner].minionDamage != spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(((float)spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - } - SKIP_CALAMITY: - - if (forceMelee) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = true; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = false; - rogue = false; - } - else if (forceRanged) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = true; - projectile.magic = false; - projectile.minion = false; - rogue = false; - } - else if (forceMagic) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = true; - projectile.minion = false; - rogue = false; - } - else if (forceRogue) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = false; - rogue = true; - } - else if (forceMinion) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = true; - rogue = false; - } - - if (projectile.type == ProjectileID.NettleBurstRight || projectile.type == ProjectileID.NettleBurstLeft || projectile.type == ProjectileID.NettleBurstEnd) - { - if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("ThornBlossom")) - projectile.penetrate = 1; - } - else if (projectile.type == ProjectileID.VilethornBase || projectile.type == ProjectileID.VilethornTip) - { - if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("FeralthornClaymore")) - { - projectile.melee = true; - projectile.magic = false; - projectile.penetrate = 1; - } - } - 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 == 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)) - { - if (Main.rand.Next(200) > 198) - { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 1; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - if (projectile.owner == Main.myPlayer) - { - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), projectile.type, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), projectile.type, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile1].ranged = false; - Main.projectile[projectile2].ranged = false; - Main.projectile[projectile1].timeLeft = 60; - Main.projectile[projectile2].timeLeft = 60; - Main.projectile[projectile1].noDropItem = true; - Main.projectile[projectile2].noDropItem = true; - } - } - } - } - - 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) - { - if (projectile.type == mod.ProjectileType("Nebulash") || projectile.type == mod.ProjectileType("CosmicDischarge") || - projectile.type == mod.ProjectileType("Mourningstar") || projectile.type == ProjectileID.SolarWhipSword) - { - Vector2 vector24 = Main.OffsetsPlayerOnhand[Main.player[projectile.owner].bodyFrame.Y / 56] * 2f; - if (Main.player[projectile.owner].direction != 1) - { - vector24.X = (float)Main.player[projectile.owner].bodyFrame.Width - vector24.X; - } - if (Main.player[projectile.owner].gravDir != 1f) - { - vector24.Y = (float)Main.player[projectile.owner].bodyFrame.Height - vector24.Y; - } - vector24 -= new Vector2((float)(Main.player[projectile.owner].bodyFrame.Width - Main.player[projectile.owner].width), (float)(Main.player[projectile.owner].bodyFrame.Height - 42)) / 2f; - Vector2 newCenter = Main.player[projectile.owner].RotatedRelativePoint(Main.player[projectile.owner].position + vector24, true) + projectile.velocity; - Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ProjectileID.Mushroom, - (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - } - else - { - 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++; - if (counter >= 30) - { - counter = 0; - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("Nanotech")] < 30) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Nanotech"), - (int)((double)projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); - } - } - } - - if (Main.player[projectile.owner].GetModPlayer(mod).daedalusSplit && rogue && projectile.friendly) - { - counter2++; - if (counter2 >= 30) - { - counter2 = 0; - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[90] < 30) - { - for (int num252 = 0; num252 < 2; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, 90, (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - Main.projectile[shard].ranged = false; - } - } - } - } - - 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 - - #region PostAI - public override void PostAI(Projectile projectile) - { - int x = (int)(projectile.Center.X / 16f); - int y = (int)(projectile.Center.Y / 16f); - for (int i = x - 1; i <= x + 1; i++) - { - for (int j = y - 1; j <= y + 1; j++) - { - if (projectile.type == ProjectileID.PureSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); - } - if (projectile.type == ProjectileID.CorruptSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); - } - if (projectile.type == ProjectileID.CrimsonSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); - } - if (projectile.type == ProjectileID.HallowSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); - } - } - } - } - #endregion - - #region OnHitNPC - public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - if (projectile.magic && Main.player[projectile.owner].ghostHeal) - { - float num = 0.1f; - num -= (float)projectile.numHits * 0.05f; - if (num < 0f) - { - num = 0f; - } - float num2 = (float)damage * num; - Main.player[Main.myPlayer].lifeSteal -= num2; - } - if (projectile.type == ProjectileID.VampireKnife) - { - float num = (float)damage * 0.0375f; - if (num < 0f) - { - num = 0f; - } - Main.player[Main.myPlayer].lifeSteal -= num; - } - if (Main.player[projectile.owner].GetModPlayer(mod).alchFlask && - (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) - { - newDamage = 30; - } - int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueSeeker"), newDamage, 0f, projectile.owner, 0f, 0f); - Main.projectile[plague].melee = false; - } - if (Main.player[projectile.owner].GetModPlayer(mod).reaverBlast && projectile.melee) - { - int newDamage = (int)((double)projectile.damage * 0.2); - if (newDamage > 30) - { - newDamage = 30; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ReaverBlast"), newDamage, 0f, projectile.owner, 0f, 0f); - } - if (Main.player[projectile.owner].GetModPlayer(mod).auricSet && target.canGhostHeal) - { - float num11 = 0.05f; - num11 -= (float)projectile.numHits * 0.025f; - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) - { - float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) - { - num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); - num14 = i; - } - } - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AuricOrb"), 0, 0f, projectile.owner, (float)num14, num12); - } - else if (Main.player[projectile.owner].GetModPlayer(mod).silvaSet && target.canGhostHeal) - { - float num11 = 0.03f; - num11 -= (float)projectile.numHits * 0.015f; - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) - { - float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) - { - num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); - num14 = i; - } - } - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SilvaOrb"), 0, 0f, projectile.owner, (float)num14, num12); - } - if (projectile.magic) - { - if (Main.player[projectile.owner].GetModPlayer(mod).silvaMage && projectile.penetrate == 1 && - Main.rand.Next(0, 100) >= 97) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 96); - 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 < 3; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 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, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.damage *= (Main.player[projectile.owner].GetModPlayer(mod).auricSet ? 7 : 4); - projectile.Damage(); - } - if (Main.player[projectile.owner].GetModPlayer(mod).tarraMage && target.canGhostHeal) - { - if (Main.player[projectile.owner].GetModPlayer(mod).tarraMageHealCooldown <= 0) - { - Main.player[projectile.owner].GetModPlayer(mod).tarraMageHealCooldown = 90; - float num11 = 0.03f; - num11 -= (float)projectile.numHits * 0.015f; - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - int healAmount = (Main.player[projectile.owner].GetModPlayer(mod).auricSet ? projectile.damage / 100 : projectile.damage / 50); - Player player = Main.player[projectile.owner]; - player.statLife += healAmount; - player.HealEffect(healAmount); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).reaverBurst) - { - int num251 = Main.rand.Next(2, 5); - 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; - int newDamage = (int)((double)projectile.damage * 0.25); - if (newDamage > 40) - { - 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); - } - } - else if (Main.player[projectile.owner].GetModPlayer(mod).ataxiaMage && - Main.player[projectile.owner].GetModPlayer(mod).ataxiaDmg <= 0) - { - int num = projectile.damage / 2; - Main.player[projectile.owner].GetModPlayer(mod).ataxiaDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 20f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("AtaxiaOrb"), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); - if (target.canGhostHeal) - { - float num11 = 0.1f; //0.2 - num11 -= (float)projectile.numHits * 0.05f; //0.05 - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) - { - float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) - { - num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); - num14 = i; - } - } - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AtaxiaHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); - } - } - else if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet && - Main.player[projectile.owner].GetModPlayer(mod).xerocDmg <= 0) - { - int num = projectile.damage / 2; - Main.player[projectile.owner].GetModPlayer(mod).xerocDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 30f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocOrb"), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); - if (target.canGhostHeal) - { - float num11 = 0.1f; - num11 -= (float)projectile.numHits * 0.05f; - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) - { - float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) - { - num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); - num14 = i; - } - } - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); - } - } - else if (Main.player[projectile.owner].GetModPlayer(mod).godSlayerMage && - Main.player[projectile.owner].GetModPlayer(mod).godSlayerDmg <= 0) - { - int num = projectile.damage / 2; - Main.player[projectile.owner].GetModPlayer(mod).godSlayerDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 20f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("GodSlayerOrb"), - (int)((double)num * (Main.player[projectile.owner].GetModPlayer(mod).auricSet ? 2.0 : 1.5)), 0f, projectile.owner, (float)num6, 0f); - if (target.canGhostHeal) - { - float num11 = (Main.player[projectile.owner].GetModPlayer(mod).auricSet ? 0.03f : 0.06f); //0.2 - num11 -= (float)projectile.numHits * 0.015f; //0.05 - if (num11 <= 0f) - { - return; - } - float num12 = (float)projectile.damage * num11; - if ((int)num12 <= 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; - float num13 = 0f; - int num14 = projectile.owner; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) - { - float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) - { - num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); - num14 = i; - } - } - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); - } - } - } - else if (projectile.melee) - { - if (Main.player[projectile.owner].GetModPlayer(mod).ataxiaGeyser && - Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChaosGeyser")] < 3) - { - int newDamage = (int)((double)projectile.damage * 0.15); - if (newDamage > 35) - { - newDamage = 35; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), newDamage, 0f, projectile.owner, 0f, 0f); - } - else if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet && - Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocBlast")] < 3) - { - int newDamage = (int)((double)projectile.damage * 0.2); - if (newDamage > 40) - { - newDamage = 40; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocBlast"), newDamage, 0f, projectile.owner, 0f, 0f); - } - } - else if (projectile.ranged) - { - if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet && - Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocFire")] < 3) - { - int newDamage = (int)((double)projectile.damage * 0.15); - if (newDamage > 40) - { - newDamage = 40; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocFire"), newDamage, 0f, projectile.owner, 0f, 0f); - } - } - else if (rogue) - { - if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet && - Main.player[projectile.owner].GetModPlayer(mod).xerocDmg <= 0) - { - int num = projectile.damage / 2; - Main.player[projectile.owner].GetModPlayer(mod).xerocDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = Main.rand.Next(15, 30); - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocStar"), (int)((double)num * 1.6), 0f, projectile.owner, (float)num6, 0f); - } - } - else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) - { - if (Main.player[projectile.owner].GetModPlayer(mod).pArtifact) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - if (Main.player[projectile.owner].GetModPlayer(mod).tearMinions) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 60); - } - if (Main.player[projectile.owner].GetModPlayer(mod).shadowMinions) - { - target.AddBuff(BuffID.ShadowFlame, 300); - } - if (Main.player[projectile.owner].GetModPlayer(mod).godSlayerSummon && - Main.player[projectile.owner].GetModPlayer(mod).godSlayerDmg <= 0) - { - int num = projectile.damage / 2; - float ai1 = (Main.rand.NextFloat() + 0.5f); - Main.player[projectile.owner].GetModPlayer(mod).godSlayerDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 15f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("GodSlayerPhantom"), (int)((double)num * 2.0), 0f, projectile.owner, 0f, ai1); - } - else if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet && - Main.player[projectile.owner].GetModPlayer(mod).xerocDmg <= 0) - { - int num = projectile.damage / 2; - Main.player[projectile.owner].GetModPlayer(mod).xerocDmg += (float)num; - int[] array = new int[200]; - int num3 = 0; - int num4 = 0; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); - if (num5 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) - { - array[num4] = i; - num4++; - } - else if (num4 == 0) - { - array[num3] = i; - num3++; - } - } - } - } - if (num3 == 0 && num4 == 0) - { - return; - } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = 15f; - float num8 = (float)Main.rand.Next(-100, 101); - float num9 = (float)Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocBubble"), (int)((double)num * 1.2), 0f, projectile.owner, (float)num6, 0f); - } - } - } - } - #endregion - - #region CanDamage - public override bool CanDamage(Projectile projectile) - { - switch (projectile.type) - { - case ProjectileID.Sharknado: - if (projectile.timeLeft > 420) - return false; - break; - case ProjectileID.Cthulunado: - if (projectile.timeLeft > 720) - return false; - break; - } - return true; - } - #endregion - - #region Drawing - public override Color? GetAlpha(Projectile projectile, Color lightColor) - { - if (Main.player[Main.myPlayer].GetModPlayer(mod).trippy) - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - return null; - } - - public override bool PreDraw(Projectile projectile, SpriteBatch spriteBatch, Color lightColor) - { - if (Main.player[Main.myPlayer].GetModPlayer(mod).trippy) - { - Texture2D texture = Main.projectileTexture[projectile.type]; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - float num66 = 0f; - Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.projFrames[projectile.type] / 2)); - Microsoft.Xna.Framework.Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - Microsoft.Xna.Framework.Color alpha15 = projectile.GetAlpha(color9); - float num212 = 0.99f; - alpha15.R = (byte)((float)alpha15.R * num212); - alpha15.G = (byte)((float)alpha15.G * num212); - alpha15.B = (byte)((float)alpha15.B * num212); - alpha15.A = (byte)((float)alpha15.A * num212); - for (int num213 = 0; num213 < 4; num213++) - { - Vector2 position9 = projectile.position; - float num214 = Math.Abs(projectile.Center.X - Main.player[Main.myPlayer].Center.X); - float num215 = Math.Abs(projectile.Center.Y - Main.player[Main.myPlayer].Center.Y); - if (num213 == 0 || num213 == 2) - { - position9.X = Main.player[Main.myPlayer].Center.X + num214; - } - else - { - position9.X = Main.player[Main.myPlayer].Center.X - num214; - } - position9.X -= (float)(projectile.width / 2); - if (num213 == 0 || num213 == 1) - { - position9.Y = Main.player[Main.myPlayer].Center.Y + num215; - } - else - { - position9.Y = Main.player[Main.myPlayer].Center.Y - num215; - } - int frames = texture.Height / Main.projFrames[projectile.type]; - int y = frames * projectile.frame; - position9.Y -= (float)(projectile.height / 2); - Main.spriteBatch.Draw(texture, - new Vector2(position9.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + (float)projectile.height - (float)texture.Height * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + num66 + projectile.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); - } - } - return true; - } - #endregion - - #region Kill - public override void Kill(Projectile projectile, int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - if (Main.player[projectile.owner].GetModPlayer(mod).providenceLore && 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) - { - 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) - { - 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 newDamage = (int)((double)projectile.damage * 0.33); - if (newDamage > 65) - { - newDamage = 65; - } - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("TarraEnergy"), newDamage, 0f, projectile.owner, 0f, 0f); - } - } - } - } - } - #endregion - - #region CanHit - public override bool CanHitPlayer(Projectile projectile, Player target) - { - if (projectile.type == ProjectileID.CultistBossLightningOrb) - { - return false; - } - return true; - } - #endregion - } -} +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.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; +using CalamityMod.World; +using CalamityMod.NPCs.TheDevourerofGods; +using CalamityMod.Items.Armor; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Projectiles +{ + public class CalamityGlobalProjectile : GlobalProjectile + { + public override bool InstancePerEntity + { + get + { + return true; + } + } + + //Class Types + public bool rogue = false; + public bool trueMelee = false; + + //Force Class Types + public bool forceMelee = false; + public bool forceRanged = false; + public bool forceMagic = false; + public bool forceRogue = false; + public bool forceMinion = false; + + //Damage Adjusters + private bool setDamageValues = true; + public float spawnedPlayerMinionDamageValue = 1f; + public int spawnedPlayerMinionProjectileDamageValue = 0; + private int defDamage = 0; + + //Counters and Timers + private int counter = 0; + private int counter2 = 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) + { + spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + spawnedPlayerMinionProjectileDamageValue = projectile.damage; + setDamageValues = false; + } + if (Main.player[projectile.owner].minionDamage != spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue) * Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + } + SKIP_CALAMITY: + + if (forceMelee) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = true; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = false; + rogue = false; + } + else if (forceRanged) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = true; + projectile.magic = false; + projectile.minion = false; + rogue = false; + } + else if (forceMagic) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = true; + projectile.minion = false; + rogue = false; + } + else if (forceRogue) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = false; + rogue = true; + } + else if (forceMinion) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = true; + rogue = false; + } + + if (projectile.type == ProjectileID.NettleBurstRight || projectile.type == ProjectileID.NettleBurstLeft || projectile.type == ProjectileID.NettleBurstEnd) + { + if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("ThornBlossom")) + projectile.penetrate = 1; + } + else if (projectile.type == ProjectileID.VilethornBase || projectile.type == ProjectileID.VilethornTip) + { + if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("FeralthornClaymore")) + { + projectile.melee = true; + projectile.magic = false; + projectile.penetrate = 1; + } + } + 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 == 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)) + { + if (Main.rand.Next(200) > 198) + { + float spread = 180f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 1; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + if (projectile.owner == Main.myPlayer) + { + int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 8f), (float)(Math.Cos(offsetAngle) * 8f), projectile.type, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 8f), (float)(-Math.Cos(offsetAngle) * 8f), projectile.type, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile1].ranged = false; + Main.projectile[projectile2].ranged = false; + Main.projectile[projectile1].timeLeft = 60; + Main.projectile[projectile2].timeLeft = 60; + Main.projectile[projectile1].noDropItem = true; + Main.projectile[projectile2].noDropItem = true; + } + } + } + } + + 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) + { + if (projectile.type == mod.ProjectileType("Nebulash") || projectile.type == mod.ProjectileType("CosmicDischarge") || + projectile.type == mod.ProjectileType("Mourningstar") || projectile.type == ProjectileID.SolarWhipSword) + { + Vector2 vector24 = Main.OffsetsPlayerOnhand[Main.player[projectile.owner].bodyFrame.Y / 56] * 2f; + if (Main.player[projectile.owner].direction != 1) + { + vector24.X = (float)Main.player[projectile.owner].bodyFrame.Width - vector24.X; + } + if (Main.player[projectile.owner].gravDir != 1f) + { + vector24.Y = (float)Main.player[projectile.owner].bodyFrame.Height - vector24.Y; + } + vector24 -= new Vector2((float)(Main.player[projectile.owner].bodyFrame.Width - Main.player[projectile.owner].width), (float)(Main.player[projectile.owner].bodyFrame.Height - 42)) / 2f; + Vector2 newCenter = Main.player[projectile.owner].RotatedRelativePoint(Main.player[projectile.owner].position + vector24, true) + projectile.velocity; + Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ProjectileID.Mushroom, + (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + } + else + { + 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++; + if (counter >= 30) + { + counter = 0; + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("Nanotech")] < 30) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Nanotech"), + (int)((double)projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + } + } + } + + if (Main.player[projectile.owner].GetModPlayer(mod).daedalusSplit && rogue && projectile.friendly) + { + counter2++; + if (counter2 >= 30) + { + counter2 = 0; + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[90] < 30) + { + for (int num252 = 0; num252 < 2; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + int shard = Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, 90, (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Main.projectile[shard].ranged = false; + } + } + } + } + + 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 + + #region PostAI + public override void PostAI(Projectile projectile) + { + int x = (int)(projectile.Center.X / 16f); + int y = (int)(projectile.Center.Y / 16f); + for (int i = x - 1; i <= x + 1; i++) + { + for (int j = y - 1; j <= y + 1; j++) + { + if (projectile.type == ProjectileID.PureSpray) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); + } + if (projectile.type == ProjectileID.CorruptSpray) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); + } + if (projectile.type == ProjectileID.CrimsonSpray) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); + } + if (projectile.type == ProjectileID.HallowSpray) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); + } + } + } + } + #endregion + + #region OnHitNPC + public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + if (projectile.magic && Main.player[projectile.owner].ghostHeal) + { + float num = 0.1f; + num -= (float)projectile.numHits * 0.05f; + if (num < 0f) + { + num = 0f; + } + float num2 = (float)damage * num; + Main.player[Main.myPlayer].lifeSteal -= num2; + } + if (projectile.type == ProjectileID.VampireKnife) + { + float num = (float)damage * 0.0375f; + if (num < 0f) + { + num = 0f; + } + Main.player[Main.myPlayer].lifeSteal -= num; + } + if (Main.player[projectile.owner].GetModPlayer(mod).alchFlask && + (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) + { + newDamage = 30; + } + int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueSeeker"), newDamage, 0f, projectile.owner, 0f, 0f); + Main.projectile[plague].melee = false; + } + if (Main.player[projectile.owner].GetModPlayer(mod).reaverBlast && projectile.melee) + { + int newDamage = (int)((double)projectile.damage * 0.2); + if (newDamage > 30) + { + newDamage = 30; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ReaverBlast"), newDamage, 0f, projectile.owner, 0f, 0f); + } + if (Main.player[projectile.owner].GetModPlayer(mod).auricSet && target.canGhostHeal) + { + float num11 = 0.05f; + num11 -= (float)projectile.numHits * 0.025f; + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AuricOrb"), 0, 0f, projectile.owner, (float)num14, num12); + } + else if (Main.player[projectile.owner].GetModPlayer(mod).silvaSet && target.canGhostHeal) + { + float num11 = 0.03f; + num11 -= (float)projectile.numHits * 0.015f; + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SilvaOrb"), 0, 0f, projectile.owner, (float)num14, num12); + } + if (projectile.magic) + { + if (Main.player[projectile.owner].GetModPlayer(mod).silvaMage && projectile.penetrate == 1 && + Main.rand.Next(0, 100) >= 97) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 96); + 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 < 3; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 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, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.damage *= (Main.player[projectile.owner].GetModPlayer(mod).auricSet ? 7 : 4); + projectile.Damage(); + } + if (Main.player[projectile.owner].GetModPlayer(mod).tarraMage && target.canGhostHeal) + { + if (Main.player[projectile.owner].GetModPlayer(mod).tarraMageHealCooldown <= 0) + { + Main.player[projectile.owner].GetModPlayer(mod).tarraMageHealCooldown = 90; + float num11 = 0.03f; + num11 -= (float)projectile.numHits * 0.015f; + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + int healAmount = (Main.player[projectile.owner].GetModPlayer(mod).auricSet ? projectile.damage / 100 : projectile.damage / 50); + Player player = Main.player[projectile.owner]; + player.statLife += healAmount; + player.HealEffect(healAmount); + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).reaverBurst) + { + int num251 = Main.rand.Next(2, 5); + 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; + int newDamage = (int)((double)projectile.damage * 0.25); + if (newDamage > 40) + { + 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); + } + } + else if (Main.player[projectile.owner].GetModPlayer(mod).ataxiaMage && + Main.player[projectile.owner].GetModPlayer(mod).ataxiaDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].GetModPlayer(mod).ataxiaDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 20f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("AtaxiaOrb"), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); + if (target.canGhostHeal) + { + float num11 = 0.1f; //0.2 + num11 -= (float)projectile.numHits * 0.05f; //0.05 + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AtaxiaHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); + } + } + else if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet && + Main.player[projectile.owner].GetModPlayer(mod).xerocDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].GetModPlayer(mod).xerocDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 30f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocOrb"), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); + if (target.canGhostHeal) + { + float num11 = 0.1f; + num11 -= (float)projectile.numHits * 0.05f; + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); + } + } + else if (Main.player[projectile.owner].GetModPlayer(mod).godSlayerMage && + Main.player[projectile.owner].GetModPlayer(mod).godSlayerDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].GetModPlayer(mod).godSlayerDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 20f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("GodSlayerOrb"), + (int)((double)num * (Main.player[projectile.owner].GetModPlayer(mod).auricSet ? 2.0 : 1.5)), 0f, projectile.owner, (float)num6, 0f); + if (target.canGhostHeal) + { + float num11 = (Main.player[projectile.owner].GetModPlayer(mod).auricSet ? 0.03f : 0.06f); //0.2 + num11 -= (float)projectile.numHits * 0.015f; //0.05 + if (num11 <= 0f) + { + return; + } + float num12 = (float)projectile.damage * num11; + if ((int)num12 <= 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num12 * 1.5f; + float num13 = 0f; + int num14 = projectile.owner; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[projectile.owner].hostile && !Main.player[i].hostile) || Main.player[projectile.owner].team == Main.player[i].team)) + { + float num15 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num15 < 1200f && (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + { + num13 = (float)(Main.player[i].statLifeMax2 - Main.player[i].statLife); + num14 = i; + } + } + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerHealOrb"), 0, 0f, projectile.owner, (float)num14, num12); + } + } + } + else if (projectile.melee) + { + if (Main.player[projectile.owner].GetModPlayer(mod).ataxiaGeyser && + Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChaosGeyser")] < 3) + { + int newDamage = (int)((double)projectile.damage * 0.15); + if (newDamage > 35) + { + newDamage = 35; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), newDamage, 0f, projectile.owner, 0f, 0f); + } + else if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet && + Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocBlast")] < 3) + { + int newDamage = (int)((double)projectile.damage * 0.2); + if (newDamage > 40) + { + newDamage = 40; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocBlast"), newDamage, 0f, projectile.owner, 0f, 0f); + } + } + else if (projectile.ranged) + { + if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet && + Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("XerocFire")] < 3) + { + int newDamage = (int)((double)projectile.damage * 0.15); + if (newDamage > 40) + { + newDamage = 40; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("XerocFire"), newDamage, 0f, projectile.owner, 0f, 0f); + } + } + else if (rogue) + { + if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet && + Main.player[projectile.owner].GetModPlayer(mod).xerocDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].GetModPlayer(mod).xerocDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = Main.rand.Next(15, 30); + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocStar"), (int)((double)num * 1.6), 0f, projectile.owner, (float)num6, 0f); + } + } + else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) + { + if (Main.player[projectile.owner].GetModPlayer(mod).pArtifact) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + if (Main.player[projectile.owner].GetModPlayer(mod).tearMinions) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 60); + } + if (Main.player[projectile.owner].GetModPlayer(mod).shadowMinions) + { + target.AddBuff(BuffID.ShadowFlame, 300); + } + if (Main.player[projectile.owner].GetModPlayer(mod).godSlayerSummon && + Main.player[projectile.owner].GetModPlayer(mod).godSlayerDmg <= 0) + { + int num = projectile.damage / 2; + float ai1 = (Main.rand.NextFloat() + 0.5f); + Main.player[projectile.owner].GetModPlayer(mod).godSlayerDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 15f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("GodSlayerPhantom"), (int)((double)num * 2.0), 0f, projectile.owner, 0f, ai1); + } + else if (Main.player[projectile.owner].GetModPlayer(mod).xerocSet && + Main.player[projectile.owner].GetModPlayer(mod).xerocDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].GetModPlayer(mod).xerocDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 15f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocBubble"), (int)((double)num * 1.2), 0f, projectile.owner, (float)num6, 0f); + } + } + } + } + #endregion + + #region CanDamage + public override bool CanDamage(Projectile projectile) + { + switch (projectile.type) + { + case ProjectileID.Sharknado: + if (projectile.timeLeft > 420) + return false; + break; + case ProjectileID.Cthulunado: + if (projectile.timeLeft > 720) + return false; + break; + } + return true; + } + #endregion + + #region Drawing + public override Color? GetAlpha(Projectile projectile, Color lightColor) + { + if (Main.player[Main.myPlayer].GetModPlayer(mod).trippy) + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + return null; + } + + public override bool PreDraw(Projectile projectile, SpriteBatch spriteBatch, Color lightColor) + { + if (Main.player[Main.myPlayer].GetModPlayer(mod).trippy) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + float num66 = 0f; + Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.projFrames[projectile.type] / 2)); + Microsoft.Xna.Framework.Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + Microsoft.Xna.Framework.Color alpha15 = projectile.GetAlpha(color9); + float num212 = 0.99f; + alpha15.R = (byte)((float)alpha15.R * num212); + alpha15.G = (byte)((float)alpha15.G * num212); + alpha15.B = (byte)((float)alpha15.B * num212); + alpha15.A = (byte)((float)alpha15.A * num212); + for (int num213 = 0; num213 < 4; num213++) + { + Vector2 position9 = projectile.position; + float num214 = Math.Abs(projectile.Center.X - Main.player[Main.myPlayer].Center.X); + float num215 = Math.Abs(projectile.Center.Y - Main.player[Main.myPlayer].Center.Y); + if (num213 == 0 || num213 == 2) + { + position9.X = Main.player[Main.myPlayer].Center.X + num214; + } + else + { + position9.X = Main.player[Main.myPlayer].Center.X - num214; + } + position9.X -= (float)(projectile.width / 2); + if (num213 == 0 || num213 == 1) + { + position9.Y = Main.player[Main.myPlayer].Center.Y + num215; + } + else + { + position9.Y = Main.player[Main.myPlayer].Center.Y - num215; + } + int frames = texture.Height / Main.projFrames[projectile.type]; + int y = frames * projectile.frame; + position9.Y -= (float)(projectile.height / 2); + Main.spriteBatch.Draw(texture, + new Vector2(position9.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + (float)projectile.height - (float)texture.Height * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + num66 + projectile.gfxOffY), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); + } + } + return true; + } + #endregion + + #region Kill + public override void Kill(Projectile projectile, int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + if (Main.player[projectile.owner].GetModPlayer(mod).providenceLore && 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) + { + 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) + { + 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 newDamage = (int)((double)projectile.damage * 0.33); + if (newDamage > 65) + { + newDamage = 65; + } + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("TarraEnergy"), newDamage, 0f, projectile.owner, 0f, 0f); + } + } + } + } + } + #endregion + + #region CanHit + public override bool CanHitPlayer(Projectile projectile, Player target) + { + if (projectile.type == ProjectileID.CultistBossLightningOrb) + { + return false; + } + return true; + } + #endregion + } +} diff --git a/Projectiles/Enemy/AstralShot.cs b/Projectiles/Enemy/AstralShot.cs index 263c7fd788..f3c6f05ef7 100644 --- a/Projectiles/Enemy/AstralShot.cs +++ b/Projectiles/Enemy/AstralShot.cs @@ -1,104 +1,104 @@ -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.Enemy -{ - public class AstralShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 30f; - float num56 = 1f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 100, 255, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 30f; - float scaleFactor = 1f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - } -} \ No newline at end of file +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.Enemy +{ + public class AstralShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 3; + projectile.timeLeft = 90; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 30f; + float num56 = 1f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 100, 255, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 30f; + float scaleFactor = 1f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + } +} diff --git a/Projectiles/Enemy/CrimsonSpike.cs b/Projectiles/Enemy/CrimsonSpike.cs index 22c183f547..ee97734ed8 100644 --- a/Projectiles/Enemy/CrimsonSpike.cs +++ b/Projectiles/Enemy/CrimsonSpike.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class CrimsonSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.alpha = 255; - projectile.aiStyle = 1; - projectile.penetrate = -1; - } - - public override void AI() - { - if (projectile.alpha == 0 && Main.rand.Next(3) == 0) - { - int num67 = Dust.NewDust(projectile.position - projectile.velocity * 3f, projectile.width, projectile.height, 260, 0f, 0f, 50, new Color(255, 136, 78, 150), 1.2f); - Main.dust[num67].velocity *= 0.3f; - Main.dust[num67].velocity += projectile.velocity * 0.3f; - Main.dust[num67].noGravity = true; - } - projectile.alpha -= 50; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 17); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 5f) - { - projectile.ai[0] = 5f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Cursed, 60); - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 260, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class CrimsonSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.alpha = 255; + projectile.aiStyle = 1; + projectile.penetrate = -1; + } + + public override void AI() + { + if (projectile.alpha == 0 && Main.rand.Next(3) == 0) + { + int num67 = Dust.NewDust(projectile.position - projectile.velocity * 3f, projectile.width, projectile.height, 260, 0f, 0f, 50, new Color(255, 136, 78, 150), 1.2f); + Main.dust[num67].velocity *= 0.3f; + Main.dust[num67].velocity += projectile.velocity * 0.3f; + Main.dust[num67].noGravity = true; + } + projectile.alpha -= 50; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 17); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 5f) + { + projectile.ai[0] = 5f; + projectile.velocity.Y = projectile.velocity.Y + 0.15f; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Cursed, 60); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 260, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index 0721e1a9e6..cc268ea220 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -1,120 +1,120 @@ -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.Enemy -{ - public class EarthRockBig : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rock"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - 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 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(4, (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 = 60; - 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 num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 8, 0f, 0f, 100, default(Color), 1.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, 1, 0f, 0f, 100, default(Color), 1.7f); - 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, 8, 0f, 0f, 100, default(Color), 1f); - 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; - } - } - } -} \ No newline at end of file +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.Enemy +{ + public class EarthRockBig : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rock"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.penetrate = 3; + projectile.timeLeft = 600; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + 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 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(4, (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 = 60; + 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 num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 8, 0f, 0f, 100, default(Color), 1.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, 1, 0f, 0f, 100, default(Color), 1.7f); + 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, 8, 0f, 0f, 100, default(Color), 1f); + 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; + } + } + } +} diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index b0d1da22f4..3660c9fd76 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -1,99 +1,99 @@ -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.Enemy -{ - public class EarthRockSmall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rock"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.timeLeft = 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; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (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 = 50; - projectile.height = 50; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 8, 0f, 0f, 100, default(Color), 1.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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 1, 0f, 0f, 100, default(Color), 1.7f); - 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, 8, 0f, 0f, 100, default(Color), 1f); - 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; - } - } - } -} \ No newline at end of file +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.Enemy +{ + public class EarthRockSmall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rock"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.timeLeft = 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; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (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 = 50; + projectile.height = 50; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 8, 0f, 0f, 100, default(Color), 1.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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 1, 0f, 0f, 100, default(Color), 1.7f); + 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, 8, 0f, 0f, 100, default(Color), 1f); + 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; + } + } + } +} diff --git a/Projectiles/Enemy/FlameBurstHostile.cs b/Projectiles/Enemy/FlameBurstHostile.cs index bc5cb2b0fe..3048620fca 100644 --- a/Projectiles/Enemy/FlameBurstHostile.cs +++ b/Projectiles/Enemy/FlameBurstHostile.cs @@ -1,98 +1,98 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class FlameBurstHostile : ModProjectile - { - public float count = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burst"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 180; - } - - public override void AI() - { - if (count == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - count += 1f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 0.75f); - Main.dust[num469].velocity *= 0f; - } - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 200f && projectile.ai[1] > 40f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class FlameBurstHostile : ModProjectile + { + public float count = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burst"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.timeLeft = 180; + } + + public override void AI() + { + if (count == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + count += 1f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 0.75f); + Main.dust[num469].velocity *= 0f; + } + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 200f && projectile.ai[1] > 40f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); + } + } + } +} diff --git a/Projectiles/Enemy/HorsWaterBlast.cs b/Projectiles/Enemy/HorsWaterBlast.cs index 43c2ce8391..6c86b13a06 100644 --- a/Projectiles/Enemy/HorsWaterBlast.cs +++ b/Projectiles/Enemy/HorsWaterBlast.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class HorsWaterBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 20; 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - for (int num457 = 0; num457 < 10; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - for (int dust = 0; dust <= 40; dust++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.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; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Wet, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorsWaterBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 20; 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; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + for (int num457 = 0; num457 < 10; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + for (int dust = 0; dust <= 40; dust++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.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; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Wet, 300); + } + } +} diff --git a/Projectiles/Enemy/InkBomb.cs b/Projectiles/Enemy/InkBomb.cs index 431c14a162..e51745a367 100644 --- a/Projectiles/Enemy/InkBomb.cs +++ b/Projectiles/Enemy/InkBomb.cs @@ -1,96 +1,96 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class InkBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) - { - projectile.ai[0] = 10f; - 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.01f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 28); - int num251 = Main.rand.Next(5, 8); - if (projectile.owner == Main.myPlayer) - { - int num320 = Main.rand.Next(15, 21); - int num3; - for (int num321 = 0; num321 < num320; num321 = num3 + 1) - { - Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("InkPoisonCloud") + Main.rand.Next(3), (int)((double)projectile.damage * 0.66), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); - num3 = num321; - } - } - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 60; - 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 num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 54, 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 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 109, 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, 109, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); - projectile.Kill(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class InkBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 10f) + { + projectile.ai[0] = 10f; + 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.01f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 28); + int num251 = Main.rand.Next(5, 8); + if (projectile.owner == Main.myPlayer) + { + int num320 = Main.rand.Next(15, 21); + int num3; + for (int num321 = 0; num321 < num320; num321 = num3 + 1) + { + Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector15.Normalize(); + vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("InkPoisonCloud") + Main.rand.Next(3), (int)((double)projectile.damage * 0.66), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + num3 = num321; + } + } + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 60; + 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 num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 54, 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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 109, 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, 109, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Darkness, 600, true); + projectile.Kill(); + } + } +} diff --git a/Projectiles/Enemy/InkPoisonCloud.cs b/Projectiles/Enemy/InkPoisonCloud.cs index 93ae345bf7..0d63dac07b 100644 --- a/Projectiles/Enemy/InkPoisonCloud.cs +++ b/Projectiles/Enemy/InkPoisonCloud.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class InkPoisonCloud : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.99f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class InkPoisonCloud : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity *= 0.99f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Darkness, 600, true); + } + } +} diff --git a/Projectiles/Enemy/InkPoisonCloud2.cs b/Projectiles/Enemy/InkPoisonCloud2.cs index eadb29fb05..a0ed7a5b51 100644 --- a/Projectiles/Enemy/InkPoisonCloud2.cs +++ b/Projectiles/Enemy/InkPoisonCloud2.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class InkPoisonCloud2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.995f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class InkPoisonCloud2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity *= 0.995f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Darkness, 600, true); + } + } +} diff --git a/Projectiles/Enemy/InkPoisonCloud3.cs b/Projectiles/Enemy/InkPoisonCloud3.cs index ecc450f021..8ecd56d72c 100644 --- a/Projectiles/Enemy/InkPoisonCloud3.cs +++ b/Projectiles/Enemy/InkPoisonCloud3.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class InkPoisonCloud3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.999f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class InkPoisonCloud3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity *= 0.999f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Darkness, 600, true); + } + } +} diff --git a/Projectiles/Enemy/LavaChunk.cs b/Projectiles/Enemy/LavaChunk.cs index 2b2b07a052..06f93cc552 100644 --- a/Projectiles/Enemy/LavaChunk.cs +++ b/Projectiles/Enemy/LavaChunk.cs @@ -1,99 +1,99 @@ -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.Enemy -{ - public class LavaChunk : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lava Chunk"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.hostile = true; - projectile.timeLeft = 360; - projectile.penetrate = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - if (projectile.localAI[1] < 1f) - { - projectile.localAI[1] += 0.002f; - projectile.scale -= 0.002f; - projectile.width = (int)(18f * projectile.scale); - projectile.height = (int)(18f * projectile.scale); - } - else - { - projectile.Kill(); - } - if (projectile.scale > 0.25f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num248 = 0f; - if (num246 == 1) - { - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), projectile.scale); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), projectile.scale * 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - else - { - projectile.damage = 0; - } - if (projectile.velocity.Y < 6f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.05f; - } - if (projectile.wet) - { - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; - } - if (projectile.velocity.Y < 0.5f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.01f; - } - } - } - - 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 +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.Enemy +{ + public class LavaChunk : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lava Chunk"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.hostile = true; + projectile.timeLeft = 360; + projectile.penetrate = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + if (projectile.localAI[1] < 1f) + { + projectile.localAI[1] += 0.002f; + projectile.scale -= 0.002f; + projectile.width = (int)(18f * projectile.scale); + projectile.height = (int)(18f * projectile.scale); + } + else + { + projectile.Kill(); + } + if (projectile.scale > 0.25f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num248 = 0f; + if (num246 == 1) + { + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), projectile.scale); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), projectile.scale * 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + else + { + projectile.damage = 0; + } + if (projectile.velocity.Y < 6f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.05f; + } + if (projectile.wet) + { + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.98f; + } + if (projectile.velocity.Y < 0.5f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.01f; + } + } + } + + 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; + } + } +} diff --git a/Projectiles/Enemy/PufferExplosion.cs b/Projectiles/Enemy/PufferExplosion.cs index d9067ca1e8..a0b57459c2 100644 --- a/Projectiles/Enemy/PufferExplosion.cs +++ b/Projectiles/Enemy/PufferExplosion.cs @@ -1,97 +1,97 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class PufferExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 210; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - 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); - 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, 235, 0f, 0f, 100, default(Color), 1.5f); - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class PufferExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 250; + projectile.height = 250; + projectile.friendly = true; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 210; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + 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); + 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, 235, 0f, 0f, 100, default(Color), 1.5f); + 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++; + } + } + } +} diff --git a/Projectiles/Enemy/StormMarkHostile.cs b/Projectiles/Enemy/StormMarkHostile.cs index 9c807e8b01..22ecc70f9e 100644 --- a/Projectiles/Enemy/StormMarkHostile.cs +++ b/Projectiles/Enemy/StormMarkHostile.cs @@ -1,163 +1,163 @@ -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.Enemy -{ - public class StormMarkHostile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - } - - public override void AI() - { - Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); - } - if (projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default(Color), 0.5f)]; - dust34.position = position4; - dust34.customData = projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.localAI[1] > 103f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 16; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default(Vector2)); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) - { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) - { - int num1137 = 40; - if (Main.expertMode) - { - num1137 = 25; - } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("TornadoHostile"), num1137, 3f, projectile.owner, 0f, 0f); - } - if (projectile.localAI[1] >= 120f) - { - projectile.Kill(); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); - return false; - } - } -} \ No newline at end of file +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.Enemy +{ + public class StormMarkHostile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.timeLeft = 900; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = -1; + } + + public override void AI() + { + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + for (int num1134 = 0; num1134 < 1; num1134++) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default(Color), 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default(Vector2)); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + int num1137 = 40; + if (Main.expertMode) + { + num1137 = 25; + } + Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("TornadoHostile"), num1137, 3f, projectile.owner, 0f, 0f); + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Enemy/SulphuricAcidCannon.cs b/Projectiles/Enemy/SulphuricAcidCannon.cs index 40a4185519..ae044ef45f 100644 --- a/Projectiles/Enemy/SulphuricAcidCannon.cs +++ b/Projectiles/Enemy/SulphuricAcidCannon.cs @@ -1,133 +1,133 @@ -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.Enemy -{ - public class SulphuricAcidCannon : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Bubble"); - Main.projFrames[projectile.type] = 7; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 0.01f; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.timeLeft = 360; - projectile.penetrate = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 6) - { - projectile.frame = 0; - } - if (projectile.localAI[1] < 1f) - { - projectile.localAI[1] += 0.01f; - projectile.scale += 0.01f; - projectile.width = (int)(30f * projectile.scale); - projectile.height = (int)(30f * projectile.scale); - } - else - { - projectile.damage = 20; - projectile.width = 30; - projectile.height = 30; - projectile.tileCollide = true; - } - if (projectile.localAI[0] > 2f) - { - projectile.alpha -= 20; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - else - { - projectile.localAI[0] += 1f; - } - if (projectile.ai[1] > 30f) - { - if (projectile.velocity.Y > -2f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - } - else - { - projectile.ai[1] += 1f; - } - if (projectile.wet) - { - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; - } - if (projectile.velocity.Y > -1f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - } - } - - 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 OnHitPlayer(Player target, int damage, bool crit) - { - if (projectile.localAI[1] < 1f) - { - return; - } - target.AddBuff(BuffID.Venom, 120); - projectile.Kill(); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item54, projectile.position); - 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); - int num3; - for (int num246 = 0; num246 < 25; num246 = num3 + 1) - { - int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 0, default(Color), 1f); - Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; - Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - Main.dust[num247].velocity.Normalize(); - Dust dust = Main.dust[num247]; - dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = projectile.alpha; - num3 = num246; - } - } - } -} \ No newline at end of file +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.Enemy +{ + public class SulphuricAcidCannon : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Bubble"); + Main.projFrames[projectile.type] = 7; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.scale = 0.01f; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.timeLeft = 360; + projectile.penetrate = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 6) + { + projectile.frame = 0; + } + if (projectile.localAI[1] < 1f) + { + projectile.localAI[1] += 0.01f; + projectile.scale += 0.01f; + projectile.width = (int)(30f * projectile.scale); + projectile.height = (int)(30f * projectile.scale); + } + else + { + projectile.damage = 20; + projectile.width = 30; + projectile.height = 30; + projectile.tileCollide = true; + } + if (projectile.localAI[0] > 2f) + { + projectile.alpha -= 20; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + else + { + projectile.localAI[0] += 1f; + } + if (projectile.ai[1] > 30f) + { + if (projectile.velocity.Y > -2f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + } + else + { + projectile.ai[1] += 1f; + } + if (projectile.wet) + { + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.98f; + } + if (projectile.velocity.Y > -1f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + } + } + + 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 OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.localAI[1] < 1f) + { + return; + } + target.AddBuff(BuffID.Venom, 120); + projectile.Kill(); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item54, projectile.position); + 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); + int num3; + for (int num246 = 0; num246 < 25; num246 = num3 + 1) + { + int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 0, default(Color), 1f); + Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; + Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[num247].velocity.Normalize(); + Dust dust = Main.dust[num247]; + dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; + Main.dust[num247].alpha = projectile.alpha; + num3 = num246; + } + } + } +} diff --git a/Projectiles/Enemy/SulphuricAcidMist.cs b/Projectiles/Enemy/SulphuricAcidMist.cs index bd5ffa7042..300a193186 100644 --- a/Projectiles/Enemy/SulphuricAcidMist.cs +++ b/Projectiles/Enemy/SulphuricAcidMist.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class SulphuricAcidMist : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Mist"); - Main.projFrames[projectile.type] = 10; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 9) - { - projectile.frame = 0; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111); - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 180f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class SulphuricAcidMist : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Mist"); + Main.projFrames[projectile.type] = 10; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 9) + { + projectile.frame = 0; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111); + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 180f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 120); + } + } +} diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index 05fbd8f8c6..dd013a4b65 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -1,171 +1,171 @@ -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.Enemy -{ - public class TornadoHostile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tornado"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.hostile = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - } - - public override void AI() - { - float num1125 = 600f; - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 122); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) - { - projectile.Kill(); - } - if (projectile.localAI[0] >= 30f) - { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) - { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; - } - } - float num1127 = 15f; - float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) - { - bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) - { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) - { - flag74 = true; - break; - } - } - if (!flag74 && projectile.ai[0] < num1125 - 120f) - { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; - } - } - if (projectile.ai[0] < num1125 - 120f) - { - for (int num1133 = 0; num1133 < 1; num1133++) - { - float value75 = -0.5f; - float value76 = 0.9f; - float amount3 = Main.rand.NextFloat(); - Vector2 value77 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value75, value76, amount3)); - value77.X *= MathHelper.Lerp(2.2f, 0.6f, amount3); - value77.X *= -1f; - Vector2 value78 = new Vector2(6f, 10f); - Vector2 position3 = vector146 + value74 * value77 * 0.5f + value78; - Dust dust33 = Main.dust[Dust.NewDust(position3, 0, 0, 16, 0f, 0f, 0, default(Color), 1.5f)]; - dust33.position = position3; - dust33.customData = vector146 + value78; - dust33.fadeIn = 1f; - dust33.scale = 0.3f; - if (value77.X > -1.2f) - { - dust33.velocity.X = 1f + Main.rand.NextFloat(); - } - dust33.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - float num226 = 600f; - float num227 = 15f; - float num228 = 15f; - float num229 = projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) - { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); - } - Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default(Vector2)); - float num234 = 0f; - float num235 = 5.1f; - Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 225); - for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) - { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default(Vector2)); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) - { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); - } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); - } - return false; - } - } -} \ No newline at end of file +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.Enemy +{ + public class TornadoHostile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tornado"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 1200; + } + + public override void AI() + { + float num1125 = 600f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 122); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= num1125) + { + projectile.Kill(); + } + if (projectile.localAI[0] >= 30f) + { + projectile.damage = 0; + if (projectile.ai[0] < num1125 - 120f) + { + float num1126 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1126; + projectile.netUpdate = true; + } + } + float num1127 = 15f; + float num1128 = 15f; + Point point8 = projectile.Center.ToTileCoordinates(); + int num1129; + int num1130; + Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); + num1129++; + num1130--; + Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); + Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); + Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); + Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); + value74.X = value74.Y * 0.2f; + projectile.width = (int)(value74.X * 0.65f); + projectile.height = (int)value74.Y; + projectile.Center = vector146; + if (projectile.owner == Main.myPlayer) + { + bool flag74 = false; + Vector2 center16 = Main.player[projectile.owner].Center; + Vector2 top = Main.player[projectile.owner].Top; + for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + { + Vector2 position2 = Vector2.Lerp(value72, value73, num1131); + if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + { + flag74 = true; + break; + } + } + if (!flag74 && projectile.ai[0] < num1125 - 120f) + { + float num1132 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1132; + projectile.netUpdate = true; + } + } + if (projectile.ai[0] < num1125 - 120f) + { + for (int num1133 = 0; num1133 < 1; num1133++) + { + float value75 = -0.5f; + float value76 = 0.9f; + float amount3 = Main.rand.NextFloat(); + Vector2 value77 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value75, value76, amount3)); + value77.X *= MathHelper.Lerp(2.2f, 0.6f, amount3); + value77.X *= -1f; + Vector2 value78 = new Vector2(6f, 10f); + Vector2 position3 = vector146 + value74 * value77 * 0.5f + value78; + Dust dust33 = Main.dust[Dust.NewDust(position3, 0, 0, 16, 0f, 0f, 0, default(Color), 1.5f)]; + dust33.position = position3; + dust33.customData = vector146 + value78; + dust33.fadeIn = 1f; + dust33.scale = 0.3f; + if (value77.X > -1.2f) + { + dust33.velocity.X = 1f + Main.rand.NextFloat(); + } + dust33.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + float num226 = 600f; + float num227 = 15f; + float num228 = 15f; + float num229 = projectile.ai[0]; + float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); + if (num229 > num226 - 60f) + { + scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + } + Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); + int num230; + int num231; + Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); + num230++; + num231--; + float num232 = 0.2f; + Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); + Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); + Vector2.Lerp(value32, value33, 0.5f); + Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); + vector33.X = vector33.Y * num232; + new Vector2(value32.X - vector33.X / 2f, value32.Y); + Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); + Vector2 origin3 = rectangle9.Size() / 2f; + float num233 = -0.06283186f * num229; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default(Vector2)); + float num234 = 0f; + float num235 = 5.1f; + Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 225); + for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) + { + num234 += num235; + float num237 = num234 / vector33.Y; + float num238 = num234 * 6.28318548f / -20f; + float num239 = num237 - 0.15f; + Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default(Vector2)); + Vector2 value35 = new Vector2(0f, num237 + 1f); + value35.X = value35.Y * num232; + Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); + if (num237 > 0.5f) + { + color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + } + color39.A = (byte)((float)color39.A * 0.5f); + color39 *= scale5; + vector34 *= value35 * 100f; + vector34.Y = 0f; + vector34.X = 0f; + vector34 += new Vector2(value33.X, num236) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); + } + return false; + } + } +} diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index 60c76d07bc..fe119fb0a9 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class ToxicMinnowCloud : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.hostile = true; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 7; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if(Main.rand.Next(2) == 0) - { - projectile.velocity *= 0.95f; - } - else if(Main.rand.Next(2) == 0) - { - projectile.velocity *= 0.90f; - } - else if(Main.rand.Next(2) == 0) - { - projectile.velocity *= 0.85f; - } - else - { - projectile.velocity *= 0.80f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 1500f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Poisoned, 600); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class ToxicMinnowCloud : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 7; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if(Main.rand.Next(2) == 0) + { + projectile.velocity *= 0.95f; + } + else if(Main.rand.Next(2) == 0) + { + projectile.velocity *= 0.90f; + } + else if(Main.rand.Next(2) == 0) + { + projectile.velocity *= 0.85f; + } + else + { + projectile.velocity *= 0.80f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 1500f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 600); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 600); + } + } +} diff --git a/Projectiles/Healing/AtaxiaHealOrb.cs b/Projectiles/Healing/AtaxiaHealOrb.cs index d57b957093..f107a353e2 100644 --- a/Projectiles/Healing/AtaxiaHealOrb.cs +++ b/Projectiles/Healing/AtaxiaHealOrb.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class AtaxiaHealOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Heal Orb"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 240; - projectile.extraUpdates = 3; - } - - public override void AI() - { - int num487 = (int)projectile.ai[0]; - float num488 = 5.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 2f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class AtaxiaHealOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Heal Orb"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 240; + projectile.extraUpdates = 3; + } + + public override void AI() + { + int num487 = (int)projectile.ai[0]; + float num488 = 5.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 2f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + return; + } + } +} diff --git a/Projectiles/Healing/AuricOrb.cs b/Projectiles/Healing/AuricOrb.cs index 632725c534..1229a57fd0 100644 --- a/Projectiles/Healing/AuricOrb.cs +++ b/Projectiles/Healing/AuricOrb.cs @@ -1,93 +1,93 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class AuricOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Auric Orb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 360; - projectile.extraUpdates = 3; - projectile.light = 0.2f; - } - - public override void AI() - { - projectile.alpha -= 2; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) - { - projectile.localAI[0] = 0f; - } - } - int num487 = (int)projectile.ai[0]; - float num488 = 6f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - return; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - for (int num407 = 0; num407 < 5; num407++) - { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(255, Main.DiscoG, 53), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 1.5f; - Main.dust[num408].scale = 1.5f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class AuricOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Orb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 360; + projectile.extraUpdates = 3; + projectile.light = 0.2f; + } + + public override void AI() + { + projectile.alpha -= 2; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.05f; + if ((double)projectile.scale > 1.2) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.scale -= 0.05f; + if ((double)projectile.scale < 0.8) + { + projectile.localAI[0] = 0f; + } + } + int num487 = (int)projectile.ai[0]; + float num488 = 6f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + return; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + for (int num407 = 0; num407 < 5; num407++) + { + int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(255, Main.DiscoG, 53), 1f); + Main.dust[num408].noGravity = true; + Main.dust[num408].velocity *= 1.5f; + Main.dust[num408].scale = 1.5f; + } + } + } +} diff --git a/Projectiles/Healing/BurntSienna.cs b/Projectiles/Healing/BurntSienna.cs index da02d60560..9c19b34454 100644 --- a/Projectiles/Healing/BurntSienna.cs +++ b/Projectiles/Healing/BurntSienna.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class BurntSienna : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sienna"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - int num487 = (int)projectile.ai[0]; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = 3; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class BurntSienna : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sienna"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.95f; + int num487 = (int)projectile.ai[0]; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = 3; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + } + } +} diff --git a/Projectiles/Healing/CactusHealOrb.cs b/Projectiles/Healing/CactusHealOrb.cs index 91f343567e..d7ddfaf998 100644 --- a/Projectiles/Healing/CactusHealOrb.cs +++ b/Projectiles/Healing/CactusHealOrb.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class CactusHealOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.velocity.Y *= 0.985f; - int num487 = projectile.owner; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = 15; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - float num498 = projectile.velocity.X * 0.2f * 1f; - float num499 = -(projectile.velocity.Y * 0.2f) * 1f; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 200, 0), 1.5f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class CactusHealOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.velocity.Y *= 0.985f; + int num487 = projectile.owner; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = 15; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + float num498 = projectile.velocity.X * 0.2f * 1f; + float num499 = -(projectile.velocity.Y * 0.2f) * 1f; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 200, 0), 1.5f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + return; + } + } +} diff --git a/Projectiles/Healing/EarthHealOrb.cs b/Projectiles/Healing/EarthHealOrb.cs index 7d95b6fafb..65627441eb 100644 --- a/Projectiles/Healing/EarthHealOrb.cs +++ b/Projectiles/Healing/EarthHealOrb.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class EarthHealOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.extraUpdates = 3; - } - - public override void AI() - { - int num487 = (int)projectile.ai[0]; - float num488 = 8f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default(Color), 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class EarthHealOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.extraUpdates = 3; + } + + public override void AI() + { + int num487 = (int)projectile.ai[0]; + float num488 = 8f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default(Color), 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + return; + } + } +} diff --git a/Projectiles/Healing/EssenceFlame.cs b/Projectiles/Healing/EssenceFlame.cs index a7ec0e42ff..59fec2eee3 100644 --- a/Projectiles/Healing/EssenceFlame.cs +++ b/Projectiles/Healing/EssenceFlame.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class EssenceFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.extraUpdates = 3; - } - - public override void AI() - { - projectile.alpha -= 5; - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - int num487 = (int)projectile.ai[0]; - float num488 = 3.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = 8; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - return; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class EssenceFlame : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + projectile.alpha = 255; + projectile.extraUpdates = 3; + } + + public override void AI() + { + projectile.alpha -= 5; + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + int num487 = (int)projectile.ai[0]; + float num488 = 3.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = 8; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + return; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Healing/Exoheal.cs b/Projectiles/Healing/Exoheal.cs index 8919dd56a7..3b14401148 100644 --- a/Projectiles/Healing/Exoheal.cs +++ b/Projectiles/Healing/Exoheal.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class Exoheal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.extraUpdates = 3; - } - - public override void AI() - { - int num487 = (int)projectile.ai[0]; - float num488 = 8f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class Exoheal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.extraUpdates = 3; + } + + public override void AI() + { + int num487 = (int)projectile.ai[0]; + float num488 = 8f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + return; + } + } +} diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index b435bfc5d3..9ae0d70d0a 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Projectiles.Healing -{ - public class FungalHeal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.extraUpdates = 10; - projectile.timeLeft = 300; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - 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].GetGlobalItem(mod).rogue) || - player.inventory[player.selectedItem].hammer > 0 || - player.inventory[player.selectedItem].pick > 0 || - player.inventory[player.selectedItem].axe > 0) - { - projectile.timeLeft = 600; - } - projectile.localAI[0] += 1f; - } - int num487 = (int)projectile.ai[0]; - float num488 = 5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 9f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 9f + num490) / 16f; - float num494 = projectile.velocity.X * 0.334f; - float num495 = -(projectile.velocity.Y * 0.334f); - int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num496].noGravity = true; - Main.dust[num496].velocity *= 0f; - Dust expr_153E2_cp_0 = Main.dust[num496]; - expr_153E2_cp_0.position.X = expr_153E2_cp_0.position.X - num494; - Dust expr_15401_cp_0 = Main.dust[num496]; - expr_15401_cp_0.position.Y = expr_15401_cp_0.position.Y - num495; - float num498 = projectile.velocity.X * 0.2f; - float num499 = -(projectile.velocity.Y * 0.2f); - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default(Color), 0.7f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Projectiles.Healing +{ + public class FungalHeal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.extraUpdates = 10; + projectile.timeLeft = 300; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + 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].GetGlobalItem(mod).rogue) || + player.inventory[player.selectedItem].hammer > 0 || + player.inventory[player.selectedItem].pick > 0 || + player.inventory[player.selectedItem].axe > 0) + { + projectile.timeLeft = 600; + } + projectile.localAI[0] += 1f; + } + int num487 = (int)projectile.ai[0]; + float num488 = 5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 9f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 9f + num490) / 16f; + float num494 = projectile.velocity.X * 0.334f; + float num495 = -(projectile.velocity.Y * 0.334f); + int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num496].noGravity = true; + Main.dust[num496].velocity *= 0f; + Dust expr_153E2_cp_0 = Main.dust[num496]; + expr_153E2_cp_0.position.X = expr_153E2_cp_0.position.X - num494; + Dust expr_15401_cp_0 = Main.dust[num496]; + expr_15401_cp_0.position.Y = expr_15401_cp_0.position.Y - num495; + float num498 = projectile.velocity.X * 0.2f; + float num499 = -(projectile.velocity.Y * 0.2f); + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default(Color), 0.7f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + } +} diff --git a/Projectiles/Healing/GodSlayerHealOrb.cs b/Projectiles/Healing/GodSlayerHealOrb.cs index 8fb02621a8..d432500818 100644 --- a/Projectiles/Healing/GodSlayerHealOrb.cs +++ b/Projectiles/Healing/GodSlayerHealOrb.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class GodSlayerHealOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Heal Orb"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 240; - projectile.extraUpdates = 3; - } - - public override void AI() - { - int num487 = (int)projectile.ai[0]; - float num488 = 6.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class GodSlayerHealOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Heal Orb"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 240; + projectile.extraUpdates = 3; + } + + public override void AI() + { + int num487 = (int)projectile.ai[0]; + float num488 = 6.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + return; + } + } +} diff --git a/Projectiles/Healing/PhoenixHeal.cs b/Projectiles/Healing/PhoenixHeal.cs index 92dc2ffbc8..68565e4d21 100644 --- a/Projectiles/Healing/PhoenixHeal.cs +++ b/Projectiles/Healing/PhoenixHeal.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class PhoenixHeal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 420; - projectile.extraUpdates = 3; - } - - public override void AI() - { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - int num487 = (int)projectile.ai[0]; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = 10; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class PhoenixHeal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 420; + projectile.extraUpdates = 3; + } + + public override void AI() + { + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.95f; + int num487 = (int)projectile.ai[0]; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = 10; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + return; + } + } +} diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index c2b09e735a..840d03a4d7 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -1,64 +1,64 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class RainHeal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - int num487 = projectile.owner; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = 8; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - float num498 = projectile.velocity.X * 0.2f * 1f; - float num499 = -(projectile.velocity.Y * 0.2f) * 1f; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class RainHeal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + int num487 = projectile.owner; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = 8; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + float num498 = projectile.velocity.X * 0.2f * 1f; + float num499 = -(projectile.velocity.Y * 0.2f) * 1f; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + return; + } + } +} diff --git a/Projectiles/Healing/RoyalHeal.cs b/Projectiles/Healing/RoyalHeal.cs index 32a7367002..7dad500e26 100644 --- a/Projectiles/Healing/RoyalHeal.cs +++ b/Projectiles/Healing/RoyalHeal.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class RoyalHeal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.extraUpdates = 10; - } - - public override void AI() - { - int num487 = (int)projectile.ai[0]; - float num488 = 5.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num493 = 0; num493 < 3; num493++) - { - float num494 = projectile.velocity.X * 0.334f * (float)num493; - float num495 = -(projectile.velocity.Y * 0.334f) * (float)num493; - int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default(Color), 1.1f); - Main.dust[num496].noGravity = true; - Main.dust[num496].velocity *= 0f; - Dust expr_153E2_cp_0 = Main.dust[num496]; - expr_153E2_cp_0.position.X = expr_153E2_cp_0.position.X - num494; - Dust expr_15401_cp_0 = Main.dust[num496]; - expr_15401_cp_0.position.Y = expr_15401_cp_0.position.Y - num495; - } - for (int num497 = 0; num497 < 5; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default(Color), 1.3f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class RoyalHeal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.extraUpdates = 10; + } + + public override void AI() + { + int num487 = (int)projectile.ai[0]; + float num488 = 5.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num493 = 0; num493 < 3; num493++) + { + float num494 = projectile.velocity.X * 0.334f * (float)num493; + float num495 = -(projectile.velocity.Y * 0.334f) * (float)num493; + int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default(Color), 1.1f); + Main.dust[num496].noGravity = true; + Main.dust[num496].velocity *= 0f; + Dust expr_153E2_cp_0 = Main.dust[num496]; + expr_153E2_cp_0.position.X = expr_153E2_cp_0.position.X - num494; + Dust expr_15401_cp_0 = Main.dust[num496]; + expr_15401_cp_0.position.Y = expr_15401_cp_0.position.Y - num495; + } + for (int num497 = 0; num497 < 5; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default(Color), 1.3f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + } + } +} diff --git a/Projectiles/Healing/SilvaOrb.cs b/Projectiles/Healing/SilvaOrb.cs index f5a49f64ed..1cd6a2fb4a 100644 --- a/Projectiles/Healing/SilvaOrb.cs +++ b/Projectiles/Healing/SilvaOrb.cs @@ -1,93 +1,93 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class SilvaOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Orb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.extraUpdates = 3; - projectile.light = 0.2f; - } - - public override void AI() - { - projectile.alpha -= 2; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) - { - projectile.localAI[0] = 0f; - } - } - int num487 = (int)projectile.ai[0]; - float num488 = 6f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - return; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - for (int num407 = 0; num407 < 5; num407++) - { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 1.5f; - Main.dust[num408].scale = 1.5f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class SilvaOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Orb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.extraUpdates = 3; + projectile.light = 0.2f; + } + + public override void AI() + { + projectile.alpha -= 2; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.05f; + if ((double)projectile.scale > 1.2) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.scale -= 0.05f; + if ((double)projectile.scale < 0.8) + { + projectile.localAI[0] = 0f; + } + } + int num487 = (int)projectile.ai[0]; + float num488 = 6f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + return; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 203, 103, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + for (int num407 = 0; num407 < 5; num407++) + { + int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num408].noGravity = true; + Main.dust[num408].velocity *= 1.5f; + Main.dust[num408].scale = 1.5f; + } + } + } +} diff --git a/Projectiles/Healing/Terracotta.cs b/Projectiles/Healing/Terracotta.cs index 1927ac3b92..29a8eca639 100644 --- a/Projectiles/Healing/Terracotta.cs +++ b/Projectiles/Healing/Terracotta.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class Terracotta : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 360; - } - - public override void AI() - { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - int num487 = (int)projectile.ai[0]; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 25f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer) - { - int num492 = 9; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 1f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - return; - } - - public override void Kill(int timeLeft) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class Terracotta : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 360; + } + + public override void AI() + { + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.95f; + int num487 = (int)projectile.ai[0]; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 25f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer) + { + int num492 = 9; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 1f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + return; + } + + public override void Kill(int timeLeft) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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; + } + } + } + } +} diff --git a/Projectiles/Healing/TransfusionTrail.cs b/Projectiles/Healing/TransfusionTrail.cs index 3e14c885e7..3002bfbed8 100644 --- a/Projectiles/Healing/TransfusionTrail.cs +++ b/Projectiles/Healing/TransfusionTrail.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class TransfusionTrail : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.extraUpdates = 10; - } - - public override void AI() - { - int num487 = (int)projectile.ai[0]; - float num488 = 6.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 9f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 9f + num490) / 16f; - for (int num493 = 0; num493 < 1; num493++) - { - float num494 = projectile.velocity.X * 0.334f * (float)num493; - float num495 = -(projectile.velocity.Y * 0.334f) * (float)num493; - int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default(Color), 0.7f); - Main.dust[num496].noGravity = true; - Main.dust[num496].velocity *= 0f; - Dust expr_153E2_cp_0 = Main.dust[num496]; - expr_153E2_cp_0.position.X = expr_153E2_cp_0.position.X - num494; - Dust expr_15401_cp_0 = Main.dust[num496]; - expr_15401_cp_0.position.Y = expr_15401_cp_0.position.Y - num495; - } - for (int num497 = 0; num497 < 2; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default(Color), 0.9f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class TransfusionTrail : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.extraUpdates = 10; + } + + public override void AI() + { + int num487 = (int)projectile.ai[0]; + float num488 = 6.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 9f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 9f + num490) / 16f; + for (int num493 = 0; num493 < 1; num493++) + { + float num494 = projectile.velocity.X * 0.334f * (float)num493; + float num495 = -(projectile.velocity.Y * 0.334f) * (float)num493; + int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default(Color), 0.7f); + Main.dust[num496].noGravity = true; + Main.dust[num496].velocity *= 0f; + Dust expr_153E2_cp_0 = Main.dust[num496]; + expr_153E2_cp_0.position.X = expr_153E2_cp_0.position.X - num494; + Dust expr_15401_cp_0 = Main.dust[num496]; + expr_15401_cp_0.position.Y = expr_15401_cp_0.position.Y - num495; + } + for (int num497 = 0; num497 < 2; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default(Color), 0.9f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + } + } +} diff --git a/Projectiles/Healing/XerocHealOrb.cs b/Projectiles/Healing/XerocHealOrb.cs index c8eae27cef..9f18ae8e76 100644 --- a/Projectiles/Healing/XerocHealOrb.cs +++ b/Projectiles/Healing/XerocHealOrb.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class XerocHealOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heal"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 240; - projectile.extraUpdates = 3; - } - - public override void AI() - { - int num487 = (int)projectile.ai[0]; - float num488 = 5.5f; - Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int num492 = (int)projectile.ai[1]; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) - { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; - } - NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - num491 = num488 / num491; - num489 *= num491; - num490 *= num491; - projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; - for (int num497 = 0; num497 < 1; num497++) - { - float num498 = projectile.velocity.X * 0.2f * (float)num497; - float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 2f); - Main.dust[num500].noGravity = true; - Main.dust[num500].velocity *= 0f; - Dust expr_154F9_cp_0 = Main.dust[num500]; - expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; - Dust expr_15518_cp_0 = Main.dust[num500]; - expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; - } - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class XerocHealOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 240; + projectile.extraUpdates = 3; + } + + public override void AI() + { + int num487 = (int)projectile.ai[0]; + float num488 = 5.5f; + Vector2 vector36 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num489 = Main.player[num487].Center.X - vector36.X; + float num490 = Main.player[num487].Center.Y - vector36.Y; + float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); + if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && projectile.position.X + (float)projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && projectile.position.Y + (float)projectile.height > Main.player[num487].position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int num492 = (int)projectile.ai[1]; + Main.player[num487].HealEffect(num492, false); + Main.player[num487].statLife += num492; + if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + { + Main.player[num487].statLife = Main.player[num487].statLifeMax2; + } + NetMessage.SendData(66, -1, -1, null, num487, (float)num492, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + num491 = num488 / num491; + num489 *= num491; + num490 *= num491; + projectile.velocity.X = (projectile.velocity.X * 15f + num489) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num490) / 16f; + for (int num497 = 0; num497 < 1; num497++) + { + float num498 = projectile.velocity.X * 0.2f * (float)num497; + float num499 = -(projectile.velocity.Y * 0.2f) * (float)num497; + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 2f); + Main.dust[num500].noGravity = true; + Main.dust[num500].velocity *= 0f; + Dust expr_154F9_cp_0 = Main.dust[num500]; + expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; + Dust expr_15518_cp_0 = Main.dust[num500]; + expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; + } + return; + } + } +} diff --git a/Projectiles/Magic/AbyssBall.cs b/Projectiles/Magic/AbyssBall.cs index 642addd4b0..066dccac29 100644 --- a/Projectiles/Magic/AbyssBall.cs +++ b/Projectiles/Magic/AbyssBall.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class AbyssBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Ball"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.alpha = 60; - projectile.penetrate = 2; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - - public override void Kill(int timeLeft) - { - 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 = 150; - projectile.height = 150; - 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 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.7f); - 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, 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) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class AbyssBall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Ball"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.alpha = 60; + projectile.penetrate = 2; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + public override void Kill(int timeLeft) + { + 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 = 150; + projectile.height = 150; + 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 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.7f); + 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, 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) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/AetherBeam.cs b/Projectiles/Magic/AetherBeam.cs index 087ebc26b5..5c78cc816a 100644 --- a/Projectiles/Magic/AetherBeam.cs +++ b/Projectiles/Magic/AetherBeam.cs @@ -1,145 +1,145 @@ -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 AetherBeam : ModProjectile - { - private bool split = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.timeLeft = 300; - } - - public override void AI() - { - if (projectile.ai[0] == 1f) - { - 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) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f, 0f, 0.7f); - float num55 = 100f; - float num56 = 2f; //3 - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 200, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 2f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (split) - { - 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) - { - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 60); - target.AddBuff(BuffID.Ichor, 120); - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Poisoned, 300); - } - } -} \ No newline at end of file +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 AetherBeam : ModProjectile + { + private bool split = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.magic = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 5; + projectile.timeLeft = 300; + } + + public override void AI() + { + if (projectile.ai[0] == 1f) + { + 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) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f, 0f, 0.7f); + float num55 = 100f; + float num56 = 2f; //3 + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 200, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 2f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (split) + { + 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) + { + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 60); + target.AddBuff(BuffID.Ichor, 120); + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.Poisoned, 300); + } + } +} diff --git a/Projectiles/Magic/Ancient.cs b/Projectiles/Magic/Ancient.cs index 6264d90b58..83fe8f21e9 100644 --- a/Projectiles/Magic/Ancient.cs +++ b/Projectiles/Magic/Ancient.cs @@ -1,126 +1,126 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class Ancient : ModProjectile - { - public int addDustTimer = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.penetrate = 5; - projectile.extraUpdates = 6; - projectile.timeLeft = 151; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.6f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - addDustTimer++; - if (addDustTimer >= 30) - { - int numProj = 2; - int randomSpread = Main.rand.Next(3, 19); - float rotation = MathHelper.ToRadians(randomSpread); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Ancient2"), (int)((double)projectile.damage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - addDustTimer = 0; - } - if (projectile.timeLeft > 151) - { - projectile.timeLeft = 151; - } - if (projectile.ai[0] > 4f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 32; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(2) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 2f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 6f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 6f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 3f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 3f; - Main.dust[num299].scale *= num296; - } - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 4f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 4f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 4f; - } - else - { - Main.dust[num299].scale *= 2.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Ancient : ModProjectile + { + public int addDustTimer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.penetrate = 5; + projectile.extraUpdates = 6; + projectile.timeLeft = 151; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.6f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + addDustTimer++; + if (addDustTimer >= 30) + { + int numProj = 2; + int randomSpread = Main.rand.Next(3, 19); + float rotation = MathHelper.ToRadians(randomSpread); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Ancient2"), (int)((double)projectile.damage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + addDustTimer = 0; + } + if (projectile.timeLeft > 151) + { + projectile.timeLeft = 151; + } + if (projectile.ai[0] > 4f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 32; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(2) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 2f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 6f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 6f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 3f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 3f; + Main.dust[num299].scale *= num296; + } + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 4f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 4f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 4f; + } + else + { + Main.dust[num299].scale *= 2.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + } +} diff --git a/Projectiles/Magic/Ancient2.cs b/Projectiles/Magic/Ancient2.cs index 9108a8efbc..8d863f7b4f 100644 --- a/Projectiles/Magic/Ancient2.cs +++ b/Projectiles/Magic/Ancient2.cs @@ -1,103 +1,103 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class Ancient2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 3; - projectile.extraUpdates = 12; - projectile.timeLeft = 30; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.6f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 32; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(2) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 3f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 3f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 2f; - Main.dust[num299].scale *= num296; - } - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 2f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Ancient2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.penetrate = 3; + projectile.extraUpdates = 12; + projectile.timeLeft = 30; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.6f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 32; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(2) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 3f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 3f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 2f; + Main.dust[num299].scale *= num296; + } + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 2f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + } +} diff --git a/Projectiles/Magic/ApothChloro.cs b/Projectiles/Magic/ApothChloro.cs index d60f1d3a24..09e10e3aa5 100644 --- a/Projectiles/Magic/ApothChloro.cs +++ b/Projectiles/Magic/ApothChloro.cs @@ -1,127 +1,127 @@ -using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.GameContent; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ApothChloro : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rays of Annihilation"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 70; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.hostile = false; - projectile.friendly = true; - projectile.magic = true; - projectile.light = 0.5f; - projectile.extraUpdates = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); - for (int i = 0; i < 5; i++) - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 242, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)i; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } - float num1 = (float)(projectile.position.X - projectile.velocity.X / 10.0 * 9.0); - float num2 = (float)(projectile.position.Y - projectile.velocity.Y / 10.0 * 9.0); - float num3 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num4 = projectile.localAI[0]; - if ((double)num4 == 0.0) - { - projectile.localAI[0] = num3; - num4 = num3; - } - if (projectile.alpha > 0) - projectile.alpha = projectile.alpha - 25; - if (projectile.alpha < 0) - projectile.alpha = 0; - float num5 = (float)projectile.position.X; - float num6 = (float)projectile.position.Y; - float num7 = 300f; - bool flag2 = false; - int num8 = 0; - float num9 = 0f; - if ((double)projectile.ai[1] == 0.0) - { - for (int index = 0; index < 200; ++index) - { - if (Main.npc[index].CanBeChasedBy((object)this, false) && ((double)projectile.ai[1] == 0.0 || (double)projectile.ai[1] == (double)(index + 1))) - { - num1 = (float)Main.npc[index].position.X + (float)(Main.npc[index].width / 2); - num2 = (float)Main.npc[index].position.Y + (float)(Main.npc[index].height / 2); - num9 = Math.Abs((float)projectile.position.X + (float)(projectile.width / 2) - num1) + Math.Abs((float)projectile.position.Y + (float)(projectile.height / 2) - num2); - if ((double)num9 < (double)num7 && Collision.CanHit(new Vector2((float)projectile.position.X + (float)(projectile.width / 2), (float)projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height)) - { - num7 = num9; - num5 = num1; - num6 = num2; - flag2 = true; - num8 = index; - } - } - } - if (flag2) - projectile.ai[1] = (float)(num8 + 1); - flag2 = false; - } - if ((double)projectile.ai[1] > 0.0) - { - int index = (int)((double)projectile.ai[1] - 1.0); - if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object)this, true) && !Main.npc[index].dontTakeDamage) - { - if ((double)Math.Abs((float)projectile.position.X + (float)(projectile.width / 2) - ((float)Main.npc[index].position.X + (float)(Main.npc[index].width / 2))) + (double)Math.Abs((float)projectile.position.Y + (float)(projectile.height / 2) - ((float)Main.npc[index].position.Y + (float)(Main.npc[index].height / 2))) < 3000.0) - { - flag2 = true; - num5 = (float)Main.npc[index].position.X + (float)(Main.npc[index].width / 2); - num6 = (float)Main.npc[index].position.Y + (float)(Main.npc[index].height / 2); - } - } - else - projectile.ai[1] = 0.0f; - } - if (!projectile.friendly) - flag2 = false; - if (flag2) - { - double num15 = (double) num4; - Vector2 vector2 = new Vector2((float) (projectile.position.X + (double) projectile.width * 0.5), (float) (projectile.position.Y + (double) projectile.height * 0.5)); - num2 = num5 - (float) vector2.X; - num9 = num6 - (float) vector2.Y; - double num10 = Math.Sqrt((double) num2 * (double) num2 + (double) num9 * (double) num9); - float num11 = (float) (num15 / num10); - float num12 = num2 * num11; - float num13 = num9 * num11; - int num14 = 8; - projectile.velocity.X = (float) ((projectile.velocity.X * (double) (num14 - 1) + (double) num12) / (double) num14); - projectile.velocity.Y = (float) ((projectile.velocity.Y * (double) (num14 - 1) + (double) num13) / (double) num14); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); - target.AddBuff(mod.BuffType("DemonFlames"), 600, true); - } - } -} +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ApothChloro : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rays of Annihilation"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.alpha = 70; + projectile.timeLeft = 120; + projectile.penetrate = 1; + projectile.hostile = false; + projectile.friendly = true; + projectile.magic = true; + projectile.light = 0.5f; + projectile.extraUpdates = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); + for (int i = 0; i < 5; i++) + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 242, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; + dust4.velocity = Vector2.Zero; + dust4.position -= projectile.velocity / 5f * (float)i; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } + float num1 = (float)(projectile.position.X - projectile.velocity.X / 10.0 * 9.0); + float num2 = (float)(projectile.position.Y - projectile.velocity.Y / 10.0 * 9.0); + float num3 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num4 = projectile.localAI[0]; + if ((double)num4 == 0.0) + { + projectile.localAI[0] = num3; + num4 = num3; + } + if (projectile.alpha > 0) + projectile.alpha = projectile.alpha - 25; + if (projectile.alpha < 0) + projectile.alpha = 0; + float num5 = (float)projectile.position.X; + float num6 = (float)projectile.position.Y; + float num7 = 300f; + bool flag2 = false; + int num8 = 0; + float num9 = 0f; + if ((double)projectile.ai[1] == 0.0) + { + for (int index = 0; index < 200; ++index) + { + if (Main.npc[index].CanBeChasedBy((object)this, false) && ((double)projectile.ai[1] == 0.0 || (double)projectile.ai[1] == (double)(index + 1))) + { + num1 = (float)Main.npc[index].position.X + (float)(Main.npc[index].width / 2); + num2 = (float)Main.npc[index].position.Y + (float)(Main.npc[index].height / 2); + num9 = Math.Abs((float)projectile.position.X + (float)(projectile.width / 2) - num1) + Math.Abs((float)projectile.position.Y + (float)(projectile.height / 2) - num2); + if ((double)num9 < (double)num7 && Collision.CanHit(new Vector2((float)projectile.position.X + (float)(projectile.width / 2), (float)projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height)) + { + num7 = num9; + num5 = num1; + num6 = num2; + flag2 = true; + num8 = index; + } + } + } + if (flag2) + projectile.ai[1] = (float)(num8 + 1); + flag2 = false; + } + if ((double)projectile.ai[1] > 0.0) + { + int index = (int)((double)projectile.ai[1] - 1.0); + if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object)this, true) && !Main.npc[index].dontTakeDamage) + { + if ((double)Math.Abs((float)projectile.position.X + (float)(projectile.width / 2) - ((float)Main.npc[index].position.X + (float)(Main.npc[index].width / 2))) + (double)Math.Abs((float)projectile.position.Y + (float)(projectile.height / 2) - ((float)Main.npc[index].position.Y + (float)(Main.npc[index].height / 2))) < 3000.0) + { + flag2 = true; + num5 = (float)Main.npc[index].position.X + (float)(Main.npc[index].width / 2); + num6 = (float)Main.npc[index].position.Y + (float)(Main.npc[index].height / 2); + } + } + else + projectile.ai[1] = 0.0f; + } + if (!projectile.friendly) + flag2 = false; + if (flag2) + { + double num15 = (double) num4; + Vector2 vector2 = new Vector2((float) (projectile.position.X + (double) projectile.width * 0.5), (float) (projectile.position.Y + (double) projectile.height * 0.5)); + num2 = num5 - (float) vector2.X; + num9 = num6 - (float) vector2.Y; + double num10 = Math.Sqrt((double) num2 * (double) num2 + (double) num9 * (double) num9); + float num11 = (float) (num15 / num10); + float num12 = num2 * num11; + float num13 = num9 * num11; + int num14 = 8; + projectile.velocity.X = (float) ((projectile.velocity.X * (double) (num14 - 1) + (double) num12) / (double) num14); + projectile.velocity.Y = (float) ((projectile.velocity.Y * (double) (num14 - 1) + (double) num13) / (double) num14); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); + target.AddBuff(mod.BuffType("DemonFlames"), 600, true); + } + } +} diff --git a/Projectiles/Magic/ApothJaws.cs b/Projectiles/Magic/ApothJaws.cs index 4fc4d51124..504f3acb07 100644 --- a/Projectiles/Magic/ApothJaws.cs +++ b/Projectiles/Magic/ApothJaws.cs @@ -1,84 +1,84 @@ -using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.GameContent; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ApothJaws : ModProjectile - { - private const float degrees = (float)(Math.PI / 180) * 2; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Jaws of Annihilation"); - } - - public override void SetDefaults() - { - projectile.width = 124; - projectile.height = 64; - projectile.alpha = 70; - projectile.timeLeft = 240; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.light = 1.5f; - } - - public override void AI() - { - if(projectile.timeLeft % 8 == 0) - { - double angle = (double)(Main.rand.Next(360)) * Math.PI / 180; - float offsetX = projectile.position.X + (float)(Main.rand.Next((int)projectile.width)); - float offsetY = projectile.position.Y + (float)(Main.rand.Next((int)projectile.height)); - Projectile.NewProjectile(offsetX, offsetY, 14 * (float)(Math.Cos(angle)), 14 * (float)(Math.Sin(angle)), mod.ProjectileType("ApothChloro"), projectile.damage, projectile.knockBack / 2, Main.myPlayer); - } - if (projectile.timeLeft < 30) - projectile.alpha = projectile.alpha + 6; - else if (projectile.timeLeft < 210) - { - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.9f; - } - else if (projectile.timeLeft < 240) - { - if (projectile.ai[1] == 0) - projectile.rotation += 1.3f*degrees; - else - projectile.rotation -= 1.3f*degrees; - } - else if (projectile.timeLeft == 240) - { - if (projectile.ai[1] == 0) - projectile.rotation = projectile.ai[0] - 30*degrees; - else - { - projectile.rotation = projectile.ai[0] + 30*degrees + (float)Math.PI; - projectile.spriteDirection = -1; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); - target.AddBuff(mod.BuffType("DemonFlames"), 600, true); - target.AddBuff(mod.BuffType("ArmorCrunch"), 600, true); - if (Main.rand.Next(30) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 120, true); - } - } - } -} +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ApothJaws : ModProjectile + { + private const float degrees = (float)(Math.PI / 180) * 2; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Jaws of Annihilation"); + } + + public override void SetDefaults() + { + projectile.width = 124; + projectile.height = 64; + projectile.alpha = 70; + projectile.timeLeft = 240; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.friendly = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.light = 1.5f; + } + + public override void AI() + { + if(projectile.timeLeft % 8 == 0) + { + double angle = (double)(Main.rand.Next(360)) * Math.PI / 180; + float offsetX = projectile.position.X + (float)(Main.rand.Next((int)projectile.width)); + float offsetY = projectile.position.Y + (float)(Main.rand.Next((int)projectile.height)); + Projectile.NewProjectile(offsetX, offsetY, 14 * (float)(Math.Cos(angle)), 14 * (float)(Math.Sin(angle)), mod.ProjectileType("ApothChloro"), projectile.damage, projectile.knockBack / 2, Main.myPlayer); + } + if (projectile.timeLeft < 30) + projectile.alpha = projectile.alpha + 6; + else if (projectile.timeLeft < 210) + { + projectile.velocity.X *= 0.9f; + projectile.velocity.Y *= 0.9f; + } + else if (projectile.timeLeft < 240) + { + if (projectile.ai[1] == 0) + projectile.rotation += 1.3f*degrees; + else + projectile.rotation -= 1.3f*degrees; + } + else if (projectile.timeLeft == 240) + { + if (projectile.ai[1] == 0) + projectile.rotation = projectile.ai[0] - 30*degrees; + else + { + projectile.rotation = projectile.ai[0] + 30*degrees + (float)Math.PI; + projectile.spriteDirection = -1; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); + target.AddBuff(mod.BuffType("DemonFlames"), 600, true); + target.AddBuff(mod.BuffType("ArmorCrunch"), 600, true); + if (Main.rand.Next(30) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 120, true); + } + } + } +} diff --git a/Projectiles/Magic/ApothMark.cs b/Projectiles/Magic/ApothMark.cs index 70d0e8b500..75ce0cbd34 100644 --- a/Projectiles/Magic/ApothMark.cs +++ b/Projectiles/Magic/ApothMark.cs @@ -1,71 +1,71 @@ -using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.GameContent; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ApothMark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Jaws of Annihilation"); - } - - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 100; - projectile.alpha = 70; - projectile.timeLeft = 240; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.light = 1.5f; - } - - public override void AI() - { - if (projectile.timeLeft < 30) - projectile.alpha = projectile.alpha + 6; - else if (projectile.timeLeft < 210) - { - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.9f; - } - else if (projectile.timeLeft == 240) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - double offsetHyp = Math.Sqrt(48*48+38*38); - double offsetRotation = Math.Atan2(-38, 48) + (double)projectile.rotation; - double offsetX = offsetHyp * Math.Cos(offsetRotation); - double offsetY = offsetHyp * Math.Sin(offsetRotation); - Projectile.NewProjectile(projectile.Center.X + (float)offsetX, projectile.Center.Y + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("ApothJaws"), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 0f); - offsetRotation = Math.Atan2(38, 48) + (double)projectile.rotation; - offsetX = offsetHyp * Math.Cos(offsetRotation); - offsetY = offsetHyp * Math.Sin(offsetRotation); - Projectile.NewProjectile(projectile.position.X + projectile.width/2 + (float)offsetX, projectile.position.Y + projectile.height/2 + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("ApothJaws"), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 1f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); - target.AddBuff(mod.BuffType("DemonFlames"), 600, true); - target.AddBuff(mod.BuffType("ArmorCrunch"), 600, true); - if (Main.rand.Next(30) == 0) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 120, true); - } - } - } -} +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ApothMark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Jaws of Annihilation"); + } + + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 100; + projectile.alpha = 70; + projectile.timeLeft = 240; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.friendly = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.light = 1.5f; + } + + public override void AI() + { + if (projectile.timeLeft < 30) + projectile.alpha = projectile.alpha + 6; + else if (projectile.timeLeft < 210) + { + projectile.velocity.X *= 0.9f; + projectile.velocity.Y *= 0.9f; + } + else if (projectile.timeLeft == 240) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + double offsetHyp = Math.Sqrt(48*48+38*38); + double offsetRotation = Math.Atan2(-38, 48) + (double)projectile.rotation; + double offsetX = offsetHyp * Math.Cos(offsetRotation); + double offsetY = offsetHyp * Math.Sin(offsetRotation); + Projectile.NewProjectile(projectile.Center.X + (float)offsetX, projectile.Center.Y + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("ApothJaws"), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 0f); + offsetRotation = Math.Atan2(38, 48) + (double)projectile.rotation; + offsetX = offsetHyp * Math.Cos(offsetRotation); + offsetY = offsetHyp * Math.Sin(offsetRotation); + Projectile.NewProjectile(projectile.position.X + projectile.width/2 + (float)offsetX, projectile.position.Y + projectile.height/2 + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("ApothJaws"), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 1f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 600, true); + target.AddBuff(mod.BuffType("DemonFlames"), 600, true); + target.AddBuff(mod.BuffType("ArmorCrunch"), 600, true); + if (Main.rand.Next(30) == 0) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 120, true); + } + } + } +} diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index 70c903ceab..d98f832ba9 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -1,119 +1,119 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class Asteroid : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Asteroid"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 2; - } - - public override void AI() - { - if (projectile.position.Y > Main.player[projectile.owner].position.Y - 300f) - { - projectile.tileCollide = true; - } - if ((double)projectile.position.Y < Main.worldSurface * 16.0) - { - projectile.tileCollide = true; - } - projectile.scale = projectile.ai[1]; - projectile.rotation += projectile.velocity.X * 2f; - Vector2 position = projectile.Center + Vector2.Normalize(projectile.velocity) * 10f; - Dust dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default(Color), 1f)]; - dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default(Color), 1f)]; - dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(-1.5707963705062866, default(Vector2)) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(-1.5707963705062866, default(Vector2)); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - for (int num189 = 0; num189 < 1; num189++) - { - int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, default(Color), 1f); - Main.dust[num190].velocity *= 0.5f; - Main.dust[num190].scale *= 1.3f; - Main.dust[num190].fadeIn = 1f; - Main.dust[num190].noGravity = true; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item89, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = (int)(128f * projectile.scale); - projectile.height = (int)(128f * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num336 = 0; num336 < 4; num336++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1.5f); - } - for (int num337 = 0; num337 < 16; num337++) - { - int num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 2.5f); - Main.dust[num338].noGravity = true; - Main.dust[num338].velocity *= 3f; - num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num338].velocity *= 2f; - Main.dust[num338].noGravity = true; - } - for (int num339 = 0; num339 < 2; num339++) - { - int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64), 1f); - Main.gore[num340].velocity *= 0.3f; - Gore expr_B4D2_cp_0 = Main.gore[num340]; - expr_B4D2_cp_0.velocity.X = expr_B4D2_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; - Gore expr_B502_cp_0 = Main.gore[num340]; - expr_B502_cp_0.velocity.Y = expr_B502_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; - } - if (projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = -1f; - projectile.maxPenetrate = 0; - projectile.Damage(); - } - for (int num341 = 0; num341 < 5; num341++) - { - int num342 = Utils.SelectRandom(Main.rand, new int[] - { - 107, - 259, - 158 - }); - int num343 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num342, 2.5f * (float)projectile.direction, -2.5f, 0, default(Color), 1f); - Main.dust[num343].alpha = 200; - Main.dust[num343].velocity *= 2.4f; - Main.dust[num343].scale += Main.rand.NextFloat(); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 2; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Asteroid : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Asteroid"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.extraUpdates = 2; + } + + public override void AI() + { + if (projectile.position.Y > Main.player[projectile.owner].position.Y - 300f) + { + projectile.tileCollide = true; + } + if ((double)projectile.position.Y < Main.worldSurface * 16.0) + { + projectile.tileCollide = true; + } + projectile.scale = projectile.ai[1]; + projectile.rotation += projectile.velocity.X * 2f; + Vector2 position = projectile.Center + Vector2.Normalize(projectile.velocity) * 10f; + Dust dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default(Color), 1f)]; + dust20.position = position; + dust20.velocity = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * 0.33f + projectile.velocity / 4f; + dust20.position += projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)); + dust20.fadeIn = 0.5f; + dust20.noGravity = true; + dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default(Color), 1f)]; + dust20.position = position; + dust20.velocity = projectile.velocity.RotatedBy(-1.5707963705062866, default(Vector2)) * 0.33f + projectile.velocity / 4f; + dust20.position += projectile.velocity.RotatedBy(-1.5707963705062866, default(Vector2)); + dust20.fadeIn = 0.5f; + dust20.noGravity = true; + for (int num189 = 0; num189 < 1; num189++) + { + int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, default(Color), 1f); + Main.dust[num190].velocity *= 0.5f; + Main.dust[num190].scale *= 1.3f; + Main.dust[num190].fadeIn = 1f; + Main.dust[num190].noGravity = true; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item89, projectile.position); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = (int)(128f * projectile.scale); + projectile.height = (int)(128f * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num336 = 0; num336 < 4; num336++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1.5f); + } + for (int num337 = 0; num337 < 16; num337++) + { + int num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 2.5f); + Main.dust[num338].noGravity = true; + Main.dust[num338].velocity *= 3f; + num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num338].velocity *= 2f; + Main.dust[num338].noGravity = true; + } + for (int num339 = 0; num339 < 2; num339++) + { + int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[num340].velocity *= 0.3f; + Gore expr_B4D2_cp_0 = Main.gore[num340]; + expr_B4D2_cp_0.velocity.X = expr_B4D2_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; + Gore expr_B502_cp_0 = Main.gore[num340]; + expr_B502_cp_0.velocity.Y = expr_B502_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; + } + if (projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = -1f; + projectile.maxPenetrate = 0; + projectile.Damage(); + } + for (int num341 = 0; num341 < 5; num341++) + { + int num342 = Utils.SelectRandom(Main.rand, new int[] + { + 107, + 259, + 158 + }); + int num343 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num342, 2.5f * (float)projectile.direction, -2.5f, 0, default(Color), 1f); + Main.dust[num343].alpha = 200; + Main.dust[num343].velocity *= 2.4f; + Main.dust[num343].scale += Main.rand.NextFloat(); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 2; + } + } +} diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index 2b8da58493..4a8b06b008 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -1,120 +1,120 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class AsteroidMolten : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Asteroid"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 2; - } - - public override void AI() - { - if (projectile.position.Y > Main.player[projectile.owner].position.Y - 300f) - { - projectile.tileCollide = true; - } - if ((double)projectile.position.Y < Main.worldSurface * 16.0) - { - projectile.tileCollide = true; - } - projectile.scale = projectile.ai[1]; - projectile.rotation += projectile.velocity.X * 2f; - Vector2 position = projectile.Center + Vector2.Normalize(projectile.velocity) * 10f; - Dust dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; - dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; - dust20.position = position; - dust20.velocity = projectile.velocity.RotatedBy(-1.5707963705062866, default(Vector2)) * 0.33f + projectile.velocity / 4f; - dust20.position += projectile.velocity.RotatedBy(-1.5707963705062866, default(Vector2)); - dust20.fadeIn = 0.5f; - dust20.noGravity = true; - for (int num189 = 0; num189 < 1; num189++) - { - int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f); - Main.dust[num190].velocity *= 0.5f; - Main.dust[num190].scale *= 1.3f; - Main.dust[num190].fadeIn = 1f; - Main.dust[num190].noGravity = true; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item89, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = (int)(128f * projectile.scale); - projectile.height = (int)(128f * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num336 = 0; num336 < 8; num336++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); - } - for (int num337 = 0; num337 < 32; num337++) - { - int num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 2.5f); - Main.dust[num338].noGravity = true; - Main.dust[num338].velocity *= 3f; - num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); - Main.dust[num338].velocity *= 2f; - Main.dust[num338].noGravity = true; - } - for (int num339 = 0; num339 < 2; num339++) - { - int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64), 1f); - Main.gore[num340].velocity *= 0.3f; - Gore expr_B4D2_cp_0 = Main.gore[num340]; - expr_B4D2_cp_0.velocity.X = expr_B4D2_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; - Gore expr_B502_cp_0 = Main.gore[num340]; - expr_B502_cp_0.velocity.Y = expr_B502_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; - } - if (projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = -1f; - projectile.maxPenetrate = 0; - projectile.Damage(); - } - for (int num341 = 0; num341 < 5; num341++) - { - int num342 = Utils.SelectRandom(Main.rand, new int[] - { - 244, - 259, - 158 - }); - int num343 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num342, 2.5f * (float)projectile.direction, -2.5f, 0, new Color(255, Main.DiscoG, 0), 1f); - Main.dust[num343].alpha = 200; - Main.dust[num343].velocity *= 2.4f; - Main.dust[num343].scale += Main.rand.NextFloat(); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - player.AddBuff(mod.BuffType("Molten"), 360); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class AsteroidMolten : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Asteroid"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.extraUpdates = 2; + } + + public override void AI() + { + if (projectile.position.Y > Main.player[projectile.owner].position.Y - 300f) + { + projectile.tileCollide = true; + } + if ((double)projectile.position.Y < Main.worldSurface * 16.0) + { + projectile.tileCollide = true; + } + projectile.scale = projectile.ai[1]; + projectile.rotation += projectile.velocity.X * 2f; + Vector2 position = projectile.Center + Vector2.Normalize(projectile.velocity) * 10f; + Dust dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; + dust20.position = position; + dust20.velocity = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * 0.33f + projectile.velocity / 4f; + dust20.position += projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)); + dust20.fadeIn = 0.5f; + dust20.noGravity = true; + dust20 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f)]; + dust20.position = position; + dust20.velocity = projectile.velocity.RotatedBy(-1.5707963705062866, default(Vector2)) * 0.33f + projectile.velocity / 4f; + dust20.position += projectile.velocity.RotatedBy(-1.5707963705062866, default(Vector2)); + dust20.fadeIn = 0.5f; + dust20.noGravity = true; + for (int num189 = 0; num189 < 1; num189++) + { + int num190 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, new Color(255, Main.DiscoG, 0), 1f); + Main.dust[num190].velocity *= 0.5f; + Main.dust[num190].scale *= 1.3f; + Main.dust[num190].fadeIn = 1f; + Main.dust[num190].noGravity = true; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item89, projectile.position); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = (int)(128f * projectile.scale); + projectile.height = (int)(128f * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num336 = 0; num336 < 8; num336++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); + } + for (int num337 = 0; num337 < 32; num337++) + { + int num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 2.5f); + Main.dust[num338].noGravity = true; + Main.dust[num338].velocity *= 3f; + num338 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 0), 1.5f); + Main.dust[num338].velocity *= 2f; + Main.dust[num338].noGravity = true; + } + for (int num339 = 0; num339 < 2; num339++) + { + int num340 = Gore.NewGore(projectile.position + new Vector2((float)(projectile.width * Main.rand.Next(100)) / 100f, (float)(projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[num340].velocity *= 0.3f; + Gore expr_B4D2_cp_0 = Main.gore[num340]; + expr_B4D2_cp_0.velocity.X = expr_B4D2_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; + Gore expr_B502_cp_0 = Main.gore[num340]; + expr_B502_cp_0.velocity.Y = expr_B502_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; + } + if (projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = -1f; + projectile.maxPenetrate = 0; + projectile.Damage(); + } + for (int num341 = 0; num341 < 5; num341++) + { + int num342 = Utils.SelectRandom(Main.rand, new int[] + { + 244, + 259, + 158 + }); + int num343 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num342, 2.5f * (float)projectile.direction, -2.5f, 0, new Color(255, Main.DiscoG, 0), 1f); + Main.dust[num343].alpha = 200; + Main.dust[num343].velocity *= 2.4f; + Main.dust[num343].scale += Main.rand.NextFloat(); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + player.AddBuff(mod.BuffType("Molten"), 360); + } + } +} diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index ff23e24c08..3bf5e1db5a 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -1,122 +1,122 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class AstralStarMagic : ModProjectile - { - public int noTileHitCounter = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 50; - projectile.penetrate = 1; - projectile.tileCollide = false; - } - - public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 3); - 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.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - 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, mod.DustType("AstralOrange"), 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 (Main.rand.Next(48) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.Next(10) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); - } - 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); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 100, 250, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.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 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.7f); - 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - for (int num480 = 0; num480 < 3; num480++) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class AstralStarMagic : ModProjectile + { + public int noTileHitCounter = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.magic = true; + projectile.alpha = 50; + projectile.penetrate = 1; + projectile.tileCollide = false; + } + + public override void AI() + { + int randomToSubtract = Main.rand.Next(1, 3); + 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.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + 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, mod.DustType("AstralOrange"), 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 (Main.rand.Next(48) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + 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); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 100, 250, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.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 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.7f); + 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + for (int num480 = 0; num480 < 3; num480++) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + } + } + } +} diff --git a/Projectiles/Magic/AtlantisSpear.cs b/Projectiles/Magic/AtlantisSpear.cs index 8901195c79..0b164b226c 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -1,108 +1,108 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class AtlantisSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Atlantis Spear"); - } - - public override void SetDefaults() - { - projectile.width = 52; - projectile.height = 52; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - aiType = 493; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; - } - if (Main.myPlayer == projectile.owner) - { - int num48 = projectile.type; - if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) - { - num48 = mod.ProjectileType("AtlantisSpear2"); - } - int num49 = projectile.damage; - float num50 = projectile.knockBack; - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); - NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - { - for (int num55 = 0; num55 < 8; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default(Color), 1f); - Main.dust[num56].noGravity = true; - Main.dust[num56].velocity *= 0.5f; - } - } - projectile.alpha += 7; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - } - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - } - - public override void Kill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("AtlantisSpear2"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile2].penetrate = 1; - } - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class AtlantisSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Atlantis Spear"); + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 52; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.magic = true; + aiType = 493; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + if (Main.myPlayer == projectile.owner) + { + int num48 = projectile.type; + if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) + { + num48 = mod.ProjectileType("AtlantisSpear2"); + } + int num49 = projectile.damage; + float num50 = projectile.knockBack; + int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); + NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default(Color), 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + } + + public override void Kill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("AtlantisSpear2"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile2].penetrate = 1; + } + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + } + } + } +} diff --git a/Projectiles/Magic/AtlantisSpear2.cs b/Projectiles/Magic/AtlantisSpear2.cs index 3a3e20ecb0..ad02a6b210 100644 --- a/Projectiles/Magic/AtlantisSpear2.cs +++ b/Projectiles/Magic/AtlantisSpear2.cs @@ -1,83 +1,83 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class AtlantisSpear2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Atlantis Spear"); - } - - public override void SetDefaults() - { - projectile.width = 52; - projectile.height = 52; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - aiType = 494; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; - } - } - } - else - { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - { - for (int num55 = 0; num55 < 8; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default(Color), 1f); - Main.dust[num56].noGravity = true; - Main.dust[num56].velocity *= 0.5f; - } - } - projectile.alpha += 7; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - } - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class AtlantisSpear2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Atlantis Spear"); + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 52; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.magic = true; + aiType = 494; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default(Color), 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + } + } + } +} diff --git a/Projectiles/Magic/AuraRain.cs b/Projectiles/Magic/AuraRain.cs index fc81eaf9b5..81f2919ab3 100644 --- a/Projectiles/Magic/AuraRain.cs +++ b/Projectiles/Magic/AuraRain.cs @@ -1,43 +1,43 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class AuraRain : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura Rain"); - } - - public override void SetDefaults() - { - projectile.width = 2; - projectile.height = 2; - projectile.aiStyle = 45; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = true; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.scale = 1.1f; - projectile.magic = true; - projectile.extraUpdates = 1; - aiType = 239; - } - - public override void AI() - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class AuraRain : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura Rain"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.aiStyle = 45; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = true; + projectile.timeLeft = 300; + projectile.alpha = 255; + projectile.scale = 1.1f; + projectile.magic = true; + projectile.extraUpdates = 1; + aiType = 239; + } + + public override void AI() + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; + dust4.velocity = Vector2.Zero; + dust4.position -= projectile.velocity / 5f; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } + } +} diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index 4b4205923f..21e7c10635 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BeamingBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beaming Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.penetrate = -1; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.985f; - for (int dust = 0; dust < 3; dust++) - { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 6; k++) - { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - float spread = 90f * 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) - { - for (i = 0; i < 4; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BeamingBolt2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BeamingBolt2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BeamingBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beaming Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.penetrate = -1; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.985f; + for (int dust = 0; dust < 3; dust++) + { + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 164; + } + else if (randomDust == 1) + { + randomDust = 58; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 6; k++) + { + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 164; + } + else if (randomDust == 1) + { + randomDust = 58; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + float spread = 90f * 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) + { + for (i = 0; i < 4; i++ ) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BeamingBolt2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BeamingBolt2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + } + } +} diff --git a/Projectiles/Magic/BeamingBolt2.cs b/Projectiles/Magic/BeamingBolt2.cs index a7c2c6785b..577df8869e 100644 --- a/Projectiles/Magic/BeamingBolt2.cs +++ b/Projectiles/Magic/BeamingBolt2.cs @@ -1,104 +1,104 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BeamingBolt2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beaming Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.magic = true; - } - - public override void AI() - { - for (int dust = 0; dust < 2; dust++) - { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, 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; - 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; - return; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BeamingBolt2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beaming Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + for (int dust = 0; dust < 2; dust++) + { + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 164; + } + else if (randomDust == 1) + { + randomDust = 58; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, 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; + 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; + return; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 164; + } + else if (randomDust == 1) + { + randomDust = 58; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Magic/BigBeamofDeath.cs b/Projectiles/Magic/BigBeamofDeath.cs index 2164f6cefa..574f64ad78 100644 --- a/Projectiles/Magic/BigBeamofDeath.cs +++ b/Projectiles/Magic/BigBeamofDeath.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BigBeamofDeath : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Beam of Death"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 80; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 80; - } - - public override void Kill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BigBeamofDeath2"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 206; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 3f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BigBeamofDeath : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Beam of Death"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 80; + projectile.penetrate = -1; + projectile.extraUpdates = 100; + projectile.timeLeft = 80; + } + + public override void Kill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BigBeamofDeath2"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 206; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 3f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + } + } + } + } +} diff --git a/Projectiles/Magic/BigBeamofDeath2.cs b/Projectiles/Magic/BigBeamofDeath2.cs index 42ef73f1ab..88df6bda9d 100644 --- a/Projectiles/Magic/BigBeamofDeath2.cs +++ b/Projectiles/Magic/BigBeamofDeath2.cs @@ -1,50 +1,50 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BigBeamofDeath2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Beam of Death"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 80; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 80; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 206; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 3f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BigBeamofDeath2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Beam of Death"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 80; + projectile.penetrate = -1; + projectile.extraUpdates = 100; + projectile.timeLeft = 80; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 206; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 3f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/BlackAnurian.cs b/Projectiles/Magic/BlackAnurian.cs index e430114d2f..45fcb86262 100644 --- a/Projectiles/Magic/BlackAnurian.cs +++ b/Projectiles/Magic/BlackAnurian.cs @@ -1,85 +1,85 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BlackAnurian : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.magic = true; - } - - public override void AI() - { - if (projectile.localAI[0] > 2f) - { - projectile.alpha -= 20; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - else - { - projectile.localAI[0] += 1f; - } - if (projectile.ai[0] > 30f) - { - if (projectile.velocity.Y > -8f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - projectile.velocity.X = projectile.velocity.X * 0.98f; - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation = projectile.velocity.X * 0.1f; - if (projectile.wet) - { - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; - } - if (projectile.velocity.Y > -8f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - projectile.velocity.X = projectile.velocity.X * 0.94f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item54, projectile.position); - int num3; - for (int num246 = 0; num246 < 25; num246 = num3 + 1) - { - int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, 0f, 0f, 0, default(Color), 1f); - Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; - Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - Main.dust[num247].velocity.Normalize(); - Dust dust = Main.dust[num247]; - dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = projectile.alpha; - num3 = num246; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BlackAnurian : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.localAI[0] > 2f) + { + projectile.alpha -= 20; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + else + { + projectile.localAI[0] += 1f; + } + if (projectile.ai[0] > 30f) + { + if (projectile.velocity.Y > -8f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + projectile.velocity.X = projectile.velocity.X * 0.98f; + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation = projectile.velocity.X * 0.1f; + if (projectile.wet) + { + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.98f; + } + if (projectile.velocity.Y > -8f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + projectile.velocity.X = projectile.velocity.X * 0.94f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item54, projectile.position); + int num3; + for (int num246 = 0; num246 < 25; num246 = num3 + 1) + { + int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, 0f, 0f, 0, default(Color), 1f); + Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; + Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[num247].velocity.Normalize(); + Dust dust = Main.dust[num247]; + dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; + Main.dust[num247].alpha = projectile.alpha; + num3 = num246; + } + } + } +} diff --git a/Projectiles/Magic/BlackAnurianPlankton.cs b/Projectiles/Magic/BlackAnurianPlankton.cs index fbf6320f7e..398d24b419 100644 --- a/Projectiles/Magic/BlackAnurianPlankton.cs +++ b/Projectiles/Magic/BlackAnurianPlankton.cs @@ -1,132 +1,132 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BlackAnurianPlankton : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plankton"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.magic = true; - projectile.extraUpdates = 3; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 50; - } - else - { - projectile.extraUpdates = 0; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - 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 num4; - for (int num376 = 0; num376 < 200; num376 = num4 + 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; - } - } - num4 = 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 = 6f; - float num381 = 0.1f; - 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; - return; - } - } - 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; - return; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BlackAnurianPlankton : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plankton"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.magic = true; + projectile.extraUpdates = 3; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 50; + } + else + { + projectile.extraUpdates = 0; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + 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 num4; + for (int num376 = 0; num376 < 200; num376 = num4 + 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; + } + } + num4 = 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 = 6f; + float num381 = 0.1f; + 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; + return; + } + } + 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; + return; + } + } + } + } +} diff --git a/Projectiles/Magic/BloodBeam.cs b/Projectiles/Magic/BloodBeam.cs index b51fdd2c4a..4e297e52b0 100644 --- a/Projectiles/Magic/BloodBeam.cs +++ b/Projectiles/Magic/BloodBeam.cs @@ -1,86 +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 BloodBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Beam"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.tileCollide = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 120; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 120) - { - projectile.timeLeft = 120; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 5; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 1.25f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BloodBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Beam"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.tileCollide = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 120; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 120) + { + projectile.timeLeft = 120; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 5; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 1.25f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + } +} diff --git a/Projectiles/Magic/BloodBlast.cs b/Projectiles/Magic/BloodBlast.cs index c12e62e205..c69dedf6f5 100644 --- a/Projectiles/Magic/BloodBlast.cs +++ b/Projectiles/Magic/BloodBlast.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BloodBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 2; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - for (int num92 = 0; num92 < 3; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 5, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; - } - if (Main.rand.Next(5) == 0) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 5, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BloodBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 2; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + for (int num92 = 0; num92 < 3; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 5, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + } + if (Main.rand.Next(5) == 0) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 5, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + } + } +} diff --git a/Projectiles/Magic/BloodBolt.cs b/Projectiles/Magic/BloodBolt.cs index d1c14ec987..c54dd4a6cf 100644 --- a/Projectiles/Magic/BloodBolt.cs +++ b/Projectiles/Magic/BloodBolt.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BloodBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BloodBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 30; + projectile.magic = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/BloodOrb.cs b/Projectiles/Magic/BloodOrb.cs index 59859da444..4f53cc767c 100644 --- a/Projectiles/Magic/BloodOrb.cs +++ b/Projectiles/Magic/BloodOrb.cs @@ -1,88 +1,88 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BloodOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Orb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("BloodBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - return; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BloodOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Orb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("BloodBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + return; + } + } + } + } +} diff --git a/Projectiles/Magic/BloodRay.cs b/Projectiles/Magic/BloodRay.cs index 9e47f35309..1153a0da26 100644 --- a/Projectiles/Magic/BloodRay.cs +++ b/Projectiles/Magic/BloodRay.cs @@ -1,53 +1,53 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BloodRay : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Ray"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 150; - } - - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("BloodOrb"), (int)((double)projectile.damage * 0.6f), projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BloodRay : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Ray"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 150; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("BloodOrb"), (int)((double)projectile.damage * 0.6f), projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index 81e4de6b87..30e6acdeea 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BlueBubble : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y *= 0.99f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.005f; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 30; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Vector2 v2 = projectile.ai[0].ToRotationVector2(); - float num743 = projectile.velocity.ToRotation(); - float num744 = v2.ToRotation(); - double num745 = (double)(num744 - num743); - if (num745 > 3.1415926535897931) - { - num745 -= 6.2831853071795862; - } - if (num745 < -3.1415926535897931) - { - num745 += 6.2831853071795862; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.myPlayer == projectile.owner && projectile.timeLeft > 120) - { - projectile.timeLeft = 120; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 54); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) - { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default(Color), 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BlueBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.99f; + projectile.velocity.Y *= 0.99f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.005f; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 30; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Vector2 v2 = projectile.ai[0].ToRotationVector2(); + float num743 = projectile.velocity.ToRotation(); + float num744 = v2.ToRotation(); + double num745 = (double)(num744 - num743); + if (num745 > 3.1415926535897931) + { + num745 -= 6.2831853071795862; + } + if (num745 < -3.1415926535897931) + { + num745 += 6.2831853071795862; + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.myPlayer == projectile.owner && projectile.timeLeft > 120) + { + projectile.timeLeft = 120; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 54); + int num190 = Main.rand.Next(5, 9); + for (int num191 = 0; num191 < num190; num191++) + { + int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default(Color), 1.4f); + Main.dust[num192].velocity *= 0.8f; + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].noGravity = true; + } + } + } +} diff --git a/Projectiles/Magic/BlushieStaffProj.cs b/Projectiles/Magic/BlushieStaffProj.cs index 3484c7cc49..072ad921c0 100644 --- a/Projectiles/Magic/BlushieStaffProj.cs +++ b/Projectiles/Magic/BlushieStaffProj.cs @@ -1,205 +1,205 @@ -using System; -using System.Reflection; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BlushieStaffProj : ModProjectile - { - private const int xRange = 600; - private const int yRange = 320; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Staff of Blushie"); - } - - public override void SetDefaults() - { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - if (Main.myPlayer == projectile.owner) - { - if (!player.channel || player.noItems || player.CCed || projectile.ai[0] > 1800f) - { - projectile.Kill(); - } - } - projectile.Center = player.MountedCenter; - projectile.timeLeft = 2; - player.itemTime = 2; - player.itemAnimation = 2; - - projectile.ai[0] += 1f; - projectile.damage = ((int)projectile.ai[0] - 120) * 4; - if (projectile.damage >= 100 && Main.myPlayer == projectile.owner) - { - if (player.statMana <= 0 && player.manaFlower) - { - player.QuickMana(); - } - if (player.statMana > 0) - { - player.statMana--; - } - else - { - projectile.Kill(); - } - } - - if (projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 37f; - projectile.localAI[0] = Main.rand.Next(xRange); - } - projectile.localAI[0] = Next(projectile.localAI[0]); - } - - private float Next(float seed) - { - return (seed * projectile.localAI[1] + 101f) % (4 * xRange * yRange); - } - - public override bool CanDamage() - { - return projectile.ai[0] > 120f; - } - - public override void ModifyDamageHitbox(ref Rectangle hitbox) - { - hitbox.X -= xRange; - hitbox.Width += 2 * xRange; - hitbox.Y -= yRange; - hitbox.Height += 2 * yRange; - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage += target.defense * 2; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.penetrate++; - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 300); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - Vector2 center = projectile.Center - Main.screenPosition; - Vector2 aura = center + new Vector2(-xRange, yRange); - Texture2D texture = mod.GetTexture("ExtraTextures/BlushieStaffAura"); - Rectangle frame = new Rectangle(50, 0, 50, 32); - int count = 2 * xRange / 50; - SpriteEffects effects = projectile.ai[0] % 30f < 15f ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - for (int k = 0; k < count; k++) - { - if (k == 0) - { - frame.X = effects == SpriteEffects.None ? 0 : 100; - } - else if (k == count - 1) - { - frame.X = effects == SpriteEffects.None ? 100 : 0; - } - else - { - frame.X = 50; - } - spriteBatch.Draw(texture, aura, frame, Color.White, 0f, new Vector2(0f, 32f), 1f, effects, 0f); - aura.X += 50f; - } - - Vector2 topLeftGear = center + new Vector2(-400f, -100f); - Vector2 topRightGear = center + new Vector2(200f, -200f); - Vector2 bottomLeftGear = center + new Vector2(-xRange / 2, yRange / 2); - Vector2 bottomRightGear = center + new Vector2(xRange - 100, yRange - 100); - - float alpha = projectile.ai[0] / 60f; - if (alpha > 0f) - { - if (alpha > 1f) - { - alpha = 1f; - } - DrawChains(spriteBatch, topLeftGear, center, alpha); - DrawChains(spriteBatch, center, bottomLeftGear, alpha); - DrawChains(spriteBatch, bottomLeftGear, topLeftGear, alpha); - DrawChains(spriteBatch, center, bottomRightGear, alpha); - DrawChains(spriteBatch, bottomRightGear, topRightGear, alpha); - DrawChains(spriteBatch, topRightGear, center, alpha); - DrawChains(spriteBatch, new Vector2(bottomLeftGear.X, center.Y + yRange), bottomLeftGear, alpha); - DrawChains(spriteBatch, bottomRightGear, new Vector2(bottomRightGear.X, center.Y + yRange), alpha); - } - - float scale = 1f; - if (projectile.ai[0] < 60f) - { - scale = 4f - 3f * projectile.ai[0] / 60f; - } - texture = mod.GetTexture("ExtraTextures/BlushieStaffGear"); - Vector2 origin = new Vector2(48f, 48f); - spriteBatch.Draw(texture, center, null, Color.White, projectile.ai[0] / 20f, origin, 1.5f * scale, SpriteEffects.None, 0f); - spriteBatch.Draw(texture, topLeftGear, null, Color.White, projectile.ai[0] / 10f, origin, scale, SpriteEffects.None, 0f); - spriteBatch.Draw(texture, topRightGear, null, Color.White, -projectile.ai[0] / 8f, origin, 0.75f * scale, SpriteEffects.None, 0f); - spriteBatch.Draw(texture, bottomLeftGear, null, Color.White, -projectile.ai[0] / 15f, origin, 1.4f * scale, SpriteEffects.None, 0f); - spriteBatch.Draw(texture, bottomRightGear, null, Color.White, projectile.ai[0] / 10f, origin, scale, SpriteEffects.None, 0f); - - float seed = projectile.localAI[0]; - texture = mod.GetTexture("ExtraTextures/BlushieStaffFire"); - Vector2 topLeft = center + new Vector2(-xRange, -yRange); - for (int k = (int)projectile.ai[0] - 60; k < (int)projectile.ai[0]; k++) - { - if (k > 120) - { - spriteBatch.Draw(texture, topLeft + new Vector2(seed % (2 * xRange), seed % (2 * yRange) + k - projectile.ai[0]), Color.White); - } - seed = Next(seed); - } - - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - return false; - } - - private void DrawChains(SpriteBatch spriteBatch, Vector2 start, Vector2 end, float alpha) - { - Texture2D texture = mod.GetTexture("ExtraTextures/BlushieStaffChain"); - Vector2 unit = end - start; - float distance = unit.Length() - 36f; - unit.Normalize(); - float rotation = unit.ToRotation(); - start += unit * 18f; - end -= unit * 18f; - float offset = (projectile.ai[0] * 2f) % texture.Width; - start += unit * offset; - distance -= offset; - int count = (int)(distance / texture.Width); - Color color = Color.White * alpha; - Vector2 origin = new Vector2(texture.Width / 2, texture.Height / 2); - for (int k = 0; k <= count; k++) - { - spriteBatch.Draw(texture, start, null, color, rotation, origin, 1f, SpriteEffects.None, 0f); - start += unit * texture.Width; - } - } - } -} \ No newline at end of file +using System; +using System.Reflection; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BlushieStaffProj : ModProjectile + { + private const int xRange = 600; + private const int yRange = 320; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Staff of Blushie"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (Main.myPlayer == projectile.owner) + { + if (!player.channel || player.noItems || player.CCed || projectile.ai[0] > 1800f) + { + projectile.Kill(); + } + } + projectile.Center = player.MountedCenter; + projectile.timeLeft = 2; + player.itemTime = 2; + player.itemAnimation = 2; + + projectile.ai[0] += 1f; + projectile.damage = ((int)projectile.ai[0] - 120) * 4; + if (projectile.damage >= 100 && Main.myPlayer == projectile.owner) + { + if (player.statMana <= 0 && player.manaFlower) + { + player.QuickMana(); + } + if (player.statMana > 0) + { + player.statMana--; + } + else + { + projectile.Kill(); + } + } + + if (projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 37f; + projectile.localAI[0] = Main.rand.Next(xRange); + } + projectile.localAI[0] = Next(projectile.localAI[0]); + } + + private float Next(float seed) + { + return (seed * projectile.localAI[1] + 101f) % (4 * xRange * yRange); + } + + public override bool CanDamage() + { + return projectile.ai[0] > 120f; + } + + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + hitbox.X -= xRange; + hitbox.Width += 2 * xRange; + hitbox.Y -= yRange; + hitbox.Height += 2 * yRange; + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + damage += target.defense * 2; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.penetrate++; + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Frostburn, 300); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + Vector2 center = projectile.Center - Main.screenPosition; + Vector2 aura = center + new Vector2(-xRange, yRange); + Texture2D texture = mod.GetTexture("ExtraTextures/BlushieStaffAura"); + Rectangle frame = new Rectangle(50, 0, 50, 32); + int count = 2 * xRange / 50; + SpriteEffects effects = projectile.ai[0] % 30f < 15f ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + for (int k = 0; k < count; k++) + { + if (k == 0) + { + frame.X = effects == SpriteEffects.None ? 0 : 100; + } + else if (k == count - 1) + { + frame.X = effects == SpriteEffects.None ? 100 : 0; + } + else + { + frame.X = 50; + } + spriteBatch.Draw(texture, aura, frame, Color.White, 0f, new Vector2(0f, 32f), 1f, effects, 0f); + aura.X += 50f; + } + + Vector2 topLeftGear = center + new Vector2(-400f, -100f); + Vector2 topRightGear = center + new Vector2(200f, -200f); + Vector2 bottomLeftGear = center + new Vector2(-xRange / 2, yRange / 2); + Vector2 bottomRightGear = center + new Vector2(xRange - 100, yRange - 100); + + float alpha = projectile.ai[0] / 60f; + if (alpha > 0f) + { + if (alpha > 1f) + { + alpha = 1f; + } + DrawChains(spriteBatch, topLeftGear, center, alpha); + DrawChains(spriteBatch, center, bottomLeftGear, alpha); + DrawChains(spriteBatch, bottomLeftGear, topLeftGear, alpha); + DrawChains(spriteBatch, center, bottomRightGear, alpha); + DrawChains(spriteBatch, bottomRightGear, topRightGear, alpha); + DrawChains(spriteBatch, topRightGear, center, alpha); + DrawChains(spriteBatch, new Vector2(bottomLeftGear.X, center.Y + yRange), bottomLeftGear, alpha); + DrawChains(spriteBatch, bottomRightGear, new Vector2(bottomRightGear.X, center.Y + yRange), alpha); + } + + float scale = 1f; + if (projectile.ai[0] < 60f) + { + scale = 4f - 3f * projectile.ai[0] / 60f; + } + texture = mod.GetTexture("ExtraTextures/BlushieStaffGear"); + Vector2 origin = new Vector2(48f, 48f); + spriteBatch.Draw(texture, center, null, Color.White, projectile.ai[0] / 20f, origin, 1.5f * scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, topLeftGear, null, Color.White, projectile.ai[0] / 10f, origin, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, topRightGear, null, Color.White, -projectile.ai[0] / 8f, origin, 0.75f * scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, bottomLeftGear, null, Color.White, -projectile.ai[0] / 15f, origin, 1.4f * scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, bottomRightGear, null, Color.White, projectile.ai[0] / 10f, origin, scale, SpriteEffects.None, 0f); + + float seed = projectile.localAI[0]; + texture = mod.GetTexture("ExtraTextures/BlushieStaffFire"); + Vector2 topLeft = center + new Vector2(-xRange, -yRange); + for (int k = (int)projectile.ai[0] - 60; k < (int)projectile.ai[0]; k++) + { + if (k > 120) + { + spriteBatch.Draw(texture, topLeft + new Vector2(seed % (2 * xRange), seed % (2 * yRange) + k - projectile.ai[0]), Color.White); + } + seed = Next(seed); + } + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + return false; + } + + private void DrawChains(SpriteBatch spriteBatch, Vector2 start, Vector2 end, float alpha) + { + Texture2D texture = mod.GetTexture("ExtraTextures/BlushieStaffChain"); + Vector2 unit = end - start; + float distance = unit.Length() - 36f; + unit.Normalize(); + float rotation = unit.ToRotation(); + start += unit * 18f; + end -= unit * 18f; + float offset = (projectile.ai[0] * 2f) % texture.Width; + start += unit * offset; + distance -= offset; + int count = (int)(distance / texture.Width); + Color color = Color.White * alpha; + Vector2 origin = new Vector2(texture.Width / 2, texture.Height / 2); + for (int k = 0; k <= count; k++) + { + spriteBatch.Draw(texture, start, null, color, rotation, origin, 1f, SpriteEffects.None, 0f); + start += unit * texture.Width; + } + } + } +} diff --git a/Projectiles/Magic/BrimstoneBeam.cs b/Projectiles/Magic/BrimstoneBeam.cs index bacfadd9b7..8cfc086414 100644 --- a/Projectiles/Magic/BrimstoneBeam.cs +++ b/Projectiles/Magic/BrimstoneBeam.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 20; - } - - public override void Kill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam2"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BrimstoneBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.extraUpdates = 100; + projectile.timeLeft = 20; + } + + public override void Kill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(10); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam2"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 235; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/BrimstoneBeam2.cs b/Projectiles/Magic/BrimstoneBeam2.cs index 995e387f5b..50e39dfe00 100644 --- a/Projectiles/Magic/BrimstoneBeam2.cs +++ b/Projectiles/Magic/BrimstoneBeam2.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneBeam2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 20; - } - - public override void Kill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam3"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BrimstoneBeam2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.extraUpdates = 100; + projectile.timeLeft = 20; + } + + public override void Kill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(10); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam3"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 235; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/BrimstoneBeam3.cs b/Projectiles/Magic/BrimstoneBeam3.cs index c931f94498..8641e8e16d 100644 --- a/Projectiles/Magic/BrimstoneBeam3.cs +++ b/Projectiles/Magic/BrimstoneBeam3.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneBeam3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 20; - } - - public override void Kill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam4"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BrimstoneBeam3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.extraUpdates = 100; + projectile.timeLeft = 20; + } + + public override void Kill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(10); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam4"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 235; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/BrimstoneBeam4.cs b/Projectiles/Magic/BrimstoneBeam4.cs index 92c451e34c..fa2462cd00 100644 --- a/Projectiles/Magic/BrimstoneBeam4.cs +++ b/Projectiles/Magic/BrimstoneBeam4.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneBeam4 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 20; - } - - public override void Kill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam5"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BrimstoneBeam4 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.extraUpdates = 100; + projectile.timeLeft = 20; + } + + public override void Kill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBeam5"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 235; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/BrimstoneBeam5.cs b/Projectiles/Magic/BrimstoneBeam5.cs index 8789845028..e33f068c03 100644 --- a/Projectiles/Magic/BrimstoneBeam5.cs +++ b/Projectiles/Magic/BrimstoneBeam5.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneBeam5 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 20; - } - - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BrimstoneBeam5 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.extraUpdates = 100; + projectile.timeLeft = 20; + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 235; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs index 58d2d6ec15..33b24f616d 100644 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ b/Projectiles/Magic/BrimstoneFireball.cs @@ -1,97 +1,97 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneFireball : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fireball"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.magic = true; - projectile.aiStyle = 1; - projectile.penetrate = 4; - aiType = 277; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - if (projectile.owner == Main.myPlayer) - { - int num251 = Main.rand.Next(2, 3); - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("BrimstoneHomer"), (int)((double)projectile.damage * 0.85), 0f, projectile.owner, 0f, 0f); - } - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - 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; - } - projectile.velocity *= 0.8f; - } - return false; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BrimstoneFireball : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fireball"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.magic = true; + projectile.aiStyle = 1; + projectile.penetrate = 4; + aiType = 277; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + if (projectile.owner == Main.myPlayer) + { + int num251 = Main.rand.Next(2, 3); + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("BrimstoneHomer"), (int)((double)projectile.damage * 0.85), 0f, projectile.owner, 0f, 0f); + } + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + 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; + } + projectile.velocity *= 0.8f; + } + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index 8dc687acd1..2707d86c2a 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -1,61 +1,61 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneHellfireballFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellfire"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - return; - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosionFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BrimstoneHellfireballFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellfire"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 300; + projectile.penetrate = -1; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + return; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosionFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } +} diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs index 26b08ac351..a305b2409a 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly2.cs @@ -1,59 +1,59 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneHellfireballFriendly2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellfire"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 600; - projectile.penetrate = -1; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - return; - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosionFriendly2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BrimstoneHellfireballFriendly2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellfire"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 600; + projectile.penetrate = -1; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + return; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HellfireExplosionFriendly2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } +} diff --git a/Projectiles/Magic/BrimstoneHomer.cs b/Projectiles/Magic/BrimstoneHomer.cs index e8a6c7b23c..ed350ae0ca 100644 --- a/Projectiles/Magic/BrimstoneHomer.cs +++ b/Projectiles/Magic/BrimstoneHomer.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneHomer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Homer"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.timeLeft = 240; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 6f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BrimstoneHomer : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Homer"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.timeLeft = 240; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 6f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs index 2f4cd8463c..eae8c20fe6 100644 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ b/Projectiles/Magic/BrimstoneTentacle.cs @@ -1,102 +1,102 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneTentacle : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tentacle"); - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.MaxUpdates = 3; - projectile.magic = true; - } - - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - if (Math.Abs(projectile.velocity.X) < 1f) - { - projectile.velocity.X = -projectile.velocity.X; - } - else - { - projectile.Kill(); - } - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = -projectile.velocity.Y; - } - else - { - projectile.Kill(); - } - } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) - { - projectile.localAI[0] += 0.01f; - } - else - { - projectile.localAI[0] += 0.025f; - } - if (projectile.localAI[0] >= 0.95f) - { - projectile.Kill(); - } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) - { - int num897 = 0; - while ((float)num897 < projectile.scale * 10f) - { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1.5f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + projectile.owner); - Main.dust[num898].scale += projectile.scale * 0.75f; - num897++; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BrimstoneTentacle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tentacle"); + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.MaxUpdates = 3; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + if (Math.Abs(projectile.velocity.X) < 1f) + { + projectile.velocity.X = -projectile.velocity.X; + } + else + { + projectile.Kill(); + } + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = -projectile.velocity.Y; + } + else + { + projectile.Kill(); + } + } + Vector2 center10 = projectile.Center; + projectile.scale = 1f - projectile.localAI[0]; + projectile.width = (int)(20f * projectile.scale); + projectile.height = projectile.width; + projectile.position.X = center10.X - (float)(projectile.width / 2); + projectile.position.Y = center10.Y - (float)(projectile.height / 2); + if ((double)projectile.localAI[0] < 0.1) + { + projectile.localAI[0] += 0.01f; + } + else + { + projectile.localAI[0] += 0.025f; + } + if (projectile.localAI[0] >= 0.95f) + { + projectile.Kill(); + } + projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; + projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } + projectile.ai[0] *= 1.05f; + projectile.ai[1] *= 1.05f; + if (projectile.scale < 1f) + { + int num897 = 0; + while ((float)num897 < projectile.scale * 10f) + { + int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1.5f); + Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + Main.dust[num898].noGravity = true; + Main.dust[num898].velocity *= 0.1f; + Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); + Main.dust[num898].fadeIn = (float)(100 + projectile.owner); + Main.dust[num898].scale += projectile.scale * 0.75f; + num897++; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + } + } +} diff --git a/Projectiles/Magic/Climax.cs b/Projectiles/Magic/Climax.cs index 0ed490e113..0abf82aca1 100644 --- a/Projectiles/Magic/Climax.cs +++ b/Projectiles/Magic/Climax.cs @@ -1,133 +1,133 @@ -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 Climax : ModProjectile - { - 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 = 150; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.98f; - projectile.velocity.Y *= 0.98f; - 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; - } - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - 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 +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 Climax : ModProjectile + { + 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 = 150; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.98f; + projectile.velocity.Y *= 0.98f; + 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; + } + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + 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; + } + } +} diff --git a/Projectiles/Magic/Climax2.cs b/Projectiles/Magic/Climax2.cs index ee4c04d00f..bb6a999887 100644 --- a/Projectiles/Magic/Climax2.cs +++ b/Projectiles/Magic/Climax2.cs @@ -132,4 +132,4 @@ namespace CalamityMod.Projectiles.Magic return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Magic/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index 43076407ab..3024d442d1 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ClimaxBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 90; - projectile.magic = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ClimaxBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 90; + projectile.magic = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/CoralSpike.cs b/Projectiles/Magic/CoralSpike.cs index 23a2b22eb4..c724eaa3ae 100644 --- a/Projectiles/Magic/CoralSpike.cs +++ b/Projectiles/Magic/CoralSpike.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class CoralSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Coral Spike"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.aiStyle = 14; - projectile.penetrate = 4; - projectile.timeLeft = 360; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.99f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class CoralSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Coral Spike"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.aiStyle = 14; + projectile.penetrate = 4; + projectile.timeLeft = 360; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.9f; + projectile.velocity.Y *= 0.99f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + } +} diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 1d79f5c459..8978bd42a4 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class CosmicTentacle : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tentacle"); - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.MaxUpdates = 3; - projectile.magic = true; - } - - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - if (Math.Abs(projectile.velocity.X) < 1f) - { - projectile.velocity.X = -projectile.velocity.X; - } - else - { - projectile.Kill(); - } - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = -projectile.velocity.Y; - } - else - { - projectile.Kill(); - } - } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) - { - projectile.localAI[0] += 0.01f; - } - else - { - projectile.localAI[0] += 0.025f; - } - if (projectile.localAI[0] >= 0.95f) - { - projectile.Kill(); - } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) - { - int num897 = 0; - while ((float)num897 < projectile.scale * 10f) - { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + projectile.owner); - Main.dust[num898].scale += projectile.scale * 0.75f; - num897++; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(BuffID.CursedInferno, 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class CosmicTentacle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tentacle"); + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.MaxUpdates = 3; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + if (Math.Abs(projectile.velocity.X) < 1f) + { + projectile.velocity.X = -projectile.velocity.X; + } + else + { + projectile.Kill(); + } + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = -projectile.velocity.Y; + } + else + { + projectile.Kill(); + } + } + Vector2 center10 = projectile.Center; + projectile.scale = 1f - projectile.localAI[0]; + projectile.width = (int)(20f * projectile.scale); + projectile.height = projectile.width; + projectile.position.X = center10.X - (float)(projectile.width / 2); + projectile.position.Y = center10.Y - (float)(projectile.height / 2); + if ((double)projectile.localAI[0] < 0.1) + { + projectile.localAI[0] += 0.01f; + } + else + { + projectile.localAI[0] += 0.025f; + } + if (projectile.localAI[0] >= 0.95f) + { + projectile.Kill(); + } + projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; + projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } + projectile.ai[0] *= 1.05f; + projectile.ai[1] *= 1.05f; + if (projectile.scale < 1f) + { + int num897 = 0; + while ((float)num897 < projectile.scale * 10f) + { + int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1.1f); + Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + Main.dust[num898].noGravity = true; + Main.dust[num898].velocity *= 0.1f; + Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); + Main.dust[num898].fadeIn = (float)(100 + projectile.owner); + Main.dust[num898].scale += projectile.scale * 0.75f; + num897++; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(BuffID.CursedInferno, 240); + } + } +} diff --git a/Projectiles/Magic/CryoBlast.cs b/Projectiles/Magic/CryoBlast.cs index b0c96befa0..6fab41e1bc 100644 --- a/Projectiles/Magic/CryoBlast.cs +++ b/Projectiles/Magic/CryoBlast.cs @@ -56,4 +56,4 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.Frostburn, 360); } } -} \ No newline at end of file +} diff --git a/Projectiles/Magic/DemonicPitchfork.cs b/Projectiles/Magic/DemonicPitchfork.cs index 26f48b5f6d..3255bf4d1d 100644 --- a/Projectiles/Magic/DemonicPitchfork.cs +++ b/Projectiles/Magic/DemonicPitchfork.cs @@ -1,70 +1,70 @@ -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 DemonicPitchfork : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pitchfork"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - aiType = 114; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); - if (projectile.localAI[1] > 7f) - { - int num307 = Main.rand.Next(3); - if (num307 == 0) - { - num307 = 14; - } - else if (num307 == 1) - { - num307 = 27; - } - else - { - num307 = 173; - } - int num308 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, num307, 0f, 0f, 100, default(Color), 1.25f); - Main.dust[num308].velocity *= 0.1f; - } - } - - 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 < 2; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 27, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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 DemonicPitchfork : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pitchfork"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 2; + projectile.timeLeft = 600; + aiType = 114; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); + if (projectile.localAI[1] > 7f) + { + int num307 = Main.rand.Next(3); + if (num307 == 0) + { + num307 = 14; + } + else if (num307 == 1) + { + num307 = 27; + } + else + { + num307 = 173; + } + int num308 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, num307, 0f, 0f, 100, default(Color), 1.25f); + Main.dust[num308].velocity *= 0.1f; + } + } + + 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 < 2; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 27, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Magic/DustProjectile.cs b/Projectiles/Magic/DustProjectile.cs index b844b9a9b6..711b7f4948 100644 --- a/Projectiles/Magic/DustProjectile.cs +++ b/Projectiles/Magic/DustProjectile.cs @@ -1,106 +1,106 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class DustProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 160; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.timeLeft > 60) - { - projectile.timeLeft = 60; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 32; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 4f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 2.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class DustProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 160; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.timeLeft > 60) + { + projectile.timeLeft = 60; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 32; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 4f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 2.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + } +} diff --git a/Projectiles/Magic/EidolicWail.cs b/Projectiles/Magic/EidolicWail.cs index 945596c7c2..15bb69d73f 100644 --- a/Projectiles/Magic/EidolicWail.cs +++ b/Projectiles/Magic/EidolicWail.cs @@ -1,92 +1,92 @@ -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 EidolicWail : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wail"); - } - - public override void SetDefaults() - { - projectile.width = 36; - projectile.height = 36; - projectile.scale = 0.005f; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.timeLeft = 450; - } - - public override void AI() - { - if (projectile.localAI[0] < 1f) - { - projectile.localAI[0] += 0.005f; //200 to reach full size and max power - projectile.scale += 0.005f; - projectile.width = (int)(36f * projectile.scale); - projectile.height = (int)(36f * projectile.scale); - } - else - { - projectile.width = 36; - projectile.height = 36; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage = (int)((double)damage * (double)projectile.localAI[0]); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - projectile.velocity *= 0.975f; - } - - 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 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 +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 EidolicWail : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wail"); + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 36; + projectile.scale = 0.005f; + projectile.alpha = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.timeLeft = 450; + } + + public override void AI() + { + if (projectile.localAI[0] < 1f) + { + projectile.localAI[0] += 0.005f; //200 to reach full size and max power + projectile.scale += 0.005f; + projectile.width = (int)(36f * projectile.scale); + projectile.height = (int)(36f * projectile.scale); + } + else + { + projectile.width = 36; + projectile.height = 36; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + damage = (int)((double)damage * (double)projectile.localAI[0]); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + projectile.velocity *= 0.975f; + } + + 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 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; + } + } +} diff --git a/Projectiles/Magic/EldritchTentacle.cs b/Projectiles/Magic/EldritchTentacle.cs index 7746495c94..1bab18a9ea 100644 --- a/Projectiles/Magic/EldritchTentacle.cs +++ b/Projectiles/Magic/EldritchTentacle.cs @@ -1,100 +1,100 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class EldritchTentacle : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tentacle"); - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.MaxUpdates = 3; - projectile.magic = true; - } - - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - if (Math.Abs(projectile.velocity.X) < 1f) - { - projectile.velocity.X = -projectile.velocity.X; - } - else - { - projectile.Kill(); - } - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = -projectile.velocity.Y; - } - else - { - projectile.Kill(); - } - } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) - { - projectile.localAI[0] += 0.01f; - } - else - { - projectile.localAI[0] += 0.025f; - } - if (projectile.localAI[0] >= 0.95f) - { - projectile.Kill(); - } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; - if (projectile.velocity.Length() > 16f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) - { - int num897 = 0; - while ((float)num897 < projectile.scale * 10f) - { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].fadeIn = (float)(100 + projectile.owner); - Main.dust[num898].scale += projectile.scale * 0.75f; - num897++; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class EldritchTentacle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tentacle"); + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.MaxUpdates = 3; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + if (Math.Abs(projectile.velocity.X) < 1f) + { + projectile.velocity.X = -projectile.velocity.X; + } + else + { + projectile.Kill(); + } + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = -projectile.velocity.Y; + } + else + { + projectile.Kill(); + } + } + Vector2 center10 = projectile.Center; + projectile.scale = 1f - projectile.localAI[0]; + projectile.width = (int)(20f * projectile.scale); + projectile.height = projectile.width; + projectile.position.X = center10.X - (float)(projectile.width / 2); + projectile.position.Y = center10.Y - (float)(projectile.height / 2); + if ((double)projectile.localAI[0] < 0.1) + { + projectile.localAI[0] += 0.01f; + } + else + { + projectile.localAI[0] += 0.025f; + } + if (projectile.localAI[0] >= 0.95f) + { + projectile.Kill(); + } + projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; + projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } + projectile.ai[0] *= 1.05f; + projectile.ai[1] *= 1.05f; + if (projectile.scale < 1f) + { + int num897 = 0; + while ((float)num897 < projectile.scale * 10f) + { + int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1.1f); + Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + Main.dust[num898].noGravity = true; + Main.dust[num898].velocity *= 0.1f; + Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); + Main.dust[num898].fadeIn = (float)(100 + projectile.owner); + Main.dust[num898].scale += projectile.scale * 0.75f; + num897++; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/ElementBolt.cs b/Projectiles/Magic/ElementBolt.cs index dce7111697..be574b54c0 100644 --- a/Projectiles/Magic/ElementBolt.cs +++ b/Projectiles/Magic/ElementBolt.cs @@ -1,52 +1,52 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ElementBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("ElementOrb2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ElementBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 30; + projectile.magic = true; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("ElementOrb2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + } +} diff --git a/Projectiles/Magic/ElementBolt2.cs b/Projectiles/Magic/ElementBolt2.cs index 0cf811e3ff..73c6d74245 100644 --- a/Projectiles/Magic/ElementBolt2.cs +++ b/Projectiles/Magic/ElementBolt2.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ElementBolt2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 15; - projectile.magic = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ElementBolt2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 15; + projectile.magic = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + } +} diff --git a/Projectiles/Magic/ElementOrb.cs b/Projectiles/Magic/ElementOrb.cs index 478d34f6fc..8117722c74 100644 --- a/Projectiles/Magic/ElementOrb.cs +++ b/Projectiles/Magic/ElementOrb.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ElementOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("ElementBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ElementOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("ElementBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } +} diff --git a/Projectiles/Magic/ElementOrb2.cs b/Projectiles/Magic/ElementOrb2.cs index 354eab3592..2de80139f0 100644 --- a/Projectiles/Magic/ElementOrb2.cs +++ b/Projectiles/Magic/ElementOrb2.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ElementOrb2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("ElementBolt2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ElementOrb2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("ElementBolt2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } +} diff --git a/Projectiles/Magic/ElementRay.cs b/Projectiles/Magic/ElementRay.cs index f253dae80b..bddc76b782 100644 --- a/Projectiles/Magic/ElementRay.cs +++ b/Projectiles/Magic/ElementRay.cs @@ -1,61 +1,61 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ElementRay : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 22f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("ElementOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 3; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ElementRay : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 22f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("ElementOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 3; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Magic/ElementTentacle.cs b/Projectiles/Magic/ElementTentacle.cs index 111b990524..631c3ee22e 100644 --- a/Projectiles/Magic/ElementTentacle.cs +++ b/Projectiles/Magic/ElementTentacle.cs @@ -1,103 +1,103 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ElementTentacle : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tentacle"); - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.MaxUpdates = 3; - projectile.magic = true; - projectile.tileCollide = false; - } - - public override void AI() - { - if (projectile.velocity.X != projectile.velocity.X) - { - if (Math.Abs(projectile.velocity.X) < 1f) - { - projectile.velocity.X = -projectile.velocity.X; - } - else - { - projectile.Kill(); - } - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = -projectile.velocity.Y; - } - else - { - projectile.Kill(); - } - } - Vector2 center10 = projectile.Center; - projectile.scale = 1f - projectile.localAI[0]; - projectile.width = (int)(20f * projectile.scale); - projectile.height = projectile.width; - projectile.position.X = center10.X - (float)(projectile.width / 2); - projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) - { - projectile.localAI[0] += 0.01f; - } - else - { - projectile.localAI[0] += 0.025f; - } - if (projectile.localAI[0] >= 0.95f) - { - projectile.Kill(); - } - projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 2f; - projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 2f; - if (projectile.velocity.Length() > 16f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } - projectile.ai[0] *= 1.05f; - projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) - { - int num897 = 0; - while ((float)num897 < projectile.scale * 10f) - { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, projectile.velocity.X, projectile.velocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); - Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; - Main.dust[num898].noGravity = true; - Main.dust[num898].velocity *= 0.1f; - Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); - Main.dust[num898].scale += projectile.scale * 0.75f; - num897++; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ElementTentacle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tentacle"); + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.MaxUpdates = 3; + projectile.magic = true; + projectile.tileCollide = false; + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + if (Math.Abs(projectile.velocity.X) < 1f) + { + projectile.velocity.X = -projectile.velocity.X; + } + else + { + projectile.Kill(); + } + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = -projectile.velocity.Y; + } + else + { + projectile.Kill(); + } + } + Vector2 center10 = projectile.Center; + projectile.scale = 1f - projectile.localAI[0]; + projectile.width = (int)(20f * projectile.scale); + projectile.height = projectile.width; + projectile.position.X = center10.X - (float)(projectile.width / 2); + projectile.position.Y = center10.Y - (float)(projectile.height / 2); + if ((double)projectile.localAI[0] < 0.1) + { + projectile.localAI[0] += 0.01f; + } + else + { + projectile.localAI[0] += 0.025f; + } + if (projectile.localAI[0] >= 0.95f) + { + projectile.Kill(); + } + projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 2f; + projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 2f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } + projectile.ai[0] *= 1.05f; + projectile.ai[1] *= 1.05f; + if (projectile.scale < 1f) + { + int num897 = 0; + while ((float)num897 < projectile.scale * 10f) + { + int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, projectile.velocity.X, projectile.velocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f); + Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; + Main.dust[num898].noGravity = true; + Main.dust[num898].velocity *= 0.1f; + Main.dust[num898].velocity -= projectile.velocity * (1.3f - projectile.scale); + Main.dust[num898].scale += projectile.scale * 0.75f; + num897++; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Magic/EvergladeSprayProjectile.cs b/Projectiles/Magic/EvergladeSprayProjectile.cs index a6f97fc950..e24be54f70 100644 --- a/Projectiles/Magic/EvergladeSprayProjectile.cs +++ b/Projectiles/Magic/EvergladeSprayProjectile.cs @@ -1,80 +1,80 @@ -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 EvergladeSprayProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spray"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 6; - projectile.extraUpdates = 2; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) - { - projectile.Kill(); - } - if (projectile.ai[0] <= 3f) - { - projectile.ai[0] += 1f; - return; - } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; - for (int num151 = 0; num151 < 3; num151++) - { - float num152 = projectile.velocity.X / 3f * (float)num151; - float num153 = projectile.velocity.Y / 3f * (float)num151; - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 157, 0f, 0f, 100, default(Color), 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - Dust expr_6A04_cp_0 = Main.dust[num155]; - expr_6A04_cp_0.position.X = expr_6A04_cp_0.position.X - num152; - Dust expr_6A1F_cp_0 = Main.dust[num155]; - expr_6A1F_cp_0.position.Y = expr_6A1F_cp_0.position.Y - num153; - } - if (Main.rand.Next(8) == 0) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 157, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.Ichor, 1200); - target.AddBuff(BuffID.CursedInferno, 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 +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 EvergladeSprayProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spray"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 6; + projectile.extraUpdates = 2; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.scale -= 0.002f; + if (projectile.scale <= 0f) + { + projectile.Kill(); + } + if (projectile.ai[0] <= 3f) + { + projectile.ai[0] += 1f; + return; + } + projectile.velocity.Y = projectile.velocity.Y + 0.075f; + for (int num151 = 0; num151 < 3; num151++) + { + float num152 = projectile.velocity.X / 3f * (float)num151; + float num153 = projectile.velocity.Y / 3f * (float)num151; + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 157, 0f, 0f, 100, default(Color), 1f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + Dust expr_6A04_cp_0 = Main.dust[num155]; + expr_6A04_cp_0.position.X = expr_6A04_cp_0.position.X - num152; + Dust expr_6A1F_cp_0 = Main.dust[num155]; + expr_6A1F_cp_0.position.Y = expr_6A1F_cp_0.position.Y - num153; + } + if (Main.rand.Next(8) == 0) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 157, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.Ichor, 1200); + target.AddBuff(BuffID.CursedInferno, 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; + } + } +} diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs index c1b95c5c98..359f55b2d2 100644 --- a/Projectiles/Magic/FabBolt.cs +++ b/Projectiles/Magic/FabBolt.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FabBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 90; - projectile.magic = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FabBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 90; + projectile.magic = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + } +} diff --git a/Projectiles/Magic/FabOrb.cs b/Projectiles/Magic/FabOrb.cs index aae5b64cbb..278a7d9d33 100644 --- a/Projectiles/Magic/FabOrb.cs +++ b/Projectiles/Magic/FabOrb.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FabOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("FabBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FabOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("FabBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } +} diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index 37a54e445d..63fbdaacd4 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FabRay : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 20; - projectile.extraUpdates = 100; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 0; - } - - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 9f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("FabOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 16f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FabRay : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 20; + projectile.extraUpdates = 100; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 0; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 9f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("FabOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 16f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + + 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; + } + } +} diff --git a/Projectiles/Magic/FatesReveal.cs b/Projectiles/Magic/FatesReveal.cs index 7bed332928..33f1733cab 100644 --- a/Projectiles/Magic/FatesReveal.cs +++ b/Projectiles/Magic/FatesReveal.cs @@ -1,171 +1,171 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FatesReveal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fireball"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 180; - projectile.magic = true; - } - - public override void AI() - { - float num949 = 10f; - float scaleFactor11 = 15f; - float num950 = 160f; - if (projectile.timeLeft > 30 && projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha = 128; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num3 = projectile.frameCounter + 1; - projectile.frameCounter = num3; - if (num3 > 4) - { - projectile.frameCounter = 0; - num3 = projectile.frame + 1; - projectile.frame = num3; - if (num3 >= 4) - { - projectile.frame = 0; - } - } - float num951 = 0.5f; - if (projectile.timeLeft < 120) - { - num951 = 1.1f; - } - if (projectile.timeLeft < 60) - { - num951 = 1.6f; - } - float[] var_2_2A211_cp_0 = projectile.ai; - int var_2_2A211_cp_1 = 1; - float num73 = var_2_2A211_cp_0[var_2_2A211_cp_1]; - var_2_2A211_cp_0[var_2_2A211_cp_1] = num73 + 1f; - float num952 = projectile.ai[1] / 180f * 6.28318548f; - for (float num953 = 0f; num953 < 3f; num953 = num73 + 1f) - { - if (Main.rand.Next(3) != 0) - { - return; - } - Dust dust13 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 60, 0f, -2f, 0, default(Color), 1f)]; - dust13.position = projectile.Center + Vector2.UnitY.RotatedBy((double)(num953 * 6.28318548f / 3f + projectile.ai[1]), default(Vector2)) * 10f; - dust13.noGravity = true; - dust13.velocity = projectile.DirectionFrom(dust13.position); - dust13.scale = num951; - dust13.fadeIn = 0.5f; - dust13.alpha = 200; - num73 = num953; - } - if (projectile.timeLeft < 4) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 180); - projectile.Center = projectile.position; - projectile.damage = 800; - for (int num955 = 0; num955 < 10; num955 = num3 + 1) - { - Dust dust13 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, 0f, -2f, 0, default(Color), 1f)]; - dust13.noGravity = true; - if (dust13.position != projectile.Center) - { - dust13.velocity = projectile.DirectionTo(dust13.position) * 3f; - } - num3 = num955; - } - } - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num950) - { - Vector2 vector118 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector118.HasNaNs()) - { - vector118 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num949 - 1f) + vector118 * scaleFactor11) / num949; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 30) - { - float num4 = (float)projectile.timeLeft / 30f; - projectile.alpha = (int)(255f - 255f * num4); - } - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 128 - projectile.alpha / 2); - } - - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 180); - projectile.Center = projectile.position; - projectile.damage = projectile.damage * 3; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); - int num3; - for (int num122 = 0; num122 < 3; num122 = num3 + 1) - { - int num123 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num123].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - num3 = num122; - } - for (int num124 = 0; num124 < 10; num124 = num3 + 1) - { - int num125 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num125].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num125].noGravity = true; - Dust dust = Main.dust[num125]; - dust.velocity *= 2f; - num3 = num124; - } - for (int num126 = 0; num126 < 5; num126 = num3 + 1) - { - int num127 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num127].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; - Main.dust[num127].noGravity = true; - Dust dust = Main.dust[num127]; - dust.velocity *= 2f; - num3 = num126; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FatesReveal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fireball"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 180; + projectile.magic = true; + } + + public override void AI() + { + float num949 = 10f; + float scaleFactor11 = 15f; + float num950 = 160f; + if (projectile.timeLeft > 30 && projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha = 128; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int num3 = projectile.frameCounter + 1; + projectile.frameCounter = num3; + if (num3 > 4) + { + projectile.frameCounter = 0; + num3 = projectile.frame + 1; + projectile.frame = num3; + if (num3 >= 4) + { + projectile.frame = 0; + } + } + float num951 = 0.5f; + if (projectile.timeLeft < 120) + { + num951 = 1.1f; + } + if (projectile.timeLeft < 60) + { + num951 = 1.6f; + } + float[] var_2_2A211_cp_0 = projectile.ai; + int var_2_2A211_cp_1 = 1; + float num73 = var_2_2A211_cp_0[var_2_2A211_cp_1]; + var_2_2A211_cp_0[var_2_2A211_cp_1] = num73 + 1f; + float num952 = projectile.ai[1] / 180f * 6.28318548f; + for (float num953 = 0f; num953 < 3f; num953 = num73 + 1f) + { + if (Main.rand.Next(3) != 0) + { + return; + } + Dust dust13 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 60, 0f, -2f, 0, default(Color), 1f)]; + dust13.position = projectile.Center + Vector2.UnitY.RotatedBy((double)(num953 * 6.28318548f / 3f + projectile.ai[1]), default(Vector2)) * 10f; + dust13.noGravity = true; + dust13.velocity = projectile.DirectionFrom(dust13.position); + dust13.scale = num951; + dust13.fadeIn = 0.5f; + dust13.alpha = 200; + num73 = num953; + } + if (projectile.timeLeft < 4) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 180); + projectile.Center = projectile.position; + projectile.damage = 800; + for (int num955 = 0; num955 < 10; num955 = num3 + 1) + { + Dust dust13 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, 0f, -2f, 0, default(Color), 1f)]; + dust13.noGravity = true; + if (dust13.position != projectile.Center) + { + dust13.velocity = projectile.DirectionTo(dust13.position) * 3f; + } + num3 = num955; + } + } + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num950) + { + Vector2 vector118 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector118.HasNaNs()) + { + vector118 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num949 - 1f) + vector118 * scaleFactor11) / num949; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 30) + { + float num4 = (float)projectile.timeLeft / 30f; + projectile.alpha = (int)(255f - 255f * num4); + } + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 128 - projectile.alpha / 2); + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 180); + projectile.Center = projectile.position; + projectile.damage = projectile.damage * 3; + projectile.Damage(); + Main.PlaySound(SoundID.Item14, projectile.position); + int num3; + for (int num122 = 0; num122 < 3; num122 = num3 + 1) + { + int num123 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num123].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num3 = num122; + } + for (int num124 = 0; num124 < 10; num124 = num3 + 1) + { + int num125 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num125].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num125].noGravity = true; + Dust dust = Main.dust[num125]; + dust.velocity *= 2f; + num3 = num124; + } + for (int num126 = 0; num126 < 5; num126 = num3 + 1) + { + int num127 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num127].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; + Main.dust[num127].noGravity = true; + Dust dust = Main.dust[num127]; + dust.velocity *= 2f; + num3 = num126; + } + } + } +} diff --git a/Projectiles/Magic/FlameBeamTip.cs b/Projectiles/Magic/FlameBeamTip.cs index 2d8c45fd72..4431363a02 100644 --- a/Projectiles/Magic/FlameBeamTip.cs +++ b/Projectiles/Magic/FlameBeamTip.cs @@ -1,96 +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 FlameBeamTip : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; - } - if (Main.myPlayer == projectile.owner) - { - int num48 = projectile.type; - if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) - { - num48 = mod.ProjectileType("FlameBeamTip2"); - } - int num49 = projectile.damage; - float num50 = projectile.knockBack; - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); - NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - { - for (int num55 = 0; num55 < 8; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, projectile.velocity.X * 0.025f, projectile.velocity.Y * 0.025f, 200, default(Color), 1f); - Main.dust[num56].noGravity = true; - Main.dust[num56].velocity *= 0.5f; - } - } - projectile.alpha += 7; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - } - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, 0f, 0f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.OnFire, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FlameBeamTip : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + if (Main.myPlayer == projectile.owner) + { + int num48 = projectile.type; + if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) + { + num48 = mod.ProjectileType("FlameBeamTip2"); + } + int num49 = projectile.damage; + float num50 = projectile.knockBack; + int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); + NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, projectile.velocity.X * 0.025f, projectile.velocity.Y * 0.025f, 200, default(Color), 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, 0f, 0f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Projectiles/Magic/FlameBeamTip2.cs b/Projectiles/Magic/FlameBeamTip2.cs index 337b24d32c..8fd1a7a44a 100644 --- a/Projectiles/Magic/FlameBeamTip2.cs +++ b/Projectiles/Magic/FlameBeamTip2.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FlameBeamTip2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; - } - } - } - else - { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - { - for (int num55 = 0; num55 < 8; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, projectile.velocity.X * 0.025f, projectile.velocity.Y * 0.025f, 200, default(Color), 1f); - Main.dust[num56].noGravity = true; - Main.dust[num56].velocity *= 0.5f; - } - } - projectile.alpha += 7; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - } - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, 0f, 0f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.OnFire, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FlameBeamTip2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, projectile.velocity.X * 0.025f, projectile.velocity.Y * 0.025f, 200, default(Color), 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, 0f, 0f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Projectiles/Magic/FlamePillar.cs b/Projectiles/Magic/FlamePillar.cs index 0e5901420a..1c224afb7f 100644 --- a/Projectiles/Magic/FlamePillar.cs +++ b/Projectiles/Magic/FlamePillar.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FlamePillar : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pillar"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 127; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FlamePillar : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pillar"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 90; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 90) + { + projectile.timeLeft = 90; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 127; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + } + } +} diff --git a/Projectiles/Magic/FlamingPumpkin.cs b/Projectiles/Magic/FlamingPumpkin.cs index bda2b4c8ef..491f43b4fc 100644 --- a/Projectiles/Magic/FlamingPumpkin.cs +++ b/Projectiles/Magic/FlamingPumpkin.cs @@ -1,35 +1,35 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Projectiles.Magic -{ - public class FlamingPumpkin : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pumpkin"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 14; - projectile.penetrate = 2; - projectile.timeLeft = 200; - projectile.magic = true; - projectile.friendly = true; - } - - public override void AI() - { - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 64, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Projectiles.Magic +{ + public class FlamingPumpkin : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pumpkin"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 14; + projectile.penetrate = 2; + projectile.timeLeft = 200; + projectile.magic = true; + projectile.friendly = true; + } + + public override void AI() + { + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 64, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index cb36503259..faecc916c4 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -1,103 +1,103 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FlareBoltProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 4; - projectile.timeLeft /= 2; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); - for (int num92 = 0; num92 < 5; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; - } - if (Main.rand.Next(5) == 0) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - - 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; - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - return false; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 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.OnFire, 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FlareBoltProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 4; + projectile.timeLeft /= 2; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); + for (int num92 = 0; num92 < 5; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + } + if (Main.rand.Next(5) == 0) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + 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; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 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.OnFire, 240); + } + } +} diff --git a/Projectiles/Magic/ForbiddenAxeBlade.cs b/Projectiles/Magic/ForbiddenAxeBlade.cs index 9911982998..59e8562733 100644 --- a/Projectiles/Magic/ForbiddenAxeBlade.cs +++ b/Projectiles/Magic/ForbiddenAxeBlade.cs @@ -1,61 +1,61 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ForbiddenAxeBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.magic = true; - } - - public override void AI() - { - projectile.alpha -= 3; - projectile.rotation += 0.75f; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 20f) - { - projectile.velocity.X *= 0.85f; - projectile.velocity.Y *= 0.85f; - } - else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) - { - projectile.velocity.X *= 1.25f; - projectile.velocity.Y *= 1.25f; - } - else if (projectile.ai[1] == 40f) - { - projectile.ai[1] = 0f; - } - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ForbiddenAxeBlade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.magic = true; + } + + public override void AI() + { + projectile.alpha -= 3; + projectile.rotation += 0.75f; + projectile.ai[1] += 1f; + if (projectile.ai[1] <= 20f) + { + projectile.velocity.X *= 0.85f; + projectile.velocity.Y *= 0.85f; + } + else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) + { + projectile.velocity.X *= 1.25f; + projectile.velocity.Y *= 1.25f; + } + else if (projectile.ai[1] == 40f) + { + projectile.ai[1] = 0f; + } + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Magic/ForbiddenSunProjectile.cs b/Projectiles/Magic/ForbiddenSunProjectile.cs index 107db23b3a..fc1104b904 100644 --- a/Projectiles/Magic/ForbiddenSunProjectile.cs +++ b/Projectiles/Magic/ForbiddenSunProjectile.cs @@ -1,61 +1,61 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ForbiddenSunProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sun"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ForbiddenSunburst"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ForbiddenSunProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sun"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ForbiddenSunburst"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + } + } +} diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index 82fdbdc43d..5d65ae910f 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -1,105 +1,105 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ForbiddenSunburst : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sunburst"); - } - - public override void SetDefaults() - { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 150; - projectile.magic = true; - } - - 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); - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - } - 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(-25, 26); - float num464 = (float)Main.rand.Next(-25, 26); - float num465 = (float)Main.rand.Next(9, 24); - 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, 55, 0f, 0f, 100, default(Color), 2.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.OnFire, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ForbiddenSunburst : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sunburst"); + } + + public override void SetDefaults() + { + projectile.width = 250; + projectile.height = 250; + projectile.friendly = true; + projectile.ignoreWater = false; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 150; + projectile.magic = true; + } + + 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); + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + } + 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(-25, 26); + float num464 = (float)Main.rand.Next(-25, 26); + float num465 = (float)Main.rand.Next(9, 24); + 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, 55, 0f, 0f, 100, default(Color), 2.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.OnFire, 600); + } + } +} diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index 9d67d5f8ec..0c3ad73ec2 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -1,127 +1,127 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FrigidflashBoltProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 5; - projectile.timeLeft /= 2; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.02f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num92 = 0; num92 < 3; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; - } - if (Main.rand.Next(5) == 0) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - for (int num105 = 0; num105 < 3; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; - } - if (Main.rand.Next(5) == 0) - { - int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - - 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; - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - 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 < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, 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.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FrigidflashBoltProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 5; + projectile.timeLeft /= 2; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.02f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num92 = 0; num92 < 3; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + } + if (Main.rand.Next(5) == 0) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } + for (int num105 = 0; num105 < 3; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + } + if (Main.rand.Next(5) == 0) + { + int num103 = 4; + int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num104].velocity *= 0.25f; + Main.dust[num104].velocity += projectile.velocity * 0.5f; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + 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; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + 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 < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, 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.OnFire, 300); + target.AddBuff(BuffID.Frostburn, 300); + } + } +} diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index d8ad0235b2..5dc890c3cb 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -1,103 +1,103 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FrostBoltProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.timeLeft /= 2; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); - for (int num105 = 0; num105 < 3; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; - } - if (Main.rand.Next(5) == 0) - { - int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - - 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; - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - 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, 92, 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, 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class FrostBoltProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 2; + projectile.timeLeft /= 2; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); + for (int num105 = 0; num105 < 3; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + } + if (Main.rand.Next(5) == 0) + { + int num103 = 4; + int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num104].velocity *= 0.25f; + Main.dust[num104].velocity += projectile.velocity * 0.5f; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + 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; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + 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, 92, 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, 60); + } + } +} diff --git a/Projectiles/Magic/GammaLaser.cs b/Projectiles/Magic/GammaLaser.cs index 06c474cd6d..294ad6b4fd 100644 --- a/Projectiles/Magic/GammaLaser.cs +++ b/Projectiles/Magic/GammaLaser.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class GammaLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 150; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 1; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GammaLaser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.timeLeft = 150; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 1; + } + } +} diff --git a/Projectiles/Magic/GhastlyBlast.cs b/Projectiles/Magic/GhastlyBlast.cs index dd9f3edbff..8ef85b6e3f 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -1,331 +1,331 @@ -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 GhastlyBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 6; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - public override void AI() - { - float[] var_2_2DDF8_cp_0 = projectile.ai; - int var_2_2DDF8_cp_1 = 0; - float num73 = var_2_2DDF8_cp_0[var_2_2DDF8_cp_1]; - var_2_2DDF8_cp_0[var_2_2DDF8_cp_1] = num73 + 1f; - int num1013 = 0; - if (projectile.velocity.Length() <= 8f) //4 - { - num1013 = 1; - } - projectile.alpha -= 15; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (num1013 == 0) - { - projectile.rotation -= 0.104719758f; - if (Main.rand.Next(3) == 0) - { - if (Main.rand.Next(2) == 0) - { - Vector2 vector140 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust28 = Main.dust[Dust.NewDust(projectile.Center - vector140 * 30f, 0, 0, 60, 0f, 0f, 0, default(Color), 1f)]; - dust28.noGravity = true; - dust28.position = projectile.Center - vector140 * (float)Main.rand.Next(10, 21); - dust28.velocity = vector140.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; - dust28.scale = 0.5f + Main.rand.NextFloat(); - dust28.fadeIn = 0.5f; - dust28.customData = projectile; - } - else - { - Vector2 vector141 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust29 = Main.dust[Dust.NewDust(projectile.Center - vector141 * 30f, 0, 0, 60, 0f, 0f, 0, default(Color), 1f)]; - dust29.noGravity = true; - dust29.position = projectile.Center - vector141 * 30f; - dust29.velocity = vector141.RotatedBy(-1.5707963705062866, default(Vector2)) * 3f; - dust29.scale = 0.5f + Main.rand.NextFloat(); - dust29.fadeIn = 0.5f; - dust29.customData = projectile; - } - } - if (projectile.ai[0] >= 30f) - { - projectile.velocity *= 0.98f; - projectile.scale += 0.00744680827f; - if (projectile.scale > 1.2f) - { - projectile.scale = 1.2f; - } - projectile.rotation -= 0.0174532924f; - } - if (projectile.velocity.Length() < 8.2f) //4.1 - { - projectile.velocity.Normalize(); - projectile.velocity *= 4f; - projectile.ai[0] = 0f; - } - } - else if (num1013 == 1) - { - projectile.rotation -= 0.104719758f; - int num3; - for (int num1014 = 0; num1014 < 1; num1014 = num3 + 1) - { - if (Main.rand.Next(2) == 0) - { - Vector2 vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default(Color), 1f)]; - dust30.noGravity = true; - dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); - dust30.velocity = vector142.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; - dust30.scale = 0.9f + Main.rand.NextFloat(); - dust30.fadeIn = 0.5f; - dust30.customData = projectile; - vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default(Color), 1f)]; - dust30.noGravity = true; - dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); - dust30.velocity = vector142.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; - dust30.scale = 0.9f + Main.rand.NextFloat(); - dust30.fadeIn = 0.5f; - dust30.customData = projectile; - dust30.color = Color.Crimson; - } - else - { - Vector2 vector143 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust31 = Main.dust[Dust.NewDust(projectile.Center - vector143 * 30f, 0, 0, 60, 0f, 0f, 0, default(Color), 1f)]; - dust31.noGravity = true; - dust31.position = projectile.Center - vector143 * (float)Main.rand.Next(20, 31); - dust31.velocity = vector143.RotatedBy(-1.5707963705062866, default(Vector2)) * 5f; - dust31.scale = 0.9f + Main.rand.NextFloat(); - dust31.fadeIn = 0.5f; - dust31.customData = projectile; - } - num3 = num1014; - } - if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 241f && Main.myPlayer == projectile.owner) - { - Vector2 vector144 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector144.X, vector144.Y, mod.ProjectileType("GhastlySubBlast"), projectile.damage, 0f, projectile.owner, 0f, (float)projectile.whoAmI); - } - Vector2 vector145 = projectile.Center; - float num1015 = 800f; - bool flag59 = false; - int num1016 = 0; - if (projectile.ai[1] == 0f) - { - for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) - { - if (Main.npc[num1017].CanBeChasedBy(projectile, false)) - { - Vector2 center13 = Main.npc[num1017].Center; - if (projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) - { - num1015 = projectile.Distance(center13); - vector145 = center13; - flag59 = true; - num1016 = num1017; - } - } - num3 = num1017; - } - if (flag59) - { - if (projectile.ai[1] != (float)(num1016 + 1)) - { - projectile.netUpdate = true; - } - projectile.ai[1] = (float)(num1016 + 1); - } - flag59 = false; - } - if (projectile.ai[1] != 0f) - { - int num1018 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(projectile, true) && projectile.Distance(Main.npc[num1018].Center) < 1000f) - { - flag59 = true; - vector145 = Main.npc[num1018].Center; - } - } - if (!projectile.friendly) - { - flag59 = false; - } - if (projectile.localAI[0] < 60f) - { - projectile.localAI[0] += 1f; - } - if (flag59 && projectile.localAI[0] >= 60f) - { - float num1019 = 24f; //14 - int num1020 = 8; - Vector2 vector146 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num1021 = vector145.X - vector146.X; - float num1022 = vector145.Y - vector146.Y; - float num1023 = (float)Math.Sqrt((double)(num1021 * num1021 + num1022 * num1022)); - num1023 = num1019 / num1023; - num1021 *= num1023; - num1022 *= num1023; - projectile.velocity.X = (projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; - } - } - if (projectile.alpha < 150) - { - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0.1f); - } - if (projectile.ai[0] >= 600f) - { - 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(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha); - } - - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 238); - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); - int num3; - for (int num95 = 0; num95 < 4; num95 = num3 + 1) - { - int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num96].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - num3 = num95; - } - for (int num97 = 0; num97 < 30; num97 = num3 + 1) - { - int num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default(Color), 3.7f); - Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num98].noGravity = true; - Dust dust = Main.dust[num98]; - dust.velocity *= 3f; - num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num98]; - dust.velocity *= 2f; - Main.dust[num98].noGravity = true; - Main.dust[num98].fadeIn = 1f; - Main.dust[num98].color = Color.Crimson * 0.5f; - num3 = num97; - } - for (int num99 = 0; num99 < 10; num99 = num3 + 1) - { - int num100 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 2.7f); - Main.dust[num100].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; - Main.dust[num100].noGravity = true; - Dust dust = Main.dust[num100]; - dust.velocity *= 3f; - num3 = num99; - } - for (int num101 = 0; num101 < 10; num101 = num3 + 1) - { - int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num102].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; - Main.dust[num102].noGravity = true; - Dust dust = Main.dust[num102]; - dust.velocity *= 3f; - num3 = num101; - } - if (Main.myPlayer == projectile.owner) - { - for (int num105 = 0; num105 < 1000; num105 = num3 + 1) - { - if (Main.projectile[num105].active && Main.projectile[num105].type == mod.ProjectileType("GhastlySubBlast") && Main.projectile[num105].ai[1] == (float)projectile.whoAmI) - { - Main.projectile[num105].Kill(); - } - num3 = num105; - } - int num106 = Main.rand.Next(5, 9); - int num107 = Main.rand.Next(5, 9); - int num108 = Utils.SelectRandom(Main.rand, new int[] - { - 60, - 180 - }); - int num109 = (num108 == 60) ? 180 : 60; - for (int num110 = 0; num110 < num106; num110 = num3 + 1) - { - Vector2 vector4 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); - Vector2 vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (vector5.X == 0f && vector5.Y == 0f) - { - vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - vector5.Normalize(); - if (vector5.Y > 0.2f) - { - vector5.Y *= -1f; - } - vector5 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(vector4.X, vector4.Y, vector5.X, vector5.Y, mod.ProjectileType("GhastlyExplosionShard"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num108, 0f); - num3 = num110; - } - for (int num111 = 0; num111 < num107; num111 = num3 + 1) - { - Vector2 vector6 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); - Vector2 vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (vector7.X == 0f && vector7.Y == 0f) - { - vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - vector7.Normalize(); - if (vector7.Y > 0.4f) - { - vector7.Y *= -1f; - } - vector7 *= (float)Main.rand.Next(40, 81) * 0.1f; - Projectile.NewProjectile(vector6.X, vector6.Y, vector7.X, vector7.Y, mod.ProjectileType("GhastlyExplosion"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num109, 0f); - num3 = num111; - } - } - } - } -} \ No newline at end of file +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 GhastlyBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 6; + projectile.extraUpdates = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + float[] var_2_2DDF8_cp_0 = projectile.ai; + int var_2_2DDF8_cp_1 = 0; + float num73 = var_2_2DDF8_cp_0[var_2_2DDF8_cp_1]; + var_2_2DDF8_cp_0[var_2_2DDF8_cp_1] = num73 + 1f; + int num1013 = 0; + if (projectile.velocity.Length() <= 8f) //4 + { + num1013 = 1; + } + projectile.alpha -= 15; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (num1013 == 0) + { + projectile.rotation -= 0.104719758f; + if (Main.rand.Next(3) == 0) + { + if (Main.rand.Next(2) == 0) + { + Vector2 vector140 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust28 = Main.dust[Dust.NewDust(projectile.Center - vector140 * 30f, 0, 0, 60, 0f, 0f, 0, default(Color), 1f)]; + dust28.noGravity = true; + dust28.position = projectile.Center - vector140 * (float)Main.rand.Next(10, 21); + dust28.velocity = vector140.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; + dust28.scale = 0.5f + Main.rand.NextFloat(); + dust28.fadeIn = 0.5f; + dust28.customData = projectile; + } + else + { + Vector2 vector141 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust29 = Main.dust[Dust.NewDust(projectile.Center - vector141 * 30f, 0, 0, 60, 0f, 0f, 0, default(Color), 1f)]; + dust29.noGravity = true; + dust29.position = projectile.Center - vector141 * 30f; + dust29.velocity = vector141.RotatedBy(-1.5707963705062866, default(Vector2)) * 3f; + dust29.scale = 0.5f + Main.rand.NextFloat(); + dust29.fadeIn = 0.5f; + dust29.customData = projectile; + } + } + if (projectile.ai[0] >= 30f) + { + projectile.velocity *= 0.98f; + projectile.scale += 0.00744680827f; + if (projectile.scale > 1.2f) + { + projectile.scale = 1.2f; + } + projectile.rotation -= 0.0174532924f; + } + if (projectile.velocity.Length() < 8.2f) //4.1 + { + projectile.velocity.Normalize(); + projectile.velocity *= 4f; + projectile.ai[0] = 0f; + } + } + else if (num1013 == 1) + { + projectile.rotation -= 0.104719758f; + int num3; + for (int num1014 = 0; num1014 < 1; num1014 = num3 + 1) + { + if (Main.rand.Next(2) == 0) + { + Vector2 vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default(Color), 1f)]; + dust30.noGravity = true; + dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); + dust30.velocity = vector142.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; + dust30.scale = 0.9f + Main.rand.NextFloat(); + dust30.fadeIn = 0.5f; + dust30.customData = projectile; + vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default(Color), 1f)]; + dust30.noGravity = true; + dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); + dust30.velocity = vector142.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; + dust30.scale = 0.9f + Main.rand.NextFloat(); + dust30.fadeIn = 0.5f; + dust30.customData = projectile; + dust30.color = Color.Crimson; + } + else + { + Vector2 vector143 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust31 = Main.dust[Dust.NewDust(projectile.Center - vector143 * 30f, 0, 0, 60, 0f, 0f, 0, default(Color), 1f)]; + dust31.noGravity = true; + dust31.position = projectile.Center - vector143 * (float)Main.rand.Next(20, 31); + dust31.velocity = vector143.RotatedBy(-1.5707963705062866, default(Vector2)) * 5f; + dust31.scale = 0.9f + Main.rand.NextFloat(); + dust31.fadeIn = 0.5f; + dust31.customData = projectile; + } + num3 = num1014; + } + if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 241f && Main.myPlayer == projectile.owner) + { + Vector2 vector144 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector144.X, vector144.Y, mod.ProjectileType("GhastlySubBlast"), projectile.damage, 0f, projectile.owner, 0f, (float)projectile.whoAmI); + } + Vector2 vector145 = projectile.Center; + float num1015 = 800f; + bool flag59 = false; + int num1016 = 0; + if (projectile.ai[1] == 0f) + { + for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) + { + if (Main.npc[num1017].CanBeChasedBy(projectile, false)) + { + Vector2 center13 = Main.npc[num1017].Center; + if (projectile.Distance(center13) < num1015 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num1017].position, Main.npc[num1017].width, Main.npc[num1017].height)) + { + num1015 = projectile.Distance(center13); + vector145 = center13; + flag59 = true; + num1016 = num1017; + } + } + num3 = num1017; + } + if (flag59) + { + if (projectile.ai[1] != (float)(num1016 + 1)) + { + projectile.netUpdate = true; + } + projectile.ai[1] = (float)(num1016 + 1); + } + flag59 = false; + } + if (projectile.ai[1] != 0f) + { + int num1018 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num1018].active && Main.npc[num1018].CanBeChasedBy(projectile, true) && projectile.Distance(Main.npc[num1018].Center) < 1000f) + { + flag59 = true; + vector145 = Main.npc[num1018].Center; + } + } + if (!projectile.friendly) + { + flag59 = false; + } + if (projectile.localAI[0] < 60f) + { + projectile.localAI[0] += 1f; + } + if (flag59 && projectile.localAI[0] >= 60f) + { + float num1019 = 24f; //14 + int num1020 = 8; + Vector2 vector146 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num1021 = vector145.X - vector146.X; + float num1022 = vector145.Y - vector146.Y; + float num1023 = (float)Math.Sqrt((double)(num1021 * num1021 + num1022 * num1022)); + num1023 = num1019 / num1023; + num1021 *= num1023; + num1022 *= num1023; + projectile.velocity.X = (projectile.velocity.X * (float)(num1020 - 1) + num1021) / (float)num1020; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num1020 - 1) + num1022) / (float)num1020; + } + } + if (projectile.alpha < 150) + { + Lighting.AddLight(projectile.Center, 0.9f, 0f, 0.1f); + } + if (projectile.ai[0] >= 600f) + { + 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(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha); + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 238); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.Damage(); + Main.PlaySound(SoundID.Item14, projectile.position); + int num3; + for (int num95 = 0; num95 < 4; num95 = num3 + 1) + { + int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num96].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num3 = num95; + } + for (int num97 = 0; num97 < 30; num97 = num3 + 1) + { + int num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default(Color), 3.7f); + Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num98].noGravity = true; + Dust dust = Main.dust[num98]; + dust.velocity *= 3f; + num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num98]; + dust.velocity *= 2f; + Main.dust[num98].noGravity = true; + Main.dust[num98].fadeIn = 1f; + Main.dust[num98].color = Color.Crimson * 0.5f; + num3 = num97; + } + for (int num99 = 0; num99 < 10; num99 = num3 + 1) + { + int num100 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 2.7f); + Main.dust[num100].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; + Main.dust[num100].noGravity = true; + Dust dust = Main.dust[num100]; + dust.velocity *= 3f; + num3 = num99; + } + for (int num101 = 0; num101 < 10; num101 = num3 + 1) + { + int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num102].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; + Main.dust[num102].noGravity = true; + Dust dust = Main.dust[num102]; + dust.velocity *= 3f; + num3 = num101; + } + if (Main.myPlayer == projectile.owner) + { + for (int num105 = 0; num105 < 1000; num105 = num3 + 1) + { + if (Main.projectile[num105].active && Main.projectile[num105].type == mod.ProjectileType("GhastlySubBlast") && Main.projectile[num105].ai[1] == (float)projectile.whoAmI) + { + Main.projectile[num105].Kill(); + } + num3 = num105; + } + int num106 = Main.rand.Next(5, 9); + int num107 = Main.rand.Next(5, 9); + int num108 = Utils.SelectRandom(Main.rand, new int[] + { + 60, + 180 + }); + int num109 = (num108 == 60) ? 180 : 60; + for (int num110 = 0; num110 < num106; num110 = num3 + 1) + { + Vector2 vector4 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); + Vector2 vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (vector5.X == 0f && vector5.Y == 0f) + { + vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + vector5.Normalize(); + if (vector5.Y > 0.2f) + { + vector5.Y *= -1f; + } + vector5 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(vector4.X, vector4.Y, vector5.X, vector5.Y, mod.ProjectileType("GhastlyExplosionShard"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num108, 0f); + num3 = num110; + } + for (int num111 = 0; num111 < num107; num111 = num3 + 1) + { + Vector2 vector6 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); + Vector2 vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (vector7.X == 0f && vector7.Y == 0f) + { + vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + vector7.Normalize(); + if (vector7.Y > 0.4f) + { + vector7.Y *= -1f; + } + vector7 *= (float)Main.rand.Next(40, 81) * 0.1f; + Projectile.NewProjectile(vector6.X, vector6.Y, vector7.X, vector7.Y, mod.ProjectileType("GhastlyExplosion"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num109, 0f); + num3 = num111; + } + } + } + } +} diff --git a/Projectiles/Magic/GhastlyExplosion.cs b/Projectiles/Magic/GhastlyExplosion.cs index 09a53e1803..d943a304f9 100644 --- a/Projectiles/Magic/GhastlyExplosion.cs +++ b/Projectiles/Magic/GhastlyExplosion.cs @@ -1,94 +1,94 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class GhastlyExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.magic = true; - } - - public override void AI() - { - int num3; - int num328 = (int)projectile.ai[0]; - for (int num329 = 0; num329 < 3; num329 = num3 + 1) - { - int num330 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, num328, default(Color), 1.2f); - Main.dust[num330].position = (Main.dust[num330].position + projectile.Center) / 2f; - Main.dust[num330].noGravity = true; - Dust dust = Main.dust[num330]; - dust.velocity *= 0.5f; - num3 = num329; - } - for (int num331 = 0; num331 < 2; num331 = num3 + 1) - { - int num330 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, num328, default(Color), 0.4f); - if (num331 == 0) - { - Main.dust[num330].position = (Main.dust[num330].position + projectile.Center * 5f) / 6f; - } - else if (num331 == 1) - { - Main.dust[num330].position = (Main.dust[num330].position + (projectile.Center + projectile.velocity / 2f) * 5f) / 6f; - } - Dust dust = Main.dust[num330]; - dust.velocity *= 0.1f; - Main.dust[num330].noGravity = true; - Main.dust[num330].fadeIn = 1f; - num3 = num331; - } - return; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item50, projectile.position); - int num3; - for (int num116 = 0; num116 < 20; num116 = num3 + 1) - { - int num117 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default(Color), 0.5f); - Dust dust; - Main.dust[num117].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f; - Main.dust[num117].noGravity = true; - dust = Main.dust[num117]; - dust.velocity *= 2.5f; - dust = Main.dust[num117]; - dust.velocity -= projectile.oldVelocity / 10f; - num3 = num116; - } - if (Main.myPlayer == projectile.owner) - { - int num118 = Main.rand.Next(3, 6); - for (int num119 = 0; num119 < num118; num119 = num3 + 1) - { - Vector2 vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (vector8.X == 0f && vector8.Y == 0f) - { - vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - vector8.Normalize(); - vector8 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), vector8.X, vector8.Y, mod.ProjectileType("GhastlyExplosionShard"), (int)((double)projectile.damage * 0.9), projectile.knockBack * 0.8f, projectile.owner, projectile.ai[0], 0f); - num3 = num119; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GhastlyExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + int num3; + int num328 = (int)projectile.ai[0]; + for (int num329 = 0; num329 < 3; num329 = num3 + 1) + { + int num330 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, num328, default(Color), 1.2f); + Main.dust[num330].position = (Main.dust[num330].position + projectile.Center) / 2f; + Main.dust[num330].noGravity = true; + Dust dust = Main.dust[num330]; + dust.velocity *= 0.5f; + num3 = num329; + } + for (int num331 = 0; num331 < 2; num331 = num3 + 1) + { + int num330 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, projectile.velocity.X, projectile.velocity.Y, num328, default(Color), 0.4f); + if (num331 == 0) + { + Main.dust[num330].position = (Main.dust[num330].position + projectile.Center * 5f) / 6f; + } + else if (num331 == 1) + { + Main.dust[num330].position = (Main.dust[num330].position + (projectile.Center + projectile.velocity / 2f) * 5f) / 6f; + } + Dust dust = Main.dust[num330]; + dust.velocity *= 0.1f; + Main.dust[num330].noGravity = true; + Main.dust[num330].fadeIn = 1f; + num3 = num331; + } + return; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item50, projectile.position); + int num3; + for (int num116 = 0; num116 < 20; num116 = num3 + 1) + { + int num117 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default(Color), 0.5f); + Dust dust; + Main.dust[num117].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f; + Main.dust[num117].noGravity = true; + dust = Main.dust[num117]; + dust.velocity *= 2.5f; + dust = Main.dust[num117]; + dust.velocity -= projectile.oldVelocity / 10f; + num3 = num116; + } + if (Main.myPlayer == projectile.owner) + { + int num118 = Main.rand.Next(3, 6); + for (int num119 = 0; num119 < num118; num119 = num3 + 1) + { + Vector2 vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (vector8.X == 0f && vector8.Y == 0f) + { + vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + vector8.Normalize(); + vector8 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), vector8.X, vector8.Y, mod.ProjectileType("GhastlyExplosionShard"), (int)((double)projectile.damage * 0.9), projectile.knockBack * 0.8f, projectile.owner, projectile.ai[0], 0f); + num3 = num119; + } + } + } + } +} diff --git a/Projectiles/Magic/GhastlyExplosionShard.cs b/Projectiles/Magic/GhastlyExplosionShard.cs index 0638c7558f..d769640435 100644 --- a/Projectiles/Magic/GhastlyExplosionShard.cs +++ b/Projectiles/Magic/GhastlyExplosionShard.cs @@ -1,86 +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 GhastlyExplosionShard : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.magic = true; - } - - public override void AI() - { - int num3 = 0; - int num332 = (int)projectile.ai[0]; - projectile.ai[1] += 1f; - float num333 = (60f - projectile.ai[1]) / 60f; - if (projectile.ai[1] > 40f) - { - projectile.Kill(); - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - if (projectile.velocity.Y > 18f) - { - projectile.velocity.Y = 18f; - } - projectile.velocity.X = projectile.velocity.X * 0.98f; - for (int num334 = 0; num334 < 2; num334 = num3 + 1) - { - int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default(Color), 1.1f); - Main.dust[num335].position = (Main.dust[num335].position + projectile.Center) / 2f; - Main.dust[num335].noGravity = true; - Dust dust = Main.dust[num335]; - dust.velocity *= 0.3f; - dust = Main.dust[num335]; - dust.scale *= num333; - num3 = num334; - } - for (int num336 = 0; num336 < 1; num336 = num3 + 1) - { - int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default(Color), 0.6f); - Main.dust[num335].position = (Main.dust[num335].position + projectile.Center * 5f) / 6f; - Dust dust = Main.dust[num335]; - dust.velocity *= 0.1f; - Main.dust[num335].noGravity = true; - Main.dust[num335].fadeIn = 0.9f * num333; - dust = Main.dust[num335]; - dust.scale *= num333; - num3 = num336; - } - return; - } - - public override void Kill(int timeLeft) - { - int num3; - for (int num114 = 0; num114 < 10; num114 = num3 + 1) - { - int num115 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default(Color), 0.5f); - Dust dust; - Main.dust[num115].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - Main.dust[num115].noGravity = true; - dust = Main.dust[num115]; - dust.velocity *= 1.25f; - dust = Main.dust[num115]; - dust.velocity -= projectile.oldVelocity / 10f; - num3 = num114; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GhastlyExplosionShard : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + int num3 = 0; + int num332 = (int)projectile.ai[0]; + projectile.ai[1] += 1f; + float num333 = (60f - projectile.ai[1]) / 60f; + if (projectile.ai[1] > 40f) + { + projectile.Kill(); + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + if (projectile.velocity.Y > 18f) + { + projectile.velocity.Y = 18f; + } + projectile.velocity.X = projectile.velocity.X * 0.98f; + for (int num334 = 0; num334 < 2; num334 = num3 + 1) + { + int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default(Color), 1.1f); + Main.dust[num335].position = (Main.dust[num335].position + projectile.Center) / 2f; + Main.dust[num335].noGravity = true; + Dust dust = Main.dust[num335]; + dust.velocity *= 0.3f; + dust = Main.dust[num335]; + dust.scale *= num333; + num3 = num334; + } + for (int num336 = 0; num336 < 1; num336 = num3 + 1) + { + int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default(Color), 0.6f); + Main.dust[num335].position = (Main.dust[num335].position + projectile.Center * 5f) / 6f; + Dust dust = Main.dust[num335]; + dust.velocity *= 0.1f; + Main.dust[num335].noGravity = true; + Main.dust[num335].fadeIn = 0.9f * num333; + dust = Main.dust[num335]; + dust.scale *= num333; + num3 = num336; + } + return; + } + + public override void Kill(int timeLeft) + { + int num3; + for (int num114 = 0; num114 < 10; num114 = num3 + 1) + { + int num115 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default(Color), 0.5f); + Dust dust; + Main.dust[num115].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + Main.dust[num115].noGravity = true; + dust = Main.dust[num115]; + dust.velocity *= 1.25f; + dust = Main.dust[num115]; + dust.velocity -= projectile.oldVelocity / 10f; + num3 = num114; + } + } + } +} diff --git a/Projectiles/Magic/GhastlySubBlast.cs b/Projectiles/Magic/GhastlySubBlast.cs index b4a56eee4a..f2f9c4178e 100644 --- a/Projectiles/Magic/GhastlySubBlast.cs +++ b/Projectiles/Magic/GhastlySubBlast.cs @@ -1,118 +1,118 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class GhastlySubBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 420; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - public override void AI() - { - bool flag60 = false; - bool flag61 = false; - int num3 = projectile.type; - int num1024 = mod.ProjectileType("GhastlyBlast"); - float num1025 = 420f; - float x3 = 0.15f; - float y3 = 0.15f; - if (flag61) - { - int num1026 = (int)projectile.ai[1]; - if (!Main.projectile[num1026].active || Main.projectile[num1026].type != num1024) - { - projectile.Kill(); - return; - } - projectile.timeLeft = 2; - } - float[] npcArray = projectile.ai; - int npcChase = 0; - float num73 = npcArray[npcChase]; - npcArray[npcChase] = num73 + 1f; - if (projectile.ai[0] < num1025) - { - bool flag62 = true; - int num1027 = (int)projectile.ai[1]; - if (Main.projectile[num1027].active && Main.projectile[num1027].type == num1024) - { - if (!flag60 && Main.projectile[num1027].oldPos[1] != Vector2.Zero) - { - projectile.position += Main.projectile[num1027].position - Main.projectile[num1027].oldPos[1]; - } - if (projectile.Center.HasNaNs()) - { - projectile.Kill(); - return; - } - } - else - { - projectile.ai[0] = num1025; - flag62 = false; - projectile.Kill(); - } - if (flag62 && !flag60) - { - projectile.velocity += new Vector2((float)Math.Sign(Main.projectile[num1027].Center.X - projectile.Center.X), (float)Math.Sign(Main.projectile[num1027].Center.Y - projectile.Center.Y)) * new Vector2(x3, y3); - if (projectile.velocity.Length() > 6f) - { - projectile.velocity *= 6f / projectile.velocity.Length(); - } - } - if (Main.rand.Next(2) == 0) - { - int num1028 = Dust.NewDust(projectile.Center, 8, 8, 60, 0f, 0f, 0, default(Color), 1f); - Main.dust[num1028].position = projectile.Center; - Main.dust[num1028].velocity = projectile.velocity; - Main.dust[num1028].noGravity = true; - Main.dust[num1028].scale = 1.5f; - if (flag62) - { - Main.dust[num1028].customData = Main.projectile[(int)projectile.ai[1]]; - } - } - projectile.alpha = 255; - return; - } - } - - public override void Kill(int timeLeft) - { - projectile.ai[0] = 60f; - int num3; - for (int num114 = 0; num114 < 10; num114 = num3 + 1) - { - int num115 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default(Color), 0.5f); - Dust dust; - Main.dust[num115].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - Main.dust[num115].noGravity = true; - dust = Main.dust[num115]; - dust.velocity *= 1.25f; - dust = Main.dust[num115]; - dust.velocity -= projectile.oldVelocity / 10f; - num3 = num114; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GhastlySubBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 420; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + bool flag60 = false; + bool flag61 = false; + int num3 = projectile.type; + int num1024 = mod.ProjectileType("GhastlyBlast"); + float num1025 = 420f; + float x3 = 0.15f; + float y3 = 0.15f; + if (flag61) + { + int num1026 = (int)projectile.ai[1]; + if (!Main.projectile[num1026].active || Main.projectile[num1026].type != num1024) + { + projectile.Kill(); + return; + } + projectile.timeLeft = 2; + } + float[] npcArray = projectile.ai; + int npcChase = 0; + float num73 = npcArray[npcChase]; + npcArray[npcChase] = num73 + 1f; + if (projectile.ai[0] < num1025) + { + bool flag62 = true; + int num1027 = (int)projectile.ai[1]; + if (Main.projectile[num1027].active && Main.projectile[num1027].type == num1024) + { + if (!flag60 && Main.projectile[num1027].oldPos[1] != Vector2.Zero) + { + projectile.position += Main.projectile[num1027].position - Main.projectile[num1027].oldPos[1]; + } + if (projectile.Center.HasNaNs()) + { + projectile.Kill(); + return; + } + } + else + { + projectile.ai[0] = num1025; + flag62 = false; + projectile.Kill(); + } + if (flag62 && !flag60) + { + projectile.velocity += new Vector2((float)Math.Sign(Main.projectile[num1027].Center.X - projectile.Center.X), (float)Math.Sign(Main.projectile[num1027].Center.Y - projectile.Center.Y)) * new Vector2(x3, y3); + if (projectile.velocity.Length() > 6f) + { + projectile.velocity *= 6f / projectile.velocity.Length(); + } + } + if (Main.rand.Next(2) == 0) + { + int num1028 = Dust.NewDust(projectile.Center, 8, 8, 60, 0f, 0f, 0, default(Color), 1f); + Main.dust[num1028].position = projectile.Center; + Main.dust[num1028].velocity = projectile.velocity; + Main.dust[num1028].noGravity = true; + Main.dust[num1028].scale = 1.5f; + if (flag62) + { + Main.dust[num1028].customData = Main.projectile[(int)projectile.ai[1]]; + } + } + projectile.alpha = 255; + return; + } + } + + public override void Kill(int timeLeft) + { + projectile.ai[0] = 60f; + int num3; + for (int num114 = 0; num114 < 10; num114 = num3 + 1) + { + int num115 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)projectile.ai[0], projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, 0, default(Color), 0.5f); + Dust dust; + Main.dust[num115].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + Main.dust[num115].noGravity = true; + dust = Main.dust[num115]; + dust.velocity *= 1.25f; + dust = Main.dust[num115]; + dust.velocity -= projectile.oldVelocity / 10f; + num3 = num114; + } + } + } +} diff --git a/Projectiles/Magic/GhastlyVisage.cs b/Projectiles/Magic/GhastlyVisage.cs index c679b55473..17318ab779 100644 --- a/Projectiles/Magic/GhastlyVisage.cs +++ b/Projectiles/Magic/GhastlyVisage.cs @@ -1,196 +1,196 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class GhastlyVisage : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Visage"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.65f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.ai[0] += 1f; - int num39 = 0; - if (projectile.ai[0] >= 240f) - { - num39++; - } - if (projectile.ai[0] >= 480f) - { - num39++; - } - int num40 = 40; - int num41 = 2; - projectile.ai[1] -= 1f; - bool flag15 = false; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; - int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); - } - bool flag16 = player.channel && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - int manaCost = (int)(20f * player.manaCost); - if (projectile.localAI[1] == 0f) - { - if (player.statMana < manaCost) - { - if (player.manaFlower) - { - player.QuickMana(); - if (player.statMana >= (int)((float)manaCost)) - { - player.manaRegenDelay = (int)player.maxRegenDelay; - player.statMana -= manaCost; - } - else - { - projectile.Kill(); - } - } - else - { - projectile.Kill(); - } - } - else - { - if (player.statMana >= (int)((float)manaCost)) - { - player.statMana -= manaCost; - player.manaRegenDelay = (int)player.maxRegenDelay; - } - } - projectile.localAI[1] += 1f; - Main.PlaySound(SoundID.Item117, projectile.position); - } - if (projectile.soundDelay <= 0 && flag16) - { - if (player.statMana < manaCost) - { - if (player.manaFlower) - { - player.QuickMana(); - if (player.statMana >= (int)((float)manaCost)) - { - player.manaRegenDelay = (int)player.maxRegenDelay; - player.statMana -= manaCost; - } - else - { - projectile.Kill(); - } - } - else - { - projectile.Kill(); - } - } - else - { - if (player.statMana >= (int)((float)manaCost)) - { - player.statMana -= manaCost; - player.manaRegenDelay = (int)player.maxRegenDelay; - } - } - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item117, projectile.position); - } - projectile.localAI[0] = 12f; - } - if (flag15 && Main.myPlayer == projectile.owner) - { - int num42 = mod.ProjectileType("GhastlyBlast"); - float scaleFactor11 = 6f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; - if (flag16) - { - weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); - float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; - if (player.gravDir == -1f) - { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; - } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) - { - value19 = -Vector2.UnitY; - } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = value19 * 0.55f; - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) - { - vector20 = -Vector2.UnitY; - } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -10f, 10f); - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GhastlyVisage : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Visage"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 32; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.magic = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.65f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.ai[0] += 1f; + int num39 = 0; + if (projectile.ai[0] >= 240f) + { + num39++; + } + if (projectile.ai[0] >= 480f) + { + num39++; + } + int num40 = 40; + int num41 = 2; + projectile.ai[1] -= 1f; + bool flag15 = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = (float)(num40 - num41 * num39); + flag15 = true; + int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); + } + bool flag16 = player.channel && !player.noItems && !player.CCed; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + int manaCost = (int)(20f * player.manaCost); + if (projectile.localAI[1] == 0f) + { + if (player.statMana < manaCost) + { + if (player.manaFlower) + { + player.QuickMana(); + if (player.statMana >= (int)((float)manaCost)) + { + player.manaRegenDelay = (int)player.maxRegenDelay; + player.statMana -= manaCost; + } + else + { + projectile.Kill(); + } + } + else + { + projectile.Kill(); + } + } + else + { + if (player.statMana >= (int)((float)manaCost)) + { + player.statMana -= manaCost; + player.manaRegenDelay = (int)player.maxRegenDelay; + } + } + projectile.localAI[1] += 1f; + Main.PlaySound(SoundID.Item117, projectile.position); + } + if (projectile.soundDelay <= 0 && flag16) + { + if (player.statMana < manaCost) + { + if (player.manaFlower) + { + player.QuickMana(); + if (player.statMana >= (int)((float)manaCost)) + { + player.manaRegenDelay = (int)player.maxRegenDelay; + player.statMana -= manaCost; + } + else + { + projectile.Kill(); + } + } + else + { + projectile.Kill(); + } + } + else + { + if (player.statMana >= (int)((float)manaCost)) + { + player.statMana -= manaCost; + player.manaRegenDelay = (int)player.maxRegenDelay; + } + } + projectile.soundDelay = num40 - num41 * num39; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item117, projectile.position); + } + projectile.localAI[0] = 12f; + } + if (flag15 && Main.myPlayer == projectile.owner) + { + int num42 = mod.ProjectileType("GhastlyBlast"); + float scaleFactor11 = 6f; + int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + if (flag16) + { + weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); + float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 vector19 = vector; + Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + if (player.gravDir == -1f) + { + value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + } + Vector2 value19 = Vector2.Normalize(value18); + if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + { + value19 = -Vector2.UnitY; + } + value19 *= scaleFactor12; + if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = value19 * 0.55f; + Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + { + vector20 = -Vector2.UnitY; + } + Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -10f, 10f); + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + } +} diff --git a/Projectiles/Magic/GleamingBolt.cs b/Projectiles/Magic/GleamingBolt.cs index 7ddb22c24b..fe61da735e 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class GleamingBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 250; - projectile.penetrate = 1; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - for (int dust = 0; dust < 3; dust++) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - float spread = 90f * 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) - { - for (i = 0; i < 3; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GleamingBolt2"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GleamingBolt2"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GleamingBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.timeLeft = 250; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + for (int dust = 0; dust < 3; dust++) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 64; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 64; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + float spread = 90f * 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) + { + for (i = 0; i < 3; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GleamingBolt2"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GleamingBolt2"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); + } + } +} diff --git a/Projectiles/Magic/GleamingBolt2.cs b/Projectiles/Magic/GleamingBolt2.cs index ae62583277..d48191be0f 100644 --- a/Projectiles/Magic/GleamingBolt2.cs +++ b/Projectiles/Magic/GleamingBolt2.cs @@ -1,64 +1,64 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class GleamingBolt2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - for (int dust = 0; dust < 2; dust++) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GleamingBolt2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + for (int dust = 0; dust < 2; dust++) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 64; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 64; + } + else + { + randomDust = 204; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Magic/GraniteEnergy.cs b/Projectiles/Magic/GraniteEnergy.cs index 24c775973c..eb52037668 100644 --- a/Projectiles/Magic/GraniteEnergy.cs +++ b/Projectiles/Magic/GraniteEnergy.cs @@ -1,72 +1,72 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class GraniteEnergy : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Granite Energy"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.magic = true; - projectile.timeLeft = 90; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num469].velocity *= 0f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - 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 = 22f; - 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; - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GraniteEnergy : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Granite Energy"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.magic = true; + projectile.timeLeft = 90; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num469].velocity *= 0f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + 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 = 22f; + 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; + return; + } + } + } +} diff --git a/Projectiles/Magic/GranitePulse.cs b/Projectiles/Magic/GranitePulse.cs index 21b7c7c830..3a8893768d 100644 --- a/Projectiles/Magic/GranitePulse.cs +++ b/Projectiles/Magic/GranitePulse.cs @@ -1,146 +1,146 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class GranitePulse : ModProjectile - { - public int pulse = 49; - public float count = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pulse"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - } - - public override void AI() - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) - { - projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = projectile.type; - for (int num420 = 0; num420 < 1000; num420++) - { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) - { - num416++; - if (Main.projectile[num420].ai[1] > num418) - { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; - } - } - } - if (num416 > 1) - { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; - return; - } - } - if (count == 0f) - { - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 53); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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, 229, 0f, 0f, 100, default(Color), 0.5f); - 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 1f); - 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, 206, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num624].velocity *= 2f; - } - count += 1f; - } - pulse--; - if (pulse == 0) - { - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 53); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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, 229, 0f, 0f, 100, default(Color), 0.5f); - 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 1f); - 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, 206, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num624].velocity *= 2f; - } - pulse = 50; - float spread = 45f * 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) - { - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GraniteEnergy"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("GraniteEnergy"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class GranitePulse : ModProjectile + { + public int pulse = 49; + public float count = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pulse"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.penetrate = -1; + projectile.timeLeft = 1200; + } + + public override void AI() + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 7200f) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 10f) + { + projectile.localAI[0] = 0f; + int num416 = 0; + int num417 = 0; + float num418 = 0f; + int num419 = projectile.type; + for (int num420 = 0; num420 < 1000; num420++) + { + if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + { + num416++; + if (Main.projectile[num420].ai[1] > num418) + { + num417 = num420; + num418 = Main.projectile[num420].ai[1]; + } + } + } + if (num416 > 1) + { + Main.projectile[num417].netUpdate = true; + Main.projectile[num417].ai[1] = 36000f; + return; + } + } + if (count == 0f) + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 53); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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, 229, 0f, 0f, 100, default(Color), 0.5f); + 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 1f); + 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, 206, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num624].velocity *= 2f; + } + count += 1f; + } + pulse--; + if (pulse == 0) + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 53); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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, 229, 0f, 0f, 100, default(Color), 0.5f); + 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 1f); + 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, 206, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num624].velocity *= 2f; + } + pulse = 50; + float spread = 45f * 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) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("GraniteEnergy"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("GraniteEnergy"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } +} diff --git a/Projectiles/Magic/HellfireExplosionFriendly.cs b/Projectiles/Magic/HellfireExplosionFriendly.cs index cda0667205..4baf752e30 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly.cs @@ -1,102 +1,102 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class HellfireExplosionFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 200; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class HellfireExplosionFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 130; + projectile.height = 130; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 200; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } +} diff --git a/Projectiles/Magic/HellfireExplosionFriendly2.cs b/Projectiles/Magic/HellfireExplosionFriendly2.cs index 0bc52dfcbd..8f8f52e5b0 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly2.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly2.cs @@ -1,100 +1,100 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class HellfireExplosionFriendly2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-15, 16); - float num464 = (float)Main.rand.Next(-15, 16); - float num465 = (float)Main.rand.Next(5, 12); - 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, 235, 0f, 0f, 100, default(Color), 0.75f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class HellfireExplosionFriendly2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 130; + projectile.height = 130; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-15, 16); + float num464 = (float)Main.rand.Next(-15, 16); + float num465 = (float)Main.rand.Next(5, 12); + 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, 235, 0f, 0f, 100, default(Color), 0.75f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } +} diff --git a/Projectiles/Magic/HolyFlame.cs b/Projectiles/Magic/HolyFlame.cs index 4e266efd47..a28ff3074c 100644 --- a/Projectiles/Magic/HolyFlame.cs +++ b/Projectiles/Magic/HolyFlame.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class HolyFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - } - - public override void AI() - { - projectile.alpha -= 3; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0f); - } - - public override void Kill(int timeLeft) - { - 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 = 50; - projectile.height = 50; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 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, 246, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class HolyFlame : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + } + + public override void AI() + { + projectile.alpha -= 3; + if (projectile.alpha <= 0) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0f); + } + + public override void Kill(int timeLeft) + { + 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 = 50; + projectile.height = 50; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 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, 246, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } +} diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index 2c89d6ab3e..5dd6fe6c34 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class HolyLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 3; - projectile.extraUpdates = 100; - projectile.timeLeft = 180; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; - projectile.alpha = 255; - int num249 = Main.rand.Next(2); - if (num249 == 0) - { - num249 = 244; - } - else - { - num249 = 246; - } - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 0.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class HolyLaser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 3; + projectile.extraUpdates = 100; + projectile.timeLeft = 180; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * 0.25f; + projectile.alpha = 255; + int num249 = Main.rand.Next(2); + if (num249 == 0) + { + num249 = 244; + } + else + { + num249 = 246; + } + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 0.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + 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; + } + } + } +} diff --git a/Projectiles/Magic/IceCluster.cs b/Projectiles/Magic/IceCluster.cs index edb63a3bd9..4c6b80d413 100644 --- a/Projectiles/Magic/IceCluster.cs +++ b/Projectiles/Magic/IceCluster.cs @@ -1,117 +1,117 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class IceCluster : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice"); - } - - public override void SetDefaults() - { - projectile.width = 90; - projectile.height = 90; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 100; - projectile.tileCollide = false; - projectile.magic = true; - } - - public override void AI() - { - projectile.rotation += 0.5f; - if (projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 120); - } - projectile.ai[0] += 1f; - if (projectile.ai[1] == 1f) - { - if (projectile.ai[0] >= 130f) - { - projectile.alpha += 10; - } - else - { - projectile.alpha -= 10; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - if (projectile.ai[0] >= 150f) - { - return; - } - if (projectile.ai[0] % 30f == 0f && Main.netMode != 1) - { - Vector2 vector80 = projectile.rotation.ToRotationVector2(); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector80.X, vector80.Y, mod.ProjectileType("IceCluster"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.rotation += 0.104719758f; - Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); - } - else - { - if (projectile.ai[0] >= 40f) - { - projectile.alpha += 3; - } - else - { - projectile.alpha -= 40; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - if (projectile.ai[0] >= 45f) - { - return; - } - Vector2 value47 = new Vector2(0f, -720f).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); - float scaleFactor8 = projectile.ai[0] % 45f / 45f; - Vector2 spinningpoint = value47 * scaleFactor8; - for (int num844 = 0; num844 < 6; num844++) - { - Vector2 vector81 = projectile.Center + spinningpoint.RotatedBy((double)((float)num844 * 6.28318548f / 6f), default(Vector2)); - Lighting.AddLight(vector81, 0.3f, 0.75f, 0.9f); - for (int num845 = 0; num845 < 2; num845++) - { - int num846 = Dust.NewDust(vector81 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent, 1f); - Main.dust[num846].noGravity = true; - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("GlacialState"), 120); - Vector2 vector80 = projectile.rotation.ToRotationVector2(); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector80.X, vector80.Y, mod.ProjectileType("IceCluster"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class IceCluster : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice"); + } + + public override void SetDefaults() + { + projectile.width = 90; + projectile.height = 90; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 100; + projectile.tileCollide = false; + projectile.magic = true; + } + + public override void AI() + { + projectile.rotation += 0.5f; + if (projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 120); + } + projectile.ai[0] += 1f; + if (projectile.ai[1] == 1f) + { + if (projectile.ai[0] >= 130f) + { + projectile.alpha += 10; + } + else + { + projectile.alpha -= 10; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + if (projectile.ai[0] >= 150f) + { + return; + } + if (projectile.ai[0] % 30f == 0f && Main.netMode != 1) + { + Vector2 vector80 = projectile.rotation.ToRotationVector2(); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector80.X, vector80.Y, mod.ProjectileType("IceCluster"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.rotation += 0.104719758f; + Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); + } + else + { + if (projectile.ai[0] >= 40f) + { + projectile.alpha += 3; + } + else + { + projectile.alpha -= 40; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + if (projectile.ai[0] >= 45f) + { + return; + } + Vector2 value47 = new Vector2(0f, -720f).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); + float scaleFactor8 = projectile.ai[0] % 45f / 45f; + Vector2 spinningpoint = value47 * scaleFactor8; + for (int num844 = 0; num844 < 6; num844++) + { + Vector2 vector81 = projectile.Center + spinningpoint.RotatedBy((double)((float)num844 * 6.28318548f / 6f), default(Vector2)); + Lighting.AddLight(vector81, 0.3f, 0.75f, 0.9f); + for (int num845 = 0; num845 < 2; num845++) + { + int num846 = Dust.NewDust(vector81 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent, 1f); + Main.dust[num846].noGravity = true; + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("GlacialState"), 120); + Vector2 vector80 = projectile.rotation.ToRotationVector2(); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector80.X, vector80.Y, mod.ProjectileType("IceCluster"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Magic/IceSpike.cs b/Projectiles/Magic/IceSpike.cs index 95c41b64cc..2ac06bebae 100644 --- a/Projectiles/Magic/IceSpike.cs +++ b/Projectiles/Magic/IceSpike.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class IceSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.magic = true; - projectile.tileCollide = true; - projectile.timeLeft = 240; - } - - public override void AI() - { - projectile.rotation += 0.5f; - projectile.localAI[0] += 1f; - 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; - 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 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void 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, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class IceSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.magic = true; + projectile.tileCollide = true; + projectile.timeLeft = 240; + } + + public override void AI() + { + projectile.rotation += 0.5f; + projectile.localAI[0] += 1f; + 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; + 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 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void 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, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 240); + } + } +} diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index ac734d968a..836990c574 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -1,133 +1,133 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class InfernadoFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 88; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 500; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - int num613 = 22; - int num614 = 22; - float num615 = 2.5f; - int num616 = 320; - int num617 = 88; - if (Main.rand.Next(25) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - return; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 53, projectile.alpha); - } - - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class InfernadoFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infernado"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 88; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 500; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + int num613 = 22; + int num614 = 22; + float num615 = 2.5f; + int num616 = 320; + int num617 = 88; + if (Main.rand.Next(25) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + num623 *= 2f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + return; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 53, projectile.alpha); + } + + 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; + } + } +} diff --git a/Projectiles/Magic/InfernadoMarkFriendly.cs b/Projectiles/Magic/InfernadoMarkFriendly.cs index 05dc16057f..f66f4fc145 100644 --- a/Projectiles/Magic/InfernadoMarkFriendly.cs +++ b/Projectiles/Magic/InfernadoMarkFriendly.cs @@ -1,141 +1,141 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class InfernadoMarkFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - - public override void AI() - { - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - 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, 244, value15.X * 2f, value15.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - return; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); - 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, 244, 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; - } - if (projectile.owner == Main.myPlayer) - { - int num231 = (int)(projectile.Center.Y / 16f); - int num232 = (int)(projectile.Center.X / 16f); - int num233 = 100; - if (num232 < 10) - { - num232 = 10; - } - if (num232 > Main.maxTilesX - 10) - { - num232 = Main.maxTilesX - 10; - } - if (num231 < 10) - { - num231 = 10; - } - if (num231 > Main.maxTilesY - num233 - 10) - { - num231 = Main.maxTilesY - num233 - 10; - } - for (int num234 = num231; num234 < num231 + num233; num234++) - { - Tile tile = Main.tile[num232, num234]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) - { - num231 = num234; - break; - } - } - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("InfernadoFriendly"), 390, 15f, Main.myPlayer, 16f, 16f); - Main.projectile[num236].netUpdate = true; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class InfernadoMarkFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.magic = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + + public override void AI() + { + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + 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, 244, value15.X * 2f, value15.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + return; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); + 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, 244, 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; + } + if (projectile.owner == Main.myPlayer) + { + int num231 = (int)(projectile.Center.Y / 16f); + int num232 = (int)(projectile.Center.X / 16f); + int num233 = 100; + if (num232 < 10) + { + num232 = 10; + } + if (num232 > Main.maxTilesX - 10) + { + num232 = Main.maxTilesX - 10; + } + if (num231 < 10) + { + num231 = 10; + } + if (num231 > Main.maxTilesY - num233 - 10) + { + num231 = Main.maxTilesY - num233 - 10; + } + for (int num234 = num231; num234 < num231 + num233; num234++) + { + Tile tile = Main.tile[num232, num234]; + if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num231 = num234; + break; + } + } + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("InfernadoFriendly"), 390, 15f, Main.myPlayer, 16f, 16f); + Main.projectile[num236].netUpdate = true; + } + } + } +} diff --git a/Projectiles/Magic/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index 191199f0e2..dee6f2a2b3 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -1,156 +1,156 @@ -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 InfernalBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 180; - projectile.magic = true; - } - - public override void AI() - { - DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) - { - Main.PlaySound(2, projectile.Center, 9); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) - { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default(Vector2)) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 0, default(Color), 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; - } - - public override void Kill(int timeLeft) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) - { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default(Color), 1f); - Main.dust[num489].velocity *= 1.6f; - Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; - Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; - Main.dust[num489].scale = 2f; - Main.dust[num489].fadeIn = 0.5f; - Main.dust[num489].noGravity = true; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 50, 50, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; - rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; - SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) - { - num160 = projectile.oldRot[num159]; - effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); - } - Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("InfernalBlade2"), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); - } - } -} \ No newline at end of file +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 InfernalBlade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.timeLeft = 180; + projectile.magic = true; + } + + public override void AI() + { + DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (projectile.alpha > 0) + { + Main.PlaySound(2, projectile.Center, 9); + projectile.alpha = 0; + projectile.scale = 1.1f; + projectile.frame = Main.rand.Next(14); + float num98 = 16f; + int num99 = 0; + while ((float)num99 < num98) + { + Vector2 vector11 = Vector2.UnitX * 0f; + vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default(Vector2)) * new Vector2(1f, 4f); + vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); + int num100 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 0, default(Color), 1f); + Main.dust[num100].scale = 1.5f; + Main.dust[num100].noGravity = true; + Main.dust[num100].position = projectile.Center + vector11; + Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + num99++; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + } + + public override void Kill(int timeLeft) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + int num487 = Main.rand.Next(4, 10); + for (int num488 = 0; num488 < num487; num488++) + { + int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default(Color), 1f); + Main.dust[num489].velocity *= 1.6f; + Dust expr_FEDF_cp_0 = Main.dust[num489]; + expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; + Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + Main.dust[num489].scale = 2f; + Main.dust[num489].fadeIn = 0.5f; + Main.dust[num489].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 50, 50, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[projectile.type]; + int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y3 = num155 * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); + Vector2 origin2 = rectangle.Size() / 2f; + float num158 = 0f; + int num156 = 3; + int num157 = 1; + float value4 = 8f; + rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); + origin2 = rectangle.Size() / 2f; + for (int num159 = 1; num159 < num156; num159 += num157) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value5 = projectile.oldPos[num159]; + float num160 = projectile.rotation; + SpriteEffects effects = spriteEffects; + if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + { + num160 = projectile.oldRot[num159]; + effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + } + Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); + + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("InfernalBlade2"), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + } + } +} diff --git a/Projectiles/Magic/InfernalBlade2.cs b/Projectiles/Magic/InfernalBlade2.cs index 6c63212ee7..b63b243625 100644 --- a/Projectiles/Magic/InfernalBlade2.cs +++ b/Projectiles/Magic/InfernalBlade2.cs @@ -1,126 +1,126 @@ -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 InfernalBlade2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 180; - projectile.magic = true; - } - - public override void AI() - { - DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) - { - Main.PlaySound(2, projectile.Center, 9); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) - { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default(Vector2)) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 0, default(Color), 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; - } - - public override void Kill(int timeLeft) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) - { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default(Color), 1f); - Main.dust[num489].velocity *= 1.6f; - Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; - Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; - Main.dust[num489].scale = 2f; - Main.dust[num489].fadeIn = 0.5f; - Main.dust[num489].noGravity = true; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 50, 50, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; - rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; - SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) - { - num160 = projectile.oldRot[num159]; - effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); - } - Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); - } - } -} \ No newline at end of file +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 InfernalBlade2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 2; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 180; + projectile.magic = true; + } + + public override void AI() + { + DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (projectile.alpha > 0) + { + Main.PlaySound(2, projectile.Center, 9); + projectile.alpha = 0; + projectile.scale = 1.1f; + projectile.frame = Main.rand.Next(14); + float num98 = 16f; + int num99 = 0; + while ((float)num99 < num98) + { + Vector2 vector11 = Vector2.UnitX * 0f; + vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default(Vector2)) * new Vector2(1f, 4f); + vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); + int num100 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 0, default(Color), 1f); + Main.dust[num100].scale = 1.5f; + Main.dust[num100].noGravity = true; + Main.dust[num100].position = projectile.Center + vector11; + Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + num99++; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + } + + public override void Kill(int timeLeft) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + int num487 = Main.rand.Next(4, 10); + for (int num488 = 0; num488 < num487; num488++) + { + int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default(Color), 1f); + Main.dust[num489].velocity *= 1.6f; + Dust expr_FEDF_cp_0 = Main.dust[num489]; + expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; + Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + Main.dust[num489].scale = 2f; + Main.dust[num489].fadeIn = 0.5f; + Main.dust[num489].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 50, 50, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[projectile.type]; + int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y3 = num155 * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); + Vector2 origin2 = rectangle.Size() / 2f; + float num158 = 0f; + int num156 = 3; + int num157 = 1; + float value4 = 8f; + rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); + origin2 = rectangle.Size() / 2f; + for (int num159 = 1; num159 < num156; num159 += num157) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value5 = projectile.oldPos[num159]; + float num160 = projectile.rotation; + SpriteEffects effects = spriteEffects; + if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + { + num160 = projectile.oldRot[num159]; + effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + } + Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + } + } +} diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index efde577ca4..80685053c7 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -1,85 +1,85 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class IonBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.ignoreWater = false; - projectile.timeLeft = 120; - projectile.magic = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.X *= 1.015f; - projectile.velocity.Y *= 1.015f; - if (projectile.alpha > 0) - { - projectile.alpha -= 3; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f, 0f, 0.2f); - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override void 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("IonExplosion"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - int num212 = Main.rand.Next(15, 30); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 130, 0f, 0f, 100, default(Color), 1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class IonBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.ignoreWater = false; + projectile.timeLeft = 120; + projectile.magic = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.X *= 1.015f; + projectile.velocity.Y *= 1.015f; + if (projectile.alpha > 0) + { + projectile.alpha -= 3; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 1f, 0f, 0.2f); + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override void 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("IonExplosion"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + int num212 = Main.rand.Next(15, 30); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 130, 0f, 0f, 100, default(Color), 1f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/IonExplosion.cs b/Projectiles/Magic/IonExplosion.cs index d203407414..7fc7f095ab 100644 --- a/Projectiles/Magic/IonExplosion.cs +++ b/Projectiles/Magic/IonExplosion.cs @@ -1,29 +1,29 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class IonExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 3; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class IonExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.penetrate = -1; + projectile.timeLeft = 3; + } + } +} diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index d3982429f4..17590bcd90 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -1,159 +1,159 @@ -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 LiquidBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.ignoreWater = true; - projectile.tileCollide = true; - projectile.timeLeft = 180; - projectile.magic = true; - } - - public override void AI() - { - DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) - { - Main.PlaySound(2, projectile.Center, 9); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) - { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default(Vector2)) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; - } - - public override void Kill(int timeLeft) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) - { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num489].velocity *= 1.6f; - Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; - Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; - Main.dust[num489].scale = 2f; - Main.dust[num489].fadeIn = 0.5f; - Main.dust[num489].noGravity = true; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; - rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; - SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) - { - num160 = projectile.oldRot[num159]; - effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); - } - Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("LiquidBlade2"), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); - } - target.AddBuff(BuffID.Ichor, 600); - target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.CursedInferno, 600); - } - } -} \ No newline at end of file +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 LiquidBlade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.timeLeft = 180; + projectile.magic = true; + } + + public override void AI() + { + DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (projectile.alpha > 0) + { + Main.PlaySound(2, projectile.Center, 9); + projectile.alpha = 0; + projectile.scale = 1.1f; + projectile.frame = Main.rand.Next(14); + float num98 = 16f; + int num99 = 0; + while ((float)num99 < num98) + { + Vector2 vector11 = Vector2.UnitX * 0f; + vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default(Vector2)) * new Vector2(1f, 4f); + vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); + int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num100].scale = 1.5f; + Main.dust[num100].noGravity = true; + Main.dust[num100].position = projectile.Center + vector11; + Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + num99++; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + } + + public override void Kill(int timeLeft) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + int num487 = Main.rand.Next(4, 10); + for (int num488 = 0; num488 < num487; num488++) + { + int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num489].velocity *= 1.6f; + Dust expr_FEDF_cp_0 = Main.dust[num489]; + expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; + Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + Main.dust[num489].scale = 2f; + Main.dust[num489].fadeIn = 0.5f; + Main.dust[num489].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[projectile.type]; + int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y3 = num155 * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); + Vector2 origin2 = rectangle.Size() / 2f; + float num158 = 0f; + int num156 = 3; + int num157 = 1; + float value4 = 8f; + rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); + origin2 = rectangle.Size() / 2f; + for (int num159 = 1; num159 < num156; num159 += num157) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value5 = projectile.oldPos[num159]; + float num160 = projectile.rotation; + SpriteEffects effects = spriteEffects; + if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + { + num160 = projectile.oldRot[num159]; + effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + } + Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("LiquidBlade2"), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); + } + target.AddBuff(BuffID.Ichor, 600); + target.AddBuff(BuffID.Frostburn, 600); + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.CursedInferno, 600); + } + } +} diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index 847d08a2a3..fd07fbf5c8 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -1,130 +1,130 @@ -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 LiquidBlade2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 180; - projectile.magic = true; - } - - public override void AI() - { - DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); - if (projectile.alpha > 0) - { - Main.PlaySound(2, projectile.Center, 9); - projectile.alpha = 0; - projectile.scale = 1.1f; - projectile.frame = Main.rand.Next(14); - float num98 = 16f; - int num99 = 0; - while ((float)num99 < num98) - { - Vector2 vector11 = Vector2.UnitX * 0f; - vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default(Vector2)) * new Vector2(1f, 4f); - vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); - int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num100].scale = 1.5f; - Main.dust[num100].noGravity = true; - Main.dust[num100].position = projectile.Center + vector11; - Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; - num99++; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; - } - - public override void Kill(int timeLeft) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) - { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num489].velocity *= 1.6f; - Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; - Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; - Main.dust[num489].scale = 2f; - Main.dust[num489].fadeIn = 0.5f; - Main.dust[num489].noGravity = true; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; - int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y3 = num155 * projectile.frame; - Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); - Vector2 origin2 = rectangle.Size() / 2f; - float num158 = 0f; - int num156 = 3; - int num157 = 1; - float value4 = 8f; - rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); - origin2 = rectangle.Size() / 2f; - for (int num159 = 1; num159 < num156; num159 += num157) - { - Microsoft.Xna.Framework.Color color26 = color25; - color26 = projectile.GetAlpha(color26); - color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Vector2 value5 = projectile.oldPos[num159]; - float num160 = projectile.rotation; - SpriteEffects effects = spriteEffects; - if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) - { - num160 = projectile.oldRot[num159]; - effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - } - Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); - } - Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); - Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 600); - target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.CursedInferno, 600); - } - } -} \ No newline at end of file +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 LiquidBlade2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 180; + projectile.magic = true; + } + + public override void AI() + { + DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * 10f, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); + if (projectile.alpha > 0) + { + Main.PlaySound(2, projectile.Center, 9); + projectile.alpha = 0; + projectile.scale = 1.1f; + projectile.frame = Main.rand.Next(14); + float num98 = 16f; + int num99 = 0; + while ((float)num99 < num98) + { + Vector2 vector11 = Vector2.UnitX * 0f; + vector11 += -Vector2.UnitY.RotatedBy((double)((float)num99 * (6.28318548f / num98)), default(Vector2)) * new Vector2(1f, 4f); + vector11 = vector11.RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); + int num100 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num100].scale = 1.5f; + Main.dust[num100].noGravity = true; + Main.dust[num100].position = projectile.Center + vector11; + Main.dust[num100].velocity = projectile.velocity * 0f + vector11.SafeNormalize(Vector2.UnitY) * 1f; + num99++; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 0.7853982f; + } + + public override void Kill(int timeLeft) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + int num487 = Main.rand.Next(4, 10); + for (int num488 = 0; num488 < num487; num488++) + { + int num489 = Dust.NewDust(projectile.Center, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num489].velocity *= 1.6f; + Dust expr_FEDF_cp_0 = Main.dust[num489]; + expr_FEDF_cp_0.velocity.Y = expr_FEDF_cp_0.velocity.Y - 1f; + Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + Main.dust[num489].scale = 2f; + Main.dust[num489].fadeIn = 0.5f; + Main.dust[num489].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Texture2D texture2D3 = Main.projectileTexture[projectile.type]; + int num155 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y3 = num155 * projectile.frame; + Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num155); + Vector2 origin2 = rectangle.Size() / 2f; + float num158 = 0f; + int num156 = 3; + int num157 = 1; + float value4 = 8f; + rectangle = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); + origin2 = rectangle.Size() / 2f; + for (int num159 = 1; num159 < num156; num159 += num157) + { + Microsoft.Xna.Framework.Color color26 = color25; + color26 = projectile.GetAlpha(color26); + color26 *= (float)(num156 - num159) / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); + Vector2 value5 = projectile.oldPos[num159]; + float num160 = projectile.rotation; + SpriteEffects effects = spriteEffects; + if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) + { + num160 = projectile.oldRot[num159]; + effects = ((projectile.oldSpriteDirection[num159] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + Main.spriteBatch.Draw(texture2D3, value5 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num160 + projectile.rotation * num158 * (float)(num159 - 1) * (float)(-(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin2, MathHelper.Lerp(projectile.scale, value4, (float)num159 / 15f), effects, 0f); + } + Microsoft.Xna.Framework.Color color28 = projectile.GetAlpha(color25); + Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 600); + target.AddBuff(BuffID.Frostburn, 600); + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.CursedInferno, 600); + } + } +} diff --git a/Projectiles/Magic/MagicNebulaShot.cs b/Projectiles/Magic/MagicNebulaShot.cs index e2a5fa2971..e07ef71676 100644 --- a/Projectiles/Magic/MagicNebulaShot.cs +++ b/Projectiles/Magic/MagicNebulaShot.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class MagicNebulaShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shot"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 5; - projectile.timeLeft = 200; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 15; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.Next(3) == 0 ? 56 : 242), projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class MagicNebulaShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shot"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 5; + projectile.timeLeft = 200; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + } + if (projectile.alpha > 0) + { + projectile.alpha -= 15; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.Next(3) == 0 ? 56 : 242), projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; + dust4.velocity = Vector2.Zero; + dust4.position -= projectile.velocity / 5f * (float)num121; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } +} diff --git a/Projectiles/Magic/MagnaBlast.cs b/Projectiles/Magic/MagnaBlast.cs index f3455e6859..01c8577271 100644 --- a/Projectiles/Magic/MagnaBlast.cs +++ b/Projectiles/Magic/MagnaBlast.cs @@ -1,58 +1,58 @@ -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 MagnaBlast : 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 = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - if (projectile.scale <= 1.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, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - 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, 59, 0f, 0f, 100, default(Color), projectile.scale); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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 MagnaBlast : 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 = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + if (projectile.scale <= 1.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, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + 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, 59, 0f, 0f, 100, default(Color), projectile.scale); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Magic/MagneticBeam.cs b/Projectiles/Magic/MagneticBeam.cs index 4b9e032a88..13021b4360 100644 --- a/Projectiles/Magic/MagneticBeam.cs +++ b/Projectiles/Magic/MagneticBeam.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class MagneticBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 90; - projectile.magic = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class MagneticBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 90; + projectile.magic = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index 0ea4fffe33..24833a0b18 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -1,133 +1,133 @@ -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 MagneticOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magnetic Orb"); - 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 = 150; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.98f; - projectile.velocity.Y *= 0.98f; - 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; - } - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - 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("MagneticBeam"), 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 +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 MagneticOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magnetic Orb"); + 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 = 150; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.98f; + projectile.velocity.Y *= 0.98f; + 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; + } + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + 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("MagneticBeam"), 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; + } + } +} diff --git a/Projectiles/Magic/MagnusBeam.cs b/Projectiles/Magic/MagnusBeam.cs index b686c02372..a6cf089901 100644 --- a/Projectiles/Magic/MagnusBeam.cs +++ b/Projectiles/Magic/MagnusBeam.cs @@ -287,4 +287,4 @@ namespace CalamityMod.Projectiles.Magic } } } -} \ No newline at end of file +} diff --git a/Projectiles/Magic/ManaBolt.cs b/Projectiles/Magic/ManaBolt.cs index bde8006eeb..f28f092a12 100644 --- a/Projectiles/Magic/ManaBolt.cs +++ b/Projectiles/Magic/ManaBolt.cs @@ -1,60 +1,60 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ManaBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - float spread = 90f * 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) - { - for (i = 0; i < 3; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("ManaBoltSmall"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("ManaBoltSmall2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ManaBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + float spread = 90f * 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) + { + for (i = 0; i < 3; i++ ) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("ManaBoltSmall"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("ManaBoltSmall2"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + } +} diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index e136e01886..61a5577cf1 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ManaBoltSmall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 60; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ManaBoltSmall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 60; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + } +} diff --git a/Projectiles/Magic/ManaBoltSmall2.cs b/Projectiles/Magic/ManaBoltSmall2.cs index e5b88c7101..51c6e770a9 100644 --- a/Projectiles/Magic/ManaBoltSmall2.cs +++ b/Projectiles/Magic/ManaBoltSmall2.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ManaBoltSmall2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 60; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ManaBoltSmall2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 60; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + } +} diff --git a/Projectiles/Magic/NightBolt.cs b/Projectiles/Magic/NightBolt.cs index 78b27cec46..90a1d4c0ce 100644 --- a/Projectiles/Magic/NightBolt.cs +++ b/Projectiles/Magic/NightBolt.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class NightBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class NightBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 30; + projectile.magic = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/NightOrb.cs b/Projectiles/Magic/NightOrb.cs index de1e9829b5..a9d1c1386e 100644 --- a/Projectiles/Magic/NightOrb.cs +++ b/Projectiles/Magic/NightOrb.cs @@ -1,91 +1,91 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class NightOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NightBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - return; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class NightOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NightBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + return; + } + } + } + } +} diff --git a/Projectiles/Magic/NightRay.cs b/Projectiles/Magic/NightRay.cs index 05a47481fa..479ba89ee0 100644 --- a/Projectiles/Magic/NightRay.cs +++ b/Projectiles/Magic/NightRay.cs @@ -1,53 +1,53 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class NightRay : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 150; - } - - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("NightOrb"), (int)((double)projectile.damage * 0.6f), projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 3; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class NightRay : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 150; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("NightOrb"), (int)((double)projectile.damage * 0.6f), projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 3; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 79316173a8..250be44d3b 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -1,69 +1,69 @@ -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.Magic -{ - public class NuclearFuryProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nuclear Fury"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 3; - } - - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.alpha = 255; - projectile.friendly = true; - projectile.aiStyle = 71; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.tileCollide = false; - projectile.extraUpdates = 2; - projectile.ignoreWater = true; - aiType = 409; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 34, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 0, 200, 0); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width, projectile.height); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - } -} \ No newline at end of file +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.Magic +{ + public class NuclearFuryProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nuclear Fury"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.alpha = 255; + projectile.friendly = true; + projectile.aiStyle = 71; + projectile.magic = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.tileCollide = false; + projectile.extraUpdates = 2; + projectile.ignoreWater = true; + aiType = 409; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 34, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 0, 200, 0); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width, projectile.height); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + } +} diff --git a/Projectiles/Magic/ParticleBeamofDoom.cs b/Projectiles/Magic/ParticleBeamofDoom.cs index 4264b50970..bcacb3a54c 100644 --- a/Projectiles/Magic/ParticleBeamofDoom.cs +++ b/Projectiles/Magic/ParticleBeamofDoom.cs @@ -1,50 +1,50 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ParticleBeamofDoom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Doom"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num249 = 206; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ParticleBeamofDoom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Doom"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 100; + projectile.timeLeft = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num249 = 206; + int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].velocity *= 0.1f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/PhantasmalFury.cs b/Projectiles/Magic/PhantasmalFury.cs index ca19eca782..69404a460c 100644 --- a/Projectiles/Magic/PhantasmalFury.cs +++ b/Projectiles/Magic/PhantasmalFury.cs @@ -1,74 +1,74 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class PhantasmalFury : ModProjectile - { - int lightTimer = 10; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fury"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.magic = true; - } - - public override void AI() - { - lightTimer--; - if (lightTimer == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - lightTimer = 10; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default(Color), 2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 43); - for (int j = 0; j <= 10; j++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default(Color), 1f); - } - float spread = 30f * 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) - { - for (i = 0; i < 4; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class PhantasmalFury : ModProjectile + { + int lightTimer = 10; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fury"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + projectile.magic = true; + } + + public override void AI() + { + lightTimer--; + if (lightTimer == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + lightTimer = 10; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default(Color), 2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 43); + for (int j = 0; j <= 10; j++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default(Color), 1f); + } + float spread = 30f * 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) + { + for (i = 0; i < 4; i++ ) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("Phantom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 7d19a90e1e..f7975d78cf 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -1,74 +1,74 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class Phantom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.timeLeft = 120; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default(Color), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 800f; - 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 = 30f; - 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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Phantom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.extraUpdates = 1; + projectile.penetrate = 2; + projectile.ignoreWater = true; + projectile.timeLeft = 120; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default(Color), 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 800f; + 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 = 30f; + 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; + } + } + } +} diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index 2c97e9bc2b..8cbd0e81be 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -1,54 +1,54 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class PlagueFang : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fang"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.magic = true; - projectile.alpha = 255; - projectile.penetrate = 9; - projectile.aiStyle = 1; - aiType = 355; - } - - public override void AI() - { - if (Main.rand.Next(2) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 163, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int num301 = 0; num301 < 15; num301++) - { - int num302 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 163, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num302].noGravity = true; - Main.dust[num302].velocity *= 1.2f; - Main.dust[num302].velocity -= projectile.oldVelocity * 0.3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 300); - target.immune[projectile.owner] = 2; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class PlagueFang : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fang"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.magic = true; + projectile.alpha = 255; + projectile.penetrate = 9; + projectile.aiStyle = 1; + aiType = 355; + } + + public override void AI() + { + if (Main.rand.Next(2) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 163, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int num301 = 0; num301 < 15; num301++) + { + int num302 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 163, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num302].noGravity = true; + Main.dust[num302].velocity *= 1.2f; + Main.dust[num302].velocity -= projectile.oldVelocity * 0.3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + target.immune[projectile.owner] = 2; + } + } +} diff --git a/Projectiles/Magic/PlasmaBolt.cs b/Projectiles/Magic/PlasmaBolt.cs index 03972365ab..e7df515aff 100644 --- a/Projectiles/Magic/PlasmaBolt.cs +++ b/Projectiles/Magic/PlasmaBolt.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class PlasmaBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 200; - projectile.extraUpdates = 10; - } - - public override void AI() - { - 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), 1f)]; - dust.velocity = Vector2.Zero; - dust.position -= projectile.velocity / 5f * (float)num121; - dust.noGravity = true; - dust.scale = 0.65f; - dust.noLight = true; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class PlasmaBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 200; + projectile.extraUpdates = 10; + } + + public override void AI() + { + 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), 1f)]; + dust.velocity = Vector2.Zero; + dust.position -= projectile.velocity / 5f * (float)num121; + dust.noGravity = true; + dust.scale = 0.65f; + dust.noLight = true; + } + } + } + } +} diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index b6a94318ec..145aa5a727 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -1,99 +1,99 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class PlasmaRay : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 80; - } - - public override void AI() - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 0.75f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - - 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) - { - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("PlasmaRay2"), (int)((double)projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("PlasmaRay2"), (int)((double)projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - 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, 173, 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.ShadowFlame, 60); - target.AddBuff(BuffID.Ichor, 120); - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Poisoned, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class PlasmaRay : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.extraUpdates = 100; + projectile.timeLeft = 80; + } + + public override void AI() + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 0.75f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + + 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) + { + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("PlasmaRay2"), (int)((double)projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("PlasmaRay2"), (int)((double)projectile.damage * 1.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + 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, 173, 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.ShadowFlame, 60); + target.AddBuff(BuffID.Ichor, 120); + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.Poisoned, 300); + } + } +} diff --git a/Projectiles/Magic/PlasmaRay2.cs b/Projectiles/Magic/PlasmaRay2.cs index ee431d94d5..ee1391a4f8 100644 --- a/Projectiles/Magic/PlasmaRay2.cs +++ b/Projectiles/Magic/PlasmaRay2.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class PlasmaRay2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 40; - } - - public override void AI() - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - if (projectile.velocity.X != projectile.velocity.X) - { - projectile.position.X = projectile.position.X + projectile.velocity.X; - projectile.velocity.X = -projectile.velocity.X; - } - if (projectile.velocity.Y != projectile.velocity.Y) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 0.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class PlasmaRay2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.penetrate = 1; + projectile.extraUpdates = 100; + projectile.timeLeft = 40; + } + + public override void AI() + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.position.X = projectile.position.X + projectile.velocity.X; + projectile.velocity.X = -projectile.velocity.X; + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + projectile.position.Y = projectile.position.Y + projectile.velocity.Y; + projectile.velocity.Y = -projectile.velocity.Y; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 0.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 65, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Magic/PlasmaShot.cs b/Projectiles/Magic/PlasmaShot.cs index 8659d031e7..1910ee4368 100644 --- a/Projectiles/Magic/PlasmaShot.cs +++ b/Projectiles/Magic/PlasmaShot.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class PlasmaShot : 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 = 10; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) - { - for (int num121 = 0; num121 < 10; 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; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - int num220 = Main.rand.Next(20, 31); - if (projectile.owner == Main.myPlayer) - { - for (int num221 = 0; num221 < num220; num221++) - { - Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value17.Normalize(); - value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, 511 + Main.rand.Next(3), projectile.damage, 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); - } - } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class PlasmaShot : 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 = 10; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + for (int num121 = 0; num121 < 10; 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; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + int num220 = Main.rand.Next(20, 31); + if (projectile.owner == Main.myPlayer) + { + for (int num221 = 0; num221 < num220; num221++) + { + Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value17.Normalize(); + value17 *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, 511 + Main.rand.Next(3), projectile.damage, 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + } + } + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Magic/Purge.cs b/Projectiles/Magic/Purge.cs index a1aec85b83..9a1d9468d2 100644 --- a/Projectiles/Magic/Purge.cs +++ b/Projectiles/Magic/Purge.cs @@ -1,135 +1,135 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class Purge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Purge"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 64; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == mod.ProjectileType("Purge")) - { - projectile.ai[0] += 1f; - int num2 = 0; - if (projectile.ai[0] >= 20f) - { - num2++; - } - if (projectile.ai[0] >= 40f) - { - num2++; - } - if (projectile.ai[0] >= 60f) - { - num2++; - } - int num3 = 24; - int num4 = 6; - projectile.ai[1] += 1f; - bool flag = false; - if (projectile.ai[1] >= (float)(num3 - num4 * num2)) - { - projectile.ai[1] = 0f; - flag = true; - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num3 - num4 * num2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 91); - } - } - if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) - { - Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); - Vector2 value = projectile.Center + vector2; - for (int i = 0; i < 2; i++) - { - int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 107, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default(Color), 1f); - Main.dust[num5].velocity *= 0.66f; - Main.dust[num5].noGravity = true; - Main.dust[num5].scale = 1.4f; - } - } - if (flag && Main.myPlayer == projectile.owner) - { - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; - if (flag2) - { - float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value2 = vector; - Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; - if (player.gravDir == -1f) - { - value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; - } - Vector2 vector3 = Vector2.Normalize(value3); - if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) - { - vector3 = -Vector2.UnitY; - } - vector3 *= scaleFactor; - if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector3; - int num6 = mod.ProjectileType("PurgeLaser"); - float scaleFactor2 = 14f; - int num7 = 7; - for (int j = 0; j < 3; j++) - { - value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default(Vector2)); - if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) - { - spinningpoint = -Vector2.UnitY; - } - Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - else - { - projectile.Kill(); - } - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Purge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Purge"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 64; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.type == mod.ProjectileType("Purge")) + { + projectile.ai[0] += 1f; + int num2 = 0; + if (projectile.ai[0] >= 20f) + { + num2++; + } + if (projectile.ai[0] >= 40f) + { + num2++; + } + if (projectile.ai[0] >= 60f) + { + num2++; + } + int num3 = 24; + int num4 = 6; + projectile.ai[1] += 1f; + bool flag = false; + if (projectile.ai[1] >= (float)(num3 - num4 * num2)) + { + projectile.ai[1] = 0f; + flag = true; + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num3 - num4 * num2; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 91); + } + } + if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) + { + Vector2 vector2 = Vector2.UnitX * 24f; + vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); + Vector2 value = projectile.Center + vector2; + for (int i = 0; i < 2; i++) + { + int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 107, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default(Color), 1f); + Main.dust[num5].velocity *= 0.66f; + Main.dust[num5].noGravity = true; + Main.dust[num5].scale = 1.4f; + } + } + if (flag && Main.myPlayer == projectile.owner) + { + int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; + if (flag2) + { + float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value2 = vector; + Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; + if (player.gravDir == -1f) + { + value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; + } + Vector2 vector3 = Vector2.Normalize(value3); + if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) + { + vector3 = -Vector2.UnitY; + } + vector3 *= scaleFactor; + if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector3; + int num6 = mod.ProjectileType("PurgeLaser"); + float scaleFactor2 = 14f; + int num7 = 7; + for (int j = 0; j < 3; j++) + { + value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; + spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default(Vector2)); + if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) + { + spinningpoint = -Vector2.UnitY; + } + Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + else + { + projectile.Kill(); + } + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + } +} diff --git a/Projectiles/Magic/PurgeLaser.cs b/Projectiles/Magic/PurgeLaser.cs index 8f29b87022..7e34471d08 100644 --- a/Projectiles/Magic/PurgeLaser.cs +++ b/Projectiles/Magic/PurgeLaser.cs @@ -1,110 +1,110 @@ -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 PurgeLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 600; - projectile.magic = true; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f); - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 255, 100, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override void Kill(int timeLeft) - { - int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 107, 0f, 0f, 100, default(Color), 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } - } - } -} \ No newline at end of file +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 PurgeLaser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.timeLeft = 600; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f); + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 255, 100, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 3f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override void Kill(int timeLeft) + { + int num212 = Main.rand.Next(3, 7); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 107, 0f, 0f, 100, default(Color), 2.1f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } + } +} diff --git a/Projectiles/Magic/RougeSlashLarge.cs b/Projectiles/Magic/RougeSlashLarge.cs index b8e19a8e99..f267f25a41 100644 --- a/Projectiles/Magic/RougeSlashLarge.cs +++ b/Projectiles/Magic/RougeSlashLarge.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class RougeSlashLarge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slash"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 5; - projectile.alpha = 255; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - 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] == 12f) - { - projectile.localAI[1] = 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, 60, 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; - target.immune[projectile.owner] = 1; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class RougeSlashLarge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slash"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.penetrate = 5; + projectile.alpha = 255; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + 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] == 12f) + { + projectile.localAI[1] = 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, 60, 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; + target.immune[projectile.owner] = 1; + } + } +} diff --git a/Projectiles/Magic/RougeSlashMedium.cs b/Projectiles/Magic/RougeSlashMedium.cs index aff68dc9b5..25b6d59f6b 100644 --- a/Projectiles/Magic/RougeSlashMedium.cs +++ b/Projectiles/Magic/RougeSlashMedium.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class RougeSlashMedium : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slash"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 5; - projectile.alpha = 255; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - 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] == 12f) - { - projectile.localAI[1] = 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, 60, 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; - target.immune[projectile.owner] = 1; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class RougeSlashMedium : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slash"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.penetrate = 5; + projectile.alpha = 255; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + 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] == 12f) + { + projectile.localAI[1] = 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, 60, 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; + target.immune[projectile.owner] = 1; + } + } +} diff --git a/Projectiles/Magic/RougeSlashSmall.cs b/Projectiles/Magic/RougeSlashSmall.cs index f2b1384200..bcc7f51984 100644 --- a/Projectiles/Magic/RougeSlashSmall.cs +++ b/Projectiles/Magic/RougeSlashSmall.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class RougeSlashSmall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slash"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 5; - projectile.alpha = 255; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - 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] == 12f) - { - projectile.localAI[1] = 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, 60, 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; - target.immune[projectile.owner] = 1; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class RougeSlashSmall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slash"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.penetrate = 5; + projectile.alpha = 255; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + 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] == 12f) + { + projectile.localAI[1] = 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, 60, 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; + target.immune[projectile.owner] = 1; + } + } +} diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index 46d0e5edcf..6a97012aa4 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -1,121 +1,121 @@ -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 SHPB : ModProjectile - { - public int explosionTimer = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("SHPB"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.magic = true; - } - - public override void AI() - { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1f * num, 0.2f * num, 0.75f * num); - projectile.alpha -= 2; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; - projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) - { - projectile.localAI[0] = 0f; - } - } - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 250f; - 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) - { - explosionTimer--; - if (explosionTimer <= 0) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 155, projectile.alpha); - } - - 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(2, (int)projectile.position.X, (int)projectile.position.Y, 105); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SHPExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +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 SHPB : ModProjectile + { + public int explosionTimer = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("SHPB"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.magic = true; + } + + public override void AI() + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 1f * num, 0.2f * num, 0.75f * num); + projectile.alpha -= 2; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; + projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.05f; + if ((double)projectile.scale > 1.2) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.scale -= 0.05f; + if ((double)projectile.scale < 0.8) + { + projectile.localAI[0] = 0f; + } + } + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 250f; + 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) + { + explosionTimer--; + if (explosionTimer <= 0) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 155, projectile.alpha); + } + + 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(2, (int)projectile.position.X, (int)projectile.position.Y, 105); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SHPExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Magic/SHPExplosion.cs b/Projectiles/Magic/SHPExplosion.cs index a89983cd35..4f3e2cad8a 100644 --- a/Projectiles/Magic/SHPExplosion.cs +++ b/Projectiles/Magic/SHPExplosion.cs @@ -1,108 +1,108 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SHPExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 500; - projectile.height = 500; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 5f * num, 1f * num, 4f * num); - 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(-40, 41); - float num464 = (float)Main.rand.Next(-40, 41); - float num465 = (float)Main.rand.Next(12, 36); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 246; - } - else if (randomDust == 1) - { - randomDust = 73; - } - else - { - randomDust = 187; - } - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 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++; - } - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SHPExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 500; + projectile.height = 500; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 5f * num, 1f * num, 4f * num); + 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(-40, 41); + float num464 = (float)Main.rand.Next(-40, 41); + float num465 = (float)Main.rand.Next(12, 36); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 246; + } + else if (randomDust == 1) + { + randomDust = 73; + } + else + { + randomDust = 187; + } + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 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++; + } + return; + } + } +} diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index b939b48444..8573b46ced 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -1,124 +1,124 @@ -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 SHPL : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 600; - projectile.magic = true; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0.2f, 0.5f); - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - return; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 155, projectile.alpha); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override void Kill(int timeLeft) - { - int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) - { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 246; - } - else if (randomDust == 1) - { - randomDust = 73; - } - else - { - randomDust = 187; - } - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, randomDust, 0f, 0f, 100, default(Color), 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } - } - } -} \ No newline at end of file +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 SHPL : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 3; + projectile.timeLeft = 600; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0.2f, 0.5f); + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + return; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 155, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 3f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override void Kill(int timeLeft) + { + int num212 = Main.rand.Next(3, 7); + for (int num213 = 0; num213 < num212; num213++) + { + int randomDust = Main.rand.Next(3); + if (randomDust == 0) + { + randomDust = 246; + } + else if (randomDust == 1) + { + randomDust = 73; + } + else + { + randomDust = 187; + } + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, randomDust, 0f, 0f, 100, default(Color), 2.1f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } + } +} diff --git a/Projectiles/Magic/SanguineFlare.cs b/Projectiles/Magic/SanguineFlare.cs index 1968b25989..567e9dbd80 100644 --- a/Projectiles/Magic/SanguineFlare.cs +++ b/Projectiles/Magic/SanguineFlare.cs @@ -1,98 +1,98 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SanguineFlare : ModProjectile - { - private int x; - private double speed = 10; - private float startSpeedX = 0f; - private float startSpeedY = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.magic = true; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.velocity.X = projectile.velocity.X + (Main.player[projectile.owner].velocity.X * 0.5f); - startSpeedY = projectile.velocity.Y + (Main.player[projectile.owner].velocity.Y * 0.5f); - projectile.velocity.Y = startSpeedY; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 180f) - { - x++; - speed += 0.1; - projectile.velocity.Y = startSpeedY + (float)(speed * Math.Sin(x/4)); - } - projectile.rotation += projectile.velocity.Y * 0.02f; - projectile.alpha -= 5; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - } - - public override void Kill(int timeLeft) - { - 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 = 10; - projectile.height = 10; - 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 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.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 < 6; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.7f); - 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, 235, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - - 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.HealEffect(1); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SanguineFlare : ModProjectile + { + private int x; + private double speed = 10; + private float startSpeedX = 0f; + private float startSpeedY = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + projectile.alpha = 255; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.velocity.X = projectile.velocity.X + (Main.player[projectile.owner].velocity.X * 0.5f); + startSpeedY = projectile.velocity.Y + (Main.player[projectile.owner].velocity.Y * 0.5f); + projectile.velocity.Y = startSpeedY; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 180f) + { + x++; + speed += 0.1; + projectile.velocity.Y = startSpeedY + (float)(speed * Math.Sin(x/4)); + } + projectile.rotation += projectile.velocity.Y * 0.02f; + projectile.alpha -= 5; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + + public override void Kill(int timeLeft) + { + 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 = 10; + projectile.height = 10; + 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 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.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 < 6; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.7f); + 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, 235, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + + 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.HealEffect(1); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs index 9f4ffa7805..53b5126cf5 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs @@ -1,65 +1,65 @@ -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 SeethingDischargeBrimstoneBarrage : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < (projectile.ai[1] == 1f ? 12f : 16f)) - { - projectile.velocity *= 1.01f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - 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 +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 SeethingDischargeBrimstoneBarrage : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < (projectile.ai[1] == 1f ? 12f : 16f)) + { + projectile.velocity *= 1.01f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + + 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; + } + } +} diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index 37bc6fe581..0641c8adb7 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -1,78 +1,78 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SeethingDischargeBrimstoneHellblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hellblast"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.magic = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 255; - projectile.alpha = 0; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.alpha += 1; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.velocity.X *= 1.03f; - projectile.velocity.Y *= 1.03f; - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int dust = 0; dust <= 5; dust++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SeethingDischargeBrimstoneHellblast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellblast"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.magic = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 255; + projectile.alpha = 0; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.alpha += 1; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.9f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.velocity.X *= 1.03f; + projectile.velocity.Y *= 1.03f; + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int dust = 0; dust <= 5; dust++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Magic/ShadeNimbus.cs b/Projectiles/Magic/ShadeNimbus.cs index 730d6a76a1..958155953a 100644 --- a/Projectiles/Magic/ShadeNimbus.cs +++ b/Projectiles/Magic/ShadeNimbus.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ShadeNimbus : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nimbus"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 54; - projectile.height = 28; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 5) - { - projectile.frame = 0; - } - } - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - else - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 8f) - { - projectile.ai[0] = 0f; - if (projectile.owner == Main.myPlayer) - { - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("Shaderain"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) - { - projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = projectile.type; - for (int num420 = 0; num420 < 1000; num420++) - { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) - { - num416++; - if (Main.projectile[num420].ai[1] > num418) - { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; - } - } - } - if (num416 > 2) - { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; - return; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ShadeNimbus : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nimbus"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 54; + projectile.height = 28; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 5) + { + projectile.frame = 0; + } + } + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 7200f) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + else + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 8f) + { + projectile.ai[0] = 0f; + if (projectile.owner == Main.myPlayer) + { + int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); + int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("Shaderain"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 10f) + { + projectile.localAI[0] = 0f; + int num416 = 0; + int num417 = 0; + float num418 = 0f; + int num419 = projectile.type; + for (int num420 = 0; num420 < 1000; num420++) + { + if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + { + num416++; + if (Main.projectile[num420].ai[1] > num418) + { + num417 = num420; + num418 = Main.projectile[num420].ai[1]; + } + } + } + if (num416 > 2) + { + Main.projectile[num417].netUpdate = true; + Main.projectile[num417].ai[1] = 36000f; + return; + } + } + } + } +} diff --git a/Projectiles/Magic/ShadeNimbusCloud.cs b/Projectiles/Magic/ShadeNimbusCloud.cs index e1b65c72dd..45c7c73765 100644 --- a/Projectiles/Magic/ShadeNimbusCloud.cs +++ b/Projectiles/Magic/ShadeNimbusCloud.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ShadeNimbusCloud : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nimbus"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.netImportant = true; - projectile.penetrate = -1; - } - - public override void AI() - { - float num410 = projectile.ai[0]; - float num411 = projectile.ai[1]; - if (num410 != 0f && num411 != 0f) - { - bool flag12 = false; - bool flag13 = false; - if ((projectile.velocity.X < 0f && projectile.Center.X < num410) || (projectile.velocity.X > 0f && projectile.Center.X > num410)) - { - flag12 = true; - } - if ((projectile.velocity.Y < 0f && projectile.Center.Y < num411) || (projectile.velocity.Y > 0f && projectile.Center.Y > num411)) - { - flag13 = true; - } - if (flag12 && flag13) - { - projectile.Kill(); - } - } - projectile.rotation += projectile.velocity.X * 0.02f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame > 3) - { - projectile.frame = 0; - return; - } - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShadeNimbus"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ShadeNimbusCloud : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nimbus"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.netImportant = true; + projectile.penetrate = -1; + } + + public override void AI() + { + float num410 = projectile.ai[0]; + float num411 = projectile.ai[1]; + if (num410 != 0f && num411 != 0f) + { + bool flag12 = false; + bool flag13 = false; + if ((projectile.velocity.X < 0f && projectile.Center.X < num410) || (projectile.velocity.X > 0f && projectile.Center.X > num410)) + { + flag12 = true; + } + if ((projectile.velocity.Y < 0f && projectile.Center.Y < num411) || (projectile.velocity.Y > 0f && projectile.Center.Y > num411)) + { + flag13 = true; + } + if (flag12 && flag13) + { + projectile.Kill(); + } + } + projectile.rotation += projectile.velocity.X * 0.02f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 3) + { + projectile.frame = 0; + return; + } + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShadeNimbus"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Magic/ShadecrystalProjectile.cs b/Projectiles/Magic/ShadecrystalProjectile.cs index a05fce815e..8035192944 100644 --- a/Projectiles/Magic/ShadecrystalProjectile.cs +++ b/Projectiles/Magic/ShadecrystalProjectile.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ShadecrystalProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 50; - projectile.scale = 1.2f; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); - projectile.rotation += projectile.velocity.X * 0.2f; - projectile.ai[1] += 1f; - if (Main.rand.Next(4) == 0) - { - int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 70, 0f, 0f, 0, default(Color), 1f); - Main.dust[num300].noGravity = true; - Main.dust[num300].velocity *= 0.5f; - Main.dust[num300].scale *= 0.9f; - } - projectile.velocity *= 0.985f; - if (projectile.ai[1] > 130f) - { - projectile.scale -= 0.05f; - if ((double)projectile.scale <= 0.2) - { - projectile.scale = 0.2f; - projectile.Kill(); - } - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 70, 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, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ShadecrystalProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.alpha = 50; + projectile.scale = 1.2f; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); + projectile.rotation += projectile.velocity.X * 0.2f; + projectile.ai[1] += 1f; + if (Main.rand.Next(4) == 0) + { + int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 70, 0f, 0f, 0, default(Color), 1f); + Main.dust[num300].noGravity = true; + Main.dust[num300].velocity *= 0.5f; + Main.dust[num300].scale *= 0.9f; + } + projectile.velocity *= 0.985f; + if (projectile.ai[1] > 130f) + { + projectile.scale -= 0.05f; + if ((double)projectile.scale <= 0.2) + { + projectile.scale = 0.2f; + projectile.Kill(); + } + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 70, 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, 120); + } + } +} diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index 2ae7a07d3e..50cb2a431f 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class Shaderain : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rain"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 40; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.penetrate = 3; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.magic = true; - } - - public override void AI() - { - projectile.alpha = 50; - } - - public override void Kill(int timeLeft) - { - int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default(Color), 1f); - Dust expr_A0A0_cp_0 = Main.dust[num310]; - expr_A0A0_cp_0.position.X = expr_A0A0_cp_0.position.X - 2f; - Main.dust[num310].alpha = 38; - Main.dust[num310].velocity *= 0.1f; - Main.dust[num310].velocity += -projectile.oldVelocity * 0.25f; - Main.dust[num310].scale = 0.95f; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Shaderain : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rain"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 40; + projectile.friendly = true; + projectile.extraUpdates = 1; + projectile.penetrate = 3; + projectile.ignoreWater = true; + projectile.timeLeft = 300; + projectile.magic = true; + } + + public override void AI() + { + projectile.alpha = 50; + } + + public override void Kill(int timeLeft) + { + int num310 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + (float)projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default(Color), 1f); + Dust expr_A0A0_cp_0 = Main.dust[num310]; + expr_A0A0_cp_0.position.X = expr_A0A0_cp_0.position.X - 2f; + Main.dust[num310].alpha = 38; + Main.dust[num310].velocity *= 0.1f; + Main.dust[num310].velocity += -projectile.oldVelocity * 0.25f; + Main.dust[num310].scale = 0.95f; + } + } +} diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index fc0cd7a33c..a757c1e9f4 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class Shadowbolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.damage = (int)((double)projectile.damage * 1.25); - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - projectile.damage = (int)((double)projectile.damage * 1.1); - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Shadowbolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.damage = (int)((double)projectile.damage * 1.25); + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + projectile.damage = (int)((double)projectile.damage * 1.1); + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 1f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + } +} diff --git a/Projectiles/Magic/ShiftingSands.cs b/Projectiles/Magic/ShiftingSands.cs index 4534f9f1ff..dcfc915f68 100644 --- a/Projectiles/Magic/ShiftingSands.cs +++ b/Projectiles/Magic/ShiftingSands.cs @@ -1,162 +1,162 @@ -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 ShiftingSands : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shifting Sands"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.magic = true; - } - - public override void AI() - { - if (projectile.soundDelay == 0 && Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.soundDelay = 10; - Main.PlaySound(SoundID.Item20, projectile.position); - } - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default(Color), 2f); - Dust dust = Main.dust[num114]; - dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; - if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) - { - if (Main.player[projectile.owner].channel) - { - float num115 = 18f; - Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; - } - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (projectile.ai[0] < 0f) - { - projectile.ai[0] += 1f; - } - if (num118 > num115) - { - num118 = num115 / num118; - num116 *= num118; - num117 *= num118; - int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); - int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); - if (num119 != num120 || num121 != num122) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - else - { - int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); - int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); - if (num123 != num124 || num125 != num126) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - } - else if (projectile.ai[0] <= 0f) - { - projectile.netUpdate = true; - float num127 = 12f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; - } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) - { - vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.Kill(); - } - projectile.ai[0] = 1f; - } - } - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - - 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, 14); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - } -} \ No newline at end of file +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 ShiftingSands : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shifting Sands"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.soundDelay == 0 && Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.soundDelay = 10; + Main.PlaySound(SoundID.Item20, projectile.position); + } + int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default(Color), 2f); + Dust dust = Main.dust[num114]; + dust.velocity *= 0.3f; + Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].noGravity = true; + if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) + { + if (Main.player[projectile.owner].channel) + { + float num115 = 18f; + Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; + float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; + if (Main.player[projectile.owner].gravDir == -1f) + { + num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; + } + float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + if (projectile.ai[0] < 0f) + { + projectile.ai[0] += 1f; + } + if (num118 > num115) + { + num118 = num115 / num118; + num116 *= num118; + num117 *= num118; + int num119 = (int)(num116 * 1000f); + int num120 = (int)(projectile.velocity.X * 1000f); + int num121 = (int)(num117 * 1000f); + int num122 = (int)(projectile.velocity.Y * 1000f); + if (num119 != num120 || num121 != num122) + { + projectile.netUpdate = true; + } + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + else + { + int num123 = (int)(num116 * 1000f); + int num124 = (int)(projectile.velocity.X * 1000f); + int num125 = (int)(num117 * 1000f); + int num126 = (int)(projectile.velocity.Y * 1000f); + if (num123 != num124 || num125 != num126) + { + projectile.netUpdate = true; + } + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + } + else if (projectile.ai[0] <= 0f) + { + projectile.netUpdate = true; + float num127 = 12f; + Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; + float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + if (Main.player[projectile.owner].gravDir == -1f) + { + num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + } + float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + if (num130 == 0f || projectile.ai[0] < 0f) + { + vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); + num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; + num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + } + num130 = num127 / num130; + num128 *= num130; + num129 *= num130; + projectile.velocity.X = num128; + projectile.velocity.Y = num129; + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.Kill(); + } + projectile.ai[0] = 1f; + } + } + if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + 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, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + } + } +} diff --git a/Projectiles/Magic/SirensSong.cs b/Projectiles/Magic/SirensSong.cs index ac6bae851d..b3bc8a69ab 100644 --- a/Projectiles/Magic/SirensSong.cs +++ b/Projectiles/Magic/SirensSong.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SirensSong : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Song"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - { - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - { - projectile.localAI[0] = 0f; - } - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.harpNote = projectile.ai[0]; - Main.PlaySound(SoundID.Item26, projectile.position); - } - Lighting.AddLight(projectile.Center, 0f, 1.2f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, 0); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - target.AddBuff(BuffID.Confused, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SirensSong : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Song"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.02f; + if (projectile.scale >= 1.25f) + { + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.02f; + if (projectile.scale <= 0.75f) + { + projectile.localAI[0] = 0f; + } + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.harpNote = projectile.ai[0]; + Main.PlaySound(SoundID.Item26, projectile.position); + } + Lighting.AddLight(projectile.Center, 0f, 1.2f, 0f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, 0); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + target.AddBuff(BuffID.Confused, 300); + } + } +} diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index 597787db5f..8296758ab4 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -1,63 +1,63 @@ -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 Snowflake : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Snowflake"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 9; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.alpha = 70; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.magic = true; - aiType = 491; - } - - public override void AI() - { - projectile.rotation += 0.15f; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.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); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - target.AddBuff(BuffID.Frostburn, 180); - } - } -} \ No newline at end of file +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 Snowflake : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snowflake"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 9; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.alpha = 70; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.magic = true; + aiType = 491; + } + + public override void AI() + { + projectile.rotation += 0.15f; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.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); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + target.AddBuff(BuffID.Frostburn, 180); + } + } +} diff --git a/Projectiles/Magic/SolarBeam2.cs b/Projectiles/Magic/SolarBeam2.cs index 2fb8a01650..5d9686470b 100644 --- a/Projectiles/Magic/SolarBeam2.cs +++ b/Projectiles/Magic/SolarBeam2.cs @@ -1,78 +1,78 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SolarBeam2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 6; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; - } - - 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; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default(Color), 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 4; - if (projectile.owner == Main.myPlayer) - { - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SolarBeam2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 6; + projectile.extraUpdates = 100; + projectile.timeLeft = 300; + } + + 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; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default(Color), 1f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 4; + if (projectile.owner == Main.myPlayer) + { + 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; + } + } + } +} diff --git a/Projectiles/Magic/SoulPiercer.cs b/Projectiles/Magic/SoulPiercer.cs index 2dacef2563..225a4a3f98 100644 --- a/Projectiles/Magic/SoulPiercer.cs +++ b/Projectiles/Magic/SoulPiercer.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SoulPiercer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Piercer"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 240; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - for (int x = 0; x < 3; x++) - { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("SoulPiercerBolt"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SoulPiercer : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Piercer"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.extraUpdates = 100; + projectile.timeLeft = 240; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + for (int x = 0; x < 3; x++) + { + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("SoulPiercerBolt"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner); + } + } + } + } +} diff --git a/Projectiles/Magic/SoulPiercerBolt.cs b/Projectiles/Magic/SoulPiercerBolt.cs index 52ab307dd5..0bf1ef8826 100644 --- a/Projectiles/Magic/SoulPiercerBolt.cs +++ b/Projectiles/Magic/SoulPiercerBolt.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SoulPiercerBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Piercer"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 180; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f; - Main.dust[num448].velocity *= 0.2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SoulPiercerBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Piercer"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 180; + projectile.penetrate = -1; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f; + Main.dust[num448].velocity *= 0.2f; + } + } + } +} diff --git a/Projectiles/Magic/SpiritFlameCurse.cs b/Projectiles/Magic/SpiritFlameCurse.cs index d4ce43f522..175c9aa8a9 100644 --- a/Projectiles/Magic/SpiritFlameCurse.cs +++ b/Projectiles/Magic/SpiritFlameCurse.cs @@ -1,85 +1,85 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SpiritFlameCurse : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 8; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.magic = true; - } - - public override void AI() - { - projectile.alpha -= 3; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.5f); - } - - public override void Kill(int timeLeft) - { - 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 = 150; - projectile.height = 150; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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, 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) - { - target.AddBuff(BuffID.Frostburn, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SpiritFlameCurse : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 8; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.magic = true; + } + + public override void AI() + { + projectile.alpha -= 3; + if (projectile.alpha <= 0) + { + projectile.Kill(); + } + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.5f); + } + + public override void Kill(int timeLeft) + { + 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 = 150; + projectile.height = 150; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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, 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) + { + target.AddBuff(BuffID.Frostburn, 180); + } + } +} diff --git a/Projectiles/Magic/Starblast.cs b/Projectiles/Magic/Starblast.cs index e50df3ffea..05d79715f1 100644 --- a/Projectiles/Magic/Starblast.cs +++ b/Projectiles/Magic/Starblast.cs @@ -1,83 +1,83 @@ -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 Starblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.magic = true; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.1f; - projectile.velocity.X = projectile.velocity.X * 1.025f; - projectile.alpha -= 23; - projectile.scale = 0.8f * (255f - (float)projectile.alpha) / 255f; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.alpha >= 255 && projectile.ai[0] > 5f) - { - projectile.Kill(); - } - if (Main.rand.Next(4) == 0) - { - int num193 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1f); - Main.dust[num193].position = projectile.Center; - Main.dust[num193].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[num193].noGravity = true; - Dust expr_835F_cp_0 = Main.dust[num193]; - expr_835F_cp_0.velocity.Y = expr_835F_cp_0.velocity.Y - 2f; - } - if (Main.rand.Next(6) == 0) - { - int num194 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 176, 0f, 0f, 100, default(Color), 1f); - Main.dust[num194].position = projectile.Center; - Main.dust[num194].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[num194].noGravity = true; - Main.dust[num194].velocity *= 0.1f; - } - } - - 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++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 176, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 180, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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 Starblast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + projectile.magic = true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.1f; + projectile.velocity.X = projectile.velocity.X * 1.025f; + projectile.alpha -= 23; + projectile.scale = 0.8f * (255f - (float)projectile.alpha) / 255f; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.alpha >= 255 && projectile.ai[0] > 5f) + { + projectile.Kill(); + } + if (Main.rand.Next(4) == 0) + { + int num193 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1f); + Main.dust[num193].position = projectile.Center; + Main.dust[num193].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num193].noGravity = true; + Dust expr_835F_cp_0 = Main.dust[num193]; + expr_835F_cp_0.velocity.Y = expr_835F_cp_0.velocity.Y - 2f; + } + if (Main.rand.Next(6) == 0) + { + int num194 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 176, 0f, 0f, 100, default(Color), 1f); + Main.dust[num194].position = projectile.Center; + Main.dust[num194].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num194].noGravity = true; + Main.dust[num194].velocity *= 0.1f; + } + } + + 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++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 176, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 180, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index 0af41b50df..b5c66c7ff3 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class StickyFeather : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feather"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.magic = true; - projectile.aiStyle = 93; - aiType = 514; - } - - public override void AI() - { - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - 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 = 50; - projectile.height = 50; - 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 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 1.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, 206, 0f, 0f, 100, default(Color), 1.7f); - 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, 206, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class StickyFeather : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.magic = true; + projectile.aiStyle = 93; + aiType = 514; + } + + public override void AI() + { + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + 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 = 50; + projectile.height = 50; + 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 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 1.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, 206, 0f, 0f, 100, default(Color), 1.7f); + 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, 206, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Magic/SupremeDustFlakProjectile.cs b/Projectiles/Magic/SupremeDustFlakProjectile.cs index 87bbf54dc3..319778d3bb 100644 --- a/Projectiles/Magic/SupremeDustFlakProjectile.cs +++ b/Projectiles/Magic/SupremeDustFlakProjectile.cs @@ -1,107 +1,107 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SupremeDustFlakProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = 2; - projectile.extraUpdates = 3; - projectile.timeLeft = 100; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 32; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = false; - Main.dust[num299].scale *= 1f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = false; - Main.dust[num299].scale *= 1.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 0.25f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SupremeDustFlakProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.penetrate = 2; + projectile.extraUpdates = 3; + projectile.timeLeft = 100; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 32; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = false; + Main.dust[num299].scale *= 1f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = false; + Main.dust[num299].scale *= 1.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 0.25f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + } + } +} diff --git a/Projectiles/Magic/SupremeDustProjectile.cs b/Projectiles/Magic/SupremeDustProjectile.cs index 309f6fa38f..2808bc3809 100644 --- a/Projectiles/Magic/SupremeDustProjectile.cs +++ b/Projectiles/Magic/SupremeDustProjectile.cs @@ -1,105 +1,105 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class SupremeDustProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 200; - projectile.height = 200; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = 4; - projectile.extraUpdates = 3; - projectile.timeLeft = 200; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.95f) / 255f, ((255 - projectile.alpha) * 0.85f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 32; - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 4f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 2.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - int num399 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num399].noGravity = true; - Main.dust[num399].scale *= 6f; - Dust expr_DBEF_cp_0 = Main.dust[num399]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num399]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num399].scale *= 2.5f; - } - Dust expr_DC74_cp_1 = Main.dust[num399]; - expr_DC74_cp_1.velocity.X = expr_DC74_cp_1.velocity.X * 1.2f; - Dust expr_DC94_cp_1 = Main.dust[num399]; - expr_DC94_cp_1.velocity.Y = expr_DC94_cp_1.velocity.Y * 1.2f; - Main.dust[num399].scale *= num296; - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SupremeDustFlakProjectile"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SupremeDustProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 200; + projectile.height = 200; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.penetrate = 4; + projectile.extraUpdates = 3; + projectile.timeLeft = 200; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.95f) / 255f, ((255 - projectile.alpha) * 0.85f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 32; + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 4f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 2.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + int num399 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num399].noGravity = true; + Main.dust[num399].scale *= 6f; + Dust expr_DBEF_cp_0 = Main.dust[num399]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num399]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num399].scale *= 2.5f; + } + Dust expr_DC74_cp_1 = Main.dust[num399]; + expr_DC74_cp_1.velocity.X = expr_DC74_cp_1.velocity.X * 1.2f; + Dust expr_DC94_cp_1 = Main.dust[num399]; + expr_DC94_cp_1.velocity.Y = expr_DC94_cp_1.velocity.Y * 1.2f; + Main.dust[num399].scale *= num296; + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SupremeDustFlakProjectile"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Magic/T1000.cs b/Projectiles/Magic/T1000.cs index 9f62ceff5a..d1ba00eea0 100644 --- a/Projectiles/Magic/T1000.cs +++ b/Projectiles/Magic/T1000.cs @@ -1,135 +1,135 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class T1000 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("T1000"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 80; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == mod.ProjectileType("T1000")) - { - projectile.ai[0] += 1f; - int num2 = 0; - if (projectile.ai[0] >= 20f) - { - num2++; - } - if (projectile.ai[0] >= 40f) - { - num2++; - } - if (projectile.ai[0] >= 60f) - { - num2++; - } - int num3 = 24; - int num4 = 6; - projectile.ai[1] += 1f; - bool flag = false; - if (projectile.ai[1] >= (float)(num3 - num4 * num2)) - { - projectile.ai[1] = 0f; - flag = true; - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num3 - num4 * num2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 91); - } - } - if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) - { - Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); - Vector2 value = projectile.Center + vector2; - for (int i = 0; i < 2; i++) - { - int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 66, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num5].velocity *= 0.66f; - Main.dust[num5].noGravity = true; - Main.dust[num5].scale = 1.4f; - } - } - if (flag && Main.myPlayer == projectile.owner) - { - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; - if (flag2) - { - float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value2 = vector; - Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; - if (player.gravDir == -1f) - { - value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; - } - Vector2 vector3 = Vector2.Normalize(value3); - if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) - { - vector3 = -Vector2.UnitY; - } - vector3 *= scaleFactor; - if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector3; - int num6 = mod.ProjectileType("T1000Laser"); - float scaleFactor2 = 14f; - int num7 = 7; - for (int j = 0; j < 4; j++) - { - value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default(Vector2)); - if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) - { - spinningpoint = -Vector2.UnitY; - } - Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - else - { - projectile.Kill(); - } - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class T1000 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("T1000"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 80; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.type == mod.ProjectileType("T1000")) + { + projectile.ai[0] += 1f; + int num2 = 0; + if (projectile.ai[0] >= 20f) + { + num2++; + } + if (projectile.ai[0] >= 40f) + { + num2++; + } + if (projectile.ai[0] >= 60f) + { + num2++; + } + int num3 = 24; + int num4 = 6; + projectile.ai[1] += 1f; + bool flag = false; + if (projectile.ai[1] >= (float)(num3 - num4 * num2)) + { + projectile.ai[1] = 0f; + flag = true; + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num3 - num4 * num2; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 91); + } + } + if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) + { + Vector2 vector2 = Vector2.UnitX * 24f; + vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); + Vector2 value = projectile.Center + vector2; + for (int i = 0; i < 2; i++) + { + int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 66, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num5].velocity *= 0.66f; + Main.dust[num5].noGravity = true; + Main.dust[num5].scale = 1.4f; + } + } + if (flag && Main.myPlayer == projectile.owner) + { + int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; + if (flag2) + { + float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value2 = vector; + Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; + if (player.gravDir == -1f) + { + value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; + } + Vector2 vector3 = Vector2.Normalize(value3); + if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) + { + vector3 = -Vector2.UnitY; + } + vector3 *= scaleFactor; + if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector3; + int num6 = mod.ProjectileType("T1000Laser"); + float scaleFactor2 = 14f; + int num7 = 7; + for (int j = 0; j < 4; j++) + { + value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; + spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default(Vector2)); + if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) + { + spinningpoint = -Vector2.UnitY; + } + Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + else + { + projectile.Kill(); + } + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + } +} diff --git a/Projectiles/Magic/T1000Laser.cs b/Projectiles/Magic/T1000Laser.cs index 7a5599072a..ccb13732a7 100644 --- a/Projectiles/Magic/T1000Laser.cs +++ b/Projectiles/Magic/T1000Laser.cs @@ -1,110 +1,110 @@ -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 T1000Laser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 600; - projectile.magic = true; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f); - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override void Kill(int timeLeft) - { - int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } - } - } -} \ No newline at end of file +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 T1000Laser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.timeLeft = 600; + projectile.magic = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f); + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 3f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override void Kill(int timeLeft) + { + int num212 = Main.rand.Next(3, 7); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } + } +} diff --git a/Projectiles/Magic/TearsofHeavenProjectile.cs b/Projectiles/Magic/TearsofHeavenProjectile.cs index 35c3788bbf..092bee355b 100644 --- a/Projectiles/Magic/TearsofHeavenProjectile.cs +++ b/Projectiles/Magic/TearsofHeavenProjectile.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class TearsofHeavenProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.timeLeft = 240; - projectile.light = 0.5f; - projectile.tileCollide = false; - } - - 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, 175, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - for (int num92 = 0; num92 < 3; num92++) - { - int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default(Color), 1f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0f; - } - for (int num105 = 0; num105 < 3; num105++) - { - int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, 0f, 0f, 100, default(Color), 1f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - 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 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class TearsofHeavenProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.timeLeft = 240; + projectile.light = 0.5f; + projectile.tileCollide = false; + } + + 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, 175, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + for (int num92 = 0; num92 < 3; num92++) + { + int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default(Color), 1f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0f; + } + for (int num105 = 0; num105 < 3; num105++) + { + int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 92, 0f, 0f, 100, default(Color), 1f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + 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 = 8f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } +} diff --git a/Projectiles/Magic/TerraBolt.cs b/Projectiles/Magic/TerraBolt.cs index 8b47a5a803..8e5d5d6f83 100644 --- a/Projectiles/Magic/TerraBolt.cs +++ b/Projectiles/Magic/TerraBolt.cs @@ -1,52 +1,52 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class TerraBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("TerraOrb2"), (int)((double)projectile.damage * 0.7f), projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class TerraBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 30; + projectile.magic = true; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("TerraOrb2"), (int)((double)projectile.damage * 0.7f), projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/TerraBolt2.cs b/Projectiles/Magic/TerraBolt2.cs index 5331751b50..138c9ba88a 100644 --- a/Projectiles/Magic/TerraBolt2.cs +++ b/Projectiles/Magic/TerraBolt2.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class TerraBolt2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 15; - projectile.magic = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class TerraBolt2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 15; + projectile.magic = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/TerraOrb.cs b/Projectiles/Magic/TerraOrb.cs index ae843a4a86..43d2fe695f 100644 --- a/Projectiles/Magic/TerraOrb.cs +++ b/Projectiles/Magic/TerraOrb.cs @@ -1,91 +1,91 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class TerraOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("TerraBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - return; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class TerraOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("TerraBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + return; + } + } + } + } +} diff --git a/Projectiles/Magic/TerraOrb2.cs b/Projectiles/Magic/TerraOrb2.cs index f24c7478bd..f23f94b09c 100644 --- a/Projectiles/Magic/TerraOrb2.cs +++ b/Projectiles/Magic/TerraOrb2.cs @@ -1,91 +1,91 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class TerraOrb2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("TerraBolt2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - return; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class TerraOrb2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("TerraBolt2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + return; + } + } + } + } +} diff --git a/Projectiles/Magic/TerraRay.cs b/Projectiles/Magic/TerraRay.cs index c911f425ef..fdfd9b8202 100644 --- a/Projectiles/Magic/TerraRay.cs +++ b/Projectiles/Magic/TerraRay.cs @@ -1,53 +1,53 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class TerraRay : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 150; - } - - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 21f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("TerraOrb"), (int)((double)projectile.damage * 0.7f), projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 3; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class TerraRay : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 150; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 21f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("TerraOrb"), (int)((double)projectile.damage * 0.7f), projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 3; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } + } + } +} diff --git a/Projectiles/Magic/ThunderstormShot.cs b/Projectiles/Magic/ThunderstormShot.cs index e05316cefb..6cb8455df3 100644 --- a/Projectiles/Magic/ThunderstormShot.cs +++ b/Projectiles/Magic/ThunderstormShot.cs @@ -93,4 +93,4 @@ namespace CalamityMod.Projectiles.Magic projectile.Damage(); } } -} \ No newline at end of file +} diff --git a/Projectiles/Magic/ThunderstormShotSplit.cs b/Projectiles/Magic/ThunderstormShotSplit.cs index 6b57c14467..243879a285 100644 --- a/Projectiles/Magic/ThunderstormShotSplit.cs +++ b/Projectiles/Magic/ThunderstormShotSplit.cs @@ -83,4 +83,4 @@ namespace CalamityMod.Projectiles.Magic projectile.Damage(); } } -} \ No newline at end of file +} diff --git a/Projectiles/Magic/TradewindsProjectile.cs b/Projectiles/Magic/TradewindsProjectile.cs index 41960e1c0a..4d41d53dd9 100644 --- a/Projectiles/Magic/TradewindsProjectile.cs +++ b/Projectiles/Magic/TradewindsProjectile.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class TradewindsProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feather"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.magic = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 64, 0f, 0f); - } - } - - 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; - } - projectile.velocity *= 0.75f; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.ai[0] += 0.1f; - projectile.velocity *= 0.75f; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class TradewindsProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.timeLeft = 600; + projectile.magic = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 64, 0f, 0f); + } + } + + 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; + } + projectile.velocity *= 0.75f; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.ai[0] += 0.1f; + projectile.velocity *= 0.75f; + } + } +} diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index ecd2c6bf98..c81f467af1 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class UberBubble : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.magic = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - if (projectile.alpha > 0) - { - projectile.alpha -= 30; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Vector2 v2 = projectile.ai[0].ToRotationVector2(); - float num743 = projectile.velocity.ToRotation(); - float num744 = v2.ToRotation(); - double num745 = (double)(num744 - num743); - if (num745 > 3.1415926535897931) - { - num745 -= 6.2831853071795862; - } - if (num745 < -3.1415926535897931) - { - num745 += 6.2831853071795862; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.myPlayer == projectile.owner && projectile.timeLeft > 60) - { - projectile.timeLeft = 60; - return; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 96); - int num190 = Main.rand.Next(3, 7); - for (int num191 = 0; num191 < num190; num191++) - { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 171, 0f, 0f, 100, default(Color), 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; - } - if (projectile.owner == Main.myPlayer) - { - for (int numBubbles = 0; numBubbles <= (Main.rand.Next(3, 7)); numBubbles++) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * (Main.rand.NextFloat() * 3f), projectile.velocity.Y * (Main.rand.NextFloat() * 3f), mod.ProjectileType("BlueBubble"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class UberBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.magic = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + if (projectile.alpha > 0) + { + projectile.alpha -= 30; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Vector2 v2 = projectile.ai[0].ToRotationVector2(); + float num743 = projectile.velocity.ToRotation(); + float num744 = v2.ToRotation(); + double num745 = (double)(num744 - num743); + if (num745 > 3.1415926535897931) + { + num745 -= 6.2831853071795862; + } + if (num745 < -3.1415926535897931) + { + num745 += 6.2831853071795862; + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.myPlayer == projectile.owner && projectile.timeLeft > 60) + { + projectile.timeLeft = 60; + return; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 96); + int num190 = Main.rand.Next(3, 7); + for (int num191 = 0; num191 < num190; num191++) + { + int num192 = Dust.NewDust(projectile.Center, 0, 0, 171, 0f, 0f, 100, default(Color), 1.4f); + Main.dust[num192].velocity *= 0.8f; + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].noGravity = true; + } + if (projectile.owner == Main.myPlayer) + { + for (int numBubbles = 0; numBubbles <= (Main.rand.Next(3, 7)); numBubbles++) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * (Main.rand.NextFloat() * 3f), projectile.velocity.Y * (Main.rand.NextFloat() * 3f), mod.ProjectileType("BlueBubble"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Magic/UndinesRetribution.cs b/Projectiles/Magic/UndinesRetribution.cs index 9db7bf8eab..bff5cf04a0 100644 --- a/Projectiles/Magic/UndinesRetribution.cs +++ b/Projectiles/Magic/UndinesRetribution.cs @@ -1,152 +1,152 @@ -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 UndinesRetribution : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Undine's Retribution"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 420; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num953 = 25f * projectile.ai[1]; //100 - float scaleFactor12 = 5f * projectile.ai[1]; //5 - float num954 = 500f; - 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, 0f, 0.1f, 0.7f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 9f; - 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 - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } - - 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("CrushDepth"), 180); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 4; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - } - for (int num194 = 0; num194 < 6; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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 UndinesRetribution : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Undine's Retribution"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 420; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num953 = 25f * projectile.ai[1]; //100 + float scaleFactor12 = 5f * projectile.ai[1]; //5 + float num954 = 500f; + 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, 0f, 0.1f, 0.7f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 9f; + 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 + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } + + 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("CrushDepth"), 180); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 4; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 6; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index ded8898dad..0b1fac5940 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class Vehemence : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vehemence"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - projectile.magic = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default(Color), 2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.15f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - for (int j = 0; j <= 25; j++) - { - int num459 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default(Color), 1f); - Main.dust[num459].noGravity = true; - Main.dust[num459].velocity *= 0.1f; - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - double lifeAmount = (double)target.life; - double lifeMax = (double)target.lifeMax; - double damageMult = (lifeAmount / lifeMax) * 7; - damage = (int)Math.Pow(damage, damageMult); - if (damage > 1000000) - { - damage = 1000000; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.life == target.lifeMax) - { - target.AddBuff(BuffID.ShadowFlame, 12000); - target.AddBuff(BuffID.Ichor, 12000); - target.AddBuff(BuffID.Frostburn, 12000); - target.AddBuff(BuffID.OnFire, 12000); - target.AddBuff(BuffID.Poisoned, 12000); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Vehemence : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vehemence"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + projectile.magic = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default(Color), 2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.15f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + for (int j = 0; j <= 25; j++) + { + int num459 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default(Color), 1f); + Main.dust[num459].noGravity = true; + Main.dust[num459].velocity *= 0.1f; + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + double lifeAmount = (double)target.life; + double lifeMax = (double)target.lifeMax; + double damageMult = (lifeAmount / lifeMax) * 7; + damage = (int)Math.Pow(damage, damageMult); + if (damage > 1000000) + { + damage = 1000000; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.life == target.lifeMax) + { + target.AddBuff(BuffID.ShadowFlame, 12000); + target.AddBuff(BuffID.Ichor, 12000); + target.AddBuff(BuffID.Frostburn, 12000); + target.AddBuff(BuffID.OnFire, 12000); + target.AddBuff(BuffID.Poisoned, 12000); + } + } + } +} diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index fa74dee584..ebbba381cf 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -1,74 +1,74 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class VenusianBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("VenusianExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int num251 = Main.rand.Next(4, 10); - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("VenusianFlame"), (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VenusianBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("VenusianExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int num251 = Main.rand.Next(4, 10); + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("VenusianFlame"), (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index a5cfa2559c..be10103e66 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -1,103 +1,103 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class VenusianExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - 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); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - 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, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - 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, 55, 0f, 0f, 100, default(Color), 2.5f); - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VenusianExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 250; + projectile.height = 250; + projectile.friendly = true; + projectile.ignoreWater = false; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 120; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + + 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); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + 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, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + 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, 55, 0f, 0f, 100, default(Color), 2.5f); + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + } + } +} diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index fe659270ac..a7c607e483 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -1,106 +1,106 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class VenusianFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 120; - } - - 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.type >= 326 && projectile.type <= 328) - { - 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, 55, 0f, 0f, 100, default(Color), 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, 55, 0f, 0f, 100, default(Color), 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; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VenusianFlame : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 120; + } + + 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.type >= 326 && projectile.type <= 328) + { + 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, 55, 0f, 0f, 100, default(Color), 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, 55, 0f, 0f, 100, default(Color), 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; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} diff --git a/Projectiles/Magic/Viscera.cs b/Projectiles/Magic/Viscera.cs index 29182c458e..c4030dbc80 100644 --- a/Projectiles/Magic/Viscera.cs +++ b/Projectiles/Magic/Viscera.cs @@ -1,85 +1,85 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class Viscera : ModProjectile - { - public float healAmt = 1f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Viscera"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 6; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - healAmt *= 1.4f; - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - healAmt *= 1.4f; - Player player = Main.player[projectile.owner]; - player.statLife += (int)healAmt; - player.HealEffect((int)healAmt); - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 5, 0f, 0f, 0, default(Color), 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Viscera : ModProjectile + { + public float healAmt = 1f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Viscera"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 6; + projectile.extraUpdates = 100; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + healAmt *= 1.4f; + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + healAmt *= 1.4f; + Player player = Main.player[projectile.owner]; + player.statLife += (int)healAmt; + player.HealEffect((int)healAmt); + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 5, 0f, 0f, 0, default(Color), 1f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + } +} diff --git a/Projectiles/Magic/VividBolt.cs b/Projectiles/Magic/VividBolt.cs index e41461e012..14bed1882f 100644 --- a/Projectiles/Magic/VividBolt.cs +++ b/Projectiles/Magic/VividBolt.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class VividBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.penetrate = -1; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VividBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.penetrate = -1; + projectile.friendly = true; + projectile.timeLeft = 30; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num447 = 0; num447 < 1; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + } +} diff --git a/Projectiles/Magic/VividClarity.cs b/Projectiles/Magic/VividClarity.cs index 405a9b7c6a..36dd1217b5 100644 --- a/Projectiles/Magic/VividClarity.cs +++ b/Projectiles/Magic/VividClarity.cs @@ -1,96 +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 VividClarity : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("VividOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.damage = (int)((double)projectile.damage * 1.1); - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - projectile.damage = (int)((double)projectile.damage * 1.05); - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VividClarity : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + { + projectile.localAI[1] = 0f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("VividOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num447 = 0; num447 < 2; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.damage = (int)((double)projectile.damage * 1.1); + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + projectile.damage = (int)((double)projectile.damage * 1.05); + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + } +} diff --git a/Projectiles/Magic/VividOrb.cs b/Projectiles/Magic/VividOrb.cs index 145af4cad9..76c9d94569 100644 --- a/Projectiles/Magic/VividOrb.cs +++ b/Projectiles/Magic/VividOrb.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class VividOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = projectile.velocity.X; - projectile.ai[1] = projectile.velocity.Y; - } - if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) - { - projectile.velocity *= 0.98f; - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 24f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("VividBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VividOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = projectile.velocity.X; + projectile.ai[1] = projectile.velocity.Y; + } + if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0) + { + projectile.velocity *= 0.98f; + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 24f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("VividBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } +} diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs index 7879b97f03..06108ea9be 100644 --- a/Projectiles/Magic/Vortex.cs +++ b/Projectiles/Magic/Vortex.cs @@ -1,190 +1,190 @@ -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.Magic -{ - public class Vortex : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Vortex"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; - ProjectileID.Sets.TrailingMode[projectile.type] = 3; - } - - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.alpha = 255; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.timeLeft = 300; - projectile.tileCollide = true; - projectile.extraUpdates = 4; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 10f && Main.rand.Next(3) == 0) - { - int num713 = 5; - for (int num714 = 0; num714 < num713; num714++) - { - Vector2 vector58 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width, (float)projectile.height) / 2f; - vector58 = vector58.RotatedBy((double)(num714 - (num713 / 2 - 1)) * 3.1415926535897931 / (double)((float)num713), default(Vector2)) + projectile.Center; - Vector2 value25 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num715 = Dust.NewDust(vector58 + value25, 0, 0, 66, value25.X * 2f, value25.Y * 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.7f); - Main.dust[num715].noGravity = true; - Main.dust[num715].noLight = true; - Main.dust[num715].velocity /= 4f; - Main.dust[num715].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[1] / 3f) % 3; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); - } - int num716 = -1; - Vector2 vector59 = projectile.Center; - float num717 = 350f * projectile.ai[1]; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) - { - for (int num718 = 0; num718 < 200; num718++) - { - NPC nPC6 = Main.npc[num718]; - if (nPC6.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (float)(num718 + 1))) - { - Vector2 center4 = nPC6.Center; - float num719 = Vector2.Distance(center4, vector59); - if (num719 < num717 && Collision.CanHit(projectile.position, projectile.width, projectile.height, nPC6.position, nPC6.width, nPC6.height)) - { - num717 = num719; - vector59 = center4; - num716 = num718; - } - } - } - if (num716 >= 0) - { - projectile.ai[0] = (float)(num716 + 1); - projectile.netUpdate = true; - } - } - if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) - { - projectile.localAI[0] = 30f; - } - bool flag32 = false; - if (projectile.ai[0] != 0f) - { - int num720 = (int)(projectile.ai[0] - 1f); - if (Main.npc[num720].active && !Main.npc[num720].dontTakeDamage && Main.npc[num720].immune[projectile.owner] == 0) - { - float num721 = Main.npc[num720].position.X + (float)(Main.npc[num720].width / 2); - float num722 = Main.npc[num720].position.Y + (float)(Main.npc[num720].height / 2); - float num723 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num721) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num722); - if (num723 < 1000f) - { - flag32 = true; - vector59 = Main.npc[num720].Center; - } - } - else - { - projectile.ai[0] = 0f; - flag32 = false; - projectile.netUpdate = true; - } - } - if (flag32) - { - Vector2 v = vector59 - projectile.Center; - float num724 = projectile.velocity.ToRotation(); - float num725 = v.ToRotation(); - double num726 = (double)(num725 - num724); - if (num726 > 3.1415926535897931) - { - num726 -= 6.2831853071795862; - } - if (num726 < -3.1415926535897931) - { - num726 += 6.2831853071795862; - } - projectile.velocity = projectile.velocity.RotatedBy(num726 * 0.10000000149011612, default(Vector2)); - } - float num727 = projectile.velocity.Length(); - projectile.velocity.Normalize(); - projectile.velocity *= num727 + 0.0025f; - } - - 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; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - 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 +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.Magic +{ + public class Vortex : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vortex"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.alpha = 255; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.timeLeft = 300; + projectile.tileCollide = true; + projectile.extraUpdates = 4; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 10f && Main.rand.Next(3) == 0) + { + int num713 = 5; + for (int num714 = 0; num714 < num713; num714++) + { + Vector2 vector58 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width, (float)projectile.height) / 2f; + vector58 = vector58.RotatedBy((double)(num714 - (num713 / 2 - 1)) * 3.1415926535897931 / (double)((float)num713), default(Vector2)) + projectile.Center; + Vector2 value25 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num715 = Dust.NewDust(vector58 + value25, 0, 0, 66, value25.X * 2f, value25.Y * 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.7f); + Main.dust[num715].noGravity = true; + Main.dust[num715].noLight = true; + Main.dust[num715].velocity /= 4f; + Main.dust[num715].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[1] / 3f) % 3; + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); + } + int num716 = -1; + Vector2 vector59 = projectile.Center; + float num717 = 350f * projectile.ai[1]; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) + { + for (int num718 = 0; num718 < 200; num718++) + { + NPC nPC6 = Main.npc[num718]; + if (nPC6.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (float)(num718 + 1))) + { + Vector2 center4 = nPC6.Center; + float num719 = Vector2.Distance(center4, vector59); + if (num719 < num717 && Collision.CanHit(projectile.position, projectile.width, projectile.height, nPC6.position, nPC6.width, nPC6.height)) + { + num717 = num719; + vector59 = center4; + num716 = num718; + } + } + } + if (num716 >= 0) + { + projectile.ai[0] = (float)(num716 + 1); + projectile.netUpdate = true; + } + } + if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) + { + projectile.localAI[0] = 30f; + } + bool flag32 = false; + if (projectile.ai[0] != 0f) + { + int num720 = (int)(projectile.ai[0] - 1f); + if (Main.npc[num720].active && !Main.npc[num720].dontTakeDamage && Main.npc[num720].immune[projectile.owner] == 0) + { + float num721 = Main.npc[num720].position.X + (float)(Main.npc[num720].width / 2); + float num722 = Main.npc[num720].position.Y + (float)(Main.npc[num720].height / 2); + float num723 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num721) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num722); + if (num723 < 1000f) + { + flag32 = true; + vector59 = Main.npc[num720].Center; + } + } + else + { + projectile.ai[0] = 0f; + flag32 = false; + projectile.netUpdate = true; + } + } + if (flag32) + { + Vector2 v = vector59 - projectile.Center; + float num724 = projectile.velocity.ToRotation(); + float num725 = v.ToRotation(); + double num726 = (double)(num725 - num724); + if (num726 > 3.1415926535897931) + { + num726 -= 6.2831853071795862; + } + if (num726 < -3.1415926535897931) + { + num726 += 6.2831853071795862; + } + projectile.velocity = projectile.velocity.RotatedBy(num726 * 0.10000000149011612, default(Vector2)); + } + float num727 = projectile.velocity.Length(); + projectile.velocity.Normalize(); + projectile.velocity *= num727 + 0.0025f; + } + + 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; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + 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; + } + } +} diff --git a/Projectiles/Magic/WaterStream.cs b/Projectiles/Magic/WaterStream.cs index c8f2411a6a..0cc7d83719 100644 --- a/Projectiles/Magic/WaterStream.cs +++ b/Projectiles/Magic/WaterStream.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class WaterStream : ModProjectile - { - public int addSprayTimer = 20; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stream"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.extraUpdates = 2; - projectile.magic = true; - } - - public override void AI() - { - addSprayTimer--; - if (addSprayTimer <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("WaterStream2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - addSprayTimer = 20; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) - { - projectile.Kill(); - } - if (projectile.ai[0] <= 3f) - { - projectile.ai[0] += 1f; - return; - } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; - for (int num151 = 0; num151 < 3; num151++) - { - float num152 = projectile.velocity.X / 3f * (float)num151; - float num153 = projectile.velocity.Y / 3f * (float)num151; - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - Dust expr_6A04_cp_0 = Main.dust[num155]; - expr_6A04_cp_0.position.X = expr_6A04_cp_0.position.X - num152; - Dust expr_6A1F_cp_0 = Main.dust[num155]; - expr_6A1F_cp_0.position.Y = expr_6A1F_cp_0.position.Y - num153; - } - if (Main.rand.Next(8) == 0) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class WaterStream : ModProjectile + { + public int addSprayTimer = 20; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stream"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.extraUpdates = 2; + projectile.magic = true; + } + + public override void AI() + { + addSprayTimer--; + if (addSprayTimer <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("WaterStream2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + addSprayTimer = 20; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + projectile.scale -= 0.002f; + if (projectile.scale <= 0f) + { + projectile.Kill(); + } + if (projectile.ai[0] <= 3f) + { + projectile.ai[0] += 1f; + return; + } + projectile.velocity.Y = projectile.velocity.Y + 0.075f; + for (int num151 = 0; num151 < 3; num151++) + { + float num152 = projectile.velocity.X / 3f * (float)num151; + float num153 = projectile.velocity.Y / 3f * (float)num151; + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 1f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + Dust expr_6A04_cp_0 = Main.dust[num155]; + expr_6A04_cp_0.position.X = expr_6A04_cp_0.position.X - num152; + Dust expr_6A1F_cp_0 = Main.dust[num155]; + expr_6A1F_cp_0.position.Y = expr_6A1F_cp_0.position.Y - num153; + } + if (Main.rand.Next(8) == 0) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 14, 0f, 0f, 100, new Color(0, 255, 255), 0.5f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } + } + } +} diff --git a/Projectiles/Magic/WaterStream2.cs b/Projectiles/Magic/WaterStream2.cs index f082b0c584..3e8b26ebe3 100644 --- a/Projectiles/Magic/WaterStream2.cs +++ b/Projectiles/Magic/WaterStream2.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class WaterStream2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stream"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 80; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - projectile.scale -= 0.002f; - if (projectile.scale <= 0f) - { - projectile.Kill(); - } - if (projectile.ai[0] <= 3f) - { - projectile.ai[0] += 1f; - return; - } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; - for (int num151 = 0; num151 < 3; num151++) - { - float num152 = projectile.velocity.X / 3f * (float)num151; - float num153 = projectile.velocity.Y / 3f * (float)num151; - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 33, 0f, 0f, 100, default(Color), 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - Dust expr_6A04_cp_0 = Main.dust[num155]; - expr_6A04_cp_0.position.X = expr_6A04_cp_0.position.X - num152; - Dust expr_6A1F_cp_0 = Main.dust[num155]; - expr_6A1F_cp_0.position.Y = expr_6A1F_cp_0.position.Y - num153; - } - if (Main.rand.Next(8) == 0) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 33, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - return; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class WaterStream2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stream"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.timeLeft = 80; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + projectile.scale -= 0.002f; + if (projectile.scale <= 0f) + { + projectile.Kill(); + } + if (projectile.ai[0] <= 3f) + { + projectile.ai[0] += 1f; + return; + } + projectile.velocity.Y = projectile.velocity.Y + 0.075f; + for (int num151 = 0; num151 < 3; num151++) + { + float num152 = projectile.velocity.X / 3f * (float)num151; + float num153 = projectile.velocity.Y / 3f * (float)num151; + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X + (float)num154, projectile.position.Y + (float)num154), projectile.width - num154 * 2, projectile.height - num154 * 2, 33, 0f, 0f, 100, default(Color), 1f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + Dust expr_6A04_cp_0 = Main.dust[num155]; + expr_6A04_cp_0.position.X = expr_6A04_cp_0.position.X - num152; + Dust expr_6A1F_cp_0 = Main.dust[num155]; + expr_6A1F_cp_0.position.Y = expr_6A1F_cp_0.position.Y - num153; + } + if (Main.rand.Next(8) == 0) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X + (float)num156, projectile.position.Y + (float)num156), projectile.width - num156 * 2, projectile.height - num156 * 2, 33, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + return; + } + } + } +} diff --git a/Projectiles/Magic/WhiteFlame.cs b/Projectiles/Magic/WhiteFlame.cs index a3be4dbd33..732b60f3be 100644 --- a/Projectiles/Magic/WhiteFlame.cs +++ b/Projectiles/Magic/WhiteFlame.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class WhiteFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default(Color), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); - int num251 = 4; - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("WhiteFlame2"), (int)((double)projectile.damage), 0f, projectile.owner, 0f, 0f); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 360); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class WhiteFlame : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default(Color), 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); + int num251 = 4; + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("WhiteFlame2"), (int)((double)projectile.damage), 0f, projectile.owner, 0f, 0f); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 360); + } + } +} diff --git a/Projectiles/Magic/WhiteFlame2.cs b/Projectiles/Magic/WhiteFlame2.cs index 0e5e7a6bdb..45784743e2 100644 --- a/Projectiles/Magic/WhiteFlame2.cs +++ b/Projectiles/Magic/WhiteFlame2.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class WhiteFlame2 : ModProjectile - { - float homeTimer = 100; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.timeLeft = 120; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - homeTimer += 5f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = homeTimer; - 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 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 360); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class WhiteFlame2 : ModProjectile + { + float homeTimer = 100; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 3; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.timeLeft = 120; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + homeTimer += 5f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = homeTimer; + 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 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 360); + } + } +} diff --git a/Projectiles/Magic/WintersFury.cs b/Projectiles/Magic/WintersFury.cs index b1b73e0d82..ba5e202e1b 100644 --- a/Projectiles/Magic/WintersFury.cs +++ b/Projectiles/Magic/WintersFury.cs @@ -1,50 +1,50 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class WintersFury : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fury"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - 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), 0.75f); - 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); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class WintersFury : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fury"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + 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), 0.75f); + 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); + } + } + } +} diff --git a/Projectiles/Magic/WulfrumBolt.cs b/Projectiles/Magic/WulfrumBolt.cs index 30d125fa42..0586098586 100644 --- a/Projectiles/Magic/WulfrumBolt.cs +++ b/Projectiles/Magic/WulfrumBolt.cs @@ -1,56 +1,56 @@ -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 WulfrumBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 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, 61, 0f, 0f, 100, default(Color), 3f); - 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, 61, 0f, 0f, 100, default(Color), 2.25f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - 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 +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 WulfrumBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 2; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 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, 61, 0f, 0f, 100, default(Color), 3f); + 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, 61, 0f, 0f, 100, default(Color), 2.25f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + 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; + } + } +} diff --git a/Projectiles/Magic/YharimsCrystal.cs b/Projectiles/Magic/YharimsCrystal.cs index 67b7728614..4e536cb537 100644 --- a/Projectiles/Magic/YharimsCrystal.cs +++ b/Projectiles/Magic/YharimsCrystal.cs @@ -1,202 +1,202 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Enums; - -namespace CalamityMod.Projectiles.Magic -{ - public class YharimsCrystal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 22; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - float num26 = 30f; - if (projectile.ai[0] > 90f) - { - num26 = 15f; - } - if (projectile.ai[0] > 120f) - { - num26 = 5f; - } - projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); - projectile.ai[0] += 1f; - projectile.ai[1] += 1f; - bool flag9 = false; - if (projectile.ai[0] % num26 == 0f) - { - flag9 = true; - } - int num27 = 10; - bool flag10 = false; - if (projectile.ai[0] % num26 == 0f) - { - flag10 = true; - } - if (projectile.ai[1] >= 1f) - { - projectile.ai[1] = 0f; - flag10 = true; - if (Main.myPlayer == projectile.owner) - { - float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value12 = vector; - Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; - if (player.gravDir == -1f) - { - value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; - } - Vector2 vector11 = Vector2.Normalize(value13); - if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) - { - vector11 = -Vector2.UnitY; - } - vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); - vector11 *= scaleFactor5; - if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector11; - } - } - projectile.frameCounter++; - int num28 = (projectile.ai[0] < 120f) ? 3 : 1; - if (projectile.frameCounter >= num28) - { - projectile.frameCounter = 0; - if (++projectile.frame >= 6) - { - projectile.frame = 0; - } - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num27; - projectile.soundDelay *= 2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item15, projectile.position); - } - } - if (flag10 && Main.myPlayer == projectile.owner) - { - bool flag11 = !flag9 || player.CheckMana(player.inventory[player.selectedItem].mana, true, false); - bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; - if (flag12) - { - if (projectile.ai[0] == 1f) - { - Vector2 center3 = projectile.Center; - Vector2 vector12 = Vector2.Normalize(projectile.velocity); - if (float.IsNaN(vector12.X) || float.IsNaN(vector12.Y)) - { - vector12 = -Vector2.UnitY; - } - int num29 = projectile.damage; - for (int l = 0; l < 7; l++) - { - Projectile.NewProjectile(center3.X, center3.Y, vector12.X, vector12.Y, mod.ProjectileType("YharimsCrystalBeam"), num29, projectile.knockBack, projectile.owner, (float)l, (float)projectile.whoAmI); - } - projectile.netUpdate = true; - } - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Texture2D texture2D14 = Main.projectileTexture[projectile.type]; - int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y7 = num215 * projectile.frame; - Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); - float scale5 = 1f; - if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) - { - float num216 = Main.player[projectile.owner].stealth; - if ((double)num216 < 0.03) - { - num216 = 0.03f; - } - float arg_97B3_0 = (1f + num216 * 10f) / 11f; - color25 *= num216; - scale5 = num216; - } - if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) - { - float num217 = Main.player[projectile.owner].stealth; - if ((double)num217 < 0.03) - { - num217 = 0.03f; - } - float arg_9854_0 = (1f + num217 * 10f) / 11f; - color25 = color25.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); - scale5 = num217; - } - Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); - float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 30f))) * 2f + 2f; - if (projectile.ai[0] > 120f) - { - scaleFactor2 = 4f; - } - for (float num218 = 0f; num218 < 4f; num218 += 1f) - { - Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default(Vector2)) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)) * 0.03f, projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); - } - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 200); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; + +namespace CalamityMod.Projectiles.Magic +{ + public class YharimsCrystal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 22; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.magic = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float num26 = 30f; + if (projectile.ai[0] > 90f) + { + num26 = 15f; + } + if (projectile.ai[0] > 120f) + { + num26 = 5f; + } + projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); + projectile.ai[0] += 1f; + projectile.ai[1] += 1f; + bool flag9 = false; + if (projectile.ai[0] % num26 == 0f) + { + flag9 = true; + } + int num27 = 10; + bool flag10 = false; + if (projectile.ai[0] % num26 == 0f) + { + flag10 = true; + } + if (projectile.ai[1] >= 1f) + { + projectile.ai[1] = 0f; + flag10 = true; + if (Main.myPlayer == projectile.owner) + { + float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value12 = vector; + Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; + if (player.gravDir == -1f) + { + value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; + } + Vector2 vector11 = Vector2.Normalize(value13); + if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) + { + vector11 = -Vector2.UnitY; + } + vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); + vector11 *= scaleFactor5; + if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector11; + } + } + projectile.frameCounter++; + int num28 = (projectile.ai[0] < 120f) ? 3 : 1; + if (projectile.frameCounter >= num28) + { + projectile.frameCounter = 0; + if (++projectile.frame >= 6) + { + projectile.frame = 0; + } + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num27; + projectile.soundDelay *= 2; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item15, projectile.position); + } + } + if (flag10 && Main.myPlayer == projectile.owner) + { + bool flag11 = !flag9 || player.CheckMana(player.inventory[player.selectedItem].mana, true, false); + bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; + if (flag12) + { + if (projectile.ai[0] == 1f) + { + Vector2 center3 = projectile.Center; + Vector2 vector12 = Vector2.Normalize(projectile.velocity); + if (float.IsNaN(vector12.X) || float.IsNaN(vector12.Y)) + { + vector12 = -Vector2.UnitY; + } + int num29 = projectile.damage; + for (int l = 0; l < 7; l++) + { + Projectile.NewProjectile(center3.X, center3.Y, vector12.X, vector12.Y, mod.ProjectileType("YharimsCrystalBeam"), num29, projectile.knockBack, projectile.owner, (float)l, (float)projectile.whoAmI); + } + projectile.netUpdate = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Texture2D texture2D14 = Main.projectileTexture[projectile.type]; + int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y7 = num215 * projectile.frame; + Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); + float scale5 = 1f; + if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) + { + float num216 = Main.player[projectile.owner].stealth; + if ((double)num216 < 0.03) + { + num216 = 0.03f; + } + float arg_97B3_0 = (1f + num216 * 10f) / 11f; + color25 *= num216; + scale5 = num216; + } + if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) + { + float num217 = Main.player[projectile.owner].stealth; + if ((double)num217 < 0.03) + { + num217 = 0.03f; + } + float arg_9854_0 = (1f + num217 * 10f) / 11f; + color25 = color25.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); + scale5 = num217; + } + Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); + float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 30f))) * 2f + 2f; + if (projectile.ai[0] > 120f) + { + scaleFactor2 = 4f; + } + for (float num218 = 0f; num218 < 4f; num218 += 1f) + { + Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default(Vector2)) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)) * 0.03f, projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); + } + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 200); + } + } +} diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index 299890faae..41c2ecdc4f 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -1,297 +1,297 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Enums; -using Terraria.GameContent.Shaders; -using Terraria.Graphics.Effects; - -namespace CalamityMod.Projectiles.Magic -{ - public class YharimsCrystalBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[1] = reader.ReadSingle(); - } - - public float GetHue(float indexing) - { - string playerName; - if (Main.player[projectile.owner].active && (playerName = Main.player[projectile.owner].name) != null) - { - Dictionary LaserHue = new Dictionary(17) - { - {"Fabsol", 0}, - {"Ziggums", 1}, - {"Poly", 2}, - {"Zach", 3}, - {"Grox the Great", 4}, - {"Jenosis", 5}, - {"DM DOKURO", 6}, - {"Uncle Danny", 7}, - {"Phoenix", 8}, - {"MineCat", 9}, - {"Khaelis", 10}, - {"Purple Necromancer", 11}, - {"gamagamer64", 12}, - {"Svante", 13}, - {"Puff", 14}, - {"Leviathan", 15}, - {"Testdude", 16} - }; - int someNumber; - if (LaserHue.TryGetValue(playerName, out someNumber)) - { - switch (someNumber) - { - case 0: - case 1: - return 2f; - case 2: - return 0.83f; - case 3: - return 1.5f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.1f; - case 4: - return 1.27f; - case 5: - return 0.65f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.1f; - case 6: - return 0f; - case 7: - case 8: - return 1.7f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.07f; - case 9: - return 0.15f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.07f; - case 10: - return 1.15f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.18f; - case 11: - return 1.7f + (float)Math.Cos(Main.time / 120.0 * 6.2831854820251465) * 0.05f; - case 12: - return 0.83f + (float)Math.Cos(Main.time / 120.0 * 6.2831854820251465) * 0.03f; - case 13: - return 1.4f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.06f; - case 14: - return 0.31f + (float)Math.Cos(Main.time / 120.0 * 6.2831854820251465) * 0.13f; - case 15: - return 1.9f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.1f; - case 16: - return Main.rand.NextFloat(); - } - } - } - return (float)((int)indexing) / 6f; - } - - public override void AI() - { - Vector2? vector71 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - if (projectile.type != mod.ProjectileType("YharimsCrystalBeam") || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("YharimsCrystal")) - { - projectile.Kill(); - return; - } - float num810 = (float)((int)projectile.ai[0]) - 2.5f; - Vector2 value36 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); - Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; - float num811 = num810 * 0.5235988f; - Vector2 value37 = Vector2.Zero; - float num812; - float y; - float num813; - float scaleFactor6; - if (projectile2.ai[0] < 180f) - { - num812 = 1f - projectile2.ai[0] / 180f; - y = 20f - projectile2.ai[0] / 180f * 14f; - if (projectile2.ai[0] < 120f) - { - num813 = 20f - 4f * (projectile2.ai[0] / 120f); - projectile.Opacity = projectile2.ai[0] / 120f * 0.4f; - } - else - { - num813 = 16f - 10f * ((projectile2.ai[0] - 120f) / 60f); - projectile.Opacity = 0.4f + (projectile2.ai[0] - 120f) / 60f * 0.6f; - } - scaleFactor6 = -22f + projectile2.ai[0] / 180f * 20f; - } - else - { - num812 = 0f; - num813 = 1.75f; - y = 6f; - projectile.Opacity = 1f; - scaleFactor6 = -2f; - } - float num814 = (projectile2.ai[0] + num810 * num813) / (num813 * 6f) * 6.28318548f; - num811 = Vector2.UnitY.RotatedBy((double)num814, default(Vector2)).Y * 0.5235988f * num812; - value37 = (Vector2.UnitY.RotatedBy((double)num814, default(Vector2)) * new Vector2(4f, y)).RotatedBy((double)projectile2.velocity.ToRotation(), default(Vector2)); - projectile.position = projectile2.Center + value36 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); - projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; - projectile.position += value37; - projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy((double)num811, default(Vector2)); - projectile.scale = 1.8f * (1f - num812); - projectile.damage = projectile2.damage; - if (projectile2.ai[0] >= 180f) - { - projectile.damage = (int)((double)projectile.damage * 2.7); - vector71 = new Vector2?(projectile2.Center); - } - if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) - { - vector71 = new Vector2?(Main.player[projectile.owner].Center); - } - projectile.friendly = (projectile2.ai[0] > 30f); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - float num818 = projectile.velocity.ToRotation(); - projectile.rotation = num818 - 1.57079637f; - projectile.velocity = num818.ToRotationVector2(); - float num819 = 2f; - float num820 = 0f; - Vector2 samplingPoint = projectile.Center; - if (vector71.HasValue) - { - samplingPoint = vector71.Value; - } - float[] array3 = new float[(int)num819]; - Collision.LaserScan(samplingPoint, projectile.velocity, num820 * projectile.scale, 2400f, array3); - float num821 = 0f; - for (int num822 = 0; num822 < array3.Length; num822++) - { - num821 += array3[num822]; - } - num821 /= num819; - float amount = 0.75f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); - if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) - { - float prismHue = GetHue(projectile.ai[0]); - Color color = Main.hslToRgb(2.55f, prismHue, 0.53f); - color.A = 0; - Vector2 vector80 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); - float x = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X; - for (int num843 = 0; num843 < 2; num843++) - { - float num844 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; - float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; - Vector2 vector81 = new Vector2((float)Math.Cos((double)num844) * num845, (float)Math.Sin((double)num844) * num845); - int num846 = Dust.NewDust(vector80, 0, 0, 244, vector81.X, vector81.Y, 0, new Color(255, Main.DiscoG, 53), 3.3f); //267 - Main.dust[num846].color = color; - Main.dust[num846].scale = 1.2f; - if (projectile.scale > 1f) - { - Main.dust[num846].velocity *= projectile.scale; - Main.dust[num846].scale *= projectile.scale; - } - Main.dust[num846].noGravity = true; - if (projectile.scale != 1.4f) - { - Dust dust9 = Dust.CloneDust(num846); - dust9.color = Color.Orange; - dust9.scale /= 2f; - } - float hue = (x + Main.rand.NextFloat() * 0.4f) % 1f; - Main.dust[num846].color = Color.Lerp(color, Main.hslToRgb(2.55f, hue, 0.53f), projectile.scale / 1.4f); - } - if (Main.rand.Next(5) == 0) - { - Vector2 value42 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; - int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 5f); - Main.dust[num847].velocity *= 0.5f; - Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); - } - DelegateMethods.v3_1 = color.ToVector3() * 0.3f; - float value43 = 0.1f * (float)Math.Sin((double)(Main.GlobalTime * 20f)); - Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], (float)projectile.width * projectile.scale); - float num848 = projectile.velocity.ToRotation(); - if (Main.netMode != 2) - { - ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy((double)num848, default(Vector2)), new Color(0.5f, 0.1f * (float)Math.Sign(value43) + 0.5f, 0f, 1f) * Math.Abs(value43), size, RippleShape.Square, num848); - } - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - return; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.velocity == Vector2.Zero) - { - return false; - } - Texture2D tex = Main.projectileTexture[projectile.type]; - float num228 = projectile.localAI[1]; - float prismHue = GetHue(projectile.ai[0]); - Microsoft.Xna.Framework.Color value25 = Main.hslToRgb(2.55f, prismHue, 0.53f); - value25.A = 0; - Vector2 value26 = projectile.Center.Floor(); - value26 += projectile.velocity * projectile.scale * 10.5f; - num228 -= projectile.scale * 14.5f * projectile.scale; - Vector2 vector29 = new Vector2(projectile.scale); - DelegateMethods.f_1 = 1f; - DelegateMethods.c_1 = value25 * 0.75f * projectile.Opacity; - Vector2 projPos = projectile.oldPos[0]; - projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); - DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, Main.DiscoG, 53, 127) * 0.75f * projectile.Opacity; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); - return false; - } - - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) - { - return true; - } - return false; - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; +using Terraria.GameContent.Shaders; +using Terraria.Graphics.Effects; + +namespace CalamityMod.Projectiles.Magic +{ + public class YharimsCrystalBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[1] = reader.ReadSingle(); + } + + public float GetHue(float indexing) + { + string playerName; + if (Main.player[projectile.owner].active && (playerName = Main.player[projectile.owner].name) != null) + { + Dictionary LaserHue = new Dictionary(17) + { + {"Fabsol", 0}, + {"Ziggums", 1}, + {"Poly", 2}, + {"Zach", 3}, + {"Grox the Great", 4}, + {"Jenosis", 5}, + {"DM DOKURO", 6}, + {"Uncle Danny", 7}, + {"Phoenix", 8}, + {"MineCat", 9}, + {"Khaelis", 10}, + {"Purple Necromancer", 11}, + {"gamagamer64", 12}, + {"Svante", 13}, + {"Puff", 14}, + {"Leviathan", 15}, + {"Testdude", 16} + }; + int someNumber; + if (LaserHue.TryGetValue(playerName, out someNumber)) + { + switch (someNumber) + { + case 0: + case 1: + return 2f; + case 2: + return 0.83f; + case 3: + return 1.5f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.1f; + case 4: + return 1.27f; + case 5: + return 0.65f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.1f; + case 6: + return 0f; + case 7: + case 8: + return 1.7f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.07f; + case 9: + return 0.15f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.07f; + case 10: + return 1.15f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.18f; + case 11: + return 1.7f + (float)Math.Cos(Main.time / 120.0 * 6.2831854820251465) * 0.05f; + case 12: + return 0.83f + (float)Math.Cos(Main.time / 120.0 * 6.2831854820251465) * 0.03f; + case 13: + return 1.4f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.06f; + case 14: + return 0.31f + (float)Math.Cos(Main.time / 120.0 * 6.2831854820251465) * 0.13f; + case 15: + return 1.9f + (float)Math.Cos(Main.time / 180.0 * 6.2831854820251465) * 0.1f; + case 16: + return Main.rand.NextFloat(); + } + } + } + return (float)((int)indexing) / 6f; + } + + public override void AI() + { + Vector2? vector71 = null; + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + if (projectile.type != mod.ProjectileType("YharimsCrystalBeam") || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("YharimsCrystal")) + { + projectile.Kill(); + return; + } + float num810 = (float)((int)projectile.ai[0]) - 2.5f; + Vector2 value36 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); + Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; + float num811 = num810 * 0.5235988f; + Vector2 value37 = Vector2.Zero; + float num812; + float y; + float num813; + float scaleFactor6; + if (projectile2.ai[0] < 180f) + { + num812 = 1f - projectile2.ai[0] / 180f; + y = 20f - projectile2.ai[0] / 180f * 14f; + if (projectile2.ai[0] < 120f) + { + num813 = 20f - 4f * (projectile2.ai[0] / 120f); + projectile.Opacity = projectile2.ai[0] / 120f * 0.4f; + } + else + { + num813 = 16f - 10f * ((projectile2.ai[0] - 120f) / 60f); + projectile.Opacity = 0.4f + (projectile2.ai[0] - 120f) / 60f * 0.6f; + } + scaleFactor6 = -22f + projectile2.ai[0] / 180f * 20f; + } + else + { + num812 = 0f; + num813 = 1.75f; + y = 6f; + projectile.Opacity = 1f; + scaleFactor6 = -2f; + } + float num814 = (projectile2.ai[0] + num810 * num813) / (num813 * 6f) * 6.28318548f; + num811 = Vector2.UnitY.RotatedBy((double)num814, default(Vector2)).Y * 0.5235988f * num812; + value37 = (Vector2.UnitY.RotatedBy((double)num814, default(Vector2)) * new Vector2(4f, y)).RotatedBy((double)projectile2.velocity.ToRotation(), default(Vector2)); + projectile.position = projectile2.Center + value36 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); + projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; + projectile.position += value37; + projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy((double)num811, default(Vector2)); + projectile.scale = 1.8f * (1f - num812); + projectile.damage = projectile2.damage; + if (projectile2.ai[0] >= 180f) + { + projectile.damage = (int)((double)projectile.damage * 2.7); + vector71 = new Vector2?(projectile2.Center); + } + if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) + { + vector71 = new Vector2?(Main.player[projectile.owner].Center); + } + projectile.friendly = (projectile2.ai[0] > 30f); + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + float num818 = projectile.velocity.ToRotation(); + projectile.rotation = num818 - 1.57079637f; + projectile.velocity = num818.ToRotationVector2(); + float num819 = 2f; + float num820 = 0f; + Vector2 samplingPoint = projectile.Center; + if (vector71.HasValue) + { + samplingPoint = vector71.Value; + } + float[] array3 = new float[(int)num819]; + Collision.LaserScan(samplingPoint, projectile.velocity, num820 * projectile.scale, 2400f, array3); + float num821 = 0f; + for (int num822 = 0; num822 < array3.Length; num822++) + { + num821 += array3[num822]; + } + num821 /= num819; + float amount = 0.75f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); + if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) + { + float prismHue = GetHue(projectile.ai[0]); + Color color = Main.hslToRgb(2.55f, prismHue, 0.53f); + color.A = 0; + Vector2 vector80 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); + float x = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X; + for (int num843 = 0; num843 < 2; num843++) + { + float num844 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; + float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; + Vector2 vector81 = new Vector2((float)Math.Cos((double)num844) * num845, (float)Math.Sin((double)num844) * num845); + int num846 = Dust.NewDust(vector80, 0, 0, 244, vector81.X, vector81.Y, 0, new Color(255, Main.DiscoG, 53), 3.3f); //267 + Main.dust[num846].color = color; + Main.dust[num846].scale = 1.2f; + if (projectile.scale > 1f) + { + Main.dust[num846].velocity *= projectile.scale; + Main.dust[num846].scale *= projectile.scale; + } + Main.dust[num846].noGravity = true; + if (projectile.scale != 1.4f) + { + Dust dust9 = Dust.CloneDust(num846); + dust9.color = Color.Orange; + dust9.scale /= 2f; + } + float hue = (x + Main.rand.NextFloat() * 0.4f) % 1f; + Main.dust[num846].color = Color.Lerp(color, Main.hslToRgb(2.55f, hue, 0.53f), projectile.scale / 1.4f); + } + if (Main.rand.Next(5) == 0) + { + Vector2 value42 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 244, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 5f); + Main.dust[num847].velocity *= 0.5f; + Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); + } + DelegateMethods.v3_1 = color.ToVector3() * 0.3f; + float value43 = 0.1f * (float)Math.Sin((double)(Main.GlobalTime * 20f)); + Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], (float)projectile.width * projectile.scale); + float num848 = projectile.velocity.ToRotation(); + if (Main.netMode != 2) + { + ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy((double)num848, default(Vector2)), new Color(0.5f, 0.1f * (float)Math.Sign(value43) + 0.5f, 0f, 1f) * Math.Abs(value43), size, RippleShape.Square, num848); + } + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D tex = Main.projectileTexture[projectile.type]; + float num228 = projectile.localAI[1]; + float prismHue = GetHue(projectile.ai[0]); + Microsoft.Xna.Framework.Color value25 = Main.hslToRgb(2.55f, prismHue, 0.53f); + value25.A = 0; + Vector2 value26 = projectile.Center.Floor(); + value26 += projectile.velocity * projectile.scale * 10.5f; + num228 -= projectile.scale * 14.5f * projectile.scale; + Vector2 vector29 = new Vector2(projectile.scale); + DelegateMethods.f_1 = 1f; + DelegateMethods.c_1 = value25 * 0.75f * projectile.Opacity; + Vector2 projPos = projectile.oldPos[0]; + projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, Main.DiscoG, 53, 127) * 0.75f * projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num6 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + { + return true; + } + return false; + } + } +} diff --git a/Projectiles/Melee/AccretionDisk2Melee.cs b/Projectiles/Melee/AccretionDisk2Melee.cs index f27ce80346..c92b95a963 100644 --- a/Projectiles/Melee/AccretionDisk2Melee.cs +++ b/Projectiles/Melee/AccretionDisk2Melee.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class AccretionDisk2Melee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Accretion Disk"); - } - - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.alpha = 120; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 60; - aiType = 52; - } - - public override void AI() - { - if (Main.rand.Next(2) == 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; - Main.dust[num250].velocity *= 0f; - } - Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class AccretionDisk2Melee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Accretion Disk"); + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.alpha = 120; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 60; + aiType = 52; + } + + public override void AI() + { + if (Main.rand.Next(2) == 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; + Main.dust[num250].velocity *= 0f; + } + Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Melee/AccretionDiskMelee.cs b/Projectiles/Melee/AccretionDiskMelee.cs index 93922d4be4..9196a6310e 100644 --- a/Projectiles/Melee/AccretionDiskMelee.cs +++ b/Projectiles/Melee/AccretionDiskMelee.cs @@ -1,114 +1,114 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class AccretionDiskMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Accretion Disk"); - } - - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 400; - aiType = 52; - } - - public override void AI() - { - if (Main.rand.Next(2) == 0) - { - for (int num468 = 0; num468 < 1; num468++) - { - 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), 1.3f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - } - } - Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.Next(3) == 0) - { - if (projectile.owner == Main.myPlayer) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.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(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AccretionDisk2Melee"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AccretionDisk2Melee"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class AccretionDiskMelee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Accretion Disk"); + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 400; + aiType = 52; + } + + public override void AI() + { + if (Main.rand.Next(2) == 0) + { + for (int num468 = 0; num468 < 1; num468++) + { + 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), 1.3f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + } + } + Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.Next(3) == 0) + { + if (projectile.owner == Main.myPlayer) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.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(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AccretionDisk2Melee"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AccretionDisk2Melee"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Melee/AegisBeam.cs b/Projectiles/Melee/AegisBeam.cs index 5f57855132..52887d6e22 100644 --- a/Projectiles/Melee/AegisBeam.cs +++ b/Projectiles/Melee/AegisBeam.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class AegisBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aegis Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - int num251 = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("AegisFlame"), (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class AegisBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aegis Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + int num251 = Main.rand.Next(2, 4); + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("AegisFlame"), (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Melee/AegisBlast.cs b/Projectiles/Melee/AegisBlast.cs index 2d8e1b29ac..e563891811 100644 --- a/Projectiles/Melee/AegisBlast.cs +++ b/Projectiles/Melee/AegisBlast.cs @@ -1,97 +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 AegisBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aegis Blast"); - } - - public override void SetDefaults() - { - projectile.width = 150; - projectile.height = 150; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 90; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - 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(-15, 16); - float num464 = (float)Main.rand.Next(-15, 16); - float num465 = (float)Main.rand.Next(4, 13); - 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, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class AegisBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aegis Blast"); + } + + public override void SetDefaults() + { + projectile.width = 150; + projectile.height = 150; + projectile.friendly = true; + projectile.ignoreWater = false; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 90; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + 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(-15, 16); + float num464 = (float)Main.rand.Next(-15, 16); + float num465 = (float)Main.rand.Next(4, 13); + 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, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); + 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++; + } + } + } +} diff --git a/Projectiles/Melee/AegisBlast2.cs b/Projectiles/Melee/AegisBlast2.cs index 08162f9ba0..b4fbe3247c 100644 --- a/Projectiles/Melee/AegisBlast2.cs +++ b/Projectiles/Melee/AegisBlast2.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class AegisBlast2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aegis Blast"); - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0f) / 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(-5, 6); - float num464 = (float)Main.rand.Next(-5, 6); - float num465 = (float)Main.rand.Next(2, 5); - 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, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class AegisBlast2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aegis Blast"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.ignoreWater = false; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0f) / 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(-5, 6); + float num464 = (float)Main.rand.Next(-5, 6); + float num465 = (float)Main.rand.Next(2, 5); + 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, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.5f); + 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++; + } + } + } +} diff --git a/Projectiles/Melee/AegisFlame.cs b/Projectiles/Melee/AegisFlame.cs index 583023e0cf..cc28420b00 100644 --- a/Projectiles/Melee/AegisFlame.cs +++ b/Projectiles/Melee/AegisFlame.cs @@ -1,110 +1,110 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class AegisFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aegis Flame"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - 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; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("AegisBlast2"), (int)((double)damage * 0.75), knockback, Main.myPlayer); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class AegisFlame : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aegis Flame"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + 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; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("AegisBlast2"), (int)((double)damage * 0.75), knockback, Main.myPlayer); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} diff --git a/Projectiles/Melee/Aftershock.cs b/Projectiles/Melee/Aftershock.cs index 8b7e57b995..1ba37a2a62 100644 --- a/Projectiles/Melee/Aftershock.cs +++ b/Projectiles/Melee/Aftershock.cs @@ -1,29 +1,29 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Aftershock : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rock"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 34; - projectile.aiStyle = 14; - projectile.friendly = true; - projectile.penetrate = 6; - projectile.melee = true; - projectile.ignoreWater = true; - aiType = 261; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Aftershock : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rock"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 34; + projectile.aiStyle = 14; + projectile.friendly = true; + projectile.penetrate = 6; + projectile.melee = true; + projectile.ignoreWater = true; + aiType = 261; + } + } +} diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 0055c9f0ba..31692afc7b 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BalefulHarvesterProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pumpkin"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.alpha = 50; - projectile.tileCollide = false; - aiType = 270; - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - for (int k = 0; k < 2; k++) - { - 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.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int num621 = 0; num621 < 5; 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BalefulHarvesterProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pumpkin"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.alpha = 50; + projectile.tileCollide = false; + aiType = 270; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + for (int k = 0; k < 2; k++) + { + 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.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int num621 = 0; num621 < 5; 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + } + } +} diff --git a/Projectiles/Melee/BallOFugu.cs b/Projectiles/Melee/BallOFugu.cs index 5f4c95755b..74b01f8386 100644 --- a/Projectiles/Melee/BallOFugu.cs +++ b/Projectiles/Melee/BallOFugu.cs @@ -1,155 +1,155 @@ -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 BallOFugu : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball O Fugu"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; - } - - public override void AI() - { - Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; - projectile.rotation = vector62.ToRotation() - 1.57f; - if (Main.player[projectile.owner].dead) - { - projectile.Kill(); - return; - } - Main.player[projectile.owner].itemAnimation = 10; - Main.player[projectile.owner].itemTime = 10; - float arg_1DC8F_0 = vector62.X; - if (vector62.X < 0f) - { - Main.player[projectile.owner].ChangeDir(1); - projectile.direction = 1; - } - else - { - Main.player[projectile.owner].ChangeDir(-1); - projectile.direction = -1; - } - Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); - if (projectile.ai[0] == 0f && vector62.Length() > 400f) - { - projectile.ai[0] = 1f; - } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) - { - float num693 = vector62.Length(); - if (num693 > 1500f) - { - projectile.Kill(); - return; - } - if (num693 > 600f) - { - projectile.ai[0] = 2f; - } - projectile.tileCollide = false; - float num694 = 20f; - if (projectile.ai[0] == 2f) - { - num694 = 40f; - } - projectile.velocity = Vector2.Normalize(vector62) * num694; - if (vector62.Length() < num694) - { - projectile.Kill(); - return; - } - } - float[] var_2_1DE21_cp_0 = projectile.ai; - int var_2_1DE21_cp_1 = 1; - float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; - var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; - if (projectile.ai[1] > 5f) - { - projectile.alpha = 0; - } - if ((int)projectile.ai[1] % 4 == 0 && projectile.owner == Main.myPlayer) - { - Vector2 vector63 = vector62 * -1f; - vector63.Normalize(); - vector63 *= (float)Main.rand.Next(45, 65) * 0.1f; - vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default(Vector2)); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector63.X, vector63.Y, mod.ProjectileType("UrchinSpikeFugu"), (int)((double)projectile.damage * 0.6), projectile.knockBack * 0.2f, projectile.owner, -10f, 0f); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/BallOFuguChain"); - Vector2 vector17 = projectile.Center; - Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) - { - flag13 = false; - } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) - { - flag13 = false; - } - while (flag13) - { - if (vector18.Length() < num91 + 1f) - { - flag13 = false; - } - else - { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); - } - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - } -} \ No newline at end of file +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 BallOFugu : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball O Fugu"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.melee = true; + projectile.alpha = 255; + } + + public override void AI() + { + Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; + projectile.rotation = vector62.ToRotation() - 1.57f; + if (Main.player[projectile.owner].dead) + { + projectile.Kill(); + return; + } + Main.player[projectile.owner].itemAnimation = 10; + Main.player[projectile.owner].itemTime = 10; + float arg_1DC8F_0 = vector62.X; + if (vector62.X < 0f) + { + Main.player[projectile.owner].ChangeDir(1); + projectile.direction = 1; + } + else + { + Main.player[projectile.owner].ChangeDir(-1); + projectile.direction = -1; + } + Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); + projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); + if (projectile.ai[0] == 0f && vector62.Length() > 400f) + { + projectile.ai[0] = 1f; + } + if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + { + float num693 = vector62.Length(); + if (num693 > 1500f) + { + projectile.Kill(); + return; + } + if (num693 > 600f) + { + projectile.ai[0] = 2f; + } + projectile.tileCollide = false; + float num694 = 20f; + if (projectile.ai[0] == 2f) + { + num694 = 40f; + } + projectile.velocity = Vector2.Normalize(vector62) * num694; + if (vector62.Length() < num694) + { + projectile.Kill(); + return; + } + } + float[] var_2_1DE21_cp_0 = projectile.ai; + int var_2_1DE21_cp_1 = 1; + float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; + var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; + if (projectile.ai[1] > 5f) + { + projectile.alpha = 0; + } + if ((int)projectile.ai[1] % 4 == 0 && projectile.owner == Main.myPlayer) + { + Vector2 vector63 = vector62 * -1f; + vector63.Normalize(); + vector63 *= (float)Main.rand.Next(45, 65) * 0.1f; + vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default(Vector2)); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector63.X, vector63.Y, mod.ProjectileType("UrchinSpikeFugu"), (int)((double)projectile.damage * 0.6), projectile.knockBack * 0.2f, projectile.owner, -10f, 0f); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + projectile.ai[0] = 1f; + projectile.netUpdate = true; + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; + Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/BallOFuguChain"); + Vector2 vector17 = projectile.Center; + Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; + Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); + float num91 = (float)texture2D2.Height; + Vector2 vector18 = mountedCenter - vector17; + float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; + bool flag13 = true; + if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + { + flag13 = false; + } + if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + { + flag13 = false; + } + while (flag13) + { + if (vector18.Length() < num91 + 1f) + { + flag13 = false; + } + else + { + Vector2 value2 = vector18; + value2.Normalize(); + vector17 += value2 * num91; + vector18 = mountedCenter - vector17; + Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); + } + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + } +} diff --git a/Projectiles/Melee/BansheeHookBoom.cs b/Projectiles/Melee/BansheeHookBoom.cs index 1e61b1cbab..d0bf3c3b5b 100644 --- a/Projectiles/Melee/BansheeHookBoom.cs +++ b/Projectiles/Melee/BansheeHookBoom.cs @@ -1,84 +1,84 @@ -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 BansheeHookBoom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boom"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.timeLeft = 6; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; - } - - public override void AI() - { - projectile.ai[1] += 0.01f; - projectile.scale = projectile.ai[1]; - projectile.ai[0] += 1f; - projectile.alpha -= 63; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 1.5f, 0f, 0.15f); - if (projectile.ai[0] == 1f) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = (int)(52f * projectile.scale)); - projectile.Center = projectile.position; - projectile.Damage(); - for (int num1000 = 0; num1000 < 2; num1000++) - { - int num1001 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num1001].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - } - for (int num1002 = 0; num1002 < 5; num1002++) - { - int num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default(Color), 2.7f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].velocity *= 3f; - num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num1003].velocity *= 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].fadeIn = 2.5f; - } - for (int num1004 = 0; num1004 < 2; num1004++) - { - int num1005 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 2.7f); - Main.dust[num1005].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; - Main.dust[num1005].noGravity = true; - Main.dust[num1005].velocity *= 3f; - } - for (int num1006 = 0; num1006 < 5; num1006++) - { - int num1007 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num1007].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; - Main.dust[num1007].noGravity = true; - Main.dust[num1007].velocity *= 3f; - } - } - } - } -} \ No newline at end of file +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 BansheeHookBoom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boom"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.melee = true; + projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.timeLeft = 6; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 16; + } + + public override void AI() + { + projectile.ai[1] += 0.01f; + projectile.scale = projectile.ai[1]; + projectile.ai[0] += 1f; + projectile.alpha -= 63; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 1.5f, 0f, 0.15f); + if (projectile.ai[0] == 1f) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = (int)(52f * projectile.scale)); + projectile.Center = projectile.position; + projectile.Damage(); + for (int num1000 = 0; num1000 < 2; num1000++) + { + int num1001 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num1001].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + } + for (int num1002 = 0; num1002 < 5; num1002++) + { + int num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default(Color), 2.7f); + Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num1003].noGravity = true; + Main.dust[num1003].velocity *= 3f; + num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num1003].velocity *= 2f; + Main.dust[num1003].noGravity = true; + Main.dust[num1003].fadeIn = 2.5f; + } + for (int num1004 = 0; num1004 < 2; num1004++) + { + int num1005 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 2.7f); + Main.dust[num1005].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; + Main.dust[num1005].noGravity = true; + Main.dust[num1005].velocity *= 3f; + } + for (int num1006 = 0; num1006 < 5; num1006++) + { + int num1007 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num1007].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; + Main.dust[num1007].noGravity = true; + Main.dust[num1007].velocity *= 3f; + } + } + } + } +} diff --git a/Projectiles/Melee/BansheeHookScythe.cs b/Projectiles/Melee/BansheeHookScythe.cs index ec25dfb657..76f9f32ca2 100644 --- a/Projectiles/Melee/BansheeHookScythe.cs +++ b/Projectiles/Melee/BansheeHookScythe.cs @@ -1,50 +1,50 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BansheeHookScythe : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 38; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; - aiType = 274; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.6f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BansheeHookScythe : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 38; + projectile.aiStyle = 18; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 5; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + aiType = 274; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.6f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + 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); + } + } +} diff --git a/Projectiles/Melee/BiomeOrb.cs b/Projectiles/Melee/BiomeOrb.cs index 5663a115a3..e527b83e83 100644 --- a/Projectiles/Melee/BiomeOrb.cs +++ b/Projectiles/Melee/BiomeOrb.cs @@ -1,139 +1,139 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BiomeOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Biome Orb"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool sky = player.ZoneSkyHeight; - int dustType = 0; - if (jungle) - { - dustType = 39; - } - else if (snow) - { - dustType = 51; - } - else if (beach) - { - dustType = 33; - } - else if (corrupt) - { - dustType = 14; - } - else if (crimson) - { - dustType = 5; - } - else if (dungeon) - { - dustType = 29; - } - else if (desert) - { - dustType = 32; - } - else if (glow) - { - dustType = 56; - } - else if (hell) - { - dustType = 6; - } - else if (sky) - { - dustType = 213; - } - else - { - dustType = 3; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - if (jungle) - { - target.AddBuff(mod.BuffType("Plague"), 180); - } - else if (snow) - { - target.AddBuff(mod.BuffType("GlacialState"), 180); - } - else if (beach) - { - target.AddBuff(mod.BuffType("CrushDepth"), 180); - } - else if (dungeon) - { - target.AddBuff(BuffID.Frostburn, 180); - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 180); - } - else if (glow) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 180); - } - else if (hell) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 180); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BiomeOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Biome Orb"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool sky = player.ZoneSkyHeight; + int dustType = 0; + if (jungle) + { + dustType = 39; + } + else if (snow) + { + dustType = 51; + } + else if (beach) + { + dustType = 33; + } + else if (corrupt) + { + dustType = 14; + } + else if (crimson) + { + dustType = 5; + } + else if (dungeon) + { + dustType = 29; + } + else if (desert) + { + dustType = 32; + } + else if (glow) + { + dustType = 56; + } + else if (hell) + { + dustType = 6; + } + else if (sky) + { + dustType = 213; + } + else + { + dustType = 3; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + if (jungle) + { + target.AddBuff(mod.BuffType("Plague"), 180); + } + else if (snow) + { + target.AddBuff(mod.BuffType("GlacialState"), 180); + } + else if (beach) + { + target.AddBuff(mod.BuffType("CrushDepth"), 180); + } + else if (dungeon) + { + target.AddBuff(BuffID.Frostburn, 180); + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 180); + } + else if (glow) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 180); + } + else if (hell) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 180); + } + } + } +} diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index 6708c6b1e1..12aa68bcb4 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -1,89 +1,89 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BlazingPhantomBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blazing Phantom Blade"); - } - - public override void SetDefaults() - { - projectile.width = 36; - projectile.height = 66; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; - aiType = 274; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.6f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 460f; - 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 = 8f; - 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 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Venom, 60); - target.AddBuff(BuffID.CursedInferno, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BlazingPhantomBlade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blazing Phantom Blade"); + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 66; + projectile.aiStyle = 18; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 5; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + aiType = 274; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.6f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 460f; + 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 = 8f; + 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 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.Venom, 60); + target.AddBuff(BuffID.CursedInferno, 120); + } + } +} diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index 9b748bdda8..71578e0176 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Blood : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 6f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - player.statLife += 5; - player.HealEffect(5); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Blood : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 2; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 6f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + player.statLife += 5; + player.HealEffect(5); + } + } +} diff --git a/Projectiles/Melee/Blood2.cs b/Projectiles/Melee/Blood2.cs index a1ae1eaeae..893e52547d 100644 --- a/Projectiles/Melee/Blood2.cs +++ b/Projectiles/Melee/Blood2.cs @@ -71,4 +71,4 @@ namespace CalamityMod.Projectiles.Melee } } } -} \ No newline at end of file +} diff --git a/Projectiles/Melee/BloodBall.cs b/Projectiles/Melee/BloodBall.cs index 599f1b614b..6f503c8b12 100644 --- a/Projectiles/Melee/BloodBall.cs +++ b/Projectiles/Melee/BloodBall.cs @@ -1,134 +1,134 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BloodBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Ball"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 200; - projectile.melee = true; - projectile.tileCollide = false; - } - - public override void AI() - { - try - { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (num223 < 0) - { - num223 = 0; - } - if (num224 > Main.maxTilesX) - { - num224 = Main.maxTilesX; - } - if (num225 < 0) - { - num225 = 0; - } - if (num226 > Main.maxTilesY) - { - num226 = Main.maxTilesY; - } - for (int num227 = num223; num227 < num224; num227++) - { - for (int num228 = num225; num228 < num226; num228++) - { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) - { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } - catch - { - } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 128; - projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 8f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) - { - projectile.ai[0] = 10f; - 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; - return; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 22; - projectile.height = 22; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num648 = 0; num648 < 20; num648++) - { - int num649 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num649].velocity *= 1.4f; - } - for (int num650 = 0; num650 < 10; num650++) - { - int num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 2.5f); - Main.dust[num651].noGravity = true; - Main.dust[num651].velocity *= 5f; - num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num651].velocity *= 3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.Kill(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BloodBall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Ball"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 200; + projectile.melee = true; + projectile.tileCollide = false; + } + + public override void AI() + { + try + { + int num223 = (int)(projectile.position.X / 16f) - 1; + int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; + int num225 = (int)(projectile.position.Y / 16f) - 1; + int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + if (num223 < 0) + { + num223 = 0; + } + if (num224 > Main.maxTilesX) + { + num224 = Main.maxTilesX; + } + if (num225 < 0) + { + num225 = 0; + } + if (num226 > Main.maxTilesY) + { + num226 = Main.maxTilesY; + } + for (int num227 = num223; num227 < num224; num227++) + { + for (int num228 = num225; num228 < num226; num228++) + { + if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) + { + Vector2 vector19; + vector19.X = (float)(num227 * 16); + vector19.Y = (float)(num228 * 16); + if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -0.2f; + } + } + } + } + } + catch + { + } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 128; + projectile.height = 128; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 8f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 10f) + { + projectile.ai[0] = 10f; + 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; + return; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 22; + projectile.height = 22; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num648 = 0; num648 < 20; num648++) + { + int num649 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num649].velocity *= 1.4f; + } + for (int num650 = 0; num650 < 10; num650++) + { + int num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 2.5f); + Main.dust[num651].noGravity = true; + Main.dust[num651].velocity *= 5f; + num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num651].velocity *= 3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.Kill(); + } + } +} diff --git a/Projectiles/Melee/BloodScythe.cs b/Projectiles/Melee/BloodScythe.cs index a48a963e04..4813bb4e47 100644 --- a/Projectiles/Melee/BloodScythe.cs +++ b/Projectiles/Melee/BloodScythe.cs @@ -1,56 +1,56 @@ -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 BloodScythe : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.075f) / 255f); - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft < 420) - { - projectile.velocity *= 1.05f; - } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.1f; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - } - } -} \ No newline at end of file +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 BloodScythe : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.075f) / 255f); + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft < 420) + { + projectile.velocity *= 1.05f; + } + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.1f; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 180); + } + } +} diff --git a/Projectiles/Melee/BloodyBlade.cs b/Projectiles/Melee/BloodyBlade.cs index 0b6cea4149..2fa25de995 100644 --- a/Projectiles/Melee/BloodyBlade.cs +++ b/Projectiles/Melee/BloodyBlade.cs @@ -1,59 +1,59 @@ -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 BloodyBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Blade"); - } - - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 48; - projectile.aiStyle = 18; - aiType = 274; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - 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 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.immune[projectile.owner] = 9; - target.AddBuff(BuffID.Ichor, 60); - } - } -} \ No newline at end of file +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 BloodyBlade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloody Blade"); + } + + public override void SetDefaults() + { + projectile.width = 48; + projectile.height = 48; + projectile.aiStyle = 18; + aiType = 274; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + 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 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.immune[projectile.owner] = 9; + target.AddBuff(BuffID.Ichor, 60); + } + } +} diff --git a/Projectiles/Melee/BlueAura.cs b/Projectiles/Melee/BlueAura.cs index 09ca193897..6c553ff9bf 100644 --- a/Projectiles/Melee/BlueAura.cs +++ b/Projectiles/Melee/BlueAura.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BlueAura : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blue Aura"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - aiType = 348; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - } - - public override void AI() - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 15, 0f, 0f, 100, default(Color), 1.3f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BlueAura : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blue Aura"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + aiType = 348; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 300; + } + + public override void AI() + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 15, 0f, 0f, 100, default(Color), 1.3f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } +} diff --git a/Projectiles/Melee/Brimblast.cs b/Projectiles/Melee/Brimblast.cs index daba45bd32..207579520f 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -1,103 +1,103 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Brimblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimblast"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 24; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 240; - } - - 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, 235, 0f, 0f, 100, default(Color), 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 - 4f; - if (Main.rand.Next(2) == 0) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 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.2f; - } - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Brimblast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimblast"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 24; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.timeLeft = 240; + } + + 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, 235, 0f, 0f, 100, default(Color), 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 - 4f; + if (Main.rand.Next(2) == 0) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 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.2f; + } + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Melee/BrimlanceHellfireExplosion.cs b/Projectiles/Melee/BrimlanceHellfireExplosion.cs index eb8d3cf68a..f6e28fb8a1 100644 --- a/Projectiles/Melee/BrimlanceHellfireExplosion.cs +++ b/Projectiles/Melee/BrimlanceHellfireExplosion.cs @@ -1,102 +1,102 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BrimlanceHellfireExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BrimlanceHellfireExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 130; + projectile.height = 130; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + } +} diff --git a/Projectiles/Melee/BrimlanceStandingFire.cs b/Projectiles/Melee/BrimlanceStandingFire.cs index e32c68cd79..970580ca8b 100644 --- a/Projectiles/Melee/BrimlanceStandingFire.cs +++ b/Projectiles/Melee/BrimlanceStandingFire.cs @@ -1,108 +1,108 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BrimlanceStandingFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 240; - } - - 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.type >= 326 && projectile.type <= 328) - { - 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, 235, 0f, 0f, 100, default(Color), 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, 235, 0f, 0f, 100, default(Color), 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; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BrimlanceStandingFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 12; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.timeLeft = 240; + } + + 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.type >= 326 && projectile.type <= 328) + { + 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, 235, 0f, 0f, 100, default(Color), 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, 235, 0f, 0f, 100, default(Color), 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; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + } + } +} diff --git a/Projectiles/Melee/Brimlash.cs b/Projectiles/Melee/Brimlash.cs index de397f22d9..575bd7bfbc 100644 --- a/Projectiles/Melee/Brimlash.cs +++ b/Projectiles/Melee/Brimlash.cs @@ -1,73 +1,73 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Brimlash : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimlash"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (Math.Abs(projectile.velocity.X) <= 1f || Math.Abs(projectile.velocity.Y) <= 1f) - { - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - float spread = 90f * 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) - { - for (i = 0; i < 2; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Brimlash2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("Brimlash2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Brimlash : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimlash"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.melee = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (Math.Abs(projectile.velocity.X) <= 1f || Math.Abs(projectile.velocity.Y) <= 1f) + { + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 3; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + float spread = 90f * 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) + { + for (i = 0; i < 2; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Brimlash2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("Brimlash2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } +} diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index cbf6d2d820..9e89b6d6d7 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -1,83 +1,83 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Brimlash2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimlash"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.melee = true; - projectile.timeLeft = 120; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - 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 = 15f; - 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; - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Brimlash2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimlash"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.melee = true; + projectile.timeLeft = 120; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + 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 = 15f; + 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; + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } +} diff --git a/Projectiles/Melee/BrimstoneBoom.cs b/Projectiles/Melee/BrimstoneBoom.cs index b162c2b8c2..537525f698 100644 --- a/Projectiles/Melee/BrimstoneBoom.cs +++ b/Projectiles/Melee/BrimstoneBoom.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BrimstoneBoom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boom"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 10; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1f); - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BrimstoneBoom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boom"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = -1; + projectile.timeLeft = 10; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1f); + 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++; + } + } + } +} diff --git a/Projectiles/Melee/BrimstoneLaserFriendly.cs b/Projectiles/Melee/BrimstoneLaserFriendly.cs index f11508fa32..8e189d953c 100644 --- a/Projectiles/Melee/BrimstoneLaserFriendly.cs +++ b/Projectiles/Melee/BrimstoneLaserFriendly.cs @@ -1,66 +1,66 @@ -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 BrimstoneLaserFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 2; - projectile.height = 2; - projectile.aiStyle = 1; - aiType = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.alpha = 120; - projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.Y += projectile.ai[0]; - if (Main.rand.Next(2) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.velocity.X * 0.5f, projectile.velocity.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, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 60); - } - } -} \ No newline at end of file +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 BrimstoneLaserFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.aiStyle = 1; + aiType = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.scale = 2f; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.alpha = 120; + projectile.timeLeft = 600; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.velocity.X *= 1.05f; + projectile.velocity.Y *= 1.05f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.Y += projectile.ai[0]; + if (Main.rand.Next(2) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.velocity.X * 0.5f, projectile.velocity.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, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 60); + } + } +} diff --git a/Projectiles/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index ff8b6b29cd..680dacc39c 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -1,133 +1,133 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BrinySpout : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Briny Spout"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 150; - projectile.height = 42; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - } - - public override void AI() - { - int num613 = 16; - int num614 = 16; - float num615 = 1.5f; - int num616 = 150; - int num617 = 42; - if (Main.rand.Next(15) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); - } - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 3; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 3; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - int num335 = Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - num623 *= 2f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(53, Main.DiscoG, 255, projectile.alpha); - } - - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BrinySpout : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Briny Spout"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 150; + projectile.height = 42; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.timeLeft = 60; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + int num613 = 16; + int num614 = 16; + float num615 = 1.5f; + int num616 = 150; + int num617 = 42; + if (Main.rand.Next(15) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + } + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 3; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 3; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + int num335 = Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + num623 *= 2f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(53, Main.DiscoG, 255, projectile.alpha); + } + + 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; + } + } +} diff --git a/Projectiles/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index cff0afb0a3..4d78ff8f3c 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -1,146 +1,146 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BrinyTyphoonBubble : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - Main.projFrames[projectile.type] = 3; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - - public override void AI() - { - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - 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, 187, value15.X * 2f, value15.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - return; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 96); - 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, 187, vector7.X * 2f, vector7.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - if (projectile.owner == Main.myPlayer) - { - int num330 = (int)(projectile.Center.Y / 16f); - int num331 = (int)(projectile.Center.X / 16f); - int num332 = 100; - if (num331 < 10) - { - num331 = 10; - } - if (num331 > Main.maxTilesX - 10) - { - num331 = Main.maxTilesX - 10; - } - if (num330 < 10) - { - num330 = 10; - } - if (num330 > Main.maxTilesY - num332 - 10) - { - num330 = Main.maxTilesY - num332 - 10; - } - for (int num333 = num330; num333 < num330 + num332; num333++) - { - Tile tile = Main.tile[num331, num333]; - if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) - { - num330 = num333; - break; - } - } - int num335 = Projectile.NewProjectile((float)(num331 * 16 + 8), (float)(num330 * 16 - 24), 0f, 0f, mod.ProjectileType("BrinySpout"), projectile.damage, 6f, Main.myPlayer, 16f, 25f); - Main.projectile[num335].netUpdate = true; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BrinyTyphoonBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.melee = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + + public override void AI() + { + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + 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, 187, value15.X * 2f, value15.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + return; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 96); + 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, 187, vector7.X * 2f, vector7.Y * 2f, 100, new Color(53, Main.DiscoG, 255), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (projectile.owner == Main.myPlayer) + { + int num330 = (int)(projectile.Center.Y / 16f); + int num331 = (int)(projectile.Center.X / 16f); + int num332 = 100; + if (num331 < 10) + { + num331 = 10; + } + if (num331 > Main.maxTilesX - 10) + { + num331 = Main.maxTilesX - 10; + } + if (num330 < 10) + { + num330 = 10; + } + if (num330 > Main.maxTilesY - num332 - 10) + { + num330 = Main.maxTilesY - num332 - 10; + } + for (int num333 = num330; num333 < num330 + num332; num333++) + { + Tile tile = Main.tile[num331, num333]; + if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num330 = num333; + break; + } + } + int num335 = Projectile.NewProjectile((float)(num331 * 16 + 8), (float)(num330 * 16 - 24), 0f, 0f, mod.ProjectileType("BrinySpout"), projectile.damage, 6f, Main.myPlayer, 16f, 25f); + Main.projectile[num335].netUpdate = true; + } + } + } +} diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 3289ac6d9f..2f74f2b3e4 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -1,113 +1,113 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BurningMeteor : ModProjectile - { - private int noTileHitCounter = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Meteor"); - } - - public override void SetDefaults() - { - projectile.width = 46; - projectile.height = 46; - projectile.alpha = 150; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 180; - 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, 20); - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) - { - 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, 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(36) == 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, 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.9f; - if (Main.rand.Next(30) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); - } - if (Main.rand.Next(60) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f, 150, default(Color), 2f); - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BurningMeteor : ModProjectile + { + private int noTileHitCounter = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Meteor"); + } + + public override void SetDefaults() + { + projectile.width = 46; + projectile.height = 46; + projectile.alpha = 150; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 180; + 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, 20); + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 30f) + { + 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, 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(36) == 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, 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.9f; + if (Main.rand.Next(30) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + if (Main.rand.Next(60) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f, 150, default(Color), 2f); + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 600); + } + } +} diff --git a/Projectiles/Melee/CalamityAura.cs b/Projectiles/Melee/CalamityAura.cs index 4c91525331..4c35113a88 100644 --- a/Projectiles/Melee/CalamityAura.cs +++ b/Projectiles/Melee/CalamityAura.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CalamityAura : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 80; - projectile.melee = true; - } - - public override void AI() - { - 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, 73, 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, 73, 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - - public override void Kill(int timeLeft) - { - int height = 40; - 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) - { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 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, 73, 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, 73, 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CalamityAura : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 80; + projectile.melee = true; + } + + public override void AI() + { + 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, 73, 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, 73, 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + } + + public override void Kill(int timeLeft) + { + int height = 40; + 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) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 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, 73, 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, 73, 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; + } + } + } +} diff --git a/Projectiles/Melee/CalamityAuraType2.cs b/Projectiles/Melee/CalamityAuraType2.cs index 8e5e7b6256..bd40961427 100644 --- a/Projectiles/Melee/CalamityAuraType2.cs +++ b/Projectiles/Melee/CalamityAuraType2.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CalamityAuraType2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 80; - projectile.melee = true; - } - - public override void AI() - { - 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, 56, 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, 56, 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - } - - public override void Kill(int timeLeft) - { - int height = 40; - 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) - { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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, 56, 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, 56, 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CalamityAuraType2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 80; + projectile.melee = true; + } + + public override void AI() + { + 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, 56, 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, 56, 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + } + + public override void Kill(int timeLeft) + { + int height = 40; + 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) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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, 56, 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, 56, 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; + } + } + } +} diff --git a/Projectiles/Melee/CalamityAuraType3.cs b/Projectiles/Melee/CalamityAuraType3.cs index e7b18e802e..754753809a 100644 --- a/Projectiles/Melee/CalamityAuraType3.cs +++ b/Projectiles/Melee/CalamityAuraType3.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CalamityAuraType3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 80; - projectile.melee = true; - } - - public override void AI() - { - 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, 57, 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, 57, 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 180); - } - - public override void Kill(int timeLeft) - { - int height = 40; - 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) - { - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 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, 57, 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, 57, 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CalamityAuraType3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 80; + projectile.melee = true; + } + + public override void AI() + { + 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, 57, 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, 57, 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 180); + } + + public override void Kill(int timeLeft) + { + int height = 40; + 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) + { + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 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, 57, 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, 57, 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; + } + } + } +} diff --git a/Projectiles/Melee/ChaosFlameLarge.cs b/Projectiles/Melee/ChaosFlameLarge.cs index 900c549b03..79d7fe8d6e 100644 --- a/Projectiles/Melee/ChaosFlameLarge.cs +++ b/Projectiles/Melee/ChaosFlameLarge.cs @@ -1,55 +1,55 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class ChaosFlameLarge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 50; - projectile.aiStyle = 44; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.alpha = 100; - projectile.timeLeft = 600; - aiType = 228; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 480); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ChaosFlameLarge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 50; + projectile.aiStyle = 44; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.alpha = 100; + projectile.timeLeft = 600; + aiType = 228; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 480); + } + } +} diff --git a/Projectiles/Melee/ChaosFlameMedium.cs b/Projectiles/Melee/ChaosFlameMedium.cs index 427c552ef5..7f79466b26 100644 --- a/Projectiles/Melee/ChaosFlameMedium.cs +++ b/Projectiles/Melee/ChaosFlameMedium.cs @@ -1,55 +1,55 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class ChaosFlameMedium : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 40; - projectile.aiStyle = 44; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 100; - projectile.penetrate = 1; - projectile.timeLeft = 600; - aiType = 228; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 360); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ChaosFlameMedium : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 40; + projectile.aiStyle = 44; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.alpha = 100; + projectile.penetrate = 1; + projectile.timeLeft = 600; + aiType = 228; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 360); + } + } +} diff --git a/Projectiles/Melee/ChaosFlameSmall.cs b/Projectiles/Melee/ChaosFlameSmall.cs index 8487110f1b..57654f62f6 100644 --- a/Projectiles/Melee/ChaosFlameSmall.cs +++ b/Projectiles/Melee/ChaosFlameSmall.cs @@ -1,55 +1,55 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class ChaosFlameSmall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 32; - projectile.aiStyle = 44; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 100; - projectile.penetrate = 1; - projectile.timeLeft = 600; - aiType = 228; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ChaosFlameSmall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 32; + projectile.aiStyle = 44; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.alpha = 100; + projectile.penetrate = 1; + projectile.timeLeft = 600; + aiType = 228; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 240); + } + } +} diff --git a/Projectiles/Melee/CosmicBolt.cs b/Projectiles/Melee/CosmicBolt.cs index e4eef51075..8c2db3411d 100644 --- a/Projectiles/Melee/CosmicBolt.cs +++ b/Projectiles/Melee/CosmicBolt.cs @@ -1,49 +1,49 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CosmicBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 180; - projectile.melee = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num441 = 0; num441 < 2; num441++) - { - Vector2 vector30 = projectile.position; - vector30 -= projectile.velocity * ((float)num441 * 0.25f); - projectile.alpha = 255; - int num442 = Dust.NewDust(vector30, 1, 1, 107, 0f, 0f, 0, default(Color), 1.3f); - Main.dust[num442].position = vector30; - Dust expr_13A3E_cp_0 = Main.dust[num442]; - expr_13A3E_cp_0.position.X = expr_13A3E_cp_0.position.X + (float)(projectile.width / 2); - Dust expr_13A62_cp_0 = Main.dust[num442]; - expr_13A62_cp_0.position.Y = expr_13A62_cp_0.position.Y + (float)(projectile.height / 2); - Main.dust[num442].scale = (float)Main.rand.Next(70, 110) * 0.007f; - Main.dust[num442].velocity *= 0.2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CosmicBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 180; + projectile.melee = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num441 = 0; num441 < 2; num441++) + { + Vector2 vector30 = projectile.position; + vector30 -= projectile.velocity * ((float)num441 * 0.25f); + projectile.alpha = 255; + int num442 = Dust.NewDust(vector30, 1, 1, 107, 0f, 0f, 0, default(Color), 1.3f); + Main.dust[num442].position = vector30; + Dust expr_13A3E_cp_0 = Main.dust[num442]; + expr_13A3E_cp_0.position.X = expr_13A3E_cp_0.position.X + (float)(projectile.width / 2); + Dust expr_13A62_cp_0 = Main.dust[num442]; + expr_13A62_cp_0.position.Y = expr_13A62_cp_0.position.Y + (float)(projectile.height / 2); + Main.dust[num442].scale = (float)Main.rand.Next(70, 110) * 0.007f; + Main.dust[num442].velocity *= 0.2f; + } + } + } + } +} diff --git a/Projectiles/Melee/CosmicDischarge.cs b/Projectiles/Melee/CosmicDischarge.cs index d9eb67b2ee..712a7a8cb9 100644 --- a/Projectiles/Melee/CosmicDischarge.cs +++ b/Projectiles/Melee/CosmicDischarge.cs @@ -1,238 +1,238 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Enums; - -namespace CalamityMod.Projectiles.Melee -{ - public class CosmicDischarge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Discharge"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.hide = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.GetGlobalProjectile(mod).trueMelee = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.localAI[1] > 0f) - { - projectile.localAI[1] -= 1f; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = projectile.velocity.ToRotation(); - } - float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); - if (projectile.ai[1] <= 0f) - { - num32 *= -1f; - } - Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); - vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); - if (projectile.ai[1] <= 0f) - { - vector17.Y *= -1f; - } - vector17 = vector17.RotatedBy((double)projectile.localAI[0], default(Vector2)); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 30f) - { - projectile.velocity += 48f * vector17; - } - else - { - projectile.Kill(); - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; - if (player.direction != 1) - { - vector24.X = (float)player.bodyFrame.Width - vector24.X; - } - if (player.gravDir != 1f) - { - vector24.Y = (float)player.bodyFrame.Height - vector24.Y; - } - vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; - projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; - if (projectile.alpha == 0) - { - for (int num51 = 0; num51 < 2; num51++) - { - Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, 67, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 2f)]; - dust.noGravity = true; - dust.velocity *= 2f; - dust.velocity += projectile.localAI[0].ToRotationVector2(); - dust.fadeIn = 1.5f; - } - float num52 = 18f; - int num53 = 0; - while ((float)num53 < num52) - { - if (Main.rand.Next(4) == 0) - { - Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); - Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1f)]; - dust2.noGravity = true; - dust2.fadeIn = 0.5f; - dust2.velocity += projectile.localAI[0].ToRotationVector2(); - dust2.noLight = true; - } - num53++; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - Vector2 projPos = projectile.position; - projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; //fuck it - Texture2D texture2D22 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25); - if (projectile.velocity == Vector2.Zero) - { - return false; - } - float num230 = projectile.velocity.Length() + 16f; - bool flag24 = num230 < 100f; - Vector2 value28 = Vector2.Normalize(projectile.velocity); - Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 36); //2 and 40 - Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); - float rotation24 = projectile.rotation + 3.14159274f; - Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); - num230 -= 40f * projectile.scale; - Vector2 vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 18); //68 and 18 - if (num230 > 0f) - { - float num231 = 0f; - while (num231 + 1f < num230) - { - if (num230 - num231 < (float)rectangle8.Height) - { - rectangle8.Height = (int)(num230 - num231); - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num231 += (float)rectangle8.Height * projectile.scale; - vector31 += value28 * (float)rectangle8.Height * projectile.scale; - } - } - Vector2 value30 = vector31; - vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 40, texture2D22.Width, 20); //46 and 18 - int num232 = 18; - if (flag24) - { - num232 = 9; - } - float num233 = num230; - if (num230 > 0f) - { - float num234 = 0f; - float num235 = num233 / (float)num232; - num234 += num235 * 0.25f; - vector31 += value28 * num235 * 0.25f; - for (int num236 = 0; num236 < num232; num236++) - { - float num237 = num235; - if (num236 == 0) - { - num237 *= 0.75f; - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num234 += num237; - vector31 += value28 * num237; - } - } - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 56); //90 and 48 - Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(150, Main.DiscoG, 255, 200); - } - - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num8 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) - { - return true; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - target.AddBuff(BuffID.Frostburn, 300); - if (Main.rand.Next(3) == 0) - { - target.AddBuff(mod.BuffType("GlacialState"), 120); - } - if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("CosmicIceBurst"), damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } - projectile.localAI[1] = 4f; - player.AddBuff(mod.BuffType("CosmicFreeze"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; + +namespace CalamityMod.Projectiles.Melee +{ + public class CosmicDischarge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Discharge"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.hide = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + projectile.GetGlobalProjectile(mod).trueMelee = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.localAI[1] > 0f) + { + projectile.localAI[1] -= 1f; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = projectile.velocity.ToRotation(); + } + float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); + if (projectile.ai[1] <= 0f) + { + num32 *= -1f; + } + Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); + vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); + if (projectile.ai[1] <= 0f) + { + vector17.Y *= -1f; + } + vector17 = vector17.RotatedBy((double)projectile.localAI[0], default(Vector2)); + projectile.ai[0] += 1f; + if (projectile.ai[0] < 30f) + { + projectile.velocity += 48f * vector17; + } + else + { + projectile.Kill(); + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; + if (player.direction != 1) + { + vector24.X = (float)player.bodyFrame.Width - vector24.X; + } + if (player.gravDir != 1f) + { + vector24.Y = (float)player.bodyFrame.Height - vector24.Y; + } + vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; + projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; + if (projectile.alpha == 0) + { + for (int num51 = 0; num51 < 2; num51++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, 67, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 2f)]; + dust.noGravity = true; + dust.velocity *= 2f; + dust.velocity += projectile.localAI[0].ToRotationVector2(); + dust.fadeIn = 1.5f; + } + float num52 = 18f; + int num53 = 0; + while ((float)num53 < num52) + { + if (Main.rand.Next(4) == 0) + { + Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); + Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1f)]; + dust2.noGravity = true; + dust2.fadeIn = 0.5f; + dust2.velocity += projectile.localAI[0].ToRotationVector2(); + dust2.noLight = true; + } + num53++; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + Vector2 projPos = projectile.position; + projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; //fuck it + Texture2D texture2D22 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25); + if (projectile.velocity == Vector2.Zero) + { + return false; + } + float num230 = projectile.velocity.Length() + 16f; + bool flag24 = num230 < 100f; + Vector2 value28 = Vector2.Normalize(projectile.velocity); + Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 36); //2 and 40 + Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); + float rotation24 = projectile.rotation + 3.14159274f; + Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); + num230 -= 40f * projectile.scale; + Vector2 vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 18); //68 and 18 + if (num230 > 0f) + { + float num231 = 0f; + while (num231 + 1f < num230) + { + if (num230 - num231 < (float)rectangle8.Height) + { + rectangle8.Height = (int)(num230 - num231); + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num231 += (float)rectangle8.Height * projectile.scale; + vector31 += value28 * (float)rectangle8.Height * projectile.scale; + } + } + Vector2 value30 = vector31; + vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 40, texture2D22.Width, 20); //46 and 18 + int num232 = 18; + if (flag24) + { + num232 = 9; + } + float num233 = num230; + if (num230 > 0f) + { + float num234 = 0f; + float num235 = num233 / (float)num232; + num234 += num235 * 0.25f; + vector31 += value28 * num235 * 0.25f; + for (int num236 = 0; num236 < num232; num236++) + { + float num237 = num235; + if (num236 == 0) + { + num237 *= 0.75f; + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num234 += num237; + vector31 += value28 * num237; + } + } + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 56); //90 and 48 + Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(150, Main.DiscoG, 255, 200); + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num8 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) + { + return true; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + target.AddBuff(BuffID.Frostburn, 300); + if (Main.rand.Next(3) == 0) + { + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("CosmicIceBurst"), damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + projectile.localAI[1] = 4f; + player.AddBuff(mod.BuffType("CosmicFreeze"), 300); + } + } +} diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index d644b25471..937cec070b 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -1,125 +1,125 @@ -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 CosmicIceBurst : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Ice"); - Main.projFrames[projectile.type] = 9; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 255; - projectile.ignoreWater = true; - projectile.timeLeft = 60; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - public override void AI() - { - projectile.ai[1] += 0.01f; - projectile.scale = projectile.ai[1]; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= (float)(3 * Main.projFrames[projectile.type])) - { - projectile.Kill(); - return; - } - if (++projectile.frameCounter >= 3) - { - projectile.frameCounter = 0; - if (++projectile.frame >= Main.projFrames[projectile.type]) - { - projectile.hide = true; - } - } - projectile.alpha -= 63; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 0.517f, ((float)Main.DiscoG / 300f), 0.85f); - if (projectile.ai[0] == 1f) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = (int)(52f * projectile.scale)); - projectile.Center = projectile.position; - projectile.Damage(); - Main.PlaySound(SoundID.Item62, projectile.position); - for (int num1000 = 0; num1000 < 4; num1000++) - { - int num1001 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1.5f); - Main.dust[num1001].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - } - for (int num1002 = 0; num1002 < 10; num1002++) - { - int num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 2.7f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].velocity *= 3f; - num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1.5f); - Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num1003].velocity *= 2f; - Main.dust[num1003].noGravity = true; - Main.dust[num1003].fadeIn = 2.5f; - } - for (int num1004 = 0; num1004 < 5; num1004++) - { - int num1005 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 0, new Color(150, Main.DiscoG, 255), 2.7f); - Main.dust[num1005].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; - Main.dust[num1005].noGravity = true; - Main.dust[num1005].velocity *= 3f; - } - for (int num1006 = 0; num1006 < 10; num1006++) - { - int num1007 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 0, new Color(150, Main.DiscoG, 255), 1.5f); - Main.dust[num1007].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; - Main.dust[num1007].noGravity = true; - Main.dust[num1007].velocity *= 3f; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - Vector2 vector42 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D33 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle15 = texture2D33.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin11 = rectangle15.Size() / 2f; - return true; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(150, Main.DiscoG, 255, 127); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - projectile.direction = Main.player[projectile.owner].direction; - } - } -} \ No newline at end of file +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 CosmicIceBurst : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Ice"); + Main.projFrames[projectile.type] = 9; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.timeLeft = 60; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + projectile.ai[1] += 0.01f; + projectile.scale = projectile.ai[1]; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= (float)(3 * Main.projFrames[projectile.type])) + { + projectile.Kill(); + return; + } + if (++projectile.frameCounter >= 3) + { + projectile.frameCounter = 0; + if (++projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.hide = true; + } + } + projectile.alpha -= 63; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 0.517f, ((float)Main.DiscoG / 300f), 0.85f); + if (projectile.ai[0] == 1f) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = (int)(52f * projectile.scale)); + projectile.Center = projectile.position; + projectile.Damage(); + Main.PlaySound(SoundID.Item62, projectile.position); + for (int num1000 = 0; num1000 < 4; num1000++) + { + int num1001 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1.5f); + Main.dust[num1001].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + } + for (int num1002 = 0; num1002 < 10; num1002++) + { + int num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 2.7f); + Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num1003].noGravity = true; + Main.dust[num1003].velocity *= 3f; + num1003 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, new Color(150, Main.DiscoG, 255), 1.5f); + Main.dust[num1003].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num1003].velocity *= 2f; + Main.dust[num1003].noGravity = true; + Main.dust[num1003].fadeIn = 2.5f; + } + for (int num1004 = 0; num1004 < 5; num1004++) + { + int num1005 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 0, new Color(150, Main.DiscoG, 255), 2.7f); + Main.dust[num1005].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; + Main.dust[num1005].noGravity = true; + Main.dust[num1005].velocity *= 3f; + } + for (int num1006 = 0; num1006 < 10; num1006++) + { + int num1007 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 0, new Color(150, Main.DiscoG, 255), 1.5f); + Main.dust[num1007].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 2f; + Main.dust[num1007].noGravity = true; + Main.dust[num1007].velocity *= 3f; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + Vector2 vector42 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D33 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle15 = texture2D33.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin11 = rectangle15.Size() / 2f; + return true; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(150, Main.DiscoG, 255, 127); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + projectile.direction = Main.player[projectile.owner].direction; + } + } +} diff --git a/Projectiles/Melee/CosmicOrb.cs b/Projectiles/Melee/CosmicOrb.cs index 8a61a81486..7886175fde 100644 --- a/Projectiles/Melee/CosmicOrb.cs +++ b/Projectiles/Melee/CosmicOrb.cs @@ -1,135 +1,135 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CosmicOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.extraUpdates = 0; - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.5f, 0.15f)); - projectile.velocity *= 0.985f; - projectile.rotation += projectile.velocity.X * 0.2f; - if (projectile.velocity.X > 0f) - { - projectile.rotation += 0.08f; - } - else - { - projectile.rotation -= 0.08f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] > 30f) - { - projectile.alpha += 10; - if (projectile.alpha >= 255) - { - projectile.alpha = 255; - projectile.Kill(); - return; - } - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 500f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("CosmicBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item54, projectile.position); - Vector2 arg_6751_0 = projectile.Center; - int num3; - for (int num191 = 0; num191 < 10; num191 = num3 + 1) - { - int num192 = (int)(10f * projectile.scale); - int num193 = Dust.NewDust(projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default(Color), 1f); - Dust dust20 = Main.dust[num193]; - Vector2 value8 = Vector2.Normalize(dust20.position - projectile.Center); - dust20.position = projectile.Center + value8 * (float)num192 * projectile.scale; - if (num191 < 30) - { - dust20.velocity = value8 * dust20.velocity.Length(); - } - else - { - dust20.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; - } - dust20.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); - dust20.color = Color.Lerp(dust20.color, Color.White, 0.3f); - dust20.noGravity = true; - dust20.scale = 0.7f; - num3 = num191; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 255 - projectile.alpha, 0, 0); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CosmicOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.extraUpdates = 0; + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.5f, 0.15f)); + projectile.velocity *= 0.985f; + projectile.rotation += projectile.velocity.X * 0.2f; + if (projectile.velocity.X > 0f) + { + projectile.rotation += 0.08f; + } + else + { + projectile.rotation -= 0.08f; + } + projectile.ai[1] += 1f; + if (projectile.ai[1] > 30f) + { + projectile.alpha += 10; + if (projectile.alpha >= 255) + { + projectile.alpha = 255; + projectile.Kill(); + return; + } + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 500f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("CosmicBolt"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item54, projectile.position); + Vector2 arg_6751_0 = projectile.Center; + int num3; + for (int num191 = 0; num191 < 10; num191 = num3 + 1) + { + int num192 = (int)(10f * projectile.scale); + int num193 = Dust.NewDust(projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default(Color), 1f); + Dust dust20 = Main.dust[num193]; + Vector2 value8 = Vector2.Normalize(dust20.position - projectile.Center); + dust20.position = projectile.Center + value8 * (float)num192 * projectile.scale; + if (num191 < 30) + { + dust20.velocity = value8 * dust20.velocity.Length(); + } + else + { + dust20.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; + } + dust20.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); + dust20.color = Color.Lerp(dust20.color, Color.White, 0.3f); + dust20.noGravity = true; + dust20.scale = 0.7f; + num3 = num191; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 255 - projectile.alpha, 0, 0); + } + } +} diff --git a/Projectiles/Melee/CosmicSpiritBomb1.cs b/Projectiles/Melee/CosmicSpiritBomb1.cs index 780dc85c86..d06d679c11 100644 --- a/Projectiles/Melee/CosmicSpiritBomb1.cs +++ b/Projectiles/Melee/CosmicSpiritBomb1.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CosmicSpiritBomb1 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.melee = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 15, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - } - - public override void Kill(int timeLeft) - { - 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 = 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 k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CosmicSpiritBomb1 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 120; + projectile.melee = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 15, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + } + + public override void Kill(int timeLeft) + { + 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 = 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 k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); + } + } + } +} diff --git a/Projectiles/Melee/CosmicSpiritBomb2.cs b/Projectiles/Melee/CosmicSpiritBomb2.cs index 31c31f832d..cae4f35f46 100644 --- a/Projectiles/Melee/CosmicSpiritBomb2.cs +++ b/Projectiles/Melee/CosmicSpiritBomb2.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CosmicSpiritBomb2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.melee = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - - public override void Kill(int timeLeft) - { - 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 = 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 k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CosmicSpiritBomb2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 120; + projectile.melee = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + } + + public override void Kill(int timeLeft) + { + 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 = 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 k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); + } + } + } +} diff --git a/Projectiles/Melee/CosmicSpiritBomb3.cs b/Projectiles/Melee/CosmicSpiritBomb3.cs index 245559b07a..8856b127ea 100644 --- a/Projectiles/Melee/CosmicSpiritBomb3.cs +++ b/Projectiles/Melee/CosmicSpiritBomb3.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CosmicSpiritBomb3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.melee = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 180); - } - - public override void Kill(int timeLeft) - { - 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 = 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 k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CosmicSpiritBomb3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 120; + projectile.melee = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 180); + } + + public override void Kill(int timeLeft) + { + 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 = 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 k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 2.5f, projectile.oldVelocity.Y * 2.5f); + } + } + } +} diff --git a/Projectiles/Melee/CrystalDust.cs b/Projectiles/Melee/CrystalDust.cs index 019846ac46..4d1733dcd8 100644 --- a/Projectiles/Melee/CrystalDust.cs +++ b/Projectiles/Melee/CrystalDust.cs @@ -1,57 +1,57 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class CrystalDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 46; - projectile.height = 46; - aiType = 348; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.timeLeft = 100; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - int num307 = Main.rand.Next(3); - if (num307 == 0) - { - num307 = 173; - } - else if (num307 == 1) - { - num307 = 57; - } - else - { - num307 = 58; - } - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num307, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CrystalDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 46; + projectile.height = 46; + aiType = 348; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 3; + projectile.timeLeft = 100; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + int num307 = Main.rand.Next(3); + if (num307 == 0) + { + num307 = 173; + } + else if (num307 == 1) + { + num307 = 57; + } + else + { + num307 = 58; + } + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num307, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + } +} diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 518f6acd3f..162f3aa03c 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -89,4 +89,4 @@ namespace CalamityMod.Projectiles.Melee return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs index 7f27ebbcc0..ab068eb2ec 100644 --- a/Projectiles/Melee/DNA.cs +++ b/Projectiles/Melee/DNA.cs @@ -1,103 +1,103 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DNA : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("DNA"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - aiType = 493; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; - } - if (Main.myPlayer == projectile.owner) - { - int num48 = projectile.type; - if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) - { - num48 = mod.ProjectileType("DNA2"); - } - int num49 = projectile.damage; - float num50 = projectile.knockBack; - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); - NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else - { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - { - for (int num55 = 0; num55 < 8; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default(Color), 1f); - Main.dust[num56].noGravity = true; - Main.dust[num56].velocity *= 0.5f; - } - } - projectile.alpha += 7; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - } - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (Main.myPlayer == projectile.owner && !CalamityPlayer.areThereAnyDamnBosses) - { - if (!Main.player[projectile.owner].immune) - { - Main.player[projectile.owner].immune = true; - Main.player[projectile.owner].immuneTime = 5; - } - } - target.immune[projectile.owner] = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DNA : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("DNA"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.melee = true; + aiType = 493; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + if (Main.myPlayer == projectile.owner) + { + int num48 = projectile.type; + if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) + { + num48 = mod.ProjectileType("DNA2"); + } + int num49 = projectile.damage; + float num50 = projectile.knockBack; + int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); + NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default(Color), 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.myPlayer == projectile.owner && !CalamityPlayer.areThereAnyDamnBosses) + { + if (!Main.player[projectile.owner].immune) + { + Main.player[projectile.owner].immune = true; + Main.player[projectile.owner].immuneTime = 5; + } + } + target.immune[projectile.owner] = 5; + } + } +} diff --git a/Projectiles/Melee/DNA2.cs b/Projectiles/Melee/DNA2.cs index 85755a87b3..79ba0d8026 100644 --- a/Projectiles/Melee/DNA2.cs +++ b/Projectiles/Melee/DNA2.cs @@ -1,91 +1,91 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DNA2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("DNA"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - aiType = 494; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] == 0f) - { - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.ai[0] = 1f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - projectile.position += projectile.velocity * 1f; - } - } - } - else - { - if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) - { - for (int num55 = 0; num55 < 8; num55++) - { - int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default(Color), 1f); - Main.dust[num56].noGravity = true; - Main.dust[num56].velocity *= 0.5f; - } - } - projectile.alpha += 7; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - } - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (Main.myPlayer == projectile.owner && !CalamityPlayer.areThereAnyDamnBosses) - { - if (!Main.player[projectile.owner].immune) - { - Main.player[projectile.owner].immune = true; - Main.player[projectile.owner].immuneTime = 5; - } - } - target.immune[projectile.owner] = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DNA2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("DNA"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.melee = true; + aiType = 494; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default(Color), 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 234, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.myPlayer == projectile.owner && !CalamityPlayer.areThereAnyDamnBosses) + { + if (!Main.player[projectile.owner].immune) + { + Main.player[projectile.owner].immune = true; + Main.player[projectile.owner].immuneTime = 5; + } + } + target.immune[projectile.owner] = 5; + } + } +} diff --git a/Projectiles/Melee/Dark.cs b/Projectiles/Melee/Dark.cs index d3b6d49108..a331239872 100644 --- a/Projectiles/Melee/Dark.cs +++ b/Projectiles/Melee/Dark.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Dark : ModProjectile - { - public int speedTimer = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.rotation += 0.5f; - speedTimer--; - if (speedTimer > 60) - { - projectile.velocity.X = 10f; - projectile.velocity.Y = 0f; - } - else if (speedTimer <= 60) - { - projectile.velocity.X = -10f; - projectile.velocity.Y = 0f; - } - if (speedTimer <= 0) - { - speedTimer = 120; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Dark : ModProjectile + { + public int speedTimer = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.rotation += 0.5f; + speedTimer--; + if (speedTimer > 60) + { + projectile.velocity.X = 10f; + projectile.velocity.Y = 0f; + } + else if (speedTimer <= 60) + { + projectile.velocity.X = -10f; + projectile.velocity.Y = 0f; + } + if (speedTimer <= 0) + { + speedTimer = 120; + } + } + } +} diff --git a/Projectiles/Melee/DarkBall.cs b/Projectiles/Melee/DarkBall.cs index f3cfca22ac..ad8bd03197 100644 --- a/Projectiles/Melee/DarkBall.cs +++ b/Projectiles/Melee/DarkBall.cs @@ -1,135 +1,135 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DarkBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Ball"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.scale = 0.9f; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 200; - projectile.melee = true; - projectile.tileCollide = false; - } - - public override void AI() - { - try - { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (num223 < 0) - { - num223 = 0; - } - if (num224 > Main.maxTilesX) - { - num224 = Main.maxTilesX; - } - if (num225 < 0) - { - num225 = 0; - } - if (num226 > Main.maxTilesY) - { - num226 = Main.maxTilesY; - } - for (int num227 = num223; num227 < num224; num227++) - { - for (int num228 = num225; num228 < num226; num228++) - { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) - { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } - catch - { - } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 128; - projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 8f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) - { - projectile.ai[0] = 10f; - 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; - return; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (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 = 22; - projectile.height = 22; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num648 = 0; num648 < 20; num648++) - { - int num649 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num649].velocity *= 1.4f; - } - for (int num650 = 0; num650 < 10; num650++) - { - int num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 2.5f); - Main.dust[num651].noGravity = true; - Main.dust[num651].velocity *= 5f; - num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num651].velocity *= 3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.Kill(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DarkBall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Ball"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.scale = 0.9f; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 200; + projectile.melee = true; + projectile.tileCollide = false; + } + + public override void AI() + { + try + { + int num223 = (int)(projectile.position.X / 16f) - 1; + int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; + int num225 = (int)(projectile.position.Y / 16f) - 1; + int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + if (num223 < 0) + { + num223 = 0; + } + if (num224 > Main.maxTilesX) + { + num224 = Main.maxTilesX; + } + if (num225 < 0) + { + num225 = 0; + } + if (num226 > Main.maxTilesY) + { + num226 = Main.maxTilesY; + } + for (int num227 = num223; num227 < num224; num227++) + { + for (int num228 = num225; num228 < num226; num228++) + { + if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) + { + Vector2 vector19; + vector19.X = (float)(num227 * 16); + vector19.Y = (float)(num228 * 16); + if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -0.2f; + } + } + } + } + } + catch + { + } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 128; + projectile.height = 128; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 8f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 10f) + { + projectile.ai[0] = 10f; + 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; + return; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (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 = 22; + projectile.height = 22; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num648 = 0; num648 < 20; num648++) + { + int num649 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num649].velocity *= 1.4f; + } + for (int num650 = 0; num650 < 10; num650++) + { + int num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 2.5f); + Main.dust[num651].noGravity = true; + Main.dust[num651].velocity *= 5f; + num651 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num651].velocity *= 3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.Kill(); + } + } +} diff --git a/Projectiles/Melee/DemonBlast.cs b/Projectiles/Melee/DemonBlast.cs index 64984812ac..435e0dfdc5 100644 --- a/Projectiles/Melee/DemonBlast.cs +++ b/Projectiles/Melee/DemonBlast.cs @@ -1,134 +1,134 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DemonBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = -1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 300); - projectile.Kill(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DemonBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.aiStyle = 1; + projectile.penetrate = -1; + projectile.extraUpdates = 5; + projectile.tileCollide = false; + projectile.melee = true; + } + + public override void AI() + { + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.ShadowFlame, 300); + projectile.Kill(); + } + } +} diff --git a/Projectiles/Melee/DemonBlastType2.cs b/Projectiles/Melee/DemonBlastType2.cs index 2f21066b88..6203560f03 100644 --- a/Projectiles/Melee/DemonBlastType2.cs +++ b/Projectiles/Melee/DemonBlastType2.cs @@ -1,134 +1,134 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DemonBlastType2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default(Color), 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - projectile.Kill(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DemonBlastType2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.aiStyle = 1; + projectile.penetrate = 1; + projectile.extraUpdates = 5; + projectile.tileCollide = false; + projectile.melee = true; + } + + public override void AI() + { + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default(Color), 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + projectile.Kill(); + } + } +} diff --git a/Projectiles/Melee/DemonBlastType3.cs b/Projectiles/Melee/DemonBlastType3.cs index 3d3b037acb..6911cc2fb2 100644 --- a/Projectiles/Melee/DemonBlastType3.cs +++ b/Projectiles/Melee/DemonBlastType3.cs @@ -1,134 +1,134 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DemonBlastType3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 0, default(Color), 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 100, default(Color), 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GlacialState"), 120); - projectile.Kill(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DemonBlastType3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.aiStyle = 1; + projectile.penetrate = 1; + projectile.extraUpdates = 5; + projectile.tileCollide = false; + projectile.melee = true; + } + + public override void AI() + { + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 0, default(Color), 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 100, default(Color), 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GlacialState"), 120); + projectile.Kill(); + } + } +} diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index 23abc239e5..34ce8ed9d1 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DepthOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 30; - projectile.penetrate = 1; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0f, 0.65f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - 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); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.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; - } - projectile.Damage(); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DepthOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 30; + projectile.penetrate = 1; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0f, 0.65f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + 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); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.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; + } + projectile.Damage(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 300); + } + } +} diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index 26d82fec1b..1dd87a331d 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -1,67 +1,67 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DepthOrb2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 60; - projectile.penetrate = 1; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - for (int dust = 0; dust <= 5; dust++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.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; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DepthOrb2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 60; + projectile.penetrate = 1; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 0.8f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + for (int dust = 0; dust <= 5; dust++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.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; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 300); + } + } +} diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index 29df1eba72..5e1ed22bff 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -1,76 +1,76 @@ -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 DracoBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 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; - } - - public override void Kill(int timeLeft) - { - float spread = 30f * 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) - { - for (i = 0; i < 4; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("DracoBeam2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("DracoBeam2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 600); - } - } -} \ No newline at end of file +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 DracoBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 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; + } + + public override void Kill(int timeLeft) + { + float spread = 30f * 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) + { + for (i = 0; i < 4; i++ ) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("DracoBeam2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("DracoBeam2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 600); + } + } +} diff --git a/Projectiles/Melee/DracoBeam2.cs b/Projectiles/Melee/DracoBeam2.cs index cbc9c85ab1..bc8c1d96cb 100644 --- a/Projectiles/Melee/DracoBeam2.cs +++ b/Projectiles/Melee/DracoBeam2.cs @@ -1,84 +1,84 @@ -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 DracoBeam2 : ModProjectile - { - private int start = 60; - private int speedTimer = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 240; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - start--; - if (start <= 0) - { - speedTimer--; - if (speedTimer > 60) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = 10f; - } - else if (speedTimer <= 60) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -10f; - } - if (speedTimer <= 0) - { - speedTimer = 120; - } - } - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 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; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 600); - } - } -} \ No newline at end of file +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 DracoBeam2 : ModProjectile + { + private int start = 60; + private int speedTimer = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 240; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + start--; + if (start <= 0) + { + speedTimer--; + if (speedTimer > 60) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = 10f; + } + else if (speedTimer <= 60) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -10f; + } + if (speedTimer <= 0) + { + speedTimer = 120; + } + } + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 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; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 600); + } + } +} diff --git a/Projectiles/Melee/DragonRage.cs b/Projectiles/Melee/DragonRage.cs index f4f909a2a8..a610824baf 100644 --- a/Projectiles/Melee/DragonRage.cs +++ b/Projectiles/Melee/DragonRage.cs @@ -1,126 +1,126 @@ -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 DragonRage : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rage"); - } - - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 120; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - if (projectile.localAI[1] <= 60f) - { - projectile.localAI[1] += 1f; - projectile.tileCollide = false; - } - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - 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; - } - - public override void Kill(int timeLeft) - { - 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 = 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 < 6; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 9; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 2; 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; - } - } - } -} \ No newline at end of file +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 DragonRage : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rage"); + } + + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 70; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.extraUpdates = 3; + projectile.timeLeft = 120; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + if (projectile.localAI[1] <= 60f) + { + projectile.localAI[1] += 1f; + projectile.tileCollide = false; + } + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + 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; + } + + public override void Kill(int timeLeft) + { + 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 = 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 < 6; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 9; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 2; 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; + } + } + } +} diff --git a/Projectiles/Melee/Earth.cs b/Projectiles/Melee/Earth.cs index 5058e54e44..4f5feda8ff 100644 --- a/Projectiles/Melee/Earth.cs +++ b/Projectiles/Melee/Earth.cs @@ -1,155 +1,155 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Earth : ModProjectile - { - private int noTileHitCounter = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = 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.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - int dustChoice = Main.rand.Next(3); - if (dustChoice == 0) - { - dustChoice = 74; - } - else if (dustChoice == 1) - { - dustChoice = 229; - } - else - { - dustChoice = 244; - } - 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, dustChoice, 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 (Main.rand.Next(48) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.Next(10) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); - } - 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); - } - } - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); - } - - public override void Kill(int timeLeft) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; - double deltaAngle = spread/8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++ ) - { - int projChoice = Main.rand.Next(3); - if (projChoice == 0) - { - projChoice = mod.ProjectileType("Earth2"); - } - else if (projChoice == 1) - { - projChoice = mod.ProjectileType("Earth3"); - } - else - { - projChoice = mod.ProjectileType("Earth4"); - } - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projChoice, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projChoice, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 15; k++) - { - int dustChoice = Main.rand.Next(3); - if (dustChoice == 0) - { - dustChoice = 74; - } - else if (dustChoice == 1) - { - dustChoice = 229; - } - else - { - dustChoice = 244; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(BuffID.CursedInferno, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Earth : ModProjectile + { + private int noTileHitCounter = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = 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.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + int dustChoice = Main.rand.Next(3); + if (dustChoice == 0) + { + dustChoice = 74; + } + else if (dustChoice == 1) + { + dustChoice = 229; + } + else + { + dustChoice = 244; + } + 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, dustChoice, 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 (Main.rand.Next(48) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + 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); + } + } + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + } + + public override void Kill(int timeLeft) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y)- spread/2; + double deltaAngle = spread/8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++ ) + { + int projChoice = Main.rand.Next(3); + if (projChoice == 0) + { + projChoice = mod.ProjectileType("Earth2"); + } + else if (projChoice == 1) + { + projChoice = mod.ProjectileType("Earth3"); + } + else + { + projChoice = mod.ProjectileType("Earth4"); + } + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), projChoice, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), projChoice, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 15; k++) + { + int dustChoice = Main.rand.Next(3); + if (dustChoice == 0) + { + dustChoice = 74; + } + else if (dustChoice == 1) + { + dustChoice = 229; + } + else + { + dustChoice = 244; + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustChoice, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + target.AddBuff(BuffID.CursedInferno, 600); + } + } +} diff --git a/Projectiles/Melee/Earth2.cs b/Projectiles/Melee/Earth2.cs index cf81946631..229525cef0 100644 --- a/Projectiles/Melee/Earth2.cs +++ b/Projectiles/Melee/Earth2.cs @@ -1,103 +1,103 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Earth2 : ModProjectile - { - private int noTileHitCounter = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 300; - 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.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - 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, 229, 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 (Main.rand.Next(48) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.Next(10) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); - } - 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); - } - } - Lighting.AddLight(projectile.Center, 0f, 0f, 1.5f); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 15; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GlacialState"), 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Earth2 : ModProjectile + { + private int noTileHitCounter = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 300; + 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.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + 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, 229, 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 (Main.rand.Next(48) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + 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); + } + } + Lighting.AddLight(projectile.Center, 0f, 0f, 1.5f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 15; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GlacialState"), 600); + } + } +} diff --git a/Projectiles/Melee/Earth3.cs b/Projectiles/Melee/Earth3.cs index 358fcd371d..5cd5551fe0 100644 --- a/Projectiles/Melee/Earth3.cs +++ b/Projectiles/Melee/Earth3.cs @@ -1,159 +1,159 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Earth3 : ModProjectile - { - private int noTileHitCounter = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 300; - 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.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - 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, 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 (Main.rand.Next(48) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.Next(10) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); - } - 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); - } - } - Lighting.AddLight(projectile.Center, 1.5f, 0f, 0f); - } - - public override void Kill(int timeLeft) - { - 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 = 30; - projectile.height = 30; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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("HolyLight"), 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Earth3 : ModProjectile + { + private int noTileHitCounter = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 300; + 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.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + 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, 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 (Main.rand.Next(48) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + 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); + } + } + Lighting.AddLight(projectile.Center, 1.5f, 0f, 0f); + } + + public override void Kill(int timeLeft) + { + 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 = 30; + projectile.height = 30; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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("HolyLight"), 600); + } + } +} diff --git a/Projectiles/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs index c2eae22709..672539c6f4 100644 --- a/Projectiles/Melee/Earth4.cs +++ b/Projectiles/Melee/Earth4.cs @@ -1,115 +1,115 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Earth4 : ModProjectile - { - private int noTileHitCounter = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Earth"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 300; - 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.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - 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, 74, 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 (Main.rand.Next(48) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.Next(10) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); - } - 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); - } - } - Lighting.AddLight(projectile.Center, 0f, 1.5f, 0f); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 15; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 4); - float num = (float)damage * 0.075f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("EarthHealOrb"), 0, 0f, projectile.owner, (float)num2, num); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Earth4 : ModProjectile + { + private int noTileHitCounter = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Earth"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 300; + 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.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + 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, 74, 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 (Main.rand.Next(48) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + 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); + } + } + Lighting.AddLight(projectile.Center, 0f, 1.5f, 0f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 15; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 4); + float num = (float)damage * 0.075f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("EarthHealOrb"), 0, 0f, projectile.owner, (float)num2, num); + } + } +} diff --git a/Projectiles/Melee/ElementBall.cs b/Projectiles/Melee/ElementBall.cs index 615542e7c2..e8721762bf 100644 --- a/Projectiles/Melee/ElementBall.cs +++ b/Projectiles/Melee/ElementBall.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class ElementBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.tileCollide = false; - projectile.timeLeft = 150; - } - - public override void AI() - { - 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), 1f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - 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 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ElementBall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.tileCollide = false; + projectile.timeLeft = 150; + } + + public override void AI() + { + 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), 1f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + 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 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + } + } +} diff --git a/Projectiles/Melee/ElementBallShiv.cs b/Projectiles/Melee/ElementBallShiv.cs index aa87a30ef1..1f17d02ce3 100644 --- a/Projectiles/Melee/ElementBallShiv.cs +++ b/Projectiles/Melee/ElementBallShiv.cs @@ -1,110 +1,110 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class ElementBallShiv : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 60; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - 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), 1.3f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - } - } - 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 = Main.rand.Next(35, 40); - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 7; k++) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - float random = (float)Main.rand.Next(1, 150); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i <= 3; i++) - { - speedX *= dir * random; - speedY *= dir * random; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("SHIV"), projectile.damage, 1f, projectile.owner); - } - } - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ElementBallShiv : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 60; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + 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), 1.3f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + } + } + 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 = Main.rand.Next(35, 40); + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 7; k++) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); + + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + float random = (float)Main.rand.Next(1, 150); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i <= 3; i++) + { + speedX *= dir * random; + speedY *= dir * random; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("SHIV"), projectile.damage, 1f, projectile.owner); + } + } + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + } + } +} diff --git a/Projectiles/Melee/EonBeam.cs b/Projectiles/Melee/EonBeam.cs index 92381dbafb..ab12175641 100644 --- a/Projectiles/Melee/EonBeam.cs +++ b/Projectiles/Melee/EonBeam.cs @@ -1,72 +1,72 @@ -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 EonBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - aiType = 173; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - if (projectile.localAI[1] > 7f) - { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); - Main.dust[num308].velocity *= 0.1f; - Main.dust[num308].noGravity = true; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 100, 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; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 7; k++) - { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); - Main.dust[num308].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +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 EonBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + aiType = 173; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + if (projectile.localAI[1] > 7f) + { + int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + Main.dust[num308].velocity *= 0.1f; + Main.dust[num308].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 100, 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; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 7; k++) + { + int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 100, 255), 1.2f); + Main.dust[num308].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Melee/EonBeamV2.cs b/Projectiles/Melee/EonBeamV2.cs index 9391700db3..3e51048091 100644 --- a/Projectiles/Melee/EonBeamV2.cs +++ b/Projectiles/Melee/EonBeamV2.cs @@ -1,72 +1,72 @@ -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 EonBeamV2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - aiType = 173; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - if (projectile.localAI[1] > 7f) - { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(53, Main.DiscoG, 255), 1.2f); - Main.dust[num308].velocity *= 0.1f; - Main.dust[num308].noGravity = true; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(53, Main.DiscoG, 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; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 7; k++) - { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(53, Main.DiscoG, 255), 1.2f); - Main.dust[num308].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +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 EonBeamV2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + aiType = 173; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + if (projectile.localAI[1] > 7f) + { + int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(53, Main.DiscoG, 255), 1.2f); + Main.dust[num308].velocity *= 0.1f; + Main.dust[num308].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(53, Main.DiscoG, 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; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 7; k++) + { + int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(53, Main.DiscoG, 255), 1.2f); + Main.dust[num308].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Melee/EonBeamV3.cs b/Projectiles/Melee/EonBeamV3.cs index d3f92a58b7..aac7a89826 100644 --- a/Projectiles/Melee/EonBeamV3.cs +++ b/Projectiles/Melee/EonBeamV3.cs @@ -1,73 +1,73 @@ -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 EonBeamV3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.timeLeft = 200; - aiType = 173; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - if (projectile.localAI[1] > 7f) - { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num308].velocity *= 0.1f; - Main.dust[num308].noGravity = true; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, 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; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 7; k++) - { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num308].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +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 EonBeamV3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 3; + projectile.timeLeft = 200; + aiType = 173; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + if (projectile.localAI[1] > 7f) + { + int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num308].velocity *= 0.1f; + Main.dust[num308].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 203, 103, 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; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 7; k++) + { + int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num308].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Melee/EonBeamV4.cs b/Projectiles/Melee/EonBeamV4.cs index 9530af552d..dbafe8f6b3 100644 --- a/Projectiles/Melee/EonBeamV4.cs +++ b/Projectiles/Melee/EonBeamV4.cs @@ -1,73 +1,73 @@ -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 EonBeamV4 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 3; - projectile.timeLeft = 200; - aiType = 173; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - if (projectile.localAI[1] > 7f) - { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(255, Main.DiscoG, 53), 1.2f); - Main.dust[num308].velocity *= 0.1f; - Main.dust[num308].noGravity = true; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, 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; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 7; k++) - { - int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(255, Main.DiscoG, 53), 1.2f); - Main.dust[num308].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +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 EonBeamV4 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 3; + projectile.timeLeft = 200; + aiType = 173; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.3f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + if (projectile.localAI[1] > 7f) + { + int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(255, Main.DiscoG, 53), 1.2f); + Main.dust[num308].velocity *= 0.1f; + Main.dust[num308].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, 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; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 7; k++) + { + int num308 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 150, new Color(255, Main.DiscoG, 53), 1.2f); + Main.dust[num308].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Melee/EradicatorMeleeProjectile.cs b/Projectiles/Melee/EradicatorMeleeProjectile.cs index a868059232..7c4f0ac858 100644 --- a/Projectiles/Melee/EradicatorMeleeProjectile.cs +++ b/Projectiles/Melee/EradicatorMeleeProjectile.cs @@ -1,108 +1,108 @@ -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 EradicatorMeleeProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - } - - public override void SetDefaults() - { - projectile.width = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 180; - aiType = 52; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.03f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.Next(2) == 0) - { - if (projectile.owner == Main.myPlayer) - { - 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; - } - } - } - } - } - - 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/EradicatorMeleeProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } -} \ No newline at end of file +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 EradicatorMeleeProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + } + + public override void SetDefaults() + { + projectile.width = 58; + projectile.height = 58; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 180; + aiType = 52; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.03f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.Next(2) == 0) + { + if (projectile.owner == Main.myPlayer) + { + 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; + } + } + } + } + } + + 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(31f, 29f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/EradicatorMeleeProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } +} diff --git a/Projectiles/Melee/EssenceBeam.cs b/Projectiles/Melee/EssenceBeam.cs index 56145e2f16..85780a148e 100644 --- a/Projectiles/Melee/EssenceBeam.cs +++ b/Projectiles/Melee/EssenceBeam.cs @@ -1,52 +1,52 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class EssenceBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 120; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - target.immune[projectile.owner] = 2; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EssenceBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 120; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 3f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 1f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + target.immune[projectile.owner] = 2; + } + } +} diff --git a/Projectiles/Melee/EssenceBurst.cs b/Projectiles/Melee/EssenceBurst.cs index 5fd8d55bec..0b827af829 100644 --- a/Projectiles/Melee/EssenceBurst.cs +++ b/Projectiles/Melee/EssenceBurst.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class EssenceBurst : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burst"); - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - aiType = 348; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 120; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EssenceBurst : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burst"); + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + aiType = 348; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 120; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + } +} diff --git a/Projectiles/Melee/EssenceFlame2.cs b/Projectiles/Melee/EssenceFlame2.cs index e54616740d..0fee171ea6 100644 --- a/Projectiles/Melee/EssenceFlame2.cs +++ b/Projectiles/Melee/EssenceFlame2.cs @@ -1,108 +1,108 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class EssenceFlame2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.extraUpdates = 3; - } - - public override void AI() - { - projectile.alpha -= 5; - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EssenceFlame2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.melee = true; + projectile.timeLeft = 600; + projectile.alpha = 255; + projectile.extraUpdates = 3; + } + + public override void AI() + { + projectile.alpha -= 5; + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 0d4e022797..df7a232b22 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class EssenceScythe : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.alpha = 55; - projectile.penetrate = 10; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - aiType = 274; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.65f) / 255f); - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 18f; - 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 Color? GetAlpha(Color lightColor) - { - return new Color(150, 0, 200, 0); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 2; - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - if (target.life <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, mod.ProjectileType("EssenceFlame"), 0, 0, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EssenceScythe : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 18; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.alpha = 55; + projectile.penetrate = 10; + projectile.timeLeft = 300; + projectile.ignoreWater = true; + aiType = 274; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.65f) / 255f); + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 18f; + 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 Color? GetAlpha(Color lightColor) + { + return new Color(150, 0, 200, 0); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 2; + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + if (target.life <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, mod.ProjectileType("EssenceFlame"), 0, 0, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Melee/Excelsus.cs b/Projectiles/Melee/Excelsus.cs index f65afc7e30..4f6ac8328b 100644 --- a/Projectiles/Melee/Excelsus.cs +++ b/Projectiles/Melee/Excelsus.cs @@ -1,104 +1,104 @@ -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 Excelsus : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Excelsus"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.alpha = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 20f && projectile.timeLeft > 85) - { - projectile.velocity *= 1.05f; - } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) - { - projectile.velocity *= 0.98f; - } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; - if (Main.rand.Next(8) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (Main.rand.Next(3) == 0 ? 56 : 242), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.tileCollide = false; - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - return false; - } - - 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 default(Color); - } - - 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Color color = default(Color); - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - color = new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - else - { - color = new Color(255, 255, 255, 100); - } - Vector2 origin = new Vector2(39f, 46f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } -} \ No newline at end of file +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 Excelsus : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Excelsus"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + projectile.alpha = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 20f && projectile.timeLeft > 85) + { + projectile.velocity *= 1.05f; + } + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) + { + projectile.velocity *= 0.98f; + } + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + if (Main.rand.Next(8) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (Main.rand.Next(3) == 0 ? 56 : 242), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.tileCollide = false; + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + return false; + } + + 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 default(Color); + } + + 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Color color = default(Color); + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + color = new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + else + { + color = new Color(255, 255, 255, 100); + } + Vector2 origin = new Vector2(39f, 46f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } +} diff --git a/Projectiles/Melee/ExcelsusBlue.cs b/Projectiles/Melee/ExcelsusBlue.cs index 02515d1e17..16b245e3a6 100644 --- a/Projectiles/Melee/ExcelsusBlue.cs +++ b/Projectiles/Melee/ExcelsusBlue.cs @@ -1,103 +1,103 @@ -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 ExcelsusBlue : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Excelsus"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.alpha = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft > 85) - { - projectile.velocity *= 1.05f; - } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) - { - projectile.velocity *= 0.98f; - } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; - if (Main.rand.Next(8) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.tileCollide = false; - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - return false; - } - - 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 default(Color); - } - - 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Color color = default(Color); - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - color = new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - else - { - color = new Color(255, 255, 255, 100); - } - Vector2 origin = new Vector2(39f, 46f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusBlueGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - target.AddBuff(BuffID.Frostburn, 600); - } - } -} \ No newline at end of file +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 ExcelsusBlue : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Excelsus"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + projectile.alpha = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft > 85) + { + projectile.velocity *= 1.05f; + } + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) + { + projectile.velocity *= 0.98f; + } + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + if (Main.rand.Next(8) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.tileCollide = false; + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + return false; + } + + 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 default(Color); + } + + 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Color color = default(Color); + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + color = new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + else + { + color = new Color(255, 255, 255, 100); + } + Vector2 origin = new Vector2(39f, 46f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusBlueGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + target.AddBuff(BuffID.Frostburn, 600); + } + } +} diff --git a/Projectiles/Melee/ExcelsusPink.cs b/Projectiles/Melee/ExcelsusPink.cs index 169e595c89..c64301c875 100644 --- a/Projectiles/Melee/ExcelsusPink.cs +++ b/Projectiles/Melee/ExcelsusPink.cs @@ -1,103 +1,103 @@ -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 ExcelsusPink : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Excelsus"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.alpha = 100; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 24f && projectile.timeLeft > 85) - { - projectile.velocity *= 1.05f; - } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) - { - projectile.velocity *= 0.98f; - } - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; - if (Main.rand.Next(8) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 242, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.tileCollide = false; - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - return false; - } - - 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 default(Color); - } - - 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Color color = default(Color); - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - color = new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - else - { - color = new Color(255, 255, 255, 100); - } - Vector2 origin = new Vector2(39f, 46f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusPinkGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.timeLeft > 85) - { - projectile.timeLeft = 85; - } - target.AddBuff(BuffID.OnFire, 600); - } - } -} \ No newline at end of file +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 ExcelsusPink : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Excelsus"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + projectile.alpha = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 24f && projectile.timeLeft > 85) + { + projectile.velocity *= 1.05f; + } + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 0f && projectile.timeLeft <= 85) + { + projectile.velocity *= 0.98f; + } + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + if (Main.rand.Next(8) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 242, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.tileCollide = false; + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + return false; + } + + 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 default(Color); + } + + 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Color color = default(Color); + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + color = new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + else + { + color = new Color(255, 255, 255, 100); + } + Vector2 origin = new Vector2(39f, 46f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ExcelsusPinkGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.timeLeft > 85) + { + projectile.timeLeft = 85; + } + target.AddBuff(BuffID.OnFire, 600); + } + } +} diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 338210cd8a..75091c3830 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -1,183 +1,183 @@ -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 Exobeam : ModProjectile - { - private int counter = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 1f; - } - - public override void AI() - { - if (projectile.localAI[1] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.localAI[1] += 1f; - } - counter++; - if (counter == 12) - { - counter = 0; - 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, 107, 0f, 0f, 160, new Color(0, 255, 255), 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 -= 40; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[0] == 0f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - } - else if (projectile.ai[0] == 1f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 2f; - projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); - projectile.netUpdate = true; - } - } - else if (projectile.ai[0] == 2f) - { - Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; - if (vector70.Length() < 30f) - { - projectile.Kill(); - return; - } - vector70.Normalize(); - vector70 *= 14f; - vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); - if (vector70.Y < 24f) - { - vector70.Y = 24f; - } - float num804 = 0.4f; - 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; - } - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 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; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103); - projectile.position = projectile.Center; - projectile.width = (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 num193 = 0; num193 < 3; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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 Exobeam : ModProjectile + { + private int counter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.light = 1f; + } + + public override void AI() + { + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + projectile.localAI[1] += 1f; + } + counter++; + if (counter == 12) + { + counter = 0; + 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, 107, 0f, 0f, 160, new Color(0, 255, 255), 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 -= 40; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.ai[0] == 0f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 90f) + { + projectile.localAI[0] = 0f; + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + } + else if (projectile.ai[0] == 1f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.localAI[0] = 0f; + projectile.ai[0] = 2f; + projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); + projectile.netUpdate = true; + } + } + else if (projectile.ai[0] == 2f) + { + Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; + if (vector70.Length() < 30f) + { + projectile.Kill(); + return; + } + vector70.Normalize(); + vector70 *= 14f; + vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); + if (vector70.Y < 24f) + { + vector70.Y = 24f; + } + float num804 = 0.4f; + 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; + } + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 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; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103); + projectile.position = projectile.Center; + projectile.width = (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 num193 = 0; num193 < 3; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Melee/Exoboom.cs b/Projectiles/Melee/Exoboom.cs index 036f0753b1..55d934d847 100644 --- a/Projectiles/Melee/Exoboom.cs +++ b/Projectiles/Melee/Exoboom.cs @@ -1,110 +1,110 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Exoboom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 30; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - 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, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - 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, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Exoboom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 250; + projectile.height = 250; + projectile.friendly = true; + projectile.ignoreWater = false; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + 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, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + 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, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + } +} diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index 63a555a526..0c00e7f734 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -1,144 +1,144 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Exocomet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Comet"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 1; - projectile.alpha = 50; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - float num953 = 100f * projectile.ai[1]; //100 - float scaleFactor12 = 20f * projectile.ai[1]; //5 - float num954 = 40f; - if (projectile.timeLeft > 30 && projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha = 128; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha < 40) - { - int num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); - Main.dust[num309].velocity *= -0.25f; - num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); - Main.dust[num309].velocity *= -0.25f; - Main.dust[num309].position -= projectile.velocity * 0.5f; - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.5f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.01f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("Exoheal"), 0, 0f, projectile.owner, (float)num2, num); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 255, 255, projectile.alpha); - } - - 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 = 80); - 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, 107, 0f, 0f, 100, new Color(0, 255, 255), 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, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Exocomet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = 1; + projectile.alpha = 50; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + float num953 = 100f * projectile.ai[1]; //100 + float scaleFactor12 = 20f * projectile.ai[1]; //5 + float num954 = 40f; + if (projectile.timeLeft > 30 && projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha = 128; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.alpha < 40) + { + int num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + Main.dust[num309].velocity *= -0.25f; + num309 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, new Color(0, 255, 255), 0.5f); + Main.dust[num309].velocity *= -0.25f; + Main.dust[num309].position -= projectile.velocity * 0.5f; + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.5f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + if (target.type == NPCID.TargetDummy) + { + return; + } + float num = (float)damage * 0.01f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("Exoheal"), 0, 0f, projectile.owner, (float)num2, num); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 255, 255, projectile.alpha); + } + + 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 = 80); + 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, 107, 0f, 0f, 100, new Color(0, 255, 255), 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, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } +} diff --git a/Projectiles/Melee/Feather.cs b/Projectiles/Melee/Feather.cs index f84bb4e99e..e558a5ed79 100644 --- a/Projectiles/Melee/Feather.cs +++ b/Projectiles/Melee/Feather.cs @@ -40,4 +40,4 @@ namespace CalamityMod.Projectiles.Melee } } } -} \ No newline at end of file +} diff --git a/Projectiles/Melee/FlameScytheProjectileMelee.cs b/Projectiles/Melee/FlameScytheProjectileMelee.cs index 5e395c68a5..14be90fa75 100644 --- a/Projectiles/Melee/FlameScytheProjectileMelee.cs +++ b/Projectiles/Melee/FlameScytheProjectileMelee.cs @@ -1,72 +1,72 @@ -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 FlameScytheProjectileMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.alpha = 55; - aiType = 52; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - 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); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - 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; - } - - 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.immune[projectile.owner] = 6; - target.AddBuff(BuffID.OnFire, 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); - } - } - } -} \ No newline at end of file +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 FlameScytheProjectileMelee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + projectile.alpha = 55; + aiType = 52; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + 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); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + + 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.immune[projectile.owner] = 6; + target.AddBuff(BuffID.OnFire, 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); + } + } + } +} diff --git a/Projectiles/Melee/Flarefrost.cs b/Projectiles/Melee/Flarefrost.cs index 904475aa17..c7ab534cb5 100644 --- a/Projectiles/Melee/Flarefrost.cs +++ b/Projectiles/Melee/Flarefrost.cs @@ -1,125 +1,125 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Flarefrost : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flarefrost"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.02f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - for (int num92 = 0; num92 < 3; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 67, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; - } - if (Main.rand.Next(5) == 0) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 67, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - for (int num105 = 0; num105 < 3; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 6, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; - } - if (Main.rand.Next(5) == 0) - { - int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 6, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; - } - 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 = 11f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 2; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, 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.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Flarefrost : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flarefrost"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.02f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num92 = 0; num92 < 3; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 67, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + } + if (Main.rand.Next(5) == 0) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 67, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } + for (int num105 = 0; num105 < 3; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 6, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + } + if (Main.rand.Next(5) == 0) + { + int num103 = 4; + int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 6, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num104].velocity *= 0.25f; + Main.dust[num104].velocity += projectile.velocity * 0.5f; + } + 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 = 11f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 2; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, 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.OnFire, 300); + target.AddBuff(BuffID.Frostburn, 300); + } + } +} diff --git a/Projectiles/Melee/FossilSpike.cs b/Projectiles/Melee/FossilSpike.cs index 1bb795c361..3b91d3054f 100644 --- a/Projectiles/Melee/FossilSpike.cs +++ b/Projectiles/Melee/FossilSpike.cs @@ -1,47 +1,47 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class FossilSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 40; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.melee = true; - } - - public override void AI() - { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class FossilSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 40; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.melee = true; + } + + public override void AI() + { + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Melee/GalacticaComet.cs b/Projectiles/Melee/GalacticaComet.cs index 0c0720c1c0..d1c1bd481d 100644 --- a/Projectiles/Melee/GalacticaComet.cs +++ b/Projectiles/Melee/GalacticaComet.cs @@ -1,138 +1,138 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GalacticaComet : ModProjectile - { - private int noTileHitCounter = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Comet"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = 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 ? 164 : 229), 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, 164, 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 (Main.rand.Next(48) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.5f; - if (Main.rand.Next(10) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); - } - 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); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 100, 255, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - 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, 164, 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, 229, 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, 229, 0f, 0f, 50, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GalacticaComet : ModProjectile + { + private int noTileHitCounter = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = 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 ? 164 : 229), 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, 164, 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 (Main.rand.Next(48) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.5f; + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + 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); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 100, 255, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + 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, 164, 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, 229, 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, 229, 0f, 0f, 50, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Frostburn, 300); + } + } +} diff --git a/Projectiles/Melee/Galaxia.cs b/Projectiles/Melee/Galaxia.cs index df3e6d106a..10cbec1fea 100644 --- a/Projectiles/Melee/Galaxia.cs +++ b/Projectiles/Melee/Galaxia.cs @@ -1,256 +1,256 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Galaxia : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 50; - projectile.penetrate = 3; - projectile.timeLeft = 240; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } - - public override void AI() - { - 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.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (Main.rand.Next(8) == 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, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.Next(24) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.Next(5) == 0) - { - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - } - 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); - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1600f; - 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 = 35f; - 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 Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - bool nebula = player.ZoneTowerNebula; - bool stardust = player.ZoneTowerStardust; - bool solar = player.ZoneTowerSolar; - bool vortex = player.ZoneTowerVortex; - bool bloodMoon = Main.bloodMoon; - bool snowMoon = Main.snowMoon; - bool pumpkinMoon = Main.pumpkinMoon; - if (bloodMoon) - { - player.AddBuff(BuffID.Battle, 600); - } - if (snowMoon) - { - player.AddBuff(BuffID.RapidHealing, 600); - } - if (pumpkinMoon) - { - player.AddBuff(BuffID.WellFed, 600); - } - if (jungle) - { - target.AddBuff(mod.BuffType("Plague"), 1200); - player.AddBuff(BuffID.Thorns, 600); - 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); - player.AddBuff(BuffID.Warmth, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 118, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (beach) - { - target.AddBuff(mod.BuffType("CrushDepth"), 1200); - player.AddBuff(BuffID.Wet, 600); - 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].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].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].GetGlobalProjectile(mod).forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 1200); - player.AddBuff(BuffID.Endurance, 600); - 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); - 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); - 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); - 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); - 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].GetGlobalProjectile(mod).forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (solar) - { - player.AddBuff(BuffID.Titan, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (vortex) - { - player.AddBuff(BuffID.AmmoReservation, 600); - 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); - player.AddBuff(BuffID.DryadsWard, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 604, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Galaxia : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.alpha = 50; + projectile.penetrate = 3; + projectile.timeLeft = 240; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + + public override void AI() + { + 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.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + if (Main.rand.Next(8) == 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, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].noGravity = true; + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.Next(24) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.Next(5) == 0) + { + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].noGravity = true; + } + 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); + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1600f; + 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 = 35f; + 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 Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + bool nebula = player.ZoneTowerNebula; + bool stardust = player.ZoneTowerStardust; + bool solar = player.ZoneTowerSolar; + bool vortex = player.ZoneTowerVortex; + bool bloodMoon = Main.bloodMoon; + bool snowMoon = Main.snowMoon; + bool pumpkinMoon = Main.pumpkinMoon; + if (bloodMoon) + { + player.AddBuff(BuffID.Battle, 600); + } + if (snowMoon) + { + player.AddBuff(BuffID.RapidHealing, 600); + } + if (pumpkinMoon) + { + player.AddBuff(BuffID.WellFed, 600); + } + if (jungle) + { + target.AddBuff(mod.BuffType("Plague"), 1200); + player.AddBuff(BuffID.Thorns, 600); + 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); + player.AddBuff(BuffID.Warmth, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 118, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (beach) + { + target.AddBuff(mod.BuffType("CrushDepth"), 1200); + player.AddBuff(BuffID.Wet, 600); + 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].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].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].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 1200); + player.AddBuff(BuffID.Endurance, 600); + 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); + 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); + 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); + 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); + 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].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (solar) + { + player.AddBuff(BuffID.Titan, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (vortex) + { + player.AddBuff(BuffID.AmmoReservation, 600); + 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); + player.AddBuff(BuffID.DryadsWard, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 604, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + } + } +} diff --git a/Projectiles/Melee/Galaxia2.cs b/Projectiles/Melee/Galaxia2.cs index 93dd7d3536..ae1d654ecf 100644 --- a/Projectiles/Melee/Galaxia2.cs +++ b/Projectiles/Melee/Galaxia2.cs @@ -1,255 +1,255 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Galaxia2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.alpha = 50; - projectile.penetrate = 2; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - 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.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (Main.rand.Next(8) == 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, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].noGravity = true; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.Next(24) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.Next(5) == 0) - { - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - } - 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); - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1600f; - 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 = 35f; - 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 Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - bool nebula = player.ZoneTowerNebula; - bool stardust = player.ZoneTowerStardust; - bool solar = player.ZoneTowerSolar; - bool vortex = player.ZoneTowerVortex; - bool bloodMoon = Main.bloodMoon; - bool snowMoon = Main.snowMoon; - bool pumpkinMoon = Main.pumpkinMoon; - if (bloodMoon) - { - player.AddBuff(BuffID.Battle, 600); - } - if (snowMoon) - { - player.AddBuff(BuffID.RapidHealing, 600); - } - if (pumpkinMoon) - { - player.AddBuff(BuffID.WellFed, 600); - } - if (jungle) - { - target.AddBuff(mod.BuffType("Plague"), 1200); - player.AddBuff(BuffID.Thorns, 600); - 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); - player.AddBuff(BuffID.Warmth, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 118, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (beach) - { - target.AddBuff(mod.BuffType("CrushDepth"), 1200); - player.AddBuff(BuffID.Wet, 600); - 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].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].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].GetGlobalProjectile(mod).forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 1200); - player.AddBuff(BuffID.Endurance, 600); - 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); - 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); - 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); - 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); - 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].GetGlobalProjectile(mod).forceMelee = true; - Main.projectile[ball].penetrate = 1; - } - else if (solar) - { - player.AddBuff(BuffID.Titan, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else if (vortex) - { - player.AddBuff(BuffID.AmmoReservation, 600); - 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); - player.AddBuff(BuffID.DryadsWard, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 604, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Galaxia2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.alpha = 50; + projectile.penetrate = 2; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + 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.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + if (Main.rand.Next(8) == 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, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].noGravity = true; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.Next(24) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.Next(5) == 0) + { + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].noGravity = true; + } + 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); + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1600f; + 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 = 35f; + 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 Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + bool nebula = player.ZoneTowerNebula; + bool stardust = player.ZoneTowerStardust; + bool solar = player.ZoneTowerSolar; + bool vortex = player.ZoneTowerVortex; + bool bloodMoon = Main.bloodMoon; + bool snowMoon = Main.snowMoon; + bool pumpkinMoon = Main.pumpkinMoon; + if (bloodMoon) + { + player.AddBuff(BuffID.Battle, 600); + } + if (snowMoon) + { + player.AddBuff(BuffID.RapidHealing, 600); + } + if (pumpkinMoon) + { + player.AddBuff(BuffID.WellFed, 600); + } + if (jungle) + { + target.AddBuff(mod.BuffType("Plague"), 1200); + player.AddBuff(BuffID.Thorns, 600); + 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); + player.AddBuff(BuffID.Warmth, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 118, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (beach) + { + target.AddBuff(mod.BuffType("CrushDepth"), 1200); + player.AddBuff(BuffID.Wet, 600); + 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].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].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].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 1200); + player.AddBuff(BuffID.Endurance, 600); + 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); + 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); + 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); + 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); + 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].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; + } + else if (solar) + { + player.AddBuff(BuffID.Titan, 600); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (vortex) + { + player.AddBuff(BuffID.AmmoReservation, 600); + 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); + player.AddBuff(BuffID.DryadsWard, 600); + int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 604, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[ball].penetrate = 1; + } + } + } +} diff --git a/Projectiles/Melee/GalaxyBlast.cs b/Projectiles/Melee/GalaxyBlast.cs index f35b98bee3..b4229335db 100644 --- a/Projectiles/Melee/GalaxyBlast.cs +++ b/Projectiles/Melee/GalaxyBlast.cs @@ -1,134 +1,134 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GalaxyBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = -1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default(Color), 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default(Color), 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - projectile.Kill(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GalaxyBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.aiStyle = 1; + projectile.penetrate = -1; + projectile.extraUpdates = 5; + projectile.tileCollide = false; + projectile.melee = true; + } + + public override void AI() + { + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default(Color), 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default(Color), 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + projectile.Kill(); + } + } +} diff --git a/Projectiles/Melee/GalaxyBlastType2.cs b/Projectiles/Melee/GalaxyBlastType2.cs index 81f28e9b2d..9af86ad68c 100644 --- a/Projectiles/Melee/GalaxyBlastType2.cs +++ b/Projectiles/Melee/GalaxyBlastType2.cs @@ -1,134 +1,134 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GalaxyBlastType2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default(Color), 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default(Color), 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 600); - projectile.Kill(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GalaxyBlastType2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.aiStyle = 1; + projectile.penetrate = 1; + projectile.extraUpdates = 5; + projectile.tileCollide = false; + projectile.melee = true; + } + + public override void AI() + { + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default(Color), 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default(Color), 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 600); + projectile.Kill(); + } + } +} diff --git a/Projectiles/Melee/GalaxyBlastType3.cs b/Projectiles/Melee/GalaxyBlastType3.cs index d0b693d6fa..6f48bf1310 100644 --- a/Projectiles/Melee/GalaxyBlastType3.cs +++ b/Projectiles/Melee/GalaxyBlastType3.cs @@ -1,134 +1,134 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GalaxyBlastType3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default(Color), 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default(Color), 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 600); - projectile.Kill(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GalaxyBlastType3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.aiStyle = 1; + projectile.penetrate = 1; + projectile.extraUpdates = 5; + projectile.tileCollide = false; + projectile.melee = true; + } + + public override void AI() + { + if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.position.HasNaNs()) + { + projectile.Kill(); + return; + } + bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default(Color), 1f)]; + dust6.position = projectile.Center; + dust6.velocity = Vector2.Zero; + dust6.noGravity = true; + if (flag5) + { + dust6.noLight = true; + } + if (projectile.ai[1] == -1f) + { + projectile.ai[0] += 1f; + projectile.velocity = Vector2.Zero; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.Center = projectile.position; + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (++projectile.frameCounter >= projectile.MaxUpdates * 3) + { + projectile.frameCounter = 0; + projectile.frame++; + } + if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + { + projectile.Kill(); + } + return; + } + projectile.alpha = 255; + if (projectile.numUpdates == 0) + { + int num158 = -1; + float num159 = 60f; + for (int num160 = 0; num160 < 200; num160++) + { + NPC nPC = Main.npc[num160]; + if (nPC.CanBeChasedBy(projectile, false)) + { + float num161 = projectile.Distance(nPC.Center); + if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + { + num159 = num161; + num158 = num160; + } + } + } + if (num158 != -1) + { + projectile.ai[0] = 0f; + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + for (int m = 0; m < 4; m++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default(Color), 1.5f); + } + for (int n = 0; n < 4; n++) + { + int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num10].noGravity = true; + Main.dust[num10].velocity *= 3f; + if (flag) + { + Main.dust[num10].noLight = true; + } + num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 57, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num10].velocity *= 2f; + Main.dust[num10].noGravity = true; + if (flag) + { + Main.dust[num10].noLight = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 600); + projectile.Kill(); + } + } +} diff --git a/Projectiles/Melee/GelWave.cs b/Projectiles/Melee/GelWave.cs index 21bdf631ac..bbe47e9275 100644 --- a/Projectiles/Melee/GelWave.cs +++ b/Projectiles/Melee/GelWave.cs @@ -1,68 +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.Melee -{ - public class GelWave : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wave"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - aiType = 348; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.alpha = 120; - projectile.timeLeft = 200; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); - projectile.localAI[0] += 1f; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.Y += projectile.ai[0]; - if (Main.rand.Next(2) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.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 < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, 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.Slimed, 300); - projectile.velocity *= 0.5f; - } - } -} \ No newline at end of file +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 GelWave : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wave"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + aiType = 348; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.penetrate = 2; + projectile.alpha = 120; + projectile.timeLeft = 200; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + projectile.localAI[0] += 1f; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.Y += projectile.ai[0]; + if (Main.rand.Next(2) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.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 < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, 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.Slimed, 300); + projectile.velocity *= 0.5f; + } + } +} diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index 5c4a0c690e..065b0d0d2e 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -1,156 +1,156 @@ -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 GhastlySoulLarge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ghastly Soul"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1.2f; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - float num953 = 30f * projectile.ai[1]; //100 - float scaleFactor12 = 6f * projectile.ai[1]; //5 - float num954 = 600f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } - 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 = 11f; - 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 - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } - - 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) - { - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 110); - 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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 GhastlySoulLarge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghastly Soul"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.scale = 1.2f; + projectile.alpha = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + float num953 = 30f * projectile.ai[1]; //100 + float scaleFactor12 = 6f * projectile.ai[1]; //5 + float num954 = 600f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } + 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 = 11f; + 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 + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } + + 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) + { + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 110); + 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index c04b174250..2af3e947a8 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -1,156 +1,156 @@ -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 GhastlySoulMedium : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ghastly Soul"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1.1f; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - float num953 = 35f * projectile.ai[1]; //100 - float scaleFactor12 = 7f * projectile.ai[1]; //5 - float num954 = 600f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } - 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 = 13f; - 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 - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } - - 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) - { - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 88); - 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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 GhastlySoulMedium : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghastly Soul"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.scale = 1.1f; + projectile.alpha = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + float num953 = 35f * projectile.ai[1]; //100 + float scaleFactor12 = 7f * projectile.ai[1]; //5 + float num954 = 600f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } + 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 = 13f; + 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 + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } + + 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) + { + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 88); + 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index 7b4e72c7a2..3243937f59 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -1,155 +1,155 @@ -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 GhastlySoulSmall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ghastly Soul"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - float num953 = 40f * projectile.ai[1]; //100 - float scaleFactor12 = 8f * projectile.ai[1]; //5 - float num954 = 600f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } - 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 = 15f; - 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 - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } - - 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) - { - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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 GhastlySoulSmall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ghastly Soul"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.alpha = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + float num953 = 40f * projectile.ai[1]; //100 + float scaleFactor12 = 8f * projectile.ai[1]; //5 + float num954 = 600f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } + 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 = 15f; + 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 + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } + + 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) + { + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Melee/GreenBall.cs b/Projectiles/Melee/GreenBall.cs index 0f95cb6b1f..f2f5edd957 100644 --- a/Projectiles/Melee/GreenBall.cs +++ b/Projectiles/Melee/GreenBall.cs @@ -1,82 +1,82 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GreenBall : ModProjectile - { - private int projTime = 15; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.aiStyle = 14; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - projTime--; - if (projTime == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("GreenDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - projTime = 15; - } - } - - 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; - } - projectile.velocity *= 0.98f; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GreenBall : ModProjectile + { + private int projTime = 15; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 2; + projectile.aiStyle = 14; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + projTime--; + if (projTime == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("GreenDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + projTime = 15; + } + } + + 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; + } + projectile.velocity *= 0.98f; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 300); + } + } +} diff --git a/Projectiles/Melee/GreenDust.cs b/Projectiles/Melee/GreenDust.cs index e205c1c0b4..8fd4230c62 100644 --- a/Projectiles/Melee/GreenDust.cs +++ b/Projectiles/Melee/GreenDust.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GreenDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.timeLeft = 3600; - } - - public override void AI() - { - projectile.rotation += projectile.velocity.X * 0.02f; - if (projectile.velocity.X < 0f) - { - projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; - } - else - { - projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; - } - projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GreenDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.timeLeft = 3600; + } + + public override void AI() + { + projectile.rotation += projectile.velocity.X * 0.02f; + if (projectile.velocity.X < 0f) + { + projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; + } + else + { + projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; + } + projectile.velocity *= 0.98f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 60f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + } +} diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index 41c7061d0f..35460999ea 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -1,78 +1,78 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GreenWater : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 150; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.5f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - projectile.localAI[0] += 1f; - } - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - for (int lol = 0; lol < 5; lol++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default(Color), 1.2f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Poisoned, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GreenWater : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 150; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.5f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + projectile.localAI[0] += 1f; + } + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + for (int lol = 0; lol < 5; lol++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default(Color), 1.2f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Poisoned, 300); + } + } +} diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index 725eb6a6eb..b5a4591a43 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class HellionSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; - aiType = 228; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.Venom, 300); - if (crit) - { - float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(600, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)((double)projectile.damage * 0.5), 2f, projectile.owner); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class HellionSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 600; + aiType = 228; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.Venom, 300); + if (crit) + { + float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(600, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)((double)projectile.damage * 0.5), 2f, projectile.owner); + } + } + } + } +} diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index bcf36445e7..6c2b8cf07b 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -1,101 +1,101 @@ -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 HolyColliderHolyFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 60; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (Math.Abs(projectile.velocity.X) < 7f) - { - projectile.velocity.X *= 1.05f; - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 180f && projectile.ai[1] > 60f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } - - 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(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - 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, 244, 0f, 0f, 100, default(Color), 2f); - 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); - } - } - } -} \ No newline at end of file +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 HolyColliderHolyFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 60; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (Math.Abs(projectile.velocity.X) < 7f) + { + projectile.velocity.X *= 1.05f; + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 180f && projectile.ai[1] > 60f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + 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(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + 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, 244, 0f, 0f, 100, default(Color), 2f); + 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); + } + } + } +} diff --git a/Projectiles/Melee/HyperBlade.cs b/Projectiles/Melee/HyperBlade.cs index 48ee4aa0f0..2df44e7989 100644 --- a/Projectiles/Melee/HyperBlade.cs +++ b/Projectiles/Melee/HyperBlade.cs @@ -1,89 +1,89 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class HyperBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } - - public override void SetDefaults() - { - projectile.width = 36; - projectile.height = 66; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; - aiType = 274; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 25f; - 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 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 120); - target.AddBuff(BuffID.CursedInferno, 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class HyperBlade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 66; + projectile.aiStyle = 18; + projectile.alpha = 100; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = 5; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + aiType = 274; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 25f; + 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 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 120); + target.AddBuff(BuffID.CursedInferno, 240); + } + } +} diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index b58d5b53ef..e8d9414fa0 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class IceBombFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 120; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - float spread = 90f * 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) - { - for (i = 0; i < 2; i++ ) - { - 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].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++) - { - 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(mod.BuffType("GlacialState"), 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class IceBombFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 120; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + float spread = 90f * 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) + { + for (i = 0; i < 2; i++ ) + { + 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].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++) + { + 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(mod.BuffType("GlacialState"), 60); + } + } +} diff --git a/Projectiles/Melee/Iceberg.cs b/Projectiles/Melee/Iceberg.cs index 17103998c5..962404b68f 100644 --- a/Projectiles/Melee/Iceberg.cs +++ b/Projectiles/Melee/Iceberg.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - 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 = 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), 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 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + 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 = 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), 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 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); + } + } + } +} diff --git a/Projectiles/Melee/Icebreaker.cs b/Projectiles/Melee/Icebreaker.cs index 3c4d5202d7..eaf0eed71a 100644 --- a/Projectiles/Melee/Icebreaker.cs +++ b/Projectiles/Melee/Icebreaker.cs @@ -1,64 +1,64 @@ -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 Icebreaker : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icebreaker"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.GetGlobalProjectile(mod).rogue = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 120; - aiType = 52; - } - - public override void AI() - { - 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); - } - } - - 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 bool OnTileCollide(Vector2 oldVelocity) - { - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 180); - } - } -} \ No newline at end of file +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 Icebreaker : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icebreaker"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.GetGlobalProjectile(mod).rogue = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 120; + aiType = 52; + } + + public override void AI() + { + 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); + } + } + + 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 bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 180); + } + } +} diff --git a/Projectiles/Melee/Judgement.cs b/Projectiles/Melee/Judgement.cs index 1a80b1a4d4..ffa56397c9 100644 --- a/Projectiles/Melee/Judgement.cs +++ b/Projectiles/Melee/Judgement.cs @@ -1,107 +1,107 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Judgement : ModProjectile - { - int whiteLightTimer = 5; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Judgement"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.melee = true; - } - - public override void AI() - { - whiteLightTimer--; - if (whiteLightTimer == 0) - { - float spread = 180f * 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) - { - for (i = 0; i < 1; i++ ) - { - 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 ), mod.ProjectileType("WhiteOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("WhiteOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile1].velocity.X *= 0.1f; - Main.projectile[projectile1].velocity.Y *= 0.1f; - Main.projectile[projectile2].velocity.X *= 0.1f; - Main.projectile[projectile2].velocity.Y *= 0.1f; - } - } - whiteLightTimer = 5; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default(Color), 1.25f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - 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 = 9f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 100, 0f, 0f, mod.ProjectileType("WhiteBoltAura"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Judgement : ModProjectile + { + int whiteLightTimer = 5; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Judgement"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.melee = true; + } + + public override void AI() + { + whiteLightTimer--; + if (whiteLightTimer == 0) + { + float spread = 180f * 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) + { + for (i = 0; i < 1; i++ ) + { + 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 ), mod.ProjectileType("WhiteOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("WhiteOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile1].velocity.X *= 0.1f; + Main.projectile[projectile1].velocity.Y *= 0.1f; + Main.projectile[projectile2].velocity.X *= 0.1f; + Main.projectile[projectile2].velocity.Y *= 0.1f; + } + } + whiteLightTimer = 5; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default(Color), 1.25f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + 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 = 9f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 100, 0f, 0f, mod.ProjectileType("WhiteBoltAura"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Melee/JudgementBlah.cs b/Projectiles/Melee/JudgementBlah.cs index c0b8b7e66d..27719dd962 100644 --- a/Projectiles/Melee/JudgementBlah.cs +++ b/Projectiles/Melee/JudgementBlah.cs @@ -1,108 +1,108 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class JudgementBlah : ModProjectile - { - private int whiteLightTimer = 5; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Judgement"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.extraUpdates = 3; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); - whiteLightTimer--; - if (whiteLightTimer == 0) - { - float spread = 180f * 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) - { - for (i = 0; i < 1; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 6f ), (float)( Math.Cos(offsetAngle) * 6f ), mod.ProjectileType("WhiteOrbBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 6f ), (float)( -Math.Cos(offsetAngle) * 6f ), mod.ProjectileType("WhiteOrbBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile1].velocity.X *= 0.1f; - Main.projectile[projectile1].velocity.Y *= 0.1f; - Main.projectile[projectile2].velocity.X *= 0.1f; - Main.projectile[projectile2].velocity.Y *= 0.1f; - } - } - whiteLightTimer = 5; - } - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - 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 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 100, 0f, 0f, mod.ProjectileType("WhiteBoltAuraBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class JudgementBlah : ModProjectile + { + private int whiteLightTimer = 5; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Judgement"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.extraUpdates = 3; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); + whiteLightTimer--; + if (whiteLightTimer == 0) + { + float spread = 180f * 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) + { + for (i = 0; i < 1; i++ ) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 6f ), (float)( Math.Cos(offsetAngle) * 6f ), mod.ProjectileType("WhiteOrbBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 6f ), (float)( -Math.Cos(offsetAngle) * 6f ), mod.ProjectileType("WhiteOrbBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile1].velocity.X *= 0.1f; + Main.projectile[projectile1].velocity.Y *= 0.1f; + Main.projectile[projectile2].velocity.X *= 0.1f; + Main.projectile[projectile2].velocity.Y *= 0.1f; + } + } + whiteLightTimer = 5; + } + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + 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 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 100, 0f, 0f, mod.ProjectileType("WhiteBoltAuraBlah"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index 1e26adbc46..f882a838fb 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -1,46 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class LaserFountain : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fountain"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 60; - projectile.melee = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - float SpeedX = (float)Main.rand.Next(-15, 15); - float SpeedY = (float)Main.rand.Next(-20, -10); - if (projectile.localAI[0] >= 12f) - { - if (projectile.owner == Main.myPlayer) - { - 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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class LaserFountain : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fountain"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 60; + projectile.melee = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + float SpeedX = (float)Main.rand.Next(-15, 15); + float SpeedY = (float)Main.rand.Next(-20, -10); + if (projectile.localAI[0] >= 12f) + { + if (projectile.owner == Main.myPlayer) + { + 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 e2fb86b43b..ccff3bf4d0 100644 --- a/Projectiles/Melee/Leech.cs +++ b/Projectiles/Melee/Leech.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Leech : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leech"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 180; - projectile.melee = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 6f; - 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; - return; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - player.statLife += 5; - player.HealEffect(5); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Leech : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leech"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.timeLeft = 180; + projectile.melee = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 6f; + 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; + return; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + player.statLife += 5; + player.HealEffect(5); + } + } +} diff --git a/Projectiles/Melee/LifeScythe.cs b/Projectiles/Melee/LifeScythe.cs index 5ddcb9abed..0bc1ccd307 100644 --- a/Projectiles/Melee/LifeScythe.cs +++ b/Projectiles/Melee/LifeScythe.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class LifeScythe : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 70; - projectile.aiStyle = 18; - projectile.alpha = 55; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 240; - projectile.ignoreWater = true; - aiType = 274; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class LifeScythe : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 70; + projectile.aiStyle = 18; + projectile.alpha = 55; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 240; + projectile.ignoreWater = true; + aiType = 274; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); + } + } +} diff --git a/Projectiles/Melee/Light.cs b/Projectiles/Melee/Light.cs index 4a6eaef5a8..3bb2de51d0 100644 --- a/Projectiles/Melee/Light.cs +++ b/Projectiles/Melee/Light.cs @@ -1,52 +1,52 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Light : ModProjectile - { - public int speedTimer = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Light"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.rotation += 0.5f; - speedTimer--; - if (speedTimer > 60) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = 10f; - } - else if (speedTimer <= 60) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -10f; - } - if (speedTimer <= 0) - { - speedTimer = 120; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Light : ModProjectile + { + public int speedTimer = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.rotation += 0.5f; + speedTimer--; + if (speedTimer > 60) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = 10f; + } + else if (speedTimer <= 60) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -10f; + } + if (speedTimer <= 0) + { + speedTimer = 120; + } + } + } +} diff --git a/Projectiles/Melee/MangroveChakramProjectileMelee.cs b/Projectiles/Melee/MangroveChakramProjectileMelee.cs index 3aae3fdc45..d3e2ef7544 100644 --- a/Projectiles/Melee/MangroveChakramProjectileMelee.cs +++ b/Projectiles/Melee/MangroveChakramProjectileMelee.cs @@ -1,65 +1,65 @@ -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 MangroveChakramProjectileMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chakram"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 600; - aiType = 52; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.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 bool OnTileCollide(Vector2 oldVelocity) - { - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 240); - } - } -} \ No newline at end of file +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 MangroveChakramProjectileMelee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chakram"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 600; + aiType = 52; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.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 bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 240); + } + } +} diff --git a/Projectiles/Melee/MarianaProjectile.cs b/Projectiles/Melee/MarianaProjectile.cs index a5e844b15f..269e39a256 100644 --- a/Projectiles/Melee/MarianaProjectile.cs +++ b/Projectiles/Melee/MarianaProjectile.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class MarianaProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mariana"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 120; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.8f); - } - - 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, 221, 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MarianaProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mariana"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 120; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.8f); + } + + 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, 221, 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; + } + } +} diff --git a/Projectiles/Melee/MarniteObliterator.cs b/Projectiles/Melee/MarniteObliterator.cs index fad8274bd5..8609570317 100644 --- a/Projectiles/Melee/MarniteObliterator.cs +++ b/Projectiles/Melee/MarniteObliterator.cs @@ -1,28 +1,28 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class MarniteObliterator : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Obliterator"); - } - - public override void SetDefaults() - { - projectile.width = 22; - projectile.height = 22; - projectile.aiStyle = 20; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.hide = true; - projectile.ownerHitCheck = true; - projectile.melee = true; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MarniteObliterator : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Obliterator"); + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.aiStyle = 20; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.hide = true; + projectile.ownerHitCheck = true; + projectile.melee = true; + } + } +} diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index 44259dc746..a815a097ed 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class MirrorBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } - - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 16f) - { - projectile.localAI[1] = 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, 234, 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.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MirrorBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 16f) + { + projectile.localAI[1] = 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, 234, 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.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + } + } +} diff --git a/Projectiles/Melee/Mourningstar.cs b/Projectiles/Melee/Mourningstar.cs index 6a8e7047a8..e1bdfb782a 100644 --- a/Projectiles/Melee/Mourningstar.cs +++ b/Projectiles/Melee/Mourningstar.cs @@ -1,232 +1,232 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Enums; - -namespace CalamityMod.Projectiles.Melee -{ - public class Mourningstar : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mourningstar"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.hide = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.GetGlobalProjectile(mod).trueMelee = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.localAI[1] > 0f) - { - projectile.localAI[1] -= 1f; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = projectile.velocity.ToRotation(); - } - float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); - if (projectile.ai[1] <= 0f) - { - num32 *= -1f; - } - Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); - vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); - if (projectile.ai[1] <= 0f) - { - vector17.Y *= -1f; - } - vector17 = vector17.RotatedBy((double)projectile.localAI[0], default(Vector2)); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 30f) - { - projectile.velocity += 48f * vector17; - } - else - { - projectile.Kill(); - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; - if (player.direction != 1) - { - vector24.X = (float)player.bodyFrame.Width - vector24.X; - } - if (player.gravDir != 1f) - { - vector24.Y = (float)player.bodyFrame.Height - vector24.Y; - } - vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; - projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; - if (projectile.alpha == 0) - { - for (int num51 = 0; num51 < 2; num51++) - { - Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, 200, 0), 2f)]; - dust.noGravity = true; - dust.velocity *= 2f; - dust.velocity += projectile.localAI[0].ToRotationVector2(); - dust.fadeIn = 1.5f; - } - float num52 = 18f; - int num53 = 0; - while ((float)num53 < num52) - { - if (Main.rand.Next(4) == 0) - { - Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); - Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, 200, 0), 1f)]; - dust2.noGravity = true; - dust2.fadeIn = 0.5f; - dust2.velocity += projectile.localAI[0].ToRotationVector2(); - dust2.noLight = true; - } - num53++; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - Vector2 projPos = projectile.position; - projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; //fuck it - Texture2D texture2D22 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25); - if (projectile.velocity == Vector2.Zero) - { - return false; - } - float num230 = projectile.velocity.Length() + 16f; - bool flag24 = num230 < 100f; - Vector2 value28 = Vector2.Normalize(projectile.velocity); - Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 36); //2 and 40 - Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); - float rotation24 = projectile.rotation + 3.14159274f; - Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); - num230 -= 40f * projectile.scale; - Vector2 vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 18); //68 and 18 - if (num230 > 0f) - { - float num231 = 0f; - while (num231 + 1f < num230) - { - if (num230 - num231 < (float)rectangle8.Height) - { - rectangle8.Height = (int)(num230 - num231); - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num231 += (float)rectangle8.Height * projectile.scale; - vector31 += value28 * (float)rectangle8.Height * projectile.scale; - } - } - Vector2 value30 = vector31; - vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 40, texture2D22.Width, 20); //46 and 18 - int num232 = 18; - if (flag24) - { - num232 = 9; - } - float num233 = num230; - if (num230 > 0f) - { - float num234 = 0f; - float num235 = num233 / (float)num232; - num234 += num235 * 0.25f; - vector31 += value28 * num235 * 0.25f; - for (int num236 = 0; num236 < num232; num236++) - { - float num237 = num235; - if (num236 == 0) - { - num237 *= 0.75f; - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num234 += num237; - vector31 += value28 * num237; - } - } - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 56); //90 and 48 - Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 200, 0, 0); - } - - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num8 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) - { - return true; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 300); - if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } - projectile.localAI[1] = 4f; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; + +namespace CalamityMod.Projectiles.Melee +{ + public class Mourningstar : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mourningstar"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.hide = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + projectile.GetGlobalProjectile(mod).trueMelee = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.localAI[1] > 0f) + { + projectile.localAI[1] -= 1f; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = projectile.velocity.ToRotation(); + } + float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); + if (projectile.ai[1] <= 0f) + { + num32 *= -1f; + } + Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); + vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); + if (projectile.ai[1] <= 0f) + { + vector17.Y *= -1f; + } + vector17 = vector17.RotatedBy((double)projectile.localAI[0], default(Vector2)); + projectile.ai[0] += 1f; + if (projectile.ai[0] < 30f) + { + projectile.velocity += 48f * vector17; + } + else + { + projectile.Kill(); + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; + if (player.direction != 1) + { + vector24.X = (float)player.bodyFrame.Width - vector24.X; + } + if (player.gravDir != 1f) + { + vector24.Y = (float)player.bodyFrame.Height - vector24.Y; + } + vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; + projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; + if (projectile.alpha == 0) + { + for (int num51 = 0; num51 < 2; num51++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, 244, 0f, 0f, 100, new Color(255, 200, 0), 2f)]; + dust.noGravity = true; + dust.velocity *= 2f; + dust.velocity += projectile.localAI[0].ToRotationVector2(); + dust.fadeIn = 1.5f; + } + float num52 = 18f; + int num53 = 0; + while ((float)num53 < num52) + { + if (Main.rand.Next(4) == 0) + { + Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); + Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, 200, 0), 1f)]; + dust2.noGravity = true; + dust2.fadeIn = 0.5f; + dust2.velocity += projectile.localAI[0].ToRotationVector2(); + dust2.noLight = true; + } + num53++; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + Vector2 projPos = projectile.position; + projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; //fuck it + Texture2D texture2D22 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25); + if (projectile.velocity == Vector2.Zero) + { + return false; + } + float num230 = projectile.velocity.Length() + 16f; + bool flag24 = num230 < 100f; + Vector2 value28 = Vector2.Normalize(projectile.velocity); + Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 36); //2 and 40 + Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); + float rotation24 = projectile.rotation + 3.14159274f; + Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); + num230 -= 40f * projectile.scale; + Vector2 vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 18); //68 and 18 + if (num230 > 0f) + { + float num231 = 0f; + while (num231 + 1f < num230) + { + if (num230 - num231 < (float)rectangle8.Height) + { + rectangle8.Height = (int)(num230 - num231); + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num231 += (float)rectangle8.Height * projectile.scale; + vector31 += value28 * (float)rectangle8.Height * projectile.scale; + } + } + Vector2 value30 = vector31; + vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 40, texture2D22.Width, 20); //46 and 18 + int num232 = 18; + if (flag24) + { + num232 = 9; + } + float num233 = num230; + if (num230 > 0f) + { + float num234 = 0f; + float num235 = num233 / (float)num232; + num234 += num235 * 0.25f; + vector31 += value28 * num235 * 0.25f; + for (int num236 = 0; num236 < num232; num236++) + { + float num237 = num235; + if (num236 == 0) + { + num237 *= 0.75f; + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num234 += num237; + vector31 += value28 * num237; + } + } + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 56); //90 and 48 + Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 200, 0, 0); + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num8 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) + { + return true; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 300); + if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, damage, 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + projectile.localAI[1] = 4f; + } + } +} diff --git a/Projectiles/Melee/Murasama.cs b/Projectiles/Melee/Murasama.cs index 0fe0cd096f..0ef4306280 100644 --- a/Projectiles/Melee/Murasama.cs +++ b/Projectiles/Melee/Murasama.cs @@ -1,103 +1,103 @@ -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 Murasama : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Murasama"); - Main.projFrames[projectile.type] = 28; - } - - public override void SetDefaults() - { - projectile.width = 148; - projectile.height = 68; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ownerHitCheck = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 0; - projectile.GetGlobalProjectile(mod).trueMelee = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - if (++projectile.frame >= Main.projFrames[projectile.type]) - { - projectile.frame = 0; - } - projectile.soundDelay--; - if (projectile.soundDelay <= 0) - { - Main.PlaySound(SoundID.Item15, projectile.Center); - projectile.soundDelay = 24; - } - if (Main.myPlayer == projectile.owner) - { - if (player.channel && !player.noItems && !player.CCed) - { - float scaleFactor6 = 1f; - if (player.inventory[player.selectedItem].shoot == projectile.type) - { - scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - } - Vector2 vector13 = Main.MouseWorld - vector; - vector13.Normalize(); - if (vector13.HasNaNs()) - { - vector13 = Vector2.UnitX * (float)player.direction; - } - vector13 *= scaleFactor6; - if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector13; - } - else - { - projectile.Kill(); - } - } - Vector2 vector14 = projectile.Center + projectile.velocity * 3f; - Lighting.AddLight(vector14, 3f, 0.2f, 0.2f); - if (Main.rand.Next(3) == 0) - { - int num30 = Dust.NewDust(vector14 - projectile.Size / 2f, projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 2f); - Main.dust[num30].noGravity = true; - Main.dust[num30].position -= projectile.velocity; - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 0, 0, 0); - } - } -} \ No newline at end of file +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 Murasama : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Murasama"); + Main.projFrames[projectile.type] = 28; + } + + public override void SetDefaults() + { + projectile.width = 148; + projectile.height = 68; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.melee = true; + projectile.ownerHitCheck = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 0; + projectile.GetGlobalProjectile(mod).trueMelee = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + if (++projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + projectile.soundDelay--; + if (projectile.soundDelay <= 0) + { + Main.PlaySound(SoundID.Item15, projectile.Center); + projectile.soundDelay = 24; + } + if (Main.myPlayer == projectile.owner) + { + if (player.channel && !player.noItems && !player.CCed) + { + float scaleFactor6 = 1f; + if (player.inventory[player.selectedItem].shoot == projectile.type) + { + scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + } + Vector2 vector13 = Main.MouseWorld - vector; + vector13.Normalize(); + if (vector13.HasNaNs()) + { + vector13 = Vector2.UnitX * (float)player.direction; + } + vector13 *= scaleFactor6; + if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector13; + } + else + { + projectile.Kill(); + } + } + Vector2 vector14 = projectile.Center + projectile.velocity * 3f; + Lighting.AddLight(vector14, 3f, 0.2f, 0.2f); + if (Main.rand.Next(3) == 0) + { + int num30 = Dust.NewDust(vector14 - projectile.Size / 2f, projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 2f); + Main.dust[num30].noGravity = true; + Main.dust[num30].position -= projectile.velocity; + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 0, 0, 0); + } + } +} diff --git a/Projectiles/Melee/Nebudust.cs b/Projectiles/Melee/Nebudust.cs index 4a10bcba01..0fb3573eae 100644 --- a/Projectiles/Melee/Nebudust.cs +++ b/Projectiles/Melee/Nebudust.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Nebudust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 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] > 60f) - { - num461 -= (projectile.ai[0] - 60f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - if (projectile.ai[0] == 0f) - { - Main.PlaySound(SoundID.Item105, projectile.position); - } - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-6, 7); - float num464 = (float)Main.rand.Next(-6, 7); - float num465 = (float)Main.rand.Next(2, 5); - 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, 269, 0f, 0f, 100, default(Color), 1f); - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Nebudust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 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] > 60f) + { + num461 -= (projectile.ai[0] - 60f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + if (projectile.ai[0] == 0f) + { + Main.PlaySound(SoundID.Item105, projectile.position); + } + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-6, 7); + float num464 = (float)Main.rand.Next(-6, 7); + float num465 = (float)Main.rand.Next(2, 5); + 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, 269, 0f, 0f, 100, default(Color), 1f); + 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++; + } + } + } +} diff --git a/Projectiles/Melee/Nebulash.cs b/Projectiles/Melee/Nebulash.cs index 3a932572a1..c20688e395 100644 --- a/Projectiles/Melee/Nebulash.cs +++ b/Projectiles/Melee/Nebulash.cs @@ -1,226 +1,226 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Enums; - -namespace CalamityMod.Projectiles.Melee -{ - public class Nebulash : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nebulash"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.hide = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - projectile.GetGlobalProjectile(mod).trueMelee = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.localAI[1] > 0f) - { - projectile.localAI[1] -= 1f; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = projectile.velocity.ToRotation(); - } - float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); - if (projectile.ai[1] <= 0f) - { - num32 *= -1f; - } - Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); - vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); - if (projectile.ai[1] <= 0f) - { - vector17.Y *= -1f; - } - vector17 = vector17.RotatedBy((double)projectile.localAI[0], default(Vector2)); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 30f) - { - projectile.velocity += 48f * vector17; - } - else - { - projectile.Kill(); - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; - if (player.direction != 1) - { - vector24.X = (float)player.bodyFrame.Width - vector24.X; - } - if (player.gravDir != 1f) - { - vector24.Y = (float)player.bodyFrame.Height - vector24.Y; - } - vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; - projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; - if (projectile.alpha == 0) - { - for (int num51 = 0; num51 < 2; num51++) - { - Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, new Color(255, 200, 0), 2f)]; - dust.noGravity = true; - dust.velocity *= 2f; - dust.velocity += projectile.localAI[0].ToRotationVector2(); - dust.fadeIn = 1.5f; - } - float num52 = 18f; - int num53 = 0; - while ((float)num53 < num52) - { - if (Main.rand.Next(4) == 0) - { - Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); - Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 173, 0f, 0f, 100, new Color(255, 200, 0), 1f)]; - dust2.noGravity = true; - dust2.fadeIn = 0.5f; - dust2.velocity += projectile.localAI[0].ToRotationVector2(); - dust2.noLight = true; - } - num53++; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - Vector2 projPos = projectile.position; - projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; //fuck it - Texture2D texture2D22 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25); - if (projectile.velocity == Vector2.Zero) - { - return false; - } - float num230 = projectile.velocity.Length() + 16f; - bool flag24 = num230 < 100f; - Vector2 value28 = Vector2.Normalize(projectile.velocity); - Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 54); //2 and 40 - Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); - float rotation24 = projectile.rotation + 3.14159274f; - Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); - num230 -= 40f * projectile.scale; - Vector2 vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 18); //68 and 18 - if (num230 > 0f) - { - float num231 = 0f; - while (num231 + 1f < num230) - { - if (num230 - num231 < (float)rectangle8.Height) - { - rectangle8.Height = (int)(num230 - num231); - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num231 += (float)rectangle8.Height * projectile.scale; - vector31 += value28 * (float)rectangle8.Height * projectile.scale; - } - } - Vector2 value30 = vector31; - vector31 = projectile.Center.Floor(); - vector31 += value28 * projectile.scale * 24f; - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 20); //46 and 18 - int num232 = 18; - if (flag24) - { - num232 = 9; - } - float num233 = num230; - if (num230 > 0f) - { - float num234 = 0f; - float num235 = num233 / (float)num232; - num234 += num235 * 0.25f; - vector31 += value28 * num235 * 0.25f; - for (int num236 = 0; num236 < num232; num236++) - { - float num237 = num235; - if (num236 == 0) - { - num237 *= 0.75f; - } - Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num234 += num237; - vector31 += value28 * num237; - } - } - rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 104, texture2D22.Width, 50); //90 and 48 - Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num8 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) - { - return true; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Nebudust"), damage, knockback, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } - projectile.localAI[1] = 4f; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; + +namespace CalamityMod.Projectiles.Melee +{ + public class Nebulash : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nebulash"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.hide = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + projectile.GetGlobalProjectile(mod).trueMelee = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.localAI[1] > 0f) + { + projectile.localAI[1] -= 1f; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = projectile.velocity.ToRotation(); + } + float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); + if (projectile.ai[1] <= 0f) + { + num32 *= -1f; + } + Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); + vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); + if (projectile.ai[1] <= 0f) + { + vector17.Y *= -1f; + } + vector17 = vector17.RotatedBy((double)projectile.localAI[0], default(Vector2)); + projectile.ai[0] += 1f; + if (projectile.ai[0] < 30f) + { + projectile.velocity += 48f * vector17; + } + else + { + projectile.Kill(); + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; + if (player.direction != 1) + { + vector24.X = (float)player.bodyFrame.Width - vector24.X; + } + if (player.gravDir != 1f) + { + vector24.Y = (float)player.bodyFrame.Height - vector24.Y; + } + vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; + projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; + if (projectile.alpha == 0) + { + for (int num51 = 0; num51 < 2; num51++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, new Color(255, 200, 0), 2f)]; + dust.noGravity = true; + dust.velocity *= 2f; + dust.velocity += projectile.localAI[0].ToRotationVector2(); + dust.fadeIn = 1.5f; + } + float num52 = 18f; + int num53 = 0; + while ((float)num53 < num52) + { + if (Main.rand.Next(4) == 0) + { + Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); + Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 173, 0f, 0f, 100, new Color(255, 200, 0), 1f)]; + dust2.noGravity = true; + dust2.fadeIn = 0.5f; + dust2.velocity += projectile.localAI[0].ToRotationVector2(); + dust2.noLight = true; + } + num53++; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + Vector2 projPos = projectile.position; + projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; //fuck it + Texture2D texture2D22 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25); + if (projectile.velocity == Vector2.Zero) + { + return false; + } + float num230 = projectile.velocity.Length() + 16f; + bool flag24 = num230 < 100f; + Vector2 value28 = Vector2.Normalize(projectile.velocity); + Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 54); //2 and 40 + Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); + float rotation24 = projectile.rotation + 3.14159274f; + Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); + num230 -= 40f * projectile.scale; + Vector2 vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 84, texture2D22.Width, 18); //68 and 18 + if (num230 > 0f) + { + float num231 = 0f; + while (num231 + 1f < num230) + { + if (num230 - num231 < (float)rectangle8.Height) + { + rectangle8.Height = (int)(num230 - num231); + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num231 += (float)rectangle8.Height * projectile.scale; + vector31 += value28 * (float)rectangle8.Height * projectile.scale; + } + } + Vector2 value30 = vector31; + vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 62, texture2D22.Width, 20); //46 and 18 + int num232 = 18; + if (flag24) + { + num232 = 9; + } + float num233 = num230; + if (num230 > 0f) + { + float num234 = 0f; + float num235 = num233 / (float)num232; + num234 += num235 * 0.25f; + vector31 += value28 * num235 * 0.25f; + for (int num236 = 0; num236 < num232; num236++) + { + float num237 = num235; + if (num236 == 0) + { + num237 *= 0.75f; + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num234 += num237; + vector31 += value28 * num237; + } + } + rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 104, texture2D22.Width, 50); //90 and 48 + Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num8 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) + { + return true; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("Nebudust"), damage, knockback, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + projectile.localAI[1] = 4f; + } + } +} diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs index 8de4943ea1..128fd5603e 100644 --- a/Projectiles/Melee/NeptuneOrb.cs +++ b/Projectiles/Melee/NeptuneOrb.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class NeptuneOrb : ModProjectile - { - private int addSprayTimer = 10; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.penetrate = -1; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - addSprayTimer--; - if (addSprayTimer <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 15f, mod.ProjectileType("DepthOrb2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - addSprayTimer = 10; - } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - - 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++) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.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; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class NeptuneOrb : ModProjectile + { + private int addSprayTimer = 10; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 300; + projectile.penetrate = -1; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + addSprayTimer--; + if (addSprayTimer <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 15f, mod.ProjectileType("DepthOrb2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + addSprayTimer = 10; + } + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + + 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++) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1.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; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 300); + } + } +} diff --git a/Projectiles/Melee/NightStabber.cs b/Projectiles/Melee/NightStabber.cs index 3510473506..2be152ee38 100644 --- a/Projectiles/Melee/NightStabber.cs +++ b/Projectiles/Melee/NightStabber.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class NightStabber : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stabber"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.melee = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 7f; - 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; - return; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class NightStabber : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stabber"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.melee = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 7f; + 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; + return; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Melee/OPHammerMelee.cs b/Projectiles/Melee/OPHammerMelee.cs index 463c60620c..477cdeb002 100644 --- a/Projectiles/Melee/OPHammerMelee.cs +++ b/Projectiles/Melee/OPHammerMelee.cs @@ -1,121 +1,121 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OPHammerMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - } - - public override void SetDefaults() - { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 20f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 16f; - float num43 = 3.2f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - 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); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class OPHammerMelee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + } + + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 62; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 2; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 20f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 16f; + float num43 = 3.2f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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); + } + } + } +} diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs index b8a744a4c2..b1147f8af2 100644 --- a/Projectiles/Melee/Oathblade.cs +++ b/Projectiles/Melee/Oathblade.cs @@ -1,49 +1,49 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Oathblade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oathblade"); - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.melee = true; - projectile.scale = 0.9f; - projectile.tileCollide = true; - projectile.penetrate = 3; - aiType = 45; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, 0f, ((255 - projectile.alpha) * 0.35f) / 255f); - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - int immuneTime = 10 - - (NPC.downedMoonlord ? 8 : 0); - target.immune[projectile.owner] = immuneTime; - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.ShadowFlame, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Oathblade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oathblade"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 18; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.scale = 0.9f; + projectile.tileCollide = true; + projectile.penetrate = 3; + aiType = 45; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, 0f, ((255 - projectile.alpha) * 0.35f) / 255f); + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int immuneTime = 10 - + (NPC.downedMoonlord ? 8 : 0); + target.immune[projectile.owner] = immuneTime; + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.ShadowFlame, 180); + } + } +} diff --git a/Projectiles/Melee/OceanBeam.cs b/Projectiles/Melee/OceanBeam.cs index cc0dd734ae..0737b11ae2 100644 --- a/Projectiles/Melee/OceanBeam.cs +++ b/Projectiles/Melee/OceanBeam.cs @@ -1,108 +1,108 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OceanBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 255; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.penetrate = 3; - projectile.timeLeft /= 2; - projectile.melee = true; - } - - public override void AI() - { - for (int num92 = 0; num92 < 2; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 56, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.25f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; - } - for (int num105 = 0; num105 < 2; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 245, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.25f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; - } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - - 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; - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - 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 < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 245, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class OceanBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.alpha = 255; + projectile.extraUpdates = 2; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + projectile.penetrate = 3; + projectile.timeLeft /= 2; + projectile.melee = true; + } + + public override void AI() + { + for (int num92 = 0; num92 < 2; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 56, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.25f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + } + for (int num105 = 0; num105 < 2; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 245, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num102].noGravity = true; + Main.dust[num102].velocity *= 0.1f; + Main.dust[num102].velocity += projectile.velocity * 0.25f; + Dust expr_47FA_cp_0 = Main.dust[num102]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + Dust expr_4815_cp_0 = Main.dust[num102]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + } + if (projectile.ai[1] >= 20f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + 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; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + 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 < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 245, projectile.oldVelocity.X * 0.25f, projectile.oldVelocity.Y * 0.25f); + } + } + } +} diff --git a/Projectiles/Melee/OmegaBiomeOrb.cs b/Projectiles/Melee/OmegaBiomeOrb.cs index a0d6e79099..3f9ef1180e 100644 --- a/Projectiles/Melee/OmegaBiomeOrb.cs +++ b/Projectiles/Melee/OmegaBiomeOrb.cs @@ -1,217 +1,217 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OmegaBiomeOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 240; - projectile.melee = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool sky = player.ZoneSkyHeight; - bool holy = player.ZoneHoly; - bool nebula = player.ZoneTowerNebula; - bool stardust = player.ZoneTowerStardust; - bool solar = player.ZoneTowerSolar; - bool vortex = player.ZoneTowerVortex; - int dustType = 0; - if (jungle) - { - dustType = 39; - } - else if (snow) - { - dustType = 51; - } - else if (beach) - { - dustType = 33; - } - else if (corrupt) - { - dustType = 14; - } - else if (crimson) - { - dustType = 5; - } - else if (dungeon) - { - dustType = 29; - } - else if (desert) - { - dustType = 32; - } - else if (glow) - { - dustType = 56; - } - else if (hell) - { - dustType = 6; - } - else if (sky) - { - dustType = 213; - } - else if (holy) - { - dustType = 57; - } - else if (nebula) - { - dustType = 242; - } - else if (stardust) - { - dustType = 206; - } - else if (solar) - { - dustType = 244; - } - else if (vortex) - { - dustType = 107; - } - else - { - dustType = 3; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - 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 = 15f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - bool bloodMoon = Main.bloodMoon; - bool snowMoon = Main.snowMoon; - bool pumpkinMoon = Main.pumpkinMoon; - if (bloodMoon) - { - player.AddBuff(BuffID.Battle, 600); - } - if (snowMoon) - { - player.AddBuff(BuffID.RapidHealing, 600); - } - if (pumpkinMoon) - { - player.AddBuff(BuffID.WellFed, 600); - } - if (jungle) - { - target.AddBuff(mod.BuffType("Plague"), 600); - } - else if (snow) - { - target.AddBuff(mod.BuffType("GlacialState"), 600); - } - else if (beach) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - } - else if (dungeon) - { - target.AddBuff(BuffID.Frostburn, 600); - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - } - else if (glow) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 600); - } - else if (hell) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); - } - else if (holy) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 600); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class OmegaBiomeOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 240; + projectile.melee = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool sky = player.ZoneSkyHeight; + bool holy = player.ZoneHoly; + bool nebula = player.ZoneTowerNebula; + bool stardust = player.ZoneTowerStardust; + bool solar = player.ZoneTowerSolar; + bool vortex = player.ZoneTowerVortex; + int dustType = 0; + if (jungle) + { + dustType = 39; + } + else if (snow) + { + dustType = 51; + } + else if (beach) + { + dustType = 33; + } + else if (corrupt) + { + dustType = 14; + } + else if (crimson) + { + dustType = 5; + } + else if (dungeon) + { + dustType = 29; + } + else if (desert) + { + dustType = 32; + } + else if (glow) + { + dustType = 56; + } + else if (hell) + { + dustType = 6; + } + else if (sky) + { + dustType = 213; + } + else if (holy) + { + dustType = 57; + } + else if (nebula) + { + dustType = 242; + } + else if (stardust) + { + dustType = 206; + } + else if (solar) + { + dustType = 244; + } + else if (vortex) + { + dustType = 107; + } + else + { + dustType = 3; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + 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 = 15f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + bool bloodMoon = Main.bloodMoon; + bool snowMoon = Main.snowMoon; + bool pumpkinMoon = Main.pumpkinMoon; + if (bloodMoon) + { + player.AddBuff(BuffID.Battle, 600); + } + if (snowMoon) + { + player.AddBuff(BuffID.RapidHealing, 600); + } + if (pumpkinMoon) + { + player.AddBuff(BuffID.WellFed, 600); + } + if (jungle) + { + target.AddBuff(mod.BuffType("Plague"), 600); + } + else if (snow) + { + target.AddBuff(mod.BuffType("GlacialState"), 600); + } + else if (beach) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + else if (dungeon) + { + target.AddBuff(BuffID.Frostburn, 600); + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + } + else if (glow) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 600); + } + else if (hell) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 600); + } + else if (holy) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 600); + } + } + } +} diff --git a/Projectiles/Melee/PlagueBeeDust.cs b/Projectiles/Melee/PlagueBeeDust.cs index 57bd0e8535..afa95ed937 100644 --- a/Projectiles/Melee/PlagueBeeDust.cs +++ b/Projectiles/Melee/PlagueBeeDust.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class PlagueBeeDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 60; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] % 2f == 0f) - { - int spawnX = (int)(projectile.width / 2); - int spawnY = (int)(projectile.width / 2); - int bee = Projectile.NewProjectile(projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), - projectile.velocity.X, projectile.velocity.Y, Main.player[projectile.owner].beeType(), - Main.player[projectile.owner].beeDamage(projectile.damage / 3), Main.player[projectile.owner].beeKB(0f), projectile.owner, 0f, 0f); - Main.projectile[bee].penetrate = 1; - } - int num297 = 89; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 2.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 2f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("Plague"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PlagueBeeDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 70; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 60; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] % 2f == 0f) + { + int spawnX = (int)(projectile.width / 2); + int spawnY = (int)(projectile.width / 2); + int bee = Projectile.NewProjectile(projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), + projectile.velocity.X, projectile.velocity.Y, Main.player[projectile.owner].beeType(), + Main.player[projectile.owner].beeDamage(projectile.damage / 3), Main.player[projectile.owner].beeKB(0f), projectile.owner, 0f, 0f); + Main.projectile[bee].penetrate = 1; + } + int num297 = 89; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 2.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 2f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("Plague"), 180); + } + } +} diff --git a/Projectiles/Melee/PlagueDust.cs b/Projectiles/Melee/PlagueDust.cs index d15f507a31..16b4fe5608 100644 --- a/Projectiles/Melee/PlagueDust.cs +++ b/Projectiles/Melee/PlagueDust.cs @@ -1,86 +1,86 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class PlagueDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 60; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 89; - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 2.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 2f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("Plague"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PlagueDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 70; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 60; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 89; + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 2.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 2f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("Plague"), 120); + } + } +} diff --git a/Projectiles/Melee/PlagueSeeker.cs b/Projectiles/Melee/PlagueSeeker.cs index 1595bb05cb..06ddaf1092 100644 --- a/Projectiles/Melee/PlagueSeeker.cs +++ b/Projectiles/Melee/PlagueSeeker.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class PlagueSeeker : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seeker"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.melee = true; - projectile.timeLeft = 180; - } - - 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, 107, 0f, 0f, 100, default(Color), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PlagueSeeker : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seeker"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.melee = true; + projectile.timeLeft = 180; + } + + 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, 107, 0f, 0f, 100, default(Color), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 18f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 180); + } + } +} diff --git a/Projectiles/Melee/PlasmaBall.cs b/Projectiles/Melee/PlasmaBall.cs index cf1edead5b..324cd0e6d4 100644 --- a/Projectiles/Melee/PlasmaBall.cs +++ b/Projectiles/Melee/PlasmaBall.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class PlasmaBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.melee = true; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PlasmaBall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.melee = true; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 300); + } + } +} diff --git a/Projectiles/Melee/ProfanedSword.cs b/Projectiles/Melee/ProfanedSword.cs index c981602640..6ffcd98127 100644 --- a/Projectiles/Melee/ProfanedSword.cs +++ b/Projectiles/Melee/ProfanedSword.cs @@ -61,4 +61,4 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); } } -} \ No newline at end of file +} diff --git a/Projectiles/Melee/PwnagehammerMelee.cs b/Projectiles/Melee/PwnagehammerMelee.cs index 776f26bb91..4984812028 100644 --- a/Projectiles/Melee/PwnagehammerMelee.cs +++ b/Projectiles/Melee/PwnagehammerMelee.cs @@ -1,58 +1,58 @@ -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 PwnagehammerMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 120; - projectile.extraUpdates = 3; - aiType = 301; - } - - public override void AI() - { - projectile.velocity.X *= 1.06f; - projectile.velocity.Y *= 1.06f; - } - - 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 bool OnTileCollide(Vector2 oldVelocity) - { - 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 +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 PwnagehammerMelee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 120; + projectile.extraUpdates = 3; + aiType = 301; + } + + public override void AI() + { + projectile.velocity.X *= 1.06f; + projectile.velocity.Y *= 1.06f; + } + + 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 bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + } +} diff --git a/Projectiles/Melee/RainBolt.cs b/Projectiles/Melee/RainBolt.cs index 4a80507d66..3248bdb448 100644 --- a/Projectiles/Melee/RainBolt.cs +++ b/Projectiles/Melee/RainBolt.cs @@ -1,85 +1,85 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class RainBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 150; - } - - public override void AI() - { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - projectile.localAI[0] += 1f; - } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 14f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - for (int k = 0; k < 5; k++) - { - int rain = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); - Main.dust[rain].noGravity = true; - Main.dust[rain].velocity *= 4f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class RainBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 150; + } + + public override void AI() + { + projectile.velocity.X *= 0.95f; + projectile.velocity.Y *= 0.95f; + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + projectile.localAI[0] += 1f; + } + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 14f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + for (int k = 0; k < 5; k++) + { + int rain = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)); + Main.dust[rain].noGravity = true; + Main.dust[rain].velocity *= 4f; + } + } + } +} diff --git a/Projectiles/Melee/RainbowBoom.cs b/Projectiles/Melee/RainbowBoom.cs index db6d582ac1..58f5ab9db2 100644 --- a/Projectiles/Melee/RainbowBoom.cs +++ b/Projectiles/Melee/RainbowBoom.cs @@ -1,91 +1,91 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class RainbowBoom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boom"); - } - - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - 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, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class RainbowBoom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boom"); + } + + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + 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, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + 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++; + } + } + } +} diff --git a/Projectiles/Melee/Razorwind.cs b/Projectiles/Melee/Razorwind.cs index 9b287fbe78..6ce642c967 100644 --- a/Projectiles/Melee/Razorwind.cs +++ b/Projectiles/Melee/Razorwind.cs @@ -1,119 +1,119 @@ -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 Razorwind : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Razorwind"); - 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 = 3; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.alpha -= 5; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 150f * 3f; - 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 = 5f * 3f; - 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; - return; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(53, Main.DiscoG, 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 +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 Razorwind : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Razorwind"); + 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 = 3; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.alpha -= 5; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 150f * 3f; + 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 = 5f * 3f; + 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; + return; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(53, Main.DiscoG, 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; + } + } +} diff --git a/Projectiles/Melee/RedBall.cs b/Projectiles/Melee/RedBall.cs index fce76500df..5fbdad1a24 100644 --- a/Projectiles/Melee/RedBall.cs +++ b/Projectiles/Melee/RedBall.cs @@ -1,82 +1,82 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class RedBall : ModProjectile - { - private int projTime = 15; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.aiStyle = 14; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - projTime--; - if (projTime == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("RedDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - projTime = 15; - } - } - - 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; - } - projectile.velocity *= 0.98f; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class RedBall : ModProjectile + { + private int projTime = 15; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 2; + projectile.aiStyle = 14; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + projTime--; + if (projTime == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("RedDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + } + projTime = 15; + } + } + + 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; + } + projectile.velocity *= 0.98f; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Projectiles/Melee/RedDust.cs b/Projectiles/Melee/RedDust.cs index ba9466995b..83870b45e8 100644 --- a/Projectiles/Melee/RedDust.cs +++ b/Projectiles/Melee/RedDust.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class RedDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.timeLeft = 3600; - } - - public override void AI() - { - projectile.rotation += projectile.velocity.X * 0.02f; - if (projectile.velocity.X < 0f) - { - projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; - } - else - { - projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; - } - projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class RedDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.melee = true; + projectile.timeLeft = 3600; + } + + public override void AI() + { + projectile.rotation += projectile.velocity.X * 0.02f; + if (projectile.velocity.X < 0f) + { + projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; + } + else + { + projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; + } + projectile.velocity *= 0.98f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 60f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + } +} diff --git a/Projectiles/Melee/RoyalKnifeMelee.cs b/Projectiles/Melee/RoyalKnifeMelee.cs index 47d81fd214..49d4cfea41 100644 --- a/Projectiles/Melee/RoyalKnifeMelee.cs +++ b/Projectiles/Melee/RoyalKnifeMelee.cs @@ -1,115 +1,115 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class RoyalKnifeMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 240f) - { - projectile.alpha += 4; - projectile.damage = (int)((double)projectile.damage * 0.95); - projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); - } - if (projectile.ai[0] < 240f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - else - { - projectile.rotation += 0.5f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 800f; - 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 = 35f; - 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; - } - if (Main.rand.Next(6) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - for (int num303 = 0; num303 < 3; num303++) - { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default(Color), 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.015f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("RoyalHeal"), 0, 0f, projectile.owner, (float)num2, num); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class RoyalKnifeMelee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 240f) + { + projectile.alpha += 4; + projectile.damage = (int)((double)projectile.damage * 0.95); + projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); + } + if (projectile.ai[0] < 240f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + else + { + projectile.rotation += 0.5f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 800f; + 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 = 35f; + 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; + } + if (Main.rand.Next(6) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + for (int num303 = 0; num303 < 3; num303++) + { + int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default(Color), 0.8f); + Main.dust[num304].noGravity = true; + Main.dust[num304].velocity *= 1.2f; + Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + if (target.type == NPCID.TargetDummy) + { + return; + } + float num = (float)damage * 0.015f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("RoyalHeal"), 0, 0f, projectile.owner, (float)num2, num); + } + } +} diff --git a/Projectiles/Melee/SHIV.cs b/Projectiles/Melee/SHIV.cs index 9f08211b03..cd63f245be 100644 --- a/Projectiles/Melee/SHIV.cs +++ b/Projectiles/Melee/SHIV.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class SHIV : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shiv"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - projectile.aiStyle = 27; - } - - public override void AI() - { - projectile.velocity.X *= 1.075f; - projectile.velocity.Y *= 1.075f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - 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), 1.3f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - } - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 1; k++) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SHIV : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shiv"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + projectile.aiStyle = 27; + } + + public override void AI() + { + projectile.velocity.X *= 1.075f; + projectile.velocity.Y *= 1.075f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + 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), 1.3f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + } + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 1; k++) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + } + } +} diff --git a/Projectiles/Melee/SandBlade.cs b/Projectiles/Melee/SandBlade.cs index 663515889b..31a7b4c7d3 100644 --- a/Projectiles/Melee/SandBlade.cs +++ b/Projectiles/Melee/SandBlade.cs @@ -1,63 +1,63 @@ -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 SandBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } - - public override void AI() - { - projectile.rotation += 0.5f; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 30f) - { - projectile.velocity.X *= 0.925f; - projectile.velocity.Y *= 0.925f; - } - else if (projectile.ai[1] > 30f && projectile.ai[1] <= 59f) - { - projectile.velocity.X *= 1.15f; - projectile.velocity.Y *= 1.15f; - } - else if (projectile.ai[1] == 60f) - { - projectile.ai[1] = 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; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, 0f, 0f); - } - } - } -} \ No newline at end of file +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 SandBlade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + } + + public override void AI() + { + projectile.rotation += 0.5f; + projectile.ai[1] += 1f; + if (projectile.ai[1] <= 30f) + { + projectile.velocity.X *= 0.925f; + projectile.velocity.Y *= 0.925f; + } + else if (projectile.ai[1] > 30f && projectile.ai[1] <= 59f) + { + projectile.velocity.X *= 1.15f; + projectile.velocity.Y *= 1.15f; + } + else if (projectile.ai[1] == 60f) + { + projectile.ai[1] = 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; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Melee/SandFire.cs b/Projectiles/Melee/SandFire.cs index ebdd8a5514..89fdb6e602 100644 --- a/Projectiles/Melee/SandFire.cs +++ b/Projectiles/Melee/SandFire.cs @@ -1,89 +1,89 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class SandFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.melee = true; - projectile.timeLeft = 60; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SandFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.melee = true; + projectile.timeLeft = 60; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Melee/ScourgeoftheCosmos.cs b/Projectiles/Melee/ScourgeoftheCosmos.cs index 20377aec39..91c6bb9b69 100644 --- a/Projectiles/Melee/ScourgeoftheCosmos.cs +++ b/Projectiles/Melee/ScourgeoftheCosmos.cs @@ -1,178 +1,178 @@ -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 ScourgeoftheCosmos : ModProjectile - { - private int bounce = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Scourge"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 255; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.GetGlobalProjectile(mod).rogue = true; - } - if (projectile.alpha <= 200) - { - int num3; - for (int num20 = 0; num20 < 2; num20 = num3 + 1) - { - int dustType = (Main.rand.Next(3) == 0 ? 56 : 242); - float num21 = projectile.velocity.X / 4f * (float)num20; - float num22 = projectile.velocity.Y / 4f * (float)num20; - int num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default(Color), 1f); - Main.dust[num23].position.X = projectile.Center.X - num21; - Main.dust[num23].position.Y = projectile.Center.Y - num22; - Dust dust = Main.dust[num23]; - dust.velocity *= 0f; - Main.dust[num23].scale = 0.7f; - num3 = num20; - } - } - projectile.alpha -= 50; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 180f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - - 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 bool OnTileCollide(Vector2 oldVelocity) - { - bounce--; - if (bounce <= 0) - { - projectile.Kill(); - } - else - { - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 4, 1f, 0f); - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - if (projectile.owner == Main.myPlayer) - { - int num626 = 1; - if (Main.rand.Next(10) == 0) - { - num626++; - } - int num3; - for (int num627 = 0; num627 < num626; num627 = num3 + 1) - { - float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; - num628 *= 10f; - num629 *= 10f; - if (!projectile.melee) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - num3 = num627; - } - } - } - return false; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 4, 1f, 0f); - int num3; - for (int num622 = 0; num622 < 10; num622 = num3 + 1) - { - int dustType = (Main.rand.Next(3) == 0 ? 56 : 242); - int num623 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default(Color), 1f); - Dust dust = Main.dust[num623]; - dust.scale *= 1.1f; - Main.dust[num623].noGravity = true; - num3 = num622; - } - for (int num624 = 0; num624 < 15; num624 = num3 + 1) - { - int dustType = (Main.rand.Next(3) == 0 ? 56 : 242); - int num625 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default(Color), 1f); - Dust dust = Main.dust[num625]; - dust.velocity *= 2.5f; - dust = Main.dust[num625]; - dust.scale *= 0.8f; - Main.dust[num625].noGravity = true; - num3 = num624; - } - if (projectile.owner == Main.myPlayer) - { - int num626 = 3; - if (Main.rand.Next(10) == 0) - { - num626++; - } - for (int num627 = 0; num627 < num626; num627 = num3 + 1) - { - float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; - num628 *= 10f; - num629 *= 10f; - if (!projectile.melee) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - num3 = num627; - } - } - } - } -} \ No newline at end of file +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 ScourgeoftheCosmos : ModProjectile + { + private int bounce = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Scourge"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.alpha = 255; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } + + public override void AI() + { + if (projectile.ai[1] == 1f) + { + projectile.melee = false; + projectile.GetGlobalProjectile(mod).rogue = true; + } + if (projectile.alpha <= 200) + { + int num3; + for (int num20 = 0; num20 < 2; num20 = num3 + 1) + { + int dustType = (Main.rand.Next(3) == 0 ? 56 : 242); + float num21 = projectile.velocity.X / 4f * (float)num20; + float num22 = projectile.velocity.Y / 4f * (float)num20; + int num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default(Color), 1f); + Main.dust[num23].position.X = projectile.Center.X - num21; + Main.dust[num23].position.Y = projectile.Center.Y - num22; + Dust dust = Main.dust[num23]; + dust.velocity *= 0f; + Main.dust[num23].scale = 0.7f; + num3 = num20; + } + } + projectile.alpha -= 50; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 180f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + 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 bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + { + projectile.Kill(); + } + else + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 4, 1f, 0f); + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + if (projectile.owner == Main.myPlayer) + { + int num626 = 1; + if (Main.rand.Next(10) == 0) + { + num626++; + } + int num3; + for (int num627 = 0; num627 < num626; num627 = num3 + 1) + { + float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; + float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; + num628 *= 10f; + num629 *= 10f; + if (!projectile.melee) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + } + num3 = num627; + } + } + } + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 4, 1f, 0f); + int num3; + for (int num622 = 0; num622 < 10; num622 = num3 + 1) + { + int dustType = (Main.rand.Next(3) == 0 ? 56 : 242); + int num623 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default(Color), 1f); + Dust dust = Main.dust[num623]; + dust.scale *= 1.1f; + Main.dust[num623].noGravity = true; + num3 = num622; + } + for (int num624 = 0; num624 < 15; num624 = num3 + 1) + { + int dustType = (Main.rand.Next(3) == 0 ? 56 : 242); + int num625 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default(Color), 1f); + Dust dust = Main.dust[num625]; + dust.velocity *= 2.5f; + dust = Main.dust[num625]; + dust.scale *= 0.8f; + Main.dust[num625].noGravity = true; + num3 = num624; + } + if (projectile.owner == Main.myPlayer) + { + int num626 = 3; + if (Main.rand.Next(10) == 0) + { + num626++; + } + for (int num627 = 0; num627 < num626; num627 = num3 + 1) + { + float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; + float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; + num628 *= 10f; + num629 *= 10f; + if (!projectile.melee) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); + } + else + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, mod.ProjectileType("ScourgeoftheCosmosMini"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + } + num3 = num627; + } + } + } + } +} diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs index d7b1f72459..555fc77c28 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosMini.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -1,182 +1,182 @@ -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 ScourgeoftheCosmosMini : ModProjectile - { - private int bounce = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Scourge Mini"); - Main.projFrames[projectile.type] = 2; - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - projectile.extraUpdates = 3; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.GetGlobalProjectile(mod).rogue = true; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 50; - } - else - { - projectile.extraUpdates = 0; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.frameCounter++; - if (projectile.frameCounter >= 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - int num3; - for (int num369 = 0; num369 < 1; num369 = num3 + 1) - { - int dustType = (Main.rand.Next(3) == 0 ? 56 : 242); - float num370 = projectile.velocity.X / 3f * (float)num369; - float num371 = projectile.velocity.Y / 3f * (float)num369; - int num372 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default(Color), 1f); - Main.dust[num372].position.X = projectile.Center.X - num370; - Main.dust[num372].position.Y = projectile.Center.Y - num371; - Dust dust = Main.dust[num372]; - dust.velocity *= 0f; - Main.dust[num372].scale = 0.5f; - num3 = num369; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - 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 num4; - for (int num376 = 0; num376 < 200; num376 = num4 + 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; - } - } - num4 = 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.16f; - 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) - { - bounce--; - if (bounce <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - - public override void PostDraw(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; - Vector2 origin = new Vector2(9f, 10f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ScourgeoftheCosmosMiniGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - } -} \ No newline at end of file +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 ScourgeoftheCosmosMini : ModProjectile + { + private int bounce = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Scourge Mini"); + Main.projFrames[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + projectile.extraUpdates = 3; + } + + public override void AI() + { + if (projectile.ai[1] == 1f) + { + projectile.melee = false; + projectile.GetGlobalProjectile(mod).rogue = true; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 50; + } + else + { + projectile.extraUpdates = 0; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.frameCounter++; + if (projectile.frameCounter >= 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + int num3; + for (int num369 = 0; num369 < 1; num369 = num3 + 1) + { + int dustType = (Main.rand.Next(3) == 0 ? 56 : 242); + float num370 = projectile.velocity.X / 3f * (float)num369; + float num371 = projectile.velocity.Y / 3f * (float)num369; + int num372 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default(Color), 1f); + Main.dust[num372].position.X = projectile.Center.X - num370; + Main.dust[num372].position.Y = projectile.Center.Y - num371; + Dust dust = Main.dust[num372]; + dust.velocity *= 0f; + Main.dust[num372].scale = 0.5f; + num3 = num369; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + 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 num4; + for (int num376 = 0; num376 < 200; num376 = num4 + 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; + } + } + num4 = 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.16f; + 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) + { + bounce--; + if (bounce <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } + + public override void PostDraw(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; + Vector2 origin = new Vector2(9f, 10f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/ScourgeoftheCosmosMiniGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Projectiles/Melee/SeashellBoomerangProjectileMelee.cs b/Projectiles/Melee/SeashellBoomerangProjectileMelee.cs index 8355da91d5..877e8c7940 100644 --- a/Projectiles/Melee/SeashellBoomerangProjectileMelee.cs +++ b/Projectiles/Melee/SeashellBoomerangProjectileMelee.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class SeashellBoomerangProjectileMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boomerang"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 240; - aiType = 52; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SeashellBoomerangProjectileMelee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boomerang"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 240; + aiType = 52; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + } +} diff --git a/Projectiles/Melee/ShortBeam.cs b/Projectiles/Melee/ShortBeam.cs index 63b40ae35f..2c9f04c070 100644 --- a/Projectiles/Melee/ShortBeam.cs +++ b/Projectiles/Melee/ShortBeam.cs @@ -1,60 +1,60 @@ -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 ShortBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 60; - aiType = 156; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, 0f, ((255 - projectile.alpha) * 0.2f) / 255f); - projectile.velocity.Y += projectile.ai[0]; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.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, 73, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - } - } -} \ No newline at end of file +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 ShortBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 60; + aiType = 156; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, 0f, ((255 - projectile.alpha) * 0.2f) / 255f); + projectile.velocity.Y += projectile.ai[0]; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.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, 73, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + } + } +} diff --git a/Projectiles/Melee/ShortNightBeam.cs b/Projectiles/Melee/ShortNightBeam.cs index 1f9e45d94b..83d1280bb1 100644 --- a/Projectiles/Melee/ShortNightBeam.cs +++ b/Projectiles/Melee/ShortNightBeam.cs @@ -1,60 +1,60 @@ -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 ShortNightBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 60; - aiType = 132; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); - projectile.velocity.Y += projectile.ai[0]; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 21, projectile.velocity.X * 0.5f, projectile.velocity.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, 21, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - } - } -} \ No newline at end of file +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 ShortNightBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 60; + aiType = 132; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); + projectile.velocity.Y += projectile.ai[0]; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 21, projectile.velocity.X * 0.5f, projectile.velocity.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, 21, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + } + } +} diff --git a/Projectiles/Melee/ShortTerraBeam.cs b/Projectiles/Melee/ShortTerraBeam.cs index f02a787b68..98c4819338 100644 --- a/Projectiles/Melee/ShortTerraBeam.cs +++ b/Projectiles/Melee/ShortTerraBeam.cs @@ -1,65 +1,65 @@ -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 ShortTerraBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 6; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 4; - projectile.timeLeft = 120; - aiType = 132; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.75f) / 255f, 0f); - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); - } - } - - 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(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} \ No newline at end of file +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 ShortTerraBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 6; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 4; + projectile.timeLeft = 120; + aiType = 132; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.75f) / 255f, 0f); + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); + } + } + + 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(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } +} diff --git a/Projectiles/Melee/SolarFlare.cs b/Projectiles/Melee/SolarFlare.cs index c0c1696a1f..36b1a6c564 100644 --- a/Projectiles/Melee/SolarFlare.cs +++ b/Projectiles/Melee/SolarFlare.cs @@ -1,129 +1,129 @@ -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 SolarFlare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.alpha = 150; - projectile.melee = true; - projectile.timeLeft = 120; - } - - public override void AI() - { - if (projectile.timeLeft < 60) - { - projectile.tileCollide = true; - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 15; - if (projectile.alpha >= 150) - { - projectile.alpha = 150; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.75f, 0.75f, 0f); - } - - 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) - { - float spread = 180f * 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) - { - for (i = 0; i < 1; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandFire"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandFire"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - 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 = 50; - projectile.height = 50; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default(Color), 0.5f); - 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 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default(Color), 1f); - 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, 159, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - } - } -} \ No newline at end of file +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 SolarFlare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.alpha = 150; + projectile.melee = true; + projectile.timeLeft = 120; + } + + public override void AI() + { + if (projectile.timeLeft < 60) + { + projectile.tileCollide = true; + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 15; + if (projectile.alpha >= 150) + { + projectile.alpha = 150; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.75f, 0.75f, 0f); + } + + 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) + { + float spread = 180f * 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) + { + for (i = 0; i < 1; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandFire"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandFire"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + 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 = 50; + projectile.height = 50; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 159, 0f, 0f, 100, default(Color), 0.5f); + 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 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default(Color), 1f); + 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, 159, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + } + } +} diff --git a/Projectiles/Melee/SolsticeBeam.cs b/Projectiles/Melee/SolsticeBeam.cs index c51241bb00..03ee3bd062 100644 --- a/Projectiles/Melee/SolsticeBeam.cs +++ b/Projectiles/Melee/SolsticeBeam.cs @@ -1,201 +1,201 @@ -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 SolsticeBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item60, projectile.position); - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - int dustType = 0; - - switch (CalamityMod.season) - { - case Season.Spring: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 74, - 157, - 107 - }); - break; - case Season.Summer: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 247, - 228, - 57 - }); - break; - case Season.Fall: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 6, - 259, - 158 - }); - break; - case Season.Winter: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 67, - 229, - 185 - }); - break; - } - if (Main.rand.Next(3) == 0) - { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f); - Main.dust[dust].noGravity = true; - } - } - - public override Color? GetAlpha(Color lightColor) - { - byte red = 255; - byte green = 255; - byte blue = 255; - switch (CalamityMod.season) - { - case Season.Spring: - red = 0; - green = 250; - blue = 0; - break; - case Season.Summer: - red = 250; - green = 250; - blue = 0; - break; - case Season.Fall: - red = 250; - green = 150; - blue = 50; - break; - case Season.Winter: - red = 100; - green = 150; - blue = 250; - break; - } - return new Color(red, green, blue, 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; - } - - public override void Kill(int timeLeft) - { - int dustType = 0; - - switch (CalamityMod.season) - { - case Season.Spring: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 245, - 157, - 107 - }); - break; - case Season.Summer: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 247, - 228, - 57 - }); - break; - case Season.Fall: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 6, - 259, - 158 - }); - break; - case Season.Winter: - dustType = Utils.SelectRandom(Main.rand, new int[] - { - 67, - 229, - 185 - }); - break; - } - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, dustType, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, dustType, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - int buff = Main.dayTime ? BuffID.Daybreak : mod.BuffType("Nightwither"); - target.AddBuff(buff, 300); - } - } -} \ No newline at end of file +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 SolsticeBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item60, projectile.position); + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + int dustType = 0; + + switch (CalamityMod.season) + { + case Season.Spring: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 74, + 157, + 107 + }); + break; + case Season.Summer: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 247, + 228, + 57 + }); + break; + case Season.Fall: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 6, + 259, + 158 + }); + break; + case Season.Winter: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 67, + 229, + 185 + }); + break; + } + if (Main.rand.Next(3) == 0) + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f); + Main.dust[dust].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + byte red = 255; + byte green = 255; + byte blue = 255; + switch (CalamityMod.season) + { + case Season.Spring: + red = 0; + green = 250; + blue = 0; + break; + case Season.Summer: + red = 250; + green = 250; + blue = 0; + break; + case Season.Fall: + red = 250; + green = 150; + blue = 50; + break; + case Season.Winter: + red = 100; + green = 150; + blue = 250; + break; + } + return new Color(red, green, blue, 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; + } + + public override void Kill(int timeLeft) + { + int dustType = 0; + + switch (CalamityMod.season) + { + case Season.Spring: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 245, + 157, + 107 + }); + break; + case Season.Summer: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 247, + 228, + 57 + }); + break; + case Season.Fall: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 6, + 259, + 158 + }); + break; + case Season.Winter: + dustType = Utils.SelectRandom(Main.rand, new int[] + { + 67, + 229, + 185 + }); + break; + } + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, dustType, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, dustType, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int buff = Main.dayTime ? BuffID.Daybreak : mod.BuffType("Nightwither"); + target.AddBuff(buff, 300); + } + } +} diff --git a/Projectiles/Melee/SoulScythe.cs b/Projectiles/Melee/SoulScythe.cs index f5268695a1..3cdf9eeaa5 100644 --- a/Projectiles/Melee/SoulScythe.cs +++ b/Projectiles/Melee/SoulScythe.cs @@ -1,100 +1,100 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class SoulScythe : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.aiStyle = 18; - projectile.alpha = 55; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 420; - projectile.ignoreWater = true; - projectile.tileCollide = false; - aiType = 274; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.5f) / 255f, 0f); - if (Main.rand.Next(2) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 75, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(mod.BuffType("Plague"), 300); - if (target.life <= (target.lifeMax * 0.15f)) - { - Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 14); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("HiveBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 60; - 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 num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.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(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, 89, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SoulScythe : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.aiStyle = 18; + projectile.alpha = 55; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 420; + projectile.ignoreWater = true; + projectile.tileCollide = false; + aiType = 274; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.5f) / 255f, 0f); + if (Main.rand.Next(2) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 75, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(mod.BuffType("Plague"), 300); + if (target.life <= (target.lifeMax * 0.15f)) + { + Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 14); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("HiveBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 60; + 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 num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.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(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, 89, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } +} diff --git a/Projectiles/Melee/Spark.cs b/Projectiles/Melee/Spark.cs index b039270628..376e24e313 100644 --- a/Projectiles/Melee/Spark.cs +++ b/Projectiles/Melee/Spark.cs @@ -1,99 +1,99 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Spark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("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; - 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; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 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, 206, 0f, 0f, 100, default(Color), 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; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Spark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("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; + 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; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 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, 206, 0f, 0f, 100, default(Color), 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; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} diff --git a/Projectiles/Melee/SpatialSpear.cs b/Projectiles/Melee/SpatialSpear.cs index d1179deed7..9ca76d50ca 100644 --- a/Projectiles/Melee/SpatialSpear.cs +++ b/Projectiles/Melee/SpatialSpear.cs @@ -1,121 +1,121 @@ -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 SpatialSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.05f, 1f, 0.05f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 60f) - { - projectile.ai[0] = 60f; - projectile.velocity.Y = projectile.velocity.Y + 0.25f; - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - projectile.velocity.X = projectile.velocity.X * 0.995f; - } - if (projectile.localAI[1] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) - { - projectile.alpha = 130; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[1] = 0f; - } - } - if (Main.rand.Next(8) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.localAI[0] = 0f; - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear2"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} \ No newline at end of file +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 SpatialSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 180; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.05f, 1f, 0.05f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 60f) + { + projectile.ai[0] = 60f; + projectile.velocity.Y = projectile.velocity.Y + 0.25f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + projectile.velocity.X = projectile.velocity.X * 0.995f; + } + if (projectile.localAI[1] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 125) + { + projectile.alpha = 130; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[1] = 0f; + } + } + if (Main.rand.Next(8) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.localAI[0] = 0f; + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear2"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 12; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } +} diff --git a/Projectiles/Melee/SpatialSpear2.cs b/Projectiles/Melee/SpatialSpear2.cs index 870f443f9d..5d8775e325 100644 --- a/Projectiles/Melee/SpatialSpear2.cs +++ b/Projectiles/Melee/SpatialSpear2.cs @@ -1,109 +1,109 @@ -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 SpatialSpear2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 2; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.05f, 0.05f, 1f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.localAI[1] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) - { - projectile.alpha = 130; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[1] = 0f; - } - } - if (Main.rand.Next(8) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.localAI[0] = 0f; - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear3"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - - public override void Kill(int timeLeft) - { - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} \ No newline at end of file +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 SpatialSpear2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 2; + projectile.timeLeft = 120; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.05f, 0.05f, 1f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.localAI[1] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 125) + { + projectile.alpha = 130; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[1] = 0f; + } + } + if (Main.rand.Next(8) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.localAI[0] = 0f; + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear3"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + + public override void Kill(int timeLeft) + { + int num3; + for (int num795 = 4; num795 < 12; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } +} diff --git a/Projectiles/Melee/SpatialSpear3.cs b/Projectiles/Melee/SpatialSpear3.cs index ba6b61b4bd..2441a27283 100644 --- a/Projectiles/Melee/SpatialSpear3.cs +++ b/Projectiles/Melee/SpatialSpear3.cs @@ -1,107 +1,107 @@ -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 SpatialSpear3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 80; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 1f, 0.05f, 0.05f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.localAI[1] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) - { - projectile.alpha = 130; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[1] = 0f; - } - } - if (Main.rand.Next(8) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.localAI[0] = 0f; - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear4"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - - public override void Kill(int timeLeft) - { - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} \ No newline at end of file +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 SpatialSpear3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 80; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 1f, 0.05f, 0.05f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.localAI[1] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 125) + { + projectile.alpha = 130; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[1] = 0f; + } + } + if (Main.rand.Next(8) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.localAI[0] = 0f; + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.5f, perturbedSpeed.Y * 0.5f, mod.ProjectileType("SpatialSpear4"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + + public override void Kill(int timeLeft) + { + int num3; + for (int num795 = 4; num795 < 12; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } +} diff --git a/Projectiles/Melee/SpatialSpear4.cs b/Projectiles/Melee/SpatialSpear4.cs index a9244188c0..0226b00c04 100644 --- a/Projectiles/Melee/SpatialSpear4.cs +++ b/Projectiles/Melee/SpatialSpear4.cs @@ -1,92 +1,92 @@ -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 SpatialSpear4 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 50; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.05f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.localAI[1] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) - { - projectile.alpha = 130; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[1] = 0f; - } - } - if (Main.rand.Next(8) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - } - - 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("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - - public override void Kill(int timeLeft) - { - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 244, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 244, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} \ No newline at end of file +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 SpatialSpear4 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 50; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.05f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.localAI[1] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 125) + { + projectile.alpha = 130; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[1] = 0f; + } + } + if (Main.rand.Next(8) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + } + + 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("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + + public override void Kill(int timeLeft) + { + int num3; + for (int num795 = 4; num795 < 12; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 244, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 244, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } +} diff --git a/Projectiles/Melee/Spears/AstralPike.cs b/Projectiles/Melee/Spears/AstralPike.cs index 627e0d45da..c82f6d6a3f 100644 --- a/Projectiles/Melee/Spears/AstralPike.cs +++ b/Projectiles/Melee/Spears/AstralPike.cs @@ -1,117 +1,117 @@ -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 AstralPike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pike"); - } - - 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; - 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, mod.DustType("AstralOrange"), 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; - if (crit) - { - for (int i = 0; i < 3; i++) - { - float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AstralStar"), (int)((double)projectile.damage * 0.2), 1f, projectile.owner); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; - } - } - } - } - } -} \ No newline at end of file +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 AstralPike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pike"); + } + + 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; + 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, mod.DustType("AstralOrange"), 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; + if (crit) + { + for (int i = 0; i < 3; i++) + { + float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AstralStar"), (int)((double)projectile.damage * 0.2), 1f, projectile.owner); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } + } + } + } + } +} diff --git a/Projectiles/Melee/Spears/BansheeHook.cs b/Projectiles/Melee/Spears/BansheeHook.cs index 35fcef4e76..944d8e237d 100644 --- a/Projectiles/Melee/Spears/BansheeHook.cs +++ b/Projectiles/Melee/Spears/BansheeHook.cs @@ -1,153 +1,153 @@ -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.Spears -{ - public class BansheeHook : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Banshee Hook"); - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.melee = true; - projectile.timeLeft = 90; - projectile.height = 40; - projectile.friendly = true; - projectile.hostile = false; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.ownerHitCheck = true; - projectile.hide = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - projectile.alpha = 255; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - projectile.direction = player.direction; - player.heldProj = projectile.whoAmI; - projectile.Center = vector; - if (player.dead) - { - projectile.Kill(); - return; - } - if (!player.frozen) - { - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X + (projectile.velocity.X * 0.5f), projectile.Center.Y + (projectile.velocity.Y * 0.5f), - projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f, mod.ProjectileType("BansheeHookScythe"), (int)((double)projectile.damage * 1.75), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); - } - } - projectile.spriteDirection = (projectile.direction = player.direction); - projectile.alpha -= 127; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - float num = (float)player.itemAnimation / (float)player.itemAnimationMax; - float num2 = 1f - num; - float num3 = projectile.velocity.ToRotation(); - float num4 = projectile.velocity.Length(); - float num5 = 22f; - Vector2 spinningpoint = new Vector2(1f, 0f).RotatedBy((double)(3.14159274f + num2 * 6.28318548f), default(Vector2)) * new Vector2(num4, projectile.ai[0]); - projectile.position += spinningpoint.RotatedBy((double)num3, default(Vector2)) + new Vector2(num4 + num5, 0f).RotatedBy((double)num3, default(Vector2)); - Vector2 destination = vector + spinningpoint.RotatedBy((double)num3, default(Vector2)) + new Vector2(num4 + num5 + 40f, 0f).RotatedBy((double)num3, default(Vector2)); - projectile.rotation = player.AngleTo(destination) + ((float)(Math.PI * 0.25)) * (float)player.direction; //or this - if (projectile.spriteDirection == -1) - { - projectile.rotation += (float)Math.PI; //change this - } - player.DirectionTo(projectile.Center); - Vector2 value = player.DirectionTo(destination); - Vector2 vector2 = projectile.velocity.SafeNormalize(Vector2.UnitY); - float num6 = 2f; - int num7 = 0; - while ((float)num7 < num6) - { - Dust dust = Dust.NewDustDirect(projectile.Center, 14, 14, 60, 0f, 0f, 110, default(Color), 1f); - dust.velocity = player.DirectionTo(dust.position) * 2f; - dust.position = projectile.Center + vector2.RotatedBy((double)(num2 * 6.28318548f * 2f + (float)num7 / num6 * 6.28318548f), default(Vector2)) * 10f; - dust.scale = 1f + 0.6f * Main.rand.NextFloat(); - dust.velocity += vector2 * 3f; - dust.noGravity = true; - num7++; - } - for (int i = 0; i < 1; i++) - { - if (Main.rand.Next(3) == 0) - { - Dust dust2 = Dust.NewDustDirect(projectile.Center, 20, 20, 60, 0f, 0f, 110, default(Color), 1f); - dust2.velocity = player.DirectionTo(dust2.position) * 2f; - dust2.position = projectile.Center + value * -110f; - dust2.scale = 0.45f + 0.4f * Main.rand.NextFloat(); - dust2.fadeIn = 0.7f + 0.4f * Main.rand.NextFloat(); - dust2.noGravity = true; - dust2.noLight = true; - } - } - } - if (player.itemAnimation == 2) - { - projectile.Kill(); - player.reuseDelay = 2; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Vector2 vector53 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D31 = (projectile.spriteDirection == -1) ? mod.GetTexture("Projectiles/Melee/Spears/BansheeHookAlt") : Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Color alpha4 = projectile.GetAlpha(color25); - Vector2 origin8 = new Vector2((float)texture2D31.Width, (float)texture2D31.Height) / 2f; - origin8 = new Vector2((projectile.spriteDirection == 1) ? ((float)texture2D31.Width - -8f) : -8f, -8f); //-8 -8 - SpriteBatch arg_E055_0 = Main.spriteBatch; - Vector2 arg_E055_2 = vector53; - Microsoft.Xna.Framework.Rectangle? sourceRectangle2 = null; - arg_E055_0.Draw(texture2D31, arg_E055_2, sourceRectangle2, new Microsoft.Xna.Framework.Color(255, 255, 255, 127), projectile.rotation, origin8, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float f2 = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X) + ((projectile.spriteDirection == -1) ? 3.14159274f : 0f); - float num4 = 0f; - float scaleFactor = -95f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + f2.ToRotationVector2() * scaleFactor, 23f * projectile.scale, ref num4)) - { - return true; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BansheeHookBoom"), (int)((double)damage * 0.25), 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - } - } - } -} \ No newline at end of file +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.Spears +{ + public class BansheeHook : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Banshee Hook"); + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.melee = true; + projectile.timeLeft = 90; + projectile.height = 40; + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + projectile.alpha = 255; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + projectile.direction = player.direction; + player.heldProj = projectile.whoAmI; + projectile.Center = vector; + if (player.dead) + { + projectile.Kill(); + return; + } + if (!player.frozen) + { + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X + (projectile.velocity.X * 0.5f), projectile.Center.Y + (projectile.velocity.Y * 0.5f), + projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f, mod.ProjectileType("BansheeHookScythe"), (int)((double)projectile.damage * 1.75), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + } + } + projectile.spriteDirection = (projectile.direction = player.direction); + projectile.alpha -= 127; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + float num = (float)player.itemAnimation / (float)player.itemAnimationMax; + float num2 = 1f - num; + float num3 = projectile.velocity.ToRotation(); + float num4 = projectile.velocity.Length(); + float num5 = 22f; + Vector2 spinningpoint = new Vector2(1f, 0f).RotatedBy((double)(3.14159274f + num2 * 6.28318548f), default(Vector2)) * new Vector2(num4, projectile.ai[0]); + projectile.position += spinningpoint.RotatedBy((double)num3, default(Vector2)) + new Vector2(num4 + num5, 0f).RotatedBy((double)num3, default(Vector2)); + Vector2 destination = vector + spinningpoint.RotatedBy((double)num3, default(Vector2)) + new Vector2(num4 + num5 + 40f, 0f).RotatedBy((double)num3, default(Vector2)); + projectile.rotation = player.AngleTo(destination) + ((float)(Math.PI * 0.25)) * (float)player.direction; //or this + if (projectile.spriteDirection == -1) + { + projectile.rotation += (float)Math.PI; //change this + } + player.DirectionTo(projectile.Center); + Vector2 value = player.DirectionTo(destination); + Vector2 vector2 = projectile.velocity.SafeNormalize(Vector2.UnitY); + float num6 = 2f; + int num7 = 0; + while ((float)num7 < num6) + { + Dust dust = Dust.NewDustDirect(projectile.Center, 14, 14, 60, 0f, 0f, 110, default(Color), 1f); + dust.velocity = player.DirectionTo(dust.position) * 2f; + dust.position = projectile.Center + vector2.RotatedBy((double)(num2 * 6.28318548f * 2f + (float)num7 / num6 * 6.28318548f), default(Vector2)) * 10f; + dust.scale = 1f + 0.6f * Main.rand.NextFloat(); + dust.velocity += vector2 * 3f; + dust.noGravity = true; + num7++; + } + for (int i = 0; i < 1; i++) + { + if (Main.rand.Next(3) == 0) + { + Dust dust2 = Dust.NewDustDirect(projectile.Center, 20, 20, 60, 0f, 0f, 110, default(Color), 1f); + dust2.velocity = player.DirectionTo(dust2.position) * 2f; + dust2.position = projectile.Center + value * -110f; + dust2.scale = 0.45f + 0.4f * Main.rand.NextFloat(); + dust2.fadeIn = 0.7f + 0.4f * Main.rand.NextFloat(); + dust2.noGravity = true; + dust2.noLight = true; + } + } + } + if (player.itemAnimation == 2) + { + projectile.Kill(); + player.reuseDelay = 2; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Vector2 vector53 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D31 = (projectile.spriteDirection == -1) ? mod.GetTexture("Projectiles/Melee/Spears/BansheeHookAlt") : Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Color alpha4 = projectile.GetAlpha(color25); + Vector2 origin8 = new Vector2((float)texture2D31.Width, (float)texture2D31.Height) / 2f; + origin8 = new Vector2((projectile.spriteDirection == 1) ? ((float)texture2D31.Width - -8f) : -8f, -8f); //-8 -8 + SpriteBatch arg_E055_0 = Main.spriteBatch; + Vector2 arg_E055_2 = vector53; + Microsoft.Xna.Framework.Rectangle? sourceRectangle2 = null; + arg_E055_0.Draw(texture2D31, arg_E055_2, sourceRectangle2, new Microsoft.Xna.Framework.Color(255, 255, 255, 127), projectile.rotation, origin8, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float f2 = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X) + ((projectile.spriteDirection == -1) ? 3.14159274f : 0f); + float num4 = 0f; + float scaleFactor = -95f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + f2.ToRotationVector2() * scaleFactor, 23f * projectile.scale, ref num4)) + { + return true; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BansheeHookBoom"), (int)((double)damage * 0.25), 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + } + } +} diff --git a/Projectiles/Melee/Spears/Brimlance.cs b/Projectiles/Melee/Spears/Brimlance.cs index 1dca98fa4e..870904c47d 100644 --- a/Projectiles/Melee/Spears/Brimlance.cs +++ b/Projectiles/Melee/Spears/Brimlance.cs @@ -1,99 +1,99 @@ -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 Brimlance : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimlance"); - } - - 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 this 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; - 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(4) == 0) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, (float)(projectile.direction * 2), 0f, 150, default(Color), 1f); - Main.dust[num].noGravity = true; - } - 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] = 7; - if (target.life <= 0) - { - int num251 = Main.rand.Next(2, 5); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrimlanceHellfireExplosion"), (int)((double)projectile.damage * 0.75), knockback, Main.myPlayer); - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("BrimlanceStandingFire"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } - } - } - } -} \ No newline at end of file +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 Brimlance : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimlance"); + } + + 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 this 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; + 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(4) == 0) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, (float)(projectile.direction * 2), 0f, 150, default(Color), 1f); + Main.dust[num].noGravity = true; + } + 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] = 7; + if (target.life <= 0) + { + int num251 = Main.rand.Next(2, 5); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrimlanceHellfireExplosion"), (int)((double)projectile.damage * 0.75), knockback, Main.myPlayer); + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("BrimlanceStandingFire"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } + } + } + } +} diff --git a/Projectiles/Melee/Spears/DiseasedPike.cs b/Projectiles/Melee/Spears/DiseasedPike.cs index eb11f9ddcd..cf4fc846e4 100644 --- a/Projectiles/Melee/Spears/DiseasedPike.cs +++ b/Projectiles/Melee/Spears/DiseasedPike.cs @@ -1,89 +1,89 @@ -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 DiseasedPike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pike"); - } - - 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; - 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(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, 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; - target.AddBuff(mod.BuffType("Plague"), 360); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i <= 3; i++) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f, mod.ProjectileType("PlagueSeeker"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +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 DiseasedPike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pike"); + } + + 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; + 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(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, 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; + target.AddBuff(mod.BuffType("Plague"), 360); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i <= 3; i++) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f, mod.ProjectileType("PlagueSeeker"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Melee/Spears/EarthenPike.cs b/Projectiles/Melee/Spears/EarthenPike.cs index fb1bc831c8..c5e921e58b 100644 --- a/Projectiles/Melee/Spears/EarthenPike.cs +++ b/Projectiles/Melee/Spears/EarthenPike.cs @@ -1,97 +1,97 @@ -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 EarthenPike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pike"); - } - - 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 (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - projectile.localAI[0] = 0f; - if (Main.myPlayer == projectile.owner) - { - float velocityY = projectile.velocity.Y * 1.25f; - if (velocityY < 0.1f) - { - velocityY = 0.1f; - } - int proj = Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 1.25f, velocityY, mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = 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] = 8; - target.AddBuff(mod.BuffType("ArmorCrunch"), 300); - } - } -} \ No newline at end of file +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 EarthenPike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pike"); + } + + 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 (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { + projectile.localAI[0] = 0f; + if (Main.myPlayer == projectile.owner) + { + float velocityY = projectile.velocity.Y * 1.25f; + if (velocityY < 0.1f) + { + velocityY = 0.1f; + } + int proj = Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, + projectile.velocity.X * 1.25f, velocityY, mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = 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] = 8; + target.AddBuff(mod.BuffType("ArmorCrunch"), 300); + } + } +} diff --git a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs index ea3810ada0..d7ed9e64ee 100644 --- a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs @@ -1,119 +1,119 @@ -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 ExsanguinationLanceProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lance"); - } - - 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. - projectile.timeLeft = 90; - projectile.height = 95; //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; - 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; - 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; - target.AddBuff(BuffID.OnFire, 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); - } - if (crit) - { - for (int i = 0; i < 2; i++) - { - float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("TinyFlare"), (int)((double)projectile.damage * 0.5), 2f, projectile.owner); - } - } - } - } - } -} \ No newline at end of file +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 ExsanguinationLanceProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lance"); + } + + 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. + projectile.timeLeft = 90; + projectile.height = 95; //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; + 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; + 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; + target.AddBuff(BuffID.OnFire, 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); + } + if (crit) + { + for (int i = 0; i < 2; i++) + { + float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("TinyFlare"), (int)((double)projectile.damage * 0.5), 2f, projectile.owner); + } + } + } + } + } +} diff --git a/Projectiles/Melee/Spears/FulgurationHalberd.cs b/Projectiles/Melee/Spears/FulgurationHalberd.cs index cd99dfe8d4..7b7cb7eea3 100644 --- a/Projectiles/Melee/Spears/FulgurationHalberd.cs +++ b/Projectiles/Melee/Spears/FulgurationHalberd.cs @@ -68,4 +68,4 @@ namespace CalamityMod.Projectiles.Melee.Spears target.AddBuff(mod.BuffType("BurningBlood"), 300); } } -} \ No newline at end of file +} diff --git a/Projectiles/Melee/Spears/GildedProboscis.cs b/Projectiles/Melee/Spears/GildedProboscis.cs index dfeb147d4f..b904ecbb4e 100644 --- a/Projectiles/Melee/Spears/GildedProboscis.cs +++ b/Projectiles/Melee/Spears/GildedProboscis.cs @@ -1,88 +1,88 @@ -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 GildedProboscis : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Proboscis"); - } - - 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 this 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; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - 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(4) == 0) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, (float)(projectile.direction * 2), 0f, 150, default(Color), 1f); - Main.dust[num].noGravity = true; - } - 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) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 1; - player.HealEffect(1); - } - } -} \ No newline at end of file +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 GildedProboscis : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Proboscis"); + } + + 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 this 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; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + 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(4) == 0) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, (float)(projectile.direction * 2), 0f, 150, default(Color), 1f); + Main.dust[num].noGravity = true; + } + 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) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 1; + player.HealEffect(1); + } + } +} diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index cc4dae07d5..2dc929e36f 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -1,81 +1,81 @@ -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 GoldplumeSpearProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 54; //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. - projectile.timeLeft = 90; - projectile.height = 54; //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 (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - projectile.localAI[0] = 0f; - if (Main.myPlayer == projectile.owner) - { - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("Feather"), (int)((double)projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f); - } - } - if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 1.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; - } - } - } -} \ No newline at end of file +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 GoldplumeSpearProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 54; //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. + projectile.timeLeft = 90; + projectile.height = 54; //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 (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { + projectile.localAI[0] = 0f; + if (Main.myPlayer == projectile.owner) + { + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, + projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("Feather"), (int)((double)projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f); + } + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 1.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; + } + } + } +} diff --git a/Projectiles/Melee/Spears/HeartRapierProjectile.cs b/Projectiles/Melee/Spears/HeartRapierProjectile.cs index 9ef586cbde..2511143f1f 100644 --- a/Projectiles/Melee/Spears/HeartRapierProjectile.cs +++ b/Projectiles/Melee/Spears/HeartRapierProjectile.cs @@ -1,81 +1,81 @@ -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 HeartRapierProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rapier"); - } - - public override void SetDefaults() - { - projectile.width = 44; //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. - projectile.timeLeft = 90; - projectile.height = 44; //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; - 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, 12, 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] -= 1.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) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - Player player = Main.player[projectile.owner]; - player.statLife += 5; - player.HealEffect(5); - } - } -} \ No newline at end of file +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 HeartRapierProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rapier"); + } + + public override void SetDefaults() + { + projectile.width = 44; //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. + projectile.timeLeft = 90; + projectile.height = 44; //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; + 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, 12, 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] -= 1.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) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 5; + player.HealEffect(5); + } + } +} diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index b3eef4d9aa..17d92a0be2 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -1,114 +1,114 @@ -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 HellionFlowerSpearProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - 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 this 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 (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, 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.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, mod.ProjectileType("HellionSpike"), (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; - target.AddBuff(BuffID.Venom, 300); - if (crit) - { - float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(600, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)((double)projectile.damage * 0.5), 2f, projectile.owner); - } - } - } - } -} \ No newline at end of file +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 HellionFlowerSpearProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + 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 this 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 (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, 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.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, mod.ProjectileType("HellionSpike"), (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; + target.AddBuff(BuffID.Venom, 300); + if (crit) + { + float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(600, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)((double)projectile.damage * 0.5), 2f, projectile.owner); + } + } + } + } +} diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs index 4209eba86e..aff575f3d2 100644 --- a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs +++ b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs @@ -1,68 +1,68 @@ -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 MarniteSpearProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 50; //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. - projectile.timeLeft = 90; - projectile.height = 50; //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; - 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(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] -= 1.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; - } - } - } -} \ No newline at end of file +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 MarniteSpearProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 50; //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. + projectile.timeLeft = 90; + projectile.height = 50; //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; + 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(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] -= 1.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; + } + } + } +} diff --git a/Projectiles/Melee/Spears/SausageMaker.cs b/Projectiles/Melee/Spears/SausageMaker.cs index 1e20b0b5f8..cc537aba09 100644 --- a/Projectiles/Melee/Spears/SausageMaker.cs +++ b/Projectiles/Melee/Spears/SausageMaker.cs @@ -1,83 +1,83 @@ -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 SausageMaker : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 44; //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. - projectile.timeLeft = 90; - projectile.height = 42; //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; - 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, 5, 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] -= 1.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) - { - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 2; i++) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 1.2f, projectile.velocity.Y * 1.2f, mod.ProjectileType("Blood2"), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +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 SausageMaker : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 44; //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. + projectile.timeLeft = 90; + projectile.height = 42; //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; + 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, 5, 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] -= 1.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) + { + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 1.2f, projectile.velocity.Y * 1.2f, mod.ProjectileType("Blood2"), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs index 45accb566e..eb3e0380b2 100644 --- a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs +++ b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs @@ -1,88 +1,88 @@ -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 SpatialLanceProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lance"); - } - - 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 this 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; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } - - 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) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num].noGravity = true; - } - 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.Center.Y + projectile.velocity.Y, - projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("SpatialSpear"), projectile.damage, projectile.knockBack, 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.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +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 SpatialLanceProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lance"); + } + + 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 this 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; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + + 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) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num].noGravity = true; + } + 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.Center.Y + projectile.velocity.Y, + projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("SpatialSpear"), projectile.damage, projectile.knockBack, 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.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index 5281dea304..fbe5e5b2dd 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -1,83 +1,83 @@ -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 StarnightLanceProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lance"); - } - - 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 (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.Center.Y + projectile.velocity.Y, - 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; - target.AddBuff(BuffID.Frostburn, 120); - } - } -} \ No newline at end of file +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 StarnightLanceProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lance"); + } + + 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 (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.Center.Y + projectile.velocity.Y, + 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; + target.AddBuff(BuffID.Frostburn, 120); + } + } +} diff --git a/Projectiles/Melee/Spears/StreamGouge.cs b/Projectiles/Melee/Spears/StreamGouge.cs index 55f29f0bb4..7c68e92f13 100644 --- a/Projectiles/Melee/Spears/StreamGouge.cs +++ b/Projectiles/Melee/Spears/StreamGouge.cs @@ -1,83 +1,83 @@ -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 StreamGouge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gouge"); - } - - 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 this 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; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - 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) - { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, (float)(projectile.direction * 2), 0f, 150, default(Color), 1f); - Main.dust[num].noGravity = true; - } - 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.Center.Y, projectile.velocity.X, projectile.velocity.Y, - mod.ProjectileType("EssenceBeam"), projectile.damage * 4, projectile.knockBack, 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.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } - } -} \ No newline at end of file +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 StreamGouge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gouge"); + } + + 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 this 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; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + 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) + { + int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, (float)(projectile.direction * 2), 0f, 150, default(Color), 1f); + Main.dust[num].noGravity = true; + } + 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.Center.Y, projectile.velocity.X, projectile.velocity.Y, + mod.ProjectileType("EssenceBeam"), projectile.damage * 4, projectile.knockBack, 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.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } + } +} diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.cs b/Projectiles/Melee/Spears/TerraLanceProjectile.cs index 1327e7a7f5..25f79bf51b 100644 --- a/Projectiles/Melee/Spears/TerraLanceProjectile.cs +++ b/Projectiles/Melee/Spears/TerraLanceProjectile.cs @@ -1,82 +1,82 @@ -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 TerraLanceProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lance"); - } - - 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 this 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 (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - 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.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, mod.ProjectileType("TerraSpear"), (int)((double)projectile.damage * 0.85), 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] = 5; - } - } -} \ No newline at end of file +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 TerraLanceProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lance"); + } + + 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 this 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 (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + 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.Center.Y + projectile.velocity.Y, + projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, mod.ProjectileType("TerraSpear"), (int)((double)projectile.damage * 0.85), 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] = 5; + } + } +} diff --git a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs index 0c766510e1..ff7556399b 100644 --- a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs +++ b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs @@ -1,78 +1,78 @@ -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 UrchinSpearProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 56; //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. - projectile.timeLeft = 90; - projectile.height = 56; //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; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, - projectile.velocity.X * 1.6f, projectile.velocity.Y * 1.6f, mod.ProjectileType("UrchinSpikeFugu"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, 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.AddBuff(BuffID.Poisoned, 300); - } - } -} \ No newline at end of file +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 UrchinSpearProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 56; //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. + projectile.timeLeft = 90; + projectile.height = 56; //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; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, + projectile.velocity.X * 1.6f, projectile.velocity.Y * 1.6f, mod.ProjectileType("UrchinSpikeFugu"), (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.5f, 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.AddBuff(BuffID.Poisoned, 300); + } + } +} diff --git a/Projectiles/Melee/StarCrystal.cs b/Projectiles/Melee/StarCrystal.cs index 7fdde7cd77..762b73d815 100644 --- a/Projectiles/Melee/StarCrystal.cs +++ b/Projectiles/Melee/StarCrystal.cs @@ -1,48 +1,48 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class StarCrystal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.aiStyle = 29; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - aiType = 121; - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 227, 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("TinyCrystal"), - (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.15f, Main.myPlayer, 0f, 0f); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class StarCrystal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.aiStyle = 29; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + aiType = 121; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 227, 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("TinyCrystal"), + (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.15f, Main.myPlayer, 0f, 0f); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 240); + } + } +} diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index 5cabb7528c..6c2d989f37 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -1,70 +1,70 @@ -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 StarnightBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - aiType = 156; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, 0f, ((255 - projectile.alpha) * 0.2f) / 255f); - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.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(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } - } -} \ No newline at end of file +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 StarnightBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 2; + projectile.timeLeft = 600; + aiType = 156; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.2f) / 255f, 0f, ((255 - projectile.alpha) * 0.2f) / 255f); + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.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(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120); + } + } +} diff --git a/Projectiles/Melee/StormBeam.cs b/Projectiles/Melee/StormBeam.cs index 90ffe03caa..31e8aba2af 100644 --- a/Projectiles/Melee/StormBeam.cs +++ b/Projectiles/Melee/StormBeam.cs @@ -1,53 +1,53 @@ -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 StormBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - if (Main.rand.Next(2) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f); - } - } - - 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, 187, projectile.oldVelocity.X, projectile.oldVelocity.Y); - } - } - } -} \ No newline at end of file +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 StormBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + if (Main.rand.Next(2) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f); + } + } + + 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, 187, projectile.oldVelocity.X, projectile.oldVelocity.Y); + } + } + } +} diff --git a/Projectiles/Melee/StormMark.cs b/Projectiles/Melee/StormMark.cs index db5baf4869..112911d5d2 100644 --- a/Projectiles/Melee/StormMark.cs +++ b/Projectiles/Melee/StormMark.cs @@ -1,162 +1,162 @@ -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 StormMark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 25; - } - - public override void AI() - { - Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); - } - if (projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 187, 0f, 0f, 0, default(Color), 0.5f)]; - dust34.position = position4; - dust34.customData = projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.localAI[1] > 103f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 16; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default(Vector2)); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) - { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) - { - int num1137 = 100; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("Tornado"), num1137, 3f, projectile.owner, 0f, 0f); - } - if (projectile.localAI[1] >= 120f) - { - projectile.Kill(); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); - return false; - } - } -} \ No newline at end of file +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 StormMark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.timeLeft = 900; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 25; + } + + public override void AI() + { + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + for (int num1134 = 0; num1134 < 1; num1134++) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 187, 0f, 0f, 0, default(Color), 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default(Vector2)); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + int num1137 = 100; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("Tornado"), num1137, 3f, projectile.owner, 0f, 0f); + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Melee/StormRuler.cs b/Projectiles/Melee/StormRuler.cs index 65be798bda..962df22e32 100644 --- a/Projectiles/Melee/StormRuler.cs +++ b/Projectiles/Melee/StormRuler.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class StormRuler : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ruler"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.light = 1f; - projectile.alpha = 255; - projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - 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; - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("StormMark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class StormRuler : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ruler"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.light = 1f; + projectile.alpha = 255; + projectile.timeLeft = 600; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + 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; + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("StormMark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Melee/SunlightBlade.cs b/Projectiles/Melee/SunlightBlade.cs index 2dd21ab666..f809d34c2a 100644 --- a/Projectiles/Melee/SunlightBlade.cs +++ b/Projectiles/Melee/SunlightBlade.cs @@ -1,55 +1,55 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class SunlightBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } - - public override void SetDefaults() - { - projectile.width = 36; - projectile.height = 66; - projectile.aiStyle = 18; - projectile.alpha = 100; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 5; - projectile.timeLeft = 180; - projectile.ignoreWater = true; - aiType = 274; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, 0f); - } - - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SunlightBlade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 66; + projectile.aiStyle = 18; + projectile.alpha = 100; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = 5; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + aiType = 274; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, 0f); + } + + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } +} diff --git a/Projectiles/Melee/TemporalFloeSwordProjectile.cs b/Projectiles/Melee/TemporalFloeSwordProjectile.cs index 72399184ee..9bef314f0c 100644 --- a/Projectiles/Melee/TemporalFloeSwordProjectile.cs +++ b/Projectiles/Melee/TemporalFloeSwordProjectile.cs @@ -1,78 +1,78 @@ -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 TemporalFloeSwordProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Floe"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - if (Main.rand.Next(2) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 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; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(50, 50, 255, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.Next(3) == 0) - { - target.AddBuff(mod.BuffType("GlacialState"), 120); - } - target.AddBuff(BuffID.Frostburn, 240); - } - } -} \ No newline at end of file +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 TemporalFloeSwordProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Floe"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + if (Main.rand.Next(2) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, 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; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(50, 50, 255, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 56, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.Next(3) == 0) + { + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + target.AddBuff(BuffID.Frostburn, 240); + } + } +} diff --git a/Projectiles/Melee/TerraBall.cs b/Projectiles/Melee/TerraBall.cs index adb00a6d0d..8b6868b552 100644 --- a/Projectiles/Melee/TerraBall.cs +++ b/Projectiles/Melee/TerraBall.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TerraBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 600; - } - - public override void AI() - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 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 void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, 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.CursedInferno, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerraBall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.timeLeft = 600; + } + + public override void AI() + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 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 void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, 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.CursedInferno, 300); + } + } +} diff --git a/Projectiles/Melee/TerraEdgeBeam.cs b/Projectiles/Melee/TerraEdgeBeam.cs index d6c5a5a17d..bdaed401b4 100644 --- a/Projectiles/Melee/TerraEdgeBeam.cs +++ b/Projectiles/Melee/TerraEdgeBeam.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TerraEdgeBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; - aiType = 132; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 1.3f) / 255f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 200, 0, 0); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 60); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerraEdgeBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 600; + aiType = 132; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 1.3f) / 255f, 0f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 200, 0, 0); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 60); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } +} diff --git a/Projectiles/Melee/TerraSpear.cs b/Projectiles/Melee/TerraSpear.cs index 4849e68c46..ddfb25375f 100644 --- a/Projectiles/Melee/TerraSpear.cs +++ b/Projectiles/Melee/TerraSpear.cs @@ -1,90 +1,90 @@ -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 TerraSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 180; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 1f) / 255f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (projectile.localAI[1] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 15; - if (projectile.alpha >= 125) - { - projectile.alpha = 130; - projectile.localAI[1] = 1f; - } - } - else if (projectile.localAI[1] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[1] = 0f; - } - } - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - - 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.immune[projectile.owner] = 5; - } - } -} \ No newline at end of file +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 TerraSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 180; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 1f) / 255f, 0f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.localAI[1] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 125) + { + projectile.alpha = 130; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[1] = 0f; + } + } + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + + 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.immune[projectile.owner] = 5; + } + } +} diff --git a/Projectiles/Melee/TerracottaExplosion.cs b/Projectiles/Melee/TerracottaExplosion.cs index 4d065ac2f9..aafa436dd9 100644 --- a/Projectiles/Melee/TerracottaExplosion.cs +++ b/Projectiles/Melee/TerracottaExplosion.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TerracottaExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 180; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.5f, 0.35f, 0f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 1.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerracottaExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = -1; + projectile.timeLeft = 180; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.5f, 0.35f, 0f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 1.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + } + } +} diff --git a/Projectiles/Melee/TerratomereProjectile.cs b/Projectiles/Melee/TerratomereProjectile.cs index e4594dd2f8..afe478687a 100644 --- a/Projectiles/Melee/TerratomereProjectile.cs +++ b/Projectiles/Melee/TerratomereProjectile.cs @@ -1,104 +1,104 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.GameContent; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TerratomereProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.tileCollide = false; - aiType = 132; - } - - public override void AI() - { - 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; - } - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.75f) / 255f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 200, 0, 0); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GlacialState"), 60); - target.AddBuff(BuffID.CursedInferno, 600); - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(BuffID.OnFire, 900); - target.AddBuff(BuffID.Ichor, 180); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerratomereProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.tileCollide = false; + aiType = 132; + } + + public override void AI() + { + 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; + } + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.75f) / 255f, 0f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 200, 0, 0); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GlacialState"), 60); + target.AddBuff(BuffID.CursedInferno, 600); + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.OnFire, 900); + target.AddBuff(BuffID.Ichor, 180); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 107, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } +} diff --git a/Projectiles/Melee/TerrorBeam.cs b/Projectiles/Melee/TerrorBeam.cs index 644eb46f26..cc75acbd78 100644 --- a/Projectiles/Melee/TerrorBeam.cs +++ b/Projectiles/Melee/TerrorBeam.cs @@ -1,118 +1,118 @@ -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 TerrorBeam : ModProjectile - { - private bool hasHitEnemy = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 7; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 1f; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TerrorBoom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - 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); - } - } - - public override void AI() - { - if (projectile.localAI[1] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.localAI[1] += 1f; - } - projectile.alpha -= 40; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 0, 0, 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; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 400); - 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 < 6; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); - } - for (int num194 = 0; num194 < 60; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 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, 60, 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 +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 TerrorBeam : ModProjectile + { + private bool hasHitEnemy = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 7; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.light = 1f; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TerrorBoom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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); + } + } + + public override void AI() + { + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + projectile.localAI[1] += 1f; + } + projectile.alpha -= 40; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 0, 0, 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; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 400); + 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 < 6; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 60; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 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, 60, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Melee/TerrorBoom.cs b/Projectiles/Melee/TerrorBoom.cs index ac5506dbf5..12f36d8db1 100644 --- a/Projectiles/Melee/TerrorBoom.cs +++ b/Projectiles/Melee/TerrorBoom.cs @@ -1,54 +1,54 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TerrorBoom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 4; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - projectile.melee = true; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 400); - 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 < 6; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); - } - for (int num194 = 0; num194 < 60; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 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, 60, 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerrorBoom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 250; + projectile.height = 250; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 4; + projectile.timeLeft = 60; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + projectile.melee = true; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 400); + 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 < 6; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 60; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 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, 60, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Melee/TinyCrystal.cs b/Projectiles/Melee/TinyCrystal.cs index 3499630a18..c50fc781e1 100644 --- a/Projectiles/Melee/TinyCrystal.cs +++ b/Projectiles/Melee/TinyCrystal.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TinyCrystal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 29; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.tileCollide = true; - aiType = 122; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 227, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TinyCrystal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 29; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.tileCollide = true; + aiType = 122; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 227, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120); + } + } +} diff --git a/Projectiles/Melee/TinyFlare.cs b/Projectiles/Melee/TinyFlare.cs index 20a31a144f..78948e9f03 100644 --- a/Projectiles/Melee/TinyFlare.cs +++ b/Projectiles/Melee/TinyFlare.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TinyFlare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 240; - projectile.light = 0.5f; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - } - - public override void AI() - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default(Color), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TinyFlare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.melee = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 240; + projectile.light = 0.5f; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + } + + public override void AI() + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 174, 0f, 0f, 100, default(Color), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Projectiles/Melee/Tornado.cs b/Projectiles/Melee/Tornado.cs index 0e940909fb..78b4b79861 100644 --- a/Projectiles/Melee/Tornado.cs +++ b/Projectiles/Melee/Tornado.cs @@ -1,193 +1,193 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Melee -{ - public class Tornado : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tornado"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = NPC.downedMoonlord ? -1 : 3; - projectile.timeLeft = 1200; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); - } - - public override void AI() - { - float num1125 = 900f; - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 122); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) - { - projectile.Kill(); - } - if (projectile.localAI[0] >= 30f) - { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) - { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; - } - } - 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++) - { - NPC npc = Main.npc[num475]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) - { - npcCenterX = npc.position.X + (float)(npc.width / 2); - npcCenterY = npc.position.Y + (float)(npc.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 (npc.position.X < num472) - { - npc.velocity.X += 0.02f; - } - else - { - npc.velocity.X -= 0.02f; - } - if (npc.position.Y < num473) - { - npc.velocity.Y += 0.02f; - } - else - { - npc.velocity.Y -= 0.02f; - } - } - } - } - float num1127 = 15f; - float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) - { - bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) - { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) - { - flag74 = true; - break; - } - } - if (!flag74 && projectile.ai[0] < num1125 - 120f) - { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; - } - } - if (projectile.ai[0] < num1125 - 120f) - { - return; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - float num226 = 600f; - float num227 = 15f; - float num228 = 15f; - float num229 = projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) - { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); - } - Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default(Vector2)); - float num234 = 0f; - float num235 = 5.1f; - Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 225); - for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) - { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default(Vector2)); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) - { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); - } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); - } - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Melee +{ + public class Tornado : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tornado"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = NPC.downedMoonlord ? -1 : 3; + projectile.timeLeft = 1200; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); + } + + public override void AI() + { + float num1125 = 900f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 122); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= num1125) + { + projectile.Kill(); + } + if (projectile.localAI[0] >= 30f) + { + projectile.damage = 0; + if (projectile.ai[0] < num1125 - 120f) + { + float num1126 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1126; + projectile.netUpdate = true; + } + } + 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++) + { + NPC npc = Main.npc[num475]; + if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + { + npcCenterX = npc.position.X + (float)(npc.width / 2); + npcCenterY = npc.position.Y + (float)(npc.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 (npc.position.X < num472) + { + npc.velocity.X += 0.02f; + } + else + { + npc.velocity.X -= 0.02f; + } + if (npc.position.Y < num473) + { + npc.velocity.Y += 0.02f; + } + else + { + npc.velocity.Y -= 0.02f; + } + } + } + } + float num1127 = 15f; + float num1128 = 15f; + Point point8 = projectile.Center.ToTileCoordinates(); + int num1129; + int num1130; + Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); + num1129++; + num1130--; + Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); + Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); + Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); + Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); + value74.X = value74.Y * 0.2f; + projectile.width = (int)(value74.X * 0.65f); + projectile.height = (int)value74.Y; + projectile.Center = vector146; + if (projectile.owner == Main.myPlayer) + { + bool flag74 = false; + Vector2 center16 = Main.player[projectile.owner].Center; + Vector2 top = Main.player[projectile.owner].Top; + for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + { + Vector2 position2 = Vector2.Lerp(value72, value73, num1131); + if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + { + flag74 = true; + break; + } + } + if (!flag74 && projectile.ai[0] < num1125 - 120f) + { + float num1132 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1132; + projectile.netUpdate = true; + } + } + if (projectile.ai[0] < num1125 - 120f) + { + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + float num226 = 600f; + float num227 = 15f; + float num228 = 15f; + float num229 = projectile.ai[0]; + float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); + if (num229 > num226 - 60f) + { + scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + } + Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); + int num230; + int num231; + Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); + num230++; + num231--; + float num232 = 0.2f; + Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); + Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); + Vector2.Lerp(value32, value33, 0.5f); + Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); + vector33.X = vector33.Y * num232; + new Vector2(value32.X - vector33.X / 2f, value32.Y); + Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); + Vector2 origin3 = rectangle9.Size() / 2f; + float num233 = -0.06283186f * num229; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default(Vector2)); + float num234 = 0f; + float num235 = 5.1f; + Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 225); + for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) + { + num234 += num235; + float num237 = num234 / vector33.Y; + float num238 = num234 * 6.28318548f / -20f; + float num239 = num237 - 0.15f; + Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default(Vector2)); + Vector2 value35 = new Vector2(0f, num237 + 1f); + value35.X = value35.Y * num232; + Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); + if (num237 > 0.5f) + { + color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + } + color39.A = (byte)((float)color39.A * 0.5f); + color39 *= scale5; + vector34 *= value35 * 100f; + vector34.Y = 0f; + vector34.X = 0f; + vector34 += new Vector2(value33.X, num236) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); + } + return false; + } + } +} diff --git a/Projectiles/Melee/TriactisOPHammerMelee.cs b/Projectiles/Melee/TriactisOPHammerMelee.cs index 0690299d4e..732f5a1322 100644 --- a/Projectiles/Melee/TriactisOPHammerMelee.cs +++ b/Projectiles/Melee/TriactisOPHammerMelee.cs @@ -1,147 +1,147 @@ -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 TriactisOPHammerMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - } - - public override void SetDefaults() - { - projectile.width = 160; - projectile.height = 160; - projectile.friendly = true; - projectile.melee = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 20f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 20f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - return; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MageHammerBoom"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - 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 = 60; - 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 num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(2) == 0 ? 89 : 229, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(2) == 0 ? 89 : 229, 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, Main.rand.Next(2) == 0 ? 89 : 229, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +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 TriactisOPHammerMelee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + } + + public override void SetDefaults() + { + projectile.width = 160; + projectile.height = 160; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 20f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 20f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; + return; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MageHammerBoom"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + } + 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 = 60; + 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 num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(2) == 0 ? 89 : 229, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(2) == 0 ? 89 : 229, 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, Main.rand.Next(2) == 0 ? 89 : 229, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Melee/TrueBiomeOrb.cs b/Projectiles/Melee/TrueBiomeOrb.cs index d942c1ceec..d03d154097 100644 --- a/Projectiles/Melee/TrueBiomeOrb.cs +++ b/Projectiles/Melee/TrueBiomeOrb.cs @@ -1,150 +1,150 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TrueBiomeOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool corrupt = player.ZoneCorrupt; - bool crimson = player.ZoneCrimson; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool sky = player.ZoneSkyHeight; - bool holy = player.ZoneHoly; - int dustType = 0; - if (jungle) - { - dustType = 39; - } - else if (snow) - { - dustType = 51; - } - else if (beach) - { - dustType = 33; - } - else if (corrupt) - { - dustType = 14; - } - else if (crimson) - { - dustType = 5; - } - else if (dungeon) - { - dustType = 29; - } - else if (desert) - { - dustType = 32; - } - else if (glow) - { - dustType = 56; - } - else if (hell) - { - dustType = 6; - } - else if (sky) - { - dustType = 213; - } - else if (holy) - { - dustType = 57; - } - else - { - dustType = 3; - } - for (int num457 = 0; num457 < 10; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - bool jungle = player.ZoneJungle; - bool snow = player.ZoneSnow; - bool beach = player.ZoneBeach; - bool dungeon = player.ZoneDungeon; - bool desert = player.ZoneDesert; - bool glow = player.ZoneGlowshroom; - bool hell = player.ZoneUnderworldHeight; - bool holy = player.ZoneHoly; - if (jungle) - { - target.AddBuff(mod.BuffType("Plague"), 360); - } - else if (snow) - { - target.AddBuff(mod.BuffType("GlacialState"), 360); - } - else if (beach) - { - target.AddBuff(mod.BuffType("CrushDepth"), 360); - } - else if (dungeon) - { - target.AddBuff(BuffID.Frostburn, 360); - } - else if (desert) - { - target.AddBuff(mod.BuffType("HolyLight"), 360); - } - else if (glow) - { - target.AddBuff(mod.BuffType("TemporalSadness"), 360); - } - else if (hell) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); - } - else if (holy) - { - target.AddBuff(mod.BuffType("HolyLight"), 360); - } - else - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 360); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TrueBiomeOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool corrupt = player.ZoneCorrupt; + bool crimson = player.ZoneCrimson; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool sky = player.ZoneSkyHeight; + bool holy = player.ZoneHoly; + int dustType = 0; + if (jungle) + { + dustType = 39; + } + else if (snow) + { + dustType = 51; + } + else if (beach) + { + dustType = 33; + } + else if (corrupt) + { + dustType = 14; + } + else if (crimson) + { + dustType = 5; + } + else if (dungeon) + { + dustType = 29; + } + else if (desert) + { + dustType = 32; + } + else if (glow) + { + dustType = 56; + } + else if (hell) + { + dustType = 6; + } + else if (sky) + { + dustType = 213; + } + else if (holy) + { + dustType = 57; + } + else + { + dustType = 3; + } + for (int num457 = 0; num457 < 10; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + return; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Player player = Main.player[projectile.owner]; + bool jungle = player.ZoneJungle; + bool snow = player.ZoneSnow; + bool beach = player.ZoneBeach; + bool dungeon = player.ZoneDungeon; + bool desert = player.ZoneDesert; + bool glow = player.ZoneGlowshroom; + bool hell = player.ZoneUnderworldHeight; + bool holy = player.ZoneHoly; + if (jungle) + { + target.AddBuff(mod.BuffType("Plague"), 360); + } + else if (snow) + { + target.AddBuff(mod.BuffType("GlacialState"), 360); + } + else if (beach) + { + target.AddBuff(mod.BuffType("CrushDepth"), 360); + } + else if (dungeon) + { + target.AddBuff(BuffID.Frostburn, 360); + } + else if (desert) + { + target.AddBuff(mod.BuffType("HolyLight"), 360); + } + else if (glow) + { + target.AddBuff(mod.BuffType("TemporalSadness"), 360); + } + else if (hell) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + } + else if (holy) + { + target.AddBuff(mod.BuffType("HolyLight"), 360); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 360); + } + } + } +} diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.cs b/Projectiles/Melee/TrueCausticEdgeProjectile.cs index ca1d75f580..736b19c76c 100644 --- a/Projectiles/Melee/TrueCausticEdgeProjectile.cs +++ b/Projectiles/Melee/TrueCausticEdgeProjectile.cs @@ -1,94 +1,94 @@ -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 TrueCausticEdgeProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Edge"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - } - - 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 Color? GetAlpha(Color lightColor) - { - return new Color(0, 100, 0, 0); - } - - 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; - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Venom, 120); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} \ No newline at end of file +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 TrueCausticEdgeProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Edge"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 600; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + } + + 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 Color? GetAlpha(Color lightColor) + { + return new Color(0, 100, 0, 0); + } + + 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; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.Venom, 120); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + int num3; + for (int num795 = 4; num795 < 31; num795 = num3 + 1) + { + float num796 = projectile.oldVelocity.X * (30f / (float)num795); + float num797 = projectile.oldVelocity.Y * (30f / (float)num795); + int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.8f); + Main.dust[num798].noGravity = true; + Dust dust = Main.dust[num798]; + dust.velocity *= 0.5f; + num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 44, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default(Color), 1.4f); + dust = Main.dust[num798]; + dust.velocity *= 0.05f; + num3 = num795; + } + } + } +} diff --git a/Projectiles/Melee/Tumbleweed.cs b/Projectiles/Melee/Tumbleweed.cs index ce4d3e8255..6929ec13b6 100644 --- a/Projectiles/Melee/Tumbleweed.cs +++ b/Projectiles/Melee/Tumbleweed.cs @@ -1,169 +1,169 @@ -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 Tumbleweed : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tumbleweed"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; - projectile.GetGlobalProjectile(mod).trueMelee = true; - } - - public override void AI() - { - Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (Main.player[projectile.owner].dead) - { - projectile.Kill(); - return; - } - Main.player[projectile.owner].itemAnimation = 10; - Main.player[projectile.owner].itemTime = 10; - float arg_1DC8F_0 = vector62.X; - if (vector62.X < 0f) - { - Main.player[projectile.owner].ChangeDir(1); - projectile.direction = 1; - } - else - { - Main.player[projectile.owner].ChangeDir(-1); - projectile.direction = -1; - } - Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); - if (projectile.ai[0] == 0f && vector62.Length() > 400f) - { - projectile.ai[0] = 1f; - } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) - { - float num693 = vector62.Length(); - if (num693 > 1500f) - { - projectile.Kill(); - return; - } - if (num693 > 600f) - { - projectile.ai[0] = 2f; - } - projectile.tileCollide = false; - float num694 = 20f; - if (projectile.ai[0] == 2f) - { - num694 = 40f; - } - projectile.velocity = Vector2.Normalize(vector62) * num694; - if (vector62.Length() < num694) - { - projectile.Kill(); - return; - } - } - float[] var_2_1DE21_cp_0 = projectile.ai; - int var_2_1DE21_cp_1 = 1; - float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; - var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; - if (projectile.ai[1] > 5f) - { - projectile.alpha = 0; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 11); - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/TumbleweedChain"); - Vector2 vector17 = projectile.Center; - Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) - { - flag13 = false; - } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) - { - flag13 = false; - } - while (flag13) - { - if (vector18.Length() < num91 + 1f) - { - flag13 = false; - } - else - { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); - } - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 15); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default(Color), 1.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, 85, 0f, 0f, 100, default(Color), 1.7f); - 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, 85, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("TumbleweedRolling"), projectile.damage, projectile.knockBack, Main.myPlayer, 0f, 0f); - } - projectile.Kill(); - } - } -} \ No newline at end of file +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 Tumbleweed : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tumbleweed"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.melee = true; + projectile.alpha = 255; + projectile.GetGlobalProjectile(mod).trueMelee = true; + } + + public override void AI() + { + Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + if (Main.player[projectile.owner].dead) + { + projectile.Kill(); + return; + } + Main.player[projectile.owner].itemAnimation = 10; + Main.player[projectile.owner].itemTime = 10; + float arg_1DC8F_0 = vector62.X; + if (vector62.X < 0f) + { + Main.player[projectile.owner].ChangeDir(1); + projectile.direction = 1; + } + else + { + Main.player[projectile.owner].ChangeDir(-1); + projectile.direction = -1; + } + Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); + projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); + if (projectile.ai[0] == 0f && vector62.Length() > 400f) + { + projectile.ai[0] = 1f; + } + if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + { + float num693 = vector62.Length(); + if (num693 > 1500f) + { + projectile.Kill(); + return; + } + if (num693 > 600f) + { + projectile.ai[0] = 2f; + } + projectile.tileCollide = false; + float num694 = 20f; + if (projectile.ai[0] == 2f) + { + num694 = 40f; + } + projectile.velocity = Vector2.Normalize(vector62) * num694; + if (vector62.Length() < num694) + { + projectile.Kill(); + return; + } + } + float[] var_2_1DE21_cp_0 = projectile.ai; + int var_2_1DE21_cp_1 = 1; + float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; + var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; + if (projectile.ai[1] > 5f) + { + projectile.alpha = 0; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + projectile.ai[0] = 1f; + projectile.netUpdate = true; + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 11); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; + Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/TumbleweedChain"); + Vector2 vector17 = projectile.Center; + Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; + Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); + float num91 = (float)texture2D2.Height; + Vector2 vector18 = mountedCenter - vector17; + float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; + bool flag13 = true; + if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + { + flag13 = false; + } + if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + { + flag13 = false; + } + while (flag13) + { + if (vector18.Length() < num91 + 1f) + { + flag13 = false; + } + else + { + Vector2 value2 = vector18; + value2.Normalize(); + vector17 += value2 * num91; + vector18 = mountedCenter - vector17; + Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); + } + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 15); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default(Color), 1.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, 85, 0f, 0f, 100, default(Color), 1.7f); + 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, 85, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("TumbleweedRolling"), projectile.damage, projectile.knockBack, Main.myPlayer, 0f, 0f); + } + projectile.Kill(); + } + } +} diff --git a/Projectiles/Melee/TumbleweedRolling.cs b/Projectiles/Melee/TumbleweedRolling.cs index 7eb094cc05..cd6489a622 100644 --- a/Projectiles/Melee/TumbleweedRolling.cs +++ b/Projectiles/Melee/TumbleweedRolling.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TumbleweedRolling : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tumbleweed"); - } - - public override void SetDefaults() - { - projectile.width = 44; - projectile.height = 44; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 8; - projectile.timeLeft = 300; - projectile.melee = true; - } - - public override void AI() - { - if ((projectile.velocity.X != projectile.velocity.X && (projectile.velocity.X < -3f || projectile.velocity.X > 3f)) || - (projectile.velocity.Y != projectile.velocity.Y && (projectile.velocity.Y < -3f || projectile.velocity.Y > 3f))) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 11); - } - 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.rotation += projectile.velocity.X * 0.05f; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 15); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default(Color), 1.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, 85, 0f, 0f, 100, default(Color), 1.7f); - 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, 85, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TumbleweedRolling : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tumbleweed"); + } + + public override void SetDefaults() + { + projectile.width = 44; + projectile.height = 44; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 8; + projectile.timeLeft = 300; + projectile.melee = true; + } + + public override void AI() + { + if ((projectile.velocity.X != projectile.velocity.X && (projectile.velocity.X < -3f || projectile.velocity.X > 3f)) || + (projectile.velocity.Y != projectile.velocity.Y && (projectile.velocity.Y < -3f || projectile.velocity.Y > 3f))) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 11); + } + 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.rotation += projectile.velocity.X * 0.05f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 15); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default(Color), 1.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, 85, 0f, 0f, 100, default(Color), 1.7f); + 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, 85, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Melee/TyphonsGreed.cs b/Projectiles/Melee/TyphonsGreed.cs index b82d7b647f..ad1f471c6f 100644 --- a/Projectiles/Melee/TyphonsGreed.cs +++ b/Projectiles/Melee/TyphonsGreed.cs @@ -1,126 +1,126 @@ -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 TyphonsGreed : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Typhon's Greed"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num953 = 50f * projectile.ai[1]; //100 - float scaleFactor12 = 10f * projectile.ai[1]; //5 - float num954 = 40f; - 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, 0f, 0.1f, 0.7f); - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - } - } - - 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("CrushDepth"), 180); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - } - for (int num194 = 0; num194 < 6; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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 TyphonsGreed : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Typhon's Greed"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num953 = 50f * projectile.ai[1]; //100 + float scaleFactor12 = 10f * projectile.ai[1]; //5 + float num954 = 40f; + 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, 0f, 0.1f, 0.7f); + int num959 = (int)projectile.ai[0]; + if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + { + if (projectile.Distance(Main.player[num959].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + } + } + else + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + } + } + + 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("CrushDepth"), 180); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 6; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 1421d8a86c..cf2b527838 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -1,252 +1,252 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class TyphonsGreedStaff : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Typhon's Greed"); - } - - public override void SetDefaults() - { - projectile.width = 110; - projectile.height = 110; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.melee = true; - projectile.hide = true; - projectile.ignoreWater = true; - projectile.ownerHitCheck = true; - } - - public override void AI() - { - float num = 50f; - float num2 = 2f; - float scaleFactor = 20f; - Player player = Main.player[projectile.owner]; - float num3 = -0.7853982f; - Vector2 value = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value2 = Vector2.Zero; - if (player.dead) - { - projectile.Kill(); - return; - } - Lighting.AddLight(player.Center, 0f, 0.2f, 1.45f); - int num9 = Math.Sign(projectile.velocity.X); - projectile.velocity = new Vector2((float)num9, 0f); - if (projectile.ai[0] == 0f) - { - projectile.rotation = new Vector2((float)num9, -player.gravDir).ToRotation() + num3 + 3.14159274f; - if (projectile.velocity.X < 0f) - { - projectile.rotation -= 1.57079637f; - } - } - projectile.alpha -= 128; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float arg_5DB_0 = projectile.ai[0] / num; - float num10 = 1f; - projectile.ai[0] += num10; - projectile.rotation += 6.28318548f * num2 / num * (float)num9; - bool flag2 = projectile.ai[0] == (float)((int)(num / 2f)); - if (projectile.ai[0] >= num || (flag2 && !player.controlUseItem)) - { - projectile.Kill(); - player.reuseDelay = 2; - } - else if (flag2) - { - Vector2 mouseWorld2 = Main.MouseWorld; - int num11 = (player.DirectionTo(mouseWorld2).X > 0f) ? 1 : -1; - if ((float)num11 != projectile.velocity.X) - { - player.ChangeDir(num11); - projectile.velocity = new Vector2((float)num11, 0f); - projectile.netUpdate = true; - projectile.rotation -= 3.14159274f; - } - } - if ((projectile.ai[0] == num10 || (projectile.ai[0] == (float)((int)(num / 2f)) && projectile.active)) && projectile.owner == Main.myPlayer) - { - Vector2 mouseWorld3 = Main.MouseWorld; - Vector2 mouse = player.DirectionTo(mouseWorld3) * 0f; - player.DirectionTo(mouse); - } - float num12 = projectile.rotation - 0.7853982f * (float)num9; - value2 = (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * (projectile.ai[0] / num) * scaleFactor; - Vector2 value3 = projectile.Center + (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * 30f; - Vector2 vector2 = num12.ToRotationVector2(); - Vector2 value4 = vector2.RotatedBy((double)(1.57079637f * (float)projectile.spriteDirection), default(Vector2)); - if (Main.rand.Next(2) == 0) - { - Dust dust3 = Dust.NewDustDirect(value3 - new Vector2(5f), 10, 10, 33, player.velocity.X, player.velocity.Y, 150, default(Color), 1f); - dust3.velocity = projectile.DirectionTo(dust3.position) * 0.1f + dust3.velocity * 0.1f; - } - for (int j = 0; j < 4; j++) - { - float scaleFactor2 = 1f; - float scaleFactor3 = 1f; - switch (j) - { - case 1: - scaleFactor3 = -1f; - break; - case 2: - scaleFactor3 = 1.25f; - scaleFactor2 = 0.5f; - break; - case 3: - scaleFactor3 = -1.25f; - scaleFactor2 = 0.5f; - break; - } - if (Main.rand.Next(6) != 0) - { - Dust dust4 = Dust.NewDustDirect(projectile.position, 0, 0, 186, 0f, 0f, 100, default(Color), 1f); - dust4.position = projectile.Center + vector2 * (60f + Main.rand.NextFloat() * 20f) * scaleFactor3; - dust4.velocity = value4 * (4f + 4f * Main.rand.NextFloat()) * scaleFactor3 * scaleFactor2; - dust4.noGravity = true; - dust4.noLight = true; - dust4.scale = 0.5f; - if (Main.rand.Next(4) == 0) - { - dust4.noGravity = false; - } - } - } - projectile.position = value - projectile.Size / 2f; - projectile.position += value2; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = MathHelper.WrapAngle(projectile.rotation); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 12f) - { - projectile.localAI[0] = 0f; - float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800f : projectile.position.X - 800f); - Vector2 vector20 = new Vector2(xPos, projectile.position.Y + (float)Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)player.position.X - vector20.X; - float speedY = (float)player.position.Y - vector20.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - float ai1 = (Main.rand.NextFloat() + 0.5f); - Projectile.NewProjectile(vector20.X, vector20.Y, speedX, speedY, mod.ProjectileType("TyphonsGreed"), projectile.damage, 2f, projectile.owner, 0.0f, ai1); - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && - ((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)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - hitDirection = ((Main.player[projectile.owner].Center.X < Main.npc[i].Center.X) ? 1 : -1); - } - } - } - } - } - } - - public override void CutTiles() - { - float num5 = 60f; - float f = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X); - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Utils.PlotTileLine(projectile.Center + f.ToRotationVector2() * -num5, projectile.Center + f.ToRotationVector2() * num5, (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float f = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X); - float num2 = 0f; - float num3 = 110f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + f.ToRotationVector2() * -num3, projectile.Center + f.ToRotationVector2() * num3, 23f * projectile.scale, ref num2)) - { - return true; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 240); - target.immune[projectile.owner] = 6; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TyphonsGreedStaff : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Typhon's Greed"); + } + + public override void SetDefaults() + { + projectile.width = 110; + projectile.height = 110; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.melee = true; + projectile.hide = true; + projectile.ignoreWater = true; + projectile.ownerHitCheck = true; + } + + public override void AI() + { + float num = 50f; + float num2 = 2f; + float scaleFactor = 20f; + Player player = Main.player[projectile.owner]; + float num3 = -0.7853982f; + Vector2 value = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 value2 = Vector2.Zero; + if (player.dead) + { + projectile.Kill(); + return; + } + Lighting.AddLight(player.Center, 0f, 0.2f, 1.45f); + int num9 = Math.Sign(projectile.velocity.X); + projectile.velocity = new Vector2((float)num9, 0f); + if (projectile.ai[0] == 0f) + { + projectile.rotation = new Vector2((float)num9, -player.gravDir).ToRotation() + num3 + 3.14159274f; + if (projectile.velocity.X < 0f) + { + projectile.rotation -= 1.57079637f; + } + } + projectile.alpha -= 128; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float arg_5DB_0 = projectile.ai[0] / num; + float num10 = 1f; + projectile.ai[0] += num10; + projectile.rotation += 6.28318548f * num2 / num * (float)num9; + bool flag2 = projectile.ai[0] == (float)((int)(num / 2f)); + if (projectile.ai[0] >= num || (flag2 && !player.controlUseItem)) + { + projectile.Kill(); + player.reuseDelay = 2; + } + else if (flag2) + { + Vector2 mouseWorld2 = Main.MouseWorld; + int num11 = (player.DirectionTo(mouseWorld2).X > 0f) ? 1 : -1; + if ((float)num11 != projectile.velocity.X) + { + player.ChangeDir(num11); + projectile.velocity = new Vector2((float)num11, 0f); + projectile.netUpdate = true; + projectile.rotation -= 3.14159274f; + } + } + if ((projectile.ai[0] == num10 || (projectile.ai[0] == (float)((int)(num / 2f)) && projectile.active)) && projectile.owner == Main.myPlayer) + { + Vector2 mouseWorld3 = Main.MouseWorld; + Vector2 mouse = player.DirectionTo(mouseWorld3) * 0f; + player.DirectionTo(mouse); + } + float num12 = projectile.rotation - 0.7853982f * (float)num9; + value2 = (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * (projectile.ai[0] / num) * scaleFactor; + Vector2 value3 = projectile.Center + (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * 30f; + Vector2 vector2 = num12.ToRotationVector2(); + Vector2 value4 = vector2.RotatedBy((double)(1.57079637f * (float)projectile.spriteDirection), default(Vector2)); + if (Main.rand.Next(2) == 0) + { + Dust dust3 = Dust.NewDustDirect(value3 - new Vector2(5f), 10, 10, 33, player.velocity.X, player.velocity.Y, 150, default(Color), 1f); + dust3.velocity = projectile.DirectionTo(dust3.position) * 0.1f + dust3.velocity * 0.1f; + } + for (int j = 0; j < 4; j++) + { + float scaleFactor2 = 1f; + float scaleFactor3 = 1f; + switch (j) + { + case 1: + scaleFactor3 = -1f; + break; + case 2: + scaleFactor3 = 1.25f; + scaleFactor2 = 0.5f; + break; + case 3: + scaleFactor3 = -1.25f; + scaleFactor2 = 0.5f; + break; + } + if (Main.rand.Next(6) != 0) + { + Dust dust4 = Dust.NewDustDirect(projectile.position, 0, 0, 186, 0f, 0f, 100, default(Color), 1f); + dust4.position = projectile.Center + vector2 * (60f + Main.rand.NextFloat() * 20f) * scaleFactor3; + dust4.velocity = value4 * (4f + 4f * Main.rand.NextFloat()) * scaleFactor3 * scaleFactor2; + dust4.noGravity = true; + dust4.noLight = true; + dust4.scale = 0.5f; + if (Main.rand.Next(4) == 0) + { + dust4.noGravity = false; + } + } + } + projectile.position = value - projectile.Size / 2f; + projectile.position += value2; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = MathHelper.WrapAngle(projectile.rotation); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 12f) + { + projectile.localAI[0] = 0f; + float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800f : projectile.position.X - 800f); + Vector2 vector20 = new Vector2(xPos, projectile.position.Y + (float)Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)player.position.X - vector20.X; + float speedY = (float)player.position.Y - vector20.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + float ai1 = (Main.rand.NextFloat() + 0.5f); + Projectile.NewProjectile(vector20.X, vector20.Y, speedX, speedY, mod.ProjectileType("TyphonsGreed"), projectile.damage, 2f, projectile.owner, 0.0f, ai1); + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + ((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)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + hitDirection = ((Main.player[projectile.owner].Center.X < Main.npc[i].Center.X) ? 1 : -1); + } + } + } + } + } + } + + public override void CutTiles() + { + float num5 = 60f; + float f = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X); + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Utils.PlotTileLine(projectile.Center + f.ToRotationVector2() * -num5, projectile.Center + f.ToRotationVector2() * num5, (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float f = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X); + float num2 = 0f; + float num3 = 110f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + f.ToRotationVector2() * -num3, projectile.Center + f.ToRotationVector2() * num3, 23f * projectile.scale, ref num2)) + { + return true; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 240); + target.immune[projectile.owner] = 6; + } + } +} diff --git a/Projectiles/Melee/UltimusCleaverDust.cs b/Projectiles/Melee/UltimusCleaverDust.cs index c36abfddcd..05a044dcd8 100644 --- a/Projectiles/Melee/UltimusCleaverDust.cs +++ b/Projectiles/Melee/UltimusCleaverDust.cs @@ -93,4 +93,4 @@ namespace CalamityMod.Projectiles.Melee } } } -} \ No newline at end of file +} diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index b521767141..b6a44b4cbf 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -1,89 +1,89 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class UrchinSpikeFugu : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Urchin Spike"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 90; - projectile.noEnchantments = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] == 0f) - { - float num695 = 100f; - int num696 = -1; - int num3; - for (int num697 = 0; num697 < 200; num697 = num3 + 1) - { - NPC nPC5 = Main.npc[num697]; - if (nPC5.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.position, projectile.width, projectile.height, nPC5.position, nPC5.width, nPC5.height)) - { - float num698 = (nPC5.Center - projectile.Center).Length(); - if (num698 < num695) - { - num696 = num697; - num695 = num698; - } - } - num3 = num697; - } - projectile.ai[0] = (float)(num696 + 1); - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = -15f; - } - if (projectile.ai[0] > 0f) - { - float scaleFactor5 = (float)Main.rand.Next(35, 75) / 30f; - projectile.velocity = (projectile.velocity * 20f + Vector2.Normalize(Main.npc[(int)projectile.ai[0] - 1].Center - projectile.Center + new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101))) * scaleFactor5) / 21f; - projectile.netUpdate = true; - } - } - else if (projectile.ai[0] > 0f) - { - Vector2 value16 = Vector2.Normalize(Main.npc[(int)projectile.ai[0] - 1].Center - projectile.Center); - projectile.velocity = (projectile.velocity * 40f + value16 * 12f) / 41f; - } - else - { - float[] var_2_1E1A4_cp_0 = projectile.ai; - int var_2_1E1A4_cp_1 = 0; - float num73 = var_2_1E1A4_cp_0[var_2_1E1A4_cp_1]; - var_2_1E1A4_cp_0[var_2_1E1A4_cp_1] = num73 + 1f; - projectile.alpha -= 25; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity.Y = projectile.velocity.Y + 0.015f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class UrchinSpikeFugu : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Urchin Spike"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 90; + projectile.noEnchantments = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] == 0f) + { + float num695 = 100f; + int num696 = -1; + int num3; + for (int num697 = 0; num697 < 200; num697 = num3 + 1) + { + NPC nPC5 = Main.npc[num697]; + if (nPC5.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.position, projectile.width, projectile.height, nPC5.position, nPC5.width, nPC5.height)) + { + float num698 = (nPC5.Center - projectile.Center).Length(); + if (num698 < num695) + { + num696 = num697; + num695 = num698; + } + } + num3 = num697; + } + projectile.ai[0] = (float)(num696 + 1); + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = -15f; + } + if (projectile.ai[0] > 0f) + { + float scaleFactor5 = (float)Main.rand.Next(35, 75) / 30f; + projectile.velocity = (projectile.velocity * 20f + Vector2.Normalize(Main.npc[(int)projectile.ai[0] - 1].Center - projectile.Center + new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101))) * scaleFactor5) / 21f; + projectile.netUpdate = true; + } + } + else if (projectile.ai[0] > 0f) + { + Vector2 value16 = Vector2.Normalize(Main.npc[(int)projectile.ai[0] - 1].Center - projectile.Center); + projectile.velocity = (projectile.velocity * 40f + value16 * 12f) / 41f; + } + else + { + float[] var_2_1E1A4_cp_0 = projectile.ai; + int var_2_1E1A4_cp_1 = 0; + float num73 = var_2_1E1A4_cp_0[var_2_1E1A4_cp_1]; + var_2_1E1A4_cp_0[var_2_1E1A4_cp_1] = num73 + 1f; + projectile.alpha -= 25; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity.Y = projectile.velocity.Y + 0.015f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 180); + } + } +} diff --git a/Projectiles/Melee/Whirlpool.cs b/Projectiles/Melee/Whirlpool.cs index 8010d79057..74b594d7dc 100644 --- a/Projectiles/Melee/Whirlpool.cs +++ b/Projectiles/Melee/Whirlpool.cs @@ -88,4 +88,4 @@ namespace CalamityMod.Projectiles.Melee } } } -} \ No newline at end of file +} diff --git a/Projectiles/Melee/WhiteBoltAura.cs b/Projectiles/Melee/WhiteBoltAura.cs index 43c8b817c7..b83ee258f5 100644 --- a/Projectiles/Melee/WhiteBoltAura.cs +++ b/Projectiles/Melee/WhiteBoltAura.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class WhiteBoltAura : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } - - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 2; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - else - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) - { - projectile.ai[0] = 0f; - if (projectile.owner == Main.myPlayer) - { - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("Whiterain"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) - { - projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = projectile.type; - for (int num420 = 0; num420 < 1000; num420++) - { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) - { - num416++; - if (Main.projectile[num420].ai[1] > num418) - { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; - } - } - } - if (num416 > 1) - { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class WhiteBoltAura : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } + + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 2; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 7200f) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + else + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + projectile.ai[0] = 0f; + if (projectile.owner == Main.myPlayer) + { + int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); + int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, mod.ProjectileType("Whiterain"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 10f) + { + projectile.localAI[0] = 0f; + int num416 = 0; + int num417 = 0; + float num418 = 0f; + int num419 = projectile.type; + for (int num420 = 0; num420 < 1000; num420++) + { + if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + { + num416++; + if (Main.projectile[num420].ai[1] > num418) + { + num417 = num420; + num418 = Main.projectile[num420].ai[1]; + } + } + } + if (num416 > 1) + { + Main.projectile[num417].netUpdate = true; + Main.projectile[num417].ai[1] = 36000f; + } + } + } + } +} diff --git a/Projectiles/Melee/WhiteBoltAuraBlah.cs b/Projectiles/Melee/WhiteBoltAuraBlah.cs index a440d41cbe..45c897eeed 100644 --- a/Projectiles/Melee/WhiteBoltAuraBlah.cs +++ b/Projectiles/Melee/WhiteBoltAuraBlah.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class WhiteBoltAuraBlah : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } - - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 2; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - } - - public override void AI() - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 7200f) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - else - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) - { - projectile.ai[0] = 0f; - if (projectile.owner == Main.myPlayer) - { - int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); - int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 10f, mod.ProjectileType("WhiterainBlah"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 10f) - { - projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = projectile.type; - for (int num420 = 0; num420 < 1000; num420++) - { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) - { - num416++; - if (Main.projectile[num420].ai[1] > num418) - { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; - } - } - } - if (num416 > 1) - { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class WhiteBoltAuraBlah : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } + + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 2; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 1200; + } + + public override void AI() + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 7200f) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + else + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + projectile.ai[0] = 0f; + if (projectile.owner == Main.myPlayer) + { + int num414 = (int)(projectile.position.X + 14f + (float)Main.rand.Next(projectile.width - 28)); + int num415 = (int)(projectile.position.Y + (float)projectile.height + 4f); + Projectile.NewProjectile((float)num414, (float)num415, 0f, 10f, mod.ProjectileType("WhiterainBlah"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 10f) + { + projectile.localAI[0] = 0f; + int num416 = 0; + int num417 = 0; + float num418 = 0f; + int num419 = projectile.type; + for (int num420 = 0; num420 < 1000; num420++) + { + if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + { + num416++; + if (Main.projectile[num420].ai[1] > num418) + { + num417 = num420; + num418 = Main.projectile[num420].ai[1]; + } + } + } + if (num416 > 1) + { + Main.projectile[num417].netUpdate = true; + Main.projectile[num417].ai[1] = 36000f; + } + } + } + } +} diff --git a/Projectiles/Melee/WhiteOrb.cs b/Projectiles/Melee/WhiteOrb.cs index 6e91aba013..ef94bf0a23 100644 --- a/Projectiles/Melee/WhiteOrb.cs +++ b/Projectiles/Melee/WhiteOrb.cs @@ -1,41 +1,41 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class WhiteOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.timeLeft = 60; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default(Color), 1.25f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class WhiteOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.timeLeft = 60; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default(Color), 1.25f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + } +} diff --git a/Projectiles/Melee/WhiteOrbBlah.cs b/Projectiles/Melee/WhiteOrbBlah.cs index d84c858e02..db13742cb4 100644 --- a/Projectiles/Melee/WhiteOrbBlah.cs +++ b/Projectiles/Melee/WhiteOrbBlah.cs @@ -1,41 +1,41 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class WhiteOrbBlah : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.extraUpdates = 2; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.timeLeft = 60; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class WhiteOrbBlah : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.extraUpdates = 2; + projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.timeLeft = 60; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + } +} diff --git a/Projectiles/Melee/Whiterain.cs b/Projectiles/Melee/Whiterain.cs index f0a79211ed..f81e5755b4 100644 --- a/Projectiles/Melee/Whiterain.cs +++ b/Projectiles/Melee/Whiterain.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Whiterain : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rain"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); - } - Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default(Color), 1.25f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Whiterain : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rain"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.extraUpdates = 1; + projectile.penetrate = 2; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 120; + projectile.melee = true; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + } + Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default(Color), 1.25f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 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; + } + } + } +} diff --git a/Projectiles/Melee/WhiterainBlah.cs b/Projectiles/Melee/WhiterainBlah.cs index a9db7a3a43..95232646d1 100644 --- a/Projectiles/Melee/WhiterainBlah.cs +++ b/Projectiles/Melee/WhiterainBlah.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class WhiterainBlah : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rain"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.extraUpdates = 2; - projectile.penetrate = 2; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 180; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); - for (int num457 = 0; num457 < 2; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1000f; - 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 = 18f; - 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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class WhiterainBlah : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rain"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.extraUpdates = 2; + projectile.penetrate = 2; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 180; + projectile.melee = true; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 200f), ((float)Main.DiscoG / 200f), ((float)Main.DiscoB / 200f)); + for (int num457 = 0; num457 < 2; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1000f; + 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 = 18f; + 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; + } + } + } +} diff --git a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs b/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs index baf3b640b3..47ddf21c4f 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs @@ -1,90 +1,90 @@ -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.Yoyos -{ - public class AirSpinnerProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Air Spinner"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Valor); - projectile.width = 16; - projectile.scale = 1.05f; - projectile.height = 16; - projectile.penetrate = 7; - projectile.extraUpdates = 1; - projectile.melee = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - aiType = ProjectileID.Valor; - } - - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 60f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Feather"), projectile.damage / 4, 0f, 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 +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.Yoyos +{ + public class AirSpinnerProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Air Spinner"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Valor); + projectile.width = 16; + projectile.scale = 1.05f; + projectile.height = 16; + projectile.penetrate = 7; + projectile.extraUpdates = 1; + projectile.melee = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + aiType = ProjectileID.Valor; + } + + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 60f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Feather"), projectile.damage / 4, 0f, 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/AortaProjectile.cs b/Projectiles/Melee/Yoyos/AortaProjectile.cs index 79b09bd20c..86f6f74ff2 100644 --- a/Projectiles/Melee/Yoyos/AortaProjectile.cs +++ b/Projectiles/Melee/Yoyos/AortaProjectile.cs @@ -1,38 +1,38 @@ -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.Yoyos -{ - public class AortaProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aorta"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Valor); - projectile.width = 16; - projectile.height = 16; - projectile.penetrate = 7; - projectile.extraUpdates = 1; - projectile.melee = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - 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 +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.Yoyos +{ + public class AortaProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aorta"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Valor); + projectile.width = 16; + projectile.height = 16; + projectile.penetrate = 7; + projectile.extraUpdates = 1; + projectile.melee = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/AzathothProjectile.cs b/Projectiles/Melee/Yoyos/AzathothProjectile.cs index acaa363ca8..b1b0554ae1 100644 --- a/Projectiles/Melee/Yoyos/AzathothProjectile.cs +++ b/Projectiles/Melee/Yoyos/AzathothProjectile.cs @@ -1,50 +1,50 @@ -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.Yoyos -{ - public class AzathothProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Azathoth"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Kraken); - projectile.width = 16; - projectile.scale = 1.2f; - projectile.height = 16; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - aiType = 554; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - if (Main.rand.Next(6) == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("CosmicOrb"), 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 +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.Yoyos +{ + public class AzathothProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Azathoth"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Kraken); + projectile.width = 16; + projectile.scale = 1.2f; + projectile.height = 16; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + aiType = 554; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + if (Main.rand.Next(6) == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, mod.ProjectileType("CosmicOrb"), 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs b/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs index 8288587442..8fce5e6824 100644 --- a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs +++ b/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs @@ -1,53 +1,53 @@ -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.Yoyos -{ - public class ChaotrixProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaotrix"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Yelets); - projectile.width = 16; - projectile.scale = 1.15f; - projectile.height = 16; - projectile.penetrate = 10; - projectile.melee = true; - aiType = 549; - } - - public override void AI() - { - 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); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 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); - } - } - - 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 +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.Yoyos +{ + public class ChaotrixProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaotrix"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Yelets); + projectile.width = 16; + projectile.scale = 1.15f; + projectile.height = 16; + projectile.penetrate = 10; + projectile.melee = true; + aiType = 549; + } + + public override void AI() + { + 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); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 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); + } + } + + 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs b/Projectiles/Melee/Yoyos/CnidarianProjectile.cs index a34c92b96a..a76a388512 100644 --- a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs +++ b/Projectiles/Melee/Yoyos/CnidarianProjectile.cs @@ -1,88 +1,88 @@ -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.Yoyos -{ - public class CnidarianProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cnidarian"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.CorruptYoyo); - projectile.width = 16; - projectile.scale = 1.15f; - projectile.height = 16; - projectile.penetrate = 6; - projectile.melee = true; - aiType = 542; - } - - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 60f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Seashell"), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].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 +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.Yoyos +{ + public class CnidarianProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cnidarian"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.CorruptYoyo); + projectile.width = 16; + projectile.scale = 1.15f; + projectile.height = 16; + projectile.penetrate = 6; + projectile.melee = true; + aiType = 542; + } + + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 60f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Seashell"), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); + Main.projectile[projectile2].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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/LaceratorProjectile.cs b/Projectiles/Melee/Yoyos/LaceratorProjectile.cs index 0e7a035683..5a31fa9972 100644 --- a/Projectiles/Melee/Yoyos/LaceratorProjectile.cs +++ b/Projectiles/Melee/Yoyos/LaceratorProjectile.cs @@ -1,53 +1,53 @@ -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.Yoyos -{ - public class LaceratorProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lacerator"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); - projectile.width = 16; - projectile.scale = 1.1f; - projectile.height = 16; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - 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]; - if (Main.rand.Next(5) == 0) - { - player.statLife += 1; - 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 +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.Yoyos +{ + public class LaceratorProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lacerator"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.scale = 1.1f; + projectile.height = 16; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + aiType = 555; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + 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]; + if (Main.rand.Next(5) == 0) + { + player.statLife += 1; + 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs b/Projectiles/Melee/Yoyos/QuagmireProjectile.cs index 594a31bb99..70c34687b1 100644 --- a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs +++ b/Projectiles/Melee/Yoyos/QuagmireProjectile.cs @@ -1,67 +1,67 @@ -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.Yoyos -{ - public class QuagmireProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Quagmire"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.HelFire); - projectile.width = 16; - projectile.scale = 1.25f; - projectile.height = 16; - projectile.penetrate = 8; - projectile.melee = true; - aiType = 553; - } - - public override void AI() - { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (projectile.owner == Main.myPlayer) - { - if (Main.rand.Next(10) == 0) - { - 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) - { - 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) - { - 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; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 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 +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.Yoyos +{ + public class QuagmireProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Quagmire"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.HelFire); + projectile.width = 16; + projectile.scale = 1.25f; + projectile.height = 16; + projectile.penetrate = 8; + projectile.melee = true; + aiType = 553; + } + + public override void AI() + { + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.owner == Main.myPlayer) + { + if (Main.rand.Next(10) == 0) + { + 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) + { + 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) + { + 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; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs b/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs index 2b2377ddc4..e937229328 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs @@ -1,100 +1,100 @@ -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.Yoyos -{ - public class ShimmersparkProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shimmerspark"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Chik); - projectile.width = 16; - projectile.scale = 0.9f; - projectile.height = 16; - projectile.penetrate = 8; - projectile.melee = true; - aiType = 546; - } - - public override void AI() - { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.Next(5) == 0) - { - if (projectile.owner == Main.myPlayer) - { - 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; - } - } - } - } - } - - 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, 120); - } - } -} \ No newline at end of file +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.Yoyos +{ + public class ShimmersparkProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shimmerspark"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Chik); + projectile.width = 16; + projectile.scale = 0.9f; + projectile.height = 16; + projectile.penetrate = 8; + projectile.melee = true; + aiType = 546; + } + + public override void AI() + { + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.Next(5) == 0) + { + if (projectile.owner == Main.myPlayer) + { + 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; + } + } + } + } + } + + 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, 120); + } + } +} diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index 52d400df46..145320b1ae 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -1,57 +1,57 @@ -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.Yoyos -{ - public class SolarFlareYoyo : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Solar Flare"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); - projectile.width = 16; - projectile.scale = 1.15f; - projectile.height = 16; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - if (projectile.owner == Main.myPlayer) - { - 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 +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.Yoyos +{ + public class SolarFlareYoyo : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Solar Flare"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.scale = 1.15f; + projectile.height = 16; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + aiType = 555; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + if (projectile.owner == Main.myPlayer) + { + 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs b/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs index 9075036ef8..3c72db4ee9 100644 --- a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs +++ b/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs @@ -1,92 +1,92 @@ -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.Yoyos -{ - public class TheEyeofCalamitasProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oblivion"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); - projectile.width = 16; - projectile.scale = 1.1f; - projectile.height = 16; - projectile.penetrate = -1; - projectile.melee = true; - aiType = 555; - } - - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 16f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("BrimstoneLaserFriendly"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - 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 +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.Yoyos +{ + public class TheEyeofCalamitasProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oblivion"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.scale = 1.1f; + projectile.height = 16; + projectile.penetrate = -1; + projectile.melee = true; + aiType = 555; + } + + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 16f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("BrimstoneLaserFriendly"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs b/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs index f2ae049c10..e3c574bdae 100644 --- a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs +++ b/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs @@ -1,93 +1,93 @@ -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.Yoyos -{ - public class TheGodsGambitProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God's Gambit"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Kraken); - projectile.width = 16; - projectile.scale = 1.15f; - projectile.height = 16; - projectile.penetrate = 6; - projectile.melee = true; - aiType = 554; - } - - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 450f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 20f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ProjectileID.SlimeGun, projectile.damage / 4, 0f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].GetGlobalProjectile(mod).forceMelee = true; - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Slimed, 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 +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.Yoyos +{ + public class TheGodsGambitProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God's Gambit"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Kraken); + projectile.width = 16; + projectile.scale = 1.15f; + projectile.height = 16; + projectile.penetrate = 6; + projectile.melee = true; + aiType = 554; + } + + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 450f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 20f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + int projectile2 = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ProjectileID.SlimeGun, projectile.damage / 4, 0f, projectile.owner, 0f, 0f); + Main.projectile[projectile2].GetGlobalProjectile(mod).forceMelee = true; + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Slimed, 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/TheObliterator.cs b/Projectiles/Melee/Yoyos/TheObliterator.cs index f2c33cec97..1c4e5d7531 100644 --- a/Projectiles/Melee/Yoyos/TheObliterator.cs +++ b/Projectiles/Melee/Yoyos/TheObliterator.cs @@ -1,95 +1,95 @@ -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.Yoyos -{ - public class TheObliterator : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Obliterator"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); - projectile.width = 16; - projectile.height = 16; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } - - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 16f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - 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; - } - } - } - } - - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(10f, 10f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/Yoyos/TheObliteratorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } -} \ No newline at end of file +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.Yoyos +{ + public class TheObliterator : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Obliterator"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.height = 16; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + aiType = 555; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 16f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + 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; + } + } + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(10f, 10f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Melee/Yoyos/TheObliteratorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } +} diff --git a/Projectiles/Melee/Yoyos/ThePlaguebringer.cs b/Projectiles/Melee/Yoyos/ThePlaguebringer.cs index d86b39bbc0..329e292fc7 100644 --- a/Projectiles/Melee/Yoyos/ThePlaguebringer.cs +++ b/Projectiles/Melee/Yoyos/ThePlaguebringer.cs @@ -1,92 +1,92 @@ -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.Yoyos -{ - public class ThePlaguebringer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pandemic"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); - projectile.width = 16; - projectile.scale = 1f; - projectile.height = 16; - projectile.penetrate = -1; - projectile.melee = true; - aiType = 555; - } - - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 32f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("PlagueSeeker"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - 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 +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.Yoyos +{ + public class ThePlaguebringer : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pandemic"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.scale = 1f; + projectile.height = 16; + projectile.penetrate = -1; + projectile.melee = true; + aiType = 555; + } + + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 32f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("PlagueSeeker"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/VerdantProjectile.cs b/Projectiles/Melee/Yoyos/VerdantProjectile.cs index 8787e7edf6..cee5d5b01e 100644 --- a/Projectiles/Melee/Yoyos/VerdantProjectile.cs +++ b/Projectiles/Melee/Yoyos/VerdantProjectile.cs @@ -1,97 +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.Melee.Yoyos -{ - public class VerdantProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Verdant"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Kraken); - projectile.width = 16; - projectile.scale = 1.1f; - projectile.height = 16; - projectile.penetrate = -1; - projectile.melee = true; - aiType = 554; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 75, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.Next(2) == 0) - { - if (projectile.owner == Main.myPlayer) - { - 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; - } - } - } - } - } - - 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 +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.Yoyos +{ + public class VerdantProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Verdant"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Kraken); + projectile.width = 16; + projectile.scale = 1.1f; + projectile.height = 16; + projectile.penetrate = -1; + projectile.melee = true; + aiType = 554; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 75, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.Next(2) == 0) + { + if (projectile.owner == Main.myPlayer) + { + 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; + } + } + } + } + } + + 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; + } + } +} diff --git a/Projectiles/Melee/Yoyos/YinYo.cs b/Projectiles/Melee/Yoyos/YinYo.cs index 22b9405512..86ec92013e 100644 --- a/Projectiles/Melee/Yoyos/YinYo.cs +++ b/Projectiles/Melee/Yoyos/YinYo.cs @@ -1,98 +1,98 @@ -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.Yoyos -{ - public class YinYo : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yinyo"); - } - - public override void SetDefaults() - { - projectile.CloneDefaults(ProjectileID.Chik); - projectile.width = 16; - projectile.scale = 0.9f; - projectile.height = 16; - projectile.penetrate = 5; - projectile.melee = true; - aiType = 546; - } - - public override void AI() - { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 0f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.Next(6) == 0) - { - int choice = Main.rand.Next(2); - if (projectile.owner == Main.myPlayer) - { - if (choice == 0) - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Dark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else - { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Light"), 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 +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.Yoyos +{ + public class YinYo : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yinyo"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.Chik); + projectile.width = 16; + projectile.scale = 0.9f; + projectile.height = 16; + projectile.penetrate = 5; + projectile.melee = true; + aiType = 546; + } + + public override void AI() + { + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 0f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.Next(6) == 0) + { + int choice = Main.rand.Next(2); + if (projectile.owner == Main.myPlayer) + { + if (choice == 0) + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Dark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else + { + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("Light"), 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; + } + } +} diff --git a/Projectiles/Patreon/Akato.cs b/Projectiles/Patreon/Akato.cs index 78835bcdfa..8b44409121 100644 --- a/Projectiles/Patreon/Akato.cs +++ b/Projectiles/Patreon/Akato.cs @@ -147,4 +147,4 @@ namespace CalamityMod.Projectiles.Patreon } } } -} \ No newline at end of file +} diff --git a/Projectiles/Patreon/DarkSpark.cs b/Projectiles/Patreon/DarkSpark.cs index c23bfb6d28..2e8ee5926d 100644 --- a/Projectiles/Patreon/DarkSpark.cs +++ b/Projectiles/Patreon/DarkSpark.cs @@ -1,230 +1,230 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Enums; - -namespace CalamityMod.Projectiles.Patreon -{ - public class DarkSpark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 22; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.magic = true; - projectile.ignoreWater = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 0f; - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - float num26 = 30f; - if (projectile.ai[0] > 360f) - { - num26 = 15f; - } - if (projectile.ai[0] > 480f) - { - num26 = 5f; - } - projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); - projectile.ai[0] += 1f; - projectile.ai[1] += 1f; - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.localAI[1] = 255f; - } - if (projectile.localAI[1] > 0f) - { - projectile.localAI[1] -= 1f; - } - bool flag9 = false; - if (projectile.ai[0] % num26 == 0f) - { - flag9 = true; - } - int num27 = 10; - bool flag10 = false; - if (projectile.ai[0] % num26 == 0f) - { - flag10 = true; - } - if (projectile.ai[1] >= 1f) - { - projectile.ai[1] = 0f; - flag10 = true; - if (Main.myPlayer == projectile.owner) - { - float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value12 = vector; - Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; - if (player.gravDir == -1f) - { - value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; - } - Vector2 vector11 = Vector2.Normalize(value13); - if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) - { - vector11 = -Vector2.UnitY; - } - vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); - vector11 *= scaleFactor5; - if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector11; - } - } - projectile.frameCounter++; - int num28 = (projectile.ai[0] < 480f) ? 3 : 1; - if (projectile.frameCounter >= num28) - { - projectile.frameCounter = 0; - if (++projectile.frame >= 4) - { - projectile.frame = 0; - } - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num27; - projectile.soundDelay *= 2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item15, projectile.position); - } - } - if (flag10 && Main.myPlayer == projectile.owner) - { - bool flag11 = !flag9 || player.CheckMana(player.inventory[player.selectedItem].mana, true, false); - bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; - if (flag12) - { - if (projectile.ai[0] == 1f) - { - Vector2 center3 = projectile.Center; - Vector2 vector12 = Vector2.Normalize(projectile.velocity); - if (float.IsNaN(vector12.X) || float.IsNaN(vector12.Y)) - { - vector12 = -Vector2.UnitY; - } - int num29 = projectile.damage; - for (int l = 0; l < 7; l++) - { - Projectile.NewProjectile(center3.X, center3.Y, vector12.X, vector12.Y, mod.ProjectileType("DarkSparkBeam"), num29, projectile.knockBack, projectile.owner, (float)l, (float)projectile.whoAmI); - } - projectile.netUpdate = true; - } - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) - { - color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); - } - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Texture2D texture2D14 = Main.projectileTexture[projectile.type]; - int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y7 = num215 * projectile.frame; - Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); - float scale5 = 1f; - if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) - { - float num216 = Main.player[projectile.owner].stealth; - if ((double)num216 < 0.03) - { - num216 = 0.03f; - } - float arg_97B3_0 = (1f + num216 * 10f) / 11f; - color25 *= num216; - scale5 = num216; - } - if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) - { - float num217 = Main.player[projectile.owner].stealth; - if ((double)num217 < 0.03) - { - num217 = 0.03f; - } - float arg_9854_0 = (1f + num217 * 10f) / 11f; - color25 = color25.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); - scale5 = num217; - } - Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); - float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 120f))) * 2f + 2f; - if (projectile.ai[0] > 480f) - { - scaleFactor2 = 4f; - } - for (float num218 = 0f; num218 < 4f; num218 += 1f) - { - Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default(Vector2)) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)) * 0.03f, projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); - } - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.ai[0] < 255f) - return new Color((int)(projectile.ai[0]), (int)(projectile.ai[0]), (int)(projectile.ai[0]), (int)(projectile.localAI[1])); - else - return new Color(255, 255, 255, 0); - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; + +namespace CalamityMod.Projectiles.Patreon +{ + public class DarkSpark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 22; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.magic = true; + projectile.ignoreWater = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 0f; + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + float num26 = 30f; + if (projectile.ai[0] > 360f) + { + num26 = 15f; + } + if (projectile.ai[0] > 480f) + { + num26 = 5f; + } + projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage); + projectile.ai[0] += 1f; + projectile.ai[1] += 1f; + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.localAI[1] = 255f; + } + if (projectile.localAI[1] > 0f) + { + projectile.localAI[1] -= 1f; + } + bool flag9 = false; + if (projectile.ai[0] % num26 == 0f) + { + flag9 = true; + } + int num27 = 10; + bool flag10 = false; + if (projectile.ai[0] % num26 == 0f) + { + flag10 = true; + } + if (projectile.ai[1] >= 1f) + { + projectile.ai[1] = 0f; + flag10 = true; + if (Main.myPlayer == projectile.owner) + { + float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value12 = vector; + Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; + if (player.gravDir == -1f) + { + value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; + } + Vector2 vector11 = Vector2.Normalize(value13); + if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) + { + vector11 = -Vector2.UnitY; + } + vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); + vector11 *= scaleFactor5; + if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector11; + } + } + projectile.frameCounter++; + int num28 = (projectile.ai[0] < 480f) ? 3 : 1; + if (projectile.frameCounter >= num28) + { + projectile.frameCounter = 0; + if (++projectile.frame >= 4) + { + projectile.frame = 0; + } + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num27; + projectile.soundDelay *= 2; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item15, projectile.position); + } + } + if (flag10 && Main.myPlayer == projectile.owner) + { + bool flag11 = !flag9 || player.CheckMana(player.inventory[player.selectedItem].mana, true, false); + bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; + if (flag12) + { + if (projectile.ai[0] == 1f) + { + Vector2 center3 = projectile.Center; + Vector2 vector12 = Vector2.Normalize(projectile.velocity); + if (float.IsNaN(vector12.X) || float.IsNaN(vector12.Y)) + { + vector12 = -Vector2.UnitY; + } + int num29 = projectile.damage; + for (int l = 0; l < 7; l++) + { + Projectile.NewProjectile(center3.X, center3.Y, vector12.X, vector12.Y, mod.ProjectileType("DarkSparkBeam"), num29, projectile.knockBack, projectile.owner, (float)l, (float)projectile.whoAmI); + } + projectile.netUpdate = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Texture2D texture2D14 = Main.projectileTexture[projectile.type]; + int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y7 = num215 * projectile.frame; + Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); + float scale5 = 1f; + if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) + { + float num216 = Main.player[projectile.owner].stealth; + if ((double)num216 < 0.03) + { + num216 = 0.03f; + } + float arg_97B3_0 = (1f + num216 * 10f) / 11f; + color25 *= num216; + scale5 = num216; + } + if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) + { + float num217 = Main.player[projectile.owner].stealth; + if ((double)num217 < 0.03) + { + num217 = 0.03f; + } + float arg_9854_0 = (1f + num217 * 10f) / 11f; + color25 = color25.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); + scale5 = num217; + } + Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); + float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 120f))) * 2f + 2f; + if (projectile.ai[0] > 480f) + { + scaleFactor2 = 4f; + } + for (float num218 = 0f; num218 < 4f; num218 += 1f) + { + Main.spriteBatch.Draw(texture2D14, vector27 + Vector2.UnitY.RotatedBy((double)(num218 * 6.28318548f / 4f), default(Vector2)) * scaleFactor2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)) * 0.03f, projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); + } + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.ai[0] < 255f) + return new Color((int)(projectile.ai[0]), (int)(projectile.ai[0]), (int)(projectile.ai[0]), (int)(projectile.localAI[1])); + else + return new Color(255, 255, 255, 0); + } + } +} diff --git a/Projectiles/Patreon/DarkSparkBeam.cs b/Projectiles/Patreon/DarkSparkBeam.cs index fb646d5acd..6e19c9692d 100644 --- a/Projectiles/Patreon/DarkSparkBeam.cs +++ b/Projectiles/Patreon/DarkSparkBeam.cs @@ -1,306 +1,306 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Enums; -using Terraria.GameContent.Shaders; -using Terraria.Graphics.Effects; - -namespace CalamityMod.Projectiles.Patreon -{ - public class DarkSparkBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - Vector2? vector71 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - if (projectile.type != mod.ProjectileType("DarkSparkBeam") || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("DarkSpark")) - { - projectile.Kill(); - return; - } - float num810 = (float)((int)projectile.ai[0]) - 2.5f; - Vector2 value36 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); - Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; - float num811 = num810 * 0.5235988f; - Vector2 value37 = Vector2.Zero; - float num812; //0 to 1 - float y; //6 to 20 - float num813; //1.75 to 20 - float scaleFactor6; //-22 to -2 - Color color = new Color(1, 1, 1, 127); - projectile.Opacity = 1f; - if (projectile2.ai[0] < 720f) - { - num812 = 0f + projectile2.ai[0] / 1440f; //0 to 0.5 - y = 6f + projectile2.ai[0] / 720f * 7f; - if (projectile2.ai[0] > 360f) - { - int colorValue = (int)((0.01f + (((projectile2.ai[0] - 360f) / 360f) * 2.55f)) * 100f); - color = new Color(colorValue, colorValue, colorValue, 127); - } - if (projectile2.ai[0] < 480f) - { - num813 = 1.75f/* + 4f * (projectile2.ai[0] / 120f)*/; //20 to 16 - } - else - { - num813 = 3f + 5f * ((projectile2.ai[0] - 480f) / 240f); //7.99 to 3.01 - } - scaleFactor6 = -2f - projectile2.ai[0] / 720f * 5f; - } - else - { - float colorLimit = projectile2.ai[0] - 720f; - if (colorLimit > 255f) - { - colorLimit = 255f; - } - switch ((int)projectile.ai[0]) //R O Y G B I V - { - case 0: - color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); //red - break; - case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); //orange - break; - case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); //yellow - break; - case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); //green - break; - case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); //blue - break; - case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); //indigo - break; - case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); //violet - break; - } - num812 = 0.5f; //0f, inverted - num813 = 10.875f; //1.75f, inverted - y = 13f; //6f, inverted - scaleFactor6 = -7f; //-2, inverted - } - float num814 = (projectile2.ai[0] + num810 * num813) / (num813 * 6f) * 6.28318548f; - num811 = Vector2.UnitY.RotatedBy((double)num814, default(Vector2)).Y * 0.5235988f * num812; - value37 = (Vector2.UnitY.RotatedBy((double)num814, default(Vector2)) * new Vector2(4f, y)).RotatedBy((double)projectile2.velocity.ToRotation(), default(Vector2)); - projectile.position = projectile2.Center + value36 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); - projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; - projectile.position += value37; - projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy((double)num811, default(Vector2)); - projectile.scale = 1.5f * (1.5f - num812); - projectile.damage = projectile2.damage; - double damageMult = 1.0 + (double)(projectile2.ai[0] * 0.0015f); //1 to 2.0 (1400 * x) - if (damageMult > 2.0) - { - damageMult = 2.0; - } - if (projectile2.ai[0] >= 720f) - { - projectile.damage = (int)((double)projectile.damage * damageMult); - vector71 = new Vector2?(projectile2.Center); - } - if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) - { - vector71 = new Vector2?(Main.player[projectile.owner].Center); - } - projectile.friendly = (projectile2.ai[0] > 120f); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - float num818 = projectile.velocity.ToRotation(); - projectile.rotation = num818 - 1.57079637f; - projectile.velocity = num818.ToRotationVector2(); - float num819 = 2f; - float num820 = 0f; - Vector2 samplingPoint = projectile.Center; - if (vector71.HasValue) - { - samplingPoint = vector71.Value; - } - float[] array3 = new float[(int)num819]; - Collision.LaserScan(samplingPoint, projectile.velocity, num820 * projectile.scale, 2400f, array3); - float num821 = 0f; - for (int num822 = 0; num822 < array3.Length; num822++) - { - num821 += array3[num822]; - } - num821 /= num819; - float amount = 0.75f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); - if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) - { - //color.A = 0; - Vector2 vector80 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); - for (int num843 = 0; num843 < 2; num843++) - { - float num844 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; - float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; - Vector2 vector81 = new Vector2((float)Math.Cos((double)num844) * num845, (float)Math.Sin((double)num844) * num845); - int num846 = Dust.NewDust(vector80, 0, 0, 267, vector81.X, vector81.Y, 0, color, 3.3f); //267 - Main.dust[num846].color = color; - Main.dust[num846].scale = 1.2f; - if (projectile.scale > 1f) - { - Main.dust[num846].velocity *= projectile.scale; - Main.dust[num846].scale *= projectile.scale; - } - Main.dust[num846].noGravity = true; - if (projectile.scale != 1.4f) - { - Dust dust9 = Dust.CloneDust(num846); - dust9.color = color; - dust9.scale /= 2f; - dust9.noGravity = true; - } - Main.dust[num846].color = color; - } - if (Main.rand.Next(5) == 0) - { - Vector2 value42 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; - int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 267, 0f, 0f, 100, color, 5f); - Main.dust[num847].velocity *= 0.5f; - Main.dust[num847].noGravity = true; - Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); - } - DelegateMethods.v3_1 = color.ToVector3() * 0.3f; - float value43 = 0.1f * (float)Math.Sin((double)(Main.GlobalTime * 20f)); - Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], (float)projectile.width * projectile.scale); - float num848 = projectile.velocity.ToRotation(); - if (Main.netMode != 2) - { - ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy((double)num848, default(Vector2)), color, size, RippleShape.Square, num848); - } - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - return; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.velocity == Vector2.Zero) - { - return false; - } - Texture2D tex = Main.projectileTexture[projectile.type]; - float num228 = projectile.localAI[1]; - Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; - Color color = new Color(1, 1, 1, 127); - if (projectile2.ai[0] < 720f) - { - if (projectile2.ai[0] > 360f) - { - int colorValue = (int)((0.01f + (((projectile2.ai[0] - 360f) / 360f) * 2.55f)) * 100f); - color = new Color(colorValue, colorValue, colorValue, 127); - } - } - else - { - float colorLimit = projectile2.ai[0] - 720f; - if (colorLimit > 255f) - { - colorLimit = 255f; - } - switch ((int)projectile.ai[0]) //R O Y G B I V - { - case 0: - color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); //red - break; - case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); //orange - break; - case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); //yellow - break; - case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); //green - break; - case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); //blue - break; - case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); //indigo - break; - case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); //violet - break; - } - } - Microsoft.Xna.Framework.Color value25 = color; - //value25.A = 0; - Vector2 value26 = projectile.Center.Floor(); - value26 += projectile.velocity * projectile.scale * 10.5f; - num228 -= projectile.scale * 14.5f * projectile.scale; - Vector2 vector29 = new Vector2(projectile.scale); - DelegateMethods.f_1 = 1f; - DelegateMethods.c_1 = value25 * 0.75f * projectile.Opacity; - Vector2 projPos = projectile.oldPos[0]; - projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); - DelegateMethods.c_1 = color * 0.75f * projectile.Opacity; - Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); - return false; - } - - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) - { - return true; - } - return false; - } - } -} \ No newline at end of file +using System; +using System.IO; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; +using Terraria.GameContent.Shaders; +using Terraria.Graphics.Effects; + +namespace CalamityMod.Projectiles.Patreon +{ + public class DarkSparkBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + Vector2? vector71 = null; + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + if (projectile.type != mod.ProjectileType("DarkSparkBeam") || !Main.projectile[(int)projectile.ai[1]].active || Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("DarkSpark")) + { + projectile.Kill(); + return; + } + float num810 = (float)((int)projectile.ai[0]) - 2.5f; + Vector2 value36 = Vector2.Normalize(Main.projectile[(int)projectile.ai[1]].velocity); + Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; + float num811 = num810 * 0.5235988f; + Vector2 value37 = Vector2.Zero; + float num812; //0 to 1 + float y; //6 to 20 + float num813; //1.75 to 20 + float scaleFactor6; //-22 to -2 + Color color = new Color(1, 1, 1, 127); + projectile.Opacity = 1f; + if (projectile2.ai[0] < 720f) + { + num812 = 0f + projectile2.ai[0] / 1440f; //0 to 0.5 + y = 6f + projectile2.ai[0] / 720f * 7f; + if (projectile2.ai[0] > 360f) + { + int colorValue = (int)((0.01f + (((projectile2.ai[0] - 360f) / 360f) * 2.55f)) * 100f); + color = new Color(colorValue, colorValue, colorValue, 127); + } + if (projectile2.ai[0] < 480f) + { + num813 = 1.75f/* + 4f * (projectile2.ai[0] / 120f)*/; //20 to 16 + } + else + { + num813 = 3f + 5f * ((projectile2.ai[0] - 480f) / 240f); //7.99 to 3.01 + } + scaleFactor6 = -2f - projectile2.ai[0] / 720f * 5f; + } + else + { + float colorLimit = projectile2.ai[0] - 720f; + if (colorLimit > 255f) + { + colorLimit = 255f; + } + switch ((int)projectile.ai[0]) //R O Y G B I V + { + case 0: + color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); //red + break; + case 1: + color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); //orange + break; + case 2: + color = new Color(255, 255, 255 - (int)colorLimit, 127); //yellow + break; + case 3: + color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); //green + break; + case 4: + color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); //blue + break; + case 5: + color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); //indigo + break; + case 6: + color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); //violet + break; + } + num812 = 0.5f; //0f, inverted + num813 = 10.875f; //1.75f, inverted + y = 13f; //6f, inverted + scaleFactor6 = -7f; //-2, inverted + } + float num814 = (projectile2.ai[0] + num810 * num813) / (num813 * 6f) * 6.28318548f; + num811 = Vector2.UnitY.RotatedBy((double)num814, default(Vector2)).Y * 0.5235988f * num812; + value37 = (Vector2.UnitY.RotatedBy((double)num814, default(Vector2)) * new Vector2(4f, y)).RotatedBy((double)projectile2.velocity.ToRotation(), default(Vector2)); + projectile.position = projectile2.Center + value36 * 16f - projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)projectile.ai[1]].gfxOffY); + projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; + projectile.position += value37; + projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy((double)num811, default(Vector2)); + projectile.scale = 1.5f * (1.5f - num812); + projectile.damage = projectile2.damage; + double damageMult = 1.0 + (double)(projectile2.ai[0] * 0.0015f); //1 to 2.0 (1400 * x) + if (damageMult > 2.0) + { + damageMult = 2.0; + } + if (projectile2.ai[0] >= 720f) + { + projectile.damage = (int)((double)projectile.damage * damageMult); + vector71 = new Vector2?(projectile2.Center); + } + if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) + { + vector71 = new Vector2?(Main.player[projectile.owner].Center); + } + projectile.friendly = (projectile2.ai[0] > 120f); + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + { + projectile.velocity = -Vector2.UnitY; + } + float num818 = projectile.velocity.ToRotation(); + projectile.rotation = num818 - 1.57079637f; + projectile.velocity = num818.ToRotationVector2(); + float num819 = 2f; + float num820 = 0f; + Vector2 samplingPoint = projectile.Center; + if (vector71.HasValue) + { + samplingPoint = vector71.Value; + } + float[] array3 = new float[(int)num819]; + Collision.LaserScan(samplingPoint, projectile.velocity, num820 * projectile.scale, 2400f, array3); + float num821 = 0f; + for (int num822 = 0; num822 < array3.Length; num822++) + { + num821 += array3[num822]; + } + num821 /= num819; + float amount = 0.75f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); + if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) + { + //color.A = 0; + Vector2 vector80 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14.5f * projectile.scale); + for (int num843 = 0; num843 < 2; num843++) + { + float num844 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; + float num845 = (float)Main.rand.NextDouble() * 0.8f + 1f; + Vector2 vector81 = new Vector2((float)Math.Cos((double)num844) * num845, (float)Math.Sin((double)num844) * num845); + int num846 = Dust.NewDust(vector80, 0, 0, 267, vector81.X, vector81.Y, 0, color, 3.3f); //267 + Main.dust[num846].color = color; + Main.dust[num846].scale = 1.2f; + if (projectile.scale > 1f) + { + Main.dust[num846].velocity *= projectile.scale; + Main.dust[num846].scale *= projectile.scale; + } + Main.dust[num846].noGravity = true; + if (projectile.scale != 1.4f) + { + Dust dust9 = Dust.CloneDust(num846); + dust9.color = color; + dust9.scale /= 2f; + dust9.noGravity = true; + } + Main.dust[num846].color = color; + } + if (Main.rand.Next(5) == 0) + { + Vector2 value42 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + int num847 = Dust.NewDust(vector80 + value42 - Vector2.One * 4f, 8, 8, 267, 0f, 0f, 100, color, 5f); + Main.dust[num847].velocity *= 0.5f; + Main.dust[num847].noGravity = true; + Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); + } + DelegateMethods.v3_1 = color.ToVector3() * 0.3f; + float value43 = 0.1f * (float)Math.Sin((double)(Main.GlobalTime * 20f)); + Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], (float)projectile.width * projectile.scale); + float num848 = projectile.velocity.ToRotation(); + if (Main.netMode != 2) + { + ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy((double)num848, default(Vector2)), color, size, RippleShape.Square, num848); + } + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D tex = Main.projectileTexture[projectile.type]; + float num228 = projectile.localAI[1]; + Projectile projectile2 = Main.projectile[(int)projectile.ai[1]]; + Color color = new Color(1, 1, 1, 127); + if (projectile2.ai[0] < 720f) + { + if (projectile2.ai[0] > 360f) + { + int colorValue = (int)((0.01f + (((projectile2.ai[0] - 360f) / 360f) * 2.55f)) * 100f); + color = new Color(colorValue, colorValue, colorValue, 127); + } + } + else + { + float colorLimit = projectile2.ai[0] - 720f; + if (colorLimit > 255f) + { + colorLimit = 255f; + } + switch ((int)projectile.ai[0]) //R O Y G B I V + { + case 0: + color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); //red + break; + case 1: + color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); //orange + break; + case 2: + color = new Color(255, 255, 255 - (int)colorLimit, 127); //yellow + break; + case 3: + color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); //green + break; + case 4: + color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); //blue + break; + case 5: + color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); //indigo + break; + case 6: + color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); //violet + break; + } + } + Microsoft.Xna.Framework.Color value25 = color; + //value25.A = 0; + Vector2 value26 = projectile.Center.Floor(); + value26 += projectile.velocity * projectile.scale * 10.5f; + num228 -= projectile.scale * 14.5f * projectile.scale; + Vector2 vector29 = new Vector2(projectile.scale); + DelegateMethods.f_1 = 1f; + DelegateMethods.c_1 = value25 * 0.75f * projectile.Opacity; + Vector2 projPos = projectile.oldPos[0]; + projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + DelegateMethods.c_1 = color * 0.75f * projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, value26 - Main.screenPosition, value26 + projectile.velocity * num228 - Main.screenPosition, vector29 / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num6 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + { + return true; + } + return false; + } + } +} diff --git a/Projectiles/Patreon/DivineRetribution.cs b/Projectiles/Patreon/DivineRetribution.cs index d1ad994e04..83199c45c4 100644 --- a/Projectiles/Patreon/DivineRetribution.cs +++ b/Projectiles/Patreon/DivineRetribution.cs @@ -1,148 +1,148 @@ -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 DivineRetribution : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Divine Retribution"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.scale = 0.9f; - projectile.timeLeft = 420; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void AI() - { - float num953 = 25f * projectile.ai[1]; //100 - float scaleFactor12 = 5f * projectile.ai[1]; //5 - float num954 = 1000f; - 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.7f, 0.3f, 0f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 9f; - 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 - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - target.AddBuff(mod.BuffType("HolyLight"), 600); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 64); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 6; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); - } - for (int num194 = 0; num194 < 10; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); - 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, 244, 0, 0); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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 DivineRetribution : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Divine Retribution"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.magic = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.scale = 0.9f; + projectile.timeLeft = 420; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void AI() + { + float num953 = 25f * projectile.ai[1]; //100 + float scaleFactor12 = 5f * projectile.ai[1]; //5 + float num954 = 1000f; + 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.7f, 0.3f, 0f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 9f; + 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 + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + target.AddBuff(mod.BuffType("HolyLight"), 600); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 64); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 6; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); + } + for (int num194 = 0; num194 < 10; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0, 0); + 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, 244, 0, 0); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Patreon/HandheldTankShell.cs b/Projectiles/Patreon/HandheldTankShell.cs index 0d7a98b9bf..fc02818f60 100644 --- a/Projectiles/Patreon/HandheldTankShell.cs +++ b/Projectiles/Patreon/HandheldTankShell.cs @@ -6,155 +6,155 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Patreon -{ - public class HandheldTankShell : ModProjectile - { +{ + public class HandheldTankShell : ModProjectile + { public override void SetStaticDefaults() { DisplayName.SetDefault("Tank Shell"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 11; - projectile.timeLeft = 1800; - } - - public override void AI() - { - drawOffsetX = -8; - drawOriginOffsetY = 0; - drawOriginOffsetX = -2; - projectile.rotation = projectile.velocity.ToRotation(); - Vector2 pos = projectile.Center; - projectile.localAI[0] += 1f; - - if (projectile.localAI[0] > 7f) // projectile has had more than 8 updates, draw fire trail + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.extraUpdates = 11; + projectile.timeLeft = 1800; + } + + public override void AI() + { + drawOffsetX = -8; + drawOriginOffsetY = 0; + drawOriginOffsetX = -2; + projectile.rotation = projectile.velocity.ToRotation(); + Vector2 pos = projectile.Center; + projectile.localAI[0] += 1f; + + if (projectile.localAI[0] > 7f) // projectile has had more than 8 updates, draw fire trail { for (int i = 0; i < 5; ++i) { pos -= projectile.velocity * ((float)i * 0.25f); - int idx = Dust.NewDust(pos, 1, 1, 158, 0f, 0f, 0, default(Color), 1f); - Main.dust[idx].noGravity = true; + int idx = Dust.NewDust(pos, 1, 1, 158, 0f, 0f, 0, default(Color), 1f); + Main.dust[idx].noGravity = true; Main.dust[idx].position = pos; Main.dust[idx].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[idx].velocity *= 0.3f; } return; - } - else // projectile has had less than 8 updates, draw smoke - { - for (int i = 0; i < 30; ++i) - { - // Pick a random type of smoke (there's a little fire mixed in) - int dustID = -1; - switch (Main.rand.Next(6)) - { - case 0: dustID = 55; break; - case 1: - case 2: dustID = 54; break; - default: dustID = 53; break; - } - - // Choose a random speed and angle to belch out the smoke - float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the smoke particle - float scale = Main.rand.NextFloat(0.5f, 1.6f); - - // Actually spawn the smoke - int idx = Dust.NewDust(pos, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default(Color), scale); - Main.dust[idx].noGravity = true; - Main.dust[idx].position = pos; - } - } - } - - public override void Kill(int timeLeft) - { - // Grenade Launcher + Lunar Flare sounds for maximum meaty explosion - Main.PlaySound(SoundID.Item62, projectile.Center); - Main.PlaySound(SoundID.Item88, projectile.Center); - - // Transform the projectile's hitbox into a big explosion - projectile.position = projectile.Center; - projectile.width = (projectile.height = 140); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - - // Spawn explosion dust (separate method because it's messy) - SpawnExplosionDust(); - - // Make the explosion cause damage to nearby targets (makes projectile hit twice) - projectile.Damage(); - } - - // Dust copied from Rocket III - void SpawnExplosionDust() - { - // Sparks and such - Vector2 corner = new Vector2(projectile.position.X, projectile.position.Y); - for (int i = 0; i < 40; i++) - { - int idx = Dust.NewDust(corner, projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 2f); - Main.dust[idx].velocity *= 3f; - if (Main.rand.Next(2) == 0) - { - Main.dust[idx].scale = 0.5f; - Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int i = 0; i < 70; i++) - { - int idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 3f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 2f); - Main.dust[idx].velocity *= 2f; - } - - // Smoke, which counts as a Gore - Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f); - for (int i = 0; i < 3; i++) - { - float smokeScale = 0.33f; - if (i == 1) - { - smokeScale = 0.66f; - } - if (i == 2) - { - smokeScale = 1f; - } - int idx = Gore.NewGore(goreVec, default(Vector2), Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X += 1f; - Main.gore[idx].velocity.Y += 1f; - - idx = Gore.NewGore(goreVec, default(Vector2), Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X -= 1f; - Main.gore[idx].velocity.Y += 1f; - - idx = Gore.NewGore(goreVec, default(Vector2), Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X += 1f; - Main.gore[idx].velocity.Y -= 1f; - - idx = Gore.NewGore(goreVec, default(Vector2), Main.rand.Next(61, 64), 1f); - Main.gore[idx].velocity *= smokeScale; - Main.gore[idx].velocity.X -= 1f; - Main.gore[idx].velocity.Y -= 1f; - } - } + } + else // projectile has had less than 8 updates, draw smoke + { + for (int i = 0; i < 30; ++i) + { + // Pick a random type of smoke (there's a little fire mixed in) + int dustID = -1; + switch (Main.rand.Next(6)) + { + case 0: dustID = 55; break; + case 1: + case 2: dustID = 54; break; + default: dustID = 53; break; + } + + // Choose a random speed and angle to belch out the smoke + float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the smoke particle + float scale = Main.rand.NextFloat(0.5f, 1.6f); + + // Actually spawn the smoke + int idx = Dust.NewDust(pos, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default(Color), scale); + Main.dust[idx].noGravity = true; + Main.dust[idx].position = pos; + } + } + } + + public override void Kill(int timeLeft) + { + // Grenade Launcher + Lunar Flare sounds for maximum meaty explosion + Main.PlaySound(SoundID.Item62, projectile.Center); + Main.PlaySound(SoundID.Item88, projectile.Center); + + // Transform the projectile's hitbox into a big explosion + projectile.position = projectile.Center; + projectile.width = (projectile.height = 140); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + + // Spawn explosion dust (separate method because it's messy) + SpawnExplosionDust(); + + // Make the explosion cause damage to nearby targets (makes projectile hit twice) + projectile.Damage(); + } + + // Dust copied from Rocket III + void SpawnExplosionDust() + { + // Sparks and such + Vector2 corner = new Vector2(projectile.position.X, projectile.position.Y); + for (int i = 0; i < 40; i++) + { + int idx = Dust.NewDust(corner, projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 2f); + Main.dust[idx].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int i = 0; i < 70; i++) + { + int idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 3f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 5f; + idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 2f); + Main.dust[idx].velocity *= 2f; + } + + // Smoke, which counts as a Gore + Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f); + for (int i = 0; i < 3; i++) + { + float smokeScale = 0.33f; + if (i == 1) + { + smokeScale = 0.66f; + } + if (i == 2) + { + smokeScale = 1f; + } + int idx = Gore.NewGore(goreVec, default(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[idx].velocity *= smokeScale; + Main.gore[idx].velocity.X += 1f; + Main.gore[idx].velocity.Y += 1f; + + idx = Gore.NewGore(goreVec, default(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[idx].velocity *= smokeScale; + Main.gore[idx].velocity.X -= 1f; + Main.gore[idx].velocity.Y += 1f; + + idx = Gore.NewGore(goreVec, default(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[idx].velocity *= smokeScale; + Main.gore[idx].velocity.X += 1f; + Main.gore[idx].velocity.Y -= 1f; + + idx = Gore.NewGore(goreVec, default(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[idx].velocity *= smokeScale; + Main.gore[idx].velocity.X -= 1f; + Main.gore[idx].velocity.Y -= 1f; + } + } } } diff --git a/Projectiles/Patreon/KeelhaulBubble.cs b/Projectiles/Patreon/KeelhaulBubble.cs index 0a6957e311..b700291bda 100644 --- a/Projectiles/Patreon/KeelhaulBubble.cs +++ b/Projectiles/Patreon/KeelhaulBubble.cs @@ -1,31 +1,31 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class KeelhaulBubble : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void Kill(int timeLeft) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 80f, 0f, 0f, mod.ProjectileType("KeelhaulGeyserBottom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 80f, 0f, 0f, mod.ProjectileType("KeelhaulGeyserTop"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class KeelhaulBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void Kill(int timeLeft) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 80f, 0f, 0f, mod.ProjectileType("KeelhaulGeyserBottom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 80f, 0f, 0f, mod.ProjectileType("KeelhaulGeyserTop"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } +} diff --git a/Projectiles/Patreon/KeelhaulGeyserBottom.cs b/Projectiles/Patreon/KeelhaulGeyserBottom.cs index 1eb1d174cb..f810de39d2 100644 --- a/Projectiles/Patreon/KeelhaulGeyserBottom.cs +++ b/Projectiles/Patreon/KeelhaulGeyserBottom.cs @@ -1,47 +1,47 @@ -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 KeelhaulGeyserBottom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Geyser"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 158; - projectile.height = 188; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 360; - projectile.alpha = 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } - } -} \ No newline at end of file +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 KeelhaulGeyserBottom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Geyser"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 158; + projectile.height = 188; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.timeLeft = 360; + projectile.alpha = 90; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Patreon/KeelhaulGeyserTop.cs b/Projectiles/Patreon/KeelhaulGeyserTop.cs index e0af95ed19..66626bca23 100644 --- a/Projectiles/Patreon/KeelhaulGeyserTop.cs +++ b/Projectiles/Patreon/KeelhaulGeyserTop.cs @@ -1,47 +1,47 @@ -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 KeelhaulGeyserTop : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Geyser"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 158; - projectile.height = 188; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = -1; - projectile.timeLeft = 360; - projectile.alpha = 90; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } - } -} \ No newline at end of file +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 KeelhaulGeyserTop : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Geyser"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 158; + projectile.height = 188; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.timeLeft = 360; + projectile.alpha = 90; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Patreon/LightBall.cs b/Projectiles/Patreon/LightBall.cs index fa0d4e12b4..09cf7c2104 100644 --- a/Projectiles/Patreon/LightBall.cs +++ b/Projectiles/Patreon/LightBall.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class LightBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Light Ball"); - } - - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.alpha = 60; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - projectile.velocity.X *= 0.995f; - projectile.velocity.Y *= 0.995f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 212, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - - public override void Kill(int timeLeft) - { - 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 = 300; - projectile.height = 300; - 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 < 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; - 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 < 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; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 212, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class LightBall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light Ball"); + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.friendly = true; + projectile.alpha = 60; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + projectile.velocity.X *= 0.995f; + projectile.velocity.Y *= 0.995f; + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 212, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + public override void Kill(int timeLeft) + { + 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 = 300; + projectile.height = 300; + 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 < 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; + 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 < 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; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 212, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Patreon/LightBallExplosion.cs b/Projectiles/Patreon/LightBallExplosion.cs index 3872d0eaae..05bfa2943d 100644 --- a/Projectiles/Patreon/LightBallExplosion.cs +++ b/Projectiles/Patreon/LightBallExplosion.cs @@ -1,30 +1,30 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class LightBallExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 300; - projectile.height = 300; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class LightBallExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 300; + projectile.height = 300; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + } +} diff --git a/Projectiles/Patreon/LightBead.cs b/Projectiles/Patreon/LightBead.cs index 487cb3a3ff..bfae70eb83 100644 --- a/Projectiles/Patreon/LightBead.cs +++ b/Projectiles/Patreon/LightBead.cs @@ -1,109 +1,109 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class LightBead : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Light Bead"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 50; - projectile.scale = 1.2f; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.magic = true; - } - - public override void AI() - { - 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(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; - Main.dust[num300].velocity *= 0.5f; - Main.dust[num300].scale *= 0.9f; - } - if (projectile.ai[1] > 300f) - { - projectile.scale -= 0.05f; - if ((double)projectile.scale <= 0.2) - { - projectile.scale = 0.2f; - projectile.Kill(); - return; - } - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 500f; - bool homeIn = 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; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 18f; - 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; - } - } - - public override void Kill(int timeLeft) - { - 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); - } - int num251 = Main.rand.Next(2, 3); - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("LightBeadSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class LightBead : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light Bead"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.alpha = 50; + projectile.scale = 1.2f; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.magic = true; + } + + public override void AI() + { + 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(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; + Main.dust[num300].velocity *= 0.5f; + Main.dust[num300].scale *= 0.9f; + } + if (projectile.ai[1] > 300f) + { + projectile.scale -= 0.05f; + if ((double)projectile.scale <= 0.2) + { + projectile.scale = 0.2f; + projectile.Kill(); + return; + } + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 500f; + bool homeIn = 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; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 18f; + 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; + } + } + + public override void Kill(int timeLeft) + { + 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); + } + int num251 = Main.rand.Next(2, 3); + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("LightBeadSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Patreon/LightBeadSplit.cs b/Projectiles/Patreon/LightBeadSplit.cs index 7b1a9c9860..2052449caf 100644 --- a/Projectiles/Patreon/LightBeadSplit.cs +++ b/Projectiles/Patreon/LightBeadSplit.cs @@ -1,45 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class LightBeadSplit : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Light Bead"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.alpha = 50; - projectile.scale = 0.6f; - projectile.penetrate = 1; - projectile.timeLeft = 400; - projectile.magic = true; - } - - public override void AI() - { - 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.velocity *= 0.985f; - - } - - public override void Kill(int timeLeft) - { - 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); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class LightBeadSplit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light Bead"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.alpha = 50; + projectile.scale = 0.6f; + projectile.penetrate = 1; + projectile.timeLeft = 400; + projectile.magic = true; + } + + public override void AI() + { + 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.velocity *= 0.985f; + + } + + public override void Kill(int timeLeft) + { + 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/MelterAmp.cs b/Projectiles/Patreon/MelterAmp.cs index 13fce042e2..ca1dca64e7 100644 --- a/Projectiles/Patreon/MelterAmp.cs +++ b/Projectiles/Patreon/MelterAmp.cs @@ -1,117 +1,117 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class MelterAmp : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Melter Amp"); - Main.projFrames[projectile.type] = 3; - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 38; - projectile.friendly = true; - projectile.magic = true; - projectile.netImportant = true; - projectile.penetrate = -1; - projectile.timeLeft = 6000; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - projectile.tileCollide = false; - projectile.ignoreWater = true; - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("MelterAmp"); - Player player = Main.player[projectile.owner]; - if (flag64) - { - if (player.dead) - { - projectile.active = false; - return; - } - if (player.ownedProjectileCounts[mod.ProjectileType("MelterAmp")] > 1) - { - projectile.active = false; - return; - } - if (!player.inventory[player.selectedItem].magic || player.inventory[player.selectedItem].shoot != mod.ProjectileType("MelterNote1")) - { - projectile.active = false; - return; - } - } - Lighting.AddLight(projectile.Center, 0.75f, 0.75f, 0.75f); - if (projectile.ai[0] > 0f) - { - projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) - { - projectile.ai[0] = 0f; - } - } - if (Main.myPlayer == projectile.owner && projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - int Damage = projectile.damage; - int type; - projectile.netUpdate = true; - float num127 = 20f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (player.gravDir == -1f) - { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; - } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f) - { - vector11 = new Vector2(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - float VelocityX = num128; - float VelocityY = num129; - int note = Main.rand.Next(0, 2); - if (note == 0) - { - Damage = (int)(projectile.damage * 1.5f); - type = mod.ProjectileType("MelterNote1"); - } - else - { - VelocityX *= 1.5f; - VelocityY *= 1.5f; - type = mod.ProjectileType("MelterNote2"); - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, VelocityX, VelocityY, type, Damage, projectile.knockBack, projectile.owner, 0.0f, 0.0f); - } - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class MelterAmp : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Melter Amp"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 38; + projectile.friendly = true; + projectile.magic = true; + projectile.netImportant = true; + projectile.penetrate = -1; + projectile.timeLeft = 6000; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("MelterAmp"); + Player player = Main.player[projectile.owner]; + if (flag64) + { + if (player.dead) + { + projectile.active = false; + return; + } + if (player.ownedProjectileCounts[mod.ProjectileType("MelterAmp")] > 1) + { + projectile.active = false; + return; + } + if (!player.inventory[player.selectedItem].magic || player.inventory[player.selectedItem].shoot != mod.ProjectileType("MelterNote1")) + { + projectile.active = false; + return; + } + } + Lighting.AddLight(projectile.Center, 0.75f, 0.75f, 0.75f); + if (projectile.ai[0] > 0f) + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + projectile.ai[0] = 0f; + } + } + if (Main.myPlayer == projectile.owner && projectile.ai[0] == 0f) + { + projectile.ai[0] = 1f; + int Damage = projectile.damage; + int type; + projectile.netUpdate = true; + float num127 = 20f; + Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; + float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + if (player.gravDir == -1f) + { + num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + } + float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + if (num130 == 0f) + { + vector11 = new Vector2(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2)); + num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; + num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + } + num130 = num127 / num130; + num128 *= num130; + num129 *= num130; + float VelocityX = num128; + float VelocityY = num129; + int note = Main.rand.Next(0, 2); + if (note == 0) + { + Damage = (int)(projectile.damage * 1.5f); + type = mod.ProjectileType("MelterNote1"); + } + else + { + VelocityX *= 1.5f; + VelocityY *= 1.5f; + type = mod.ProjectileType("MelterNote2"); + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, VelocityX, VelocityY, type, Damage, projectile.knockBack, projectile.owner, 0.0f, 0.0f); + } + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Patreon/MelterNote1.cs b/Projectiles/Patreon/MelterNote1.cs index b228dc9622..6f21ff3867 100644 --- a/Projectiles/Patreon/MelterNote1.cs +++ b/Projectiles/Patreon/MelterNote1.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class MelterNote1 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Song"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.tileCollide = false; - projectile.ignoreWater = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - { - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - { - projectile.localAI[0] = 0f; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class MelterNote1 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Song"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.02f; + if (projectile.scale >= 1.25f) + { + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.02f; + if (projectile.scale <= 0.75f) + { + projectile.localAI[0] = 0f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255); + } + } +} diff --git a/Projectiles/Patreon/MelterNote2.cs b/Projectiles/Patreon/MelterNote2.cs index 0e60ddb766..6c3a79428c 100644 --- a/Projectiles/Patreon/MelterNote2.cs +++ b/Projectiles/Patreon/MelterNote2.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class MelterNote2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Song"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 24; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; - projectile.tileCollide = false; - projectile.ignoreWater = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y *= 0.99f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - { - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - { - projectile.localAI[0] = 0f; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class MelterNote2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Song"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 24; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 7; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.99f; + projectile.velocity.Y *= 0.99f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.02f; + if (projectile.scale >= 1.25f) + { + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.02f; + if (projectile.scale <= 0.75f) + { + projectile.localAI[0] = 0f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255); + } + } +} diff --git a/Projectiles/Patreon/MiniGuardianAttack.cs b/Projectiles/Patreon/MiniGuardianAttack.cs index 4210eb87c4..a98dbf1612 100644 --- a/Projectiles/Patreon/MiniGuardianAttack.cs +++ b/Projectiles/Patreon/MiniGuardianAttack.cs @@ -1,247 +1,247 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class MiniGuardianAttack : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Offensive Guardian"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.tileCollide = false; - projectile.width = 60; - projectile.height = 88; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.timeLeft *= 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (player.dead) - { - modPlayer.gOffense = false; - } - if (modPlayer.gOffense) - { - projectile.timeLeft = 2; - } - if (!modPlayer.pArtifact || (!modPlayer.tarraSummon && !modPlayer.bloodflareSummon && - !modPlayer.godSlayerSummon && !modPlayer.silvaSummon && !modPlayer.dsSetBonus && !modPlayer.omegaBlueSet)) - { - projectile.active = false; - return; - } - float num535 = projectile.position.X; - float num536 = projectile.position.Y; - float num537 = 3000f; - bool flag19 = false; - 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) - { - int num3; - for (int num542 = 0; num542 < 200; num542 = num3 + 1) - { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) - { - float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); - float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); - if (num545 < num537) - { - num537 = num545; - num535 = num543; - num536 = num544; - flag19 = true; - } - } - num3 = num542; - } - } - if (!flag19) - { - 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.90f; - } - 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; - } - } - } - else - { - if (projectile.ai[1] == -1f) - { - projectile.ai[1] = 17f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] -= 1f; - } - if (projectile.ai[1] == 0f) - { - float num550 = 24f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num551 = num535 - vector43.X; - float num552 = num536 - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) - { - num550 = 28f; //14 - } - if (modPlayer.gDefense) - { - num550 *= 0.95f; - } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; - } - else - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) - { - projectile.velocity *= 1.05f; - } - } - } - if ((double)projectile.velocity.X > 0.25) - { - projectile.direction = -1; - } - else if ((double)projectile.velocity.X < -0.25) - { - projectile.direction = 1; - } - - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class MiniGuardianAttack : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Offensive Guardian"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.tileCollide = false; + projectile.width = 60; + projectile.height = 88; + projectile.minionSlots = 0f; + projectile.minion = true; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 18000; + projectile.timeLeft *= 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.dead) + { + modPlayer.gOffense = false; + } + if (modPlayer.gOffense) + { + projectile.timeLeft = 2; + } + if (!modPlayer.pArtifact || (!modPlayer.tarraSummon && !modPlayer.bloodflareSummon && + !modPlayer.godSlayerSummon && !modPlayer.silvaSummon && !modPlayer.dsSetBonus && !modPlayer.omegaBlueSet)) + { + projectile.active = false; + return; + } + float num535 = projectile.position.X; + float num536 = projectile.position.Y; + float num537 = 3000f; + bool flag19 = false; + 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) + { + int num3; + for (int num542 = 0; num542 < 200; num542 = num3 + 1) + { + if (Main.npc[num542].CanBeChasedBy(projectile, false)) + { + float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); + float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); + float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + if (num545 < num537) + { + num537 = num545; + num535 = num543; + num536 = num544; + flag19 = true; + } + } + num3 = num542; + } + } + if (!flag19) + { + 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.90f; + } + 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; + } + } + } + else + { + if (projectile.ai[1] == -1f) + { + projectile.ai[1] = 17f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] -= 1f; + } + if (projectile.ai[1] == 0f) + { + float num550 = 24f; //12 + Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num551 = num535 - vector43.X; + float num552 = num536 - vector43.Y; + float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); + if (num553 < 100f) + { + num550 = 28f; //14 + } + if (modPlayer.gDefense) + { + num550 *= 0.95f; + } + num553 = num550 / num553; + num551 *= num553; + num552 *= num553; + projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; + projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + } + else + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + { + projectile.velocity *= 1.05f; + } + } + } + if ((double)projectile.velocity.X > 0.25) + { + projectile.direction = -1; + } + else if ((double)projectile.velocity.X < -0.25) + { + projectile.direction = 1; + } + + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Patreon/MiniGuardianDefense.cs b/Projectiles/Patreon/MiniGuardianDefense.cs index e00df1f2ac..3761945aec 100644 --- a/Projectiles/Patreon/MiniGuardianDefense.cs +++ b/Projectiles/Patreon/MiniGuardianDefense.cs @@ -1,246 +1,246 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class MiniGuardianDefense : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Defensive Guardian"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.tileCollide = false; - projectile.width = 62; - projectile.height = 80; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.timeLeft *= 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (player.dead) - { - modPlayer.gDefense = false; - } - if (modPlayer.gDefense) - { - projectile.timeLeft = 2; - } - if (!modPlayer.pArtifact || player.maxMinions < 8) - { - projectile.active = false; - return; - } - float num535 = projectile.position.X; - float num536 = projectile.position.Y; - float num537 = 3000f; - bool flag19 = false; - 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) - { - int num3; - for (int num542 = 0; num542 < 200; num542 = num3 + 1) - { - if (Main.npc[num542].CanBeChasedBy(projectile, false)) - { - float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); - float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); - if (num545 < num537) - { - num537 = num545; - num535 = num543; - num536 = num544; - flag19 = true; - } - } - num3 = num542; - } - } - if (!flag19) - { - 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.90f; - } - 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; - } - } - } - else - { - if (projectile.ai[1] == -1f) - { - projectile.ai[1] = 17f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] -= 1f; - } - if (projectile.ai[1] == 0f) - { - float num550 = 24f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num551 = num535 - vector43.X; - float num552 = num536 - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) - { - num550 = 28f; //14 - } - if (modPlayer.gOffense) - { - num550 *= 0.95f; - } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; - } - else - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) - { - projectile.velocity *= 1.05f; - } - } - } - if ((double)projectile.velocity.X > 0.25) - { - projectile.direction = -1; - } - else if ((double)projectile.velocity.X < -0.25) - { - projectile.direction = 1; - } - - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class MiniGuardianDefense : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Defensive Guardian"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.tileCollide = false; + projectile.width = 62; + projectile.height = 80; + projectile.minionSlots = 0f; + projectile.minion = true; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 18000; + projectile.timeLeft *= 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.dead) + { + modPlayer.gDefense = false; + } + if (modPlayer.gDefense) + { + projectile.timeLeft = 2; + } + if (!modPlayer.pArtifact || player.maxMinions < 8) + { + projectile.active = false; + return; + } + float num535 = projectile.position.X; + float num536 = projectile.position.Y; + float num537 = 3000f; + bool flag19 = false; + 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) + { + int num3; + for (int num542 = 0; num542 < 200; num542 = num3 + 1) + { + if (Main.npc[num542].CanBeChasedBy(projectile, false)) + { + float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); + float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); + float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + if (num545 < num537) + { + num537 = num545; + num535 = num543; + num536 = num544; + flag19 = true; + } + } + num3 = num542; + } + } + if (!flag19) + { + 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.90f; + } + 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; + } + } + } + else + { + if (projectile.ai[1] == -1f) + { + projectile.ai[1] = 17f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] -= 1f; + } + if (projectile.ai[1] == 0f) + { + float num550 = 24f; //12 + Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num551 = num535 - vector43.X; + float num552 = num536 - vector43.Y; + float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); + if (num553 < 100f) + { + num550 = 28f; //14 + } + if (modPlayer.gOffense) + { + num550 *= 0.95f; + } + num553 = num550 / num553; + num551 *= num553; + num552 *= num553; + projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; + projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + } + else + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + { + projectile.velocity *= 1.05f; + } + } + } + if ((double)projectile.velocity.X > 0.25) + { + projectile.direction = -1; + } + else if ((double)projectile.velocity.X < -0.25) + { + projectile.direction = 1; + } + + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Patreon/MiniGuardianHealer.cs b/Projectiles/Patreon/MiniGuardianHealer.cs index ea4e350b0d..7db26b7e17 100644 --- a/Projectiles/Patreon/MiniGuardianHealer.cs +++ b/Projectiles/Patreon/MiniGuardianHealer.cs @@ -1,164 +1,164 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Patreon -{ - public class MiniGuardianHealer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Healer Guardian"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.tileCollide = false; - projectile.width = 68; - projectile.height = 82; - projectile.friendly = true; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.timeLeft *= 5; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (player.dead) - { - modPlayer.gHealer = false; - } - if (modPlayer.gHealer) - { - projectile.timeLeft = 2; - } - if (!modPlayer.pArtifact) - { - projectile.active = false; - return; - } - Player projOwner = Main.player[projectile.owner]; - 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 = projOwner.position.X + (float)(projOwner.width / 2) - vector3.X; - float num19 = projOwner.position.Y + (float)(projOwner.height / 2) - vector3.Y; - num19 += (float)Main.rand.Next(-10, 21); - num18 += (float)Main.rand.Next(-10, 21); - num18 += (float)(60 * -(float)projOwner.direction); - num19 -= 60f; - float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); - float num21 = 18f; - - if (num20 < (float)num17 && projOwner.velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= projOwner.position.Y + (float)projOwner.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.90f; - } - 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; - } - - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class MiniGuardianHealer : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Healer Guardian"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.tileCollide = false; + projectile.width = 68; + projectile.height = 82; + projectile.friendly = true; + projectile.minionSlots = 0f; + projectile.minion = true; + projectile.penetrate = -1; + projectile.timeLeft = 18000; + projectile.timeLeft *= 5; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.dead) + { + modPlayer.gHealer = false; + } + if (modPlayer.gHealer) + { + projectile.timeLeft = 2; + } + if (!modPlayer.pArtifact) + { + projectile.active = false; + return; + } + Player projOwner = Main.player[projectile.owner]; + 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 = projOwner.position.X + (float)(projOwner.width / 2) - vector3.X; + float num19 = projOwner.position.Y + (float)(projOwner.height / 2) - vector3.Y; + num19 += (float)Main.rand.Next(-10, 21); + num18 += (float)Main.rand.Next(-10, 21); + num18 += (float)(60 * -(float)projOwner.direction); + num19 -= 60f; + float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); + float num21 = 18f; + + if (num20 < (float)num17 && projOwner.velocity.Y == 0f && + projectile.position.Y + (float)projectile.height <= projOwner.position.Y + (float)projOwner.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.90f; + } + 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; + } + + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Patreon/PlagueBee.cs b/Projectiles/Patreon/PlagueBee.cs index 002ce196b6..97355f0c9c 100644 --- a/Projectiles/Patreon/PlagueBee.cs +++ b/Projectiles/Patreon/PlagueBee.cs @@ -162,4 +162,4 @@ namespace CalamityMod.Projectiles.Patreon target.AddBuff(mod.BuffType("Plague"), 300); } } -} \ No newline at end of file +} diff --git a/Projectiles/Patreon/Plaguenade.cs b/Projectiles/Patreon/Plaguenade.cs index f150d70e9e..fdfde1d9e2 100644 --- a/Projectiles/Patreon/Plaguenade.cs +++ b/Projectiles/Patreon/Plaguenade.cs @@ -147,4 +147,4 @@ namespace CalamityMod.Projectiles.Patreon target.AddBuff(mod.BuffType("Plague"), 600); } } -} \ No newline at end of file +} diff --git a/Projectiles/Patreon/ThePackMinissile.cs b/Projectiles/Patreon/ThePackMinissile.cs index 81af04b7e8..7350fd6ddf 100644 --- a/Projectiles/Patreon/ThePackMinissile.cs +++ b/Projectiles/Patreon/ThePackMinissile.cs @@ -1,88 +1,88 @@ -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 ThePackMinissile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pack Minissile"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 1500f; - bool homeIn = 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; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 25f; - 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 * 15f + num484) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; - return; - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int i = 0; i < 10; i++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default(Color), 1f); - - } - } - } -} \ No newline at end of file +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 ThePackMinissile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pack Minissile"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 14; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 1500f; + bool homeIn = 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; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 25f; + 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 * 15f + num484) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; + return; + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int i = 0; i < 10; i++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default(Color), 1f); + + } + } + } +} diff --git a/Projectiles/Patreon/ThePackMissile.cs b/Projectiles/Patreon/ThePackMissile.cs index e1774c7f32..c4c08a7250 100644 --- a/Projectiles/Patreon/ThePackMissile.cs +++ b/Projectiles/Patreon/ThePackMissile.cs @@ -1,133 +1,133 @@ -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 ThePackMissile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pack Missile"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 82; - projectile.height = 18; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 2500f; - float explode = 200f; - bool homeIn = 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 < explode) - { - int numProj = 4; - 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) * 2f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("ThePackMinissile"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - projectile.Kill(); - return; - } - else 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 * 15f + num484) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; - return; - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } - - public override void Kill(int timeLeft) - { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 400; - projectile.height = 400; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default(Color), 1.5f); - 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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default(Color), 2f); - 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, 255, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num624].velocity *= 2f; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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 ThePackMissile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pack Missile"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 82; + projectile.height = 18; + projectile.friendly = true; + projectile.ranged = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 2500f; + float explode = 200f; + bool homeIn = 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 < explode) + { + int numProj = 4; + 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) * 2f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("ThePackMinissile"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.Kill(); + return; + } + else 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 * 15f + num484) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; + return; + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + + public override void Kill(int timeLeft) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 400; + projectile.height = 400; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default(Color), 1.5f); + 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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 255, 0f, 0f, 0, default(Color), 2f); + 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, 255, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num624].velocity *= 2f; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Permafrost/ArcticBearPaw.cs b/Projectiles/Permafrost/ArcticBearPaw.cs index 0e9988f600..a366ed963f 100644 --- a/Projectiles/Permafrost/ArcticBearPaw.cs +++ b/Projectiles/Permafrost/ArcticBearPaw.cs @@ -1,62 +1,62 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class ArcticBearPaw : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 44; - projectile.height = 44; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.magic = true; - projectile.coldDamage = true; - projectile.penetrate = 5; - projectile.ignoreWater = true; - projectile.tileCollide = false; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arctic Bear Paw"); - } - - public override void AI() - { - //make pretty dust - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); - Main.dust[index2].noGravity = true; - - if (projectile.velocity.X > -0.05f && projectile.velocity.X < 0.05f & - projectile.velocity.Y > -0.05f && projectile.velocity.Y < 0.05f) - { - projectile.Kill(); - } - else - { - projectile.velocity *= 0.96f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 480); - target.AddBuff(mod.BuffType("GlacialState"), 60); - - if (Main.rand.Next(3) == 0) - target.AddBuff(BuffID.Confused, Main.rand.Next(60, 240)); - } - - public override Color? GetAlpha (Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class ArcticBearPaw : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 44; + projectile.height = 44; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; + projectile.magic = true; + projectile.coldDamage = true; + projectile.penetrate = 5; + projectile.ignoreWater = true; + projectile.tileCollide = false; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arctic Bear Paw"); + } + + public override void AI() + { + //make pretty dust + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); + Main.dust[index2].noGravity = true; + + if (projectile.velocity.X > -0.05f && projectile.velocity.X < 0.05f & + projectile.velocity.Y > -0.05f && projectile.velocity.Y < 0.05f) + { + projectile.Kill(); + } + else + { + projectile.velocity *= 0.96f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 480); + target.AddBuff(mod.BuffType("GlacialState"), 60); + + if (Main.rand.Next(3) == 0) + target.AddBuff(BuffID.Confused, Main.rand.Next(60, 240)); + } + + public override Color? GetAlpha (Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + } +} diff --git a/Projectiles/Permafrost/DarkIce.cs b/Projectiles/Permafrost/DarkIce.cs index 1c50a55db3..16051a120b 100644 --- a/Projectiles/Permafrost/DarkIce.cs +++ b/Projectiles/Permafrost/DarkIce.cs @@ -1,70 +1,70 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class DarkIce : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - projectile.coldDamage = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Ice"); - } - - public override void AI() - { - if (projectile.localAI[0] != 1f) - { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item8, projectile.Center); - } - - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) - { - projectile.velocity *= 1.04f; - } - - //make pretty dust - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1.25f); - Main.dust[index2].noGravity = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 480); - target.AddBuff(mod.BuffType("GlacialState"), 480); - } - - public override Color? GetAlpha (Color lightColor) - { - return new Color(198, 197, 246); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item27, projectile.position); - for (int i = 0; i < 30; i++) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, 0f, 0f, 0, default(Color), Main.rand.NextFloat(1f, 2f)); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 4f; - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class DarkIce : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.extraUpdates = 1; + projectile.coldDamage = true; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Ice"); + } + + public override void AI() + { + if (projectile.localAI[0] != 1f) + { + projectile.localAI[0] = 1f; + Main.PlaySound(SoundID.Item8, projectile.Center); + } + + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) + { + projectile.velocity *= 1.04f; + } + + //make pretty dust + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1.25f); + Main.dust[index2].noGravity = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 480); + target.AddBuff(mod.BuffType("GlacialState"), 480); + } + + public override Color? GetAlpha (Color lightColor) + { + return new Color(198, 197, 246); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + for (int i = 0; i < 30; i++) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, 0f, 0f, 0, default(Color), Main.rand.NextFloat(1f, 2f)); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 4f; + } + } + } +} diff --git a/Projectiles/Permafrost/DarkIceZero.cs b/Projectiles/Permafrost/DarkIceZero.cs index 94cd363fd4..d7d26ce3f6 100644 --- a/Projectiles/Permafrost/DarkIceZero.cs +++ b/Projectiles/Permafrost/DarkIceZero.cs @@ -1,83 +1,83 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class DarkIceZero : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - projectile.coldDamage = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Ice"); - } - - public override void AI() - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) - { - projectile.velocity *= 1.035f; - } - - //make pretty dust - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1.25f); - Main.dust[index2].noGravity = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 480); - target.AddBuff(mod.BuffType("GlacialState"), 90); - } - - public override Color? GetAlpha (Color lightColor) - { - return new Color(198, 197, 246); - } - - public override void Kill(int timeLeft) - { - if (timeLeft > 0) - { - timeLeft = 0; - Main.PlaySound(SoundID.Item27, projectile.position); - for (int i = 0; i < 30; i++) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, 0f, 0f, 0, default(Color), Main.rand.NextFloat(1f, 2f)); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 4f; - } - projectile.position = projectile.Center; - projectile.width = 200; - projectile.height = 200; - projectile.position.X -= projectile.width / 2; - projectile.position.Y -= projectile.height / 2; - for (int index1 = 0; index1 < 20; ++index1) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1.3f); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 1.5f; - } - projectile.penetrate = -1; - projectile.damage /= 2; - projectile.Damage(); - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class DarkIceZero : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.extraUpdates = 1; + projectile.coldDamage = true; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark Ice"); + } + + public override void AI() + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) + { + projectile.velocity *= 1.035f; + } + + //make pretty dust + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1.25f); + Main.dust[index2].noGravity = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 480); + target.AddBuff(mod.BuffType("GlacialState"), 90); + } + + public override Color? GetAlpha (Color lightColor) + { + return new Color(198, 197, 246); + } + + public override void Kill(int timeLeft) + { + if (timeLeft > 0) + { + timeLeft = 0; + Main.PlaySound(SoundID.Item27, projectile.position); + for (int i = 0; i < 30; i++) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172, 0f, 0f, 0, default(Color), Main.rand.NextFloat(1f, 2f)); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 4f; + } + projectile.position = projectile.Center; + projectile.width = 200; + projectile.height = 200; + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= projectile.height / 2; + for (int index1 = 0; index1 < 20; ++index1) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1.3f); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 1.5f; + } + projectile.penetrate = -1; + projectile.damage /= 2; + projectile.Damage(); + } + } + } +} diff --git a/Projectiles/Permafrost/FrostShardFriendly.cs b/Projectiles/Permafrost/FrostShardFriendly.cs index 556a3bc012..a087af4bc2 100644 --- a/Projectiles/Permafrost/FrostShardFriendly.cs +++ b/Projectiles/Permafrost/FrostShardFriendly.cs @@ -1,82 +1,82 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class FrostShardFriendly : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.aiStyle = 1; - projectile.coldDamage = true; - projectile.friendly = true; - projectile.minion = true; - projectile.penetrate = 1; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frost Shard"); - Main.projFrames[projectile.type] = 5; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frameCounter = 0; - projectile.frame++; - } - - if (projectile.frame >= 5) - projectile.frame = 0; - - projectile.velocity.Y += 0.2f; - if (projectile.localAI[0] == 0f || projectile.localAI[0] == 2f) - { - projectile.scale += 0.01f; - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.localAI[0] = 1f; - projectile.alpha = 0; - } - } - else if (projectile.localAI[0] == 1.0) - { - projectile.scale -= 0.01f; - projectile.alpha += 50; - if (projectile.alpha >= byte.MaxValue) - { - projectile.localAI[0] = 2f; - projectile.alpha = byte.MaxValue; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item27, projectile.position); - for (int index1 = 0; index1 < 3; ++index1) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 76); - Main.dust[index2].noGravity = true; - Main.dust[index2].noLight = true; - Main.dust[index2].scale = 0.7f; - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class FrostShardFriendly : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.aiStyle = 1; + projectile.coldDamage = true; + projectile.friendly = true; + projectile.minion = true; + projectile.penetrate = 1; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frost Shard"); + Main.projFrames[projectile.type] = 5; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frameCounter = 0; + projectile.frame++; + } + + if (projectile.frame >= 5) + projectile.frame = 0; + + projectile.velocity.Y += 0.2f; + if (projectile.localAI[0] == 0f || projectile.localAI[0] == 2f) + { + projectile.scale += 0.01f; + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.localAI[0] = 1f; + projectile.alpha = 0; + } + } + else if (projectile.localAI[0] == 1.0) + { + projectile.scale -= 0.01f; + projectile.alpha += 50; + if (projectile.alpha >= byte.MaxValue) + { + projectile.localAI[0] = 2f; + projectile.alpha = byte.MaxValue; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + for (int index1 = 0; index1 < 3; ++index1) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 76); + Main.dust[index2].noGravity = true; + Main.dust[index2].noLight = true; + Main.dust[index2].scale = 0.7f; + } + } + } +} diff --git a/Projectiles/Permafrost/FrostyFlare.cs b/Projectiles/Permafrost/FrostyFlare.cs index b8f4216d3c..8cbe92014a 100644 --- a/Projectiles/Permafrost/FrostyFlare.cs +++ b/Projectiles/Permafrost/FrostyFlare.cs @@ -1,129 +1,129 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class FrostyFlare : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.coldDamage = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frosty Flare"); - } - - public override void AI() - { - bool shoot = false; - projectile.localAI[0]--; - if (projectile.localAI[0] <= 0f) - { - projectile.localAI[0] = 30f; - if (projectile.owner == Main.myPlayer) - shoot = true; - } - - if (projectile.ai[0] == 0f) - { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y += 0.35f; - projectile.rotation = projectile.velocity.ToRotation(); - - if (shoot) - { - Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); - Vector2 pos = projectile.Center - vel; - vel.X += Main.rand.Next(-50, 51); - vel.Normalize(); - vel *= 30f; - int p = Projectile.NewProjectile(pos, vel + projectile.velocity / 4f, mod.ProjectileType("FrostShardFriendly"), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[p].minion = false; - } - - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172); - Main.dust[index2].noGravity = true; - } - else - { - projectile.ignoreWater = true; - projectile.tileCollide = false; - int id = (int)projectile.ai[1]; - if (id >= 0 && id < 200 && Main.npc[id].active && !Main.npc[id].dontTakeDamage) - { - projectile.Center = Main.npc[id].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[id].gfxOffY; - - if (shoot) - { - Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); - Vector2 pos = Main.npc[id].Center - vel; - vel.X += Main.rand.Next(-50, 51); - vel.Normalize(); - vel *= 30f; - int p = Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, mod.ProjectileType("FrostShardFriendly"), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[p].minion = false; - } - } - else - { - projectile.Kill(); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.immune[projectile.owner] = 0; - projectile.ai[0] = 1f; - projectile.ai[1] = target.whoAmI; - projectile.velocity = target.Center - projectile.Center; - projectile.velocity *= 0.75f; - projectile.netUpdate = true; - - const int maxFlares = 5; - int flaresFound = 0; - int oldestFlare = -1; - int oldestFlareTimeLeft = 300; - for (int i = 0; i < 1000; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == projectile.type && i != projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) - { - flaresFound++; - if (Main.projectile[i].timeLeft < oldestFlareTimeLeft) - { - oldestFlareTimeLeft = Main.projectile[i].timeLeft; - oldestFlare = Main.projectile[i].whoAmI; - } - if (flaresFound >= maxFlares) - break; - } - } - //Main.NewText("found " + flaresFound.ToString()); - if (flaresFound >= maxFlares && oldestFlare >= 0) - { - //Main.NewText("killing flare " + oldestFlare.ToString()); - Main.projectile[oldestFlare].Kill(); - } - } - - public override bool CanDamage() - { - return projectile.ai[0] == 0f; - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class FrostyFlare : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.coldDamage = true; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frosty Flare"); + } + + public override void AI() + { + bool shoot = false; + projectile.localAI[0]--; + if (projectile.localAI[0] <= 0f) + { + projectile.localAI[0] = 30f; + if (projectile.owner == Main.myPlayer) + shoot = true; + } + + if (projectile.ai[0] == 0f) + { + projectile.velocity.X *= 0.99f; + projectile.velocity.Y += 0.35f; + projectile.rotation = projectile.velocity.ToRotation(); + + if (shoot) + { + Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); + Vector2 pos = projectile.Center - vel; + vel.X += Main.rand.Next(-50, 51); + vel.Normalize(); + vel *= 30f; + int p = Projectile.NewProjectile(pos, vel + projectile.velocity / 4f, mod.ProjectileType("FrostShardFriendly"), projectile.damage, projectile.knockBack, projectile.owner); + Main.projectile[p].minion = false; + } + + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172); + Main.dust[index2].noGravity = true; + } + else + { + projectile.ignoreWater = true; + projectile.tileCollide = false; + int id = (int)projectile.ai[1]; + if (id >= 0 && id < 200 && Main.npc[id].active && !Main.npc[id].dontTakeDamage) + { + projectile.Center = Main.npc[id].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[id].gfxOffY; + + if (shoot) + { + Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); + Vector2 pos = Main.npc[id].Center - vel; + vel.X += Main.rand.Next(-50, 51); + vel.Normalize(); + vel *= 30f; + int p = Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, mod.ProjectileType("FrostShardFriendly"), projectile.damage, projectile.knockBack, projectile.owner); + Main.projectile[p].minion = false; + } + } + else + { + projectile.Kill(); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.immune[projectile.owner] = 0; + projectile.ai[0] = 1f; + projectile.ai[1] = target.whoAmI; + projectile.velocity = target.Center - projectile.Center; + projectile.velocity *= 0.75f; + projectile.netUpdate = true; + + const int maxFlares = 5; + int flaresFound = 0; + int oldestFlare = -1; + int oldestFlareTimeLeft = 300; + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == projectile.type && i != projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) + { + flaresFound++; + if (Main.projectile[i].timeLeft < oldestFlareTimeLeft) + { + oldestFlareTimeLeft = Main.projectile[i].timeLeft; + oldestFlare = Main.projectile[i].whoAmI; + } + if (flaresFound >= maxFlares) + break; + } + } + //Main.NewText("found " + flaresFound.ToString()); + if (flaresFound >= maxFlares && oldestFlare >= 0) + { + //Main.NewText("killing flare " + oldestFlare.ToString()); + Main.projectile[oldestFlare].Kill(); + } + } + + public override bool CanDamage() + { + return projectile.ai[0] == 0f; + } + } +} diff --git a/Projectiles/Permafrost/IceSentry.cs b/Projectiles/Permafrost/IceSentry.cs index c660e1c58b..35e638c458 100644 --- a/Projectiles/Permafrost/IceSentry.cs +++ b/Projectiles/Permafrost/IceSentry.cs @@ -1,179 +1,179 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.GameContent; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class IceSentry : ModProjectile - { - private bool setDamage = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Sentry"); - Main.projFrames[projectile.type] = 18; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 102; - projectile.height = 94; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.sentry = true; - } - - public override void AI() - { - if (setDamage) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - setDamage = false; - } - 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.velocity = Vector2.Zero; - - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frameCounter = 0; - projectile.frame++; - } - - if (projectile.ai[1] < 300f) - { - projectile.localAI[1] = 1f; - if (projectile.frame >= 9) - projectile.frame = 0; - } - else - { - if (projectile.frame >= 18) - projectile.frame = 9; - - projectile.localAI[1]++; - if (projectile.localAI[1] > 2) - { - projectile.localAI[1] = 0; - - if (projectile.owner == Main.myPlayer) - { - Vector2 speed = new Vector2(Main.rand.Next(-1000, 1001), Main.rand.Next(-1000, 1001)); - speed.Normalize(); - speed *= 15f; - Projectile.NewProjectile(projectile.Center + speed, speed, mod.ProjectileType("FrostShardFriendly"), projectile.damage / 2, projectile.knockBack / 2, Main.myPlayer); - } - } - } - - NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC; - if (minionAttackTargetNpc != null && projectile.ai[0] != minionAttackTargetNpc.whoAmI && minionAttackTargetNpc.CanBeChasedBy(projectile) && Collision.CanHit(projectile.Center, 0, 0, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height)) - { - //Main.NewText("targeting special target"); - projectile.ai[0] = minionAttackTargetNpc.whoAmI; - projectile.ai[1] = 0f; - projectile.localAI[0] = 0f; - projectile.netUpdate = true; - } - - if (projectile.ai[0] >= 0 && projectile.ai[0] < 200) - { - NPC npc = Main.npc[(int)projectile.ai[0]]; - - bool rememberTarget = npc.CanBeChasedBy(projectile); - if (rememberTarget) - { - projectile.localAI[0]++; - - if (projectile.ai[1] < 300f) - projectile.ai[1]++; - - float delay = 60f - projectile.ai[1] / 60f * 10f; - if (projectile.localAI[0] > delay) - { - //Main.NewText("time to attack, delay " + delay.ToString()); - projectile.localAI[0] = 0f; - - rememberTarget = Collision.CanHit(projectile.Center, 0, 0, npc.position, npc.width, npc.height); - if (rememberTarget && projectile.owner == Main.myPlayer) - { - //Main.NewText("i attacked"); - Vector2 speed = npc.Center - projectile.Center; - speed.Normalize(); - speed *= 8f; - if (projectile.ai[1] >= 300f) - speed = speed.RotatedBy(MathHelper.ToRadians(Main.rand.Next(-5, 6))) * 1.5f + npc.velocity / 2f; - int p = Projectile.NewProjectile(projectile.Center, speed + npc.velocity / 2f, mod.ProjectileType("FrostBoltProjectile"), projectile.damage, projectile.knockBack, projectile.owner); - if (p != 1000) - { - Main.projectile[p].magic = false; - Main.projectile[p].minion = true; - } - } - - //if (!rememberTarget) Main.NewText("couldn't hit target"); - } - } - - if (!rememberTarget) - { - //Main.NewText("forgetting target"); - projectile.ai[0] = -1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.localAI[0] = 0f; - - float maxDistance = 1000f; - int possibleTarget = -1; - - for (int i = 0; i < 200; i++) - { - NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile)) - { - float npcDistance = projectile.Distance(npc.Center); - if (npcDistance < maxDistance) - { - maxDistance = npcDistance; - possibleTarget = i; - } - } - } - - if (possibleTarget > 0) - { - //Main.NewText("new target acquired"); - projectile.ai[0] = possibleTarget; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - } - - public override bool CanDamage() - { - return false; - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class IceSentry : ModProjectile + { + private bool setDamage = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Sentry"); + Main.projFrames[projectile.type] = 18; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 102; + projectile.height = 94; + projectile.timeLeft = Projectile.SentryLifeTime; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.sentry = true; + } + + public override void AI() + { + if (setDamage) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + setDamage = false; + } + 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.velocity = Vector2.Zero; + + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frameCounter = 0; + projectile.frame++; + } + + if (projectile.ai[1] < 300f) + { + projectile.localAI[1] = 1f; + if (projectile.frame >= 9) + projectile.frame = 0; + } + else + { + if (projectile.frame >= 18) + projectile.frame = 9; + + projectile.localAI[1]++; + if (projectile.localAI[1] > 2) + { + projectile.localAI[1] = 0; + + if (projectile.owner == Main.myPlayer) + { + Vector2 speed = new Vector2(Main.rand.Next(-1000, 1001), Main.rand.Next(-1000, 1001)); + speed.Normalize(); + speed *= 15f; + Projectile.NewProjectile(projectile.Center + speed, speed, mod.ProjectileType("FrostShardFriendly"), projectile.damage / 2, projectile.knockBack / 2, Main.myPlayer); + } + } + } + + NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC; + if (minionAttackTargetNpc != null && projectile.ai[0] != minionAttackTargetNpc.whoAmI && minionAttackTargetNpc.CanBeChasedBy(projectile) && Collision.CanHit(projectile.Center, 0, 0, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height)) + { + //Main.NewText("targeting special target"); + projectile.ai[0] = minionAttackTargetNpc.whoAmI; + projectile.ai[1] = 0f; + projectile.localAI[0] = 0f; + projectile.netUpdate = true; + } + + if (projectile.ai[0] >= 0 && projectile.ai[0] < 200) + { + NPC npc = Main.npc[(int)projectile.ai[0]]; + + bool rememberTarget = npc.CanBeChasedBy(projectile); + if (rememberTarget) + { + projectile.localAI[0]++; + + if (projectile.ai[1] < 300f) + projectile.ai[1]++; + + float delay = 60f - projectile.ai[1] / 60f * 10f; + if (projectile.localAI[0] > delay) + { + //Main.NewText("time to attack, delay " + delay.ToString()); + projectile.localAI[0] = 0f; + + rememberTarget = Collision.CanHit(projectile.Center, 0, 0, npc.position, npc.width, npc.height); + if (rememberTarget && projectile.owner == Main.myPlayer) + { + //Main.NewText("i attacked"); + Vector2 speed = npc.Center - projectile.Center; + speed.Normalize(); + speed *= 8f; + if (projectile.ai[1] >= 300f) + speed = speed.RotatedBy(MathHelper.ToRadians(Main.rand.Next(-5, 6))) * 1.5f + npc.velocity / 2f; + int p = Projectile.NewProjectile(projectile.Center, speed + npc.velocity / 2f, mod.ProjectileType("FrostBoltProjectile"), projectile.damage, projectile.knockBack, projectile.owner); + if (p != 1000) + { + Main.projectile[p].magic = false; + Main.projectile[p].minion = true; + } + } + + //if (!rememberTarget) Main.NewText("couldn't hit target"); + } + } + + if (!rememberTarget) + { + //Main.NewText("forgetting target"); + projectile.ai[0] = -1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.localAI[0] = 0f; + + float maxDistance = 1000f; + int possibleTarget = -1; + + for (int i = 0; i < 200; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile)) + { + float npcDistance = projectile.Distance(npc.Center); + if (npcDistance < maxDistance) + { + maxDistance = npcDistance; + possibleTarget = i; + } + } + } + + if (possibleTarget > 0) + { + //Main.NewText("new target acquired"); + projectile.ai[0] = possibleTarget; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Permafrost/Icicle.cs b/Projectiles/Permafrost/Icicle.cs index bfd2cce87b..76ff67ed9f 100644 --- a/Projectiles/Permafrost/Icicle.cs +++ b/Projectiles/Permafrost/Icicle.cs @@ -1,51 +1,51 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class Icicle : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.magic = true; - projectile.coldDamage = true; - projectile.penetrate = 1; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icicle"); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item27, projectile.position); - for (int index1 = 0; index1 < 5; ++index1) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 1.5f; - Main.dust[index2].scale *= 0.9f; - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class Icicle : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; + projectile.magic = true; + projectile.coldDamage = true; + projectile.penetrate = 1; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icicle"); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + for (int index1 = 0; index1 < 5; ++index1) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 1.5f; + Main.dust[index2].scale *= 0.9f; + } + } + } +} diff --git a/Projectiles/Permafrost/IcicleArrow.cs b/Projectiles/Permafrost/IcicleArrow.cs index ce5c44a878..803da5d1f4 100644 --- a/Projectiles/Permafrost/IcicleArrow.cs +++ b/Projectiles/Permafrost/IcicleArrow.cs @@ -1,66 +1,66 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class IcicleArrow : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.coldDamage = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icicle Arrow"); - } - - public override void AI() - { - //icicle dust - if (Main.rand.Next(2) == 0) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1.1f); - Main.dust[index2].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item27, projectile.position); - for (int index1 = 0; index1 < 5; ++index1) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 1.5f; - Main.dust[index2].scale *= 0.9f; - } - if (projectile.owner == Main.myPlayer) - { - for (int index = 0; index < 3; ++index) - { - float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - Projectile.NewProjectile(projectile.position.X + SpeedX, projectile.position.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); - } - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class IcicleArrow : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.coldDamage = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icicle Arrow"); + } + + public override void AI() + { + //icicle dust + if (Main.rand.Next(2) == 0) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1.1f); + Main.dust[index2].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + for (int index1 = 0; index1 < 5; ++index1) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 1.5f; + Main.dust[index2].scale *= 0.9f; + } + if (projectile.owner == Main.myPlayer) + { + for (int index = 0; index < 3; ++index) + { + float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + Projectile.NewProjectile(projectile.position.X + SpeedX, projectile.position.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); + } + } + } + } +} diff --git a/Projectiles/Permafrost/IcyBullet.cs b/Projectiles/Permafrost/IcyBullet.cs index bbcc9f072e..69bae50c29 100644 --- a/Projectiles/Permafrost/IcyBullet.cs +++ b/Projectiles/Permafrost/IcyBullet.cs @@ -1,73 +1,73 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class IcyBullet : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - projectile.timeLeft = 600; - projectile.friendly = true; - projectile.ranged = true; - projectile.coldDamage = true; - projectile.penetrate = 3; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icy Bullet"); - } - - public override void AI() - { - if (Main.rand.Next(3) == 0) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1f); - Main.dust[index2].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(mod.BuffType("GlacialState"), 120); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item27, projectile.position); - for (int index1 = 0; index1 < 5; ++index1) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, 0f, 0f, 0, new Color(), 0.9f); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 1.5f; - } - if (projectile.owner == Main.myPlayer) - { - for (int index = 0; index < 2; ++index) - { - float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - Projectile.NewProjectile(projectile.position.X + SpeedX, projectile.position.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); - } - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class IcyBullet : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.timeLeft = 600; + projectile.friendly = true; + projectile.ranged = true; + projectile.coldDamage = true; + projectile.penetrate = 3; + projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icy Bullet"); + } + + public override void AI() + { + if (Main.rand.Next(3) == 0) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1f); + Main.dust[index2].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + for (int index1 = 0; index1 < 5; ++index1) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, 0f, 0f, 0, new Color(), 0.9f); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 1.5f; + } + if (projectile.owner == Main.myPlayer) + { + for (int index = 0; index < 2; ++index) + { + float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + Projectile.NewProjectile(projectile.position.X + SpeedX, projectile.position.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); + } + } + } + } +} diff --git a/Projectiles/Permafrost/Snowball.cs b/Projectiles/Permafrost/Snowball.cs index e50787ebcf..b2d05c8efb 100644 --- a/Projectiles/Permafrost/Snowball.cs +++ b/Projectiles/Permafrost/Snowball.cs @@ -1,64 +1,64 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class Snowball : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.magic = true; - projectile.coldDamage = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Snowball"); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(mod.BuffType("GlacialState"), 180); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item27, projectile.position); - //crystal bullet shards - for (int index1 = 0; index1 < 10; ++index1) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 2f; - } - if (projectile.owner == Main.myPlayer) - { - for (int index = 0; index < 6; ++index) - { - float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - int p = Projectile.NewProjectile(projectile.position.X + SpeedX, projectile.position.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); - Main.projectile[p].ranged = false; - Main.projectile[p].magic = true; - } - } - //insert ice shattering dust here - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class Snowball : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.magic = true; + projectile.coldDamage = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snowball"); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(mod.BuffType("GlacialState"), 180); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + //crystal bullet shards + for (int index1 = 0; index1 < 10; ++index1) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, 0f, 0, new Color(), 1f); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 2f; + } + if (projectile.owner == Main.myPlayer) + { + for (int index = 0; index < 6; ++index) + { + float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + int p = Projectile.NewProjectile(projectile.position.X + SpeedX, projectile.position.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); + Main.projectile[p].ranged = false; + Main.projectile[p].magic = true; + } + } + //insert ice shattering dust here + } + } +} diff --git a/Projectiles/Permafrost/TridentIcicle.cs b/Projectiles/Permafrost/TridentIcicle.cs index 02fb6dcb5e..77d9d15e7f 100644 --- a/Projectiles/Permafrost/TridentIcicle.cs +++ b/Projectiles/Permafrost/TridentIcicle.cs @@ -1,59 +1,59 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Permafrost -{ - public class TridentIcicle : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - projectile.friendly = true; - projectile.coldDamage = true; - projectile.magic = true; - projectile.penetrate = 2; - projectile.ignoreWater = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Trident Icicle"); - } - - public override void AI() - { - //make pretty dust - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); - Main.dust[index2].noGravity = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 480); - target.AddBuff(mod.BuffType("GlacialState"), 180); - } - - public override Color? GetAlpha (Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item27, projectile.position); - for (int i = 0; i < 10; i++) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); - Main.dust[index2].noGravity = true; - Main.dust[index2].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Permafrost +{ + public class TridentIcicle : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.friendly = true; + projectile.coldDamage = true; + projectile.magic = true; + projectile.penetrate = 2; + projectile.ignoreWater = true; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trident Icicle"); + } + + public override void AI() + { + //make pretty dust + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); + Main.dust[index2].noGravity = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 480); + target.AddBuff(mod.BuffType("GlacialState"), 180); + } + + public override Color? GetAlpha (Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + for (int i = 0; i < 10; i++) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Pets/Bear.cs b/Projectiles/Pets/Bear.cs index 70acb01977..785ddd33c1 100644 --- a/Projectiles/Pets/Bear.cs +++ b/Projectiles/Pets/Bear.cs @@ -1,378 +1,378 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Pets -{ - 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() - { - 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; - } - - 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 += 0.20f; - - 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.10f; - - if (projectile.velocity.X > 7f) - { - projectile.velocity.X = 7f; - } - } - else - { - projectile.velocity.X -= 0.10f; - - 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 > 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 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) - { - 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 = 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) - { - projectile.velocity *= 0.90f; - } - 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.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 (projectile.velocity.X > 0.25f) - { - 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; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + 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() + { + 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; + } + + 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 += 0.20f; + + 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.10f; + + if (projectile.velocity.X > 7f) + { + projectile.velocity.X = 7f; + } + } + else + { + projectile.velocity.X -= 0.10f; + + 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 > 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 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) + { + 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 = 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) + { + projectile.velocity *= 0.90f; + } + 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.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 (projectile.velocity.X > 0.25f) + { + 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; + } + } +} diff --git a/Projectiles/Pets/Brimling.cs b/Projectiles/Pets/Brimling.cs index 254a4919f7..6a12c73e31 100644 --- a/Projectiles/Pets/Brimling.cs +++ b/Projectiles/Pets/Brimling.cs @@ -1,187 +1,187 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Pets -{ - public class Brimling : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimling"); - Main.projFrames[projectile.type] = 8; - Main.projPet[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 62; - 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.brimling = false; - } - if (modPlayer.brimling) - { - projectile.timeLeft = 4; - } - 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; - - //Limites de mouvement ici - - float num27 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); - if (num27 > 1000f) - { - projectile.position.X = projectile.position.X + num18; - projectile.position.Y = projectile.position.Y + num19; - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0, -1f, 0, default(Color), 1f); - } - } - - 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 < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.90f; - } - num16 = 0.01f; - } - else - { - if (num20 < 100f) - { - num16 = 0.1f; - } - if (num20 > 300f) - { - num16 = 1f; - } - num20 = num21 / num20; - num18 *= num20; - num19 *= num20; - } - - //Les changements de velocité ici - 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; - } - - //On gère le sprite et les frames ici - - Player projOwner = Main.player[projectile.owner]; - - projectile.spriteDirection = -projOwner.direction; - projectile.rotation = projectile.velocity.X * 0.03f; - - projectile.frameCounter++; - - if (projOwner.statLife >= projOwner.statLifeMax2 / 4) - { - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - return; - } - } - else - { - if (projectile.frameCounter > 5) - - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 4; - return; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class Brimling : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimling"); + Main.projFrames[projectile.type] = 8; + Main.projPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 62; + 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.brimling = false; + } + if (modPlayer.brimling) + { + projectile.timeLeft = 4; + } + 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; + + //Limites de mouvement ici + + float num27 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); + if (num27 > 1000f) + { + projectile.position.X = projectile.position.X + num18; + projectile.position.Y = projectile.position.Y + num19; + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0, -1f, 0, default(Color), 1f); + } + } + + 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 < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.90f; + } + num16 = 0.01f; + } + else + { + if (num20 < 100f) + { + num16 = 0.1f; + } + if (num20 > 300f) + { + num16 = 1f; + } + num20 = num21 / num20; + num18 *= num20; + num19 *= num20; + } + + //Les changements de velocité ici + 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; + } + + //On gère le sprite et les frames ici + + Player projOwner = Main.player[projectile.owner]; + + projectile.spriteDirection = -projOwner.direction; + projectile.rotation = projectile.velocity.X * 0.03f; + + projectile.frameCounter++; + + if (projOwner.statLife >= projOwner.statLifeMax2 / 4) + { + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + return; + } + } + else + { + if (projectile.frameCounter > 5) + + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 4; + return; + } + } + } + } +} diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index d33637840b..477abcffa4 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -1,59 +1,59 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.GameContent; -using Terraria.ModLoader; -using Terraria.Localization; - -namespace CalamityMod.Projectiles.Pets -{ - public class ChibiiDoggo : ModProjectile - { - public int trueType; - public bool previousCollide = false; - public bool yFlip = false; //used to suppress y velocity (pet fastfalls with an extra update per tick otherwise) - public float notlocalai1 = 0f; - //used for companion cube AI section; using the actual projectile.ai[1] seems to conflict with black cat AI and cause pet to freeze up sometimes - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chibii Devourer"); - Main.projFrames[projectile.type] = 11; //same as black cat - Main.projPet[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 38; - projectile.height = 46; - projectile.aiStyle = 26; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.scale = 0.8f; - - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - - trueType = projectile.type; - - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - } - - public override bool PreDraw (SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ModLoader; +using Terraria.Localization; + +namespace CalamityMod.Projectiles.Pets +{ + public class ChibiiDoggo : ModProjectile + { + public int trueType; + public bool previousCollide = false; + public bool yFlip = false; //used to suppress y velocity (pet fastfalls with an extra update per tick otherwise) + public float notlocalai1 = 0f; + //used for companion cube AI section; using the actual projectile.ai[1] seems to conflict with black cat AI and cause pet to freeze up sometimes + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chibii Devourer"); + Main.projFrames[projectile.type] = 11; //same as black cat + Main.projPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 38; + projectile.height = 46; + projectile.aiStyle = 26; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.scale = 0.8f; + + projectile.ignoreWater = true; + projectile.extraUpdates = 1; + + trueType = projectile.type; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } + + public override bool PreDraw (SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); - Texture2D texture2D3 = mod.GetTexture("Projectiles/Pets/ChibiiDoggoMonochrome"); + spriteEffects = SpriteEffects.FlipHorizontally; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); + Texture2D texture2D3 = mod.GetTexture("Projectiles/Pets/ChibiiDoggoMonochrome"); int num156 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y3 = num156 * projectile.frame; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); @@ -84,166 +84,166 @@ namespace CalamityMod.Projectiles.Pets SpriteEffects effects = spriteEffects; 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; - } - - public override bool PreAI() - { - projectile.type = 319; //tricks AI 26 into thinking this is a black cat, makes it act like black cat - Player player = Main.player[projectile.owner]; - player.blackCat = false; //ensure doesnt interact weird with actual black cat - return true; - } - - //negates effect of y velocity every other tick - //pet updates twice per second, so this effectively gives it normal gravity despite otherwise doubled speed - //has full y speed when jumping up and when tile-intangible (i.e. chasing player when they move out of range) - public void PreventFastfall() - { - yFlip = !yFlip; - - if (yFlip && projectile.velocity.Y > 0) - projectile.position.Y -= projectile.velocity.Y; - } - - public void SpawnDoggo() - { - Player player = Main.player[projectile.owner]; - string doggoType = "DevourerofGodsHead"; - - if (player.name == "Terry") - { - doggoType += "S"; - Main.NewText("It's not over yet, kid!", Color.Cyan); - } - else - { - doggoType += "2"; - Main.NewText("Don't get cocky, kid!", Color.Cyan); - } - - int type = mod.NPCType(doggoType); - - int n = NPC.NewNPC((int)projectile.position.X, (int)projectile.position.Y, type); - NetMessage.SendData(23, -1, -1, (NetworkText) null, n, 0.0f, 0.0f, 0.0f, 0, 0, 0); - Main.npc[n].netUpdate = true; - } - - public override void AI() - { - projectile.type = trueType; //asserts real type after running black Cat AI 26 (ensures chibii pet isnt drawn as black cat and other weird stuff) - - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (player.dead) - { - modPlayer.chibii = false; - } - if (modPlayer.chibii) - { - projectile.timeLeft = 2; - } - //creates dust whenever switching between flying and grounded like when player spawns/despawns mount - if (previousCollide != projectile.tileCollide) - { - previousCollide = projectile.tileCollide; - - for (int i = 0; i < 10; i++) //resets oldpos so trail doesn't "snap" to chibii from previous position after unhiding - projectile.oldPos[i] = projectile.position; - - for (int i = 0; i < 77; i++) //loop to make lots of dust - { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 182, projectile.velocity.X * 0.7f, projectile.velocity.Y * 0.7f, 100, default(Color), 2.5f); - - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.5f; - Main.dust[dust].noLight = true; - - int rng = Main.rand.Next(3); - - if (rng == 0) - { - Main.dust[dust].velocity *= 1.5f; - Main.dust[dust].scale *= 0.7f; - } - else if (rng == 1) - { - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].scale *= 0.9f; - } - } - } - - if (projectile.tileCollide) - { - projectile.hide = false; - - //if (projectile.extraUpdates == 1) - PreventFastfall(); - - /*Vector2 distance = Main.player[projectile.owner].Center - projectile.Center; - if (distance.Length() < 100) - projectile.extraUpdates = 0; - else - projectile.extraUpdates = 1;*/ - } - else - { - projectile.hide = true; - //projectile.extraUpdates = 1; - - if (player.ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")] <= 0) - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0f, 0f, mod.ProjectileType("ChibiiDoggoFly"), 0, 0f, projectile.owner, (float) projectile.identity); - } - - //companion cube lighting check and stab - Color color; - color = Lighting.GetColor((int) projectile.Center.X / 16, (int) projectile.Center.Y / 16); - Vector3 vector3_1 = color.ToVector3(); - color = Lighting.GetColor((int) player.Center.X / 16, (int) player.Center.Y / 16); - Vector3 vector3_2 = color.ToVector3(); - - if ((double)vector3_1.Length() < 0.150000005960464 && (double)vector3_2.Length() < 0.150000005960464) - { - notlocalai1 += 1; - } - else if ((double) notlocalai1 > 0.0) - { - notlocalai1 -= 1; - } - - notlocalai1 = MathHelper.Clamp(notlocalai1, -3600f, 120f); - - if ((double) notlocalai1 > (double) Main.rand.Next(30, 120) && !player.immune && player.velocity.X == 0 && player.velocity.Y == 0) - { - if (Main.rand.Next(3) == 0) - { - if (Main.rand.Next(2) == 0) - { - int style = 5 + Main.rand.Next(5); - Main.PlaySound(SoundID.Meowmere, (int) projectile.position.X, (int) projectile.position.Y, style, 4f, 0.0f); //nya - } - else - { - Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 2, 2f); //REEEEEEE - } - notlocalai1 = -600f; - } - else - { - notlocalai1 = (float) (Main.rand.Next(30) * -10 - 300); - Main.PlaySound(SoundID.Item1, projectile.Center); - player.Hurt(PlayerDeathReason.ByOther(6), 500, 0, false, false, false, -1); - player.immune = false; - player.immuneTime = 0; - - if (Main.netMode != 1) - SpawnDoggo(); - } - projectile.netUpdate = true; - } - } - } -} + } + 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; + } + + public override bool PreAI() + { + projectile.type = 319; //tricks AI 26 into thinking this is a black cat, makes it act like black cat + Player player = Main.player[projectile.owner]; + player.blackCat = false; //ensure doesnt interact weird with actual black cat + return true; + } + + //negates effect of y velocity every other tick + //pet updates twice per second, so this effectively gives it normal gravity despite otherwise doubled speed + //has full y speed when jumping up and when tile-intangible (i.e. chasing player when they move out of range) + public void PreventFastfall() + { + yFlip = !yFlip; + + if (yFlip && projectile.velocity.Y > 0) + projectile.position.Y -= projectile.velocity.Y; + } + + public void SpawnDoggo() + { + Player player = Main.player[projectile.owner]; + string doggoType = "DevourerofGodsHead"; + + if (player.name == "Terry") + { + doggoType += "S"; + Main.NewText("It's not over yet, kid!", Color.Cyan); + } + else + { + doggoType += "2"; + Main.NewText("Don't get cocky, kid!", Color.Cyan); + } + + int type = mod.NPCType(doggoType); + + int n = NPC.NewNPC((int)projectile.position.X, (int)projectile.position.Y, type); + NetMessage.SendData(23, -1, -1, (NetworkText) null, n, 0.0f, 0.0f, 0.0f, 0, 0, 0); + Main.npc[n].netUpdate = true; + } + + public override void AI() + { + projectile.type = trueType; //asserts real type after running black Cat AI 26 (ensures chibii pet isnt drawn as black cat and other weird stuff) + + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.dead) + { + modPlayer.chibii = false; + } + if (modPlayer.chibii) + { + projectile.timeLeft = 2; + } + //creates dust whenever switching between flying and grounded like when player spawns/despawns mount + if (previousCollide != projectile.tileCollide) + { + previousCollide = projectile.tileCollide; + + for (int i = 0; i < 10; i++) //resets oldpos so trail doesn't "snap" to chibii from previous position after unhiding + projectile.oldPos[i] = projectile.position; + + for (int i = 0; i < 77; i++) //loop to make lots of dust + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 182, projectile.velocity.X * 0.7f, projectile.velocity.Y * 0.7f, 100, default(Color), 2.5f); + + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.5f; + Main.dust[dust].noLight = true; + + int rng = Main.rand.Next(3); + + if (rng == 0) + { + Main.dust[dust].velocity *= 1.5f; + Main.dust[dust].scale *= 0.7f; + } + else if (rng == 1) + { + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].scale *= 0.9f; + } + } + } + + if (projectile.tileCollide) + { + projectile.hide = false; + + //if (projectile.extraUpdates == 1) + PreventFastfall(); + + /*Vector2 distance = Main.player[projectile.owner].Center - projectile.Center; + if (distance.Length() < 100) + projectile.extraUpdates = 0; + else + projectile.extraUpdates = 1;*/ + } + else + { + projectile.hide = true; + //projectile.extraUpdates = 1; + + if (player.ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")] <= 0) + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0f, 0f, mod.ProjectileType("ChibiiDoggoFly"), 0, 0f, projectile.owner, (float) projectile.identity); + } + + //companion cube lighting check and stab + Color color; + color = Lighting.GetColor((int) projectile.Center.X / 16, (int) projectile.Center.Y / 16); + Vector3 vector3_1 = color.ToVector3(); + color = Lighting.GetColor((int) player.Center.X / 16, (int) player.Center.Y / 16); + Vector3 vector3_2 = color.ToVector3(); + + if ((double)vector3_1.Length() < 0.150000005960464 && (double)vector3_2.Length() < 0.150000005960464) + { + notlocalai1 += 1; + } + else if ((double) notlocalai1 > 0.0) + { + notlocalai1 -= 1; + } + + notlocalai1 = MathHelper.Clamp(notlocalai1, -3600f, 120f); + + if ((double) notlocalai1 > (double) Main.rand.Next(30, 120) && !player.immune && player.velocity.X == 0 && player.velocity.Y == 0) + { + if (Main.rand.Next(3) == 0) + { + if (Main.rand.Next(2) == 0) + { + int style = 5 + Main.rand.Next(5); + Main.PlaySound(SoundID.Meowmere, (int) projectile.position.X, (int) projectile.position.Y, style, 4f, 0.0f); //nya + } + else + { + Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 2, 2f); //REEEEEEE + } + notlocalai1 = -600f; + } + else + { + notlocalai1 = (float) (Main.rand.Next(30) * -10 - 300); + Main.PlaySound(SoundID.Item1, projectile.Center); + player.Hurt(PlayerDeathReason.ByOther(6), 500, 0, false, false, false, -1); + player.immune = false; + player.immuneTime = 0; + + if (Main.netMode != 1) + SpawnDoggo(); + } + projectile.netUpdate = true; + } + } + } +} diff --git a/Projectiles/Pets/ChibiiDoggoFly.cs b/Projectiles/Pets/ChibiiDoggoFly.cs index f808cf5850..02e033b141 100644 --- a/Projectiles/Pets/ChibiiDoggoFly.cs +++ b/Projectiles/Pets/ChibiiDoggoFly.cs @@ -1,47 +1,47 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.GameContent; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Pets -{ - public class ChibiiDoggoFly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chibii Devourer (Flying)"); - Main.projPet[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 24; - projectile.height = 46; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.scale = 0.8f; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.extraUpdates = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - } - - public override bool PreDraw (SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class ChibiiDoggoFly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chibii Devourer (Flying)"); + Main.projPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 24; + projectile.height = 46; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.scale = 0.8f; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.extraUpdates = 1; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } + + public override bool PreDraw (SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); - Texture2D texture2D3 = mod.GetTexture("Projectiles/Pets/ChibiiDoggoFlyMonochrome"); + spriteEffects = SpriteEffects.FlipHorizontally; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); + Texture2D texture2D3 = mod.GetTexture("Projectiles/Pets/ChibiiDoggoFlyMonochrome"); int num156 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y3 = num156 * projectile.frame; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); @@ -71,47 +71,47 @@ namespace CalamityMod.Projectiles.Pets SpriteEffects effects = spriteEffects; 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; - } - - public override bool PreAI() - { - //parent projectile might spawn more than one ChibiiDoggoFly sometimes - if (Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")] > 1) - { - projectile.hide = true; - projectile.Kill(); - Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")]--; - return false; - } - - return true; - } - - public override void AI() - { - if (Main.player[projectile.owner].GetModPlayer(mod).chibii) - projectile.timeLeft = 2; - - int byUuid = (int) projectile.ai[0]; //contains identity of parent projectile in main.projectile array - - //basically slaved to parent's position - //this projectile only exists because i fucking hate that tile collision desync i got when using full-sized flying sprites in ChibiiDoggo - if (Main.projectile[byUuid].active && Main.projectile[byUuid].type == mod.ProjectileType("ChibiiDoggo")) - { - //projectile.position.X = Main.projectile[byUuid].position.X - 22; - //projectile.position.Y = Main.projectile[byUuid].position.Y; - projectile.Center = Main.projectile[byUuid].Center; - projectile.rotation = Main.projectile[byUuid].rotation; - projectile.spriteDirection = Main.projectile[byUuid].spriteDirection; - - if(Main.projectile[byUuid].tileCollide) - projectile.hide = true; - else - projectile.hide = false; - } - } - } -} + } + 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; + } + + public override bool PreAI() + { + //parent projectile might spawn more than one ChibiiDoggoFly sometimes + if (Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")] > 1) + { + projectile.hide = true; + projectile.Kill(); + Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ChibiiDoggoFly")]--; + return false; + } + + return true; + } + + public override void AI() + { + if (Main.player[projectile.owner].GetModPlayer(mod).chibii) + projectile.timeLeft = 2; + + int byUuid = (int) projectile.ai[0]; //contains identity of parent projectile in main.projectile array + + //basically slaved to parent's position + //this projectile only exists because i fucking hate that tile collision desync i got when using full-sized flying sprites in ChibiiDoggo + if (Main.projectile[byUuid].active && Main.projectile[byUuid].type == mod.ProjectileType("ChibiiDoggo")) + { + //projectile.position.X = Main.projectile[byUuid].position.X - 22; + //projectile.position.Y = Main.projectile[byUuid].position.Y; + projectile.Center = Main.projectile[byUuid].Center; + projectile.rotation = Main.projectile[byUuid].rotation; + projectile.spriteDirection = Main.projectile[byUuid].spriteDirection; + + if(Main.projectile[byUuid].tileCollide) + projectile.hide = true; + else + projectile.hide = false; + } + } + } +} diff --git a/Projectiles/Pets/DannyDevito.cs b/Projectiles/Pets/DannyDevito.cs index 1d7aad8c0e..af0acdcf3e 100644 --- a/Projectiles/Pets/DannyDevito.cs +++ b/Projectiles/Pets/DannyDevito.cs @@ -1,324 +1,324 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.GameInput; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Pets -{ - public class DannyDevito : ModProjectile - { - private int chosenIdle = 0; - private int idleTimer = 0; - private int playerStill = 0; - private bool fly = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Danny Devito"); - Main.projFrames[projectile.type] = 8; - Main.projPet[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 42; - projectile.height = 42; - 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.trashMan = false; - } - if (modPlayer.trashMan) - { - 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 == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) - { - projectile.velocity.Y = -5f; - } - projectile.velocity.Y += 0.20f; - 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.10f; - if (projectile.velocity.X > 7f) - { - projectile.velocity.X = 7f; - } - } - else - { - projectile.velocity.X -= 0.10f; - 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.frame = 0; - } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) - { - projectile.frame = 1; - projectile.frameCounter = 0; - } - else - { - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 6) - { - projectile.frame = 2; - } - if (projectile.frame < 2) - { - projectile.frame = 2; - } - } - } - 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 = 18f; - float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - if (playerDistance > 1200f) - { - 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.90f; - } - 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.03f; - projectile.frame = 7; - } - if (projectile.velocity.X > 0.25f) - { - projectile.spriteDirection = -1; - } - else if (projectile.velocity.X < -0.25f) - { - projectile.spriteDirection = 1; - } - } - - /*public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (!Main.gamePaused || Main.gameMenu) - { - Vector2 vector69 = projectile.position - Main.screenPosition; - if ((float)Main.mouseX > vector69.X && (float)Main.mouseX < vector69.X + (float)projectile.width && (float)Main.mouseY > vector69.Y && (float)Main.mouseY < vector69.Y + (float)projectile.height) - { - int num345 = (int)(Main.player[projectile.owner].Center.X / 16f); - int num346 = (int)(Main.player[projectile.owner].Center.Y / 16f); - int num347 = (int)projectile.Center.X / 16; - int num348 = (int)projectile.Center.Y / 16; - int lastTileRangeX = Main.player[projectile.owner].lastTileRangeX; - int lastTileRangeY = Main.player[projectile.owner].lastTileRangeY; - if (num345 >= num347 - lastTileRangeX && num345 <= num347 + lastTileRangeX + 1 && num346 >= num348 - lastTileRangeY && num346 <= num348 + lastTileRangeY + 1) - { - Main.player[projectile.owner].noThrow = 2; - Main.player[projectile.owner].showItemIcon = true; - Main.player[projectile.owner].showItemIcon2 = 3213; - if (PlayerInput.UsingGamepad) - { - Main.player[projectile.owner].GamepadEnableGrappleCooldown(); - } - if (Main.mouseRight && Main.mouseRightRelease && Player.StopMoneyTroughFromWorking == 0) - { - Main.mouseRightRelease = false; - if (Main.player[projectile.owner].chest == -2) - { - Main.PlaySound(SoundID.Item11, -1, -1); - Main.player[projectile.owner].chest = -1; - Recipe.FindRecipes(); - return; - } - Main.player[projectile.owner].GetModPlayer(mod).trashManChest = projectile.type; - Main.player[projectile.owner].chest = -2; - Main.player[projectile.owner].chestX = (int)(projectile.Center.X / 16f); - Main.player[projectile.owner].chestY = (int)(projectile.Center.Y / 16f); - Main.player[projectile.owner].talkNPC = -1; - Main.npcShop = 0; - Main.playerInventory = true; - Main.PlaySound(SoundID.Item10, -1, -1); - Recipe.FindRecipes(); - } - } - } - } - }*/ - - 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; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.GameInput; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class DannyDevito : ModProjectile + { + private int chosenIdle = 0; + private int idleTimer = 0; + private int playerStill = 0; + private bool fly = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Danny Devito"); + Main.projFrames[projectile.type] = 8; + Main.projPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 42; + projectile.height = 42; + 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.trashMan = false; + } + if (modPlayer.trashMan) + { + 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 == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + { + projectile.velocity.Y = -5f; + } + projectile.velocity.Y += 0.20f; + 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.10f; + if (projectile.velocity.X > 7f) + { + projectile.velocity.X = 7f; + } + } + else + { + projectile.velocity.X -= 0.10f; + 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.frame = 0; + } + else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + { + projectile.frame = 1; + projectile.frameCounter = 0; + } + else + { + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 6) + { + projectile.frame = 2; + } + if (projectile.frame < 2) + { + projectile.frame = 2; + } + } + } + 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 = 18f; + float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + if (playerDistance > 1200f) + { + 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.90f; + } + 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.03f; + projectile.frame = 7; + } + if (projectile.velocity.X > 0.25f) + { + projectile.spriteDirection = -1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.spriteDirection = 1; + } + } + + /*public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (!Main.gamePaused || Main.gameMenu) + { + Vector2 vector69 = projectile.position - Main.screenPosition; + if ((float)Main.mouseX > vector69.X && (float)Main.mouseX < vector69.X + (float)projectile.width && (float)Main.mouseY > vector69.Y && (float)Main.mouseY < vector69.Y + (float)projectile.height) + { + int num345 = (int)(Main.player[projectile.owner].Center.X / 16f); + int num346 = (int)(Main.player[projectile.owner].Center.Y / 16f); + int num347 = (int)projectile.Center.X / 16; + int num348 = (int)projectile.Center.Y / 16; + int lastTileRangeX = Main.player[projectile.owner].lastTileRangeX; + int lastTileRangeY = Main.player[projectile.owner].lastTileRangeY; + if (num345 >= num347 - lastTileRangeX && num345 <= num347 + lastTileRangeX + 1 && num346 >= num348 - lastTileRangeY && num346 <= num348 + lastTileRangeY + 1) + { + Main.player[projectile.owner].noThrow = 2; + Main.player[projectile.owner].showItemIcon = true; + Main.player[projectile.owner].showItemIcon2 = 3213; + if (PlayerInput.UsingGamepad) + { + Main.player[projectile.owner].GamepadEnableGrappleCooldown(); + } + if (Main.mouseRight && Main.mouseRightRelease && Player.StopMoneyTroughFromWorking == 0) + { + Main.mouseRightRelease = false; + if (Main.player[projectile.owner].chest == -2) + { + Main.PlaySound(SoundID.Item11, -1, -1); + Main.player[projectile.owner].chest = -1; + Recipe.FindRecipes(); + return; + } + Main.player[projectile.owner].GetModPlayer(mod).trashManChest = projectile.type; + Main.player[projectile.owner].chest = -2; + Main.player[projectile.owner].chestX = (int)(projectile.Center.X / 16f); + Main.player[projectile.owner].chestY = (int)(projectile.Center.Y / 16f); + Main.player[projectile.owner].talkNPC = -1; + Main.npcShop = 0; + Main.playerInventory = true; + Main.PlaySound(SoundID.Item10, -1, -1); + Recipe.FindRecipes(); + } + } + } + } + }*/ + + 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; + } + } +} diff --git a/Projectiles/Pets/Fox.cs b/Projectiles/Pets/Fox.cs index deb21b7b53..dbfadda947 100644 --- a/Projectiles/Pets/Fox.cs +++ b/Projectiles/Pets/Fox.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Pets -{ - public class Fox : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fox"); - Main.projFrames[projectile.type] = 11; - Main.projPet[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 24; - projectile.height = 32; - projectile.friendly = true; - projectile.aiStyle = 26; - aiType = 334; - 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.fox = false; - } - if (modPlayer.fox) - { - projectile.timeLeft = 2; - } - projectile.spriteDirection = projectile.direction; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class Fox : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fox"); + Main.projFrames[projectile.type] = 11; + Main.projPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 24; + projectile.height = 32; + projectile.friendly = true; + projectile.aiStyle = 26; + aiType = 334; + 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.fox = false; + } + if (modPlayer.fox) + { + projectile.timeLeft = 2; + } + projectile.spriteDirection = projectile.direction; + } + } +} diff --git a/Projectiles/Pets/Kendra.cs b/Projectiles/Pets/Kendra.cs index 26f05c1eeb..f8e3ce471a 100644 --- a/Projectiles/Pets/Kendra.cs +++ b/Projectiles/Pets/Kendra.cs @@ -379,4 +379,4 @@ namespace CalamityMod.Projectiles.Pets return true; } } -} \ No newline at end of file +} diff --git a/Projectiles/Pets/Levi.cs b/Projectiles/Pets/Levi.cs index 675db1e8c5..8e930724fe 100644 --- a/Projectiles/Pets/Levi.cs +++ b/Projectiles/Pets/Levi.cs @@ -1,150 +1,150 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Pets -{ - public class Levi : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Levi"); - Main.projFrames[projectile.type] = 5; - Main.projPet[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; - } - - 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.leviPet = false; - } - if (modPlayer.leviPet) - { - 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.05f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class Levi : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Levi"); + Main.projFrames[projectile.type] = 5; + Main.projPet[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; + } + + 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.leviPet = false; + } + if (modPlayer.leviPet) + { + 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.05f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Pets/SirenYoung.cs b/Projectiles/Pets/SirenYoung.cs index 33a7891ed6..054a7d1ffa 100644 --- a/Projectiles/Pets/SirenYoung.cs +++ b/Projectiles/Pets/SirenYoung.cs @@ -1,491 +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 - { - 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; - } - - 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) || modPlayer.leviathanAndSirenLore; - 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 +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 + { + 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; + } + + 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) || modPlayer.leviathanAndSirenLore; + 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; + } + } +} diff --git a/Projectiles/Ranged/AMR.cs b/Projectiles/Ranged/AMR.cs index e0b8771c05..a360cb918a 100644 --- a/Projectiles/Ranged/AMR.cs +++ b/Projectiles/Ranged/AMR.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class AMR : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("AMR"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (crit) - { - for (int x = 0; x < 8; x++) - { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AMR2"), (int)((double)projectile.damage * 0.1), 1f, projectile.owner); - } - } - } - target.AddBuff(mod.BuffType("MarkedforDeath"), 600); - if (target.defense > 50) - { - target.defense -= 50; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class AMR : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("AMR"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 10; + projectile.scale = 1.18f; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + for (int x = 0; x < 8; x++) + { + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AMR2"), (int)((double)projectile.damage * 0.1), 1f, projectile.owner); + } + } + } + target.AddBuff(mod.BuffType("MarkedforDeath"), 600); + if (target.defense > 50) + { + target.defense -= 50; + } + } + } +} diff --git a/Projectiles/Ranged/AMR2.cs b/Projectiles/Ranged/AMR2.cs index a22ed0e6fd..c598b885d6 100644 --- a/Projectiles/Ranged/AMR2.cs +++ b/Projectiles/Ranged/AMR2.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class AMR2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("AMR"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 5; - projectile.scale = 1.18f; - projectile.tileCollide = false; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class AMR2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("AMR"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 5; + projectile.scale = 1.18f; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + } +} diff --git a/Projectiles/Ranged/AccelerationBullet.cs b/Projectiles/Ranged/AccelerationBullet.cs index b8fadc534d..f50d23c560 100644 --- a/Projectiles/Ranged/AccelerationBullet.cs +++ b/Projectiles/Ranged/AccelerationBullet.cs @@ -1,73 +1,73 @@ -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 AccelerationBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acceleration Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - projectile.velocity *= 1.01f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 91, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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 AccelerationBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acceleration Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + projectile.velocity *= 1.01f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { + for (int num136 = 0; num136 < 10; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 91, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Ranged/AcidBullet.cs b/Projectiles/Ranged/AcidBullet.cs index 15932eb288..b67b6cc732 100644 --- a/Projectiles/Ranged/AcidBullet.cs +++ b/Projectiles/Ranged/AcidBullet.cs @@ -1,77 +1,77 @@ -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 AcidBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 4f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 360); - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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 AcidBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 4f) + { + for (int num136 = 0; num136 < 10; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 360); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Ranged/AquaBlast.cs b/Projectiles/Ranged/AquaBlast.cs index 69173819a9..3d5eab3178 100644 --- a/Projectiles/Ranged/AquaBlast.cs +++ b/Projectiles/Ranged/AquaBlast.cs @@ -1,48 +1,48 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class AquaBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aqua Blast"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - for (int lol = 0; lol < 10; lol++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class AquaBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aqua Blast"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ranged = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + for (int lol = 0; lol < 10; lol++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 1f); + } + } + } +} diff --git a/Projectiles/Ranged/AquaBlastToxic.cs b/Projectiles/Ranged/AquaBlastToxic.cs index 7fd2cd4307..e7843a3290 100644 --- a/Projectiles/Ranged/AquaBlastToxic.cs +++ b/Projectiles/Ranged/AquaBlastToxic.cs @@ -1,54 +1,54 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class AquaBlastToxic : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aqua Blast Toxic"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f); - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default(Color), 1f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - for (int lol = 0; lol < 10; lol++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default(Color), 1f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Poisoned, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class AquaBlastToxic : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aqua Blast Toxic"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ranged = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f); + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default(Color), 1f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + for (int lol = 0; lol < 10; lol++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default(Color), 1f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Poisoned, 300); + } + } +} diff --git a/Projectiles/Ranged/Archerfish.cs b/Projectiles/Ranged/Archerfish.cs index b5f385fc23..cba2b3e12d 100644 --- a/Projectiles/Ranged/Archerfish.cs +++ b/Projectiles/Ranged/Archerfish.cs @@ -1,140 +1,140 @@ -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 Archerfish : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water Round"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.extraUpdates = 2; - } - - public override void AI() - { - if (projectile.localAI[0] < 5f) - { - projectile.localAI[0] += 1f; - return; - } - int num3; - for (int num586 = 0; num586 < 1; num586 = num3 + 1) - { - for (int num587 = 0; num587 < 6; num587 = num3 + 1) - { - float num588 = projectile.velocity.X / 6f * (float)num587; - float num589 = projectile.velocity.Y / 6f * (float)num587; - int num590 = 6; - int num591 = Dust.NewDust(new Vector2(projectile.position.X + (float)num590, projectile.position.Y + (float)num590), projectile.width - num590 * 2, projectile.height - num590 * 2, 211, 0f, 0f, 75, default(Color), 1.2f); - Dust dust; - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - Main.dust[num591].noGravity = true; - dust = Main.dust[num591]; - dust.velocity *= 0.3f; - dust = Main.dust[num591]; - dust.velocity += projectile.velocity * 0.5f; - Main.dust[num591].position = projectile.Center; - Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591]; - var_2_18F52_cp_0_cp_0.position.X = var_2_18F52_cp_0_cp_0.position.X - num588; - Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591]; - var_2_18F74_cp_0_cp_0.position.Y = var_2_18F74_cp_0_cp_0.position.Y - num589; - dust = Main.dust[num591]; - dust.velocity *= 0.2f; - num3 = num587; - } - if (Main.rand.Next(4) == 0) - { - int num592 = 6; - int num593 = Dust.NewDust(new Vector2(projectile.position.X + (float)num592, projectile.position.Y + (float)num592), projectile.width - num592 * 2, projectile.height - num592 * 2, 211, 0f, 0f, 75, default(Color), 0.65f); - Dust dust = Main.dust[num593]; - dust.velocity *= 0.5f; - dust = Main.dust[num593]; - dust.velocity += projectile.velocity * 0.5f; - } - num3 = num586; - } - } - - public override void Kill(int timeLeft) - { - projectile.velocity = projectile.oldVelocity * 0.2f; - int num3; - for (int num362 = 0; num362 < 100; num362 = num3 + 1) - { - int num363 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 211, 0f, 0f, 75, default(Color), 1.2f); - Dust dust; - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - Main.dust[num363].scale = 0.6f; - } - else - { - Main.dust[num363].noGravity = true; - } - dust = Main.dust[num363]; - dust.velocity *= 0.3f; - dust = Main.dust[num363]; - dust.velocity += projectile.velocity; - dust = Main.dust[num363]; - dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; - Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363]; - expr_C6F7_cp_0_cp_0.velocity.X = expr_C6F7_cp_0_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.015f; - Dust expr_C726_cp_0_cp_0 = Main.dust[num363]; - expr_C726_cp_0_cp_0.velocity.Y = expr_C726_cp_0_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.015f; - Main.dust[num363].position = projectile.Center; - num3 = num362; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Wet, 240); - } - } -} \ No newline at end of file +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 Archerfish : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water Round"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.penetrate = 2; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.extraUpdates = 2; + } + + public override void AI() + { + if (projectile.localAI[0] < 5f) + { + projectile.localAI[0] += 1f; + return; + } + int num3; + for (int num586 = 0; num586 < 1; num586 = num3 + 1) + { + for (int num587 = 0; num587 < 6; num587 = num3 + 1) + { + float num588 = projectile.velocity.X / 6f * (float)num587; + float num589 = projectile.velocity.Y / 6f * (float)num587; + int num590 = 6; + int num591 = Dust.NewDust(new Vector2(projectile.position.X + (float)num590, projectile.position.Y + (float)num590), projectile.width - num590 * 2, projectile.height - num590 * 2, 211, 0f, 0f, 75, default(Color), 1.2f); + Dust dust; + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num591]; + dust.alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num591]; + dust.alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num591]; + dust.alpha += 25; + } + Main.dust[num591].noGravity = true; + dust = Main.dust[num591]; + dust.velocity *= 0.3f; + dust = Main.dust[num591]; + dust.velocity += projectile.velocity * 0.5f; + Main.dust[num591].position = projectile.Center; + Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591]; + var_2_18F52_cp_0_cp_0.position.X = var_2_18F52_cp_0_cp_0.position.X - num588; + Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591]; + var_2_18F74_cp_0_cp_0.position.Y = var_2_18F74_cp_0_cp_0.position.Y - num589; + dust = Main.dust[num591]; + dust.velocity *= 0.2f; + num3 = num587; + } + if (Main.rand.Next(4) == 0) + { + int num592 = 6; + int num593 = Dust.NewDust(new Vector2(projectile.position.X + (float)num592, projectile.position.Y + (float)num592), projectile.width - num592 * 2, projectile.height - num592 * 2, 211, 0f, 0f, 75, default(Color), 0.65f); + Dust dust = Main.dust[num593]; + dust.velocity *= 0.5f; + dust = Main.dust[num593]; + dust.velocity += projectile.velocity * 0.5f; + } + num3 = num586; + } + } + + public override void Kill(int timeLeft) + { + projectile.velocity = projectile.oldVelocity * 0.2f; + int num3; + for (int num362 = 0; num362 < 100; num362 = num3 + 1) + { + int num363 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 211, 0f, 0f, 75, default(Color), 1.2f); + Dust dust; + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num363]; + dust.alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num363]; + dust.alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num363]; + dust.alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + Main.dust[num363].scale = 0.6f; + } + else + { + Main.dust[num363].noGravity = true; + } + dust = Main.dust[num363]; + dust.velocity *= 0.3f; + dust = Main.dust[num363]; + dust.velocity += projectile.velocity; + dust = Main.dust[num363]; + dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; + Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363]; + expr_C6F7_cp_0_cp_0.velocity.X = expr_C6F7_cp_0_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.015f; + Dust expr_C726_cp_0_cp_0 = Main.dust[num363]; + expr_C726_cp_0_cp_0.velocity.Y = expr_C726_cp_0_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.015f; + Main.dust[num363].position = projectile.Center; + num3 = num362; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Wet, 240); + } + } +} diff --git a/Projectiles/Ranged/ArcticArrow.cs b/Projectiles/Ranged/ArcticArrow.cs index 1eb16be534..70d95082df 100644 --- a/Projectiles/Ranged/ArcticArrow.cs +++ b/Projectiles/Ranged/ArcticArrow.cs @@ -1,64 +1,64 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ArcticArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arctic Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - 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; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 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; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GlacialState"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ArcticArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arctic Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + 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; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 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; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GlacialState"), 180); + } + } +} diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index 7c4a05fa23..8f5d454a66 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -1,150 +1,150 @@ -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 AstralRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Round"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 0.25f; - projectile.extraUpdates = 1; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - aiType = ProjectileID.Bullet; - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override bool PreAI() - { - for (int num136 = 0; num136 < 6; num136++) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = mod.DustType("AstralOrange"); - } - else - { - randomDust = mod.DustType("AstralBlue"); - } - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, randomDust, 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 200f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 240); - } - } -} \ No newline at end of file +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 AstralRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Round"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.light = 0.25f; + projectile.extraUpdates = 1; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + aiType = ProjectileID.Bullet; + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override bool PreAI() + { + for (int num136 = 0; num136 < 6; num136++) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = mod.DustType("AstralOrange"); + } + else + { + randomDust = mod.DustType("AstralBlue"); + } + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, randomDust, 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + float num140 = projectile.position.X; + float num141 = projectile.position.Y; + float num142 = 200f; + bool flag4 = false; + int num143 = 0; + if (projectile.ai[1] == 0f) + { + for (int num144 = 0; num144 < 200; num144++) + { + if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) + { + float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); + float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); + float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); + if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) + { + num142 = num147; + num140 = num145; + num141 = num146; + flag4 = true; + num143 = num144; + } + } + } + if (flag4) + { + projectile.ai[1] = (float)(num143 + 1); + } + flag4 = false; + } + if (projectile.ai[1] > 0f) + { + int num148 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) + { + float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); + if (num151 < 1000f) + { + flag4 = true; + num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + } + } + else + { + projectile.ai[1] = 0f; + } + } + if (!projectile.friendly) + { + flag4 = false; + } + if (flag4) + { + float num152 = num139; + Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num153 = num140 - vector13.X; + float num154 = num141 - vector13.Y; + float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); + num155 = num152 / num155; + num153 *= num155; + num154 *= num155; + int num156 = 12; + projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 240); + } + } +} diff --git a/Projectiles/Ranged/AstrealArrow.cs b/Projectiles/Ranged/AstrealArrow.cs index 1a42a6942d..e7200b751f 100644 --- a/Projectiles/Ranged/AstrealArrow.cs +++ b/Projectiles/Ranged/AstrealArrow.cs @@ -1,130 +1,130 @@ -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.Ranged -{ - public class AstrealArrow : ModProjectile - { - private int flameTimer = 180; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astreal Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - } - - 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.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - int random = Main.rand.Next(1, 4); - flameTimer -= random; - int choice = Main.rand.Next(2); - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - if (choice == 0 && (projectile.velocity.X >= 25f || projectile.velocity.Y >= 25f)) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = 10f; - } - else if (choice == 1 && (projectile.velocity.X >= 25f || projectile.velocity.Y >= 25f)) - { - projectile.velocity.X = 10f; - projectile.velocity.Y = 0f; - } - else if (choice == 0 && (projectile.velocity.X <= -25f || projectile.velocity.Y <= -25f)) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -10f; - } - else if (choice == 1 && (projectile.velocity.X <= -25f || projectile.velocity.Y <= -25f)) - { - projectile.velocity.X = -10f; - projectile.velocity.Y = 0f; - } - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if (flameTimer <= 0) - { - float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)projectile.position.X - vector2.X; - float speedY = (float)projectile.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AstrealFlame"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - } - flameTimer = 180; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); - Texture2D texture2D3 = Main.projectileTexture[projectile.type]; +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.Ranged +{ + public class AstrealArrow : ModProjectile + { + private int flameTimer = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astreal Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 600; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } + + 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.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + int random = Main.rand.Next(1, 4); + flameTimer -= random; + int choice = Main.rand.Next(2); + projectile.velocity.X *= 1.05f; + projectile.velocity.Y *= 1.05f; + if (choice == 0 && (projectile.velocity.X >= 25f || projectile.velocity.Y >= 25f)) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = 10f; + } + else if (choice == 1 && (projectile.velocity.X >= 25f || projectile.velocity.Y >= 25f)) + { + projectile.velocity.X = 10f; + projectile.velocity.Y = 0f; + } + else if (choice == 0 && (projectile.velocity.X <= -25f || projectile.velocity.Y <= -25f)) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -10f; + } + else if (choice == 1 && (projectile.velocity.X <= -25f || projectile.velocity.Y <= -25f)) + { + projectile.velocity.X = -10f; + projectile.velocity.Y = 0f; + } + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (flameTimer <= 0) + { + float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)projectile.position.X - vector2.X; + float speedY = (float)projectile.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("AstrealFlame"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + } + flameTimer = 180; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); + Texture2D texture2D3 = Main.projectileTexture[projectile.type]; int num156 = texture2D3.Height / Main.projFrames[projectile.type]; int y3 = num156 * projectile.frame; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156); @@ -132,17 +132,17 @@ namespace CalamityMod.Projectiles.Ranged int num157 = 8; int num158 = 2; int num159 = 1; - float num160 = 0f; - + 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; + color26 = projectile.GetAlpha(color26); + goto IL_6899; IL_6881: num161 += num158; - continue; + continue; IL_6899: float num164 = (float)(num157 - num161); if (num158 < 0) @@ -155,22 +155,22 @@ namespace CalamityMod.Projectiles.Ranged SpriteEffects effects = spriteEffects; 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(texture2D3, 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; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 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.ShadowFlame, 360); - } - } -} \ No newline at end of file + } + Main.spriteBatch.Draw(texture2D3, 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; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 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.ShadowFlame, 360); + } + } +} diff --git a/Projectiles/Ranged/AstrealFlame.cs b/Projectiles/Ranged/AstrealFlame.cs index 63697ff787..0e885193ae 100644 --- a/Projectiles/Ranged/AstrealFlame.cs +++ b/Projectiles/Ranged/AstrealFlame.cs @@ -1,106 +1,106 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class AstrealFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.alpha = 255; - } - - public override void AI() - { - projectile.alpha -= 5; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - 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 = 16f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class AstrealFlame : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.alpha -= 5; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + 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 = 16f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index b13d26bf16..f45285055a 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -1,52 +1,52 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BallistaGreatArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ballista Great Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 3; - projectile.aiStyle = 1; - aiType = 1; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 12; - target.AddBuff(mod.BuffType("ArmorCrunch"), 360); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - float spread = 90f * 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) - { - for (i = 0; i < 3; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BallistaGreatArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ballista Great Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 3; + projectile.aiStyle = 1; + aiType = 1; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 12; + target.AddBuff(mod.BuffType("ArmorCrunch"), 360); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + float spread = 90f * 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) + { + for (i = 0; i < 3; i++ ) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index 7e484be7fc..ac235499a8 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -1,177 +1,177 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BeeRPG : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bee RPG"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; - } - - public override void AI() - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 2f; - } - else if (Main.rand.Next(2) == 0) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - projectile.ai[0] = 10f; - 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; - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BeeRPGExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int num516 = 12; - for (int num517 = 0; num517 < num516; num517++) - { - if (num517 % 2 != 1 || Main.rand.Next(3) == 0) - { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - 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 / 4), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; - } - } - } - 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 = 20; - projectile.height = 20; - 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, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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 < 2; 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"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BeeRPG : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bee RPG"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 95; + projectile.ranged = true; + } + + public override void AI() + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 2f; + } + else if (Main.rand.Next(2) == 0) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + { + projectile.ai[0] = 10f; + 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; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BeeRPGExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int num516 = 12; + for (int num517 = 0; num517 < num516; num517++) + { + if (num517 % 2 != 1 || Main.rand.Next(3) == 0) + { + Vector2 value20 = projectile.position; + Vector2 value21 = projectile.oldVelocity; + value21.Normalize(); + value21 *= 8f; + float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; + value20 -= value21 * (float)num517; + 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 / 4), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + Main.projectile[num520].penetrate = 2; + Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; + } + } + } + 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 = 20; + projectile.height = 20; + 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, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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 < 2; 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"), 300); + } + } +} diff --git a/Projectiles/Ranged/BeeRPGExplosion.cs b/Projectiles/Ranged/BeeRPGExplosion.cs index dae7d8548e..2392d3f509 100644 --- a/Projectiles/Ranged/BeeRPGExplosion.cs +++ b/Projectiles/Ranged/BeeRPGExplosion.cs @@ -1,29 +1,29 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BeeRPGExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BeeRPGExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + } +} diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index b0d81d6d49..c0553870cf 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -1,154 +1,154 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BigNuke : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Nuke"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - 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; - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BigNukeExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - 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 = 700; - projectile.height = 700; - 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 < 90; 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 < 180; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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 < 9; 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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BigNuke : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Nuke"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 95; + projectile.ranged = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + 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; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BigNukeExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + 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 = 700; + projectile.height = 700; + 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 < 90; 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 < 180; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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 < 9; 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; + } + } + } +} diff --git a/Projectiles/Ranged/BigNukeExplosion.cs b/Projectiles/Ranged/BigNukeExplosion.cs index f016936462..9c130c0426 100644 --- a/Projectiles/Ranged/BigNukeExplosion.cs +++ b/Projectiles/Ranged/BigNukeExplosion.cs @@ -1,29 +1,29 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BigNukeExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 700; - projectile.height = 700; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BigNukeExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 700; + projectile.height = 700; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + } +} diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index 8a4738ff6a..4a071da953 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BloodClotFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Clot"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - } - - 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, 5, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BloodClotFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Clot"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + } + + 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, 5, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + } +} diff --git a/Projectiles/Ranged/BloodfireArrow.cs b/Projectiles/Ranged/BloodfireArrow.cs index f9822331d2..54c8f1be29 100644 --- a/Projectiles/Ranged/BloodfireArrow.cs +++ b/Projectiles/Ranged/BloodfireArrow.cs @@ -1,85 +1,85 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BloodfireArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodfire Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 15f) - { - 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, 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 void Kill(int timeLeft) - { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 0.5f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - } - - 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]; - if (Main.rand.Next(3) == 0) - { - player.statLife += 1; - player.HealEffect(1); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BloodfireArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodfire Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 15f) + { + 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, 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 void Kill(int timeLeft) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 0.5f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + } + + 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]; + if (Main.rand.Next(3) == 0) + { + player.statLife += 1; + player.HealEffect(1); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + } + } +} diff --git a/Projectiles/Ranged/BloodfireBullet.cs b/Projectiles/Ranged/BloodfireBullet.cs index 2696f15901..0e60ed89b8 100644 --- a/Projectiles/Ranged/BloodfireBullet.cs +++ b/Projectiles/Ranged/BloodfireBullet.cs @@ -1,59 +1,59 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BloodfireBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodfire Bullet"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); - } - } - - 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]; - if (Main.rand.Next(2) == 0) - { - player.statLife += 1; - player.HealEffect(1); - } - target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BloodfireBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodfire Bullet"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); + } + } + + 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]; + if (Main.rand.Next(2) == 0) + { + player.statLife += 1; + player.HealEffect(1); + } + target.AddBuff(mod.BuffType("BrimstoneFlames"), 360); + } + } +} diff --git a/Projectiles/Ranged/BloodflareSoul.cs b/Projectiles/Ranged/BloodflareSoul.cs index ba9e7bee11..b2a1ee93f6 100644 --- a/Projectiles/Ranged/BloodflareSoul.cs +++ b/Projectiles/Ranged/BloodflareSoul.cs @@ -1,152 +1,152 @@ -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.Ranged -{ - public class BloodflareSoul : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Soul"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1.2f; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 900; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 1f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - float num953 = 30f * projectile.ai[1]; //100 - float scaleFactor12 = 6f * projectile.ai[1]; //5 - float num954 = 600f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } - 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 = 11f; - 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 - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } - - 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) - { - 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 Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 110); - 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, 60, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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.Ranged +{ + public class BloodflareSoul : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Soul"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.scale = 1.2f; + projectile.alpha = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 900; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, 0f, 0f, 0, default(Color), 1f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + float num953 = 30f * projectile.ai[1]; //100 + float scaleFactor12 = 6f * projectile.ai[1]; //5 + float num954 = 600f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } + 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 = 11f; + 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 + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } + + 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) + { + 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 Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 39, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 110); + 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, 60, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Ranged/BlueExoArrow.cs b/Projectiles/Ranged/BlueExoArrow.cs index 98717720b0..7bf209c04b 100644 --- a/Projectiles/Ranged/BlueExoArrow.cs +++ b/Projectiles/Ranged/BlueExoArrow.cs @@ -1,128 +1,128 @@ -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.Ranged -{ - public class BlueExoArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, 1f); - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 0, 250, projectile.alpha); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - for (int x = 0; x < 3; x++) - { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("BlueExoArrow2"), (int)((double)projectile.damage * 0.7), 1f, projectile.owner); - } - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class BlueExoArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.timeLeft = 300; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, 1f); + float num55 = 50f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 0, 250, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 50f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + for (int x = 0; x < 3; x++) + { + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("BlueExoArrow2"), (int)((double)projectile.damage * 0.7), 1f, projectile.owner); + } + } + } + } +} diff --git a/Projectiles/Ranged/BlueExoArrow2.cs b/Projectiles/Ranged/BlueExoArrow2.cs index 58ab99bd09..fdc1be6a6b 100644 --- a/Projectiles/Ranged/BlueExoArrow2.cs +++ b/Projectiles/Ranged/BlueExoArrow2.cs @@ -1,100 +1,100 @@ -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.Ranged -{ - public class BlueExoArrow2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.timeLeft = 300; - projectile.tileCollide = false; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, 1f); - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 0, 250, projectile.alpha); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - } -} \ No newline at end of file +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.Ranged +{ + public class BlueExoArrow2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 5; + projectile.timeLeft = 300; + projectile.tileCollide = false; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, 1f); + float num55 = 50f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 0, 250, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 50f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + } +} diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs index bbb58d1180..8898e7aea9 100644 --- a/Projectiles/Ranged/Bolt.cs +++ b/Projectiles/Ranged/Bolt.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Bolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.65f) / 255f); - projectile.velocity.X *= 1.015f; - projectile.velocity.Y *= 1.015f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) - { - projectile.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, 221, 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); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Bolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.alpha = 255; + projectile.penetrate = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.65f) / 255f); + projectile.velocity.X *= 1.015f; + projectile.velocity.Y *= 1.015f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 30f) + { + projectile.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, 221, 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); + } + } +} diff --git a/Projectiles/Ranged/BoltArrow.cs b/Projectiles/Ranged/BoltArrow.cs index 08acfa97c9..35e1a13f9f 100644 --- a/Projectiles/Ranged/BoltArrow.cs +++ b/Projectiles/Ranged/BoltArrow.cs @@ -1,64 +1,64 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BoltArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 15f) - { - 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, 221, 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BoltArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 15f) + { + 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, 221, 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; + } + } + } +} diff --git a/Projectiles/Ranged/BoltExplosion.cs b/Projectiles/Ranged/BoltExplosion.cs index 45670bd599..b778922a23 100644 --- a/Projectiles/Ranged/BoltExplosion.cs +++ b/Projectiles/Ranged/BoltExplosion.cs @@ -1,29 +1,29 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BoltExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 3; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BoltExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 3; + } + } +} diff --git a/Projectiles/Ranged/BrimstoneBallFriendly.cs b/Projectiles/Ranged/BrimstoneBallFriendly.cs index da3db8f208..12c277657d 100644 --- a/Projectiles/Ranged/BrimstoneBallFriendly.cs +++ b/Projectiles/Ranged/BrimstoneBallFriendly.cs @@ -1,72 +1,72 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BrimstoneBallFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 6; - projectile.aiStyle = 14; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - 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; - } - projectile.velocity *= 0.98f; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BrimstoneBallFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 6; + projectile.aiStyle = 14; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + 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; + } + projectile.velocity *= 0.98f; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } +} diff --git a/Projectiles/Ranged/BrimstoneBolt.cs b/Projectiles/Ranged/BrimstoneBolt.cs index da0c0dfe7a..1fbd4eedd9 100644 --- a/Projectiles/Ranged/BrimstoneBolt.cs +++ b/Projectiles/Ranged/BrimstoneBolt.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BrimstoneBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 15; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 0.7f, 0f, 0f); - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BrimstoneBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.timeLeft = 300; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + if (projectile.alpha > 0) + { + projectile.alpha -= 15; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 0.7f, 0f, 0f); + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; + dust4.velocity = Vector2.Zero; + dust4.position -= projectile.velocity / 5f * (float)num121; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index d021fcc14a..f8202d288a 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -1,92 +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 BrimstoneFireFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 235; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BrimstoneFireFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 90; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 90) + { + projectile.timeLeft = 90; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 235; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + } + } +} diff --git a/Projectiles/Ranged/Butcher.cs b/Projectiles/Ranged/Butcher.cs index aa1101a3ca..2c391c659f 100644 --- a/Projectiles/Ranged/Butcher.cs +++ b/Projectiles/Ranged/Butcher.cs @@ -1,163 +1,163 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Butcher : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Butcher"); - } - - public override void SetDefaults() - { - projectile.width = 66; - projectile.height = 32; - 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]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - projectile.ai[0] += 1f; - int num39 = 0; - float spreadMult = 0.15f; - if (projectile.ai[0] >= 120f) - { - num39++; - spreadMult = 0.13f; - } - if (projectile.ai[0] >= 240f) - { - num39++; - spreadMult = 0.11f; - } - if (projectile.ai[0] >= 360f) - { - num39++; - spreadMult = 0.09f; - } - if (projectile.ai[0] >= 480f) - { - num39++; - spreadMult = 0.07f; - } - if (projectile.ai[0] >= 600f) - { - num39++; - spreadMult = 0.05f; - } - if (projectile.ai[0] >= 720f) - { - num39++; - spreadMult = 0.04f; - } - if (projectile.ai[0] >= 840f) - { - num39++; - spreadMult = 0.03f; - } - if (projectile.ai[0] >= 960f) //8 - { - num39++; - spreadMult = 0.02f; - } - int num40 = 40; - int num41 = 3; - projectile.ai[1] -= 1f; - bool flag15 = false; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; - } - bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - if (projectile.soundDelay <= 0 && flag16) - { - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item38, projectile.position); - } - projectile.localAI[0] = 12f; - } - if (flag15 && Main.myPlayer == projectile.owner) - { - int num42 = 14; - float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; - if (flag16) - { - player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); - weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); - float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; - if (player.gravDir == -1f) - { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; - } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) - { - value19 = -Vector2.UnitY; - } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = value19 * 0.55f; - int randomBulletCount = Main.rand.Next(3, 5); - for (int num43 = 0; num43 < randomBulletCount; num43++) - { - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * spreadMult); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) - { - vector20 = -Vector2.UnitY; - } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -5f, 5f); - vector20.X = vector20.X + (float)Main.rand.Next(-15, 16) * spreadMult; - vector20.Y = vector20.Y + (float)Main.rand.Next(-15, 16) * spreadMult; - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); - Main.projectile[num44].noDropItem = true; - Main.projectile[num44].extraUpdates += num39 / 2; //0 to 4 - } - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Butcher : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Butcher"); + } + + public override void SetDefaults() + { + projectile.width = 66; + projectile.height = 32; + 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]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + projectile.ai[0] += 1f; + int num39 = 0; + float spreadMult = 0.15f; + if (projectile.ai[0] >= 120f) + { + num39++; + spreadMult = 0.13f; + } + if (projectile.ai[0] >= 240f) + { + num39++; + spreadMult = 0.11f; + } + if (projectile.ai[0] >= 360f) + { + num39++; + spreadMult = 0.09f; + } + if (projectile.ai[0] >= 480f) + { + num39++; + spreadMult = 0.07f; + } + if (projectile.ai[0] >= 600f) + { + num39++; + spreadMult = 0.05f; + } + if (projectile.ai[0] >= 720f) + { + num39++; + spreadMult = 0.04f; + } + if (projectile.ai[0] >= 840f) + { + num39++; + spreadMult = 0.03f; + } + if (projectile.ai[0] >= 960f) //8 + { + num39++; + spreadMult = 0.02f; + } + int num40 = 40; + int num41 = 3; + projectile.ai[1] -= 1f; + bool flag15 = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = (float)(num40 - num41 * num39); + flag15 = true; + } + bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + if (projectile.soundDelay <= 0 && flag16) + { + projectile.soundDelay = num40 - num41 * num39; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item38, projectile.position); + } + projectile.localAI[0] = 12f; + } + if (flag15 && Main.myPlayer == projectile.owner) + { + int num42 = 14; + float scaleFactor11 = 14f; + int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + if (flag16) + { + player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); + weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); + float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 vector19 = vector; + Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + if (player.gravDir == -1f) + { + value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + } + Vector2 value19 = Vector2.Normalize(value18); + if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + { + value19 = -Vector2.UnitY; + } + value19 *= scaleFactor12; + if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = value19 * 0.55f; + int randomBulletCount = Main.rand.Next(3, 5); + for (int num43 = 0; num43 < randomBulletCount; num43++) + { + Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * spreadMult); + if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + { + vector20 = -Vector2.UnitY; + } + Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -5f, 5f); + vector20.X = vector20.X + (float)Main.rand.Next(-15, 16) * spreadMult; + vector20.Y = vector20.Y + (float)Main.rand.Next(-15, 16) * spreadMult; + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + Main.projectile[num44].noDropItem = true; + Main.projectile[num44].extraUpdates += num39 / 2; //0 to 4 + } + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + } +} diff --git a/Projectiles/Ranged/ChargedBlast.cs b/Projectiles/Ranged/ChargedBlast.cs index e2ae09fc16..2af3596450 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -1,114 +1,114 @@ -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.Ranged -{ - public class ChargedBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.alpha = 255; - projectile.timeLeft = 600; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - return; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 100, 255, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); - int projectiles = Main.rand.Next(2, 5); - if (projectile.owner == Main.myPlayer) - { - for (int k = 0; k < projectiles; k++) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, mod.ProjectileType("ChargedBlast2"), - (int)((double)projectile.damage * 0.85), (float)((int)((double)projectile.knockBack * 0.5)), Main.myPlayer, 0f, 0f); - } - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class ChargedBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.extraUpdates = 3; + projectile.alpha = 255; + projectile.timeLeft = 600; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + return; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 100, 255, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 3f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); + int projectiles = Main.rand.Next(2, 5); + if (projectile.owner == Main.myPlayer) + { + for (int k = 0; k < projectiles; k++) + { + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-10, 11) * 2f, (float)Main.rand.Next(-10, 11) * 2f, mod.ProjectileType("ChargedBlast2"), + (int)((double)projectile.damage * 0.85), (float)((int)((double)projectile.knockBack * 0.5)), Main.myPlayer, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Ranged/ChargedBlast2.cs b/Projectiles/Ranged/ChargedBlast2.cs index 7b6de8afa5..d060b8453b 100644 --- a/Projectiles/Ranged/ChargedBlast2.cs +++ b/Projectiles/Ranged/ChargedBlast2.cs @@ -1,133 +1,133 @@ -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.Ranged -{ - public class ChargedBlast2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 3; - projectile.extraUpdates = 2; - projectile.alpha = 255; - projectile.timeLeft = 200; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 30f; - float num56 = 1f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - return; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 100, 255, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 30f; - float scaleFactor = 1f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - 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; - } - - public override void Kill(int timeLeft) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 160, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 3; - } - } -} \ No newline at end of file +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.Ranged +{ + public class ChargedBlast2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 3; + projectile.extraUpdates = 2; + projectile.alpha = 255; + projectile.timeLeft = 200; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); + float num55 = 30f; + float num56 = 1f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + return; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 100, 255, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 30f; + float scaleFactor = 1f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + 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; + } + + public override void Kill(int timeLeft) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 160, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 3; + } + } +} diff --git a/Projectiles/Ranged/ChargedBlast3.cs b/Projectiles/Ranged/ChargedBlast3.cs index 70fab60b84..5e24b2b066 100644 --- a/Projectiles/Ranged/ChargedBlast3.cs +++ b/Projectiles/Ranged/ChargedBlast3.cs @@ -1,210 +1,210 @@ -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.Ranged -{ - public class ChargedBlast3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 4; - projectile.extraUpdates = 3; - projectile.alpha = 255; - projectile.timeLeft = 300; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 100, 255, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[explode].penetrate = 1; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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, 160, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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, 160, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - 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; - } - - public override void Kill(int timeLeft) - { - int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[explode].penetrate = 1; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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, 160, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 2; - int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[explode].penetrate = 1; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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, 160, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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, 160, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class ChargedBlast3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 4; + projectile.extraUpdates = 3; + projectile.alpha = 255; + projectile.timeLeft = 300; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); + float num55 = 50f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 100, 255, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 50f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[explode].penetrate = 1; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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, 160, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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, 160, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + 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; + } + + public override void Kill(int timeLeft) + { + int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[explode].penetrate = 1; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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, 160, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 2; + int explode = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage / 4, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[explode].penetrate = 1; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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, 160, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 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, 160, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Ranged/Chicken.cs b/Projectiles/Ranged/Chicken.cs index cc998ed7e3..861f3422b4 100644 --- a/Projectiles/Ranged/Chicken.cs +++ b/Projectiles/Ranged/Chicken.cs @@ -1,125 +1,125 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Chicken : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chicken"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.ranged = true; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 1.1f; - } - else if (Main.rand.Next(2) == 0) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - } - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -15f; - projectile.timeLeft = 20; - return false; - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChickenExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - 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 = 1000; - projectile.height = 1000; - 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 < 40; 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; - } - } - - - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Chicken : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chicken"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + projectile.ranged = true; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 1.1f; + } + else if (Main.rand.Next(2) == 0) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + } + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -15f; + projectile.timeLeft = 20; + return false; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ChickenExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + 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 = 1000; + projectile.height = 1000; + 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 < 40; 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; + } + } + + + } +} diff --git a/Projectiles/Ranged/ChickenExplosion.cs b/Projectiles/Ranged/ChickenExplosion.cs index 353e0bd7ea..4872012d90 100644 --- a/Projectiles/Ranged/ChickenExplosion.cs +++ b/Projectiles/Ranged/ChickenExplosion.cs @@ -1,97 +1,97 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ChickenExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 1000; - projectile.height = 1000; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 150; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - 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); - 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(-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, 244, 0f, 0f, 100, default(Color), 2.5f); - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ChickenExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 1000; + projectile.height = 1000; + projectile.friendly = true; + projectile.ignoreWater = false; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 150; + projectile.ranged = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + 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); + 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(-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, 244, 0f, 0f, 100, default(Color), 2.5f); + 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++; + } + } + } +} diff --git a/Projectiles/Ranged/Contagion.cs b/Projectiles/Ranged/Contagion.cs index 9299b4d2f7..0b1400e885 100644 --- a/Projectiles/Ranged/Contagion.cs +++ b/Projectiles/Ranged/Contagion.cs @@ -1,141 +1,141 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Contagion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Contagion"); - } - - public override void SetDefaults() - { - projectile.width = 84; - projectile.height = 42; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.type == mod.ProjectileType("Contagion")) - { - projectile.ai[0] += 1f; - int num2 = 0; - if (projectile.ai[0] >= 40f) - { - num2++; - } - if (projectile.ai[0] >= 80f) - { - num2++; - } - if (projectile.ai[0] >= 120f) - { - num2++; - } - int num3 = 24; - int num4 = 6; - projectile.ai[1] += 1f; - bool flag = false; - if (projectile.ai[1] >= (float)(num3 - num4 * num2)) - { - projectile.ai[1] = 0f; - flag = true; - } - projectile.frameCounter += 1 + num2; - if (projectile.frameCounter >= 4) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame >= 3) - { - projectile.frame = 0; - } - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num3 - num4 * num2; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 5); - } - } - if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) - { - Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); - Vector2 value = projectile.Center + vector2; - for (int i = 0; i < 2; i++) - { - int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 44, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default(Color), 0.25f); - Main.dust[num5].velocity *= 0.66f; - Main.dust[num5].noGravity = true; - Main.dust[num5].scale = 1.4f; - } - } - if (flag && Main.myPlayer == projectile.owner) - { - bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; - if (flag2) - { - float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value2 = vector; - Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; - if (player.gravDir == -1f) - { - value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; - } - Vector2 vector3 = Vector2.Normalize(value3); - if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) - { - vector3 = -Vector2.UnitY; - } - vector3 *= scaleFactor; - if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector3; - int num6 = mod.ProjectileType("ContagionArrow"); - float scaleFactor2 = 14f; - int num7 = 7; - value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default(Vector2)); - if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) - { - spinningpoint = -Vector2.UnitY; - } - Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - else - { - projectile.Kill(); - } - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Contagion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Contagion"); + } + + public override void SetDefaults() + { + projectile.width = 84; + projectile.height = 42; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.ranged = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.type == mod.ProjectileType("Contagion")) + { + projectile.ai[0] += 1f; + int num2 = 0; + if (projectile.ai[0] >= 40f) + { + num2++; + } + if (projectile.ai[0] >= 80f) + { + num2++; + } + if (projectile.ai[0] >= 120f) + { + num2++; + } + int num3 = 24; + int num4 = 6; + projectile.ai[1] += 1f; + bool flag = false; + if (projectile.ai[1] >= (float)(num3 - num4 * num2)) + { + projectile.ai[1] = 0f; + flag = true; + } + projectile.frameCounter += 1 + num2; + if (projectile.frameCounter >= 4) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame >= 3) + { + projectile.frame = 0; + } + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num3 - num4 * num2; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 5); + } + } + if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) + { + Vector2 vector2 = Vector2.UnitX * 24f; + vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); + Vector2 value = projectile.Center + vector2; + for (int i = 0; i < 2; i++) + { + int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 44, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default(Color), 0.25f); + Main.dust[num5].velocity *= 0.66f; + Main.dust[num5].noGravity = true; + Main.dust[num5].scale = 1.4f; + } + } + if (flag && Main.myPlayer == projectile.owner) + { + bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed; + if (flag2) + { + float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value2 = vector; + Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; + if (player.gravDir == -1f) + { + value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; + } + Vector2 vector3 = Vector2.Normalize(value3); + if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) + { + vector3 = -Vector2.UnitY; + } + vector3 *= scaleFactor; + if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector3; + int num6 = mod.ProjectileType("ContagionArrow"); + float scaleFactor2 = 14f; + int num7 = 7; + value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; + spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default(Vector2)); + if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) + { + spinningpoint = -Vector2.UnitY; + } + Projectile.NewProjectile(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + else + { + projectile.Kill(); + } + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + } +} diff --git a/Projectiles/Ranged/ContagionArrow.cs b/Projectiles/Ranged/ContagionArrow.cs index ca9bafa67a..00e1dda138 100644 --- a/Projectiles/Ranged/ContagionArrow.cs +++ b/Projectiles/Ranged/ContagionArrow.cs @@ -1,66 +1,66 @@ -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.Ranged -{ - public class ContagionArrow : ModProjectile - { - public int addBallTimer = 10; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Contagion Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.ranged = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - addBallTimer--; - if (addBallTimer <= 0) - { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ContagionBall")] < 100) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ContagionBall"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - addBallTimer = 10; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.ai[0] <= 60f) - { - projectile.ai[0] += 1f; - return; - } - projectile.velocity.Y = projectile.velocity.Y + 0.075f; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 600); - } - - 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 +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.Ranged +{ + public class ContagionArrow : ModProjectile + { + public int addBallTimer = 10; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Contagion Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.ranged = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + addBallTimer--; + if (addBallTimer <= 0) + { + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("ContagionBall")] < 100) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ContagionBall"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + addBallTimer = 10; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.ai[0] <= 60f) + { + projectile.ai[0] += 1f; + return; + } + projectile.velocity.Y = projectile.velocity.Y + 0.075f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 600); + } + + 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; + } + } +} diff --git a/Projectiles/Ranged/ContagionBall.cs b/Projectiles/Ranged/ContagionBall.cs index f1e44b9b6b..ef5727acb8 100644 --- a/Projectiles/Ranged/ContagionBall.cs +++ b/Projectiles/Ranged/ContagionBall.cs @@ -1,56 +1,56 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ContagionBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Contagion Ball"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 60; - projectile.ranged = true; - } - - public override void Kill(int timeLeft) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - 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 = 60; - projectile.height = 60; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, default(Color), 0.15f); - Main.dust[num622].velocity *= 1.2f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 60; - projectile.height = 60; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ContagionBall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Contagion Ball"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 60; + projectile.ranged = true; + } + + public override void Kill(int timeLeft) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + 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 = 60; + projectile.height = 60; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, default(Color), 0.15f); + Main.dust[num622].velocity *= 1.2f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 60; + projectile.height = 60; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + } + } +} diff --git a/Projectiles/Ranged/CorossiveFlames.cs b/Projectiles/Ranged/CorossiveFlames.cs index 279d738029..e472f58b57 100644 --- a/Projectiles/Ranged/CorossiveFlames.cs +++ b/Projectiles/Ranged/CorossiveFlames.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class CorossiveFlames : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flames"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.075f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 89; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 2.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - if (Main.rand.Next(6) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 2f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("Plague"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class CorossiveFlames : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flames"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 90; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.075f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.timeLeft > 90) + { + projectile.timeLeft = 90; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 89; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 2.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + if (Main.rand.Next(6) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 2f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("Plague"), 300); + } + } +} diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 74610901e0..497d42ef6e 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class CosmicFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - } - - public override void AI() - { - if (projectile.scale <= 1.5f) - { - projectile.scale *= 1.01f; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 58; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 4; - target.AddBuff(BuffID.CursedInferno, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class CosmicFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 90; + } + + public override void AI() + { + if (projectile.scale <= 1.5f) + { + projectile.scale *= 1.01f; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 90) + { + projectile.timeLeft = 90; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 58; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 4; + target.AddBuff(BuffID.CursedInferno, 300); + } + } +} diff --git a/Projectiles/Ranged/DaemonsFlame.cs b/Projectiles/Ranged/DaemonsFlame.cs index 7e4f7abc05..c9b522023b 100644 --- a/Projectiles/Ranged/DaemonsFlame.cs +++ b/Projectiles/Ranged/DaemonsFlame.cs @@ -1,155 +1,155 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class DaemonsFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daemon's Flame"); - Main.projFrames[projectile.type] = 3; - } - - public override void SetDefaults() - { - projectile.width = 54; - projectile.height = 116; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - projectile.ai[0] += 1f; - int num39 = 0; - if (projectile.ai[0] >= 30f) - { - num39++; - } - if (projectile.ai[0] >= 60f) - { - num39++; - } - if (projectile.ai[0] >= 90f) - { - num39++; - } - if (projectile.ai[0] >= 120f) - { - num39++; - } - int num40 = 24; - int num41 = 2; - projectile.ai[1] -= 1f; - bool flag15 = false; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; - int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); - } - bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - if (projectile.soundDelay <= 0 && flag16) - { - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item5, projectile.position); - } - projectile.localAI[0] = 12f; - } - if (flag15 && Main.myPlayer == projectile.owner) - { - int num42 = 14; - float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; - if (flag16) - { - player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); - weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); - float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; - if (player.gravDir == -1f) - { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; - } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) - { - value19 = -Vector2.UnitY; - } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = value19 * 0.55f; - for (int num43 = 0; num43 < 4; num43++) - { - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) - { - vector20 = -Vector2.UnitY; - } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); - Main.projectile[num44].noDropItem = true; - } - Vector2 vector2 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector2.X) || float.IsNaN(vector2.Y)) - { - vector2 = -Vector2.UnitY; - } - float speedY = vector2.Y; - Vector2 vector3 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - Projectile.NewProjectile(vector3.X, vector3.Y, vector2.X, vector2.Y, mod.ProjectileType("DaemonsFlameArrow"), weaponDamage2, weaponKnockback2, projectile.owner, 0.0f, speedY); - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class DaemonsFlame : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daemon's Flame"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 54; + projectile.height = 116; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + projectile.ai[0] += 1f; + int num39 = 0; + if (projectile.ai[0] >= 30f) + { + num39++; + } + if (projectile.ai[0] >= 60f) + { + num39++; + } + if (projectile.ai[0] >= 90f) + { + num39++; + } + if (projectile.ai[0] >= 120f) + { + num39++; + } + int num40 = 24; + int num41 = 2; + projectile.ai[1] -= 1f; + bool flag15 = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = (float)(num40 - num41 * num39); + flag15 = true; + int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); + } + bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + if (projectile.soundDelay <= 0 && flag16) + { + projectile.soundDelay = num40 - num41 * num39; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item5, projectile.position); + } + projectile.localAI[0] = 12f; + } + if (flag15 && Main.myPlayer == projectile.owner) + { + int num42 = 14; + float scaleFactor11 = 14f; + int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + if (flag16) + { + player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); + weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); + float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 vector19 = vector; + Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + if (player.gravDir == -1f) + { + value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + } + Vector2 value19 = Vector2.Normalize(value18); + if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + { + value19 = -Vector2.UnitY; + } + value19 *= scaleFactor12; + if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = value19 * 0.55f; + for (int num43 = 0; num43 < 4; num43++) + { + Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + { + vector20 = -Vector2.UnitY; + } + Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + Main.projectile[num44].noDropItem = true; + } + Vector2 vector2 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(vector2.X) || float.IsNaN(vector2.Y)) + { + vector2 = -Vector2.UnitY; + } + float speedY = vector2.Y; + Vector2 vector3 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); + Projectile.NewProjectile(vector3.X, vector3.Y, vector2.X, vector2.Y, mod.ProjectileType("DaemonsFlameArrow"), weaponDamage2, weaponKnockback2, projectile.owner, 0.0f, speedY); + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + } +} diff --git a/Projectiles/Ranged/DaemonsFlameArrow.cs b/Projectiles/Ranged/DaemonsFlameArrow.cs index bb3d003855..22f1b052cc 100644 --- a/Projectiles/Ranged/DaemonsFlameArrow.cs +++ b/Projectiles/Ranged/DaemonsFlameArrow.cs @@ -1,87 +1,87 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class DaemonsFlameArrow : ModProjectile - { - public int x; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - x++; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 30f) - { - projectile.velocity.Y = (float)(((double)projectile.ai[1]) * Math.Sin(x/4)); - } - 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, 60, 0f, 0f, 100, default(Color), 3f); - 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, 60, 0f, 0f, 100, default(Color), 2.25f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].velocity += projectile.velocity * 0.5f; - } - } - - public override void Kill(int timeLeft) - { - 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 = 150; - projectile.height = 150; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.7f); - 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, 60, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class DaemonsFlameArrow : ModProjectile + { + public int x; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.alpha = 255; + projectile.ranged = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + x++; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 30f) + { + projectile.velocity.Y = (float)(((double)projectile.ai[1]) * Math.Sin(x/4)); + } + 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, 60, 0f, 0f, 100, default(Color), 3f); + 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, 60, 0f, 0f, 100, default(Color), 2.25f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } + } + + public override void Kill(int timeLeft) + { + 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 = 150; + projectile.height = 150; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default(Color), 1.7f); + 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, 60, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Ranged/DragonBurst.cs b/Projectiles/Ranged/DragonBurst.cs index 4e23d0d810..cae7a98bfc 100644 --- a/Projectiles/Ranged/DragonBurst.cs +++ b/Projectiles/Ranged/DragonBurst.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class DragonBurst : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burst"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.extraUpdates = 10; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.ranged = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num92 = 0; num92 < 2; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 127, 0f, 0f, 100, default(Color), 2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; - } - if (Main.rand.Next(10) == 0) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 127, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class DragonBurst : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burst"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.extraUpdates = 10; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.ranged = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num92 = 0; num92 < 2; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 127, 0f, 0f, 100, default(Color), 2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + } + if (Main.rand.Next(10) == 0) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 127, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + } + } +} diff --git a/Projectiles/Ranged/Drataliornus.cs b/Projectiles/Ranged/Drataliornus.cs index 1c97608668..64f0dcfe0a 100644 --- a/Projectiles/Ranged/Drataliornus.cs +++ b/Projectiles/Ranged/Drataliornus.cs @@ -1,160 +1,160 @@ -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 Drataliornus : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Drataliornus"); - } - - public override void SetDefaults() - { - projectile.width = 64; - projectile.height = 84; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; - } - - public override void AI() //mostly phangasm code - { - Lighting.AddLight(projectile.Center, 255f / 255f, 154f / 255f, 58f / 255f); - Player player = Main.player[projectile.owner]; - - projectile.ai[1]--; //usetime timer - - if (projectile.ai[0] >= 0) //spinup timer - { - projectile.ai[0]++; - - switch ((int)projectile.ai[0]) - { - case 36: - case 72: - case 108: - case 144: - case 180: - case 216: - case 252: - case 288: - case 324: projectile.localAI[0]++; break; - - case 360: - projectile.localAI[0]++; - projectile.ai[0] = -1f; //fully spun up, don't need timer anymore - - const int num226 = 36; //dusts indicate fully spun up - 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, 127, 0f, 0f, 0, default(Color), 4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - break; - } - } - - int baseUseTime = 35; - int modifier = 3; - 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.Item5, projectile.position); - } - - player.phantasmTime = 2; - - if (timeToFire && Main.myPlayer == projectile.owner) - { - if (canFire) //fire an angery flame - { - int type = 14; - float scaleFactor = 18f; - 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); - - type = mod.ProjectileType("DrataliornusFlame"); - 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; //variation increases as fire rate increases - Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); - Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); - - float ai0 = 0f; - if (projectile.ai[0] < 0f) //if fully spun up - { - if (Main.rand.Next(3) == 0) //chance to shoot homing - { - ai0 = 2f; - speed /= 2f; - } - else - { - ai0 = 1f; - } - } - - Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, ai0, 0f); - - projectile.netUpdate = true; - } - else - { - projectile.Kill(); - } - } - - //display projectile - 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 +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 Drataliornus : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Drataliornus"); + } + + public override void SetDefaults() + { + projectile.width = 64; + projectile.height = 84; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() //mostly phangasm code + { + Lighting.AddLight(projectile.Center, 255f / 255f, 154f / 255f, 58f / 255f); + Player player = Main.player[projectile.owner]; + + projectile.ai[1]--; //usetime timer + + if (projectile.ai[0] >= 0) //spinup timer + { + projectile.ai[0]++; + + switch ((int)projectile.ai[0]) + { + case 36: + case 72: + case 108: + case 144: + case 180: + case 216: + case 252: + case 288: + case 324: projectile.localAI[0]++; break; + + case 360: + projectile.localAI[0]++; + projectile.ai[0] = -1f; //fully spun up, don't need timer anymore + + const int num226 = 36; //dusts indicate fully spun up + 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, 127, 0f, 0f, 0, default(Color), 4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + break; + } + } + + int baseUseTime = 35; + int modifier = 3; + 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.Item5, projectile.position); + } + + player.phantasmTime = 2; + + if (timeToFire && Main.myPlayer == projectile.owner) + { + if (canFire) //fire an angery flame + { + int type = 14; + float scaleFactor = 18f; + 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); + + type = mod.ProjectileType("DrataliornusFlame"); + 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; //variation increases as fire rate increases + Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); + Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); + + float ai0 = 0f; + if (projectile.ai[0] < 0f) //if fully spun up + { + if (Main.rand.Next(3) == 0) //chance to shoot homing + { + ai0 = 2f; + speed /= 2f; + } + else + { + ai0 = 1f; + } + } + + Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, ai0, 0f); + + projectile.netUpdate = true; + } + else + { + projectile.Kill(); + } + } + + //display projectile + 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; + } + } +} diff --git a/Projectiles/Ranged/DrataliornusExoArrow.cs b/Projectiles/Ranged/DrataliornusExoArrow.cs index a7bb022c23..ee8759a62c 100644 --- a/Projectiles/Ranged/DrataliornusExoArrow.cs +++ b/Projectiles/Ranged/DrataliornusExoArrow.cs @@ -1,126 +1,126 @@ -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.Ranged -{ - public class DrataliornusExoArrow : ModProjectile - { - private int HolyLight { get { return mod.BuffType("HolyLight"); } } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Drataliornus Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 4; - projectile.timeLeft = 60; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 100f; - float num56 = 3f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - return; - } - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Ichor, 540); - target.AddBuff(HolyLight, 540); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 0; - - target.AddBuff(BuffID.Daybreak, 540); - target.AddBuff(HolyLight, 540); - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 25, 0, projectile.alpha); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - } -} \ No newline at end of file +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.Ranged +{ + public class DrataliornusExoArrow : ModProjectile + { + private int HolyLight { get { return mod.BuffType("HolyLight"); } } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Drataliornus Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 4; + projectile.timeLeft = 60; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 100f; + float num56 = 3f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + return; + } + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Ichor, 540); + target.AddBuff(HolyLight, 540); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 0; + + target.AddBuff(BuffID.Daybreak, 540); + target.AddBuff(HolyLight, 540); + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 25, 0, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 100f; + float scaleFactor = 3f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + } +} diff --git a/Projectiles/Ranged/DrataliornusFlame.cs b/Projectiles/Ranged/DrataliornusFlame.cs index 6ef4720195..5092eaa651 100644 --- a/Projectiles/Ranged/DrataliornusFlame.cs +++ b/Projectiles/Ranged/DrataliornusFlame.cs @@ -1,262 +1,262 @@ -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 DrataliornusFlame : ModProjectile - { - private int HolyLight { get { return mod.BuffType("HolyLight"); } } - private int DragonDust { get { return mod.ProjectileType("DragonDust"); } } - private int SkyFlareFriendly { get { return mod.ProjectileType("SkyFlareFriendly"); } } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Drataliornus Flame"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.scale = 1.5f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.hide = true; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.rotation = projectile.velocity.ToRotation() + 1.5708f; - - if (projectile.hide) //called on first AI tick only - more initializations - { - projectile.hide = false; - projectile.ai[1] = -1f; - - if (projectile.ai[0] != 0f) //if empowered fireball - { - projectile.extraUpdates = 1; - projectile.localAI[0] = Main.rand.Next(30); - - if (projectile.ai[0] == 2f) //if homing fireball - projectile.timeLeft += 180; - } - - projectile.netUpdate = true; - } - - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frameCounter = 0; - projectile.frame++; - } - - if (projectile.frame > 4) - projectile.frame = 0; - - //intangible until it's in completely open space - if (!projectile.tileCollide && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.tileCollide = true; - projectile.netUpdate = true; - } - - projectile.localAI[0]++; - if (projectile.localAI[0] > 30f) //dragon dust trail counter, but only empowered proj spawns it - { - projectile.localAI[0] = 0f; - - if (projectile.ai[0] != 0f && projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, Vector2.Zero, DragonDust, projectile.damage / 3, projectile.knockBack * 3f, projectile.owner); - } - - projectile.localAI[1]++; - if (projectile.localAI[1] > 12f) //homing counter, checks every 12/2=6 ticks - { - projectile.localAI[1] = 0f; - - if (projectile.ai[0] == 2f && projectile.ai[1] < 0f) //if homing fireball and no target - { - int possibleTarget = -1; - float closestDistance = 700f; - - for (int i = 0; i < 200; i++) - { - NPC npc = Main.npc[i]; - - if (npc.active && npc.chaseable && npc.lifeMax > 5 && !npc.dontTakeDamage && !npc.friendly && - !npc.immortal && Collision.CanHit(projectile.Center, 0, 0, npc.Center, 0, 0)) - { - float distance = Vector2.Distance(projectile.Center, npc.Center); - - if (closestDistance > distance) - { - closestDistance = distance; - possibleTarget = i; - } - } - } - - projectile.ai[1] = possibleTarget; - projectile.netUpdate = true; - } - } - - if (projectile.ai[1] != -1f) //if has target - { - NPC npc = Main.npc[(int)projectile.ai[1]]; - - if (npc.active && npc.chaseable && !npc.dontTakeDamage) //do homing - { - Vector2 distance = npc.Center - projectile.Center; - double angle = distance.ToRotation() - projectile.velocity.ToRotation(); - if (angle > Math.PI) - angle -= 2.0 * Math.PI; - if (angle < -Math.PI) - angle += 2.0 * Math.PI; - - if (Math.Abs(angle) > Math.PI * 0.75) - { - projectile.velocity = projectile.velocity.RotatedBy(angle * 0.07); - } - else - { - float range = distance.Length(); - float difference = 12.7f / range; - distance *= difference; - distance /= 7f; - projectile.velocity += distance; - if (range > 70f) - { - projectile.velocity *= 0.98f; - } - } - } - else //target not valid, stop homing - { - projectile.ai[1] = -1; - projectile.netUpdate = true; - } - } - - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1.5f + Main.rand.NextFloat()); - Main.dust[d].noGravity = true; - - Lighting.AddLight(projectile.Center, 255f / 255f, 154f / 255f, 58f / 255f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 154, 58, projectile.alpha); - } - - 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) - { - if (timeLeft != 0) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 1f, 0f); - - if (projectile.ai[0] != 0f && projectile.owner == Main.myPlayer) //if empowered, make exo arrow and dragon dust - { - Vector2 vector3 = projectile.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); - Vector2 speed = projectile.Center - vector3; - speed /= 30f; - Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, mod.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); - - Projectile.NewProjectile(projectile.Center, Vector2.Zero, DragonDust, projectile.damage / 3, projectile.knockBack * 2f, projectile.owner); - } - - projectile.position = projectile.Center; - projectile.width = 180; - projectile.height = 180; - projectile.position.X = projectile.position.X - 90; - projectile.position.Y = projectile.position.Y - 90; - - //just dusts - const int num226 = 24; - float modifier = 4f + 8f * Main.rand.NextFloat(); - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * modifier; - vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 45, default(Color), 2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - for (int num193 = 0; num193 < 4; num193++) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 50, default(Color), 1.5f); - - int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 50, default(Color), 1f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 2f; - } - for (int num194 = 0; num194 < 12; num194++) - { - int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 0, default(Color), 3f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - } - - projectile.timeLeft = 0; //should avoid infinite loop if a hit npc calls proj.Kill() - projectile.penetrate = -1; - projectile.damage /= 3; - projectile.Damage(); - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Ichor, 540); - target.AddBuff(HolyLight, 540); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 0; - - target.AddBuff(BuffID.Ichor, 540); - target.AddBuff(BuffID.BetsysCurse, 540); - target.AddBuff(BuffID.Daybreak, 540); - target.AddBuff(HolyLight, 540); - - if (projectile.ai[0] != 0f && projectile.owner == Main.myPlayer) //if empowered - { - if (projectile.timeLeft != 0) //will not be called on npcs hit by explosion (only direct hits) - { - //make exo arrow, make meteor - Vector2 vector3 = target.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); - Vector2 speed = target.Center - vector3; - speed /= 30f; - Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, mod.ProjectileType("DrataliornusExoArrow"), projectile.damage / 2, projectile.knockBack, projectile.owner); - - Vector2 vel = new Vector2(Main.rand.Next(-400, 401), Main.rand.Next(500, 801)); - Vector2 pos = target.Center - vel; - vel.X += Main.rand.Next(-100, 101); - vel.Normalize(); - vel *= 30f; - Projectile.NewProjectile(pos, vel + target.velocity, SkyFlareFriendly, projectile.damage * 3, projectile.knockBack * 5f, projectile.owner); - } - } - } - } -} \ No newline at end of file +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 DrataliornusFlame : ModProjectile + { + private int HolyLight { get { return mod.BuffType("HolyLight"); } } + private int DragonDust { get { return mod.ProjectileType("DragonDust"); } } + private int SkyFlareFriendly { get { return mod.ProjectileType("SkyFlareFriendly"); } } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Drataliornus Flame"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.scale = 1.5f; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.hide = true; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + 1.5708f; + + if (projectile.hide) //called on first AI tick only - more initializations + { + projectile.hide = false; + projectile.ai[1] = -1f; + + if (projectile.ai[0] != 0f) //if empowered fireball + { + projectile.extraUpdates = 1; + projectile.localAI[0] = Main.rand.Next(30); + + if (projectile.ai[0] == 2f) //if homing fireball + projectile.timeLeft += 180; + } + + projectile.netUpdate = true; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frameCounter = 0; + projectile.frame++; + } + + if (projectile.frame > 4) + projectile.frame = 0; + + //intangible until it's in completely open space + if (!projectile.tileCollide && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.tileCollide = true; + projectile.netUpdate = true; + } + + projectile.localAI[0]++; + if (projectile.localAI[0] > 30f) //dragon dust trail counter, but only empowered proj spawns it + { + projectile.localAI[0] = 0f; + + if (projectile.ai[0] != 0f && projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projectile.Center, Vector2.Zero, DragonDust, projectile.damage / 3, projectile.knockBack * 3f, projectile.owner); + } + + projectile.localAI[1]++; + if (projectile.localAI[1] > 12f) //homing counter, checks every 12/2=6 ticks + { + projectile.localAI[1] = 0f; + + if (projectile.ai[0] == 2f && projectile.ai[1] < 0f) //if homing fireball and no target + { + int possibleTarget = -1; + float closestDistance = 700f; + + for (int i = 0; i < 200; i++) + { + NPC npc = Main.npc[i]; + + if (npc.active && npc.chaseable && npc.lifeMax > 5 && !npc.dontTakeDamage && !npc.friendly && + !npc.immortal && Collision.CanHit(projectile.Center, 0, 0, npc.Center, 0, 0)) + { + float distance = Vector2.Distance(projectile.Center, npc.Center); + + if (closestDistance > distance) + { + closestDistance = distance; + possibleTarget = i; + } + } + } + + projectile.ai[1] = possibleTarget; + projectile.netUpdate = true; + } + } + + if (projectile.ai[1] != -1f) //if has target + { + NPC npc = Main.npc[(int)projectile.ai[1]]; + + if (npc.active && npc.chaseable && !npc.dontTakeDamage) //do homing + { + Vector2 distance = npc.Center - projectile.Center; + double angle = distance.ToRotation() - projectile.velocity.ToRotation(); + if (angle > Math.PI) + angle -= 2.0 * Math.PI; + if (angle < -Math.PI) + angle += 2.0 * Math.PI; + + if (Math.Abs(angle) > Math.PI * 0.75) + { + projectile.velocity = projectile.velocity.RotatedBy(angle * 0.07); + } + else + { + float range = distance.Length(); + float difference = 12.7f / range; + distance *= difference; + distance /= 7f; + projectile.velocity += distance; + if (range > 70f) + { + projectile.velocity *= 0.98f; + } + } + } + else //target not valid, stop homing + { + projectile.ai[1] = -1; + projectile.netUpdate = true; + } + } + + int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, projectile.velocity.X, projectile.velocity.Y, 0, default(Color), 1.5f + Main.rand.NextFloat()); + Main.dust[d].noGravity = true; + + Lighting.AddLight(projectile.Center, 255f / 255f, 154f / 255f, 58f / 255f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 154, 58, projectile.alpha); + } + + 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) + { + if (timeLeft != 0) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 1f, 0f); + + if (projectile.ai[0] != 0f && projectile.owner == Main.myPlayer) //if empowered, make exo arrow and dragon dust + { + Vector2 vector3 = projectile.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); + Vector2 speed = projectile.Center - vector3; + speed /= 30f; + Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, mod.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + + Projectile.NewProjectile(projectile.Center, Vector2.Zero, DragonDust, projectile.damage / 3, projectile.knockBack * 2f, projectile.owner); + } + + projectile.position = projectile.Center; + projectile.width = 180; + projectile.height = 180; + projectile.position.X = projectile.position.X - 90; + projectile.position.Y = projectile.position.Y - 90; + + //just dusts + const int num226 = 24; + float modifier = 4f + 8f * Main.rand.NextFloat(); + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * modifier; + vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 45, default(Color), 2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + for (int num193 = 0; num193 < 4; num193++) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 50, default(Color), 1.5f); + + int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 174, 0f, 0f, 50, default(Color), 1f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 2f; + } + for (int num194 = 0; num194 < 12; num194++) + { + int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 0, default(Color), 3f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + } + + projectile.timeLeft = 0; //should avoid infinite loop if a hit npc calls proj.Kill() + projectile.penetrate = -1; + projectile.damage /= 3; + projectile.Damage(); + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Ichor, 540); + target.AddBuff(HolyLight, 540); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 0; + + target.AddBuff(BuffID.Ichor, 540); + target.AddBuff(BuffID.BetsysCurse, 540); + target.AddBuff(BuffID.Daybreak, 540); + target.AddBuff(HolyLight, 540); + + if (projectile.ai[0] != 0f && projectile.owner == Main.myPlayer) //if empowered + { + if (projectile.timeLeft != 0) //will not be called on npcs hit by explosion (only direct hits) + { + //make exo arrow, make meteor + Vector2 vector3 = target.Center + new Vector2(600, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))); + Vector2 speed = target.Center - vector3; + speed /= 30f; + Projectile.NewProjectile(vector3.X, vector3.Y, speed.X, speed.Y, mod.ProjectileType("DrataliornusExoArrow"), projectile.damage / 2, projectile.knockBack, projectile.owner); + + Vector2 vel = new Vector2(Main.rand.Next(-400, 401), Main.rand.Next(500, 801)); + Vector2 pos = target.Center - vel; + vel.X += Main.rand.Next(-100, 101); + vel.Normalize(); + vel *= 30f; + Projectile.NewProjectile(pos, vel + target.velocity, SkyFlareFriendly, projectile.damage * 3, projectile.knockBack * 5f, projectile.owner); + } + } + } + } +} diff --git a/Projectiles/Ranged/ElysianArrow.cs b/Projectiles/Ranged/ElysianArrow.cs index 6d476e8849..e583142146 100644 --- a/Projectiles/Ranged/ElysianArrow.cs +++ b/Projectiles/Ranged/ElysianArrow.cs @@ -1,120 +1,120 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ElysianArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - 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; - } - - public override void Kill(int timeLeft) - { - 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 = 30; - projectile.height = 30; - 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 < 2; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 6; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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; - } - float x = projectile.position.X + (float)Main.rand.Next(-400, 400); - float y = projectile.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - if (projectile.owner == Main.myPlayer) - { - int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("SkyFlareFriendly"), projectile.damage, 5f, projectile.owner, 0f, 0f); - Main.projectile[num19].ai[1] = projectile.position.Y; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 360); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ElysianArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + 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; + } + + public override void Kill(int timeLeft) + { + 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 = 30; + projectile.height = 30; + 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 < 2; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 6; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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; + } + float x = projectile.position.X + (float)Main.rand.Next(-400, 400); + float y = projectile.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X; + float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 25; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + if (projectile.owner == Main.myPlayer) + { + int num19 = Projectile.NewProjectile(x, y, num15, num16, mod.ProjectileType("SkyFlareFriendly"), projectile.damage, 5f, projectile.owner, 0f, 0f); + Main.projectile[num19].ai[1] = projectile.position.Y; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 360); + } + } +} diff --git a/Projectiles/Ranged/EnhancedNanoRound.cs b/Projectiles/Ranged/EnhancedNanoRound.cs index f9b5cb2b9c..f5d431029d 100644 --- a/Projectiles/Ranged/EnhancedNanoRound.cs +++ b/Projectiles/Ranged/EnhancedNanoRound.cs @@ -1,98 +1,98 @@ -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 EnhancedNanoRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nano Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Confused, 300); - if (target.life <= 0) - { - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < 2; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("Nanomachine"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); - } - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93); - int num212 = Main.rand.Next(5, 10); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 229, 0f, 0f, 100, default(Color), 2f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } - } - } -} \ No newline at end of file +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 EnhancedNanoRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nano Round"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { + for (int num136 = 0; num136 < 10; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Confused, 300); + if (target.life <= 0) + { + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < 2; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("Nanomachine"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + } + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93); + int num212 = Main.rand.Next(5, 10); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 229, 0f, 0f, 100, default(Color), 2f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } + } +} diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index 83a64dac0d..68e7099cd0 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class EssenceFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 50; - } - - public override void AI() - { - if (projectile.scale <= 1.5f) - { - projectile.scale *= 1.01f; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); - if (projectile.timeLeft > 50) - { - projectile.timeLeft = 50; - } - if (projectile.ai[0] > 5f) - { - float num296 = 1f; - if (projectile.ai[0] == 6f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 7f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 8f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 173; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - target.immune[projectile.owner] = 1; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class EssenceFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 50; + } + + public override void AI() + { + if (projectile.scale <= 1.5f) + { + projectile.scale *= 1.01f; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); + if (projectile.timeLeft > 50) + { + projectile.timeLeft = 50; + } + if (projectile.ai[0] > 5f) + { + float num296 = 1f; + if (projectile.ai[0] == 6f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 7f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 8f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 173; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + target.immune[projectile.owner] = 1; + } + } +} diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index 3617ed163a..9e244783d9 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -1,118 +1,118 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ExoFire : ModProjectile - { - public bool speedXChoice = false; - public bool speedYChoice = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.timeLeft = 300; - } - - public override void AI() - { - float speedX = 1f; - float speedY = 1f; - if (!speedXChoice) - { - speedX = (Main.rand.Next(2) == 0 ? 1.03f : 0.97f); - speedXChoice = true; - } - if (!speedYChoice) - { - speedY = (Main.rand.Next(2) == 0 ? 1.03f : 0.97f); - speedYChoice = true; - } - projectile.velocity.X *= speedX; - projectile.velocity.X *= speedY; - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = (Main.rand.Next(2) == 0 ? 107 : 234); - if (Main.rand.Next(4) == 0) - { - num297 = 269; - } - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 0.75f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].scale *= 1.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 1.2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 1.2f; - } - else - { - Main.dust[num299].scale *= 0.75f; - } - Main.dust[num299].noGravity = true; - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 0.8f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 0.8f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ExoFire : ModProjectile + { + public bool speedXChoice = false; + public bool speedYChoice = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.extraUpdates = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.timeLeft = 300; + } + + public override void AI() + { + float speedX = 1f; + float speedY = 1f; + if (!speedXChoice) + { + speedX = (Main.rand.Next(2) == 0 ? 1.03f : 0.97f); + speedXChoice = true; + } + if (!speedYChoice) + { + speedY = (Main.rand.Next(2) == 0 ? 1.03f : 0.97f); + speedYChoice = true; + } + projectile.velocity.X *= speedX; + projectile.velocity.X *= speedY; + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = (Main.rand.Next(2) == 0 ? 107 : 234); + if (Main.rand.Next(4) == 0) + { + num297 = 269; + } + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 0.75f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].scale *= 1.5f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 1.2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 1.2f; + } + else + { + Main.dust[num299].scale *= 0.75f; + } + Main.dust[num299].noGravity = true; + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 0.8f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 0.8f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + } +} diff --git a/Projectiles/Ranged/ExoMark.cs b/Projectiles/Ranged/ExoMark.cs index d163cfe918..d6df91b3ab 100644 --- a/Projectiles/Ranged/ExoMark.cs +++ b/Projectiles/Ranged/ExoMark.cs @@ -1,160 +1,160 @@ -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.Ranged -{ - public class ExoMark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); - } - if (projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 107, 0f, 0f, 0, default(Color), 0.5f)]; - dust34.position = position4; - dust34.customData = projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.localAI[1] > 103f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 16; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default(Vector2)); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) - { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("ExoTornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); - } - if (projectile.localAI[1] >= 120f) - { - projectile.Kill(); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0f, 3f, 0f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); - return false; - } - } -} \ No newline at end of file +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.Ranged +{ + public class ExoMark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.timeLeft = 900; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + for (int num1134 = 0; num1134 < 1; num1134++) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 107, 0f, 0f, 0, default(Color), 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default(Vector2)); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 107, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("ExoTornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0f, 3f, 0f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Ranged/ExoTornado.cs b/Projectiles/Ranged/ExoTornado.cs index 0324271034..001a784be2 100644 --- a/Projectiles/Ranged/ExoTornado.cs +++ b/Projectiles/Ranged/ExoTornado.cs @@ -1,154 +1,154 @@ -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.Ranged -{ - public class ExoTornado : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tornado"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; //1200 - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - float num1125 = 225f; //900 - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 122); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) - { - projectile.Kill(); - } - if (projectile.localAI[0] >= 30f) - { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) - { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; - } - } - float num1127 = 30f; //15 - float num1128 = 30f; //15 - Point point8 = projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) - { - bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) - { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) - { - flag74 = true; - break; - } - } - if (!flag74 && projectile.ai[0] < num1125 - 120f) - { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; - } - } - if (projectile.ai[0] < num1125 - 120f) - { - return; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - float num226 = 150f; //600 - float num227 = 30f; //15 - float num228 = 30f; //15 - float num229 = projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) - { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); - } - Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default(Vector2)); - float num234 = 0f; - float num235 = 5.1f; - Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(0, 250, 0); - for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) - { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default(Vector2)); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) - { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); - } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); - } - return false; - } - } -} \ No newline at end of file +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.Ranged +{ + public class ExoTornado : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tornado"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; //1200 + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + float num1125 = 225f; //900 + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 122); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= num1125) + { + projectile.Kill(); + } + if (projectile.localAI[0] >= 30f) + { + projectile.damage = 0; + if (projectile.ai[0] < num1125 - 120f) + { + float num1126 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1126; + projectile.netUpdate = true; + } + } + float num1127 = 30f; //15 + float num1128 = 30f; //15 + Point point8 = projectile.Center.ToTileCoordinates(); + int num1129; + int num1130; + Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); + num1129++; + num1130--; + Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); + Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); + Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); + Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); + value74.X = value74.Y * 0.2f; + projectile.width = (int)(value74.X * 0.65f); + projectile.height = (int)value74.Y; + projectile.Center = vector146; + if (projectile.owner == Main.myPlayer) + { + bool flag74 = false; + Vector2 center16 = Main.player[projectile.owner].Center; + Vector2 top = Main.player[projectile.owner].Top; + for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + { + Vector2 position2 = Vector2.Lerp(value72, value73, num1131); + if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + { + flag74 = true; + break; + } + } + if (!flag74 && projectile.ai[0] < num1125 - 120f) + { + float num1132 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1132; + projectile.netUpdate = true; + } + } + if (projectile.ai[0] < num1125 - 120f) + { + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + float num226 = 150f; //600 + float num227 = 30f; //15 + float num228 = 30f; //15 + float num229 = projectile.ai[0]; + float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); + if (num229 > num226 - 60f) + { + scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + } + Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); + int num230; + int num231; + Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); + num230++; + num231--; + float num232 = 0.2f; + Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); + Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); + Vector2.Lerp(value32, value33, 0.5f); + Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); + vector33.X = vector33.Y * num232; + new Vector2(value32.X - vector33.X / 2f, value32.Y); + Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); + Vector2 origin3 = rectangle9.Size() / 2f; + float num233 = -0.06283186f * num229; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default(Vector2)); + float num234 = 0f; + float num235 = 5.1f; + Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(0, 250, 0); + for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) + { + num234 += num235; + float num237 = num234 / vector33.Y; + float num238 = num234 * 6.28318548f / -20f; + float num239 = num237 - 0.15f; + Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default(Vector2)); + Vector2 value35 = new Vector2(0f, num237 + 1f); + value35.X = value35.Y * num232; + Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); + if (num237 > 0.5f) + { + color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + } + color39.A = (byte)((float)color39.A * 0.5f); + color39 *= scale5; + vector34 *= value35 * 100f; + vector34.Y = 0f; + vector34.X = 0f; + vector34 += new Vector2(value33.X, num236) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); + } + return false; + } + } +} diff --git a/Projectiles/Ranged/ExplodingStake.cs b/Projectiles/Ranged/ExplodingStake.cs index a389203446..bce19ee541 100644 --- a/Projectiles/Ranged/ExplodingStake.cs +++ b/Projectiles/Ranged/ExplodingStake.cs @@ -1,65 +1,65 @@ -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.Ranged -{ - public class ExplodingStake : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stake"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 8; - projectile.alpha = 255; - projectile.scale = 0.8f; - projectile.extraUpdates = 3; - projectile.aiStyle = 1; - aiType = 323; - } - - public override void AI() - { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.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) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.Stake); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - if (projectile.owner == Main.myPlayer) - { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[boom].GetGlobalProjectile(mod).forceRanged = true; - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class ExplodingStake : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stake"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 8; + projectile.alpha = 255; + projectile.scale = 0.8f; + projectile.extraUpdates = 3; + projectile.aiStyle = 1; + aiType = 323; + } + + public override void AI() + { + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.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) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.Stake); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + if (projectile.owner == Main.myPlayer) + { + int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[boom].GetGlobalProjectile(mod).forceRanged = true; + } + } + } +} diff --git a/Projectiles/Ranged/ExplosiveShellBullet.cs b/Projectiles/Ranged/ExplosiveShellBullet.cs index 2434a57d10..9fb8d25f13 100644 --- a/Projectiles/Ranged/ExplosiveShellBullet.cs +++ b/Projectiles/Ranged/ExplosiveShellBullet.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ExplosiveShellBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosive Shell Bullet"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage += target.lifeMax / 150; //120 + 30 = 150 + (100000 / 150 = 666) = 816 * 15 (pellets) = 12240 * 2 (explosion) = 24480 = 24.48% of boss HP - if (damage > target.lifeMax / 90 && CalamityPlayer.areThereAnyDamnBosses) - damage = target.lifeMax / 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ExplosiveShellBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosive Shell Bullet"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 10; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + damage += target.lifeMax / 150; //120 + 30 = 150 + (100000 / 150 = 666) = 816 * 15 (pellets) = 12240 * 2 (explosion) = 24480 = 24.48% of boss HP + if (damage > target.lifeMax / 90 && CalamityPlayer.areThereAnyDamnBosses) + damage = target.lifeMax / 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(); + } + } +} diff --git a/Projectiles/Ranged/Feather.cs b/Projectiles/Ranged/Feather.cs index 1f2d89d4ea..bbe2402c79 100644 --- a/Projectiles/Ranged/Feather.cs +++ b/Projectiles/Ranged/Feather.cs @@ -84,4 +84,4 @@ namespace CalamityMod.Projectiles.Ranged } } } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/FishronRPG.cs b/Projectiles/Ranged/FishronRPG.cs index 5fb3a4312c..b329f0affb 100644 --- a/Projectiles/Ranged/FishronRPG.cs +++ b/Projectiles/Ranged/FishronRPG.cs @@ -1,146 +1,146 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class FishronRPG : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("RPG"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 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 void Kill(int timeLeft) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MiniRocketExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 10; 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 < 20; 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FishronRPG : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("RPG"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 95; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + 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; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 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 void Kill(int timeLeft) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MiniRocketExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 10; 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 < 20; 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; + } + } + } +} diff --git a/Projectiles/Ranged/FlakKraken.cs b/Projectiles/Ranged/FlakKraken.cs index 7ab9898c8b..3163b21bee 100644 --- a/Projectiles/Ranged/FlakKraken.cs +++ b/Projectiles/Ranged/FlakKraken.cs @@ -1,149 +1,149 @@ -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.Ranged -{ - public class FlakKraken : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kraken"); - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.scale = 0.002f; - projectile.timeLeft = 36000; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - public override void AI() - { - if (projectile.type != mod.ProjectileType("FlakKraken") || - !Main.projectile[(int)projectile.ai[1]].active || - Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("FlakKrakenGun")) - { - projectile.Kill(); - return; - } - projectile.rotation += 0.2f; - if (projectile.localAI[0] < 1f) - { - projectile.localAI[0] += 0.002f; - projectile.scale += 0.002f; - projectile.width = (int)(50f * projectile.scale); - projectile.height = (int)(50f * projectile.scale); - } - else - { - projectile.width = 50; - projectile.height = 50; - } - Player player = Main.player[projectile.owner]; - 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; - } - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - } - vector2 += new Vector2(num78, num79); - /*if (projectile.localAI[0] >= 1f) - { - vector2.X -= 25f; - vector2.Y -= 25f; - }*/ - float speed = 30f; - float speedScale = 3f; - Vector2 vectorPos = projectile.Center; - if (Vector2.Distance(vector2, vectorPos) < 90f) - { - speed = 10f; - speedScale = 1f; - } - if (Vector2.Distance(vector2, vectorPos) < 30f) - { - speed = 3f; - speedScale = 0.3f; - } - if (Vector2.Distance(vector2, vectorPos) < 10f) - { - speed = 1f; - speedScale = 0.1f; - } - float num678 = vector2.X - vectorPos.X; - float num679 = vector2.Y - vectorPos.Y; - float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); - num680 = speed / num680; - num678 *= num680; - num679 *= num680; - if (projectile.velocity.X < num678) - { - projectile.velocity.X = projectile.velocity.X + speedScale; - if (projectile.velocity.X < 0f && num678 > 0f) - { - projectile.velocity.X = projectile.velocity.X + speedScale; - } - } - else if (projectile.velocity.X > num678) - { - projectile.velocity.X = projectile.velocity.X - speedScale; - if (projectile.velocity.X > 0f && num678 < 0f) - { - projectile.velocity.X = projectile.velocity.X - speedScale; - } - } - if (projectile.velocity.Y < num679) - { - projectile.velocity.Y = projectile.velocity.Y + speedScale; - if (projectile.velocity.Y < 0f && num679 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + speedScale; - } - } - else if (projectile.velocity.Y > num679) - { - projectile.velocity.Y = projectile.velocity.Y - speedScale; - if (projectile.velocity.Y > 0f && num679 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - speedScale; - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage = (int)((double)damage * (double)projectile.localAI[0]); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 200, 50, 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 +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.Ranged +{ + public class FlakKraken : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kraken"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.scale = 0.002f; + projectile.timeLeft = 36000; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + if (projectile.type != mod.ProjectileType("FlakKraken") || + !Main.projectile[(int)projectile.ai[1]].active || + Main.projectile[(int)projectile.ai[1]].type != mod.ProjectileType("FlakKrakenGun")) + { + projectile.Kill(); + return; + } + projectile.rotation += 0.2f; + if (projectile.localAI[0] < 1f) + { + projectile.localAI[0] += 0.002f; + projectile.scale += 0.002f; + projectile.width = (int)(50f * projectile.scale); + projectile.height = (int)(50f * projectile.scale); + } + else + { + projectile.width = 50; + projectile.height = 50; + } + Player player = Main.player[projectile.owner]; + 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; + } + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + } + vector2 += new Vector2(num78, num79); + /*if (projectile.localAI[0] >= 1f) + { + vector2.X -= 25f; + vector2.Y -= 25f; + }*/ + float speed = 30f; + float speedScale = 3f; + Vector2 vectorPos = projectile.Center; + if (Vector2.Distance(vector2, vectorPos) < 90f) + { + speed = 10f; + speedScale = 1f; + } + if (Vector2.Distance(vector2, vectorPos) < 30f) + { + speed = 3f; + speedScale = 0.3f; + } + if (Vector2.Distance(vector2, vectorPos) < 10f) + { + speed = 1f; + speedScale = 0.1f; + } + float num678 = vector2.X - vectorPos.X; + float num679 = vector2.Y - vectorPos.Y; + float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); + num680 = speed / num680; + num678 *= num680; + num679 *= num680; + if (projectile.velocity.X < num678) + { + projectile.velocity.X = projectile.velocity.X + speedScale; + if (projectile.velocity.X < 0f && num678 > 0f) + { + projectile.velocity.X = projectile.velocity.X + speedScale; + } + } + else if (projectile.velocity.X > num678) + { + projectile.velocity.X = projectile.velocity.X - speedScale; + if (projectile.velocity.X > 0f && num678 < 0f) + { + projectile.velocity.X = projectile.velocity.X - speedScale; + } + } + if (projectile.velocity.Y < num679) + { + projectile.velocity.Y = projectile.velocity.Y + speedScale; + if (projectile.velocity.Y < 0f && num679 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + speedScale; + } + } + else if (projectile.velocity.Y > num679) + { + projectile.velocity.Y = projectile.velocity.Y - speedScale; + if (projectile.velocity.Y > 0f && num679 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - speedScale; + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + damage = (int)((double)damage * (double)projectile.localAI[0]); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 200, 50, 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; + } + } +} diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs index 197ab1cc1b..8f2f023335 100644 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ b/Projectiles/Ranged/FlakKrakenGun.cs @@ -1,134 +1,134 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Enums; - -namespace CalamityMod.Projectiles.Ranged -{ - public class FlakKrakenGun : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flak Kraken"); - } - - public override void SetDefaults() - { - projectile.width = 140; - projectile.height = 44; - 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]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - float num26 = 30f; - if (projectile.ai[0] > 90f) - { - num26 = 15f; - } - if (projectile.ai[0] > 120f) - { - num26 = 5f; - } - projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.rangedDamage); - projectile.ai[0] += 1f; - projectile.ai[1] += 1f; - int num27 = 10; - bool flag10 = false; - if (projectile.ai[0] % num26 == 0f) - { - flag10 = true; - } - if (projectile.ai[1] >= 1f) - { - projectile.ai[1] = 0f; - flag10 = true; - if (Main.myPlayer == projectile.owner) - { - float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 value12 = vector; - Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; - if (player.gravDir == -1f) - { - value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; - } - Vector2 vector11 = Vector2.Normalize(value13); - if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) - { - vector11 = -Vector2.UnitY; - } - vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); //0.92 - vector11 *= scaleFactor5; - if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = vector11; - } - } - if (projectile.soundDelay <= 0) - { - projectile.soundDelay = num27; - projectile.soundDelay *= 2; - if (projectile.ai[0] != 1f && projectile.ai[0] <= 500f) - { - Main.PlaySound(SoundID.Item15, projectile.position); - } - } - if (flag10 && Main.myPlayer == projectile.owner) - { - bool flag12 = player.channel && !player.noItems && !player.CCed; - if (flag12) - { - if (projectile.ai[0] == 1f) - { - 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; - } - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - } - vector2 += new Vector2(num78, num79); - int num29 = projectile.damage; - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, mod.ProjectileType("FlakKraken"), num29, projectile.knockBack, projectile.owner, 0f, (float)projectile.whoAmI); - projectile.netUpdate = true; - } - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FlakKrakenGun : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flak Kraken"); + } + + public override void SetDefaults() + { + projectile.width = 140; + projectile.height = 44; + 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]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + float num26 = 30f; + if (projectile.ai[0] > 90f) + { + num26 = 15f; + } + if (projectile.ai[0] > 120f) + { + num26 = 5f; + } + projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.rangedDamage); + projectile.ai[0] += 1f; + projectile.ai[1] += 1f; + int num27 = 10; + bool flag10 = false; + if (projectile.ai[0] % num26 == 0f) + { + flag10 = true; + } + if (projectile.ai[1] >= 1f) + { + projectile.ai[1] = 0f; + flag10 = true; + if (Main.myPlayer == projectile.owner) + { + float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 value12 = vector; + Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; + if (player.gravDir == -1f) + { + value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; + } + Vector2 vector11 = Vector2.Normalize(value13); + if (float.IsNaN(vector11.X) || float.IsNaN(vector11.Y)) + { + vector11 = -Vector2.UnitY; + } + vector11 = Vector2.Normalize(Vector2.Lerp(vector11, Vector2.Normalize(projectile.velocity), 0.92f)); //0.92 + vector11 *= scaleFactor5; + if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector11; + } + } + if (projectile.soundDelay <= 0) + { + projectile.soundDelay = num27; + projectile.soundDelay *= 2; + if (projectile.ai[0] != 1f && projectile.ai[0] <= 500f) + { + Main.PlaySound(SoundID.Item15, projectile.position); + } + } + if (flag10 && Main.myPlayer == projectile.owner) + { + bool flag12 = player.channel && !player.noItems && !player.CCed; + if (flag12) + { + if (projectile.ai[0] == 1f) + { + 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; + } + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + } + vector2 += new Vector2(num78, num79); + int num29 = projectile.damage; + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, mod.ProjectileType("FlakKraken"), num29, projectile.knockBack, projectile.owner, 0f, (float)projectile.whoAmI); + projectile.netUpdate = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + } +} diff --git a/Projectiles/Ranged/FlamingStake.cs b/Projectiles/Ranged/FlamingStake.cs index f9a3832d35..0dae2c637d 100644 --- a/Projectiles/Ranged/FlamingStake.cs +++ b/Projectiles/Ranged/FlamingStake.cs @@ -1,60 +1,60 @@ -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.Ranged -{ - public class FlamingStake : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stake"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 10; - projectile.alpha = 255; - projectile.extraUpdates = 3; - projectile.aiStyle = 1; - aiType = 323; - } - - public override void AI() - { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.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) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.Stake); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(BuffID.OnFire, 300); - } - } -} \ No newline at end of file +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.Ranged +{ + public class FlamingStake : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stake"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 10; + projectile.alpha = 255; + projectile.extraUpdates = 3; + projectile.aiStyle = 1; + aiType = 323; + } + + public override void AI() + { + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.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) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ItemID.Stake); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index 261e5ab185..1aae64c3de 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -1,121 +1,121 @@ -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.Ranged -{ - public class FlareBat : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bat"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.light = 0.25f; - } - - public override void AI() - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } - int num192 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 0, default(Color), 1f); - Main.dust[num192].noGravity = true; - Main.dust[num192].velocity *= 0.2f; - Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; - projectile.frameCounter++; - if (projectile.frameCounter >= 2) - { - projectile.frameCounter = 0; - projectile.frame++; - if (projectile.frame >= 5) - { - projectile.frame = 0; - } - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } - - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - projectile.Kill(); - } - - 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) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class FlareBat : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bat"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + projectile.light = 0.25f; + } + + public override void AI() + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } + } + int num192 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 0, default(Color), 1f); + Main.dust[num192].noGravity = true; + Main.dust[num192].velocity *= 0.2f; + Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; + projectile.frameCounter++; + if (projectile.frameCounter >= 2) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame >= 5) + { + projectile.frame = 0; + } + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.Kill(); + } + + 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) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index e42de891a7..888455bb4f 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Flash : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flash"); - } - - public override void SetDefaults() - { - projectile.width = 200; - projectile.height = 200; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 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(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - 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, 264, 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Confused, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Flash : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flash"); + } + + public override void SetDefaults() + { + projectile.width = 200; + projectile.height = 200; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 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(-30, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + 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, 264, 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Confused, 300); + } + } +} diff --git a/Projectiles/Ranged/FlashBullet.cs b/Projectiles/Ranged/FlashBullet.cs index 31147f0367..2c9836140b 100644 --- a/Projectiles/Ranged/FlashBullet.cs +++ b/Projectiles/Ranged/FlashBullet.cs @@ -1,77 +1,77 @@ -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 FlashBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 264, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Flash"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 264, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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 FlashBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { + for (int num136 = 0; num136 < 10; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 264, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Flash"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + } + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 264, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Ranged/FossilShard.cs b/Projectiles/Ranged/FossilShard.cs index 09450be5f8..8886f215f0 100644 --- a/Projectiles/Ranged/FossilShard.cs +++ b/Projectiles/Ranged/FossilShard.cs @@ -1,47 +1,47 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class FossilShard : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shard"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 120; - aiType = 1; - } - - public override void AI() - { - projectile.rotation += projectile.velocity.Y; - projectile.velocity.Y *= 1.05f; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 60); - } - - public override void Kill(int timeLeft) - { - for (int i = 0; i <= 2; i++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FossilShard : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shard"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + projectile.timeLeft = 120; + aiType = 1; + } + + public override void AI() + { + projectile.rotation += projectile.velocity.Y; + projectile.velocity.Y *= 1.05f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 60); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Ranged/FrostsparkBullet.cs b/Projectiles/Ranged/FrostsparkBullet.cs index 7f9b7d6051..2f6cc06f57 100644 --- a/Projectiles/Ranged/FrostsparkBullet.cs +++ b/Projectiles/Ranged/FrostsparkBullet.cs @@ -1,102 +1,102 @@ -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 FrostsparkBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 4f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 67; - } - else - { - dustType = 6; - } - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, dustType, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Frostburn, 240); - target.AddBuff(mod.BuffType("GlacialState"), 120); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BoltExplosion"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - int num212 = Main.rand.Next(10, 20); - for (int num213 = 0; num213 < num212; num213++) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 67; - } - else - { - dustType = 6; - } - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, dustType, 0f, 0f, 100, default(Color), 2f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } - } - } -} \ No newline at end of file +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 FrostsparkBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 4f) + { + for (int num136 = 0; num136 < 10; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 67; + } + else + { + dustType = 6; + } + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, dustType, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BoltExplosion"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + int num212 = Main.rand.Next(10, 20); + for (int num213 = 0; num213 < num212; num213++) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = 67; + } + else + { + dustType = 6; + } + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, dustType, 0f, 0f, 100, default(Color), 2f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } + } +} diff --git a/Projectiles/Ranged/FungiOrb.cs b/Projectiles/Ranged/FungiOrb.cs index 3c06db82ea..03e24b76f2 100644 --- a/Projectiles/Ranged/FungiOrb.cs +++ b/Projectiles/Ranged/FungiOrb.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class FungiOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - } - - 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, 56, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void Kill(int timeLeft) - { - int num251 = Main.rand.Next(2, 5); - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("FungiOrb2"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FungiOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + } + + 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, 56, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void Kill(int timeLeft) + { + int num251 = Main.rand.Next(2, 5); + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("FungiOrb2"), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Ranged/FungiOrb2.cs b/Projectiles/Ranged/FungiOrb2.cs index 2e1c60d0cd..61f997c028 100644 --- a/Projectiles/Ranged/FungiOrb2.cs +++ b/Projectiles/Ranged/FungiOrb2.cs @@ -1,49 +1,49 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class FungiOrb2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - projectile.velocity.Y += 0.1f; - projectile.velocity.X *= 0.95f; - 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, 56, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void Kill(int timeLeft) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FungiOrb2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + projectile.velocity.Y += 0.1f; + projectile.velocity.X *= 0.95f; + 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, 56, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void Kill(int timeLeft) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } +} diff --git a/Projectiles/Ranged/GoliathExplosion.cs b/Projectiles/Ranged/GoliathExplosion.cs index b8d9de7155..fc60a3584f 100644 --- a/Projectiles/Ranged/GoliathExplosion.cs +++ b/Projectiles/Ranged/GoliathExplosion.cs @@ -1,29 +1,29 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class GoliathExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 160; - projectile.height = 160; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class GoliathExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 160; + projectile.height = 160; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + } +} diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index 6af3df9c96..62fa2362b5 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -1,201 +1,201 @@ -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.Ranged -{ - public class GoliathRocket : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rocket"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 1.1f; - } - else if (Main.rand.Next(2) == 0) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - } - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - projectile.ai[0] = 10f; - 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; - } - } - - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GoliathExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int num516 = 2; - for (int num517 = 0; num517 < num516; num517++) - { - if (num517 % 2 != 1 || Main.rand.Next(3) == 0) - { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - 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), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; - } - } - } - 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 = 160; - projectile.height = 160; - 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 < 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, 6, 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"), 300); - } - } -} \ No newline at end of file +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.Ranged +{ + public class GoliathRocket : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rocket"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 95; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 1.1f; + } + else if (Main.rand.Next(2) == 0) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + } + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + { + projectile.ai[0] = 10f; + 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; + } + } + + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GoliathExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int num516 = 2; + for (int num517 = 0; num517 < num516; num517++) + { + if (num517 % 2 != 1 || Main.rand.Next(3) == 0) + { + Vector2 value20 = projectile.position; + Vector2 value21 = projectile.oldVelocity; + value21.Normalize(); + value21 *= 8f; + float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; + value20 -= value21 * (float)num517; + 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), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + Main.projectile[num520].penetrate = 2; + Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; + } + } + } + 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 = 160; + projectile.height = 160; + 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 < 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, 6, 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"), 300); + } + } +} diff --git a/Projectiles/Ranged/GreenExoArrow.cs b/Projectiles/Ranged/GreenExoArrow.cs index 017e36b143..442f5ad0e4 100644 --- a/Projectiles/Ranged/GreenExoArrow.cs +++ b/Projectiles/Ranged/GreenExoArrow.cs @@ -1,120 +1,120 @@ -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.Ranged -{ - public class GreenExoArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 1f, 0f); - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 250, 0, projectile.alpha); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ExoMark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class GreenExoArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.timeLeft = 300; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 1f, 0f); + float num55 = 50f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 250, 0, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 50f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ExoMark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index 5aa6171357..b6af627200 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -1,201 +1,201 @@ -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.Ranged -{ - public class HiveBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 1.1f; - } - else if (Main.rand.Next(2) == 0) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - } - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - projectile.ai[0] = 10f; - 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; - } - } - - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int num516 = 6; - for (int num517 = 0; num517 < num516; num517++) - { - if (num517 % 2 != 1 || Main.rand.Next(3) == 0) - { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - 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 / 3), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; - } - } - } - 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 = 60; - 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 num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.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 < 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, 89, 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"), 900); - } - } -} \ No newline at end of file +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.Ranged +{ + public class HiveBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 95; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 1.1f; + } + else if (Main.rand.Next(2) == 0) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + } + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + { + projectile.ai[0] = 10f; + 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; + } + } + + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int num516 = 6; + for (int num517 = 0; num517 < num516; num517++) + { + if (num517 % 2 != 1 || Main.rand.Next(3) == 0) + { + Vector2 value20 = projectile.position; + Vector2 value21 = projectile.oldVelocity; + value21.Normalize(); + value21 *= 8f; + float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; + value20 -= value21 * (float)num517; + 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 / 3), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + Main.projectile[num520].penetrate = 2; + Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; + } + } + } + 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 = 60; + 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 num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.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 < 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, 89, 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"), 900); + } + } +} diff --git a/Projectiles/Ranged/HiveBombExplosion.cs b/Projectiles/Ranged/HiveBombExplosion.cs index 577070bb04..a30d92947f 100644 --- a/Projectiles/Ranged/HiveBombExplosion.cs +++ b/Projectiles/Ranged/HiveBombExplosion.cs @@ -1,34 +1,34 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class HiveBombExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HiveBombExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 600); + } + } +} diff --git a/Projectiles/Ranged/HiveExplosion.cs b/Projectiles/Ranged/HiveExplosion.cs index 18e74dd6db..3ec0b4b695 100644 --- a/Projectiles/Ranged/HiveExplosion.cs +++ b/Projectiles/Ranged/HiveExplosion.cs @@ -1,29 +1,29 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class HiveExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 80; - projectile.height = 80; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HiveExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 80; + projectile.height = 80; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + } +} diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 5c103a501b..ec364af36c 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -1,197 +1,197 @@ -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.Ranged -{ - public class HiveMissile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.scale = 0.75f; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 1.5f; - } - else if (Main.rand.Next(2) == 0) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - } - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - projectile.ai[0] = 10f; - 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; - } - } - - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int num516 = 3; - for (int num517 = 0; num517 < num516; num517++) - { - if (num517 % 2 != 1 || Main.rand.Next(3) == 0) - { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - 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].penetrate = 2; - Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; - } - } - } - 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 = 80; - projectile.height = 80; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 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, 90, 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, 90, 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; - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class HiveMissile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.scale = 0.75f; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 95; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 1.5f; + } + else if (Main.rand.Next(2) == 0) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + } + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + { + projectile.ai[0] = 10f; + 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; + } + } + + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HiveExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int num516 = 3; + for (int num517 = 0; num517 < num516; num517++) + { + if (num517 % 2 != 1 || Main.rand.Next(3) == 0) + { + Vector2 value20 = projectile.position; + Vector2 value21 = projectile.oldVelocity; + value21.Normalize(); + value21 *= 8f; + float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; + value20 -= value21 * (float)num517; + 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].penetrate = 2; + Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; + } + } + } + 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 = 80; + projectile.height = 80; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 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, 90, 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, 90, 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; + } + } + } +} diff --git a/Projectiles/Ranged/HolyFireBullet.cs b/Projectiles/Ranged/HolyFireBullet.cs index a4eb8894c8..27aca0ed34 100644 --- a/Projectiles/Ranged/HolyFireBullet.cs +++ b/Projectiles/Ranged/HolyFireBullet.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class HolyFireBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.extraUpdates = 5; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ranged = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.65f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 4f) - { - for (int num92 = 0; num92 < 2; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 244, 0f, 0f, 100, default(Color), 2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; - } - if (Main.rand.Next(10) == 0) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 244, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - 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); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HolyFireBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.extraUpdates = 5; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ranged = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.65f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 4f) + { + for (int num92 = 0; num92 < 2; num92++) + { + float num93 = projectile.velocity.X / 3f * (float)num92; + float num94 = projectile.velocity.Y / 3f * (float)num92; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 244, 0f, 0f, 100, default(Color), 2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + } + if (Main.rand.Next(10) == 0) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 244, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + 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); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } +} diff --git a/Projectiles/Ranged/HyperiusBullet.cs b/Projectiles/Ranged/HyperiusBullet.cs index 1dd389171f..96ca11037d 100644 --- a/Projectiles/Ranged/HyperiusBullet.cs +++ b/Projectiles/Ranged/HyperiusBullet.cs @@ -1,97 +1,97 @@ -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 HyperiusBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - for (int num136 = 0; num136 < 3; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 235, 0f, 0f, 0, default(Color), 0.75f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir= (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("OMGWTH"), (int)((double)projectile.damage * 0.8), 1f, projectile.owner); - } - } - } -} \ No newline at end of file +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 HyperiusBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { + for (int num136 = 0; num136 < 3; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 235, 0f, 0f, 0, default(Color), 0.75f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + float xPos = (Main.rand.Next(2) == 0 ? projectile.position.X + 800 : projectile.position.X - 800); + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir= (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (speedX > 15f) + { + speedX = 15f; + } + if (speedX < -15f) + { + speedX = -15f; + } + if (speedY > 15f) + { + speedY = 15f; + } + if (speedY < -15f) + { + speedY = -15f; + } + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, mod.ProjectileType("OMGWTH"), (int)((double)projectile.damage * 0.8), 1f, projectile.owner); + } + } + } +} diff --git a/Projectiles/Ranged/LeafArrow.cs b/Projectiles/Ranged/LeafArrow.cs index 84859f0722..fdd47e98ec 100644 --- a/Projectiles/Ranged/LeafArrow.cs +++ b/Projectiles/Ranged/LeafArrow.cs @@ -1,88 +1,88 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class LeafArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.light = 0.1f; - } - - public override void AI() - { - projectile.alpha -= 2; - projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; - projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) - { - projectile.localAI[0] = 0f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 3.14f; - if (projectile.localAI[1] <= 30f) - { - projectile.localAI[1] += 1f; - projectile.velocity.Y *= 0.975f; - projectile.velocity.X *= 0.975f; - } - else if (projectile.localAI[1] <= 60f) - { - projectile.localAI[1] += 1f; - projectile.velocity.Y *= 1.025f; - projectile.velocity.X *= 1.025f; - } - else - { - projectile.localAI[1] = 0f; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(6, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - projectile.localAI[1] += 1f; - for (int num407 = 0; num407 < 5; num407++) - { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 3f; - Main.dust[num408].scale = 1.5f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class LeafArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + projectile.ranged = true; + projectile.light = 0.1f; + } + + public override void AI() + { + projectile.alpha -= 2; + projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; + projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.05f; + if ((double)projectile.scale > 1.2) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.scale -= 0.05f; + if ((double)projectile.scale < 0.8) + { + projectile.localAI[0] = 0f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 3.14f; + if (projectile.localAI[1] <= 30f) + { + projectile.localAI[1] += 1f; + projectile.velocity.Y *= 0.975f; + projectile.velocity.X *= 0.975f; + } + else if (projectile.localAI[1] <= 60f) + { + projectile.localAI[1] += 1f; + projectile.velocity.Y *= 1.025f; + projectile.velocity.X *= 1.025f; + } + else + { + projectile.localAI[1] = 0f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 203, 103, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(6, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + projectile.localAI[1] += 1f; + for (int num407 = 0; num407 < 5; num407++) + { + int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num408].noGravity = true; + Main.dust[num408].velocity *= 3f; + Main.dust[num408].scale = 1.5f; + } + } + } +} diff --git a/Projectiles/Ranged/LunarBolt.cs b/Projectiles/Ranged/LunarBolt.cs index d8d8af450c..f720349a5f 100644 --- a/Projectiles/Ranged/LunarBolt.cs +++ b/Projectiles/Ranged/LunarBolt.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class LunarBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.scale = 1.25f; - projectile.friendly = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 180; - aiType = 357; - } - - public override void AI() - { - if (projectile.alpha < 170) - { - for (int num134 = 0; num134 < 10; num134++) - { - float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 15, 0f, 0f, 0, default(Color), 0.4f); - Main.dust[num135].alpha = projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity *= 0f; - Main.dust[num135].noGravity = true; - } - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class LunarBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.aiStyle = 1; + projectile.scale = 1.25f; + projectile.friendly = true; + projectile.ranged = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 180; + aiType = 357; + } + + public override void AI() + { + if (projectile.alpha < 170) + { + for (int num134 = 0; num134 < 10; num134++) + { + float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; + float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; + int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 15, 0f, 0f, 0, default(Color), 0.4f); + Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].position.X = x; + Main.dust[num135].position.Y = y; + Main.dust[num135].velocity *= 0f; + Main.dust[num135].noGravity = true; + } + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + return false; + } + } +} diff --git a/Projectiles/Ranged/LunarBolt2.cs b/Projectiles/Ranged/LunarBolt2.cs index 0f9aa89dfa..39f9bf7ece 100644 --- a/Projectiles/Ranged/LunarBolt2.cs +++ b/Projectiles/Ranged/LunarBolt2.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class LunarBolt2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.scale = 1.25f; - projectile.friendly = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 180; - aiType = 357; - } - - public override void AI() - { - if (projectile.alpha < 170) - { - for (int num134 = 0; num134 < 10; num134++) - { - float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 107, 0f, 0f, 0, default(Color), 0.2f); - Main.dust[num135].alpha = projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity *= 0f; - Main.dust[num135].noGravity = true; - } - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class LunarBolt2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.aiStyle = 1; + projectile.scale = 1.25f; + projectile.friendly = true; + projectile.ranged = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 180; + aiType = 357; + } + + public override void AI() + { + if (projectile.alpha < 170) + { + for (int num134 = 0; num134 < 10; num134++) + { + float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; + float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; + int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 107, 0f, 0f, 0, default(Color), 0.2f); + Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].position.X = x; + Main.dust[num135].position.Y = y; + Main.dust[num135].velocity *= 0f; + Main.dust[num135].noGravity = true; + } + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + return false; + } + } +} diff --git a/Projectiles/Ranged/MagnaStrike.cs b/Projectiles/Ranged/MagnaStrike.cs index f78b8b2b9b..f4c742314f 100644 --- a/Projectiles/Ranged/MagnaStrike.cs +++ b/Projectiles/Ranged/MagnaStrike.cs @@ -1,51 +1,51 @@ -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.Ranged -{ - public class MagnaStrike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Strike"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.scale = 0.5f; - projectile.alpha = 200; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.scale <= 1.5f) - { - projectile.scale *= 1.01f; - } - projectile.alpha -= 2; - if (projectile.alpha == 0) - { - projectile.alpha = 200; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 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; - } - } -} \ No newline at end of file +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.Ranged +{ + public class MagnaStrike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Strike"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.scale = 0.5f; + projectile.alpha = 200; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.scale <= 1.5f) + { + projectile.scale *= 1.01f; + } + projectile.alpha -= 2; + if (projectile.alpha == 0) + { + projectile.alpha = 200; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 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; + } + } +} diff --git a/Projectiles/Ranged/MechanicalBarracuda.cs b/Projectiles/Ranged/MechanicalBarracuda.cs index 03cd134b92..a2cd119070 100644 --- a/Projectiles/Ranged/MechanicalBarracuda.cs +++ b/Projectiles/Ranged/MechanicalBarracuda.cs @@ -1,31 +1,31 @@ -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.Ranged -{ - public class MechanicalBarracuda : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Barracuda"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.aiStyle = 39; - aiType = 190; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.ranged = true; - } - } -} \ No newline at end of file +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.Ranged +{ + public class MechanicalBarracuda : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Barracuda"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.friendly = true; + projectile.aiStyle = 39; + aiType = 190; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.ranged = true; + } + } +} diff --git a/Projectiles/Ranged/MeowFire.cs b/Projectiles/Ranged/MeowFire.cs index 769e1b3c74..53922f87cf 100644 --- a/Projectiles/Ranged/MeowFire.cs +++ b/Projectiles/Ranged/MeowFire.cs @@ -1,118 +1,118 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class MeowFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 56; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 57); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default(Color), 1.5f); - 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, 56, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - target.AddBuff(BuffID.Frostburn, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MeowFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 90; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 56; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 57); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 10; + projectile.height = 10; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 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; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default(Color), 1.5f); + 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, 56, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + target.AddBuff(BuffID.Frostburn, 180); + } + } +} diff --git a/Projectiles/Ranged/MeowFire2.cs b/Projectiles/Ranged/MeowFire2.cs index d05883232b..30f3f332d1 100644 --- a/Projectiles/Ranged/MeowFire2.cs +++ b/Projectiles/Ranged/MeowFire2.cs @@ -1,118 +1,118 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class MeowFire2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 73; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 58); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 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; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default(Color), 1.5f); - 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, 73, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - target.AddBuff(BuffID.OnFire, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MeowFire2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 90; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 73; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 58); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 10; + projectile.height = 10; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 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; + } + } + for (int num623 = 0; num623 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default(Color), 1.5f); + 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, 73, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + target.AddBuff(BuffID.OnFire, 180); + } + } +} diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index e96ddb46fb..844048a797 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -1,171 +1,171 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class MiniRocket : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rocket"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - 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; - return; - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MiniRocketExplosion"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - 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 = 20; - projectile.height = 20; - 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 < 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, 6, 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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MiniRocket : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rocket"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 95; + projectile.ranged = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + 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; + return; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MiniRocketExplosion"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + 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 = 20; + projectile.height = 20; + 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 < 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, 6, 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; + } + } + } +} diff --git a/Projectiles/Ranged/MiniRocketExplosion.cs b/Projectiles/Ranged/MiniRocketExplosion.cs index dd33e7b1ef..76af6ed023 100644 --- a/Projectiles/Ranged/MiniRocketExplosion.cs +++ b/Projectiles/Ranged/MiniRocketExplosion.cs @@ -1,29 +1,29 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class MiniRocketExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MiniRocketExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + } +} diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index 5235ce3ca3..965b0e2dee 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -1,57 +1,57 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class MistArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 300; - aiType = 1; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void Kill(int timeLeft) - { - 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, 240); - target.AddBuff(mod.BuffType("GlacialState"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MistArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + projectile.timeLeft = 300; + aiType = 1; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void Kill(int timeLeft) + { + 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, 240); + target.AddBuff(mod.BuffType("GlacialState"), 120); + } + } +} diff --git a/Projectiles/Ranged/MortarRound.cs b/Projectiles/Ranged/MortarRound.cs index 855ba98311..330cab54f3 100644 --- a/Projectiles/Ranged/MortarRound.cs +++ b/Projectiles/Ranged/MortarRound.cs @@ -1,228 +1,228 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Achievements; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class MortarRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mortar"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 150; - projectile.ranged = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - } - - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GoliathExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int num621 = 0; num621 < 40; 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; - } - if (projectile.owner == Main.myPlayer) - { - int num814 = 5; - int num815 = (int)(projectile.position.X / 16f - (float)num814); - int num816 = (int)(projectile.position.X / 16f + (float)num814); - int num817 = (int)(projectile.position.Y / 16f - (float)num814); - int num818 = (int)(projectile.position.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; - } - bool flag3 = false; - for (int num819 = num815; num819 <= num816; num819++) - { - for (int num820 = num817; num820 <= num818; num820++) - { - float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); - float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); - double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); - if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) - { - flag3 = true; - break; - } - } - } - AchievementsHelper.CurrentlyMining = true; - for (int num824 = num815; num824 <= num816; num824++) - { - for (int num825 = num817; num825 <= num818; num825++) - { - float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); - float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); - double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); - if (num828 < (double)num814) - { - if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active() && Main.tile[num824, num825].type != (ushort)mod.TileType("AbyssGravel")) - { - 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); - } - } - for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) - { - for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) - { - if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && Main.tile[num829, num830].wall != (byte)mod.WallType("AbyssGravelWall") && flag3) - { - WorldGen.KillWall(num829, num830, false); - if (Main.tile[num829, num830].wall == 0 && Main.netMode != 0) - { - NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); - } - } - } - } - } - } - } - AchievementsHelper.CurrentlyMining = false; - if (Main.netMode != 0) - { - NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); - } - if (!projectile.noDropItem) - { - int num831 = -1; - if (Main.netMode == 1 && num831 >= 0) - { - NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); - } - } - } - projectile.active = false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.GameContent.Achievements; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MortarRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mortar"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 150; + projectile.ranged = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + } + + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GoliathExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int num621 = 0; num621 < 40; 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; + } + if (projectile.owner == Main.myPlayer) + { + int num814 = 5; + int num815 = (int)(projectile.position.X / 16f - (float)num814); + int num816 = (int)(projectile.position.X / 16f + (float)num814); + int num817 = (int)(projectile.position.Y / 16f - (float)num814); + int num818 = (int)(projectile.position.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; + } + bool flag3 = false; + for (int num819 = num815; num819 <= num816; num819++) + { + for (int num820 = num817; num820 <= num818; num820++) + { + float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); + float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); + double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); + if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) + { + flag3 = true; + break; + } + } + } + AchievementsHelper.CurrentlyMining = true; + for (int num824 = num815; num824 <= num816; num824++) + { + for (int num825 = num817; num825 <= num818; num825++) + { + float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); + float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); + double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); + if (num828 < (double)num814) + { + if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active() && Main.tile[num824, num825].type != (ushort)mod.TileType("AbyssGravel")) + { + 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); + } + } + for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) + { + for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) + { + if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && Main.tile[num829, num830].wall != (byte)mod.WallType("AbyssGravelWall") && flag3) + { + WorldGen.KillWall(num829, num830, false); + if (Main.tile[num829, num830].wall == 0 && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); + } + } + } + } + } + } + } + AchievementsHelper.CurrentlyMining = false; + if (Main.netMode != 0) + { + NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); + } + if (!projectile.noDropItem) + { + int num831 = -1; + if (Main.netMode == 1 && num831 >= 0) + { + NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); + } + } + } + projectile.active = false; + } + } +} diff --git a/Projectiles/Ranged/Nanomachine.cs b/Projectiles/Ranged/Nanomachine.cs index 886f0929ce..a6ec5d101f 100644 --- a/Projectiles/Ranged/Nanomachine.cs +++ b/Projectiles/Ranged/Nanomachine.cs @@ -1,140 +1,140 @@ -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 Nanomachine : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void AI() - { - for (int num136 = 0; num136 < 3; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 800f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Confused, 180); - } - } -} \ No newline at end of file +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 Nanomachine : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void AI() + { + for (int num136 = 0; num136 < 3; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + float num140 = projectile.position.X; + float num141 = projectile.position.Y; + float num142 = 800f; + bool flag4 = false; + int num143 = 0; + if (projectile.ai[1] == 0f) + { + for (int num144 = 0; num144 < 200; num144++) + { + if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) + { + float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); + float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); + float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); + if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) + { + num142 = num147; + num140 = num145; + num141 = num146; + flag4 = true; + num143 = num144; + } + } + } + if (flag4) + { + projectile.ai[1] = (float)(num143 + 1); + } + flag4 = false; + } + if (projectile.ai[1] > 0f) + { + int num148 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) + { + float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); + if (num151 < 1000f) + { + flag4 = true; + num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + } + } + else + { + projectile.ai[1] = 0f; + } + } + if (!projectile.friendly) + { + flag4 = false; + } + if (flag4) + { + float num152 = num139; + Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num153 = num140 - vector13.X; + float num154 = num141 - vector13.Y; + float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); + num155 = num152 / num155; + num153 *= num155; + num154 *= num155; + int num156 = 12; + projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Confused, 180); + } + } +} diff --git a/Projectiles/Ranged/NapalmArrow.cs b/Projectiles/Ranged/NapalmArrow.cs index 973e413a4e..17b8b0fea1 100644 --- a/Projectiles/Ranged/NapalmArrow.cs +++ b/Projectiles/Ranged/NapalmArrow.cs @@ -1,117 +1,117 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class NapalmArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - 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; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - 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 = 30; - projectile.height = 30; - 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, 6, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; - } - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < 3; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, Main.rand.Next(400, 403), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class NapalmArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + 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; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + 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 = 30; + projectile.height = 30; + 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, 6, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; + } + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < 3; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, Main.rand.Next(400, 403), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Ranged/NebulaShot.cs b/Projectiles/Ranged/NebulaShot.cs index 90671b3e52..e726c0073f 100644 --- a/Projectiles/Ranged/NebulaShot.cs +++ b/Projectiles/Ranged/NebulaShot.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class NebulaShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shot"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); - } - if (projectile.ai[0] == 1f) - { - projectile.ranged = false; - projectile.melee = true; - } - else if (projectile.ai[0] == 2f) - { - projectile.ranged = false; - projectile.GetGlobalProjectile(mod).rogue = true; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 15; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.Next(3) == 0 ? 56 : 242), projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class NebulaShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shot"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 5; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + } + if (projectile.ai[0] == 1f) + { + projectile.ranged = false; + projectile.melee = true; + } + else if (projectile.ai[0] == 2f) + { + projectile.ranged = false; + projectile.GetGlobalProjectile(mod).rogue = true; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 15; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.Next(3) == 0 ? 56 : 242), projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; + dust4.velocity = Vector2.Zero; + dust4.position -= projectile.velocity / 5f * (float)num121; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } +} diff --git a/Projectiles/Ranged/Needler.cs b/Projectiles/Ranged/Needler.cs index 1709429faf..b07e51ab25 100644 --- a/Projectiles/Ranged/Needler.cs +++ b/Projectiles/Ranged/Needler.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Needler : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Needle"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.ranged = true; - projectile.extraUpdates = 2; - projectile.aiStyle = 93; - aiType = 514; - } - - public override void AI() - { - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, default(Color), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 1; - } - - public override void Kill(int timeLeft) - { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - 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, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Needler : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Needle"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.ranged = true; + projectile.extraUpdates = 2; + projectile.aiStyle = 93; + aiType = 514; + } + + public override void AI() + { + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, default(Color), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 1; + } + + public override void Kill(int timeLeft) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + 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, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Ranged/Norfleet.cs b/Projectiles/Ranged/Norfleet.cs index 44de90e164..f089a37b00 100644 --- a/Projectiles/Ranged/Norfleet.cs +++ b/Projectiles/Ranged/Norfleet.cs @@ -128,4 +128,4 @@ namespace CalamityMod.Projectiles.Ranged return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/NorfleetComet.cs b/Projectiles/Ranged/NorfleetComet.cs index ce2ae71348..5d46ca21a9 100644 --- a/Projectiles/Ranged/NorfleetComet.cs +++ b/Projectiles/Ranged/NorfleetComet.cs @@ -122,4 +122,4 @@ namespace CalamityMod.Projectiles.Ranged } } } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/NorfleetExplosion.cs b/Projectiles/Ranged/NorfleetExplosion.cs index 8b1b03d59f..6d736e245a 100644 --- a/Projectiles/Ranged/NorfleetExplosion.cs +++ b/Projectiles/Ranged/NorfleetExplosion.cs @@ -89,4 +89,4 @@ namespace CalamityMod.Projectiles.Ranged } } } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index 101716ae24..27d9912603 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -1,181 +1,181 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Nuke : ModProjectile - { - public int flarePowderTimer = 12; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nuke"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 125; - projectile.ranged = true; - } - - public override void AI() - { - flarePowderTimer--; - if (flarePowderTimer <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("DragonDust"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - } - flarePowderTimer = 12; - } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 1000; - projectile.height = 1000; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 30f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 4; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 24f; - 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; - return; - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("NukeExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - 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 = 400; - projectile.height = 400; - 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 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 10; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Nuke : ModProjectile + { + public int flarePowderTimer = 12; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nuke"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 125; + projectile.ranged = true; + } + + public override void AI() + { + flarePowderTimer--; + if (flarePowderTimer <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("DragonDust"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + } + flarePowderTimer = 12; + } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 1000; + projectile.height = 1000; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 30f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 4; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 24f; + 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; + return; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("NukeExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + 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 = 400; + projectile.height = 400; + 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 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 10; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(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; + } + } + } +} diff --git a/Projectiles/Ranged/NukeExplosion.cs b/Projectiles/Ranged/NukeExplosion.cs index 1db8ee8479..0074cdca6e 100644 --- a/Projectiles/Ranged/NukeExplosion.cs +++ b/Projectiles/Ranged/NukeExplosion.cs @@ -1,31 +1,31 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class NukeExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 200; - projectile.height = 200; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class NukeExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 200; + projectile.height = 200; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + } +} diff --git a/Projectiles/Ranged/NullShot.cs b/Projectiles/Ranged/NullShot.cs index 46fc718354..db8e390d49 100644 --- a/Projectiles/Ranged/NullShot.cs +++ b/Projectiles/Ranged/NullShot.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class NullShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Null"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.ranged = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) - { - for (int num134 = 0; num134 < 10; num134++) - { - float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default(Color), 2f); - Main.dust[num135].alpha = projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity *= 0f; - Main.dust[num135].noGravity = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - int nullBuff = Main.rand.Next(7); - if (!target.boss) - { - if (nullBuff == 0) - { - target.scale *= 2f; - } - else if (nullBuff == 1) - { - target.scale *= 0.5f; - } - else if (nullBuff == 2) - { - target.damage += 100; - } - else if (nullBuff == 3) - { - target.damage -= 100; - } - else if (nullBuff == 4) - { - target.knockBackResist = 0f; - } - else if (nullBuff == 5) - { - target.knockBackResist = 1f; - } - else if (nullBuff == 6) - { - target.defense += 10; - } - else - { - target.defense -= 10; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class NullShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Null"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + projectile.ranged = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 3f) + { + for (int num134 = 0; num134 < 10; num134++) + { + float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; + float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; + int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default(Color), 2f); + Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].position.X = x; + Main.dust[num135].position.Y = y; + Main.dust[num135].velocity *= 0f; + Main.dust[num135].noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + int nullBuff = Main.rand.Next(7); + if (!target.boss) + { + if (nullBuff == 0) + { + target.scale *= 2f; + } + else if (nullBuff == 1) + { + target.scale *= 0.5f; + } + else if (nullBuff == 2) + { + target.damage += 100; + } + else if (nullBuff == 3) + { + target.damage -= 100; + } + else if (nullBuff == 4) + { + target.knockBackResist = 0f; + } + else if (nullBuff == 5) + { + target.knockBackResist = 1f; + } + else if (nullBuff == 6) + { + target.defense += 10; + } + else + { + target.defense -= 10; + } + } + } + } +} diff --git a/Projectiles/Ranged/NullShot2.cs b/Projectiles/Ranged/NullShot2.cs index e248f02b07..46d982e353 100644 --- a/Projectiles/Ranged/NullShot2.cs +++ b/Projectiles/Ranged/NullShot2.cs @@ -1,99 +1,99 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class NullShot2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Null"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 120; - projectile.ranged = true; - projectile.extraUpdates = 1; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) - { - for (int num134 = 0; num134 < 10; num134++) - { - float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num135].alpha = projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity *= 0f; - Main.dust[num135].noGravity = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - int nullBuff = Main.rand.Next(10); - if (!target.boss) - { - if (nullBuff == 0) - { - target.scale *= 5f; - } - else if (nullBuff == 1) - { - target.scale *= 0.1f; - } - else if (nullBuff == 2) - { - target.damage += 500; - } - else if (nullBuff == 3) - { - target.damage -= 500; - } - else if (nullBuff == 4) - { - target.knockBackResist = 0f; - } - else if (nullBuff == 5) - { - target.knockBackResist = 1f; - } - else if (nullBuff == 6) - { - target.defense += 20; - } - else if (nullBuff == 7) - { - target.defense -= 20; - } - else if (nullBuff == 8) - { - target.velocity.Y = -30f; - } - else - { - target.velocity.X = (Main.rand.Next(2) == 0 ? 30f : -30f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class NullShot2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Null"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; + projectile.ranged = true; + projectile.extraUpdates = 1; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 3f) + { + for (int num134 = 0; num134 < 10; num134++) + { + float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; + float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; + int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].position.X = x; + Main.dust[num135].position.Y = y; + Main.dust[num135].velocity *= 0f; + Main.dust[num135].noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + int nullBuff = Main.rand.Next(10); + if (!target.boss) + { + if (nullBuff == 0) + { + target.scale *= 5f; + } + else if (nullBuff == 1) + { + target.scale *= 0.1f; + } + else if (nullBuff == 2) + { + target.damage += 500; + } + else if (nullBuff == 3) + { + target.damage -= 500; + } + else if (nullBuff == 4) + { + target.knockBackResist = 0f; + } + else if (nullBuff == 5) + { + target.knockBackResist = 1f; + } + else if (nullBuff == 6) + { + target.defense += 20; + } + else if (nullBuff == 7) + { + target.defense -= 20; + } + else if (nullBuff == 8) + { + target.velocity.Y = -30f; + } + else + { + target.velocity.X = (Main.rand.Next(2) == 0 ? 30f : -30f); + } + } + } + } +} diff --git a/Projectiles/Ranged/OMGWTH.cs b/Projectiles/Ranged/OMGWTH.cs index c6d9a0313f..e2f79d2903 100644 --- a/Projectiles/Ranged/OMGWTH.cs +++ b/Projectiles/Ranged/OMGWTH.cs @@ -1,61 +1,61 @@ -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 OMGWTH : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("WTH"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 360; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - for (int num136 = 0; num136 < 3; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 235, 0f, 0f, 0, default(Color), 0.75f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - } -} \ No newline at end of file +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 OMGWTH : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("WTH"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 360; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + for (int num136 = 0; num136 < 3; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 235, 0f, 0f, 0, default(Color), 0.75f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + } +} diff --git a/Projectiles/Ranged/OnyxExplosion.cs b/Projectiles/Ranged/OnyxExplosion.cs index 3507c042fc..5ce8b00410 100644 --- a/Projectiles/Ranged/OnyxExplosion.cs +++ b/Projectiles/Ranged/OnyxExplosion.cs @@ -1,29 +1,29 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class OnyxExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 3; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class OnyxExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 3; + } + } +} diff --git a/Projectiles/Ranged/OnyxSharkBomb.cs b/Projectiles/Ranged/OnyxSharkBomb.cs index fbba5aae64..e8e5b09923 100644 --- a/Projectiles/Ranged/OnyxSharkBomb.cs +++ b/Projectiles/Ranged/OnyxSharkBomb.cs @@ -1,85 +1,85 @@ -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.Ranged -{ - public class OnyxSharkBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shark"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 109, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 159, 0f, 0f, 100, default(Color), 0.25f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - - 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++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 109, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("OnyxExplosion"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 2; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandyWaifuShark"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandyWaifuShark"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class OnyxSharkBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shark"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.ranged = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 109, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 159, 0f, 0f, 100, default(Color), 0.25f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + + 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++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 109, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, mod.ProjectileType("OnyxExplosion"), (int)((double)projectile.damage), projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 2; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandyWaifuShark"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("SandyWaifuShark"), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Ranged/OpalStrike.cs b/Projectiles/Ranged/OpalStrike.cs index ce4280f9ca..cd630cda30 100644 --- a/Projectiles/Ranged/OpalStrike.cs +++ b/Projectiles/Ranged/OpalStrike.cs @@ -1,51 +1,51 @@ -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.Ranged -{ - public class OpalStrike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Strike"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.scale = 0.5f; - projectile.alpha = 200; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.scale <= 1.5f) - { - projectile.scale *= 1.01f; - } - projectile.alpha -= 2; - if (projectile.alpha == 0) - { - projectile.alpha = 200; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 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; - } - } -} \ No newline at end of file +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.Ranged +{ + public class OpalStrike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Strike"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.scale = 0.5f; + projectile.alpha = 200; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.scale <= 1.5f) + { + projectile.scale *= 1.01f; + } + projectile.alpha -= 2; + if (projectile.alpha == 0) + { + projectile.alpha = 200; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 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; + } + } +} diff --git a/Projectiles/Ranged/OrangeExoArrow.cs b/Projectiles/Ranged/OrangeExoArrow.cs index 8487fbbbb1..9b93e47f7a 100644 --- a/Projectiles/Ranged/OrangeExoArrow.cs +++ b/Projectiles/Ranged/OrangeExoArrow.cs @@ -1,146 +1,146 @@ -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.Ranged -{ - public class OrangeExoArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.7f, 0.3f, 0f); - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 100, 0, projectile.alpha); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 1f, 0f); - int num226 = 36; - 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 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, 55, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - 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), 1f); - } - 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), 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, 55, 0f, 0f, 50, default(Color), 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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.Ranged +{ + public class OrangeExoArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.timeLeft = 300; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.7f, 0.3f, 0f); + float num55 = 50f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 100, 0, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 50f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 1f, 0f); + int num226 = 36; + 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 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, 55, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + 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), 1f); + } + 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), 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, 55, 0f, 0f, 50, default(Color), 1f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Ranged/Phangasm.cs b/Projectiles/Ranged/Phangasm.cs index c8ac27009c..232b0713b7 100644 --- a/Projectiles/Ranged/Phangasm.cs +++ b/Projectiles/Ranged/Phangasm.cs @@ -1,133 +1,133 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Phangasm : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phangasm"); - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 82; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - projectile.ai[0] += 1f; - int num39 = 0; - if (projectile.ai[0] >= 90f) - { - num39++; - } - if (projectile.ai[0] >= 180f) - { - num39++; - } - if (projectile.ai[0] >= 270f) - { - num39++; - } - int num40 = 24; - int num41 = 2; - projectile.ai[1] -= 1f; - bool flag15 = false; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; - int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); - } - bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - if (projectile.soundDelay <= 0 && flag16) - { - projectile.soundDelay = num40 - num41 * num39; - if (projectile.ai[0] != 1f) - { - Main.PlaySound(SoundID.Item5, projectile.position); - } - projectile.localAI[0] = 12f; - } - player.phantasmTime = 2; - if (flag15 && Main.myPlayer == projectile.owner) - { - int num42 = 14; - float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; - if (flag16) - { - player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); - weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); - float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; - if (player.gravDir == -1f) - { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; - } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) - { - value19 = -Vector2.UnitY; - } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) - { - projectile.netUpdate = true; - } - projectile.velocity = value19 * 0.55f; - for (int num43 = 0; num43 < 10; num43++) - { - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) - { - vector20 = -Vector2.UnitY; - } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); - Main.projectile[num44].noDropItem = true; - } - } - else - { - projectile.Kill(); - } - } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; - 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Phangasm : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phangasm"); + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 82; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + projectile.ai[0] += 1f; + int num39 = 0; + if (projectile.ai[0] >= 90f) + { + num39++; + } + if (projectile.ai[0] >= 180f) + { + num39++; + } + if (projectile.ai[0] >= 270f) + { + num39++; + } + int num40 = 24; + int num41 = 2; + projectile.ai[1] -= 1f; + bool flag15 = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = (float)(num40 - num41 * num39); + flag15 = true; + int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39); + } + bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + if (projectile.soundDelay <= 0 && flag16) + { + projectile.soundDelay = num40 - num41 * num39; + if (projectile.ai[0] != 1f) + { + Main.PlaySound(SoundID.Item5, projectile.position); + } + projectile.localAI[0] = 12f; + } + player.phantasmTime = 2; + if (flag15 && Main.myPlayer == projectile.owner) + { + int num42 = 14; + float scaleFactor11 = 14f; + int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float weaponKnockback2 = player.inventory[player.selectedItem].knockBack; + if (flag16) + { + player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); + weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2); + float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 vector19 = vector; + Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + if (player.gravDir == -1f) + { + value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + } + Vector2 value19 = Vector2.Normalize(value18); + if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + { + value19 = -Vector2.UnitY; + } + value19 *= scaleFactor12; + if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = value19 * 0.55f; + for (int num43 = 0; num43 < 10; num43++) + { + Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + { + vector20 = -Vector2.UnitY; + } + Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); + int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + Main.projectile[num44].noDropItem = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + } +} diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index e4dceabd99..0afdbf9ae2 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -1,56 +1,56 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class PlagueArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 600; - aiType = 1; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueExplosionFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int num516 = 6; - for (int num517 = 0; num517 < num516; num517++) - { - if (num517 % 2 != 1 || Main.rand.Next(3) == 0) - { - Vector2 value20 = projectile.position; - Vector2 value21 = projectile.oldVelocity; - value21.Normalize(); - value21 *= 8f; - float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; - float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; - value20 -= value21 * (float)num517; - 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].GetGlobalProjectile(mod).forceRanged = true; - Main.projectile[num520].penetrate = 2; - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class PlagueArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + projectile.timeLeft = 600; + aiType = 1; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlagueExplosionFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int num516 = 6; + for (int num517 = 0; num517 < num516; num517++) + { + if (num517 % 2 != 1 || Main.rand.Next(3) == 0) + { + Vector2 value20 = projectile.position; + Vector2 value21 = projectile.oldVelocity; + value21.Normalize(); + value21 *= 8f; + float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; + float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; + value20 -= value21 * (float)num517; + 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].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[num520].penetrate = 2; + } + } + } + } + } +} diff --git a/Projectiles/Ranged/PlagueExplosionFriendly.cs b/Projectiles/Ranged/PlagueExplosionFriendly.cs index 8b75d70754..9459bad71d 100644 --- a/Projectiles/Ranged/PlagueExplosionFriendly.cs +++ b/Projectiles/Ranged/PlagueExplosionFriendly.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class PlagueExplosionFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default(Color), 0.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class PlagueExplosionFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 60; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default(Color), 0.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 120); + } + } +} diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index 1a8e09b242..f56a2e05e3 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -1,120 +1,120 @@ -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; - -namespace CalamityMod.Projectiles.Ranged -{ - public class PlasmaBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 150; - projectile.friendly = true; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ignoreWater = true; - aiType = 503; - } - - public override void AI() - { - if (projectile.Center.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 20 + Main.rand.Next(40); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 12f) - { - 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, 221, 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, 221, 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 (Main.rand.Next(48) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.Next(10) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); - } - 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); - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); - } - - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlasmaExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.Projectiles.Ranged +{ + public class PlasmaBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.alpha = 150; + projectile.friendly = true; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ignoreWater = true; + aiType = 503; + } + + public override void AI() + { + if (projectile.Center.Y > projectile.ai[1]) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 12f) + { + 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, 221, 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, 221, 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 (Main.rand.Next(48) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + 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); + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); + } + + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlasmaExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 221, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Ranged/PlasmaExplosion.cs b/Projectiles/Ranged/PlasmaExplosion.cs index 9b0b0f5b4e..29b03192b9 100644 --- a/Projectiles/Ranged/PlasmaExplosion.cs +++ b/Projectiles/Ranged/PlasmaExplosion.cs @@ -1,99 +1,99 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class PlasmaExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 400; - projectile.height = 400; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93); - 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(-40, 41); - float num464 = (float)Main.rand.Next(-40, 41); - float num465 = (float)Main.rand.Next(12, 36); - 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, - (projectile.ai[1] == 1f ? 173 : 221), 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++; - } - return; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class PlasmaExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 400; + projectile.height = 400; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93); + 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(-40, 41); + float num464 = (float)Main.rand.Next(-40, 41); + float num465 = (float)Main.rand.Next(12, 36); + 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, + (projectile.ai[1] == 1f ? 173 : 221), 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++; + } + return; + } + } +} diff --git a/Projectiles/Ranged/ProBolt.cs b/Projectiles/Ranged/ProBolt.cs index d25c0a3847..5a1cb82d0f 100644 --- a/Projectiles/Ranged/ProBolt.cs +++ b/Projectiles/Ranged/ProBolt.cs @@ -1,73 +1,73 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ProBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.timeLeft = 600; - } - - public override void AI() - { - for (int num134 = 0; num134 < 10; num134++) - { - float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default(Color), 1.25f); - Main.dust[num135].alpha = projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity *= 0f; - Main.dust[num135].noGravity = true; - } - } - - 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; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 160, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); //206 160 226 - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ProBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.timeLeft = 600; + } + + public override void AI() + { + for (int num134 = 0; num134 < 10; num134++) + { + float x = projectile.position.X - projectile.velocity.X / 10f * (float)num134; + float y = projectile.position.Y - projectile.velocity.Y / 10f * (float)num134; + int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default(Color), 1.25f); + Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].position.X = x; + Main.dust[num135].position.Y = y; + Main.dust[num135].velocity *= 0f; + Main.dust[num135].noGravity = true; + } + } + + 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; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 160, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); //206 160 226 + } + } + } +} diff --git a/Projectiles/Ranged/RainbowBlast.cs b/Projectiles/Ranged/RainbowBlast.cs index 80664b2111..b1e63261f4 100644 --- a/Projectiles/Ranged/RainbowBlast.cs +++ b/Projectiles/Ranged/RainbowBlast.cs @@ -1,83 +1,83 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class RainbowBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.ranged = true; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 200f; - 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 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class RainbowBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.ranged = true; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 200f; + 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 = 18f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index 05e22401d6..71e122b88e 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -52,4 +52,4 @@ namespace CalamityMod.Projectiles.Ranged projectile.Damage(); } } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/RubberMortarRound.cs b/Projectiles/Ranged/RubberMortarRound.cs index 5431d02fb8..adb5b1c90f 100644 --- a/Projectiles/Ranged/RubberMortarRound.cs +++ b/Projectiles/Ranged/RubberMortarRound.cs @@ -1,389 +1,389 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Achievements; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class RubberMortarRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.ranged = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - } - - 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 bool OnTileCollide(Vector2 oldVelocity) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int num621 = 0; num621 < 40; 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; - } - if (projectile.owner == Main.myPlayer) - { - int num814 = 5; - int num815 = (int)(projectile.position.X / 16f - (float)num814); - int num816 = (int)(projectile.position.X / 16f + (float)num814); - int num817 = (int)(projectile.position.Y / 16f - (float)num814); - int num818 = (int)(projectile.position.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; - } - bool flag3 = false; - for (int num819 = num815; num819 <= num816; num819++) - { - for (int num820 = num817; num820 <= num818; num820++) - { - float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); - float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); - double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); - if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) - { - flag3 = true; - break; - } - } - } - AchievementsHelper.CurrentlyMining = true; - for (int num824 = num815; num824 <= num816; num824++) - { - for (int num825 = num817; num825 <= num818; num825++) - { - float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); - float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); - double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); - if (num828 < (double)num814) - { - if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active() && Main.tile[num824, num825].type != (ushort)mod.TileType("AbyssGravel")) - { - 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); - } - } - for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) - { - for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) - { - if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && Main.tile[num829, num830].wall != (byte)mod.WallType("AbyssGravelWall") && flag3) - { - WorldGen.KillWall(num829, num830, false); - if (Main.tile[num829, num830].wall == 0 && Main.netMode != 0) - { - NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); - } - } - } - } - } - } - } - AchievementsHelper.CurrentlyMining = false; - if (Main.netMode != 0) - { - NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); - } - if (!projectile.noDropItem) - { - int num831 = -1; - if (Main.netMode == 1 && num831 >= 0) - { - NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); - } - } - } - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - projectile.active = false; - } - 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; - } - projectile.velocity *= 1.25f; - } - return false; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int num621 = 0; num621 < 40; 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; - } - if (projectile.owner == Main.myPlayer) - { - int num814 = 5; - int num815 = (int)(projectile.position.X / 16f - (float)num814); - int num816 = (int)(projectile.position.X / 16f + (float)num814); - int num817 = (int)(projectile.position.Y / 16f - (float)num814); - int num818 = (int)(projectile.position.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; - } - bool flag3 = false; - for (int num819 = num815; num819 <= num816; num819++) - { - for (int num820 = num817; num820 <= num818; num820++) - { - float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); - float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); - double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); - if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) - { - flag3 = true; - break; - } - } - } - AchievementsHelper.CurrentlyMining = true; - for (int num824 = num815; num824 <= num816; num824++) - { - for (int num825 = num817; num825 <= num818; num825++) - { - float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); - float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); - double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); - if (num828 < (double)num814) - { - if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active()) - { - 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); - } - } - for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) - { - for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) - { - if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && flag3) - { - WorldGen.KillWall(num829, num830, false); - if (Main.tile[num829, num830].wall == 0 && Main.netMode != 0) - { - NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); - } - } - } - } - } - } - } - AchievementsHelper.CurrentlyMining = false; - if (Main.netMode != 0) - { - NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); - } - if (!projectile.noDropItem) - { - int num831 = -1; - if (Main.netMode == 1 && num831 >= 0) - { - NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.GameContent.Achievements; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class RubberMortarRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + projectile.ranged = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + } + + 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 bool OnTileCollide(Vector2 oldVelocity) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int num621 = 0; num621 < 40; 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; + } + if (projectile.owner == Main.myPlayer) + { + int num814 = 5; + int num815 = (int)(projectile.position.X / 16f - (float)num814); + int num816 = (int)(projectile.position.X / 16f + (float)num814); + int num817 = (int)(projectile.position.Y / 16f - (float)num814); + int num818 = (int)(projectile.position.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; + } + bool flag3 = false; + for (int num819 = num815; num819 <= num816; num819++) + { + for (int num820 = num817; num820 <= num818; num820++) + { + float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); + float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); + double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); + if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) + { + flag3 = true; + break; + } + } + } + AchievementsHelper.CurrentlyMining = true; + for (int num824 = num815; num824 <= num816; num824++) + { + for (int num825 = num817; num825 <= num818; num825++) + { + float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); + float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); + double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); + if (num828 < (double)num814) + { + if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active() && Main.tile[num824, num825].type != (ushort)mod.TileType("AbyssGravel")) + { + 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); + } + } + for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) + { + for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) + { + if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && Main.tile[num829, num830].wall != (byte)mod.WallType("AbyssGravelWall") && flag3) + { + WorldGen.KillWall(num829, num830, false); + if (Main.tile[num829, num830].wall == 0 && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); + } + } + } + } + } + } + } + AchievementsHelper.CurrentlyMining = false; + if (Main.netMode != 0) + { + NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); + } + if (!projectile.noDropItem) + { + int num831 = -1; + if (Main.netMode == 1 && num831 >= 0) + { + NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); + } + } + } + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + projectile.active = false; + } + 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; + } + projectile.velocity *= 1.25f; + } + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int num621 = 0; num621 < 40; 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; + } + if (projectile.owner == Main.myPlayer) + { + int num814 = 5; + int num815 = (int)(projectile.position.X / 16f - (float)num814); + int num816 = (int)(projectile.position.X / 16f + (float)num814); + int num817 = (int)(projectile.position.Y / 16f - (float)num814); + int num818 = (int)(projectile.position.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; + } + bool flag3 = false; + for (int num819 = num815; num819 <= num816; num819++) + { + for (int num820 = num817; num820 <= num818; num820++) + { + float num821 = Math.Abs((float)num819 - projectile.position.X / 16f); + float num822 = Math.Abs((float)num820 - projectile.position.Y / 16f); + double num823 = Math.Sqrt((double)(num821 * num821 + num822 * num822)); + if (num823 < (double)num814 && Main.tile[num819, num820] != null && Main.tile[num819, num820].wall == 0) + { + flag3 = true; + break; + } + } + } + AchievementsHelper.CurrentlyMining = true; + for (int num824 = num815; num824 <= num816; num824++) + { + for (int num825 = num817; num825 <= num818; num825++) + { + float num826 = Math.Abs((float)num824 - projectile.position.X / 16f); + float num827 = Math.Abs((float)num825 - projectile.position.Y / 16f); + double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); + if (num828 < (double)num814) + { + if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active()) + { + 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); + } + } + for (int num829 = num824 - 1; num829 <= num824 + 1; num829++) + { + for (int num830 = num825 - 1; num830 <= num825 + 1; num830++) + { + if (Main.tile[num829, num830] != null && Main.tile[num829, num830].wall > 0 && flag3) + { + WorldGen.KillWall(num829, num830, false); + if (Main.tile[num829, num830].wall == 0 && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 2, (float)num829, (float)num830, 0f, 0, 0, 0); + } + } + } + } + } + } + } + AchievementsHelper.CurrentlyMining = false; + if (Main.netMode != 0) + { + NetMessage.SendData(29, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); + } + if (!projectile.noDropItem) + { + int num831 = -1; + if (Main.netMode == 1 && num831 >= 0) + { + NetMessage.SendData(21, -1, -1, null, num831, 1f, 0f, 0f, 0, 0, 0); + } + } + } + } + } +} diff --git a/Projectiles/Ranged/SandWater.cs b/Projectiles/Ranged/SandWater.cs index 0d2d95900f..2f30dee042 100644 --- a/Projectiles/Ranged/SandWater.cs +++ b/Projectiles/Ranged/SandWater.cs @@ -62,4 +62,4 @@ namespace CalamityMod.Projectiles.Ranged } } } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/SandstormBullet.cs b/Projectiles/Ranged/SandstormBullet.cs index 9d73edd02d..23b73a4ac9 100644 --- a/Projectiles/Ranged/SandstormBullet.cs +++ b/Projectiles/Ranged/SandstormBullet.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class SandstormBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sandstorm"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - projectile.aiStyle = 1; - projectile.alpha = 255; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - projectile.alpha -= 50; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 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, 14); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 20); - 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (!target.boss) - { - target.velocity.X *= 0.5f; - target.velocity.Y *= 0.5f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SandstormBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sandstorm"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + projectile.aiStyle = 1; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + projectile.alpha -= 50; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 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, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 20); + 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!target.boss) + { + target.velocity.X *= 0.5f; + target.velocity.Y *= 0.5f; + } + } + } +} diff --git a/Projectiles/Ranged/SandyWaifuShark.cs b/Projectiles/Ranged/SandyWaifuShark.cs index bc2043949f..33b723f58c 100644 --- a/Projectiles/Ranged/SandyWaifuShark.cs +++ b/Projectiles/Ranged/SandyWaifuShark.cs @@ -1,95 +1,95 @@ -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.Ranged -{ - public class SandyWaifuShark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shark"); - Main.projFrames[projectile.type] = 8; - } - - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.scale = 0.7f; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 240; - } - - public override void AI() - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.05f; - } - } - int num192 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 32, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num192].noGravity = true; - Main.dust[num192].velocity *= 0.2f; - Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } - - 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) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class SandyWaifuShark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shark"); + Main.projFrames[projectile.type] = 8; + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.scale = 0.7f; + projectile.friendly = true; + projectile.ranged = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 240; + } + + public override void AI() + { + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.05f; + } + } + int num192 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 32, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num192].noGravity = true; + Main.dust[num192].velocity *= 0.2f; + Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 0; + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + + 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) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index 229df703b6..d94f7e8c6a 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -1,160 +1,160 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class SeaDragonRocket : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("RPG"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 95; - projectile.ranged = true; - } - - public override void AI() - { - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 109); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 200; - projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.knockBack = 10f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 110); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - 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 num621 = 0; num621 < 15; 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 < 25; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; - } - int num251 = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, Main.rand.Next(400, 403), (int)((double)projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SeaDragonRocket : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("RPG"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 95; + projectile.ranged = true; + } + + public override void AI() + { + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 109); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.knockBack = 10f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 24f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 110); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + 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 num621 = 0; num621 < 15; 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 < 25; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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; + } + int num251 = Main.rand.Next(2, 4); + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, Main.rand.Next(400, 403), (int)((double)projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Ranged/ShadeFire.cs b/Projectiles/Ranged/ShadeFire.cs index 0a915c9206..6918d9a0d1 100644 --- a/Projectiles/Ranged/ShadeFire.cs +++ b/Projectiles/Ranged/ShadeFire.cs @@ -1,91 +1,91 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ShadeFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 80; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - if (projectile.timeLeft > 80) - { - projectile.timeLeft = 80; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 14; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 3; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ShadeFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 80; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + if (projectile.timeLeft > 80) + { + projectile.timeLeft = 80; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 14; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 3; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + } +} diff --git a/Projectiles/Ranged/Shockblast.cs b/Projectiles/Ranged/Shockblast.cs index f3105e0d74..1ba7c87e20 100644 --- a/Projectiles/Ranged/Shockblast.cs +++ b/Projectiles/Ranged/Shockblast.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Shockblast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 10; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.025f) / 255f, ((255 - projectile.alpha) * 0.25f) / 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185, 0f, 0f, 100, default(Color), 1f); - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Shockblast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 10; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.025f) / 255f, ((255 - projectile.alpha) * 0.25f) / 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185, 0f, 0f, 100, default(Color), 1f); + 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++; + } + } + } +} diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index 6e078d6de1..2ed34d7107 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -1,109 +1,109 @@ -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 ShockblastRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 0.5f; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Shockblast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - return true; - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - projectile.damage = (int)((double)projectile.damage * 0.995); - projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.995)); - } - } - - public override bool PreAI() - { - for (int num136 = 0; num136 < 5; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 185, 0f, 0f, 0, default(Color), 1f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Shockblast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.1f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("TransfusionTrail"), 0, 0f, projectile.owner, (float)num2, num); - } - } -} \ No newline at end of file +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 ShockblastRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.light = 0.5f; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Shockblast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + return true; + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + projectile.damage = (int)((double)projectile.damage * 0.995); + projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.995)); + } + } + + public override bool PreAI() + { + for (int num136 = 0; num136 < 5; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 185, 0f, 0f, 0, default(Color), 1f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Shockblast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + if (target.type == NPCID.TargetDummy) + { + return; + } + float num = (float)damage * 0.1f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("TransfusionTrail"), 0, 0f, projectile.owner, (float)num2, num); + } + } +} diff --git a/Projectiles/Ranged/Shroom.cs b/Projectiles/Ranged/Shroom.cs index 31fbff6645..0ade3770ef 100644 --- a/Projectiles/Ranged/Shroom.cs +++ b/Projectiles/Ranged/Shroom.cs @@ -1,74 +1,74 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Shroom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shroom"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.alpha = 80; - projectile.penetrate = 2; - projectile.tileCollide = false; - projectile.timeLeft = 120; - projectile.ranged = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.65f) / 255f); - projectile.rotation += 1f; - 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 = 25f; - 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; - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Shroom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shroom"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.alpha = 80; + projectile.penetrate = 2; + projectile.tileCollide = false; + projectile.timeLeft = 120; + projectile.ranged = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.2f) / 255f, ((255 - projectile.alpha) * 0.65f) / 255f); + projectile.rotation += 1f; + 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 = 25f; + 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; + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + } + } +} diff --git a/Projectiles/Ranged/Sickness.cs b/Projectiles/Ranged/Sickness.cs index 385a5c6e0a..8d9e1ff8c1 100644 --- a/Projectiles/Ranged/Sickness.cs +++ b/Projectiles/Ranged/Sickness.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Sickness : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sickness"); - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.timeLeft = 5; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 0.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Sickness : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sickness"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 5; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.05f) / 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 0.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 120); + } + } +} diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index 3ef15c4e3e..97da25870f 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -1,90 +1,90 @@ -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 SicknessRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.light = 0.25f; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override bool PreAI() - { - for (int num136 = 0; num136 < 7; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default(Color), 1f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 360); - target.AddBuff(BuffID.Venom, 360); - target.AddBuff(mod.BuffType("Plague"), 360); - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Sickness"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, 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("SicknessRound2"), - (int)((double)projectile.damage * 0.5), (float)((int)((double)projectile.knockBack * 0.5)), Main.myPlayer, 0f, 0f); - } - } - } - } -} \ No newline at end of file +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 SicknessRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.light = 0.25f; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override bool PreAI() + { + for (int num136 = 0; num136 < 7; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default(Color), 1f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 360); + target.AddBuff(BuffID.Venom, 360); + target.AddBuff(mod.BuffType("Plague"), 360); + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Sickness"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, 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("SicknessRound2"), + (int)((double)projectile.damage * 0.5), (float)((int)((double)projectile.knockBack * 0.5)), Main.myPlayer, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index 78e4f8f089..0671b104a9 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -1,84 +1,84 @@ -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 SicknessRound2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 180; - projectile.light = 0.15f; - projectile.extraUpdates = 1; - aiType = ProjectileID.WoodenArrowFriendly; - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override bool PreAI() - { - for (int num136 = 0; num136 < 5; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default(Color), 1f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 180); - target.AddBuff(BuffID.Venom, 180); - target.AddBuff(mod.BuffType("Plague"), 180); - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Sickness"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +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 SicknessRound2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 180; + projectile.light = 0.15f; + projectile.extraUpdates = 1; + aiType = ProjectileID.WoodenArrowFriendly; + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override bool PreAI() + { + for (int num136 = 0; num136 < 5; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default(Color), 1f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + target.AddBuff(BuffID.Venom, 180); + target.AddBuff(mod.BuffType("Plague"), 180); + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Sickness"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index 8c6a8ff860..35908122d7 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class SlagRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 2f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default(Color), 1.25f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 120); - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - float spread = 180f * 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) - { - for (i = 0; i <= 1; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.35f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.35f), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SlagRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 2f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default(Color), 1.25f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 120); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + float spread = 180f * 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) + { + for (i = 0; i <= 1; i++ ) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.35f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("FossilShard"), (int)((double)projectile.damage * 0.35f), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Ranged/SlashRound.cs b/Projectiles/Ranged/SlashRound.cs index fa814b9704..14c9132977 100644 --- a/Projectiles/Ranged/SlashRound.cs +++ b/Projectiles/Ranged/SlashRound.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class SlashRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 7; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Shred"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SlashRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 7; + projectile.scale = 1.18f; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Shred"), 180); + } + } +} diff --git a/Projectiles/Ranged/SlimeBolt.cs b/Projectiles/Ranged/SlimeBolt.cs index 5c4f89e2be..a2775f015e 100644 --- a/Projectiles/Ranged/SlimeBolt.cs +++ b/Projectiles/Ranged/SlimeBolt.cs @@ -1,73 +1,73 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class SlimeBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 2; - projectile.timeLeft = 400; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - 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; - } - projectile.velocity *= 0.75f; - } - 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, 20, 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.Slimed, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SlimeBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 2; + projectile.timeLeft = 400; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + 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; + } + projectile.velocity *= 0.75f; + } + 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, 20, 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.Slimed, 180); + } + } +} diff --git a/Projectiles/Ranged/SporeBomb.cs b/Projectiles/Ranged/SporeBomb.cs index ce758e664b..7ad3c19fa3 100644 --- a/Projectiles/Ranged/SporeBomb.cs +++ b/Projectiles/Ranged/SporeBomb.cs @@ -1,98 +1,98 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class SporeBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.light = 0.2f; - } - - public override void AI() - { - projectile.alpha -= 2; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) - { - projectile.localAI[0] = 1f; - } - } - else - { - projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) - { - projectile.localAI[0] = 0f; - } - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 20f && projectile.ai[0] < 40f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.3f; - projectile.velocity.X = projectile.velocity.X * 0.98f; - } - else if (projectile.ai[0] >= 40f && projectile.ai[0] < 60f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.3f; - projectile.velocity.X = projectile.velocity.X * 1.02f; - } - else if (projectile.ai[0] >= 60f) - { - projectile.ai[0] = 0f; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int num407 = 0; num407 < 25; num407++) - { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 1.5f; - Main.dust[num408].scale = 1.5f; - } - int num251 = Main.rand.Next(3, 7); - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, 569 + Main.rand.Next(3), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SporeBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.ranged = true; + projectile.light = 0.2f; + } + + public override void AI() + { + projectile.alpha -= 2; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.05f; + if ((double)projectile.scale > 1.2) + { + projectile.localAI[0] = 1f; + } + } + else + { + projectile.scale -= 0.05f; + if ((double)projectile.scale < 0.8) + { + projectile.localAI[0] = 0f; + } + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 20f && projectile.ai[0] < 40f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.3f; + projectile.velocity.X = projectile.velocity.X * 0.98f; + } + else if (projectile.ai[0] >= 40f && projectile.ai[0] < 60f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.3f; + projectile.velocity.X = projectile.velocity.X * 1.02f; + } + else if (projectile.ai[0] >= 60f) + { + projectile.ai[0] = 0f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 203, 103, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int num407 = 0; num407 < 25; num407++) + { + int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num408].noGravity = true; + Main.dust[num408].velocity *= 1.5f; + Main.dust[num408].scale = 1.5f; + } + int num251 = Main.rand.Next(3, 7); + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, 569 + Main.rand.Next(3), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Ranged/Spyker.cs b/Projectiles/Ranged/Spyker.cs index 63ced72a96..9a4d9c6cc4 100644 --- a/Projectiles/Ranged/Spyker.cs +++ b/Projectiles/Ranged/Spyker.cs @@ -1,107 +1,107 @@ -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.Ranged -{ - public class Spyker : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spyker"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.ranged = true; - projectile.extraUpdates = 2; - projectile.aiStyle = 93; - aiType = 514; - } - - public override void AI() - { - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, default(Color), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 1; - } - - public override void Kill(int timeLeft) - { - int num251 = Main.rand.Next(3, 6); - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("Needler"), (int)((double)projectile.damage * 0.65), 0f, projectile.owner, 0f, 0f); - } - } - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - 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, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class Spyker : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spyker"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.ranged = true; + projectile.extraUpdates = 2; + projectile.aiStyle = 93; + aiType = 514; + } + + public override void AI() + { + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 2; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, default(Color), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 1; + } + + public override void Kill(int timeLeft) + { + int num251 = Main.rand.Next(3, 6); + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("Needler"), (int)((double)projectile.damage * 0.65), 0f, projectile.owner, 0f, 0f); + } + } + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + 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, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Ranged/StarfleetMK2.cs b/Projectiles/Ranged/StarfleetMK2.cs index f8665e4b1c..ad2fc9fa60 100644 --- a/Projectiles/Ranged/StarfleetMK2.cs +++ b/Projectiles/Ranged/StarfleetMK2.cs @@ -135,4 +135,4 @@ namespace CalamityMod.Projectiles.Ranged return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/StormSurge.cs b/Projectiles/Ranged/StormSurge.cs index a5b6eb4fe3..16e9f69c95 100644 --- a/Projectiles/Ranged/StormSurge.cs +++ b/Projectiles/Ranged/StormSurge.cs @@ -1,64 +1,64 @@ -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.Ranged -{ - public class StormSurge : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Surge"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 66; - projectile.height = 66; - projectile.scale = 0.5f; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 2; - projectile.ranged = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1.25f) / 255f, ((255 - projectile.alpha) * 1.25f) / 255f); - if (projectile.scale <= 2f) - { - projectile.scale *= 1.03f; - } - if (projectile.scale >= 2f) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - 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; - } - } -} \ No newline at end of file +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.Ranged +{ + public class StormSurge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Surge"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 66; + projectile.height = 66; + projectile.scale = 0.5f; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 2; + projectile.ranged = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1.25f) / 255f, ((255 - projectile.alpha) * 1.25f) / 255f); + if (projectile.scale <= 2f) + { + projectile.scale *= 1.03f; + } + if (projectile.scale >= 2f) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + 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; + } + } +} diff --git a/Projectiles/Ranged/SulphuricAcidCannon2.cs b/Projectiles/Ranged/SulphuricAcidCannon2.cs index c299f370d0..7f3ecb59ad 100644 --- a/Projectiles/Ranged/SulphuricAcidCannon2.cs +++ b/Projectiles/Ranged/SulphuricAcidCannon2.cs @@ -1,287 +1,287 @@ -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.Ranged -{ - public class SulphuricAcidCannon2 : ModProjectile - { - public float counter = 0f; - public float counter2 = 0f; - public int killCounter = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Bubble"); - Main.projFrames[projectile.type] = 7; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.alpha = 255; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 6) - { - projectile.frame = 0; - } - if (projectile.owner == Main.myPlayer) - { - if (counter >= 90f) - { - counter = 0f; - int num320 = Main.rand.Next(1, 3); - int num3; - for (int num321 = 0; num321 < num320; num321 = num3 + 1) - { - Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("SulphuricAcidMist2"), (int)(210f * Main.player[projectile.owner].rangedDamage), 1f, projectile.owner, 0f, 0f); - num3 = num321; - } - } - else - { - counter += 1f; - } - } - if (projectile.ai[0] == 0f) - { - float[] var_2_2CA48_cp_0 = projectile.ai; - int var_2_2CA48_cp_1 = 1; - float num73 = var_2_2CA48_cp_0[var_2_2CA48_cp_1]; - var_2_2CA48_cp_0[var_2_2CA48_cp_1] = num73 + 1f; - if (projectile.ai[1] >= 6f) - { - int num982 = 20; - if (projectile.alpha > 0) - { - projectile.alpha -= num982; - } - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - if (projectile.ai[1] >= 45f) - { - projectile.ai[1] = 45f; - if (counter2 < 1f) - { - counter2 += 0.002f; - projectile.scale += 0.002f; - projectile.width = (int)(30f * projectile.scale); - projectile.height = (int)(30f * projectile.scale); - } - else - { - projectile.width = 60; - projectile.height = 60; - } - if (projectile.wet) - { - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; - } - if (projectile.velocity.Y > -1f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - } - else if (projectile.velocity.Y > -2f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - } - killCounter++; - if (killCounter >= 200) - { - projectile.Kill(); - } - } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - float[] var_2_2CB4E_cp_0 = projectile.localAI; - int var_2_2CB4E_cp_1 = 0; - float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; - var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && - ((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)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 4; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - 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) - { - if (target.buffImmune[BuffID.Venom] && target.aiStyle != 6) - { - target.buffImmune[BuffID.Venom] = false; - } - target.AddBuff(BuffID.Venom, 600); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item54, projectile.position); - 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); - int num3; - for (int num246 = 0; num246 < 25; num246 = num3 + 1) - { - int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 0, default(Color), 1f); - Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; - Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - Main.dust[num247].velocity.Normalize(); - Dust dust = Main.dust[num247]; - dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = projectile.alpha; - num3 = num246; - } - } - } -} \ No newline at end of file +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.Ranged +{ + public class SulphuricAcidCannon2 : ModProjectile + { + public float counter = 0f; + public float counter2 = 0f; + public int killCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Bubble"); + Main.projFrames[projectile.type] = 7; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 6) + { + projectile.frame = 0; + } + if (projectile.owner == Main.myPlayer) + { + if (counter >= 90f) + { + counter = 0f; + int num320 = Main.rand.Next(1, 3); + int num3; + for (int num321 = 0; num321 < num320; num321 = num3 + 1) + { + Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector15.Normalize(); + vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("SulphuricAcidMist2"), (int)(210f * Main.player[projectile.owner].rangedDamage), 1f, projectile.owner, 0f, 0f); + num3 = num321; + } + } + else + { + counter += 1f; + } + } + if (projectile.ai[0] == 0f) + { + float[] var_2_2CA48_cp_0 = projectile.ai; + int var_2_2CA48_cp_1 = 1; + float num73 = var_2_2CA48_cp_0[var_2_2CA48_cp_1]; + var_2_2CA48_cp_0[var_2_2CA48_cp_1] = num73 + 1f; + if (projectile.ai[1] >= 6f) + { + int num982 = 20; + if (projectile.alpha > 0) + { + projectile.alpha -= num982; + } + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + if (projectile.ai[1] >= 45f) + { + projectile.ai[1] = 45f; + if (counter2 < 1f) + { + counter2 += 0.002f; + projectile.scale += 0.002f; + projectile.width = (int)(30f * projectile.scale); + projectile.height = (int)(30f * projectile.scale); + } + else + { + projectile.width = 60; + projectile.height = 60; + } + if (projectile.wet) + { + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.98f; + } + if (projectile.velocity.Y > -1f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + } + else if (projectile.velocity.Y > -2f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + } + killCounter++; + if (killCounter >= 200) + { + projectile.Kill(); + } + } + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + int num988 = 15; + bool flag54 = false; + bool flag55 = false; + float[] var_2_2CB4E_cp_0 = projectile.localAI; + int var_2_2CB4E_cp_1 = 0; + float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; + var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f; + if (projectile.localAI[0] % 30f == 0f) + { + flag55 = true; + } + int num989 = (int)projectile.ai[1]; + if (projectile.localAI[0] >= (float)(60 * num988)) + { + flag54 = true; + } + else if (num989 < 0 || num989 >= 200) + { + flag54 = true; + } + else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) + { + projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[num989].gfxOffY; + if (flag55) + { + Main.npc[num989].HitEffect(0, 1.0); + } + } + else + { + flag54 = true; + } + if (flag54) + { + projectile.Kill(); + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + ((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)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[0] = 1f; + projectile.ai[1] = (float)i; + projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; + projectile.netUpdate = true; + projectile.StatusNPC(i); + projectile.damage = 0; + int num28 = 4; + Point[] array2 = new Point[num28]; + int num29 = 0; + for (int l = 0; l < 1000; l++) + { + if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) + { + array2[num29++] = new Point(l, Main.projectile[l].timeLeft); + if (num29 >= array2.Length) + { + break; + } + } + } + if (num29 >= array2.Length) + { + int num30 = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[num30].Y) + { + num30 = m; + } + } + Main.projectile[array2[num30].X].Kill(); + } + } + } + } + } + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + 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) + { + if (target.buffImmune[BuffID.Venom] && target.aiStyle != 6) + { + target.buffImmune[BuffID.Venom] = false; + } + target.AddBuff(BuffID.Venom, 600); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item54, projectile.position); + 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); + int num3; + for (int num246 = 0; num246 < 25; num246 = num3 + 1) + { + int num247 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 0, default(Color), 1f); + Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; + Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[num247].velocity.Normalize(); + Dust dust = Main.dust[num247]; + dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; + Main.dust[num247].alpha = projectile.alpha; + num3 = num246; + } + } + } +} diff --git a/Projectiles/Ranged/SulphuricAcidMist2.cs b/Projectiles/Ranged/SulphuricAcidMist2.cs index 2eeffef07c..4a9dd427c1 100644 --- a/Projectiles/Ranged/SulphuricAcidMist2.cs +++ b/Projectiles/Ranged/SulphuricAcidMist2.cs @@ -1,87 +1,87 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class SulphuricAcidMist2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Mist"); - Main.projFrames[projectile.type] = 10; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 9) - { - projectile.frame = 0; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111); - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - } - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 600); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SulphuricAcidMist2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Mist"); + Main.projFrames[projectile.type] = 10; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.extraUpdates = 2; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 9) + { + projectile.frame = 0; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111); + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 600); + } + } +} diff --git a/Projectiles/Ranged/SuperballBullet.cs b/Projectiles/Ranged/SuperballBullet.cs index 3ebd9b4f99..1b6389adcf 100644 --- a/Projectiles/Ranged/SuperballBullet.cs +++ b/Projectiles/Ranged/SuperballBullet.cs @@ -1,96 +1,96 @@ -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 SuperballBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 87, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - 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; - } - projectile.velocity *= 1.5f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - return false; - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 87, projectile.oldVelocity.X * 0.05f, projectile.oldVelocity.Y * 0.05f); - } - } - } -} \ No newline at end of file +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 SuperballBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 5; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { + for (int num136 = 0; num136 < 10; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 87, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + } + + 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; + } + projectile.velocity *= 1.5f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + return false; + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 87, projectile.oldVelocity.X * 0.05f, projectile.oldVelocity.Y * 0.05f); + } + } + } +} diff --git a/Projectiles/Ranged/TealExoArrow.cs b/Projectiles/Ranged/TealExoArrow.cs index 2709ce3779..25d8af8c26 100644 --- a/Projectiles/Ranged/TealExoArrow.cs +++ b/Projectiles/Ranged/TealExoArrow.cs @@ -1,114 +1,114 @@ -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.Ranged -{ - public class TealExoArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.5f, 0.5f); - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 100, 100, projectile.alpha); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - } -} \ No newline at end of file +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.Ranged +{ + public class TealExoArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 2; + projectile.timeLeft = 300; + projectile.ranged = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.5f, 0.5f); + float num55 = 50f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 100, 100, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 50f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + } +} diff --git a/Projectiles/Ranged/TelluricGlare.cs b/Projectiles/Ranged/TelluricGlare.cs index 41da0cec18..28116a5c83 100644 --- a/Projectiles/Ranged/TelluricGlare.cs +++ b/Projectiles/Ranged/TelluricGlare.cs @@ -1,80 +1,80 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TelluricGlare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Glare"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.extraUpdates = 30; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.aiStyle = 1; - projectile.timeLeft = 300; - aiType = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1.5f); - 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, 14); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TelluricGlare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Glare"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.extraUpdates = 30; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.aiStyle = 1; + projectile.timeLeft = 300; + aiType = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1.5f); + 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, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Ranged/TerraArrow.cs b/Projectiles/Ranged/TerraArrow.cs index 93a138129c..b9aa5112d3 100644 --- a/Projectiles/Ranged/TerraArrow.cs +++ b/Projectiles/Ranged/TerraArrow.cs @@ -1,74 +1,74 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.aiStyle = 1; - } - - public override void AI() - { - projectile.velocity *= 1.005f; - if (projectile.velocity.X >= 20f || projectile.velocity.Y >= 20f || projectile.velocity.X <= -20f || projectile.velocity.Y <= -20f) - { - projectile.Kill(); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 30; - projectile.height = 30; - 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 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 1.2f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < 2; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("TerraArrow2"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.aiStyle = 1; + } + + public override void AI() + { + projectile.velocity *= 1.005f; + if (projectile.velocity.X >= 20f || projectile.velocity.Y >= 20f || projectile.velocity.X <= -20f || projectile.velocity.Y <= -20f) + { + projectile.Kill(); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 30; + projectile.height = 30; + 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 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 1.2f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < 2; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("TerraArrow2"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Ranged/TerraArrow2.cs b/Projectiles/Ranged/TerraArrow2.cs index 474f9ce462..9a5a1fc8d1 100644 --- a/Projectiles/Ranged/TerraArrow2.cs +++ b/Projectiles/Ranged/TerraArrow2.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraArrow2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.aiStyle = 1; - } - - public override void AI() - { - projectile.alpha -= 5; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 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) - { - 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; - return; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 30; - projectile.height = 30; - 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 < 2; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 2f); - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraArrow2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.aiStyle = 1; + } + + public override void AI() + { + projectile.alpha -= 5; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 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) + { + 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; + return; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 60); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 30; + projectile.height = 30; + 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 < 2; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 2f); + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + } + } +} diff --git a/Projectiles/Ranged/TerraBallB.cs b/Projectiles/Ranged/TerraBallB.cs index 274765b928..b784836ca2 100644 --- a/Projectiles/Ranged/TerraBallB.cs +++ b/Projectiles/Ranged/TerraBallB.cs @@ -1,88 +1,88 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraBallB : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 600; - } - - 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, 15, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, 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, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraBallB : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.timeLeft = 600; + } + + 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, 15, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, 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, 120); + } + } +} diff --git a/Projectiles/Ranged/TerraBallG.cs b/Projectiles/Ranged/TerraBallG.cs index 23e48ddf7a..f0c7286978 100644 --- a/Projectiles/Ranged/TerraBallG.cs +++ b/Projectiles/Ranged/TerraBallG.cs @@ -1,88 +1,88 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraBallG : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 600; - } - - 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, 74, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, 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.CursedInferno, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraBallG : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.timeLeft = 600; + } + + 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, 74, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 74, 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.CursedInferno, 120); + } + } +} diff --git a/Projectiles/Ranged/TerraBallI.cs b/Projectiles/Ranged/TerraBallI.cs index 5dd0abf09b..75c8454860 100644 --- a/Projectiles/Ranged/TerraBallI.cs +++ b/Projectiles/Ranged/TerraBallI.cs @@ -1,89 +1,89 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraBallI : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 600; - } - - 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, 73, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, 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.OnFire, 90); - target.AddBuff(BuffID.Frostburn, 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraBallI : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.timeLeft = 600; + } + + 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, 73, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, 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.OnFire, 90); + target.AddBuff(BuffID.Frostburn, 60); + } + } +} diff --git a/Projectiles/Ranged/TerraBallO.cs b/Projectiles/Ranged/TerraBallO.cs index 61f06af435..4c918785c4 100644 --- a/Projectiles/Ranged/TerraBallO.cs +++ b/Projectiles/Ranged/TerraBallO.cs @@ -1,89 +1,89 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraBallO : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 600; - } - - 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, 162, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 162, 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.OnFire, 90); - target.AddBuff(BuffID.Ichor, 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraBallO : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.timeLeft = 600; + } + + 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, 162, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 162, 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.OnFire, 90); + target.AddBuff(BuffID.Ichor, 60); + } + } +} diff --git a/Projectiles/Ranged/TerraBallR.cs b/Projectiles/Ranged/TerraBallR.cs index 623a87ff08..12691cf88d 100644 --- a/Projectiles/Ranged/TerraBallR.cs +++ b/Projectiles/Ranged/TerraBallR.cs @@ -1,88 +1,88 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraBallR : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 600; - } - - 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, 90, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 90, 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.OnFire, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraBallR : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.timeLeft = 600; + } + + 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, 90, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 90, 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.OnFire, 120); + } + } +} diff --git a/Projectiles/Ranged/TerraBallV.cs b/Projectiles/Ranged/TerraBallV.cs index 0f20d2eafc..b59dfb8c2e 100644 --- a/Projectiles/Ranged/TerraBallV.cs +++ b/Projectiles/Ranged/TerraBallV.cs @@ -1,89 +1,89 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraBallV : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 600; - } - - 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, 173, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 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, 90); - target.AddBuff(BuffID.OnFire, 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraBallV : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.timeLeft = 600; + } + + 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, 173, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 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, 90); + target.AddBuff(BuffID.OnFire, 60); + } + } +} diff --git a/Projectiles/Ranged/TerraBallY.cs b/Projectiles/Ranged/TerraBallY.cs index 8d404bb045..c7f34c0d00 100644 --- a/Projectiles/Ranged/TerraBallY.cs +++ b/Projectiles/Ranged/TerraBallY.cs @@ -1,88 +1,88 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraBallY : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.timeLeft = 600; - } - - 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, 57, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 57, 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraBallY : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.timeLeft = 600; + } + + 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, 57, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = Main.rand.Next(19, 35); + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 57, 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); + } + } +} diff --git a/Projectiles/Ranged/TerraBullet.cs b/Projectiles/Ranged/TerraBullet.cs index 1d2c26d4c1..c35d04cf34 100644 --- a/Projectiles/Ranged/TerraBullet.cs +++ b/Projectiles/Ranged/TerraBullet.cs @@ -1,89 +1,89 @@ -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 TerraBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.alpha = 255; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 17; - } - for (int num136 = 0; num136 < 3; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < 2; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("TerraBulletSplit"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 118); - } - } -} \ No newline at end of file +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 TerraBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.alpha = 255; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 6f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 17; + } + for (int num136 = 0; num136 < 3; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < 2; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("TerraBulletSplit"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 118); + } + } +} diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/TerraBulletSplit.cs index c1a2b5b56d..0ee6c7c02c 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/TerraBulletSplit.cs @@ -1,140 +1,140 @@ -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 TerraBulletSplit : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.alpha > 0) - { - projectile.alpha -= 85; - } - for (int num136 = 0; num136 < 2; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 400f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - } - } -} \ No newline at end of file +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 TerraBulletSplit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.alpha > 0) + { + projectile.alpha -= 85; + } + for (int num136 = 0; num136 < 2; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + float num140 = projectile.position.X; + float num141 = projectile.position.Y; + float num142 = 400f; + bool flag4 = false; + int num143 = 0; + if (projectile.ai[1] == 0f) + { + for (int num144 = 0; num144 < 200; num144++) + { + if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) + { + float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); + float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); + float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); + if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) + { + num142 = num147; + num140 = num145; + num141 = num146; + flag4 = true; + num143 = num144; + } + } + } + if (flag4) + { + projectile.ai[1] = (float)(num143 + 1); + } + flag4 = false; + } + if (projectile.ai[1] > 0f) + { + int num148 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) + { + float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); + if (num151 < 1000f) + { + flag4 = true; + num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + } + } + else + { + projectile.ai[1] = 0f; + } + } + if (!projectile.friendly) + { + flag4 = false; + } + if (flag4) + { + float num152 = num139; + Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num153 = num140 - vector13.X; + float num154 = num141 - vector13.Y; + float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); + num155 = num152 / num155; + num153 *= num155; + num154 *= num155; + int num156 = 12; + projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + } + } + } +} diff --git a/Projectiles/Ranged/TerraFireBlue.cs b/Projectiles/Ranged/TerraFireBlue.cs index f4681d9d76..ba02b88409 100644 --- a/Projectiles/Ranged/TerraFireBlue.cs +++ b/Projectiles/Ranged/TerraFireBlue.cs @@ -1,94 +1,94 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraFireBlue : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 45; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); - if (projectile.timeLeft > 45) - { - projectile.timeLeft = 45; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 66; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(BuffID.Frostburn, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraFireBlue : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.extraUpdates = 3; + projectile.timeLeft = 45; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f); + if (projectile.timeLeft > 45) + { + projectile.timeLeft = 45; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 66; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(BuffID.Frostburn, 300); + } + } +} diff --git a/Projectiles/Ranged/TerraFireGreen.cs b/Projectiles/Ranged/TerraFireGreen.cs index e4eeb6209d..0aa0668582 100644 --- a/Projectiles/Ranged/TerraFireGreen.cs +++ b/Projectiles/Ranged/TerraFireGreen.cs @@ -1,98 +1,98 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraFireGreen : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 120; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 120) - { - projectile.timeLeft = 120; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 107; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 3; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 0.75f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 2f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 0.75f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - if (!Main.dust[num299].noGravity) - { - Main.dust[num299].velocity *= 0.5f; - } - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(BuffID.CursedInferno, 300); - target.AddBuff(BuffID.OnFire, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraFireGreen : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 120; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 120) + { + projectile.timeLeft = 120; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 107; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 3; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 0.75f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 2f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 0.75f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + if (!Main.dust[num299].noGravity) + { + Main.dust[num299].velocity *= 0.5f; + } + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Projectiles/Ranged/TerraFireGreen2.cs b/Projectiles/Ranged/TerraFireGreen2.cs index 734aa13469..dd0f0d769f 100644 --- a/Projectiles/Ranged/TerraFireGreen2.cs +++ b/Projectiles/Ranged/TerraFireGreen2.cs @@ -1,94 +1,94 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraFireGreen2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 45; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 45) - { - projectile.timeLeft = 45; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 66; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 300); - target.AddBuff(mod.BuffType("Plague"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraFireGreen2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.extraUpdates = 3; + projectile.timeLeft = 45; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 45) + { + projectile.timeLeft = 45; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 66; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(mod.BuffType("Plague"), 120); + } + } +} diff --git a/Projectiles/Ranged/TerraFireRed.cs b/Projectiles/Ranged/TerraFireRed.cs index f108f07305..d941414c68 100644 --- a/Projectiles/Ranged/TerraFireRed.cs +++ b/Projectiles/Ranged/TerraFireRed.cs @@ -1,94 +1,94 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TerraFireRed : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 45; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.timeLeft > 45) - { - projectile.timeLeft = 45; - } - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 66; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 1.75f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 0.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - Main.dust[num299].velocity += projectile.velocity; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(BuffID.OnFire, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TerraFireRed : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.extraUpdates = 3; + projectile.timeLeft = 45; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.45f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.timeLeft > 45) + { + projectile.timeLeft = 45; + } + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 66; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 2; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 1.75f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 0.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + Main.dust[num299].velocity += projectile.velocity; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Projectiles/Ranged/TitRail.cs b/Projectiles/Ranged/TitRail.cs index cfe6d1e6fe..ec140e6b1e 100644 --- a/Projectiles/Ranged/TitRail.cs +++ b/Projectiles/Ranged/TitRail.cs @@ -1,53 +1,53 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TitRail : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 5; - projectile.extraUpdates = 100; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 91, 0f, 0f, 0, default(Color), 1f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - return; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TitRail : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 5; + projectile.extraUpdates = 100; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 91, 0f, 0f, 0, default(Color), 1f); + Main.dust[num448].noGravity = true; + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + return; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + } + } +} diff --git a/Projectiles/Ranged/TorrentialArrow.cs b/Projectiles/Ranged/TorrentialArrow.cs index 4f7ff9069d..319fc2fb10 100644 --- a/Projectiles/Ranged/TorrentialArrow.cs +++ b/Projectiles/Ranged/TorrentialArrow.cs @@ -1,101 +1,101 @@ -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.Ranged -{ - public class TorrentialArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; - projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(53, Main.DiscoG, 255, projectile.alpha); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - } -} \ No newline at end of file +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.Ranged +{ + public class TorrentialArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 2; + projectile.timeLeft = 300; + projectile.ranged = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.3f, 0.7f); + float num55 = 50f; + float num56 = 1.5f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(53, Main.DiscoG, 255, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 50f; + float scaleFactor = 1.5f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + } +} diff --git a/Projectiles/Ranged/Triploon.cs b/Projectiles/Ranged/Triploon.cs index c048ac7a55..83ef07bdd7 100644 --- a/Projectiles/Ranged/Triploon.cs +++ b/Projectiles/Ranged/Triploon.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Triploon : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triploon"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.ranged = true; - projectile.extraUpdates = 0; - } - - public override void AI() - { - if (Main.player[projectile.owner].dead) - { - projectile.Kill(); - return; - } - if (projectile.alpha == 0) - { - if (projectile.position.X + (float)(projectile.width / 2) > Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2)) - { - Main.player[projectile.owner].ChangeDir(1); - } - else - { - Main.player[projectile.owner].ChangeDir(-1); - } - } - if (projectile.ai[0] == 0f) - { - projectile.extraUpdates = 0; - } - else - { - projectile.extraUpdates = 1; - } - Vector2 vector14 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num166 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector14.X; - float num167 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector14.Y; - float num168 = (float)Math.Sqrt((double)(num166 * num166 + num167 * num167)); - if (projectile.ai[0] == 0f) - { - if (num168 > 700f) - { - projectile.ai[0] = 1f; - } - else if (num168 > 350f) - { - projectile.ai[0] = 1f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 5f) - { - projectile.alpha = 0; - } - if (projectile.ai[1] > 8f) - { - projectile.ai[1] = 8f; - } - if (projectile.ai[1] >= 10f) - { - projectile.ai[1] = 15f; - projectile.velocity.Y = projectile.velocity.Y + 0.3f; - } - } - else if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - projectile.rotation = (float)Math.Atan2((double)num167, (double)num166) - 1.57f; - float num169 = 20f; - if (num168 < 50f) - { - projectile.Kill(); - } - num168 = num169 / num168; - num166 *= num168; - num167 *= num168; - projectile.velocity.X = num166; - projectile.velocity.Y = num167; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Triploon : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Triploon"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.ranged = true; + projectile.extraUpdates = 0; + } + + public override void AI() + { + if (Main.player[projectile.owner].dead) + { + projectile.Kill(); + return; + } + if (projectile.alpha == 0) + { + if (projectile.position.X + (float)(projectile.width / 2) > Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2)) + { + Main.player[projectile.owner].ChangeDir(1); + } + else + { + Main.player[projectile.owner].ChangeDir(-1); + } + } + if (projectile.ai[0] == 0f) + { + projectile.extraUpdates = 0; + } + else + { + projectile.extraUpdates = 1; + } + Vector2 vector14 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num166 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector14.X; + float num167 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector14.Y; + float num168 = (float)Math.Sqrt((double)(num166 * num166 + num167 * num167)); + if (projectile.ai[0] == 0f) + { + if (num168 > 700f) + { + projectile.ai[0] = 1f; + } + else if (num168 > 350f) + { + projectile.ai[0] = 1f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.ai[1] += 1f; + if (projectile.ai[1] > 5f) + { + projectile.alpha = 0; + } + if (projectile.ai[1] > 8f) + { + projectile.ai[1] = 8f; + } + if (projectile.ai[1] >= 10f) + { + projectile.ai[1] = 15f; + projectile.velocity.Y = projectile.velocity.Y + 0.3f; + } + } + else if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + projectile.rotation = (float)Math.Atan2((double)num167, (double)num166) - 1.57f; + float num169 = 20f; + if (num168 < 50f) + { + projectile.Kill(); + } + num168 = num169 / num168; + num166 *= num168; + num167 *= num168; + projectile.velocity.X = num166; + projectile.velocity.Y = num167; + } + } + } +} diff --git a/Projectiles/Ranged/TyphoonArrow.cs b/Projectiles/Ranged/TyphoonArrow.cs index 52f076cc28..5674c45484 100644 --- a/Projectiles/Ranged/TyphoonArrow.cs +++ b/Projectiles/Ranged/TyphoonArrow.cs @@ -1,36 +1,36 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TyphoonArrow : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 600; - aiType = 1; - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TyphoonBubble"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TyphoonArrow : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + projectile.timeLeft = 600; + aiType = 1; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TyphoonBubble"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Ranged/TyphoonBubble.cs b/Projectiles/Ranged/TyphoonBubble.cs index 1adb744e14..756b93fd82 100644 --- a/Projectiles/Ranged/TyphoonBubble.cs +++ b/Projectiles/Ranged/TyphoonBubble.cs @@ -1,120 +1,120 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class TyphoonBubble : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - Main.projFrames[projectile.type] = 3; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 1; - } - - public override void AI() - { - if (projectile.ai[1] > 0f) - { - int num625 = (int)projectile.ai[1] - 1; - if (num625 < 255) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - 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), 1.4f); - Main.dust[num628].noGravity = true; - Main.dust[num628].noLight = true; - Main.dust[num628].velocity /= 4f; - Main.dust[num628].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - Vector2 value16 = Main.player[num625].Center - projectile.Center; - float num629 = 4f; - num629 += projectile.localAI[0] / 20f; - projectile.velocity = Vector2.Normalize(value16) * num629; - if (value16.Length() < 50f) - { - projectile.Kill(); - } - } - } - else - { - float num630 = 0.209439516f; - float num631 = 4f; - float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y - num632; - projectile.ai[0] += 1f; - num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; - projectile.velocity.Y = projectile.velocity.Y + num632; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - } - if (projectile.wet) - { - projectile.position.Y = projectile.position.Y - 16f; - projectile.Kill(); - } - } - - 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; - } - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[1] < 1f) - { - int num230 = Projectile.NewProjectile(projectile.Center.X - (float)(projectile.direction * 30), projectile.Center.Y - 4f, (float)(-(float)projectile.direction) * 0.01f, 0f, mod.ProjectileType("WaterSpout"), projectile.damage, 3f, projectile.owner, 16f, 8f); - Main.projectile[num230].netUpdate = true; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TyphoonBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ranged = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 1; + } + + public override void AI() + { + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + 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), 1.4f); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 20f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 50f) + { + projectile.Kill(); + } + } + } + else + { + float num630 = 0.209439516f; + float num631 = 4f; + float num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y - num632; + projectile.ai[0] += 1f; + num632 = (float)(Math.Cos((double)(num630 * projectile.ai[0])) - 0.5) * num631; + projectile.velocity.Y = projectile.velocity.Y + num632; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } + } + if (projectile.wet) + { + projectile.position.Y = projectile.position.Y - 16f; + projectile.Kill(); + } + } + + 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; + } + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[1] < 1f) + { + int num230 = Projectile.NewProjectile(projectile.Center.X - (float)(projectile.direction * 30), projectile.Center.Y - 4f, (float)(-(float)projectile.direction) * 0.01f, 0f, mod.ProjectileType("WaterSpout"), projectile.damage, 3f, projectile.owner, 16f, 8f); + Main.projectile[num230].netUpdate = true; + } + } + } + } +} diff --git a/Projectiles/Ranged/VanquisherArrow.cs b/Projectiles/Ranged/VanquisherArrow.cs index f4bbac707b..a121492292 100644 --- a/Projectiles/Ranged/VanquisherArrow.cs +++ b/Projectiles/Ranged/VanquisherArrow.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class VanquisherArrow : ModProjectile - { - public int projCount = 18; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ranged = true; - projectile.tileCollide = false; - projectile.arrow = true; - projectile.penetrate = 1; - projectile.timeLeft = 90; - projectile.extraUpdates = 1; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projCount--; - if (projCount <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, mod.ProjectileType("VanquisherArrow2"), (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f); - } - projCount = 18; - } - } - - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class VanquisherArrow : ModProjectile + { + public int projCount = 18; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.ranged = true; + projectile.tileCollide = false; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.timeLeft = 90; + projectile.extraUpdates = 1; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projCount--; + if (projCount <= 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, mod.ProjectileType("VanquisherArrow2"), (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f); + } + projCount = 18; + } + } + + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } + } +} diff --git a/Projectiles/Ranged/VeriumBullet.cs b/Projectiles/Ranged/VeriumBullet.cs index 857d7801d7..688c49744b 100644 --- a/Projectiles/Ranged/VeriumBullet.cs +++ b/Projectiles/Ranged/VeriumBullet.cs @@ -1,138 +1,138 @@ -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 VeriumBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override bool PreAI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 6f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 182, 0f, 0f, 0, default(Color), 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 300f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - return false; - } - } -} \ No newline at end of file +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 VeriumBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override bool PreAI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 6f) + { + for (int num136 = 0; num136 < 10; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 182, 0f, 0f, 0, default(Color), 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + float num140 = projectile.position.X; + float num141 = projectile.position.Y; + float num142 = 300f; + bool flag4 = false; + int num143 = 0; + if (projectile.ai[1] == 0f) + { + for (int num144 = 0; num144 < 200; num144++) + { + if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) + { + float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); + float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); + float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); + if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) + { + num142 = num147; + num140 = num145; + num141 = num146; + flag4 = true; + num143 = num144; + } + } + } + if (flag4) + { + projectile.ai[1] = (float)(num143 + 1); + } + flag4 = false; + } + if (projectile.ai[1] > 0f) + { + int num148 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) + { + float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); + if (num151 < 1000f) + { + flag4 = true; + num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); + num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); + } + } + else + { + projectile.ai[1] = 0f; + } + } + if (!projectile.friendly) + { + flag4 = false; + } + if (flag4) + { + float num152 = num139; + Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num153 = num140 - vector13.X; + float num154 = num141 - vector13.Y; + float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); + num155 = num152 / num155; + num153 *= num155; + num154 *= num155; + int num156 = 12; + projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + } + return false; + } + } +} diff --git a/Projectiles/Ranged/Voidragon.cs b/Projectiles/Ranged/Voidragon.cs index 0a7d3c917d..75b5ae0dc5 100644 --- a/Projectiles/Ranged/Voidragon.cs +++ b/Projectiles/Ranged/Voidragon.cs @@ -1,116 +1,116 @@ -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; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Voidragon : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 150; - projectile.friendly = true; - projectile.ranged = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.ignoreWater = true; - aiType = 503; - } - - public override void AI() - { - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 150 + Main.rand.Next(40); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 12f) - { - 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, 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; - } - } - 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, 173, 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 (Main.rand.Next(48) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.Next(10) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); - } - 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); - } - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); - } - - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlasmaExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Voidragon : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.alpha = 150; + projectile.friendly = true; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ignoreWater = true; + aiType = 503; + } + + public override void AI() + { + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 150 + Main.rand.Next(40); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 12f) + { + 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, 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; + } + } + 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, 173, 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 (Main.rand.Next(48) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + 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); + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); + } + + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("PlasmaExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index 441949bce5..e5ae86d891 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -1,124 +1,124 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - 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 = 30; - } - - public override void AI() - { - int num613 = 10; - int num614 = 15; - float num615 = 1f; - int num616 = 150; - int num617 = 42; - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); - projectile.width = (int)((float)num616 * projectile.scale); - projectile.height = (int)((float)num617 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center = projectile.Center; - center.Y -= (float)num617 * projectile.scale / 2f; - float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); - center.Y -= (float)num617 * num618 / 2f; - center.Y += 2f; - Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 5f; - float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); - projectile.ai[0] -= 1f; - num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; - projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); - } - } - - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + 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 = 30; + } + + public override void AI() + { + int num613 = 10; + int num614 = 15; + float num615 = 1f; + int num616 = 150; + int num617 = 42; + if (projectile.velocity.X != 0f) + { + projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = ((float)(num613 + num614) - projectile.ai[1]) * num615 / (float)(num614 + num613); + projectile.width = (int)((float)num616 * projectile.scale); + projectile.height = (int)((float)num617 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center = projectile.Center; + center.Y -= (float)num617 * projectile.scale / 2f; + float num618 = ((float)(num613 + num614) - projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); + center.Y -= (float)num617 * num618 / 2f; + center.Y += 2f; + Projectile.NewProjectile(center.X, center.Y, projectile.velocity.X, projectile.velocity.Y, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num622 = 0.104719758f; + float num623 = (float)projectile.width / 5f; + float num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X - num624 * (float)(-(float)projectile.direction); + projectile.ai[0] -= 1f; + num624 = (float)(Math.Cos((double)(num622 * -(double)projectile.ai[0])) - 0.5) * num623; + projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); + } + } + + 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; + } + } +} diff --git a/Projectiles/Rogue/AccretionDisk.cs b/Projectiles/Rogue/AccretionDisk.cs index d1779568e2..b6902f7887 100644 --- a/Projectiles/Rogue/AccretionDisk.cs +++ b/Projectiles/Rogue/AccretionDisk.cs @@ -1,114 +1,114 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class AccretionDisk : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Accretion Disk"); - } - - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 400; - aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - if (Main.rand.Next(2) == 0) - { - for (int num468 = 0; num468 < 1; num468++) - { - 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), 1.3f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - } - } - Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.Next(3) == 0) - { - if (projectile.owner == Main.myPlayer) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.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(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("AccretionDisk2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("AccretionDisk2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AccretionDisk : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Accretion Disk"); + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 400; + aiType = 52; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + if (Main.rand.Next(2) == 0) + { + for (int num468 = 0; num468 < 1; num468++) + { + 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), 1.3f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + } + } + Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.Next(3) == 0) + { + if (projectile.owner == Main.myPlayer) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.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(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("AccretionDisk2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("AccretionDisk2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Rogue/AccretionDisk2.cs b/Projectiles/Rogue/AccretionDisk2.cs index e40929a53c..d105f636c8 100644 --- a/Projectiles/Rogue/AccretionDisk2.cs +++ b/Projectiles/Rogue/AccretionDisk2.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class AccretionDisk2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Accretion Disk"); - } - - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.alpha = 120; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 60; - aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - 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; - Main.dust[num250].velocity *= 0f; - } - Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AccretionDisk2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Accretion Disk"); + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.alpha = 120; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 60; + aiType = 52; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + 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; + Main.dust[num250].velocity *= 0f; + } + Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index c62e09a596..ef48681fd9 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -1,37 +1,37 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class AdamantiteThrowingAxeProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Adamantite Throwing Axe"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 3; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - 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("AdamantiteThrowingAxe")); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AdamantiteThrowingAxeProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Adamantite Throwing Axe"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 3; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + 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("AdamantiteThrowingAxe")); + } + } + } +} diff --git a/Projectiles/Rogue/BallisticPoisonBomb.cs b/Projectiles/Rogue/BallisticPoisonBomb.cs index 662b4b8826..c268b13120 100644 --- a/Projectiles/Rogue/BallisticPoisonBomb.cs +++ b/Projectiles/Rogue/BallisticPoisonBomb.cs @@ -1,203 +1,203 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BallisticPoisonBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Poison Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 200; - projectile.tileCollide = false; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - if (Main.rand.Next(6) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - try - { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (num223 < 0) - { - num223 = 0; - } - if (num224 > Main.maxTilesX) - { - num224 = Main.maxTilesX; - } - if (num225 < 0) - { - num225 = 0; - } - if (num226 > Main.maxTilesY) - { - num226 = Main.maxTilesY; - } - for (int num227 = num223; num227 < num224; num227++) - { - for (int num228 = num225; num228 < num226; num228++) - { - if (Main.tile[num227, num228] != null && !TileID.Sets.Platforms[Main.tile[num227, num228].type] && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) - { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } - catch - { - } - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 128; - projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 10f) - { - projectile.ai[0] = 10f; - 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; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - int num251 = Main.rand.Next(3, 5); - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("BallisticPoisonBombSpike"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - int num320 = Main.rand.Next(8, 13); - int num3; - for (int num321 = 0; num321 < num320; num321 = num3 + 1) - { - Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("BallisticPoisonCloud") + Main.rand.Next(3), (int)((double)projectile.damage * 0.5), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); - num3 = num321; - } - } - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 128; - projectile.height = 128; - 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, 14, 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 < 9; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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(BuffID.Venom, 240); - projectile.Kill(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class BallisticPoisonBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Poison Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 200; + projectile.tileCollide = false; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + if (Main.rand.Next(6) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + try + { + int num223 = (int)(projectile.position.X / 16f) - 1; + int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; + int num225 = (int)(projectile.position.Y / 16f) - 1; + int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + if (num223 < 0) + { + num223 = 0; + } + if (num224 > Main.maxTilesX) + { + num224 = Main.maxTilesX; + } + if (num225 < 0) + { + num225 = 0; + } + if (num226 > Main.maxTilesY) + { + num226 = Main.maxTilesY; + } + for (int num227 = num223; num227 < num224; num227++) + { + for (int num228 = num225; num228 < num226; num228++) + { + if (Main.tile[num227, num228] != null && !TileID.Sets.Platforms[Main.tile[num227, num228].type] && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) + { + Vector2 vector19; + vector19.X = (float)(num227 * 16); + vector19.Y = (float)(num228 * 16); + if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -0.2f; + } + } + } + } + } + catch + { + } + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 128; + projectile.height = 128; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 10f) + { + projectile.ai[0] = 10f; + 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; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + int num251 = Main.rand.Next(3, 5); + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("BallisticPoisonBombSpike"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + int num320 = Main.rand.Next(8, 13); + int num3; + for (int num321 = 0; num321 < num320; num321 = num3 + 1) + { + Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector15.Normalize(); + vector15 *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, mod.ProjectileType("BallisticPoisonCloud") + Main.rand.Next(3), (int)((double)projectile.damage * 0.5), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + num3 = num321; + } + } + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 128; + projectile.height = 128; + 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, 14, 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 < 9; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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(BuffID.Venom, 240); + projectile.Kill(); + } + } +} diff --git a/Projectiles/Rogue/BallisticPoisonBombSpike.cs b/Projectiles/Rogue/BallisticPoisonBombSpike.cs index 0765a9e46c..1cace81ca7 100644 --- a/Projectiles/Rogue/BallisticPoisonBombSpike.cs +++ b/Projectiles/Rogue/BallisticPoisonBombSpike.cs @@ -1,82 +1,82 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BallisticPoisonBombSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.extraUpdates = 2; - projectile.aiStyle = 93; - aiType = 514; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - target.immune[projectile.owner] = 1; - } - - public override void Kill(int timeLeft) - { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 30; - projectile.height = 30; - 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 < 2; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 2; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - 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, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class BallisticPoisonBombSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.extraUpdates = 2; + projectile.aiStyle = 93; + aiType = 514; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.alpha -= 10; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default(Color), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + target.immune[projectile.owner] = 1; + } + + public override void Kill(int timeLeft) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 30; + projectile.height = 30; + 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 < 2; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 2; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + 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, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Rogue/BrackishFlask.cs b/Projectiles/Rogue/BrackishFlask.cs index 322bb6ce68..6bbe72d52b 100644 --- a/Projectiles/Rogue/BrackishFlask.cs +++ b/Projectiles/Rogue/BrackishFlask.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BrackishFlask : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brackish Flask"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 180; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); //change - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X, projectile.oldVelocity.Y); - } - float spread = 45f * 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BrackishWaterBlast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrackishWater"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BrackishWater"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Poisoned, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class BrackishFlask : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brackish Flask"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 2; + projectile.timeLeft = 180; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); //change + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X, projectile.oldVelocity.Y); + } + float spread = 45f * 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BrackishWaterBlast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BrackishWater"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BrackishWater"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Poisoned, 300); + } + } +} diff --git a/Projectiles/Rogue/BrackishWater.cs b/Projectiles/Rogue/BrackishWater.cs index e6c7ac013d..47b64e8b17 100644 --- a/Projectiles/Rogue/BrackishWater.cs +++ b/Projectiles/Rogue/BrackishWater.cs @@ -1,68 +1,68 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BrackishWater : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 60; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - projectile.localAI[0] += 1f; - } - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BrackishWaterBlast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Poisoned, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class BrackishWater : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 60; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + projectile.localAI[0] += 1f; + } + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + for (int num457 = 0; num457 < 3; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BrackishWaterBlast"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Poisoned, 300); + } + } +} diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs index 27bc0fd8e9..463d50efea 100644 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ b/Projectiles/Rogue/BrackishWaterBlast.cs @@ -1,111 +1,111 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class BrackishWaterBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water"); - } - - public override void SetDefaults() - { - projectile.width = 130; - projectile.height = 130; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default(Color), 0.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Poisoned, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class BrackishWaterBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water"); + } + + public override void SetDefaults() + { + projectile.width = 130; + projectile.height = 130; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default(Color), 0.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(BuffID.Poisoned, 300); + } + } +} diff --git a/Projectiles/Rogue/Brimblade.cs b/Projectiles/Rogue/Brimblade.cs index 79076962a1..6ff55ec73e 100644 --- a/Projectiles/Rogue/Brimblade.cs +++ b/Projectiles/Rogue/Brimblade.cs @@ -1,48 +1,48 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class Brimblade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimblade"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; - aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.25f, perturbedSpeed.Y * 0.25f, mod.ProjectileType("Brimblade2"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class Brimblade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimblade"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 300; + aiType = 52; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X * 0.25f, perturbedSpeed.Y * 0.25f, mod.ProjectileType("Brimblade2"), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Rogue/Brimblade2.cs b/Projectiles/Rogue/Brimblade2.cs index c7a38f3c66..3a4840d2d4 100644 --- a/Projectiles/Rogue/Brimblade2.cs +++ b/Projectiles/Rogue/Brimblade2.cs @@ -1,38 +1,38 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class Brimblade2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimblade"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; - aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class Brimblade2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimblade"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 3; + projectile.timeLeft = 300; + aiType = 52; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Rogue/Celestus.cs b/Projectiles/Rogue/Celestus.cs index 7cd1813052..f898ec7b24 100644 --- a/Projectiles/Rogue/Celestus.cs +++ b/Projectiles/Rogue/Celestus.cs @@ -1,141 +1,141 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class Celestus : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestus"); - } - - public override void SetDefaults() - { - projectile.width = 94; - projectile.height = 94; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((Main.DiscoR - projectile.alpha) * 0.5f) / 255f, ((Main.DiscoG - projectile.alpha) * 0.5f) / 255f, ((Main.DiscoB - projectile.alpha) * 0.5f) / 255f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 40f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - float num42 = 25f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 4000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 1f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - if (projectile.owner == Main.myPlayer) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.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(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), mod.ProjectileType("Celestus2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), mod.ProjectileType("Celestus2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class Celestus : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestus"); + } + + public override void SetDefaults() + { + projectile.width = 94; + projectile.height = 94; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((Main.DiscoR - projectile.alpha) * 0.5f) / 255f, ((Main.DiscoG - projectile.alpha) * 0.5f) / 255f, ((Main.DiscoB - projectile.alpha) * 0.5f) / 255f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 40f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + float num42 = 25f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 4000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 1f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + if (projectile.owner == Main.myPlayer) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.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(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), mod.ProjectileType("Celestus2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), mod.ProjectileType("Celestus2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122); + } + } +} diff --git a/Projectiles/Rogue/Celestus2.cs b/Projectiles/Rogue/Celestus2.cs index 96f6807ac8..2dbef4cb3c 100644 --- a/Projectiles/Rogue/Celestus2.cs +++ b/Projectiles/Rogue/Celestus2.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class Celestus2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Celestus"); - } - - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 48; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 4; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; - projectile.timeLeft = 85; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.rotation += 2f; - projectile.velocity.X *= 1.02f; - projectile.velocity.Y *= 1.02f; - Lighting.AddLight(projectile.Center, ((Main.DiscoR - projectile.alpha) * 0.5f) / 255f, ((Main.DiscoG - projectile.alpha) * 0.5f) / 255f, ((Main.DiscoB - projectile.alpha) * 0.5f) / 255f); - } - - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class Celestus2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Celestus"); + } + + public override void SetDefaults() + { + projectile.width = 48; + projectile.height = 48; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 4; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 40; + projectile.timeLeft = 85; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.rotation += 2f; + projectile.velocity.X *= 1.02f; + projectile.velocity.Y *= 1.02f; + Lighting.AddLight(projectile.Center, ((Main.DiscoR - projectile.alpha) * 0.5f) / 255f, ((Main.DiscoG - projectile.alpha) * 0.5f) / 255f, ((Main.DiscoB - projectile.alpha) * 0.5f) / 255f); + } + + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + } +} diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index d689b81cca..97c7fc3988 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class CobaltKunaiProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kunai"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - 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; - } - - 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("CobaltKunai")); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CobaltKunaiProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kunai"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + 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; + } + + 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("CobaltKunai")); + } + } + } +} diff --git a/Projectiles/Rogue/CosmicKunai.cs b/Projectiles/Rogue/CosmicKunai.cs index 3b41b79756..8dc94d35b3 100644 --- a/Projectiles/Rogue/CosmicKunai.cs +++ b/Projectiles/Rogue/CosmicKunai.cs @@ -1,70 +1,70 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class CosmicKunai : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kunai"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.alpha += 17; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - 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) - { - float num483 = 28f; - 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; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CosmicKunai : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kunai"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.alpha += 17; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + 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) + { + float num483 = 28f; + 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; + } + } + } +} diff --git a/Projectiles/Rogue/CraniumSmasher.cs b/Projectiles/Rogue/CraniumSmasher.cs index 87f93872a6..7e7c68cbbc 100644 --- a/Projectiles/Rogue/CraniumSmasher.cs +++ b/Projectiles/Rogue/CraniumSmasher.cs @@ -56,4 +56,4 @@ namespace CalamityMod.Projectiles.Rogue return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 33b2afc627..c68c1069c0 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -83,4 +83,4 @@ namespace CalamityMod.Projectiles.Rogue projectile.Damage(); } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index 9f65973730..581294a6be 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -1,64 +1,64 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class Crushax : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crushax"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 300; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - 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; - } - - 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.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class Crushax : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crushax"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.aiStyle = 2; + projectile.timeLeft = 300; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + 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; + } + + 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.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 240); + } + } +} diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index a26add197e..92e1918d59 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -1,67 +1,67 @@ -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 CrystalPiercerProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Piercer"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = -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, 173, 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) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("CrystalPiercer")); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } - } -} \ No newline at end of file +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 CrystalPiercerProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Piercer"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = -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, 173, 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) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("CrystalPiercer")); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120); + } + } +} diff --git a/Projectiles/Rogue/Crystalline.cs b/Projectiles/Rogue/Crystalline.cs index 5b2330badb..bf5894b5f0 100644 --- a/Projectiles/Rogue/Crystalline.cs +++ b/Projectiles/Rogue/Crystalline.cs @@ -1,69 +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.Rogue -{ - public class Crystalline : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystalline"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 120; - 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(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] == 30f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Crystalline2"), (int)((double)projectile.damage * 0.5f), 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; - } - - 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, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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 Crystalline : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystalline"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 120; + 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(projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + projectile.ai[1] += 1f; + if (projectile.ai[1] == 30f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(50); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Crystalline2"), (int)((double)projectile.damage * 0.5f), 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; + } + + 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, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Rogue/Crystalline2.cs b/Projectiles/Rogue/Crystalline2.cs index 0edc49924a..717bdc719e 100644 --- a/Projectiles/Rogue/Crystalline2.cs +++ b/Projectiles/Rogue/Crystalline2.cs @@ -1,54 +1,54 @@ -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 Crystalline2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystalline"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 30; - 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(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) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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 Crystalline2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystalline"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 30; + 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(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) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Rogue/CursedDagger.cs b/Projectiles/Rogue/CursedDagger.cs index cf6e272ab8..18eeb6254f 100644 --- a/Projectiles/Rogue/CursedDagger.cs +++ b/Projectiles/Rogue/CursedDagger.cs @@ -1,56 +1,56 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class CursedDagger : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cursed Dagger"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CursedDagger : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cursed Dagger"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } + } +} diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index 1aec79321a..71b8bb90b3 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -1,75 +1,75 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class DuststormCloud : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.995f; - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DuststormCloud : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity *= 0.995f; + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + } + } +} diff --git a/Projectiles/Rogue/DuststormInABottle.cs b/Projectiles/Rogue/DuststormInABottle.cs index a8ec780f1a..b8533f22af 100644 --- a/Projectiles/Rogue/DuststormInABottle.cs +++ b/Projectiles/Rogue/DuststormInABottle.cs @@ -1,49 +1,49 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class DuststormInABottle : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Duststorm"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 180; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); //change - for (int k = 0; k < 15; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.oldVelocity.X, projectile.oldVelocity.Y); - } - int num220 = Main.rand.Next(20, 31); - if (projectile.owner == Main.myPlayer) - { - for (int num221 = 0; num221 < num220; num221++) - { - Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value17.Normalize(); - value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, mod.ProjectileType("DuststormCloud"), projectile.damage, 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DuststormInABottle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Duststorm"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 2; + projectile.timeLeft = 180; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); //change + for (int k = 0; k < 15; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.oldVelocity.X, projectile.oldVelocity.Y); + } + int num220 = Main.rand.Next(20, 31); + if (projectile.owner == Main.myPlayer) + { + for (int num221 = 0; num221 < num220; num221++) + { + Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value17.Normalize(); + value17 *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, mod.ProjectileType("DuststormCloud"), projectile.damage, 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + } + } + } + } +} diff --git a/Projectiles/Rogue/EmpyreanKnives.cs b/Projectiles/Rogue/EmpyreanKnives.cs index ef54e9e3e6..e7f76193b2 100644 --- a/Projectiles/Rogue/EmpyreanKnives.cs +++ b/Projectiles/Rogue/EmpyreanKnives.cs @@ -1,147 +1,147 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class EmpyreanKnives : ModProjectile - { - public int bounce = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - projectile.extraUpdates = 1; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.GetGlobalProjectile(mod).rogue = true; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 75f) - { - projectile.alpha += 10; - projectile.damage = (int)((double)projectile.damage * 0.95); - projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); - if (projectile.alpha >= 255) - { - projectile.active = false; - } - } - if (projectile.ai[0] < 75f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - else - { - projectile.rotation += 0.5f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 250f; - 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 = 15f; - 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; - } - if (Main.rand.Next(6) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - bounce--; - if (bounce <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - - public override void Kill(int timeLeft) - { - for (int num303 = 0; num303 < 3; num303++) - { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.005f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, 305, 0, 0f, projectile.owner, (float)num2, num); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class EmpyreanKnives : ModProjectile + { + public int bounce = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.melee = true; + projectile.extraUpdates = 1; + } + + public override void AI() + { + if (projectile.ai[1] == 1f) + { + projectile.melee = false; + projectile.GetGlobalProjectile(mod).rogue = true; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 75f) + { + projectile.alpha += 10; + projectile.damage = (int)((double)projectile.damage * 0.95); + projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); + if (projectile.alpha >= 255) + { + projectile.active = false; + } + } + if (projectile.ai[0] < 75f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + else + { + projectile.rotation += 0.5f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 250f; + 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 = 15f; + 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; + } + if (Main.rand.Next(6) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } + + public override void Kill(int timeLeft) + { + for (int num303 = 0; num303 < 3; num303++) + { + int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 0.8f); + Main.dust[num304].noGravity = true; + Main.dust[num304].velocity *= 1.2f; + Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + { + return; + } + float num = (float)damage * 0.005f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, 305, 0, 0f, projectile.owner, (float)num2, num); + } + } +} diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 61263596ba..0783af6b0b 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -1,108 +1,108 @@ -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 EradicatorProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - } - - public override void SetDefaults() - { - projectile.width = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 180; - aiType = 52; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.03f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (Main.rand.Next(2) == 0) - { - if (projectile.owner == Main.myPlayer) - { - 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; - } - } - } - } - } - - 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Rogue/EradicatorProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } -} \ No newline at end of file +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 EradicatorProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + } + + public override void SetDefaults() + { + projectile.width = 58; + projectile.height = 58; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 180; + aiType = 52; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.03f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); + float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); + float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); + float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); + num440 = num437 / num440; + num438 *= num440; + num439 *= num440; + if (Main.rand.Next(2) == 0) + { + if (projectile.owner == Main.myPlayer) + { + 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; + } + } + } + } + } + + 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(31f, 29f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Rogue/EradicatorProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } +} diff --git a/Projectiles/Rogue/ExecutionersBlade.cs b/Projectiles/Rogue/ExecutionersBlade.cs index 7369578e1b..7f0614c7cf 100644 --- a/Projectiles/Rogue/ExecutionersBlade.cs +++ b/Projectiles/Rogue/ExecutionersBlade.cs @@ -1,105 +1,105 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ExecutionersBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blade"); - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 240; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.65f) / 255f); - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - float num472 = projectile.Center.X; - 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) && 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 = 26f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ExecutionersBlade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.aiStyle = 2; + projectile.timeLeft = 240; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.65f) / 255f); + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + float num472 = projectile.Center.X; + 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) && 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 = 26f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Rogue/FeatherKnifeProjectile.cs b/Projectiles/Rogue/FeatherKnifeProjectile.cs index 85463c0700..26593e4062 100644 --- a/Projectiles/Rogue/FeatherKnifeProjectile.cs +++ b/Projectiles/Rogue/FeatherKnifeProjectile.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class FeatherKnifeProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - 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; - } - - 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("FeatherKnife")); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FeatherKnifeProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + 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; + } + + 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("FeatherKnife")); + } + } + } +} diff --git a/Projectiles/Rogue/FlameScytheProjectile.cs b/Projectiles/Rogue/FlameScytheProjectile.cs index 38f53f3f04..c84d385928 100644 --- a/Projectiles/Rogue/FlameScytheProjectile.cs +++ b/Projectiles/Rogue/FlameScytheProjectile.cs @@ -1,73 +1,73 @@ -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 FlameScytheProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.alpha = 55; - aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - 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); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - 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; - } - - 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.immune[projectile.owner] = 6; - target.AddBuff(BuffID.OnFire, 300); - if (projectile.owner == Main.myPlayer) - { - 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 +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 FlameScytheProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + projectile.alpha = 55; + aiType = 52; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + 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); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + + 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.immune[projectile.owner] = 6; + target.AddBuff(BuffID.OnFire, 300); + if (projectile.owner == Main.myPlayer) + { + 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; + } + } + } +} diff --git a/Projectiles/Rogue/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index 624ce38cf9..6684251d5e 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -1,47 +1,47 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class FossilShardThrown : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shard"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.timeLeft = 90; - aiType = 1; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.rotation += projectile.velocity.Y; - projectile.velocity.Y *= 1.05f; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 60); - } - - public override void Kill(int timeLeft) - { - for (int i = 0; i <= 2; i++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FossilShardThrown : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shard"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 1; + projectile.timeLeft = 90; + aiType = 1; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.rotation += projectile.velocity.Y; + projectile.velocity.Y *= 1.05f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 60); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index 1535c505b3..29edc7fb8e 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -1,64 +1,64 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class GelDartProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dart"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - 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; - } - - 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("GelDart")); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Slimed, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class GelDartProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dart"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + 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; + } + + 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("GelDart")); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Slimed, 120); + } + } +} diff --git a/Projectiles/Rogue/GhoulishGouger.cs b/Projectiles/Rogue/GhoulishGouger.cs index 3c0770b9f1..b87b2ca0c6 100644 --- a/Projectiles/Rogue/GhoulishGouger.cs +++ b/Projectiles/Rogue/GhoulishGouger.cs @@ -1,114 +1,114 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class GhoulishGouger : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 4; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 20f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 28f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class GhoulishGouger : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 4; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.7f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 20f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 28f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + } +} diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index f7a7fe379b..949d4d7da8 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -1,87 +1,87 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class IceStarProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - 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; - 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 = 14f; - 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) - { - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class IceStarProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + 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; + 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 = 14f; + 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) + { + 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); + } + } + } +} diff --git a/Projectiles/Rogue/IchorSpear.cs b/Projectiles/Rogue/IchorSpear.cs index 55db5dfd26..53fdc028ab 100644 --- a/Projectiles/Rogue/IchorSpear.cs +++ b/Projectiles/Rogue/IchorSpear.cs @@ -1,63 +1,63 @@ -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 IchorSpear : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - 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; - } - } - - 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 +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 IchorSpear : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + 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; + } + } + + 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); + } + } +} diff --git a/Projectiles/Rogue/IchorSpear2.cs b/Projectiles/Rogue/IchorSpear2.cs index 76c5ce239e..600b55bb8c 100644 --- a/Projectiles/Rogue/IchorSpear2.cs +++ b/Projectiles/Rogue/IchorSpear2.cs @@ -94,4 +94,4 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.Ichor, 120); } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/Lionfish.cs b/Projectiles/Rogue/Lionfish.cs index 820f1a2e3c..5a4d526b8c 100644 --- a/Projectiles/Rogue/Lionfish.cs +++ b/Projectiles/Rogue/Lionfish.cs @@ -1,230 +1,230 @@ -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 Lionfish : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lionfish"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - int num982 = 25; - if (projectile.alpha > 0) - { - projectile.alpha -= num982; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[0] == 0f) - { - float[] var_2_2CA48_cp_0 = projectile.ai; - int var_2_2CA48_cp_1 = 1; - float num73 = var_2_2CA48_cp_0[var_2_2CA48_cp_1]; - var_2_2CA48_cp_0[var_2_2CA48_cp_1] = num73 + 1f; - if (projectile.ai[1] >= 45f) - { - float num986 = 0.98f; - float num987 = 0.35f; - projectile.ai[1] = 45f; - projectile.velocity.X = projectile.velocity.X * num986; - projectile.velocity.Y = projectile.velocity.Y + num987; - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } - } - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - int num988 = 15; - bool flag54 = false; - bool flag55 = false; - float[] var_2_2CB4E_cp_0 = projectile.localAI; - int var_2_2CB4E_cp_1 = 0; - float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; - var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60 * num988)) - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) - { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.Kill(); - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && - ((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)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 6; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - 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(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 72); - 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 < 3; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.KingSlime || target.type == NPCID.WallofFlesh || target.type == NPCID.WallofFleshEye || - target.type == NPCID.SkeletronHead || target.type == NPCID.SkeletronHand) - { - target.buffImmune[BuffID.Venom] = false; - } - target.AddBuff(BuffID.Venom, 240); - } - } -} \ No newline at end of file +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 Lionfish : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lionfish"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + int num982 = 25; + if (projectile.alpha > 0) + { + projectile.alpha -= num982; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.ai[0] == 0f) + { + float[] var_2_2CA48_cp_0 = projectile.ai; + int var_2_2CA48_cp_1 = 1; + float num73 = var_2_2CA48_cp_0[var_2_2CA48_cp_1]; + var_2_2CA48_cp_0[var_2_2CA48_cp_1] = num73 + 1f; + if (projectile.ai[1] >= 45f) + { + float num986 = 0.98f; + float num987 = 0.35f; + projectile.ai[1] = 45f; + projectile.velocity.X = projectile.velocity.X * num986; + projectile.velocity.Y = projectile.velocity.Y + num987; + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + } + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + int num988 = 15; + bool flag54 = false; + bool flag55 = false; + float[] var_2_2CB4E_cp_0 = projectile.localAI; + int var_2_2CB4E_cp_1 = 0; + float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; + var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f; + if (projectile.localAI[0] % 30f == 0f) + { + flag55 = true; + } + int num989 = (int)projectile.ai[1]; + if (projectile.localAI[0] >= (float)(60 * num988)) + { + flag54 = true; + } + else if (num989 < 0 || num989 >= 200) + { + flag54 = true; + } + else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) + { + projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[num989].gfxOffY; + if (flag55) + { + Main.npc[num989].HitEffect(0, 1.0); + } + } + else + { + flag54 = true; + } + if (flag54) + { + projectile.Kill(); + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + ((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)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[0] = 1f; + projectile.ai[1] = (float)i; + projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; + projectile.netUpdate = true; + projectile.StatusNPC(i); + projectile.damage = 0; + int num28 = 6; + Point[] array2 = new Point[num28]; + int num29 = 0; + for (int l = 0; l < 1000; l++) + { + if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) + { + array2[num29++] = new Point(l, Main.projectile[l].timeLeft); + if (num29 >= array2.Length) + { + break; + } + } + } + if (num29 >= array2.Length) + { + int num30 = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[num30].Y) + { + num30 = m; + } + } + Main.projectile[array2[num30].X].Kill(); + } + } + } + } + } + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + 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(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 72); + 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 < 3; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.KingSlime || target.type == NPCID.WallofFlesh || target.type == NPCID.WallofFleshEye || + target.type == NPCID.SkeletronHead || target.type == NPCID.SkeletronHand) + { + target.buffImmune[BuffID.Venom] = false; + } + target.AddBuff(BuffID.Venom, 240); + } + } +} diff --git a/Projectiles/Rogue/Malachite.cs b/Projectiles/Rogue/Malachite.cs index 5870878362..a173a4e600 100644 --- a/Projectiles/Rogue/Malachite.cs +++ b/Projectiles/Rogue/Malachite.cs @@ -1,94 +1,94 @@ -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 Malachite : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malachite"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.extraUpdates = 3; - projectile.aiStyle = 93; - aiType = 514; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.alpha -= 3; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 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; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 7; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +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 Malachite : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malachite"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.extraUpdates = 3; + projectile.aiStyle = 93; + aiType = 514; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.alpha -= 3; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 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; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 203, 103, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 7; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Rogue/MalachiteBolt.cs b/Projectiles/Rogue/MalachiteBolt.cs index 355cbe06f1..ec02ea9ba3 100644 --- a/Projectiles/Rogue/MalachiteBolt.cs +++ b/Projectiles/Rogue/MalachiteBolt.cs @@ -1,126 +1,126 @@ -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 MalachiteBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malachite"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.alpha = 255; - projectile.extraUpdates = 10; - 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; - projectile.alpha -= 3; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 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; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.penetrate <= 1) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GoliathExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - 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 < 70; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void Kill(int timeLeft) - { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 15; - projectile.height = 15; - 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 < 7; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 3; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +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 MalachiteBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malachite"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 2; + projectile.alpha = 255; + projectile.extraUpdates = 10; + 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; + projectile.alpha -= 3; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 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; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 203, 103, projectile.alpha); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.penetrate <= 1) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GoliathExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + 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 < 70; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void Kill(int timeLeft) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 15; + projectile.height = 15; + 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 < 7; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.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 < 3; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + 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, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs index f10b60b715..21bed66bb1 100644 --- a/Projectiles/Rogue/MangroveChakramProjectile.cs +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -1,65 +1,65 @@ -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 MangroveChakramProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chakram"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 600; - aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.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 bool OnTileCollide(Vector2 oldVelocity) - { - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 240); - } - } -} \ No newline at end of file +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 MangroveChakramProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chakram"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 600; + aiType = 52; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.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 bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 240); + } + } +} diff --git a/Projectiles/Rogue/MeteorFist.cs b/Projectiles/Rogue/MeteorFist.cs index 6c6c673d6d..e2d27349f7 100644 --- a/Projectiles/Rogue/MeteorFist.cs +++ b/Projectiles/Rogue/MeteorFist.cs @@ -165,4 +165,4 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.OnFire, 120); } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/MoltenAmputator.cs b/Projectiles/Rogue/MoltenAmputator.cs index 8a8230ddb2..d351f60acb 100644 --- a/Projectiles/Rogue/MoltenAmputator.cs +++ b/Projectiles/Rogue/MoltenAmputator.cs @@ -1,63 +1,63 @@ -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 MoltenAmputator : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amputator"); - } - - public override void SetDefaults() - { - projectile.width = 74; - projectile.height = 74; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 300; - aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 3; - int num251 = Main.rand.Next(1, 3); - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("MoltenBlobThrown"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - 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); - } - } - } -} \ No newline at end of file +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 MoltenAmputator : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amputator"); + } + + public override void SetDefaults() + { + projectile.width = 74; + projectile.height = 74; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 300; + aiType = 52; + projectile.GetGlobalProjectile(mod).rogue = 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 3; + int num251 = Main.rand.Next(1, 3); + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("MoltenBlobThrown"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + 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/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs index 82f6c65127..8c7d6775bf 100644 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ b/Projectiles/Rogue/MoltenBlobThrown.cs @@ -1,97 +1,97 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class MoltenBlobThrown : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blob"); - Main.projFrames[projectile.type] = 2; - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.velocity.X *= 0.95f; - if (projectile.wet || projectile.lavaWet) - { - projectile.velocity.Y = 0f; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + 0.1f; - if (projectile.velocity.Y > 5f) - { - projectile.velocity.Y = 5f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 150, 0, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 10; - projectile.height = 10; - 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 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); - 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 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class MoltenBlobThrown : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blob"); + Main.projFrames[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.velocity.X *= 0.95f; + if (projectile.wet || projectile.lavaWet) + { + projectile.velocity.Y = 0f; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + 0.1f; + if (projectile.velocity.Y > 5f) + { + projectile.velocity.Y = 5f; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 150, 0, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 10; + projectile.height = 10; + 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 < 3; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); + 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 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f); + } + } + } +} diff --git a/Projectiles/Rogue/Mycoroot.cs b/Projectiles/Rogue/Mycoroot.cs index 83005a3ccc..12813a4e5a 100644 --- a/Projectiles/Rogue/Mycoroot.cs +++ b/Projectiles/Rogue/Mycoroot.cs @@ -1,48 +1,48 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class Mycoroot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Root"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.penetrate = 1; - 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, 56, 0f, 0f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.alpha += 20; - if (projectile.alpha >= 255) - { - projectile.Kill(); - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - } - - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class Mycoroot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Root"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.penetrate = 1; + 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, 56, 0f, 0f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.alpha += 20; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + } + + 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; + } + } +} diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index e98ecb7a9c..056e49a46f 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -1,64 +1,64 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class MythrilKnifeProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - 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; - } - - 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("MythrilKnife")); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 200); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class MythrilKnifeProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + 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; + } + + 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("MythrilKnife")); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 200); + } + } +} diff --git a/Projectiles/Rogue/OPHammer.cs b/Projectiles/Rogue/OPHammer.cs index c38056a030..7061d7367a 100644 --- a/Projectiles/Rogue/OPHammer.cs +++ b/Projectiles/Rogue/OPHammer.cs @@ -1,122 +1,122 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class OPHammer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - } - - public override void SetDefaults() - { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 20f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 16f; - float num43 = 3.2f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - if (projectile.owner == Main.myPlayer) - { - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class OPHammer : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + } + + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 62; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 2; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 20f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 16f; + float num43 = 3.2f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); + if (projectile.owner == Main.myPlayer) + { + 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; + } + } + } +} diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index 444b7aebdb..cd183156ca 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class OrichalcumSpikedGemstoneProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gemstone"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.aiStyle = 2; - projectile.penetrate = 6; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Vector2 velocity = projectile.velocity; - if (projectile.velocity.Y != velocity.Y && (velocity.Y < -3f || velocity.Y > 3f)) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.Center.X, (int)projectile.Center.Y, 1); - } - if (projectile.velocity.X != velocity.X) - { - projectile.velocity.X = velocity.X * -0.5f; - } - if (projectile.velocity.Y != velocity.Y && velocity.Y > 1f) - { - projectile.velocity.Y = velocity.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 (Main.rand.Next(2) == 0) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("OrichalcumSpikedGemstone")); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class OrichalcumSpikedGemstoneProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gemstone"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.aiStyle = 2; + projectile.penetrate = 6; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Vector2 velocity = projectile.velocity; + if (projectile.velocity.Y != velocity.Y && (velocity.Y < -3f || velocity.Y > 3f)) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.Center.X, (int)projectile.Center.Y, 1); + } + if (projectile.velocity.X != velocity.X) + { + projectile.velocity.X = velocity.X * -0.5f; + } + if (projectile.velocity.Y != velocity.Y && velocity.Y > 1f) + { + projectile.velocity.Y = velocity.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 (Main.rand.Next(2) == 0) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("OrichalcumSpikedGemstone")); + } + } + } +} diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index 03b3f3df67..30d2e95c4d 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -1,59 +1,59 @@ -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 PalladiumJavelinProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Javelin"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -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(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("PalladiumJavelin")); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.BoneJavelin, 500); - } - } -} \ No newline at end of file +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 PalladiumJavelinProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Javelin"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = -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(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("PalladiumJavelin")); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.BoneJavelin, 500); + } + } +} diff --git a/Projectiles/Rogue/ProfanedTrident.cs b/Projectiles/Rogue/ProfanedTrident.cs index 34c15af248..3f5c28b022 100644 --- a/Projectiles/Rogue/ProfanedTrident.cs +++ b/Projectiles/Rogue/ProfanedTrident.cs @@ -1,105 +1,105 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ProfanedTrident : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - 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) + 0.785f; - 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 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GoliathExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; - } - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 150; - projectile.height = 150; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1.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, 244, 0f, 0f, 100, default(Color), 1.7f); - 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, 244, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 360); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ProfanedTrident : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 62; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + 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) + 0.785f; + 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 = 24f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("GoliathExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + } + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 150; + projectile.height = 150; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1.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, 244, 0f, 0f, 100, default(Color), 1.7f); + 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, 244, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 360); + } + } +} diff --git a/Projectiles/Rogue/Pwnagehammer.cs b/Projectiles/Rogue/Pwnagehammer.cs index 63b3071f4e..55f998201c 100644 --- a/Projectiles/Rogue/Pwnagehammer.cs +++ b/Projectiles/Rogue/Pwnagehammer.cs @@ -1,58 +1,58 @@ -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 Pwnagehammer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 120; - projectile.extraUpdates = 3; - aiType = 301; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.velocity.X *= 1.06f; - projectile.velocity.Y *= 1.06f; - } - - 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 bool OnTileCollide(Vector2 oldVelocity) - { - 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 +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 Pwnagehammer : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 120; + projectile.extraUpdates = 3; + aiType = 301; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.velocity.X *= 1.06f; + projectile.velocity.Y *= 1.06f; + } + + 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 bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + } +} diff --git a/Projectiles/Rogue/RotBallProjectile.cs b/Projectiles/Rogue/RotBallProjectile.cs index 57e22e8534..9db30d7fd9 100644 --- a/Projectiles/Rogue/RotBallProjectile.cs +++ b/Projectiles/Rogue/RotBallProjectile.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class RotBallProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = 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; - } - - 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("RotBall")); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class RotBallProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = 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; + } + + 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("RotBall")); + } + } + } +} diff --git a/Projectiles/Rogue/RoyalKnife.cs b/Projectiles/Rogue/RoyalKnife.cs index f1d556c441..0c108dcf9c 100644 --- a/Projectiles/Rogue/RoyalKnife.cs +++ b/Projectiles/Rogue/RoyalKnife.cs @@ -1,115 +1,115 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class RoyalKnife : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 240f) - { - projectile.alpha += 4; - projectile.damage = (int)((double)projectile.damage * 0.95); - projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); - } - if (projectile.ai[0] < 240f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - else - { - projectile.rotation += 0.5f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 800f; - 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 = 35f; - 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; - } - if (Main.rand.Next(6) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - for (int num303 = 0; num303 < 3; num303++) - { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default(Color), 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 600); - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.015f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("RoyalHeal"), 0, 0f, projectile.owner, (float)num2, num); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class RoyalKnife : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 240f) + { + projectile.alpha += 4; + projectile.damage = (int)((double)projectile.damage * 0.95); + projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.95)); + } + if (projectile.ai[0] < 240f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + else + { + projectile.rotation += 0.5f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 800f; + 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 = 35f; + 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; + } + if (Main.rand.Next(6) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void Kill(int timeLeft) + { + for (int num303 = 0; num303 < 3; num303++) + { + int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default(Color), 0.8f); + Main.dust[num304].noGravity = true; + Main.dust[num304].velocity *= 1.2f; + Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 600); + if (target.type == NPCID.TargetDummy) + { + return; + } + float num = (float)damage * 0.015f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("RoyalHeal"), 0, 0f, projectile.owner, (float)num2, num); + } + } +} diff --git a/Projectiles/Rogue/ScarletBlast.cs b/Projectiles/Rogue/ScarletBlast.cs index 0216e1b7e9..23ca076571 100644 --- a/Projectiles/Rogue/ScarletBlast.cs +++ b/Projectiles/Rogue/ScarletBlast.cs @@ -94,4 +94,4 @@ namespace CalamityMod.Projectiles.Rogue } } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index db50263fd8..5b25a009f9 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -100,4 +100,4 @@ namespace CalamityMod.Projectiles.Rogue return true; } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/ScourgeoftheDesert.cs b/Projectiles/Rogue/ScourgeoftheDesert.cs index 132348b17a..07ecaeb2fd 100644 --- a/Projectiles/Rogue/ScourgeoftheDesert.cs +++ b/Projectiles/Rogue/ScourgeoftheDesert.cs @@ -1,46 +1,46 @@ -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 ScourgeoftheDesert : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scourge"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.aiStyle = 113; - aiType = 598; - projectile.penetrate = 3; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.velocity.X *= 1.025f; - 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 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 +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 ScourgeoftheDesert : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.aiStyle = 113; + aiType = 598; + projectile.penetrate = 3; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.velocity.X *= 1.025f; + 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 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; + } + } +} diff --git a/Projectiles/Rogue/ScourgeoftheDesert2.cs b/Projectiles/Rogue/ScourgeoftheDesert2.cs index 74b643997e..9c3e005e3e 100644 --- a/Projectiles/Rogue/ScourgeoftheDesert2.cs +++ b/Projectiles/Rogue/ScourgeoftheDesert2.cs @@ -65,4 +65,4 @@ namespace CalamityMod.Projectiles.Rogue return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/SeashellBoomerangProjectile.cs b/Projectiles/Rogue/SeashellBoomerangProjectile.cs index 4bee5a8fa8..ce7ebffa38 100644 --- a/Projectiles/Rogue/SeashellBoomerangProjectile.cs +++ b/Projectiles/Rogue/SeashellBoomerangProjectile.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SeashellBoomerangProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Boomerang"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 240; - aiType = 52; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SeashellBoomerangProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Boomerang"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 240; + aiType = 52; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + } +} diff --git a/Projectiles/Rogue/ShatteredExplosion.cs b/Projectiles/Rogue/ShatteredExplosion.cs index 3ac1e1474b..ab062e8a93 100644 --- a/Projectiles/Rogue/ShatteredExplosion.cs +++ b/Projectiles/Rogue/ShatteredExplosion.cs @@ -1,50 +1,50 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ShatteredExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 150; - projectile.height = 150; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 15; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int i = 0; i < 5; i++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ShatteredExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 150; + projectile.height = 150; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 15; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int i = 0; i < 5; i++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 180); + } + } +} diff --git a/Projectiles/Rogue/ShatteredSun.cs b/Projectiles/Rogue/ShatteredSun.cs index 6d08a960ec..002ec2de5c 100644 --- a/Projectiles/Rogue/ShatteredSun.cs +++ b/Projectiles/Rogue/ShatteredSun.cs @@ -1,95 +1,95 @@ -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 ShatteredSun : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shattered Sun"); - } - - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - 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] < 5f) - { - projectile.alpha -= 50; - } - if (projectile.ai[1] == 5f) - { - projectile.alpha = 0; - projectile.tileCollide = false; - } - - if (projectile.ai[1] == 12f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ShatteredSun2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.active = 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - return true; - } - - 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, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default(Color), 1f); - } - } - } -} \ No newline at end of file +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 ShatteredSun : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shattered Sun"); + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + 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] < 5f) + { + projectile.alpha -= 50; + } + if (projectile.ai[1] == 5f) + { + projectile.alpha = 0; + projectile.tileCollide = false; + } + + if (projectile.ai[1] == 12f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(10); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ShatteredSun2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.active = 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + return true; + } + + 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, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default(Color), 1f); + } + } + } +} diff --git a/Projectiles/Rogue/ShatteredSun2.cs b/Projectiles/Rogue/ShatteredSun2.cs index 73ff6dcb24..759bc66308 100644 --- a/Projectiles/Rogue/ShatteredSun2.cs +++ b/Projectiles/Rogue/ShatteredSun2.cs @@ -1,83 +1,83 @@ -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 ShatteredSun2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shattered Sun"); - } - - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - 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] == 8f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ShatteredSun3"), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); - } - projectile.active = 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - return true; - } - - 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, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default(Color), 1f); - } - } - } -} \ No newline at end of file +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 ShatteredSun2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shattered Sun"); + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + 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] == 8f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(10); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ShatteredSun3"), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.active = 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + return true; + } + + 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, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default(Color), 1f); + } + } + } +} diff --git a/Projectiles/Rogue/ShatteredSun3.cs b/Projectiles/Rogue/ShatteredSun3.cs index ca323fc5de..a4e95ddca8 100644 --- a/Projectiles/Rogue/ShatteredSun3.cs +++ b/Projectiles/Rogue/ShatteredSun3.cs @@ -1,98 +1,98 @@ -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 ShatteredSun3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shattered Sun"); - } - - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.penetrate = 1; - 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; - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 750f; - 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 = 20f; - 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 * 15f + num484) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; - } - } - - 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) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - return true; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default(Color), 1f); - } - } - } -} \ No newline at end of file +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 ShatteredSun3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shattered Sun"); + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.friendly = true; + projectile.penetrate = 1; + 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; + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 750f; + 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 = 20f; + 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 * 15f + num484) / 16f; + projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; + } + } + + 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) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ShatteredExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + return true; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default(Color), 1f); + } + } + } +} diff --git a/Projectiles/Rogue/SpearofPaleolith.cs b/Projectiles/Rogue/SpearofPaleolith.cs index 19424a6790..a4e927483b 100644 --- a/Projectiles/Rogue/SpearofPaleolith.cs +++ b/Projectiles/Rogue/SpearofPaleolith.cs @@ -1,74 +1,74 @@ -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 SpearofPaleolith : ModProjectile - { - private int shardRainTimer = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - shardRainTimer--; - if (Main.rand.Next(4) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, 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; - } - if (shardRainTimer == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("FossilShardThrown"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - } - shardRainTimer = 3; - } - } - - 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, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ArmorCrunch"), 120); - } - } -} \ No newline at end of file +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 SpearofPaleolith : ModProjectile + { + private int shardRainTimer = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + shardRainTimer--; + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, 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; + } + if (shardRainTimer == 0) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("FossilShardThrown"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + } + shardRainTimer = 3; + } + } + + 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, 159, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 120); + } + } +} diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs index ed88a2756a..a81bc0ef65 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -1,63 +1,63 @@ -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 TarragonThrowingDartProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dart"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 3; - 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, 75, 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("TarragonThrowingDart")); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 3; - } - } -} \ No newline at end of file +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 TarragonThrowingDartProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dart"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 3; + 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, 75, 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("TarragonThrowingDart")); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 3; + } + } +} diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index 9950b75f53..2a272c4473 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class TitaniumShurikenProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shuriken"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = 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; - } - - 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("TitaniumShuriken")); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class TitaniumShurikenProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shuriken"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = 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; + } + + 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("TitaniumShuriken")); + } + } + } +} diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index 93a243df30..7e480844d9 100644 --- a/Projectiles/Rogue/ToothBallProjectile.cs +++ b/Projectiles/Rogue/ToothBallProjectile.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ToothBallProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ball"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = 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; - } - - 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("ToothBall")); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ToothBallProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = 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; + } + + 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("ToothBall")); + } + } + } +} diff --git a/Projectiles/Rogue/TriactisOPHammer.cs b/Projectiles/Rogue/TriactisOPHammer.cs index 572fae9794..b84d64ba35 100644 --- a/Projectiles/Rogue/TriactisOPHammer.cs +++ b/Projectiles/Rogue/TriactisOPHammer.cs @@ -1,145 +1,145 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class TriactisOPHammer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - } - - public override void SetDefaults() - { - projectile.width = 160; - projectile.height = 160; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 20f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 20f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MageHammerBoom"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - 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 = 60; - 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 num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(2) == 0 ? 89 : 229, 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 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(2) == 0 ? 89 : 229, 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, Main.rand.Next(2) == 0 ? 89 : 229, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class TriactisOPHammer : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + } + + public override void SetDefaults() + { + projectile.width = 160; + projectile.height = 160; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 20f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 20f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("MageHammerBoom"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + } + 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 = 60; + 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 num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(2) == 0 ? 89 : 229, 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 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(2) == 0 ? 89 : 229, 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, Main.rand.Next(2) == 0 ? 89 : 229, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Rogue/UrchinStinger.cs b/Projectiles/Rogue/UrchinStinger.cs index 1b749c7785..fd82e79661 100644 --- a/Projectiles/Rogue/UrchinStinger.cs +++ b/Projectiles/Rogue/UrchinStinger.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class UrchinStinger : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stinger"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 180); - } - - 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("UrchinStinger")); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class UrchinStinger : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stinger"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 180); + } + + 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("UrchinStinger")); + } + } + } +} diff --git a/Projectiles/Rogue/Valediction.cs b/Projectiles/Rogue/Valediction.cs index 54e5696507..66e9e6ffc6 100644 --- a/Projectiles/Rogue/Valediction.cs +++ b/Projectiles/Rogue/Valediction.cs @@ -1,185 +1,185 @@ -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 Valediction : 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 = -1; - 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.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) - { - projectile.ai[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 num42 = 30f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - 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 +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 Valediction : 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 = -1; + 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.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 60f) + { + projectile.ai[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 num42 = 30f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; + float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); + if (num46 > 3000f) + { + projectile.Kill(); + } + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num43; + } + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num43; + } + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + } + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + { + projectile.Kill(); + } + } + } + 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; + } + } + } +} diff --git a/Projectiles/Rogue/Valediction2.cs b/Projectiles/Rogue/Valediction2.cs index b25c00edb4..e0e894dd85 100644 --- a/Projectiles/Rogue/Valediction2.cs +++ b/Projectiles/Rogue/Valediction2.cs @@ -206,4 +206,4 @@ namespace CalamityMod.Projectiles.Rogue } } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/WulfrumKnife.cs b/Projectiles/Rogue/WulfrumKnife.cs index 8568a6b254..91c75d1fb9 100644 --- a/Projectiles/Rogue/WulfrumKnife.cs +++ b/Projectiles/Rogue/WulfrumKnife.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class WulfrumKnife : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 2; - projectile.timeLeft = 600; - aiType = 48; - projectile.GetGlobalProjectile(mod).rogue = 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; - } - - 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("WulfrumKnife")); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class WulfrumKnife : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Knife"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.aiStyle = 2; + projectile.timeLeft = 600; + aiType = 48; + projectile.GetGlobalProjectile(mod).rogue = 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; + } + + 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("WulfrumKnife")); + } + } + } +} diff --git a/Projectiles/Rogue/XerocPitchforkProjectile.cs b/Projectiles/Rogue/XerocPitchforkProjectile.cs index 8fcdcc7c96..159ff2f84b 100644 --- a/Projectiles/Rogue/XerocPitchforkProjectile.cs +++ b/Projectiles/Rogue/XerocPitchforkProjectile.cs @@ -1,70 +1,70 @@ -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 XerocPitchforkProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pitchfork"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - 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) - { - projectile.damage /= 2; - if (projectile.damage < 1) - { - projectile.damage = 1; - } - target.immune[projectile.owner] = 2; - target.AddBuff(BuffID.CursedInferno, 300); - } - } -} \ No newline at end of file +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 XerocPitchforkProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pitchfork"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + 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) + { + projectile.damage /= 2; + if (projectile.damage < 1) + { + projectile.damage = 1; + } + target.immune[projectile.owner] = 2; + target.AddBuff(BuffID.CursedInferno, 300); + } + } +} diff --git a/Projectiles/Shrines/GladiatorSword.cs b/Projectiles/Shrines/GladiatorSword.cs index 7dff13a043..31de11effb 100644 --- a/Projectiles/Shrines/GladiatorSword.cs +++ b/Projectiles/Shrines/GladiatorSword.cs @@ -66,4 +66,4 @@ namespace CalamityMod.Projectiles.Shrines projectile.velocity.X = ((vector.X > 0f) ? -0.000001f : 0f); } } -} \ No newline at end of file +} diff --git a/Projectiles/Shrines/GladiatorSword2.cs b/Projectiles/Shrines/GladiatorSword2.cs index 4d5a3c0d0f..be260fc3df 100644 --- a/Projectiles/Shrines/GladiatorSword2.cs +++ b/Projectiles/Shrines/GladiatorSword2.cs @@ -66,4 +66,4 @@ namespace CalamityMod.Projectiles.Shrines projectile.velocity.X = ((vector.X > 0f) ? -0.000001f : 0f); } } -} \ No newline at end of file +} diff --git a/Projectiles/Shrines/LuxorsGiftMagic.cs b/Projectiles/Shrines/LuxorsGiftMagic.cs index 11c6902fb3..f22e59e29f 100644 --- a/Projectiles/Shrines/LuxorsGiftMagic.cs +++ b/Projectiles/Shrines/LuxorsGiftMagic.cs @@ -73,4 +73,4 @@ namespace CalamityMod.Projectiles.Shrines projectile.velocity *= 0.25f; } } -} \ No newline at end of file +} diff --git a/Projectiles/Shrines/LuxorsGiftMelee.cs b/Projectiles/Shrines/LuxorsGiftMelee.cs index e72b66246a..145e46211f 100644 --- a/Projectiles/Shrines/LuxorsGiftMelee.cs +++ b/Projectiles/Shrines/LuxorsGiftMelee.cs @@ -104,4 +104,4 @@ namespace CalamityMod.Projectiles.Shrines return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Shrines/LuxorsGiftRanged.cs b/Projectiles/Shrines/LuxorsGiftRanged.cs index 62b764ce6f..91f98d6e78 100644 --- a/Projectiles/Shrines/LuxorsGiftRanged.cs +++ b/Projectiles/Shrines/LuxorsGiftRanged.cs @@ -92,4 +92,4 @@ namespace CalamityMod.Projectiles.Shrines } } } -} \ No newline at end of file +} diff --git a/Projectiles/Shrines/LuxorsGiftRogue.cs b/Projectiles/Shrines/LuxorsGiftRogue.cs index 793fef684b..f57f2cd6d8 100644 --- a/Projectiles/Shrines/LuxorsGiftRogue.cs +++ b/Projectiles/Shrines/LuxorsGiftRogue.cs @@ -103,4 +103,4 @@ namespace CalamityMod.Projectiles.Shrines return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Shrines/LuxorsGiftSummon.cs b/Projectiles/Shrines/LuxorsGiftSummon.cs index 76a029b80f..4936987b47 100644 --- a/Projectiles/Shrines/LuxorsGiftSummon.cs +++ b/Projectiles/Shrines/LuxorsGiftSummon.cs @@ -282,4 +282,4 @@ namespace CalamityMod.Projectiles.Shrines return new Color(255, 255, 255, 100); } } -} \ No newline at end of file +} diff --git a/Projectiles/Shrines/UnstableSpark.cs b/Projectiles/Shrines/UnstableSpark.cs index 36f34cba5a..6b3f927496 100644 --- a/Projectiles/Shrines/UnstableSpark.cs +++ b/Projectiles/Shrines/UnstableSpark.cs @@ -95,4 +95,4 @@ namespace CalamityMod.Projectiles.Shrines return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Summon/AngryChicken.cs b/Projectiles/Summon/AngryChicken.cs index 85464d7c43..655b69170b 100644 --- a/Projectiles/Summon/AngryChicken.cs +++ b/Projectiles/Summon/AngryChicken.cs @@ -1,292 +1,292 @@ -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.Summon -{ - public class AngryChicken : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Son of Yharon"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 100; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.extraUpdates = 1; - projectile.minionSlots = 4f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 100; - 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, 244, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - 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; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 800f; - float num634 = 1200f; - float num635 = 3000f; - float num636 = 500f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1.2f * num, 0.8f * num, 0f * num); - bool flag64 = projectile.type == mod.ProjectileType("AngryChicken"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("AngryChicken"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.aChicken = false; - } - if (modPlayer.aChicken) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("AngryChicken")); - 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 = 2; - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 1; - 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 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = 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.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - 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 * 8f; - projectile.netUpdate = true; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class AngryChicken : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Son of Yharon"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 100; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.extraUpdates = 1; + projectile.minionSlots = 4f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 100; + 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, 244, 0f, 0f, 0, default(Color), 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + 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; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 800f; + float num634 = 1200f; + float num635 = 3000f; + float num636 = 500f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 1.2f * num, 0.8f * num, 0f * num); + bool flag64 = projectile.type == mod.ProjectileType("AngryChicken"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("AngryChicken"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.aChicken = false; + } + if (modPlayer.aChicken) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("AngryChicken")); + 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 = 2; + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 1; + 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 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = 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.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + 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 * 8f; + projectile.netUpdate = true; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/AquaticStar.cs b/Projectiles/Summon/AquaticStar.cs index 550d96d679..3764901260 100644 --- a/Projectiles/Summon/AquaticStar.cs +++ b/Projectiles/Summon/AquaticStar.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class AquaticStar : ModProjectile - { - public float dust = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Star"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = 66; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - aiType = 388; - } - - public override void AI() - { - if (dust == 0f) - { - 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, 33, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 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.rotation += projectile.velocity.X * 0.04f; - bool flag64 = projectile.type == mod.ProjectileType("AquaticStar"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("AquaticStar"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.aStar = false; - } - if (modPlayer.aStar) - { - projectile.timeLeft = 2; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class AquaticStar : ModProjectile + { + public float dust = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Star"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.aiStyle = 66; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + aiType = 388; + } + + public override void AI() + { + if (dust == 0f) + { + 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, 33, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 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.rotation += projectile.velocity.X * 0.04f; + bool flag64 = projectile.type == mod.ProjectileType("AquaticStar"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("AquaticStar"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.aStar = false; + } + if (modPlayer.aStar) + { + projectile.timeLeft = 2; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + } + } +} diff --git a/Projectiles/Summon/BigBustyRose.cs b/Projectiles/Summon/BigBustyRose.cs index 26f18185ce..3f042c6711 100644 --- a/Projectiles/Summon/BigBustyRose.cs +++ b/Projectiles/Summon/BigBustyRose.cs @@ -1,245 +1,245 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Summon -{ - public class BigBustyRose : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Big Busty Rose"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 78; - projectile.height = 126; - 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 = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("BigBustyRose"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.brimstoneWaifu && !modPlayer.allWaifus) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.bWaifu = false; - } - if (modPlayer.bWaifu) - { - projectile.timeLeft = 2; - } - } - 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++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 235, 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 / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - projectile.frameCounter++; - if (projectile.frameCounter > 20) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1.25f * num, 0f * num, 0.5f * num); - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 700f; - float num636 = 400f; //150 - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("BigBustyRose")); - 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; - } - } - } - 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; - } - 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; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 5f; //6 - if (flag26) - { - num650 = 12f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(-500f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 6.5f) //200 and 8 - { - num650 = 6.5f; //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.18f; - projectile.velocity.Y = -0.08f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 160f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 14f; - int num658 = mod.ProjectileType("BrimstoneHellfireballFriendly"); - if (flag25 && projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 200; - Main.projectile[num659].GetGlobalProjectile(mod).forceMinion = true; - projectile.netUpdate = true; - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Summon +{ + public class BigBustyRose : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Big Busty Rose"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 78; + projectile.height = 126; + 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 = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("BigBustyRose"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.brimstoneWaifu && !modPlayer.allWaifus) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.bWaifu = false; + } + if (modPlayer.bWaifu) + { + projectile.timeLeft = 2; + } + } + 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++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 235, 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 / + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + projectile.frameCounter++; + if (projectile.frameCounter > 20) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 1.25f * num, 0f * num, 0.5f * num); + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 700f; + float num636 = 400f; //150 + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("BigBustyRose")); + 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; + } + } + } + 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; + } + 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; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 5f; //6 + if (flag26) + { + num650 = 12f; //15 + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(-500f, -60f); //-60 + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 6.5f) //200 and 8 + { + num650 = 6.5f; //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.18f; + projectile.velocity.Y = -0.08f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 160f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 14f; + int num658 = mod.ProjectileType("BrimstoneHellfireballFriendly"); + if (flag25 && projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num659].timeLeft = 200; + Main.projectile[num659].GetGlobalProjectile(mod).forceMinion = true; + projectile.netUpdate = true; + } + } + } + } + } +} diff --git a/Projectiles/Summon/BloodClotMinion.cs b/Projectiles/Summon/BloodClotMinion.cs index c39c0606fa..52899b316b 100644 --- a/Projectiles/Summon/BloodClotMinion.cs +++ b/Projectiles/Summon/BloodClotMinion.cs @@ -1,301 +1,301 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class BloodClotMinion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Clot"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 36; - projectile.height = 36; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - 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, 5, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - 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; - } - int num1262 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, 0f, 0f, 0, default(Color), 1f); - Main.dust[num1262].velocity *= 0.1f; - Main.dust[num1262].scale = 0.7f; - Main.dust[num1262].noGravity = true; - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - bool flag64 = projectile.type == mod.ProjectileType("BloodClotMinion"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("BloodClot"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.bClot = false; - } - if (modPlayer.bClot) - { - projectile.timeLeft = 2; - } - } - int num3; - for (int num534 = 0; num534 < 1000; num534 = num3 + 1) - { - if (num534 != projectile.whoAmI && Main.projectile[num534].active && Main.projectile[num534].owner == projectile.owner && - Main.projectile[num534].type == mod.ProjectileType("BloodClotMinion") && - Math.Abs(projectile.position.X - Main.projectile[num534].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num534].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num534].position.X) - { - projectile.velocity.X = projectile.velocity.X - 0.05f; - } - else - { - projectile.velocity.X = projectile.velocity.X + 0.05f; - } - if (projectile.position.Y < Main.projectile[num534].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + 0.05f; - } - } - num3 = num534; - } - float num535 = projectile.position.X; - float num536 = projectile.position.Y; - float num537 = 1300f; - bool flag19 = false; - int num538 = 1100; - if (projectile.ai[1] != 0f) - { - num538 = 1800; - } - if (Math.Abs(projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(projectile.Center.Y - Main.player[projectile.owner].Center.Y) > (float)num538) - { - projectile.ai[0] = 1f; - } - if (projectile.ai[0] == 0f) - { - 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)) - { - float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); - float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); - if (num545 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num542].position, Main.npc[num542].width, Main.npc[num542].height)) - { - num537 = num545; - num535 = num543; - num536 = num544; - flag19 = true; - } - } - num3 = num542; - } - } - } - if (!flag19) - { - float num546 = 8f; - if (projectile.ai[0] == 1f) - { - num546 = 12f; - } - Vector2 vector42 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num547 = Main.player[projectile.owner].Center.X - vector42.X; - float num548 = Main.player[projectile.owner].Center.Y - vector42.Y - 60f; - float num549 = (float)Math.Sqrt((double)(num547 * num547 + num548 * num548)); - if (num549 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - } - if (num549 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); - } - if (num549 > 70f) - { - num549 = num546 / num549; - num547 *= num549; - num548 *= num549; - projectile.velocity.X = (projectile.velocity.X * 20f + num547) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num548) / 21f; - } - else - { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - projectile.velocity *= 1.01f; - } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - return; - } - } - else - { - if (projectile.ai[1] == -1f) - { - projectile.ai[1] = 11f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] -= 1f; - } - if (projectile.ai[1] == 0f) - { - float num550 = 8f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num551 = num535 - vector43.X; - float num552 = num536 - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) - { - num550 = 10f; //14 - } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; - } - else - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) - { - projectile.velocity *= 1.05f; - } - } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - return; - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && - ((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)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class BloodClotMinion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blood Clot"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 36; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + 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, 5, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + 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; + } + int num1262 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, 0f, 0f, 0, default(Color), 1f); + Main.dust[num1262].velocity *= 0.1f; + Main.dust[num1262].scale = 0.7f; + Main.dust[num1262].noGravity = true; + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + bool flag64 = projectile.type == mod.ProjectileType("BloodClotMinion"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("BloodClot"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.bClot = false; + } + if (modPlayer.bClot) + { + projectile.timeLeft = 2; + } + } + int num3; + for (int num534 = 0; num534 < 1000; num534 = num3 + 1) + { + if (num534 != projectile.whoAmI && Main.projectile[num534].active && Main.projectile[num534].owner == projectile.owner && + Main.projectile[num534].type == mod.ProjectileType("BloodClotMinion") && + Math.Abs(projectile.position.X - Main.projectile[num534].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num534].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num534].position.X) + { + projectile.velocity.X = projectile.velocity.X - 0.05f; + } + else + { + projectile.velocity.X = projectile.velocity.X + 0.05f; + } + if (projectile.position.Y < Main.projectile[num534].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + 0.05f; + } + } + num3 = num534; + } + float num535 = projectile.position.X; + float num536 = projectile.position.Y; + float num537 = 1300f; + bool flag19 = false; + int num538 = 1100; + if (projectile.ai[1] != 0f) + { + num538 = 1800; + } + if (Math.Abs(projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(projectile.Center.Y - Main.player[projectile.owner].Center.Y) > (float)num538) + { + projectile.ai[0] = 1f; + } + if (projectile.ai[0] == 0f) + { + 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)) + { + float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); + float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); + float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + if (num545 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num542].position, Main.npc[num542].width, Main.npc[num542].height)) + { + num537 = num545; + num535 = num543; + num536 = num544; + flag19 = true; + } + } + num3 = num542; + } + } + } + if (!flag19) + { + float num546 = 8f; + if (projectile.ai[0] == 1f) + { + num546 = 12f; + } + Vector2 vector42 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num547 = Main.player[projectile.owner].Center.X - vector42.X; + float num548 = Main.player[projectile.owner].Center.Y - vector42.Y - 60f; + float num549 = (float)Math.Sqrt((double)(num547 * num547 + num548 * num548)); + if (num549 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + } + if (num549 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); + } + if (num549 > 70f) + { + num549 = num546 / num549; + num547 *= num549; + num548 *= num549; + projectile.velocity.X = (projectile.velocity.X * 20f + num547) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num548) / 21f; + } + else + { + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + projectile.velocity *= 1.01f; + } + projectile.rotation = projectile.velocity.X * 0.05f; + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + return; + } + } + else + { + if (projectile.ai[1] == -1f) + { + projectile.ai[1] = 11f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] -= 1f; + } + if (projectile.ai[1] == 0f) + { + float num550 = 8f; //12 + Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num551 = num535 - vector43.X; + float num552 = num536 - vector43.Y; + float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); + if (num553 < 100f) + { + num550 = 10f; //14 + } + num553 = num550 / num553; + num551 *= num553; + num552 *= num553; + projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; + projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + } + else + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + { + projectile.velocity *= 1.05f; + } + } + projectile.rotation = projectile.velocity.X * 0.05f; + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + return; + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + ((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)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } + } + } + } + } + } +} diff --git a/Projectiles/Summon/BrimstoneFireSummon.cs b/Projectiles/Summon/BrimstoneFireSummon.cs index 32ab2cc7d3..b54af693f4 100644 --- a/Projectiles/Summon/BrimstoneFireSummon.cs +++ b/Projectiles/Summon/BrimstoneFireSummon.cs @@ -1,89 +1,89 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class BrimstoneFireSummon : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 2; - projectile.extraUpdates = 3; - projectile.timeLeft = 50; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 235; - if (Main.rand.Next(2) == 0) - { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - if (Main.rand.Next(3) == 0) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; - Main.dust[num299].scale *= num296; - } - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.immune[projectile.owner] = 9; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class BrimstoneFireSummon : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = 2; + projectile.extraUpdates = 3; + projectile.timeLeft = 50; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + if (projectile.ai[0] > 7f) + { + float num296 = 1f; + if (projectile.ai[0] == 8f) + { + num296 = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + num296 = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + num296 = 0.75f; + } + projectile.ai[0] += 1f; + int num297 = 235; + if (Main.rand.Next(2) == 0) + { + for (int num298 = 0; num298 < 1; num298++) + { + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + if (Main.rand.Next(3) == 0) + { + Main.dust[num299].noGravity = true; + Main.dust[num299].scale *= 3f; + Dust expr_DBEF_cp_0 = Main.dust[num299]; + expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; + Dust expr_DC0F_cp_0 = Main.dust[num299]; + expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; + } + else + { + Main.dust[num299].scale *= 1.5f; + } + Dust expr_DC74_cp_0 = Main.dust[num299]; + expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; + Dust expr_DC94_cp_0 = Main.dust[num299]; + expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; + Main.dust[num299].scale *= num296; + } + } + } + else + { + projectile.ai[0] += 1f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.immune[projectile.owner] = 9; + } + } +} diff --git a/Projectiles/Summon/BrimstoneLaserSummon.cs b/Projectiles/Summon/BrimstoneLaserSummon.cs index 238e26c5c0..479dece165 100644 --- a/Projectiles/Summon/BrimstoneLaserSummon.cs +++ b/Projectiles/Summon/BrimstoneLaserSummon.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class BrimstoneLaserSummon : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 2; - projectile.aiStyle = 1; - aiType = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.alpha = 120; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.velocity.Y += projectile.ai[0]; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class BrimstoneLaserSummon : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 2; + projectile.aiStyle = 1; + aiType = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = 1; + projectile.alpha = 120; + projectile.timeLeft = 300; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f); + projectile.velocity.X *= 1.05f; + projectile.velocity.Y *= 1.05f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.Y += projectile.ai[0]; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 50, 50, projectile.alpha); + } + } +} diff --git a/Projectiles/Summon/BrittleStar.cs b/Projectiles/Summon/BrittleStar.cs index 6c098ae9a5..c6f94cc5ca 100644 --- a/Projectiles/Summon/BrittleStar.cs +++ b/Projectiles/Summon/BrittleStar.cs @@ -1,91 +1,91 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class BrittleStar : ModProjectile - { - public float dust = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brittle Star"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = 66; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - aiType = 388; - } - - public override void AI() - { - if (dust == 0f) - { - 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, 33, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 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.rotation += projectile.velocity.X * 0.04f; - bool flag64 = projectile.type == mod.ProjectileType("BrittleStar"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("BrittleStar"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.bStar = false; - } - if (modPlayer.bStar) - { - projectile.timeLeft = 2; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class BrittleStar : ModProjectile + { + public float dust = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brittle Star"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.aiStyle = 66; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + aiType = 388; + } + + public override void AI() + { + if (dust == 0f) + { + 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, 33, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 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.rotation += projectile.velocity.X * 0.04f; + bool flag64 = projectile.type == mod.ProjectileType("BrittleStar"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("BrittleStar"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.bStar = false; + } + if (modPlayer.bStar) + { + projectile.timeLeft = 2; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} diff --git a/Projectiles/Summon/Calamari.cs b/Projectiles/Summon/Calamari.cs index 279f5653ed..e2cb9885b2 100644 --- a/Projectiles/Summon/Calamari.cs +++ b/Projectiles/Summon/Calamari.cs @@ -1,368 +1,368 @@ -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.Summon -{ - public class Calamari : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamari"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } - - public override void AI() - { - if (projectile.localAI[1] == 0f) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; //66% = 1.66 - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; //300 * 1.66 = 498 (new value) - 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, 109, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[1] += 1f; - } - if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) //15% = 1.15 != 1.66 - { - int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / //498 - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * //1.66 498 / 1.66 = 300 (original value) - Main.player[projectile.owner].minionDamage); //300 * 1.15 = 345 (new value) - projectile.damage = damage2; - } - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - bool flag64 = projectile.type == mod.ProjectileType("Calamari"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("Calamari"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.calamari = false; - } - if (modPlayer.calamari) - { - projectile.timeLeft = 2; - } - } - if (Main.rand.Next(600) == 0) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 35); - } - if (projectile.ai[0] == 2f) - { - projectile.ai[1] -= 1f; - if (projectile.ai[1] > 3f) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 34); - int num = Dust.NewDust(projectile.Center, 0, 0, 109, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1.4f); - Main.dust[num].scale = 0.5f + (float)Main.rand.NextDouble() * 0.3f; - Main.dust[num].velocity /= 2.5f; - Main.dust[num].noGravity = true; - Main.dust[num].noLight = true; - } - if (projectile.ai[1] != 0f) - { - return; - } - projectile.ai[1] = 15f; - projectile.ai[0] = 0f; - projectile.velocity /= 5f; - projectile.velocity.Y = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - } - if (projectile.extraUpdates > 1) - { - projectile.extraUpdates = 0; - } - if (projectile.numUpdates > 1) - { - projectile.numUpdates = 0; - } - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - int num3; - for (int num534 = 0; num534 < 1000; num534 = num3 + 1) - { - if (num534 != projectile.whoAmI && Main.projectile[num534].active && Main.projectile[num534].owner == projectile.owner && - Main.projectile[num534].type == mod.ProjectileType("Calamari") && - Math.Abs(projectile.position.X - Main.projectile[num534].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num534].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num534].position.X) - { - projectile.velocity.X = projectile.velocity.X - 0.05f; - } - else - { - projectile.velocity.X = projectile.velocity.X + 0.05f; - } - if (projectile.position.Y < Main.projectile[num534].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + 0.05f; - } - } - num3 = num534; - } - Vector2 vector = projectile.position; - float num10 = 300f; //300 - bool flag = false; - int num11 = -1; - Vector2 center = Main.player[projectile.owner].Center; - Vector2 value = new Vector2(0.5f); - value.Y = 0f; - 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)) - { - Vector2 vector3 = nPC.position + nPC.Size * value; - float num13 = Vector2.Distance(vector3, center); - if (((Vector2.Distance(center, vector) > num13 && num13 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC.position, nPC.width, nPC.height)) - { - num10 = num13; - vector = vector3; - flag = true; - num11 = k; - } - } - } - } - int num16 = 500; - if (flag) - { - num16 = 2000; - } - if (Vector2.Distance(player.Center, projectile.Center) > (float)num16) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag && projectile.ai[0] == 0f) - { - Vector2 vector4 = vector - projectile.Center; - float num17 = vector4.Length(); - vector4.Normalize(); - vector4 = vector - Vector2.UnitY * 80f; - int num18 = (int)vector4.Y / 16; - if (num18 < 0) - { - num18 = 0; - } - Tile tile = Main.tile[(int)vector4.X / 16, num18]; - if (tile != null && tile.active() && Main.tileSolid[(int)tile.type] && !Main.tileSolidTop[(int)tile.type]) - { - vector4 += Vector2.UnitY * 16f; - tile = Main.tile[(int)vector4.X / 16, (int)vector4.Y / 16]; - if (tile != null && tile.active() && Main.tileSolid[(int)tile.type] && !Main.tileSolidTop[(int)tile.type]) - { - vector4 += Vector2.UnitY * 16f; - } - } - vector4 -= projectile.Center; - num17 = vector4.Length(); - vector4.Normalize(); - if (num17 > 300f && num17 <= 800f && projectile.localAI[0] == 0f) - { - projectile.ai[0] = 2f; - projectile.ai[1] = (float)((int)(num17 / 5f)); //10 - projectile.extraUpdates = (int)(projectile.ai[1] * 2f); - projectile.velocity = vector4 * 5f; //10 - projectile.localAI[0] = 60f; - return; - } - if (num17 > 200f) - { - float scaleFactor2 = 9f; //6 - vector4 *= scaleFactor2; - projectile.velocity.X = (projectile.velocity.X * 40f + vector4.X) / 41f; - projectile.velocity.Y = (projectile.velocity.Y * 40f + vector4.Y) / 41f; - } - if (num17 > 70f && num17 < 130f) - { - float scaleFactor3 = 14f; //7 - if (num17 < 100f) - { - scaleFactor3 = -6f; //-3 - } - vector4 *= scaleFactor3; - projectile.velocity = (projectile.velocity * 20f + vector4) / 21f; - if (Math.Abs(vector4.X) > Math.Abs(vector4.Y)) - { - projectile.velocity.X = (projectile.velocity.X * 10f + vector4.X) / 11f; - } - } - else - { - projectile.velocity *= 0.97f; - } - } - else - { - if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) - { - projectile.ai[0] = 1f; - } - float num21 = 6f; //6 - if (projectile.ai[0] == 1f) - { - num21 = 22.5f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector6 = player.Center - center2 + new Vector2(0f, -60f); - float num23 = vector6.Length(); - if (num23 > 200f && num21 < 13.5f) - { - num21 = 13.5f; //9 - } - if (num23 < 400f && projectile.ai[0] == 1f) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num23 > 3000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); - } - if (num23 > 70f) - { - vector6.Normalize(); - vector6 *= num21; - projectile.velocity = (projectile.velocity * 20f + vector6) / 21f; - } - else - { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - projectile.velocity *= 1.01f; - } - } - projectile.rotation = projectile.velocity.X * 0.025f; - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += 1f; - if (Main.rand.Next(3) != 0) - { - projectile.ai[1] += 1f; - } - } - if (projectile.ai[1] > 15f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor4 = 9f; - int num28 = mod.ProjectileType("CalamariInk"); - if (flag) - { - if (Math.Abs((vector - projectile.Center).ToRotation() - 1.57079637f) > 0.7853982f) - { - projectile.velocity += Vector2.Normalize(vector - projectile.Center - Vector2.UnitY * 80f); //80 - return; - } - if ((vector - projectile.Center).Length() <= 400f && projectile.ai[1] == 0f) //400 - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111); - Vector2 vector7 = vector - projectile.Center; - vector7.Normalize(); - vector7 *= scaleFactor4; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y + 20, vector7.X, vector7.Y, num28, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - projectile.netUpdate = true; - } - } - } - } - } - - 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 CanDamage() - { - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class Calamari : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamari"); + Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + if (projectile.localAI[1] == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; //66% = 1.66 + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; //300 * 1.66 = 498 (new value) + 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, 109, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[1] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) //15% = 1.15 != 1.66 + { + int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / //498 + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * //1.66 498 / 1.66 = 300 (original value) + Main.player[projectile.owner].minionDamage); //300 * 1.15 = 345 (new value) + projectile.damage = damage2; + } + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + bool flag64 = projectile.type == mod.ProjectileType("Calamari"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("Calamari"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.calamari = false; + } + if (modPlayer.calamari) + { + projectile.timeLeft = 2; + } + } + if (Main.rand.Next(600) == 0) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 35); + } + if (projectile.ai[0] == 2f) + { + projectile.ai[1] -= 1f; + if (projectile.ai[1] > 3f) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 34); + int num = Dust.NewDust(projectile.Center, 0, 0, 109, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1.4f); + Main.dust[num].scale = 0.5f + (float)Main.rand.NextDouble() * 0.3f; + Main.dust[num].velocity /= 2.5f; + Main.dust[num].noGravity = true; + Main.dust[num].noLight = true; + } + if (projectile.ai[1] != 0f) + { + return; + } + projectile.ai[1] = 15f; + projectile.ai[0] = 0f; + projectile.velocity /= 5f; + projectile.velocity.Y = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + } + if (projectile.extraUpdates > 1) + { + projectile.extraUpdates = 0; + } + if (projectile.numUpdates > 1) + { + projectile.numUpdates = 0; + } + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + int num3; + for (int num534 = 0; num534 < 1000; num534 = num3 + 1) + { + if (num534 != projectile.whoAmI && Main.projectile[num534].active && Main.projectile[num534].owner == projectile.owner && + Main.projectile[num534].type == mod.ProjectileType("Calamari") && + Math.Abs(projectile.position.X - Main.projectile[num534].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num534].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num534].position.X) + { + projectile.velocity.X = projectile.velocity.X - 0.05f; + } + else + { + projectile.velocity.X = projectile.velocity.X + 0.05f; + } + if (projectile.position.Y < Main.projectile[num534].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + 0.05f; + } + } + num3 = num534; + } + Vector2 vector = projectile.position; + float num10 = 300f; //300 + bool flag = false; + int num11 = -1; + Vector2 center = Main.player[projectile.owner].Center; + Vector2 value = new Vector2(0.5f); + value.Y = 0f; + 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)) + { + Vector2 vector3 = nPC.position + nPC.Size * value; + float num13 = Vector2.Distance(vector3, center); + if (((Vector2.Distance(center, vector) > num13 && num13 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC.position, nPC.width, nPC.height)) + { + num10 = num13; + vector = vector3; + flag = true; + num11 = k; + } + } + } + } + int num16 = 500; + if (flag) + { + num16 = 2000; + } + if (Vector2.Distance(player.Center, projectile.Center) > (float)num16) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag && projectile.ai[0] == 0f) + { + Vector2 vector4 = vector - projectile.Center; + float num17 = vector4.Length(); + vector4.Normalize(); + vector4 = vector - Vector2.UnitY * 80f; + int num18 = (int)vector4.Y / 16; + if (num18 < 0) + { + num18 = 0; + } + Tile tile = Main.tile[(int)vector4.X / 16, num18]; + if (tile != null && tile.active() && Main.tileSolid[(int)tile.type] && !Main.tileSolidTop[(int)tile.type]) + { + vector4 += Vector2.UnitY * 16f; + tile = Main.tile[(int)vector4.X / 16, (int)vector4.Y / 16]; + if (tile != null && tile.active() && Main.tileSolid[(int)tile.type] && !Main.tileSolidTop[(int)tile.type]) + { + vector4 += Vector2.UnitY * 16f; + } + } + vector4 -= projectile.Center; + num17 = vector4.Length(); + vector4.Normalize(); + if (num17 > 300f && num17 <= 800f && projectile.localAI[0] == 0f) + { + projectile.ai[0] = 2f; + projectile.ai[1] = (float)((int)(num17 / 5f)); //10 + projectile.extraUpdates = (int)(projectile.ai[1] * 2f); + projectile.velocity = vector4 * 5f; //10 + projectile.localAI[0] = 60f; + return; + } + if (num17 > 200f) + { + float scaleFactor2 = 9f; //6 + vector4 *= scaleFactor2; + projectile.velocity.X = (projectile.velocity.X * 40f + vector4.X) / 41f; + projectile.velocity.Y = (projectile.velocity.Y * 40f + vector4.Y) / 41f; + } + if (num17 > 70f && num17 < 130f) + { + float scaleFactor3 = 14f; //7 + if (num17 < 100f) + { + scaleFactor3 = -6f; //-3 + } + vector4 *= scaleFactor3; + projectile.velocity = (projectile.velocity * 20f + vector4) / 21f; + if (Math.Abs(vector4.X) > Math.Abs(vector4.Y)) + { + projectile.velocity.X = (projectile.velocity.X * 10f + vector4.X) / 11f; + } + } + else + { + projectile.velocity *= 0.97f; + } + } + else + { + if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) + { + projectile.ai[0] = 1f; + } + float num21 = 6f; //6 + if (projectile.ai[0] == 1f) + { + num21 = 22.5f; //15 + } + Vector2 center2 = projectile.Center; + Vector2 vector6 = player.Center - center2 + new Vector2(0f, -60f); + float num23 = vector6.Length(); + if (num23 > 200f && num21 < 13.5f) + { + num21 = 13.5f; //9 + } + if (num23 < 400f && projectile.ai[0] == 1f) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num23 > 3000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); + } + if (num23 > 70f) + { + vector6.Normalize(); + vector6 *= num21; + projectile.velocity = (projectile.velocity * 20f + vector6) / 21f; + } + else + { + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + projectile.velocity *= 1.01f; + } + } + projectile.rotation = projectile.velocity.X * 0.025f; + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += 1f; + if (Main.rand.Next(3) != 0) + { + projectile.ai[1] += 1f; + } + } + if (projectile.ai[1] > 15f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor4 = 9f; + int num28 = mod.ProjectileType("CalamariInk"); + if (flag) + { + if (Math.Abs((vector - projectile.Center).ToRotation() - 1.57079637f) > 0.7853982f) + { + projectile.velocity += Vector2.Normalize(vector - projectile.Center - Vector2.UnitY * 80f); //80 + return; + } + if ((vector - projectile.Center).Length() <= 400f && projectile.ai[1] == 0f) //400 + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 111); + Vector2 vector7 = vector - projectile.Center; + vector7.Normalize(); + vector7 *= scaleFactor4; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y + 20, vector7.X, vector7.Y, num28, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + projectile.netUpdate = true; + } + } + } + } + } + + 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 CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/CalamariInk.cs b/Projectiles/Summon/CalamariInk.cs index 620bef669c..8808043332 100644 --- a/Projectiles/Summon/CalamariInk.cs +++ b/Projectiles/Summon/CalamariInk.cs @@ -1,123 +1,123 @@ -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.Summon -{ - public class CalamariInk : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.extraUpdates = 2; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - 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 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("CrushDepth"), 600); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 28); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 40; - projectile.height = 40; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 54, 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; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 109, 0f, 0f, 100, default(Color), 1.5f); - 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, 109, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +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.Summon +{ + public class CalamariInk : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.extraUpdates = 2; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + 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 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 28); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 40; + projectile.height = 40; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 54, 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; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 109, 0f, 0f, 100, default(Color), 1.5f); + 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, 109, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index 05564466dd..a274a40ed9 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -1,283 +1,283 @@ -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.Summon -{ - public class Calamitamini : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitamini"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - 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, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default(Color), 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - 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; - } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("Calamitamini"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("CalamitasEyes"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.cEyes = false; - } - if (modPlayer.cEyes) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Calamitamini")); - 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 (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; - } - 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; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; //6 - 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; - } - } - if (flag25) - { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 90f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 8f; - int num658 = mod.ProjectileType("BrimstoneLaserSummon"); - if (flag25 && projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 300; - projectile.netUpdate = true; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class Calamitamini : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitamini"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0.5f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + 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, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default(Color), 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + 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; + } + float num633 = 700f; + float num634 = 1100f; + float num635 = 2400f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("Calamitamini"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("CalamitasEyes"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.cEyes = false; + } + if (modPlayer.cEyes) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Calamitamini")); + 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 (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; + } + 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; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; //6 + 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; + } + } + if (flag25) + { + projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + } + else + { + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 8f; + int num658 = mod.ProjectileType("BrimstoneLaserSummon"); + if (flag25 && projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num659].timeLeft = 300; + projectile.netUpdate = true; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index c871a502a0..7a7f08e687 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -1,282 +1,282 @@ -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.Summon -{ - public class Cataclymini : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cataclymini"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 20; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.25f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - 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, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default(Color), 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - 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; - } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("Cataclymini"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (flag64) - { - if (player.dead) - { - modPlayer.cEyes = false; - } - if (modPlayer.cEyes) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Cataclymini")); - 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 (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; - } - 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; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; //6 - 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.25f; - projectile.velocity.Y = -0.15f; - } - } - if (flag25) - { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 80); - } - if (projectile.ai[1] > 90f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 8f; - int num658 = mod.ProjectileType("BrimstoneFireSummon"); - if (flag25 && projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 50; - projectile.netUpdate = true; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class Cataclymini : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclymini"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 20; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0.25f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + 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, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default(Color), 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + 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; + } + float num633 = 700f; + float num634 = 1100f; + float num635 = 2400f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("Cataclymini"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (flag64) + { + if (player.dead) + { + modPlayer.cEyes = false; + } + if (modPlayer.cEyes) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Cataclymini")); + 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 (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; + } + 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; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; //6 + 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.25f; + projectile.velocity.Y = -0.15f; + } + } + if (flag25) + { + projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + } + else + { + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 80); + } + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 8f; + int num658 = mod.ProjectileType("BrimstoneFireSummon"); + if (flag25 && projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num659].timeLeft = 50; + projectile.netUpdate = true; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 1aef478a33..3972c98637 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -1,300 +1,300 @@ -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.Summon -{ - public class Catastromini : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Catastromini"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.25f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - 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, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default(Color), 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - 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; - } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("Catastromini"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (flag64) - { - if (player.dead) - { - modPlayer.cEyes = false; - } - if (modPlayer.cEyes) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Catastromini")); - 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() + 3.14159274f; - projectile.frameCounter++; - if (projectile.frameCounter > 1) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - 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; - } - 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; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = 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() + 3.14159274f; - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - 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 * 8f; - projectile.netUpdate = true; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 9; - } - } -} \ No newline at end of file +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.Summon +{ + public class Catastromini : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastromini"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0.25f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + 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, 235, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default(Color), 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + 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; + } + float num633 = 700f; + float num634 = 1100f; + float num635 = 2400f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("Catastromini"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (flag64) + { + if (player.dead) + { + modPlayer.cEyes = false; + } + if (modPlayer.cEyes) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Catastromini")); + 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() + 3.14159274f; + projectile.frameCounter++; + if (projectile.frameCounter > 1) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + 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; + } + 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; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = 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() + 3.14159274f; + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + 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 * 8f; + projectile.netUpdate = true; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 9; + } + } +} diff --git a/Projectiles/Summon/ChaosFlame.cs b/Projectiles/Summon/ChaosFlame.cs index 339d96c646..2507399828 100644 --- a/Projectiles/Summon/ChaosFlame.cs +++ b/Projectiles/Summon/ChaosFlame.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class ChaosFlame : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Flame"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.penetrate = 1; - projectile.minionSlots = 0f; - projectile.minion = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class ChaosFlame : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Flame"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 300; + projectile.penetrate = 1; + projectile.minionSlots = 0f; + projectile.minion = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 180); + } + } +} diff --git a/Projectiles/Summon/ChaosSpirit.cs b/Projectiles/Summon/ChaosSpirit.cs index e808809569..2b9eee76a9 100644 --- a/Projectiles/Summon/ChaosSpirit.cs +++ b/Projectiles/Summon/ChaosSpirit.cs @@ -1,180 +1,180 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class ChaosSpirit : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chaos Spirit"); - Main.projFrames[projectile.type] = 9; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("ChaosSpirit"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.chaosSpirit) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.cSpirit = false; - } - if (modPlayer.cSpirit) - { - projectile.timeLeft = 2; - } - } - 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++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 127, 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 / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 8) - { - projectile.frame = 0; - } - 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) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 1000f; - 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 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num508 = num541; - num506 = num539; - num507 = num540; - flag18 = true; - } - } - } - else - { - 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)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - } - } - } - } - if (flag18) - { - float num516 = num506; - float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; - int projectileType = mod.ProjectileType("ChaosFlame"); - float num403 = Main.rand.Next(14, 19); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); - projectile.ai[0] = 38f; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class ChaosSpirit : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaos Spirit"); + Main.projFrames[projectile.type] = 9; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("ChaosSpirit"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.chaosSpirit) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.cSpirit = false; + } + if (modPlayer.cSpirit) + { + projectile.timeLeft = 2; + } + } + 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++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 127, 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 / + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 8) + { + projectile.frame = 0; + } + 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) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 120f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num506 = projectile.Center.X; + float num507 = projectile.Center.Y; + float num508 = 1000f; + 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 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + } + } + } + else + { + 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)) + { + num508 = num515; + num506 = num513; + num507 = num514; + flag18 = true; + } + } + } + } + if (flag18) + { + float num516 = num506; + float num517 = num507; + num506 -= projectile.Center.X; + num507 -= projectile.Center.Y; + int projectileType = mod.ProjectileType("ChaosFlame"); + float num403 = Main.rand.Next(14, 19); //modify the speed the projectile are shot. Lower number = slower projectile. + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num516 - vector29.X; + float num405 = num517 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); + projectile.ai[0] = 38f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/CloudyWaifu.cs b/Projectiles/Summon/CloudyWaifu.cs index 1cacc4fe1c..2a34f96c5a 100644 --- a/Projectiles/Summon/CloudyWaifu.cs +++ b/Projectiles/Summon/CloudyWaifu.cs @@ -1,292 +1,292 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Summon -{ - public class CloudyWaifu : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloudy Waifu"); - Main.projFrames[projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 58; - projectile.height = 116; - 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 = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("CloudyWaifu"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.cloudWaifu && !modPlayer.allWaifus) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.cWaifu = false; - } - if (modPlayer.cWaifu) - { - projectile.timeLeft = 2; - } - } - 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++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 16, 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 / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 500f; //700 - float num634 = 800f; - float num635 = 1200f; - float num636 = 400f; //150 - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0.25f * num, 0.55f * num, 0.75f * num); - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("CloudyWaifu")); - 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 = 2; - projectile.frameCounter++; - if (projectile.frameCounter > 48) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - 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; - } - } - } - } - 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 > 100f) //200 - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; //6 - if (flag26) - { - num650 = 15f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(500f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) //200 and 8 - { - num650 = 8f; //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.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - 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 * 8f; - projectile.netUpdate = true; - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Summon +{ + public class CloudyWaifu : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloudy Waifu"); + Main.projFrames[projectile.type] = 8; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 58; + projectile.height = 116; + 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 = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("CloudyWaifu"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.cloudWaifu && !modPlayer.allWaifus) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.cWaifu = false; + } + if (modPlayer.cWaifu) + { + projectile.timeLeft = 2; + } + } + 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++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 16, 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 / + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 500f; //700 + float num634 = 800f; + float num635 = 1200f; + float num636 = 400f; //150 + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 0.25f * num, 0.55f * num, 0.75f * num); + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("CloudyWaifu")); + 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 = 2; + projectile.frameCounter++; + if (projectile.frameCounter > 48) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + 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; + } + } + } + } + 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 > 100f) //200 + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; //6 + if (flag26) + { + num650 = 15f; //15 + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(500f, -60f); //-60 + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) //200 and 8 + { + num650 = 8f; //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.15f; + projectile.velocity.Y = -0.05f; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 0; + } + 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 * 8f; + projectile.netUpdate = true; + } + } + } + } + } +} diff --git a/Projectiles/Summon/Corroslime.cs b/Projectiles/Summon/Corroslime.cs index dfbcf53362..618c57e6d1 100644 --- a/Projectiles/Summon/Corroslime.cs +++ b/Projectiles/Summon/Corroslime.cs @@ -1,109 +1,109 @@ -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.Summon -{ - public class Corroslime : ModProjectile - { - public float dust = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corroslime"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.alpha = 75; - projectile.aiStyle = 26; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - aiType = 266; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } - - public override void AI() - { - if (dust == 0f) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 16; - 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, 14, vector7.X * 1f, vector7.Y * 1f, 100, default(Color), 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 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; - } - bool flag64 = projectile.type == mod.ProjectileType("Corroslime"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("Corroslime"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.cSlime = false; - } - if (modPlayer.cSlime) - { - projectile.timeLeft = 2; - } - } - } - - 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 OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class Corroslime : ModProjectile + { + public float dust = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corroslime"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1; + projectile.alpha = 75; + projectile.aiStyle = 26; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + aiType = 266; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override void AI() + { + if (dust == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 16; + 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, 14, vector7.X * 1f, vector7.Y * 1f, 100, default(Color), 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 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; + } + bool flag64 = projectile.type == mod.ProjectileType("Corroslime"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("Corroslime"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.cSlime = false; + } + if (modPlayer.cSlime) + { + projectile.timeLeft = 2; + } + } + } + + 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 OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index 088940159f..c19d1f6524 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -1,137 +1,137 @@ -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.Summon -{ - public class CosmicBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.minionSlots = 0f; - projectile.minion = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (Main.rand.Next(8) == 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, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1200f; - bool flag17 = false; - 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; - 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 Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - 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(29, (int)projectile.position.X, (int)projectile.position.Y, 103); - 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 < 3; num193++) - { - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); - Main.dust[dust].noGravity = true; - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } -} \ No newline at end of file +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.Summon +{ + public class CosmicBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.minionSlots = 0f; + projectile.minion = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (Main.rand.Next(8) == 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, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].noGravity = true; + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1200f; + bool flag17 = false; + 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; + 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 Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + 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(29, (int)projectile.position.X, (int)projectile.position.Y, 103); + 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 < 3; num193++) + { + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + Main.dust[dust].noGravity = true; + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index 45569233a0..3535a74c64 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -1,142 +1,142 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class CosmicBlastBig : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.minion = true; - } - - public override void AI() - { - 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.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - if (Main.rand.Next(8) == 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, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; - } - if (Main.rand.Next(24) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - if (Main.rand.Next(5) == 0) - { - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); - Main.dust[num59].noGravity = true; - } - 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); - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - 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 = 45f; - 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 Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("ExoFreeze"), 30); - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 288); - 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 < 3; num193++) - { - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); - Main.dust[dust].noGravity = true; - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class CosmicBlastBig : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.minion = true; + } + + public override void AI() + { + 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.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + if (Main.rand.Next(8) == 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, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].noGravity = true; + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (Main.rand.Next(24) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + if (Main.rand.Next(5) == 0) + { + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); + Main.dust[num59].noGravity = true; + } + 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); + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + bool flag17 = false; + 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 = 45f; + 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 Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("ExoFreeze"), 30); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 288); + 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 < 3; num193++) + { + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + Main.dust[dust].noGravity = true; + } + for (int num194 = 0; num194 < 30; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 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, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Summon/CosmicEnergy.cs b/Projectiles/Summon/CosmicEnergy.cs index a7d6c3a440..57b501c1dd 100644 --- a/Projectiles/Summon/CosmicEnergy.cs +++ b/Projectiles/Summon/CosmicEnergy.cs @@ -1,278 +1,278 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class CosmicEnergy : ModProjectile - { - private bool justSpawned = true; - - public override void SetStaticDefaults() - { - 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() - { - projectile.width = 78; - projectile.height = 78; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 10f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.extraUpdates = 1; - } - - public override void AI() - { - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 255f), ((float)Main.DiscoG / 255f), ((float)Main.DiscoB / 255f)); - 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; - } - bool flag64 = projectile.type == mod.ProjectileType("CosmicEnergy"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("CosmicEnergy"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.cEnergy = false; - } - if (modPlayer.cEnergy) - { - projectile.timeLeft = 2; - } - } - float num633 = 1400f; //700 - float num634 = 1600f; //800 - float num635 = 2400f; //1200 - float num636 = 800f; - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("CosmicEnergy")); - 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; - } - } - } - projectile.rotation += projectile.velocity.X * 0.1f; - Vector2 vector46 = projectile.position; - bool flag25 = false; - 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) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[1] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[1] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 6f; //6 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; //4 - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[1] == 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[1] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) //2000 - { - 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; - } - } - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - if (justSpawned) - { - justSpawned = false; - projectile.ai[0] = 100f; - } - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - float num396 = projectile.position.X; - float num397 = projectile.position.Y; - float num398 = 1200f; - bool flag11 = false; - 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) - { - num398 = num402; - num396 = num400; - num397 = num401; - flag11 = true; - } - } - } - if (flag11) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); - int num251 = Main.rand.Next(5, 8); - 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(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); - float num404 = num396 - vector29.X; - float num405 = num397 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - 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, (float)target, 0f); - projectile.ai[0] = 100f; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class CosmicEnergy : ModProjectile + { + private bool justSpawned = true; + + public override void SetStaticDefaults() + { + 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() + { + projectile.width = 78; + projectile.height = 78; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 10f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.extraUpdates = 1; + } + + public override void AI() + { + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, ((float)Main.DiscoR / 255f), ((float)Main.DiscoG / 255f), ((float)Main.DiscoB / 255f)); + 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; + } + bool flag64 = projectile.type == mod.ProjectileType("CosmicEnergy"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("CosmicEnergy"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.cEnergy = false; + } + if (modPlayer.cEnergy) + { + projectile.timeLeft = 2; + } + } + float num633 = 1400f; //700 + float num634 = 1600f; //800 + float num635 = 2400f; //1200 + float num636 = 800f; + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("CosmicEnergy")); + 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; + } + } + } + projectile.rotation += projectile.velocity.X * 0.1f; + Vector2 vector46 = projectile.position; + bool flag25 = false; + 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) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[1] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[1] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 6f; //6 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; //4 + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[1] == 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[1] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) //2000 + { + 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; + } + } + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + if (justSpawned) + { + justSpawned = false; + projectile.ai[0] = 100f; + } + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + float num396 = projectile.position.X; + float num397 = projectile.position.Y; + float num398 = 1200f; + bool flag11 = false; + 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) + { + num398 = num402; + num396 = num400; + num397 = num401; + flag11 = true; + } + } + } + if (flag11) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); + int num251 = Main.rand.Next(5, 8); + 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(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); + float num404 = num396 - vector29.X; + float num405 = num397 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + 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, (float)target, 0f); + projectile.ai[0] = 100f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/Cosmilamp.cs b/Projectiles/Summon/Cosmilamp.cs index 40804bb64c..05f4de2a90 100644 --- a/Projectiles/Summon/Cosmilamp.cs +++ b/Projectiles/Summon/Cosmilamp.cs @@ -1,295 +1,295 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class Cosmilamp : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmilamp"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 2f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 24; - projectile.extraUpdates = 1; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - 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, 204, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - 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; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - int num1262 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 204, 0f, 0f, 0, default(Color), 1f); - Main.dust[num1262].velocity *= 0.1f; - Main.dust[num1262].scale = 0.7f; - Main.dust[num1262].noGravity = true; - bool flag64 = projectile.type == mod.ProjectileType("Cosmilamp"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("Cosmilamp"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.cLamp = false; - } - if (modPlayer.cLamp) - { - projectile.timeLeft = 2; - } - } - int num3; - for (int num534 = 0; num534 < 1000; num534 = num3 + 1) - { - if (num534 != projectile.whoAmI && Main.projectile[num534].active && Main.projectile[num534].owner == projectile.owner && - Main.projectile[num534].type == mod.ProjectileType("Cosmilamp") && - Math.Abs(projectile.position.X - Main.projectile[num534].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num534].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num534].position.X) - { - projectile.velocity.X = projectile.velocity.X - 0.05f; - } - else - { - projectile.velocity.X = projectile.velocity.X + 0.05f; - } - if (projectile.position.Y < Main.projectile[num534].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + 0.05f; - } - } - num3 = num534; - } - float num535 = projectile.position.X; - float num536 = projectile.position.Y; - float num537 = 3000f; - bool flag19 = false; - int num538 = 2500; - if (projectile.ai[1] != 0f) - { - num538 = 4000; - } - if (Math.Abs(projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(projectile.Center.Y - Main.player[projectile.owner].Center.Y) > (float)num538) - { - projectile.ai[0] = 1f; - } - if (projectile.ai[0] == 0f) - { - 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)) - { - float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); - float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); - if (num545 < num537) - { - num537 = num545; - num535 = num543; - num536 = num544; - flag19 = true; - } - } - num3 = num542; - } - } - } - if (!flag19) - { - float num546 = 12f; - if (projectile.ai[0] == 1f) - { - num546 = 18f; - } - Vector2 vector42 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num547 = Main.player[projectile.owner].Center.X - vector42.X; - float num548 = Main.player[projectile.owner].Center.Y - vector42.Y - 60f; - float num549 = (float)Math.Sqrt((double)(num547 * num547 + num548 * num548)); - if (num549 < 400f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - } - if (num549 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); - } - if (num549 > 70f) - { - num549 = num546 / num549; - num547 *= num549; - num548 *= num549; - projectile.velocity.X = (projectile.velocity.X * 20f + num547) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num548) / 21f; - } - else - { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - projectile.velocity *= 1.01f; - } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - return; - } - } - else - { - if (projectile.ai[1] == -1f) - { - projectile.ai[1] = 17f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] -= 1f; - } - if (projectile.ai[1] == 0f) - { - float num550 = 24f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num551 = num535 - vector43.X; - float num552 = num536 - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) - { - num550 = 28f; //14 - } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; - } - else - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) - { - projectile.velocity *= 1.05f; - } - } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - return; - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && - ((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)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class Cosmilamp : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmilamp"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 2f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 24; + projectile.extraUpdates = 1; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + 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, 204, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + 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; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + int num1262 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 204, 0f, 0f, 0, default(Color), 1f); + Main.dust[num1262].velocity *= 0.1f; + Main.dust[num1262].scale = 0.7f; + Main.dust[num1262].noGravity = true; + bool flag64 = projectile.type == mod.ProjectileType("Cosmilamp"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("Cosmilamp"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.cLamp = false; + } + if (modPlayer.cLamp) + { + projectile.timeLeft = 2; + } + } + int num3; + for (int num534 = 0; num534 < 1000; num534 = num3 + 1) + { + if (num534 != projectile.whoAmI && Main.projectile[num534].active && Main.projectile[num534].owner == projectile.owner && + Main.projectile[num534].type == mod.ProjectileType("Cosmilamp") && + Math.Abs(projectile.position.X - Main.projectile[num534].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num534].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num534].position.X) + { + projectile.velocity.X = projectile.velocity.X - 0.05f; + } + else + { + projectile.velocity.X = projectile.velocity.X + 0.05f; + } + if (projectile.position.Y < Main.projectile[num534].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + 0.05f; + } + } + num3 = num534; + } + float num535 = projectile.position.X; + float num536 = projectile.position.Y; + float num537 = 3000f; + bool flag19 = false; + int num538 = 2500; + if (projectile.ai[1] != 0f) + { + num538 = 4000; + } + if (Math.Abs(projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(projectile.Center.Y - Main.player[projectile.owner].Center.Y) > (float)num538) + { + projectile.ai[0] = 1f; + } + if (projectile.ai[0] == 0f) + { + 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)) + { + float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); + float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); + float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + if (num545 < num537) + { + num537 = num545; + num535 = num543; + num536 = num544; + flag19 = true; + } + } + num3 = num542; + } + } + } + if (!flag19) + { + float num546 = 12f; + if (projectile.ai[0] == 1f) + { + num546 = 18f; + } + Vector2 vector42 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num547 = Main.player[projectile.owner].Center.X - vector42.X; + float num548 = Main.player[projectile.owner].Center.Y - vector42.Y - 60f; + float num549 = (float)Math.Sqrt((double)(num547 * num547 + num548 * num548)); + if (num549 < 400f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + } + if (num549 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); + } + if (num549 > 70f) + { + num549 = num546 / num549; + num547 *= num549; + num548 *= num549; + projectile.velocity.X = (projectile.velocity.X * 20f + num547) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num548) / 21f; + } + else + { + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + projectile.velocity *= 1.01f; + } + projectile.rotation = projectile.velocity.X * 0.05f; + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + return; + } + } + else + { + if (projectile.ai[1] == -1f) + { + projectile.ai[1] = 17f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] -= 1f; + } + if (projectile.ai[1] == 0f) + { + float num550 = 24f; //12 + Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num551 = num535 - vector43.X; + float num552 = num536 - vector43.Y; + float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); + if (num553 < 100f) + { + num550 = 28f; //14 + } + num553 = num550 / num553; + num551 *= num553; + num552 *= num553; + projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; + projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + } + else + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + { + projectile.velocity *= 1.05f; + } + } + projectile.rotation = projectile.velocity.X * 0.05f; + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + return; + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + ((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)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[1] = -1f; + projectile.netUpdate = true; + } + } + } + } + } + } + } +} diff --git a/Projectiles/Summon/Crimslime.cs b/Projectiles/Summon/Crimslime.cs index 0e7aac5d7b..b232da27c9 100644 --- a/Projectiles/Summon/Crimslime.cs +++ b/Projectiles/Summon/Crimslime.cs @@ -1,109 +1,109 @@ -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.Summon -{ - public class Crimslime : ModProjectile - { - public float dust = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimslime"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.alpha = 75; - projectile.aiStyle = 26; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - aiType = 266; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } - - public override void AI() - { - if (dust == 0f) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 16; - 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, 5, vector7.X * 1f, vector7.Y * 1f, 100, default(Color), 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 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; - } - bool flag64 = projectile.type == mod.ProjectileType("Crimslime"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("Crimslime"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.cSlime2 = false; - } - if (modPlayer.cSlime2) - { - projectile.timeLeft = 2; - } - } - } - - 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 OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class Crimslime : ModProjectile + { + public float dust = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimslime"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1; + projectile.alpha = 75; + projectile.aiStyle = 26; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + aiType = 266; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override void AI() + { + if (dust == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 16; + 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, 5, vector7.X * 1f, vector7.Y * 1f, 100, default(Color), 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 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; + } + bool flag64 = projectile.type == mod.ProjectileType("Crimslime"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("Crimslime"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.cSlime2 = false; + } + if (modPlayer.cSlime2) + { + projectile.timeLeft = 2; + } + } + } + + 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 OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index 14923a361e..5b25c97627 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -1,172 +1,172 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class DaedalusCrystal : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daedalus Crystal"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("DaedalusCrystal"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.daedalusCrystal) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.dCrystal = false; - } - if (modPlayer.dCrystal) - { - projectile.timeLeft = 2; - } - } - 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++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 173, 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 / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); - 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) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 1000f; - 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 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num508 = num541; - num506 = num539; - num507 = num540; - flag18 = true; - } - } - } - else - { - 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)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - } - } - } - } - if (flag18) - { - float num516 = num506; - float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; - int projectileType = mod.ProjectileType("DaedalusCrystalShot"); - float num403 = Main.rand.Next(10, 15); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); - projectile.ai[0] = 50f; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class DaedalusCrystal : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Crystal"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 40; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("DaedalusCrystal"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.daedalusCrystal) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.dCrystal = false; + } + if (modPlayer.dCrystal) + { + projectile.timeLeft = 2; + } + } + 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++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 173, 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 / + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 255f); + 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) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 120f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num506 = projectile.Center.X; + float num507 = projectile.Center.Y; + float num508 = 1000f; + 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 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + } + } + } + else + { + 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)) + { + num508 = num515; + num506 = num513; + num507 = num514; + flag18 = true; + } + } + } + } + if (flag18) + { + float num516 = num506; + float num517 = num507; + num506 -= projectile.Center.X; + num507 -= projectile.Center.Y; + int projectileType = mod.ProjectileType("DaedalusCrystalShot"); + float num403 = Main.rand.Next(10, 15); //modify the speed the projectile are shot. Lower number = slower projectile. + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num516 - vector29.X; + float num405 = num517 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); + projectile.ai[0] = 50f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/DaedalusCrystalShot.cs b/Projectiles/Summon/DaedalusCrystalShot.cs index f004bd9d3b..aeb7050935 100644 --- a/Projectiles/Summon/DaedalusCrystalShot.cs +++ b/Projectiles/Summon/DaedalusCrystalShot.cs @@ -1,73 +1,73 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class DaedalusCrystalShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crystal Shot"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.netImportant = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.minion = true; - projectile.minionSlots = 0f; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.7f); - 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, 173, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 360); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class DaedalusCrystalShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crystal Shot"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.netImportant = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.minion = true; + projectile.minionSlots = 0f; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.7f); + 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, 173, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 360); + } + } +} diff --git a/Projectiles/Summon/DankCreeper.cs b/Projectiles/Summon/DankCreeper.cs index 38f07e5f94..febb0d8cc7 100644 --- a/Projectiles/Summon/DankCreeper.cs +++ b/Projectiles/Summon/DankCreeper.cs @@ -1,297 +1,297 @@ -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.Summon -{ - public class DankCreeper : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dank Creeper"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 74; - projectile.height = 74; - projectile.scale = 0.75f; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 1; - projectile.aiStyle = 54; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - aiType = 317; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - 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, 14, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - 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; - } - bool flag64 = projectile.type == mod.ProjectileType("DankCreeper"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("DankCreeper"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.dCreeper = false; - } - if (modPlayer.dCreeper) - { - projectile.timeLeft = 2; - } - } - int num3; - for (int num534 = 0; num534 < 1000; num534 = num3 + 1) - { - if (num534 != projectile.whoAmI && Main.projectile[num534].active && Main.projectile[num534].owner == projectile.owner && - Main.projectile[num534].type == mod.ProjectileType("DankCreeper") && - Math.Abs(projectile.position.X - Main.projectile[num534].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num534].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num534].position.X) - { - projectile.velocity.X = projectile.velocity.X - 0.05f; - } - else - { - projectile.velocity.X = projectile.velocity.X + 0.05f; - } - if (projectile.position.Y < Main.projectile[num534].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + 0.05f; - } - } - num3 = num534; - } - float num535 = projectile.position.X; - float num536 = projectile.position.Y; - float num537 = 1300f; - bool flag19 = false; - int num538 = 1100; - if (projectile.ai[1] != 0f) - { - num538 = 1800; - } - if (Math.Abs(projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(projectile.Center.Y - Main.player[projectile.owner].Center.Y) > (float)num538) - { - projectile.ai[0] = 1f; - } - if (projectile.ai[0] == 0f) - { - 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)) - { - float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); - float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); - if (num545 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num542].position, Main.npc[num542].width, Main.npc[num542].height)) - { - num537 = num545; - num535 = num543; - num536 = num544; - flag19 = true; - } - } - num3 = num542; - } - } - } - if (!flag19) - { - float num546 = 8f; - if (projectile.ai[0] == 1f) - { - num546 = 12f; - } - Vector2 vector42 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num547 = Main.player[projectile.owner].Center.X - vector42.X; - float num548 = Main.player[projectile.owner].Center.Y - vector42.Y - 60f; - float num549 = (float)Math.Sqrt((double)(num547 * num547 + num548 * num548)); - if (num549 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - } - if (num549 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); - } - if (num549 > 70f) - { - num549 = num546 / num549; - num547 *= num549; - num548 *= num549; - projectile.velocity.X = (projectile.velocity.X * 20f + num547) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num548) / 21f; - } - else - { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - projectile.velocity *= 1.01f; - } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - return; - } - } - else - { - if (projectile.ai[1] == -1f) - { - projectile.ai[1] = 11f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] -= 1f; - } - if (projectile.ai[1] == 0f) - { - float num550 = 8f; //12 - Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num551 = num535 - vector43.X; - float num552 = num536 - vector43.Y; - float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); - if (num553 < 100f) - { - num550 = 10f; //14 - } - num553 = num550 / num553; - num551 *= num553; - num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; - projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; - } - else - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) - { - projectile.velocity *= 1.05f; - } - } - projectile.rotation = projectile.velocity.X * 0.05f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - return; - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && - ((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)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[1] = -1f; - projectile.netUpdate = 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 +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.Summon +{ + public class DankCreeper : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dank Creeper"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 74; + projectile.height = 74; + projectile.scale = 0.75f; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1; + projectile.aiStyle = 54; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + aiType = 317; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + 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, 14, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + 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; + } + bool flag64 = projectile.type == mod.ProjectileType("DankCreeper"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("DankCreeper"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.dCreeper = false; + } + if (modPlayer.dCreeper) + { + projectile.timeLeft = 2; + } + } + int num3; + for (int num534 = 0; num534 < 1000; num534 = num3 + 1) + { + if (num534 != projectile.whoAmI && Main.projectile[num534].active && Main.projectile[num534].owner == projectile.owner && + Main.projectile[num534].type == mod.ProjectileType("DankCreeper") && + Math.Abs(projectile.position.X - Main.projectile[num534].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num534].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num534].position.X) + { + projectile.velocity.X = projectile.velocity.X - 0.05f; + } + else + { + projectile.velocity.X = projectile.velocity.X + 0.05f; + } + if (projectile.position.Y < Main.projectile[num534].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + 0.05f; + } + } + num3 = num534; + } + float num535 = projectile.position.X; + float num536 = projectile.position.Y; + float num537 = 1300f; + bool flag19 = false; + int num538 = 1100; + if (projectile.ai[1] != 0f) + { + num538 = 1800; + } + if (Math.Abs(projectile.Center.X - Main.player[projectile.owner].Center.X) + Math.Abs(projectile.Center.Y - Main.player[projectile.owner].Center.Y) > (float)num538) + { + projectile.ai[0] = 1f; + } + if (projectile.ai[0] == 0f) + { + 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)) + { + float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); + float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); + float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + if (num545 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num542].position, Main.npc[num542].width, Main.npc[num542].height)) + { + num537 = num545; + num535 = num543; + num536 = num544; + flag19 = true; + } + } + num3 = num542; + } + } + } + if (!flag19) + { + float num546 = 8f; + if (projectile.ai[0] == 1f) + { + num546 = 12f; + } + Vector2 vector42 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num547 = Main.player[projectile.owner].Center.X - vector42.X; + float num548 = Main.player[projectile.owner].Center.Y - vector42.Y - 60f; + float num549 = (float)Math.Sqrt((double)(num547 * num547 + num548 * num548)); + if (num549 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + } + if (num549 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); + } + if (num549 > 70f) + { + num549 = num546 / num549; + num547 *= num549; + num548 *= num549; + projectile.velocity.X = (projectile.velocity.X * 20f + num547) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num548) / 21f; + } + else + { + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + projectile.velocity *= 1.01f; + } + projectile.rotation = projectile.velocity.X * 0.05f; + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + return; + } + } + else + { + if (projectile.ai[1] == -1f) + { + projectile.ai[1] = 11f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] -= 1f; + } + if (projectile.ai[1] == 0f) + { + float num550 = 8f; //12 + Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num551 = num535 - vector43.X; + float num552 = num536 - vector43.Y; + float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); + if (num553 < 100f) + { + num550 = 10f; //14 + } + num553 = num550 / num553; + num551 *= num553; + num552 *= num553; + projectile.velocity.X = (projectile.velocity.X * 14f + num551) / 15f; + projectile.velocity.Y = (projectile.velocity.Y * 14f + num552) / 15f; + } + else + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 10f) + { + projectile.velocity *= 1.05f; + } + } + projectile.rotation = projectile.velocity.X * 0.05f; + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + return; + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + ((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)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[1] = -1f; + projectile.netUpdate = 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; + } + } +} diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index b47a976c2d..54aadf65ed 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -1,222 +1,222 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class Dreadmine : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mine"); - } - - public override void SetDefaults() - { - projectile.width = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 3600; - } - - public override void AI() - { - 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.ai[1] = 1f; - if (projectile.ai[0] < 5500f) - { - return; - } - 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 > 0) - { - projectile.alpha -= 25; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - } - 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) / 10.8f; //11 - return; - } - if ((double)projectile.velocity.Length() > 0.2) - { - projectile.velocity *= 0.98f; - return; - } - } - - 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 = 116); - 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 < 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, 6, 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; - } - projectile.Damage(); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class Dreadmine : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mine"); + } + + public override void SetDefaults() + { + projectile.width = 58; + projectile.height = 58; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 3600; + } + + public override void AI() + { + 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.ai[1] = 1f; + if (projectile.ai[0] < 5500f) + { + return; + } + 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 > 0) + { + projectile.alpha -= 25; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + } + 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) / 10.8f; //11 + return; + } + if ((double)projectile.velocity.Length() > 0.2) + { + projectile.velocity *= 0.98f; + return; + } + } + + 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 = 116); + 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 < 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, 6, 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; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index 762b288c3d..280645fe82 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -1,137 +1,137 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class DreadmineTurret : ModProjectile - { - public float count = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dreadmine Turret"); - Main.projFrames[projectile.type] = 2; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; - } - - 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 > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * projectile.ai[0] / 300f)) * 0.5f); - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 300f) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - 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 == Main.myPlayer && Main.projectile[i].type == mod.ProjectileType("Dreadmine")) - { - num++; - } - } - if (Main.rand.Next(15) >= num && num < 10) - { - 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 = projectile.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)) - { - center.X += (float)(num3 / 2); - center.Y += (float)(num3 / 2); - if (Collision.CanHit(new Vector2(projectile.Center.X, projectile.position.Y), 1, 1, center, 1, 1) || - Collision.CanHit(new Vector2(projectile.Center.X, projectile.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 == Main.myPlayer && - Main.projectile[k].type == mod.ProjectileType("Dreadmine") && (center - Main.projectile[k].Center).Length() < 48f) - { - flag = false; - break; - } - } - if (flag && Main.myPlayer == projectile.owner) - { - Projectile.NewProjectile(center.X, center.Y, 0f, 0f, mod.ProjectileType("Dreadmine"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - } - } - } - } - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class DreadmineTurret : ModProjectile + { + public float count = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dreadmine Turret"); + Main.projFrames[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.sentry = true; + projectile.timeLeft = Projectile.SentryLifeTime; + projectile.penetrate = -1; + } + + 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 > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * projectile.ai[0] / 300f)) * 0.5f); + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 300f) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + 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 == Main.myPlayer && Main.projectile[i].type == mod.ProjectileType("Dreadmine")) + { + num++; + } + } + if (Main.rand.Next(15) >= num && num < 10) + { + 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 = projectile.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)) + { + center.X += (float)(num3 / 2); + center.Y += (float)(num3 / 2); + if (Collision.CanHit(new Vector2(projectile.Center.X, projectile.position.Y), 1, 1, center, 1, 1) || + Collision.CanHit(new Vector2(projectile.Center.X, projectile.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 == Main.myPlayer && + Main.projectile[k].type == mod.ProjectileType("Dreadmine") && (center - Main.projectile[k].Center).Length() < 48f) + { + flag = false; + break; + } + } + if (flag && Main.myPlayer == projectile.owner) + { + Projectile.NewProjectile(center.X, center.Y, 0f, 0f, mod.ProjectileType("Dreadmine"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } + } + } + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/DrewsSandyWaifu.cs b/Projectiles/Summon/DrewsSandyWaifu.cs index 1b912078f1..3630c34654 100644 --- a/Projectiles/Summon/DrewsSandyWaifu.cs +++ b/Projectiles/Summon/DrewsSandyWaifu.cs @@ -1,222 +1,222 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Summon -{ - public class DrewsSandyWaifu : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Oxy's Waifu"); - Main.projFrames[projectile.type] = 5; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 42; - projectile.height = 98; - 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 = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); - } - - 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; - } - if (flag64) - { - if (player.dead) - { - modPlayer.dWaifu = false; - } - if (modPlayer.dWaifu) - { - projectile.timeLeft = 2; - } - } - 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++) - { - 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 / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - 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; - } - float num636 = 100f; //150 - float num = (float)Main.rand.Next(90, 111) * 0.01f; - 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++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("DrewsSandyWaifu")); - 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; - } - } - } - if (Vector2.Distance(player.Center, projectile.Center) > 400f) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - 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) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 220f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.localAI[0] < 120f) - { - projectile.localAI[0] += 1f; - } - if (projectile.ai[0] == 0f) - { - int num658 = mod.ProjectileType("CactusHealOrb"); - if (projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) - { - 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); - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Summon +{ + public class DrewsSandyWaifu : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Oxy's Waifu"); + Main.projFrames[projectile.type] = 5; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 42; + projectile.height = 98; + 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 = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); + } + + 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; + } + if (flag64) + { + if (player.dead) + { + modPlayer.dWaifu = false; + } + if (modPlayer.dWaifu) + { + projectile.timeLeft = 2; + } + } + 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++) + { + 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 / + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + 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; + } + float num636 = 100f; //150 + float num = (float)Main.rand.Next(90, 111) * 0.01f; + 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++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("DrewsSandyWaifu")); + 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; + } + } + } + if (Vector2.Distance(player.Center, projectile.Center) > 400f) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + 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) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 220f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.localAI[0] < 120f) + { + projectile.localAI[0] += 1f; + } + if (projectile.ai[0] == 0f) + { + int num658 = mod.ProjectileType("CactusHealOrb"); + if (projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) + { + 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); + } + } + } + } + } +} diff --git a/Projectiles/Summon/ElementalAxe.cs b/Projectiles/Summon/ElementalAxe.cs index dff9f8daed..2a4fe1bd65 100644 --- a/Projectiles/Summon/ElementalAxe.cs +++ b/Projectiles/Summon/ElementalAxe.cs @@ -1,266 +1,266 @@ -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.Summon -{ - public class ElementalAxe : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Axe"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 52; - projectile.height = 52; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.extraUpdates = 1; - } - - 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; - } - bool flag64 = (projectile.type == mod.ProjectileType("ElementalAxe")); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (flag64) - { - if (player.dead) - { - modPlayer.eAxe = false; - } - if (modPlayer.eAxe) - { - projectile.timeLeft = 2; - } - } - projectile.rotation += 0.075f; - float num633 = 700f; - float num634 = 1200f; - float num635 = 2500f; - float num636 = 400f; - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("ElementalAxe")); - 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 = 2; - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 1; - 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 = 24f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 12f; //4 - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 - } - } - 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; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 30f) - { - 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 * 16f; //8 - projectile.netUpdate = true; - } - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 4; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - target.AddBuff(mod.BuffType("GlacialState"), 120); - target.AddBuff(mod.BuffType("Plague"), 120); - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +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.Summon +{ + public class ElementalAxe : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Axe"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 52; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + } + + 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; + } + bool flag64 = (projectile.type == mod.ProjectileType("ElementalAxe")); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (flag64) + { + if (player.dead) + { + modPlayer.eAxe = false; + } + if (modPlayer.eAxe) + { + projectile.timeLeft = 2; + } + } + projectile.rotation += 0.075f; + float num633 = 700f; + float num634 = 1200f; + float num635 = 2500f; + float num636 = 400f; + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("ElementalAxe")); + 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 = 2; + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 1; + 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 = 24f; //8 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 12f; //4 + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 + } + } + 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; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 30f) + { + 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 * 16f; //8 + projectile.netUpdate = true; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 4; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + target.AddBuff(mod.BuffType("GlacialState"), 120); + target.AddBuff(mod.BuffType("Plague"), 120); + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index f2a6c2435a..08c5b4daf4 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -1,112 +1,112 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class FlameBlast : ModProjectile - { - public float count = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 180; - } - - public override void AI() - { - if (count == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - count += 1f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 0.75f); - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - 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)) - { - 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 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class FlameBlast : ModProjectile + { + public float count = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 180; + } + + public override void AI() + { + if (count == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + count += 1f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 0.75f); + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 300f; + bool flag17 = false; + 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)) + { + 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 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); + } + } + } +} diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index f3f386299f..c1622dfbf8 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -1,112 +1,112 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class FlameBurst : ModProjectile - { - private float count = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Burst"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 180; - } - - public override void AI() - { - if (count == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - count += 1f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 0.75f); - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1200f; - bool flag17 = false; - 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)) - { - 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 = 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; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class FlameBurst : ModProjectile + { + private float count = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Burst"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 180; + } + + public override void AI() + { + if (count == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 20; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + count += 1f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 0.75f); + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1200f; + bool flag17 = false; + 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)) + { + 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 = 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; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0f, projectile.oldVelocity.Y * 0f); + } + } + } +} diff --git a/Projectiles/Summon/FrostMistFriendly.cs b/Projectiles/Summon/FrostMistFriendly.cs index ee6ad2ea41..e778ff957b 100644 --- a/Projectiles/Summon/FrostMistFriendly.cs +++ b/Projectiles/Summon/FrostMistFriendly.cs @@ -1,116 +1,116 @@ -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.Summon -{ - public class FrostMistFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mist"); - Main.projFrames[projectile.type] = 6; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 30); - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - } - - 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(200, 200, 200, projectile.alpha); - } - } -} \ No newline at end of file +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.Summon +{ + public class FrostMistFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mist"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 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; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 30); + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.ai[0] < 0f) + { + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.02f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + } + + 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(200, 200, 200, projectile.alpha); + } + } +} diff --git a/Projectiles/Summon/FungalClump.cs b/Projectiles/Summon/FungalClump.cs index 10539a687d..ed60f05926 100644 --- a/Projectiles/Summon/FungalClump.cs +++ b/Projectiles/Summon/FungalClump.cs @@ -1,108 +1,108 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class FungalClump : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fungal Clump"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.minionSlots = 0f; - projectile.aiStyle = 54; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - aiType = 317; - projectile.tileCollide = false; - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("FungalClump"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.fungalClump) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.fClump = false; - } - if (modPlayer.fClump) - { - projectile.timeLeft = 2; - } - } - if (projectile.localAI[0] == 0f) - { - 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, 56, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - 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; - } - if (Main.rand.Next(16) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - float num = (float)damage * 0.25f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("FungalHeal"), 0, 0f, projectile.owner, (float)num2, num); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class FungalClump : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fungal Clump"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.netImportant = true; + projectile.friendly = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.minionSlots = 0f; + projectile.aiStyle = 54; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + aiType = 317; + projectile.tileCollide = false; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("FungalClump"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.fungalClump) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.fClump = false; + } + if (modPlayer.fClump) + { + projectile.timeLeft = 2; + } + } + if (projectile.localAI[0] == 0f) + { + 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, 56, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + 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; + } + if (Main.rand.Next(16) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + float num = (float)damage * 0.25f; + if ((int)num == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + Main.player[Main.myPlayer].lifeSteal -= num; + int num2 = projectile.owner; + Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("FungalHeal"), 0, 0f, projectile.owner, (float)num2, num); + } + } +} diff --git a/Projectiles/Summon/GhostFire.cs b/Projectiles/Summon/GhostFire.cs index fb79d57ea4..09211008a4 100644 --- a/Projectiles/Summon/GhostFire.cs +++ b/Projectiles/Summon/GhostFire.cs @@ -1,48 +1,48 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class GhostFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 80; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - projectile.minion = true; - projectile.minionSlots = 0f; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 6f) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 180, 0f, 0f, 0, default(Color), 0.2f); - Main.dust[num448].position = vector33; - Main.dust[num448].noGravity = true; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class GhostFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 100; + projectile.timeLeft = 80; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + projectile.minion = true; + projectile.minionSlots = 0f; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 6f) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * 0.25f; + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 180, 0f, 0f, 0, default(Color), 0.2f); + Main.dust[num448].position = vector33; + Main.dust[num448].noGravity = true; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } +} diff --git a/Projectiles/Summon/GhostlyMine.cs b/Projectiles/Summon/GhostlyMine.cs index a87ef2b863..86f88b00f2 100644 --- a/Projectiles/Summon/GhostlyMine.cs +++ b/Projectiles/Summon/GhostlyMine.cs @@ -1,124 +1,124 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class GhostlyMine : ModProjectile - { - public bool start = true; - public bool spawnDust = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mine"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 900; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.minion = true; - } - - public override void AI() - { - if (start) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.ai[1] = projectile.ai[0]; - start = false; - } - 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; - } - Vector2 direction = Main.player[projectile.owner].Center - projectile.Center; - direction.Normalize(); - direction *= 9f; - Player player = Main.player[projectile.owner]; - double deg = (double)projectile.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 550; - projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2; - projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2; - projectile.ai[1] += 1f; //1f - if (spawnDust) - { - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 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 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 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, 180, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - spawnDust = false; - } - } - - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - 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 = 150; - projectile.height = 150; - 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 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1.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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1.7f); - 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, 180, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class GhostlyMine : ModProjectile + { + public bool start = true; + public bool spawnDust = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mine"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 900; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.minion = true; + } + + public override void AI() + { + if (start) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Main.PlaySound(SoundID.Item20, projectile.position); + projectile.ai[1] = projectile.ai[0]; + start = false; + } + 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; + } + Vector2 direction = Main.player[projectile.owner].Center - projectile.Center; + direction.Normalize(); + direction *= 9f; + Player player = Main.player[projectile.owner]; + double deg = (double)projectile.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 550; + projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2; + projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2; + projectile.ai[1] += 1f; //1f + if (spawnDust) + { + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 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, 180, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + spawnDust = false; + } + } + + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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 = 150; + projectile.height = 150; + 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 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1.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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 180, 0f, 0f, 100, default(Color), 1.7f); + 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, 180, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Summon/GigaFlareFriendly.cs b/Projectiles/Summon/GigaFlareFriendly.cs index d3d7ebe287..0bfd54ce34 100644 --- a/Projectiles/Summon/GigaFlareFriendly.cs +++ b/Projectiles/Summon/GigaFlareFriendly.cs @@ -1,175 +1,175 @@ -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.Summon -{ - public class GigaFlareFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 120; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); - 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 = 30f; - 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; - 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 void Kill(int timeLeft) - { - float spread = 90f * 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) - { - for (i = 0; i < 2; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("PhoenixFireFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("PhoenixFireFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - 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 = 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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("HolyLight"), 200); - } - } -} \ No newline at end of file +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.Summon +{ + public class GigaFlareFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 120; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); + 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 = 30f; + 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; + 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 void Kill(int timeLeft) + { + float spread = 90f * 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) + { + for (i = 0; i < 2; i++ ) + { + offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("PhoenixFireFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("PhoenixFireFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + 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 = 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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("HolyLight"), 200); + } + } +} diff --git a/Projectiles/Summon/Herring.cs b/Projectiles/Summon/Herring.cs index e892aef20d..1486bd075c 100644 --- a/Projectiles/Summon/Herring.cs +++ b/Projectiles/Summon/Herring.cs @@ -1,288 +1,288 @@ -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.Summon -{ - public class Herring : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Herring"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } - - 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, 33, 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 ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = projectile.direction; - } - projectile.rotation = projectile.velocity.X * 0.005f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - float num633 = 600f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("Herring"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("Herring"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.herring = false; - } - if (modPlayer.herring) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Herring")); - 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; - 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) && 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; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = 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; - } - } - 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 * 7f; //8 - projectile.netUpdate = true; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } -} \ No newline at end of file +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.Summon +{ + public class Herring : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Herring"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0.5f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + 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, 33, 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 ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = projectile.direction; + } + projectile.rotation = projectile.velocity.X * 0.005f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + float num633 = 600f; + float num634 = 800f; + float num635 = 1200f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("Herring"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("Herring"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.herring = false; + } + if (modPlayer.herring) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Herring")); + 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; + 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) && 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; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = 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; + } + } + 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 * 7f; //8 + projectile.netUpdate = true; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + } + } +} diff --git a/Projectiles/Summon/IceClasper.cs b/Projectiles/Summon/IceClasper.cs index 27940d4a72..c74c1b98ca 100644 --- a/Projectiles/Summon/IceClasper.cs +++ b/Projectiles/Summon/IceClasper.cs @@ -1,285 +1,285 @@ -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.Summon -{ - public class IceClasper : ModProjectile - { - private int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Clasper"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } - - 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, 67, 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; - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.05f, 0.15f, 0.2f); - float num633 = 700f; - float num634 = 1000f; - float num635 = 2200f; - float num636 = 150f; - bool flag64 = projectile.type == mod.ProjectileType("IceClasper"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("IceClasper"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.iClasper = false; - } - if (modPlayer.iClasper) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("IceClasper")); - 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 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.immune[projectile.owner] = 7; - } - } -} \ No newline at end of file +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.Summon +{ + public class IceClasper : ModProjectile + { + private int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Clasper"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + 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, 67, 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; + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.05f, 0.15f, 0.2f); + float num633 = 700f; + float num634 = 1000f; + float num635 = 2200f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("IceClasper"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("IceClasper"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.iClasper = false; + } + if (modPlayer.iClasper) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("IceClasper")); + 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 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.immune[projectile.owner] = 7; + } + } +} diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index 53825e0c27..3efdd6afbc 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -1,126 +1,126 @@ -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.Summon -{ - public class MechwormBody : ModProjectile - { - private int playerMinionSlots = 0; - private bool runCheck = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - 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 (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 || player9.maxMinions < playerMinionSlots) - { - projectile.active = false; - return; - } - int num1051 = 10; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = (int)projectile.ai[0]; - if (chase >= 0 && Main.projectile[chase].active) - { - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - //Maybe add some kill code here ? - return; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) - { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); - } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; - } - projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -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 +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.Summon +{ + public class MechwormBody : ModProjectile + { + private int playerMinionSlots = 0; + private bool runCheck = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mechworm"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.minionSlots = 0.5f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + 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 (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 || player9.maxMinions < playerMinionSlots) + { + projectile.active = false; + return; + } + int num1051 = 10; + if (player9.dead) + { + modPlayer.mWorm = false; + } + if (modPlayer.mWorm) + { + projectile.timeLeft = 2; + } + Vector2 value68 = Vector2.Zero; + float num1064 = 0f; + float scaleFactor17 = 0f; + float scaleFactor18 = 1f; + if (projectile.ai[1] == 1f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + int chase = (int)projectile.ai[0]; + if (chase >= 0 && Main.projectile[chase].active) + { + value68 = Main.projectile[chase].Center; + Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; + num1064 = Main.projectile[chase].rotation; + scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + scaleFactor17 = 16f; + Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + } + else + { + //Maybe add some kill code here ? + return; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - projectile.Center; + if (num1064 != projectile.rotation) + { + float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); + } + projectile.rotation = vector134.ToRotation() + 1.57079637f; + projectile.position = projectile.Center; + projectile.scale = scaleFactor18; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (vector134 != Vector2.Zero) + { + projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + } + projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -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; + } + } +} diff --git a/Projectiles/Summon/MechwormBody2.cs b/Projectiles/Summon/MechwormBody2.cs index b05a099dfa..c942a2397b 100644 --- a/Projectiles/Summon/MechwormBody2.cs +++ b/Projectiles/Summon/MechwormBody2.cs @@ -1,130 +1,130 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.IO; -using Terraria.ObjectData; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class MechwormBody2 : ModProjectile - { - private int playerMinionSlots = 0; - private bool runCheck = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - 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 (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 || player9.maxMinions < playerMinionSlots) - { - projectile.active = false; - return; - } - int num1051 = 10; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = (int)projectile.ai[0]; - if (chase >= 0 && Main.projectile[chase].active) - { - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - return; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) - { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); - } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; - } - projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.IO; +using Terraria.ObjectData; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MechwormBody2 : ModProjectile + { + private int playerMinionSlots = 0; + private bool runCheck = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mechworm"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.minionSlots = 0.5f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + 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 (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 || player9.maxMinions < playerMinionSlots) + { + projectile.active = false; + return; + } + int num1051 = 10; + if (player9.dead) + { + modPlayer.mWorm = false; + } + if (modPlayer.mWorm) + { + projectile.timeLeft = 2; + } + Vector2 value68 = Vector2.Zero; + float num1064 = 0f; + float scaleFactor17 = 0f; + float scaleFactor18 = 1f; + if (projectile.ai[1] == 1f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + int chase = (int)projectile.ai[0]; + if (chase >= 0 && Main.projectile[chase].active) + { + value68 = Main.projectile[chase].Center; + Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; + num1064 = Main.projectile[chase].rotation; + scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + scaleFactor17 = 16f; + Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + } + else + { + return; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - projectile.Center; + if (num1064 != projectile.rotation) + { + float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); + } + projectile.rotation = vector134.ToRotation() + 1.57079637f; + projectile.position = projectile.Center; + projectile.scale = scaleFactor18; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (vector134 != Vector2.Zero) + { + projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + } + projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); + 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; + } + } +} diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 0ede2f387f..8cb5545daf 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -1,226 +1,226 @@ -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.Summon -{ - public class MechwormHead : ModProjectile - { - private int dust = 3; - private int playerMinionSlots = 0; - private bool runCheck = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = -1; - projectile.timeLeft = 18000; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - 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++) - { - 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--; - } - 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 || player9.maxMinions < playerMinionSlots) - { - projectile.active = false; - return; - } - int num1051 = 30; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 center14 = player9.Center; - float num1053 = 1800f; //700 - float num1054 = 2200f; //1000 - int num1055 = -1; - if (projectile.Distance(center14) > 3000f) //2000 - { - projectile.Center = center14; - projectile.netUpdate = true; - } - 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]; - Vector2 vector132 = nPC14.Center - projectile.Center; - (vector132.X > 0f).ToDirectionInt(); - (vector132.Y > 0f).ToDirectionInt(); - float scaleFactor16 = 0.3f; //.4 - if (vector132.Length() < 900f) - { - scaleFactor16 = 0.45f; //.5 - } - if (vector132.Length() < 600f) - { - scaleFactor16 = 0.6f; //.6 - } - if (vector132.Length() < 300f) - { - scaleFactor16 = 0.8f; //.8 - } - if (vector132.Length() > nPC14.Size.Length() * 0.75f) - { - projectile.velocity += Vector2.Normalize(vector132) * scaleFactor16 * 1.5f; - if (Vector2.Dot(projectile.velocity, vector132) < 0.25f) - { - projectile.velocity *= 0.8f; - } - } - float num1058 = 50f; //30 - if (projectile.velocity.Length() > num1058) - { - projectile.velocity = Vector2.Normalize(projectile.velocity) * num1058; - } - } - else - { - float num1059 = 0.2f; - Vector2 vector133 = center14 - projectile.Center; - if (vector133.Length() < 200f) - { - num1059 = 0.12f; - } - if (vector133.Length() < 140f) - { - num1059 = 0.06f; - } - if (vector133.Length() > 100f) - { - if (Math.Abs(center14.X - projectile.Center.X) > 20f) - { - projectile.velocity.X = projectile.velocity.X + num1059 * (float)Math.Sign(center14.X - projectile.Center.X); - } - if (Math.Abs(center14.Y - projectile.Center.Y) > 10f) - { - projectile.velocity.Y = projectile.velocity.Y + num1059 * (float)Math.Sign(center14.Y - projectile.Center.Y); - } - } - else if (projectile.velocity.Length() > 2f) - { - projectile.velocity *= 0.96f; - } - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.1f; - } - float num1060 = 25f; //15 - if (projectile.velocity.Length() > num1060) - { - projectile.velocity = Vector2.Normalize(projectile.velocity) * num1060; - } - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - int direction = projectile.direction; - projectile.direction = (projectile.spriteDirection = ((projectile.velocity.X > 0f) ? 1 : -1)); - if (direction != projectile.direction) - { - projectile.netUpdate = true; - } - float num1061 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); - projectile.position = projectile.Center; - projectile.scale = 1f + num1061 * 0.01f; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (projectile.alpha > 0) - { - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - } - - 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(21f, 25f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Summon/MechwormHeadGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } - } -} +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.Summon +{ + public class MechwormHead : ModProjectile + { + private int dust = 3; + private int playerMinionSlots = 0; + private bool runCheck = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mechworm"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.netImportant = true; + projectile.penetrate = -1; + projectile.timeLeft = 18000; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + 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++) + { + 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--; + } + 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 || player9.maxMinions < playerMinionSlots) + { + projectile.active = false; + return; + } + int num1051 = 30; + if (player9.dead) + { + modPlayer.mWorm = false; + } + if (modPlayer.mWorm) + { + projectile.timeLeft = 2; + } + Vector2 center14 = player9.Center; + float num1053 = 1800f; //700 + float num1054 = 2200f; //1000 + int num1055 = -1; + if (projectile.Distance(center14) > 3000f) //2000 + { + projectile.Center = center14; + projectile.netUpdate = true; + } + 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]; + Vector2 vector132 = nPC14.Center - projectile.Center; + (vector132.X > 0f).ToDirectionInt(); + (vector132.Y > 0f).ToDirectionInt(); + float scaleFactor16 = 0.3f; //.4 + if (vector132.Length() < 900f) + { + scaleFactor16 = 0.45f; //.5 + } + if (vector132.Length() < 600f) + { + scaleFactor16 = 0.6f; //.6 + } + if (vector132.Length() < 300f) + { + scaleFactor16 = 0.8f; //.8 + } + if (vector132.Length() > nPC14.Size.Length() * 0.75f) + { + projectile.velocity += Vector2.Normalize(vector132) * scaleFactor16 * 1.5f; + if (Vector2.Dot(projectile.velocity, vector132) < 0.25f) + { + projectile.velocity *= 0.8f; + } + } + float num1058 = 50f; //30 + if (projectile.velocity.Length() > num1058) + { + projectile.velocity = Vector2.Normalize(projectile.velocity) * num1058; + } + } + else + { + float num1059 = 0.2f; + Vector2 vector133 = center14 - projectile.Center; + if (vector133.Length() < 200f) + { + num1059 = 0.12f; + } + if (vector133.Length() < 140f) + { + num1059 = 0.06f; + } + if (vector133.Length() > 100f) + { + if (Math.Abs(center14.X - projectile.Center.X) > 20f) + { + projectile.velocity.X = projectile.velocity.X + num1059 * (float)Math.Sign(center14.X - projectile.Center.X); + } + if (Math.Abs(center14.Y - projectile.Center.Y) > 10f) + { + projectile.velocity.Y = projectile.velocity.Y + num1059 * (float)Math.Sign(center14.Y - projectile.Center.Y); + } + } + else if (projectile.velocity.Length() > 2f) + { + projectile.velocity *= 0.96f; + } + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.1f; + } + float num1060 = 25f; //15 + if (projectile.velocity.Length() > num1060) + { + projectile.velocity = Vector2.Normalize(projectile.velocity) * num1060; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + int direction = projectile.direction; + projectile.direction = (projectile.spriteDirection = ((projectile.velocity.X > 0f) ? 1 : -1)); + if (direction != projectile.direction) + { + projectile.netUpdate = true; + } + float num1061 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); + projectile.position = projectile.Center; + projectile.scale = 1f + num1061 * 0.01f; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (projectile.alpha > 0) + { + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + } + + 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(21f, 25f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Summon/MechwormHeadGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } + } +} diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index 8a1bc61c34..01cc8c9bae 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -1,127 +1,127 @@ -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.Summon -{ - public class MechwormTail : ModProjectile - { - private int playerMinionSlots = 0; - private bool runCheck = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.netImportant = true; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - 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 (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 || player9.maxMinions < playerMinionSlots) - { - projectile.active = false; - return; - } - int num1051 = 10; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = (int)projectile.ai[0]; - if (chase >= 0 && Main.projectile[chase].active) - { - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - projectile.Kill(); - return; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) - { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); - } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; - } - projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); - 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 +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.Summon +{ + public class MechwormTail : ModProjectile + { + private int playerMinionSlots = 0; + private bool runCheck = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mechworm"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.netImportant = true; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + 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 (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 || player9.maxMinions < playerMinionSlots) + { + projectile.active = false; + return; + } + int num1051 = 10; + if (player9.dead) + { + modPlayer.mWorm = false; + } + if (modPlayer.mWorm) + { + projectile.timeLeft = 2; + } + Vector2 value68 = Vector2.Zero; + float num1064 = 0f; + float scaleFactor17 = 0f; + float scaleFactor18 = 1f; + if (projectile.ai[1] == 1f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + int chase = (int)projectile.ai[0]; + if (chase >= 0 && Main.projectile[chase].active) + { + value68 = Main.projectile[chase].Center; + Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; + num1064 = Main.projectile[chase].rotation; + scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + scaleFactor17 = 16f; + Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + } + else + { + projectile.Kill(); + return; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - projectile.Center; + if (num1064 != projectile.rotation) + { + float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); + } + projectile.rotation = vector134.ToRotation() + 1.57079637f; + projectile.position = projectile.Center; + projectile.scale = scaleFactor18; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (vector134 != Vector2.Zero) + { + projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + } + projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); + 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; + } + } +} diff --git a/Projectiles/Summon/MiniSandShark.cs b/Projectiles/Summon/MiniSandShark.cs index 7f07706d40..354162e6fa 100644 --- a/Projectiles/Summon/MiniSandShark.cs +++ b/Projectiles/Summon/MiniSandShark.cs @@ -1,89 +1,89 @@ -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.Summon -{ - public class MiniSandShark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mini Sand Shark"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.minion = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.minionSlots = 0f; - } - - public override void AI() - { - projectile.alpha -= 40; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 19, 1f, 0f); - } - if (projectile.ai[0] >= 45f) - { - projectile.ai[0] = 45f; - projectile.velocity.Y = projectile.velocity.Y + 0.025f; - } - if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); - } - else - { - projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - - 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); - 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 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 +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.Summon +{ + public class MiniSandShark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mini Sand Shark"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.minion = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.minionSlots = 0f; + } + + public override void AI() + { + projectile.alpha -= 40; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 19, 1f, 0f); + } + if (projectile.ai[0] >= 45f) + { + projectile.ai[0] = 45f; + projectile.velocity.Y = projectile.velocity.Y + 0.025f; + } + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)(-(double)projectile.velocity.Y), (double)(-(double)projectile.velocity.X)); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + + 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); + 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index df72a26c87..d5c2fd1afb 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -1,253 +1,253 @@ -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.Summon -{ - public class PhantomGuy : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - 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, 180, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default(Color), 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - 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; - } - float num633 = 700f; - float num634 = 1300f; - float num635 = 2600f; - float num636 = 600f; - bool flag64 = projectile.type == mod.ProjectileType("PhantomGuy"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("Phantom"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.pGuy = false; - } - if (modPlayer.pGuy) - { - projectile.timeLeft = 2; - } - } - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("PhantomGuy")); - 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; - } - } - } - 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 = 18f; //12 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 9f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 12f; - if (flag26) - { - num650 = 30f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 16f) - { - num650 = 16f; - } - if (num651 < num636 && flag26) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = 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; - } - } - if (flag25) - { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 90f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 6f; - int num658 = mod.ProjectileType("GhostFire"); - if (flag25 && projectile.ai[1] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - projectile.netUpdate = true; - } - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 250, 250, projectile.alpha); - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class PhantomGuy : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0.5f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + 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, 180, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default(Color), 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + 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; + } + float num633 = 700f; + float num634 = 1300f; + float num635 = 2600f; + float num636 = 600f; + bool flag64 = projectile.type == mod.ProjectileType("PhantomGuy"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("Phantom"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.pGuy = false; + } + if (modPlayer.pGuy) + { + projectile.timeLeft = 2; + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("PhantomGuy")); + 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; + } + } + } + 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 = 18f; //12 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 9f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 12f; + if (flag26) + { + num650 = 30f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 16f) + { + num650 = 16f; + } + if (num651 < num636 && flag26) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = 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; + } + } + if (flag25) + { + projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + } + else + { + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 6f; + int num658 = mod.ProjectileType("GhostFire"); + if (flag25 && projectile.ai[1] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + projectile.netUpdate = true; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(100, 250, 250, projectile.alpha); + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/PhoenixFireFriendly.cs b/Projectiles/Summon/PhoenixFireFriendly.cs index f57c9fffed..33bd50bdad 100644 --- a/Projectiles/Summon/PhoenixFireFriendly.cs +++ b/Projectiles/Summon/PhoenixFireFriendly.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class PhoenixFireFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 200; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 30f; - 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; - return; - } - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 100); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class PhoenixFireFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 200; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 30f; + 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; + return; + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 100); + } + } +} diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index 8369724bc7..cea55d376a 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -1,168 +1,168 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class ProfanedEnergy : ModProjectile - { - private float count = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Energy"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.sentry = true; - projectile.timeLeft = Projectile.SentryLifeTime; - projectile.penetrate = -1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (count == 0f) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 244, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - count += 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; - } - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 1000f; - int target = 0; - if (Main.player[projectile.owner].HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num508 = num541; - num506 = num539; - num507 = num540; - flag18 = true; - target = npc.whoAmI; - } - } - } - else - { - 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)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - target = num512; - } - } - } - } - if (flag18) - { - float num516 = num506; - float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; - if (num506 < 0f) - { - projectile.spriteDirection = 1; - } - else - { - projectile.spriteDirection = -1; - } - int projectileType = Main.rand.Next(2); - if (projectileType == 0) - { - projectileType = mod.ProjectileType("FlameBlast"); - } - else - { - projectileType = mod.ProjectileType("FlameBurst"); - } - float num403 = Main.rand.Next(20, 30); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); - projectile.ai[0] = 8f; - } - } - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class ProfanedEnergy : ModProjectile + { + private float count = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Energy"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.sentry = true; + projectile.timeLeft = Projectile.SentryLifeTime; + projectile.penetrate = -1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (count == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 244, 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + count += 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; + } + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num506 = projectile.Center.X; + float num507 = projectile.Center.Y; + float num508 = 1000f; + int target = 0; + if (Main.player[projectile.owner].HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + target = npc.whoAmI; + } + } + } + else + { + 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)) + { + num508 = num515; + num506 = num513; + num507 = num514; + flag18 = true; + target = num512; + } + } + } + } + if (flag18) + { + float num516 = num506; + float num517 = num507; + num506 -= projectile.Center.X; + num507 -= projectile.Center.Y; + if (num506 < 0f) + { + projectile.spriteDirection = 1; + } + else + { + projectile.spriteDirection = -1; + } + int projectileType = Main.rand.Next(2); + if (projectileType == 0) + { + projectileType = mod.ProjectileType("FlameBlast"); + } + else + { + projectileType = mod.ProjectileType("FlameBurst"); + } + float num403 = Main.rand.Next(20, 30); //modify the speed the projectile are shot. Lower number = slower projectile. + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num516 - vector29.X; + float num405 = num517 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); + projectile.ai[0] = 8f; + } + } + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/ReaverOrb.cs b/Projectiles/Summon/ReaverOrb.cs index e9f7856d71..83006509e5 100644 --- a/Projectiles/Summon/ReaverOrb.cs +++ b/Projectiles/Summon/ReaverOrb.cs @@ -1,141 +1,141 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class ReaverOrb : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Orb"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.alpha = 50; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("ReaverOrb"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.reaverOrb) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.rOrb = false; - } - if (modPlayer.rOrb) - { - projectile.timeLeft = 2; - } - } - 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++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 157, 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 / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - 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) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num508 = 600f; - 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)) - { - num508 = num515; - flag18 = true; - } - } - } - if (flag18) - { - int num251 = Main.rand.Next(4, 9); - 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(90, 121) * 0.1f; - int spore = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, value15.X, value15.Y, 569 + Main.rand.Next(3), projectile.damage, 1.5f, projectile.owner, 0f, 0f); - Main.projectile[spore].minion = true; - Main.projectile[spore].minionSlots = 0f; - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 77); - projectile.ai[0] = 50f; - } - } - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class ReaverOrb : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Orb"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.alpha = 50; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("ReaverOrb"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.reaverOrb) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.rOrb = false; + } + if (modPlayer.rOrb) + { + projectile.timeLeft = 2; + } + } + 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++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 157, 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 / + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + 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) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 120f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num508 = 600f; + 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)) + { + num508 = num515; + flag18 = true; + } + } + } + if (flag18) + { + int num251 = Main.rand.Next(4, 9); + 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(90, 121) * 0.1f; + int spore = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, value15.X, value15.Y, 569 + Main.rand.Next(3), projectile.damage, 1.5f, projectile.owner, 0f, 0f); + Main.projectile[spore].minion = true; + Main.projectile[spore].minionSlots = 0f; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 77); + projectile.ai[0] = 50f; + } + } + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/RedDevil.cs b/Projectiles/Summon/RedDevil.cs index 5fa9cf599d..674de56972 100644 --- a/Projectiles/Summon/RedDevil.cs +++ b/Projectiles/Summon/RedDevil.cs @@ -1,292 +1,292 @@ -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.Summon -{ - public class RedDevil : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Devil"); - Main.projFrames[projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 48; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("RedDevil"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.redDevil) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.rDevil = false; - } - if (modPlayer.rDevil) - { - projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - int num501 = 50; - 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, 235, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1f * num, 0f * num, 0.15f * num); - projectile.rotation = projectile.velocity.X * 0.04f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 700f; - float num634 = 2000f; - float num635 = 3000f; - float num636 = 150f; - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("RedDevil")); - 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; - 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; - } - 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) && 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) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - 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 = 16f; //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 = 5f; //6 - if (flag26) - { - num650 = 12f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -30f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 6.5f) //200 and 8 - { - num650 = 6.5f; //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.2f; - projectile.velocity.Y = -0.1f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 80f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 24f; - int num658 = 114; - if (flag25 && projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 300; - projectile.netUpdate = true; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class RedDevil : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Devil"); + Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 48; + projectile.height = 48; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("RedDevil"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.redDevil) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.rDevil = false; + } + if (modPlayer.rDevil) + { + projectile.timeLeft = 2; + } + } + dust--; + if (dust >= 0) + { + int num501 = 50; + 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, 235, 0f, 0f, 0, default(Color), 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 1f * num, 0f * num, 0.15f * num); + projectile.rotation = projectile.velocity.X * 0.04f; + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 700f; + float num634 = 2000f; + float num635 = 3000f; + float num636 = 150f; + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("RedDevil")); + 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; + 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; + } + 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) && 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) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + 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 = 16f; //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 = 5f; //6 + if (flag26) + { + num650 = 12f; //15 + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -30f); //-60 + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 6.5f) //200 and 8 + { + num650 = 6.5f; //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.2f; + projectile.velocity.Y = -0.1f; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 80f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 24f; + int num658 = 114; + if (flag25 && projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num659].timeLeft = 300; + projectile.netUpdate = true; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/SandBolt.cs b/Projectiles/Summon/SandBolt.cs index 52cb9180ef..f1b3298182 100644 --- a/Projectiles/Summon/SandBolt.cs +++ b/Projectiles/Summon/SandBolt.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class SandBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.light = 1f; - projectile.timeLeft = 300; - } - - public override void AI() - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SandMark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SandBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.light = 1f; + projectile.timeLeft = 300; + } + + public override void AI() + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SandMark"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Summon/SandMark.cs b/Projectiles/Summon/SandMark.cs index ffdd1a1c44..013972014a 100644 --- a/Projectiles/Summon/SandMark.cs +++ b/Projectiles/Summon/SandMark.cs @@ -1,168 +1,168 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Summon -{ - public class SandMark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); - } - - public override void AI() - { - Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); - } - if (projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default(Color), 0.5f)]; - dust34.position = position4; - dust34.customData = projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.localAI[1] > 103f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 16; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default(Vector2)); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) - { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) - { - int storm = Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("SandTornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); - Main.projectile[storm].minion = true; - Main.projectile[storm].melee = false; - } - if (projectile.localAI[1] >= 120f) - { - projectile.Kill(); - return; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Summon +{ + public class SandMark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.timeLeft = 900; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); + } + + public override void AI() + { + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + for (int num1134 = 0; num1134 < 1; num1134++) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default(Color), 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default(Vector2)); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + int storm = Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("SandTornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); + Main.projectile[storm].minion = true; + Main.projectile[storm].melee = false; + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/SandTornado.cs b/Projectiles/Summon/SandTornado.cs index 4542de184f..345c1ed7f0 100644 --- a/Projectiles/Summon/SandTornado.cs +++ b/Projectiles/Summon/SandTornado.cs @@ -1,159 +1,159 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Summon -{ - public class SandTornado : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tornado"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.minion = true; - projectile.penetrate = NPC.downedMoonlord ? -1 : 3; - projectile.timeLeft = 1200; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); - } - - public override void AI() - { - float num1125 = 900f; - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 122); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= num1125) - { - projectile.Kill(); - } - if (projectile.localAI[0] >= 30f) - { - projectile.damage = 0; - if (projectile.ai[0] < num1125 - 120f) - { - float num1126 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1126; - projectile.netUpdate = true; - } - } - float num1127 = 15f; - float num1128 = 15f; - Point point8 = projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - projectile.width = (int)(value74.X * 0.65f); - projectile.height = (int)value74.Y; - projectile.Center = vector146; - if (projectile.owner == Main.myPlayer) - { - bool flag74 = false; - Vector2 center16 = Main.player[projectile.owner].Center; - Vector2 top = Main.player[projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) - { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) - { - flag74 = true; - break; - } - } - if (!flag74 && projectile.ai[0] < num1125 - 120f) - { - float num1132 = projectile.ai[0] % 60f; - projectile.ai[0] = num1125 - 120f + num1132; - projectile.netUpdate = true; - } - } - if (projectile.ai[0] < num1125 - 120f) - { - return; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - float num226 = 600f; - float num227 = 15f; - float num228 = 15f; - float num229 = projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) - { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); - } - Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default(Vector2)); - float num234 = 0f; - float num235 = 5.1f; - Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 100); - for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) - { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default(Vector2)); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) - { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); - } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); - } - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Summon +{ + public class SandTornado : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tornado"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.minion = true; + projectile.penetrate = NPC.downedMoonlord ? -1 : 3; + projectile.timeLeft = 1200; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); + } + + public override void AI() + { + float num1125 = 900f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 122); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= num1125) + { + projectile.Kill(); + } + if (projectile.localAI[0] >= 30f) + { + projectile.damage = 0; + if (projectile.ai[0] < num1125 - 120f) + { + float num1126 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1126; + projectile.netUpdate = true; + } + } + float num1127 = 15f; + float num1128 = 15f; + Point point8 = projectile.Center.ToTileCoordinates(); + int num1129; + int num1130; + Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); + num1129++; + num1130--; + Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); + Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); + Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); + Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); + value74.X = value74.Y * 0.2f; + projectile.width = (int)(value74.X * 0.65f); + projectile.height = (int)value74.Y; + projectile.Center = vector146; + if (projectile.owner == Main.myPlayer) + { + bool flag74 = false; + Vector2 center16 = Main.player[projectile.owner].Center; + Vector2 top = Main.player[projectile.owner].Top; + for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + { + Vector2 position2 = Vector2.Lerp(value72, value73, num1131); + if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + { + flag74 = true; + break; + } + } + if (!flag74 && projectile.ai[0] < num1125 - 120f) + { + float num1132 = projectile.ai[0] % 60f; + projectile.ai[0] = num1125 - 120f + num1132; + projectile.netUpdate = true; + } + } + if (projectile.ai[0] < num1125 - 120f) + { + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + float num226 = 600f; + float num227 = 15f; + float num228 = 15f; + float num229 = projectile.ai[0]; + float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); + if (num229 > num226 - 60f) + { + scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + } + Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates(); + int num230; + int num231; + Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); + num230++; + num231--; + float num232 = 0.2f; + Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); + Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); + Vector2.Lerp(value32, value33, 0.5f); + Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); + vector33.X = vector33.Y * num232; + new Vector2(value32.X - vector33.X / 2f, value32.Y); + Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); + Vector2 origin3 = rectangle9.Size() / 2f; + float num233 = -0.06283186f * num229; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default(Vector2)); + float num234 = 0f; + float num235 = 5.1f; + Microsoft.Xna.Framework.Color value34 = new Microsoft.Xna.Framework.Color(225, 225, 100); + for (float num236 = (float)((int)value33.Y); num236 > (float)((int)value32.Y); num236 -= num235) + { + num234 += num235; + float num237 = num234 / vector33.Y; + float num238 = num234 * 6.28318548f / -20f; + float num239 = num237 - 0.15f; + Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default(Vector2)); + Vector2 value35 = new Vector2(0f, num237 + 1f); + value35.X = value35.Y * num232; + Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); + if (num237 > 0.5f) + { + color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + } + color39.A = (byte)((float)color39.A * 0.5f); + color39 *= scale5; + vector34 *= value35 * 100f; + vector34.Y = 0f; + vector34.X = 0f; + vector34 += new Vector2(value33.X, num236) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); + } + return false; + } + } +} diff --git a/Projectiles/Summon/Sandnado.cs b/Projectiles/Summon/Sandnado.cs index 4c6eb54f1f..c0b8e18929 100644 --- a/Projectiles/Summon/Sandnado.cs +++ b/Projectiles/Summon/Sandnado.cs @@ -1,316 +1,316 @@ -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.Summon -{ - public class Sandnado : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sandnado"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 40; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - if (projectile.localAI[1] == 0f) - { - 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[1] += 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; - } - bool flag64 = projectile.type == mod.ProjectileType("Sandnado"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("Sandnado"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.sandnado = false; - } - if (modPlayer.sandnado) - { - projectile.timeLeft = 2; - } - } - float num8 = 0.1f; - float num9 = ((float)projectile.width * 2f); - for (int j = 0; j < 1000; j++) - { - if (j != projectile.whoAmI && Main.projectile[j].active && Main.projectile[j].owner == projectile.owner && Main.projectile[j].type == projectile.type && - Math.Abs(projectile.position.X - Main.projectile[j].position.X) + Math.Abs(projectile.position.Y - Main.projectile[j].position.Y) < num9) - { - if (projectile.position.X < Main.projectile[j].position.X) - { - projectile.velocity.X = projectile.velocity.X - num8; - } - else - { - projectile.velocity.X = projectile.velocity.X + num8; - } - if (projectile.position.Y < Main.projectile[j].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num8; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num8; - } - } - } - Vector2 vector = projectile.position; - float num10 = 400f; - bool flag = false; - int num11 = -1; - if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha += 20; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - else - { - projectile.alpha -= 50; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - Vector2 center = Main.player[projectile.owner].Center; - Vector2 value = new Vector2(0.5f); - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float 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)) - { - Vector2 vector3 = nPC.position + nPC.Size * value; - float num13 = Vector2.Distance(vector3, center); - if (((Vector2.Distance(center, vector) > num13 && num13 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC.position, nPC.width, nPC.height)) - { - num10 = num13; - vector = vector3; - flag = true; - num11 = k; - } - } - } - } - int num16 = 500; - if (flag) - { - num16 = 1000; - } - if (Vector2.Distance(player.Center, projectile.Center) > (float)num16) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag && projectile.ai[0] == 0f) - { - Vector2 vector4 = vector - projectile.Center; - float num17 = vector4.Length(); - vector4.Normalize(); - if (num17 > 400f) - { - float scaleFactor = 2f; - vector4 *= scaleFactor; - projectile.velocity = (projectile.velocity * 20f + vector4) / 21f; - } - else - { - projectile.velocity *= 0.96f; - } - if (num17 > 200f) - { - float scaleFactor2 = 6f; - vector4 *= scaleFactor2; - projectile.velocity.X = (projectile.velocity.X * 40f + vector4.X) / 41f; - projectile.velocity.Y = (projectile.velocity.Y * 40f + vector4.Y) / 41f; - } - if (projectile.velocity.Y > -1f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.1f; - } - } - else - { - if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) - { - projectile.ai[0] = 1f; - } - float num21 = 9f; - Vector2 center2 = projectile.Center; - Vector2 vector6 = (player.Center - center2 + new Vector2(0f, -60f)) + new Vector2(0f, 40f); - float num23 = vector6.Length(); - if (num23 > 200f && num21 < 9f) - { - num21 = 9f; - } - if (num23 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num23 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); - } - if (Math.Abs(vector6.X) > 40f || Math.Abs(vector6.Y) > 10f) - { - vector6.Normalize(); - vector6 *= num21; - vector6 *= new Vector2(1.25f, 0.65f); - projectile.velocity = (projectile.velocity * 20f + vector6) / 21f; - } - else - { - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - projectile.velocity *= 1.01f; - } - } - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.frameCounter++; - int num25 = 2; - if (projectile.frameCounter >= 6 * num25) - { - projectile.frameCounter = 0; - } - projectile.frame = projectile.frameCounter / num25; - if (Main.rand.Next(5) == 0) - { - int num26 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default(Color), 2f); - Main.dust[num26].velocity *= 0.3f; - Main.dust[num26].noGravity = true; - Main.dust[num26].noLight = true; - } - if (projectile.velocity.X > 0f) - { - projectile.spriteDirection = (projectile.direction = -1); - } - else if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = (projectile.direction = 1); - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += 1f; - if (Main.rand.Next(3) != 0) - { - projectile.ai[1] += 1f; - } - } - if (projectile.ai[1] > 60f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor4 = 14f; - int num28 = mod.ProjectileType("MiniSandShark"); - if (flag) - { - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - Vector2 vector9 = vector - projectile.Center; - vector9.Normalize(); - vector9 *= scaleFactor4; - int num32 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector9.X, vector9.Y, num28, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num32].timeLeft = 300; - Main.projectile[num32].netUpdate = true; - projectile.netUpdate = true; - } - } - } - } - } - } - - 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 CanDamage() - { - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class Sandnado : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sandnado"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 40; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + if (projectile.localAI[1] == 0f) + { + 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, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[1] += 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; + } + bool flag64 = projectile.type == mod.ProjectileType("Sandnado"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("Sandnado"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.sandnado = false; + } + if (modPlayer.sandnado) + { + projectile.timeLeft = 2; + } + } + float num8 = 0.1f; + float num9 = ((float)projectile.width * 2f); + for (int j = 0; j < 1000; j++) + { + if (j != projectile.whoAmI && Main.projectile[j].active && Main.projectile[j].owner == projectile.owner && Main.projectile[j].type == projectile.type && + Math.Abs(projectile.position.X - Main.projectile[j].position.X) + Math.Abs(projectile.position.Y - Main.projectile[j].position.Y) < num9) + { + if (projectile.position.X < Main.projectile[j].position.X) + { + projectile.velocity.X = projectile.velocity.X - num8; + } + else + { + projectile.velocity.X = projectile.velocity.X + num8; + } + if (projectile.position.Y < Main.projectile[j].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num8; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num8; + } + } + } + Vector2 vector = projectile.position; + float num10 = 400f; + bool flag = false; + int num11 = -1; + if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha += 20; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + else + { + projectile.alpha -= 50; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + } + Vector2 center = Main.player[projectile.owner].Center; + Vector2 value = new Vector2(0.5f); + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 vector2 = npc.position + npc.Size * value; + float 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)) + { + Vector2 vector3 = nPC.position + nPC.Size * value; + float num13 = Vector2.Distance(vector3, center); + if (((Vector2.Distance(center, vector) > num13 && num13 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC.position, nPC.width, nPC.height)) + { + num10 = num13; + vector = vector3; + flag = true; + num11 = k; + } + } + } + } + int num16 = 500; + if (flag) + { + num16 = 1000; + } + if (Vector2.Distance(player.Center, projectile.Center) > (float)num16) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag && projectile.ai[0] == 0f) + { + Vector2 vector4 = vector - projectile.Center; + float num17 = vector4.Length(); + vector4.Normalize(); + if (num17 > 400f) + { + float scaleFactor = 2f; + vector4 *= scaleFactor; + projectile.velocity = (projectile.velocity * 20f + vector4) / 21f; + } + else + { + projectile.velocity *= 0.96f; + } + if (num17 > 200f) + { + float scaleFactor2 = 6f; + vector4 *= scaleFactor2; + projectile.velocity.X = (projectile.velocity.X * 40f + vector4.X) / 41f; + projectile.velocity.Y = (projectile.velocity.Y * 40f + vector4.Y) / 41f; + } + if (projectile.velocity.Y > -1f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.1f; + } + } + else + { + if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) + { + projectile.ai[0] = 1f; + } + float num21 = 9f; + Vector2 center2 = projectile.Center; + Vector2 vector6 = (player.Center - center2 + new Vector2(0f, -60f)) + new Vector2(0f, 40f); + float num23 = vector6.Length(); + if (num23 > 200f && num21 < 9f) + { + num21 = 9f; + } + if (num23 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num23 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); + } + if (Math.Abs(vector6.X) > 40f || Math.Abs(vector6.Y) > 10f) + { + vector6.Normalize(); + vector6 *= num21; + vector6 *= new Vector2(1.25f, 0.65f); + projectile.velocity = (projectile.velocity * 20f + vector6) / 21f; + } + else + { + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + projectile.velocity *= 1.01f; + } + } + projectile.rotation = projectile.velocity.X * 0.05f; + projectile.frameCounter++; + int num25 = 2; + if (projectile.frameCounter >= 6 * num25) + { + projectile.frameCounter = 0; + } + projectile.frame = projectile.frameCounter / num25; + if (Main.rand.Next(5) == 0) + { + int num26 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default(Color), 2f); + Main.dust[num26].velocity *= 0.3f; + Main.dust[num26].noGravity = true; + Main.dust[num26].noLight = true; + } + if (projectile.velocity.X > 0f) + { + projectile.spriteDirection = (projectile.direction = -1); + } + else if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = (projectile.direction = 1); + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += 1f; + if (Main.rand.Next(3) != 0) + { + projectile.ai[1] += 1f; + } + } + if (projectile.ai[1] > 60f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor4 = 14f; + int num28 = mod.ProjectileType("MiniSandShark"); + if (flag) + { + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Vector2 vector9 = vector - projectile.Center; + vector9.Normalize(); + vector9 *= scaleFactor4; + int num32 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector9.X, vector9.Y, num28, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num32].timeLeft = 300; + Main.projectile[num32].netUpdate = true; + projectile.netUpdate = true; + } + } + } + } + } + } + + 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 CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/SandyWaifu.cs b/Projectiles/Summon/SandyWaifu.cs index 0638638cf6..ca7fe30d51 100644 --- a/Projectiles/Summon/SandyWaifu.cs +++ b/Projectiles/Summon/SandyWaifu.cs @@ -1,289 +1,289 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Summon -{ - public class SandyWaifu : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Waifu"); - Main.projFrames[projectile.type] = 12; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 42; - projectile.height = 98; - 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 = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("SandyWaifu"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.sandWaifu && !modPlayer.allWaifus) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.sWaifu = false; - } - if (modPlayer.sWaifu) - { - projectile.timeLeft = 2; - } - } - 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++) - { - 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 / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 700f; //700 - float num634 = 800f; - float num635 = 1200f; - float num636 = 200f; //150 - float num = (float)Main.rand.Next(90, 111) * 0.01f; - 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++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("SandyWaifu")); - 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; - } - } - } - 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; - } - 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) && 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) - { - if (projectile.frame < 6) - { - projectile.frame = 6; - } - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 11) - { - projectile.frame = 6; - } - num647 = num635; - } - else - { - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; //6 - if (flag26) - { - num650 = 15f; //16 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(250f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) //200 and 8 - { - num650 = 8f; //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.195f; - projectile.velocity.Y = -0.095f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 220f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 11f; - int num658 = mod.ProjectileType("SandBolt"); - if (flag25 && projectile.ai[1] == 0f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 300; - projectile.netUpdate = true; - } - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Summon +{ + public class SandyWaifu : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Waifu"); + Main.projFrames[projectile.type] = 12; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 42; + projectile.height = 98; + 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 = 20 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("SandyWaifu"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.sandWaifu && !modPlayer.allWaifus) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.sWaifu = false; + } + if (modPlayer.sWaifu) + { + projectile.timeLeft = 2; + } + } + 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++) + { + 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 / + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 700f; //700 + float num634 = 800f; + float num635 = 1200f; + float num636 = 200f; //150 + float num = (float)Main.rand.Next(90, 111) * 0.01f; + 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++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("SandyWaifu")); + 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; + } + } + } + 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; + } + 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) && 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) + { + if (projectile.frame < 6) + { + projectile.frame = 6; + } + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 11) + { + projectile.frame = 6; + } + num647 = num635; + } + else + { + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; //6 + if (flag26) + { + num650 = 15f; //16 + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(250f, -60f); //-60 + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) //200 and 8 + { + num650 = 8f; //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.195f; + projectile.velocity.Y = -0.095f; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 220f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 11f; + int num658 = mod.ProjectileType("SandBolt"); + if (flag25 && projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num659].timeLeft = 300; + projectile.netUpdate = true; + } + } + } + } + } +} diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index ae4d6f0405..3ea343cf57 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -1,239 +1,239 @@ -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.Summon -{ - public class SilvaCrystal : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Crystal"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.penetrate = -1; - } - - public override void AI() - { - if (projectile.localAI[1] == 0f) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[1] += 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; - } - bool flag64 = projectile.type == mod.ProjectileType("SilvaCrystal"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.silvaSummon) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.sCrystal = false; - } - if (modPlayer.sCrystal) - { - projectile.timeLeft = 2; - } - } - 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) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - float num1072 = 1500f; - projectile.velocity = Vector2.Zero; - projectile.alpha -= 5; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.direction == 0) - { - projectile.direction = Main.player[projectile.owner].direction; - } - if (projectile.alpha == 0 && Main.rand.Next(15) == 0) - { - Dust dust34 = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f)]; - dust34.velocity.X = 0f; - dust34.noGravity = true; - dust34.fadeIn = 1f; - dust34.position = projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); - dust34.scale = 0.5f; - } - float[] var_2_31123_cp_0 = projectile.localAI; - int var_2_31123_cp_1 = 0; - float num73 = var_2_31123_cp_0[var_2_31123_cp_1]; - var_2_31123_cp_0[var_2_31123_cp_1] = num73 + 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.localAI[0] = 0f; - } - if (projectile.ai[0] < 0f) - { - float[] var_2_31169_cp_0 = projectile.ai; - int var_2_31169_cp_1 = 0; - float num730 = var_2_31169_cp_0[var_2_31169_cp_1]; - var_2_31169_cp_0[var_2_31169_cp_1] = num730 + 1f; - } - if (projectile.ai[0] == 0f) - { - int num1074 = -1; - float num1075 = num1072; - 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; - for (int num1077 = 0; num1077 < 200; num1077 = num30 + 1) - { - NPC nPC16 = Main.npc[num1077]; - if (nPC16.CanBeChasedBy(projectile, false)) - { - float num1078 = projectile.Distance(nPC16.Center); - if (num1078 < num1075 && Collision.CanHitLine(projectile.Center, 0, 0, nPC16.Center, 0, 0)) - { - num1075 = num1078; - num1074 = num1077; - } - } - num30 = num1077; - } - } - if (num1074 != -1) - { - projectile.ai[0] = 1f; - projectile.ai[1] = (float)num1074; - projectile.netUpdate = true; - return; - } - } - if (projectile.ai[0] > 0f) - { - int num1079 = (int)projectile.ai[1]; - if (!Main.npc[num1079].CanBeChasedBy(projectile, false)) - { - projectile.ai[0] = 0f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - return; - } - float[] var_2_31390_cp_0 = projectile.ai; - int var_2_31390_cp_1 = 0; - float num731 = var_2_31390_cp_0[var_2_31390_cp_1]; - var_2_31390_cp_0[var_2_31390_cp_1] = num731 + 1f; - if (projectile.ai[0] >= 5f) - { - Vector2 vector154 = projectile.DirectionTo(Main.npc[num1079].Center); - if (vector154.HasNaNs()) - { - vector154 = Vector2.UnitY; - } - int num1082 = (vector154.X > 0f) ? 1 : -1; - projectile.direction = num1082; - projectile.ai[0] = -20f; - projectile.netUpdate = true; - if (projectile.owner == Main.myPlayer) - { - Vector2 vector155 = Main.npc[num1079].position + Main.npc[num1079].Size * Utils.RandomVector2(Main.rand, 0f, 1f) - projectile.Center; - int num31; - for (int num1083 = 0; num1083 < 3; num1083 = num31 + 1) - { - Vector2 vector156 = projectile.Center + vector155; - if (num1083 > 0) - { - vector156 = projectile.Center + vector155.RotatedByRandom(0.78539818525314331) * (Main.rand.NextFloat() * 0.5f + 0.75f); - } - float x4 = Main.rgbToHsl(new Color(Main.DiscoR, 203, 103)).X; - Projectile.NewProjectile(vector156.X, vector156.Y, 0f, 0f, mod.ProjectileType("SilvaCrystalExplosion"), projectile.damage, projectile.knockBack, projectile.owner, x4, (float)projectile.whoAmI); - num31 = num1083; - } - return; - } - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 127 - projectile.alpha / 2); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin11 = rectangle17.Size() / 2f; - float scaleFactor5 = (float)Math.Cos((double)(6.28318548f * (projectile.localAI[0] / 60f))) + 3f + 3f; - for (float num286 = 0f; num286 < 4f; num286 += 1f) - { - SpriteBatch arg_F907_0 = Main.spriteBatch; - Texture2D arg_F907_1 = texture2D34; - Vector2 arg_F8CE_0 = vector59; - Vector2 arg_F8BE_0 = Vector2.UnitY; - double arg_F8BE_1 = (double)(num286 * 1.57079637f); - Vector2 center = default(Vector2); - arg_F907_0.Draw(arg_F907_1, arg_F8CE_0 + arg_F8BE_0.RotatedBy(arg_F8BE_1, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, projectile.rotation, origin11, projectile.scale, SpriteEffects.None, 0f); - } - return false; - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class SilvaCrystal : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Crystal"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.penetrate = -1; + } + + public override void AI() + { + if (projectile.localAI[1] == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[1] += 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; + } + bool flag64 = projectile.type == mod.ProjectileType("SilvaCrystal"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.silvaSummon) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.sCrystal = false; + } + if (modPlayer.sCrystal) + { + projectile.timeLeft = 2; + } + } + 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) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 120f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + float num1072 = 1500f; + projectile.velocity = Vector2.Zero; + projectile.alpha -= 5; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.direction == 0) + { + projectile.direction = Main.player[projectile.owner].direction; + } + if (projectile.alpha == 0 && Main.rand.Next(15) == 0) + { + Dust dust34 = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 267, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f)]; + dust34.velocity.X = 0f; + dust34.noGravity = true; + dust34.fadeIn = 1f; + dust34.position = projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); + dust34.scale = 0.5f; + } + float[] var_2_31123_cp_0 = projectile.localAI; + int var_2_31123_cp_1 = 0; + float num73 = var_2_31123_cp_0[var_2_31123_cp_1]; + var_2_31123_cp_0[var_2_31123_cp_1] = num73 + 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.localAI[0] = 0f; + } + if (projectile.ai[0] < 0f) + { + float[] var_2_31169_cp_0 = projectile.ai; + int var_2_31169_cp_1 = 0; + float num730 = var_2_31169_cp_0[var_2_31169_cp_1]; + var_2_31169_cp_0[var_2_31169_cp_1] = num730 + 1f; + } + if (projectile.ai[0] == 0f) + { + int num1074 = -1; + float num1075 = num1072; + 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; + for (int num1077 = 0; num1077 < 200; num1077 = num30 + 1) + { + NPC nPC16 = Main.npc[num1077]; + if (nPC16.CanBeChasedBy(projectile, false)) + { + float num1078 = projectile.Distance(nPC16.Center); + if (num1078 < num1075 && Collision.CanHitLine(projectile.Center, 0, 0, nPC16.Center, 0, 0)) + { + num1075 = num1078; + num1074 = num1077; + } + } + num30 = num1077; + } + } + if (num1074 != -1) + { + projectile.ai[0] = 1f; + projectile.ai[1] = (float)num1074; + projectile.netUpdate = true; + return; + } + } + if (projectile.ai[0] > 0f) + { + int num1079 = (int)projectile.ai[1]; + if (!Main.npc[num1079].CanBeChasedBy(projectile, false)) + { + projectile.ai[0] = 0f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + return; + } + float[] var_2_31390_cp_0 = projectile.ai; + int var_2_31390_cp_1 = 0; + float num731 = var_2_31390_cp_0[var_2_31390_cp_1]; + var_2_31390_cp_0[var_2_31390_cp_1] = num731 + 1f; + if (projectile.ai[0] >= 5f) + { + Vector2 vector154 = projectile.DirectionTo(Main.npc[num1079].Center); + if (vector154.HasNaNs()) + { + vector154 = Vector2.UnitY; + } + int num1082 = (vector154.X > 0f) ? 1 : -1; + projectile.direction = num1082; + projectile.ai[0] = -20f; + projectile.netUpdate = true; + if (projectile.owner == Main.myPlayer) + { + Vector2 vector155 = Main.npc[num1079].position + Main.npc[num1079].Size * Utils.RandomVector2(Main.rand, 0f, 1f) - projectile.Center; + int num31; + for (int num1083 = 0; num1083 < 3; num1083 = num31 + 1) + { + Vector2 vector156 = projectile.Center + vector155; + if (num1083 > 0) + { + vector156 = projectile.Center + vector155.RotatedByRandom(0.78539818525314331) * (Main.rand.NextFloat() * 0.5f + 0.75f); + } + float x4 = Main.rgbToHsl(new Color(Main.DiscoR, 203, 103)).X; + Projectile.NewProjectile(vector156.X, vector156.Y, 0f, 0f, mod.ProjectileType("SilvaCrystalExplosion"), projectile.damage, projectile.knockBack, projectile.owner, x4, (float)projectile.whoAmI); + num31 = num1083; + } + return; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 127 - projectile.alpha / 2); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D34 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin11 = rectangle17.Size() / 2f; + float scaleFactor5 = (float)Math.Cos((double)(6.28318548f * (projectile.localAI[0] / 60f))) + 3f + 3f; + for (float num286 = 0f; num286 < 4f; num286 += 1f) + { + SpriteBatch arg_F907_0 = Main.spriteBatch; + Texture2D arg_F907_1 = texture2D34; + Vector2 arg_F8CE_0 = vector59; + Vector2 arg_F8BE_0 = Vector2.UnitY; + double arg_F8BE_1 = (double)(num286 * 1.57079637f); + Vector2 center = default(Vector2); + arg_F907_0.Draw(arg_F907_1, arg_F8CE_0 + arg_F8BE_0.RotatedBy(arg_F8BE_1, center) * scaleFactor5, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * 0.2f, projectile.rotation, origin11, projectile.scale, SpriteEffects.None, 0f); + } + return false; + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index 0efed1dee8..9d4b5e1322 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -1,237 +1,237 @@ -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.Summon -{ - public class SilvaCrystalExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 900; - } - - public override void AI() - { - Color newColor2 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); - int num978 = (int)projectile.ai[1]; - if (num978 < 0 || num978 >= 1000 || (!Main.projectile[num978].active && Main.projectile[num978].type != mod.ProjectileType("SilvaCrystal"))) - { - projectile.ai[1] = -1f; - } - else - { - DelegateMethods.v3_1 = newColor2.ToVector3() * 0.5f; - Utils.PlotTileLine(projectile.Center, Main.projectile[num978].Center, 8f, new Utils.PerLinePoint(DelegateMethods.CastLight)); - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f; - projectile.direction = ((Main.rand.Next(2) > 0) ? 1 : -1); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor2.ToVector3() * 0.5f); - } - int num3; - for (int num979 = 0; num979 < 2; num979 = num3 + 1) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); - Dust dust24 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust24.noGravity = true; - dust24.noLight = true; - dust24.scale = projectile.Opacity * projectile.localAI[0]; - dust24.position = projectile.Center; - dust24.velocity = value55 * 2.5f; - } - num3 = num979; - } - for (int num980 = 0; num980 < 2; num980 = num3 + 1) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default(Vector2)); - Dust dust25 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; - dust25.noGravity = true; - dust25.noLight = true; - dust25.scale = projectile.Opacity * projectile.localAI[0]; - dust25.position = projectile.Center; - dust25.velocity = value56 * 2.5f; - } - num3 = num980; - } - if (Main.rand.Next(10) == 0) - { - float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; - float fadeIn = 1f + Main.rand.NextFloat(); - float num981 = 1f + Main.rand.NextFloat(); - Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f); - if (vector136 != Vector2.Zero) - { - vector136.Normalize(); - } - vector136 *= 20f + Main.rand.NextFloat() * 100f; - Vector2 vector137 = projectile.Center + vector136; - Point point3 = vector137.ToTileCoordinates(); - bool flag52 = true; - if (!WorldGen.InWorld(point3.X, point3.Y, 0)) - { - flag52 = false; - } - if (flag52 && WorldGen.SolidTile(point3.X, point3.Y)) - { - flag52 = false; - } - if (flag52) - { - Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; - dust26.noGravity = true; - dust26.position = vector137; - dust26.velocity = -Vector2.UnitY * scaleFactor13 * (Main.rand.NextFloat() * 0.9f + 1.6f); - dust26.fadeIn = fadeIn; - dust26.scale = num981; - dust26.noLight = true; - Dust dust27 = Dust.CloneDust(dust26); - Dust dust = dust27; - dust.scale *= 0.65f; - dust = dust27; - dust.fadeIn *= 0.65f; - dust27.color = new Color(255, 255, 255, 255); - } - } - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - projectile.velocity = Vector2.Zero; - float[] var_2_2C8BA_cp_0 = projectile.localAI; - int var_2_2C8BA_cp_1 = 1; - float num73 = var_2_2C8BA_cp_0[var_2_2C8BA_cp_1]; - var_2_2C8BA_cp_0[var_2_2C8BA_cp_1] = num73 + 1f; - if (projectile.localAI[1] >= 60f) - { - projectile.Kill(); - return; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin11 = rectangle17.Size() / 2f; - Microsoft.Xna.Framework.Color color60 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, projectile.rotation, origin11, projectile.scale * 2f, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, 0f, origin11, projectile.scale * 2f, SpriteEffects.None, 0f); - if (projectile.ai[1] != -1f && projectile.Opacity > 0.3f) - { - Vector2 vector61 = Main.projectile[(int)projectile.ai[1]].Center - projectile.Center; - Vector2 vector62 = new Vector2(1f, vector61.Length() / (float)texture2D34.Height); - float rotation27 = vector61.ToRotation() + 1.57079637f; - float num279 = MathHelper.Distance(30f, projectile.localAI[1]) / 20f; - num279 = MathHelper.Clamp(num279, 0f, 1f); - if (num279 > 0f) - { - Main.spriteBatch.Draw(texture2D34, vector59 + vector61 / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60 * num279, rotation27, origin11, vector62, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(texture2D34, vector59 + vector61 / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * num279, rotation27, origin11, vector62 / 2f, SpriteEffects.None, 0f); - } - } - return false; - } - - public override void Kill(int timeLeft) - { - Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); - float num69 = (float)Main.rand.Next(7, 13); - Vector2 value5 = new Vector2(2.1f, 2f); - Color newColor = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); - newColor.A = 255; - float num72; - for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) - { - int num71 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num71].position = projectile.Center; - Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default(Vector2)) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Main.dust[num71].noGravity = true; - Main.dust[num71].scale = 2f; - Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust11 = Dust.CloneDust(num71); - Dust dust = dust11; - dust.scale /= 2f; - dust = dust11; - dust.fadeIn /= 2f; - dust11.color = new Color(255, 255, 255, 255); - num72 = num70; - } - for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) - { - int num74 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); - Main.dust[num74].position = projectile.Center; - Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default(Vector2)) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); - Dust dust = Main.dust[num74]; - dust.velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[num74].noGravity = true; - Main.dust[num74].scale = Main.rand.NextFloat() * 1f; - Main.dust[num74].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust12 = Dust.CloneDust(num74); - dust = dust12; - dust.scale /= 2f; - dust = dust12; - dust.fadeIn /= 2f; - dust12.color = new Color(255, 255, 255, 255); - num72 = num73; - } - if (Main.myPlayer == projectile.owner) - { - projectile.friendly = true; - int width = projectile.width; - int height2 = projectile.height; - int num75 = projectile.penetrate; - projectile.position = projectile.Center; - projectile.width = (projectile.height = 60); - projectile.Center = projectile.position; - projectile.penetrate = -1; - projectile.maxPenetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - projectile.penetrate = num75; - projectile.position = projectile.Center; - projectile.width = width; - projectile.height = height2; - projectile.Center = projectile.position; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } - } -} \ No newline at end of file +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.Summon +{ + public class SilvaCrystalExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 900; + } + + public override void AI() + { + Color newColor2 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); + int num978 = (int)projectile.ai[1]; + if (num978 < 0 || num978 >= 1000 || (!Main.projectile[num978].active && Main.projectile[num978].type != mod.ProjectileType("SilvaCrystal"))) + { + projectile.ai[1] = -1f; + } + else + { + DelegateMethods.v3_1 = newColor2.ToVector3() * 0.5f; + Utils.PlotTileLine(projectile.Center, Main.projectile[num978].Center, 8f, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f; + projectile.direction = ((Main.rand.Next(2) > 0) ? 1 : -1); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor2.ToVector3() * 0.5f); + } + int num3; + for (int num979 = 0; num979 < 2; num979 = num3 + 1) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value55 = Vector2.UnitY.RotatedBy((double)((float)num979 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); + Dust dust24 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + dust24.noGravity = true; + dust24.noLight = true; + dust24.scale = projectile.Opacity * projectile.localAI[0]; + dust24.position = projectile.Center; + dust24.velocity = value55 * 2.5f; + } + num3 = num979; + } + for (int num980 = 0; num980 < 2; num980 = num3 + 1) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value56 = Vector2.UnitY.RotatedBy((double)((float)num980 * 3.14159274f), default(Vector2)); + Dust dust25 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; + dust25.noGravity = true; + dust25.noLight = true; + dust25.scale = projectile.Opacity * projectile.localAI[0]; + dust25.position = projectile.Center; + dust25.velocity = value56 * 2.5f; + } + num3 = num980; + } + if (Main.rand.Next(10) == 0) + { + float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; + float fadeIn = 1f + Main.rand.NextFloat(); + float num981 = 1f + Main.rand.NextFloat(); + Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f); + if (vector136 != Vector2.Zero) + { + vector136.Normalize(); + } + vector136 *= 20f + Main.rand.NextFloat() * 100f; + Vector2 vector137 = projectile.Center + vector136; + Point point3 = vector137.ToTileCoordinates(); + bool flag52 = true; + if (!WorldGen.InWorld(point3.X, point3.Y, 0)) + { + flag52 = false; + } + if (flag52 && WorldGen.SolidTile(point3.X, point3.Y)) + { + flag52 = false; + } + if (flag52) + { + Dust dust26 = Main.dust[Dust.NewDust(vector137, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; + dust26.noGravity = true; + dust26.position = vector137; + dust26.velocity = -Vector2.UnitY * scaleFactor13 * (Main.rand.NextFloat() * 0.9f + 1.6f); + dust26.fadeIn = fadeIn; + dust26.scale = num981; + dust26.noLight = true; + Dust dust27 = Dust.CloneDust(dust26); + Dust dust = dust27; + dust.scale *= 0.65f; + dust = dust27; + dust.fadeIn *= 0.65f; + dust27.color = new Color(255, 255, 255, 255); + } + } + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + projectile.velocity = Vector2.Zero; + float[] var_2_2C8BA_cp_0 = projectile.localAI; + int var_2_2C8BA_cp_1 = 1; + float num73 = var_2_2C8BA_cp_0[var_2_2C8BA_cp_1]; + var_2_2C8BA_cp_0[var_2_2C8BA_cp_1] = num73 + 1f; + if (projectile.localAI[1] >= 60f) + { + projectile.Kill(); + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + Vector2 vector59 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D34 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle17 = texture2D34.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin11 = rectangle17.Size() / 2f; + Microsoft.Xna.Framework.Color color60 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, projectile.rotation, origin11, projectile.scale * 2f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture2D34, vector59, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60, 0f, origin11, projectile.scale * 2f, SpriteEffects.None, 0f); + if (projectile.ai[1] != -1f && projectile.Opacity > 0.3f) + { + Vector2 vector61 = Main.projectile[(int)projectile.ai[1]].Center - projectile.Center; + Vector2 vector62 = new Vector2(1f, vector61.Length() / (float)texture2D34.Height); + float rotation27 = vector61.ToRotation() + 1.57079637f; + float num279 = MathHelper.Distance(30f, projectile.localAI[1]) / 20f; + num279 = MathHelper.Clamp(num279, 0f, 1f); + if (num279 > 0f) + { + Main.spriteBatch.Draw(texture2D34, vector59 + vector61 / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangle17), color60 * num279, rotation27, origin11, vector62, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture2D34, vector59 + vector61 / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangle17), alpha5 * num279, rotation27, origin11, vector62 / 2f, SpriteEffects.None, 0f); + } + } + return false; + } + + public override void Kill(int timeLeft) + { + Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); + float num69 = (float)Main.rand.Next(7, 13); + Vector2 value5 = new Vector2(2.1f, 2f); + Color newColor = Main.hslToRgb(projectile.ai[0], 1f, 0.5f); + newColor.A = 255; + float num72; + for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) + { + int num71 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num71].position = projectile.Center; + Main.dust[num71].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num70 / num69), default(Vector2)) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[num71].noGravity = true; + Main.dust[num71].scale = 2f; + Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust11 = Dust.CloneDust(num71); + Dust dust = dust11; + dust.scale /= 2f; + dust = dust11; + dust.fadeIn /= 2f; + dust11.color = new Color(255, 255, 255, 255); + num72 = num70; + } + for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) + { + int num74 = Dust.NewDust(projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); + Main.dust[num74].position = projectile.Center; + Main.dust[num74].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num73 / num69), default(Vector2)) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Dust dust = Main.dust[num74]; + dust.velocity *= Main.rand.NextFloat() * 0.8f; + Main.dust[num74].noGravity = true; + Main.dust[num74].scale = Main.rand.NextFloat() * 1f; + Main.dust[num74].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust12 = Dust.CloneDust(num74); + dust = dust12; + dust.scale /= 2f; + dust = dust12; + dust.fadeIn /= 2f; + dust12.color = new Color(255, 255, 255, 255); + num72 = num73; + } + if (Main.myPlayer == projectile.owner) + { + projectile.friendly = true; + int width = projectile.width; + int height2 = projectile.height; + int num75 = projectile.penetrate; + projectile.position = projectile.Center; + projectile.width = (projectile.height = 60); + projectile.Center = projectile.position; + projectile.penetrate = -1; + projectile.maxPenetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + projectile.penetrate = num75; + projectile.position = projectile.Center; + projectile.width = width; + projectile.height = height2; + projectile.Center = projectile.position; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + } +} diff --git a/Projectiles/Summon/SirenLure.cs b/Projectiles/Summon/SirenLure.cs index f76bcb7f7a..f8c061c77b 100644 --- a/Projectiles/Summon/SirenLure.cs +++ b/Projectiles/Summon/SirenLure.cs @@ -1,197 +1,197 @@ -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.Summon -{ - public class SirenLure : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren Lure"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 120; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("SirenLure"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.sirenWaifu && !modPlayer.allWaifus) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.slWaifu = false; - } - if (modPlayer.slWaifu) - { - projectile.timeLeft = 2; - } - } - 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++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - 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; - } - Lighting.AddLight(projectile.Center, 0f, 0.25f, 1.5f); - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - { - projectile.frame = 0; - } - 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) + Main.player[projectile.owner].gfxOffY - 180f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 360f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 1000f; - 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 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num508 = num541; - num506 = num539; - num507 = num540; - flag18 = true; - } - } - } - else - { - 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)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - } - } - } - } - if (flag18) - { - float num516 = num506; - float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; - if (num506 < 0f) - { - projectile.spriteDirection = 1; - } - else - { - projectile.spriteDirection = -1; - } - int projectileType = mod.ProjectileType("WaterSpearFriendly"); - if (Main.rand.Next(9) == 0) - { - projectileType = mod.ProjectileType("FrostMistFriendly"); - } - else if (Main.rand.Next(9) == 0) - { - projectileType = mod.ProjectileType("SirenSongFriendly"); - } - float num403 = Main.rand.Next(12, 20); - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.ai[0] = 12f; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class SirenLure : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Siren Lure"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 120; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("SirenLure"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.sirenWaifu && !modPlayer.allWaifus) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.slWaifu = false; + } + if (modPlayer.slWaifu) + { + projectile.timeLeft = 2; + } + } + 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++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 33, 0f, 0f, 0, default(Color), 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + 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; + } + Lighting.AddLight(projectile.Center, 0f, 0.25f, 1.5f); + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + 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) + Main.player[projectile.owner].gfxOffY - 180f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 360f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num506 = projectile.Center.X; + float num507 = projectile.Center.Y; + float num508 = 1000f; + 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 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + } + } + } + else + { + 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)) + { + num508 = num515; + num506 = num513; + num507 = num514; + flag18 = true; + } + } + } + } + if (flag18) + { + float num516 = num506; + float num517 = num507; + num506 -= projectile.Center.X; + num507 -= projectile.Center.Y; + if (num506 < 0f) + { + projectile.spriteDirection = 1; + } + else + { + projectile.spriteDirection = -1; + } + int projectileType = mod.ProjectileType("WaterSpearFriendly"); + if (Main.rand.Next(9) == 0) + { + projectileType = mod.ProjectileType("FrostMistFriendly"); + } + else if (Main.rand.Next(9) == 0) + { + projectileType = mod.ProjectileType("SirenSongFriendly"); + } + float num403 = Main.rand.Next(12, 20); + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num516 - vector29.X; + float num405 = num517 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + projectile.ai[0] = 12f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/SirenSongFriendly.cs b/Projectiles/Summon/SirenSongFriendly.cs index 9d42b5637f..cfc982ceff 100644 --- a/Projectiles/Summon/SirenSongFriendly.cs +++ b/Projectiles/Summon/SirenSongFriendly.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class SirenSongFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Song"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.02f; - if (projectile.scale >= 1.25f) - { - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale -= 0.02f; - if (projectile.scale <= 0.75f) - { - projectile.localAI[0] = 0f; - } - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; - Main.harpNote = soundPitch; - Main.PlaySound(SoundID.Item26, projectile.position); - } - Lighting.AddLight(projectile.Center, 0f, 0f, 1.2f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, 0); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SirenSongFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Song"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.02f; + if (projectile.scale >= 1.25f) + { + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale -= 0.02f; + if (projectile.scale <= 0.75f) + { + projectile.localAI[0] = 0f; + } + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; + Main.harpNote = soundPitch; + Main.PlaySound(SoundID.Item26, projectile.position); + } + Lighting.AddLight(projectile.Center, 0f, 0f, 1.2f); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, 0); + } + } +} diff --git a/Projectiles/Summon/SlimeGod.cs b/Projectiles/Summon/SlimeGod.cs index 6828fea92d..4fa65ecc2d 100644 --- a/Projectiles/Summon/SlimeGod.cs +++ b/Projectiles/Summon/SlimeGod.cs @@ -1,105 +1,105 @@ -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.Summon -{ - public class SlimeGod : ModProjectile - { - public float dust = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slime God"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 0f; - projectile.alpha = 75; - projectile.aiStyle = 26; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - aiType = 266; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } - - public override void AI() - { - if (dust == 0f) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 16; - 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, 173, vector7.X * 1f, vector7.Y * 1f, 100, default(Color), 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 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; - } - bool flag64 = projectile.type == mod.ProjectileType("SlimeGod"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("SlimeGod"), 3600); - if (!modPlayer.slimeGod) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.sGod = false; - } - if (modPlayer.sGod) - { - projectile.timeLeft = 2; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class SlimeGod : ModProjectile + { + public float dust = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God"); + Main.projFrames[projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 0f; + projectile.alpha = 75; + projectile.aiStyle = 26; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + aiType = 266; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override void AI() + { + if (dust == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 16; + 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, 173, vector7.X * 1f, vector7.Y * 1f, 100, default(Color), 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 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; + } + bool flag64 = projectile.type == mod.ProjectileType("SlimeGod"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("SlimeGod"), 3600); + if (!modPlayer.slimeGod) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.sGod = false; + } + if (modPlayer.sGod) + { + projectile.timeLeft = 2; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} diff --git a/Projectiles/Summon/SlimeGodAlt.cs b/Projectiles/Summon/SlimeGodAlt.cs index 91506432ed..40af7d9885 100644 --- a/Projectiles/Summon/SlimeGodAlt.cs +++ b/Projectiles/Summon/SlimeGodAlt.cs @@ -1,105 +1,105 @@ -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.Summon -{ - public class SlimeGodAlt : ModProjectile - { - public float dust = 0f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Slime God"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 0f; - projectile.alpha = 75; - projectile.aiStyle = 26; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - aiType = 266; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } - - public override void AI() - { - if (dust == 0f) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 16; - 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, 5, vector7.X * 1f, vector7.Y * 1f, 100, default(Color), 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - dust += 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; - } - bool flag64 = projectile.type == mod.ProjectileType("SlimeGodAlt"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("SlimeGod"), 3600); - if (!modPlayer.slimeGod) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.sGod = false; - } - if (modPlayer.sGod) - { - projectile.timeLeft = 2; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class SlimeGodAlt : ModProjectile + { + public float dust = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime God"); + Main.projFrames[projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 0f; + projectile.alpha = 75; + projectile.aiStyle = 26; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + aiType = 266; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override void AI() + { + if (dust == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 16; + 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, 5, vector7.X * 1f, vector7.Y * 1f, 100, default(Color), 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 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; + } + bool flag64 = projectile.type == mod.ProjectileType("SlimeGodAlt"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("SlimeGod"), 3600); + if (!modPlayer.slimeGod) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.sGod = false; + } + if (modPlayer.sGod) + { + projectile.timeLeft = 2; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} diff --git a/Projectiles/Summon/SolarBeam.cs b/Projectiles/Summon/SolarBeam.cs index 80a2e8a550..f977349c8e 100644 --- a/Projectiles/Summon/SolarBeam.cs +++ b/Projectiles/Summon/SolarBeam.cs @@ -1,48 +1,48 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class SolarBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 48; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 200; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default(Color), 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SolarBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.aiStyle = 48; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = 1; + projectile.extraUpdates = 100; + projectile.timeLeft = 200; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + for (int num447 = 0; num447 < 4; num447++) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * ((float)num447 * 0.25f); + projectile.alpha = 255; + int num448 = Dust.NewDust(vector33, 1, 1, 246, 0f, 0f, 0, default(Color), 1f); + Main.dust[num448].position = vector33; + Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.2f; + } + } + } + } +} diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index a0f5334532..b6151ed12b 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -1,161 +1,161 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class SolarGod : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Solar God"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 54; - projectile.height = 54; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - bool flag64 = projectile.type == mod.ProjectileType("SolarGod"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("SolarSpiritGod"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.SPG = false; - } - if (modPlayer.SPG) - { - projectile.timeLeft = 2; - } - } - 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) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 150f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - if (projectile.localAI[0] == 0f) - { - 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++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - 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; - } - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - float num396 = projectile.position.X; - float num397 = projectile.position.Y; - float num398 = 700f; - bool flag11 = false; - 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 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - 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; - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num396 - vector29.X; - float num405 = num397 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, mod.ProjectileType("SolarBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.ai[0] = 30f; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SolarGod : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Solar God"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 54; + projectile.height = 54; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + bool flag64 = projectile.type == mod.ProjectileType("SolarGod"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("SolarSpiritGod"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.SPG = false; + } + if (modPlayer.SPG) + { + projectile.timeLeft = 2; + } + } + 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) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 150f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + if (projectile.localAI[0] == 0f) + { + 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++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default(Color), 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + 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; + } + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + float num396 = projectile.position.X; + float num397 = projectile.position.Y; + float num398 = 700f; + bool flag11 = false; + 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 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + 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; + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num396 - vector29.X; + float num405 = num397 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, mod.ProjectileType("SolarBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + projectile.ai[0] = 30f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index b15bb0c19d..83cde25660 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -1,163 +1,163 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class SolarPixie : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Solar Pixie"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 46; - projectile.height = 46; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - bool flag64 = projectile.type == mod.ProjectileType("SolarPixie"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("SolarSpirit"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.SP = false; - } - if (modPlayer.SP) - { - projectile.timeLeft = 2; - } - } - 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) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 140f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - if (projectile.localAI[0] == 0f) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 25; - 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, 244, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - 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; - } - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - float num396 = projectile.position.X; - float num397 = projectile.position.Y; - float num398 = 700f; - bool flag11 = false; - 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 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - 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; - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num396 - vector29.X; - float num405 = num397 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - int beam = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, 260, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[beam].magic = false; - Main.projectile[beam].minion = true; - projectile.ai[0] = 50f; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SolarPixie : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Solar Pixie"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 46; + projectile.height = 46; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + bool flag64 = projectile.type == mod.ProjectileType("SolarPixie"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("SolarSpirit"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.SP = false; + } + if (modPlayer.SP) + { + projectile.timeLeft = 2; + } + } + 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) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 140f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + if (projectile.localAI[0] == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 25; + 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, 244, 0f, 0f, 0, default(Color), 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + 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; + } + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + float num396 = projectile.position.X; + float num397 = projectile.position.Y; + float num398 = 700f; + bool flag11 = false; + 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 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + 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; + Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num404 = num396 - vector29.X; + float num405 = num397 - vector29.Y; + float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); + num406 = num403 / num406; + num404 *= num406; + num405 *= num406; + int beam = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, 260, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[beam].magic = false; + Main.projectile[beam].minion = true; + projectile.ai[0] = 50f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 200); + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/SpikecragSpike.cs b/Projectiles/Summon/SpikecragSpike.cs index 517f9ed397..25990c8db1 100644 --- a/Projectiles/Summon/SpikecragSpike.cs +++ b/Projectiles/Summon/SpikecragSpike.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity.Y += 0.1f; } } -} \ No newline at end of file +} diff --git a/Projectiles/Summon/StormMarkSummon.cs b/Projectiles/Summon/StormMarkSummon.cs index 2f5cd277d7..8c4f7212d6 100644 --- a/Projectiles/Summon/StormMarkSummon.cs +++ b/Projectiles/Summon/StormMarkSummon.cs @@ -1,167 +1,167 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Summon -{ - public class StormMarkSummon : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.localNPCHitCooldown = 30 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); - } - - public override void AI() - { - Color newColor3 = new Color(255, 255, 255); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); - } - if (projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default(Color), 0.5f)]; - dust34.position = position4; - dust34.customData = projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 0.8f; - projectile.direction = 1; - Point point9 = projectile.Center.ToTileCoordinates(); - projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; - if (projectile.localAI[1] < 33f) - { - if (projectile.alpha > 0) - { - projectile.alpha -= 8; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - if (projectile.localAI[1] > 103f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 16; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - if (projectile.alpha == 0) - { - Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); - Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = projectile.Opacity * projectile.localAI[0]; - dust35.position = projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.Next(10) == 0) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default(Vector2)); - Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = projectile.Opacity * projectile.localAI[0]; - dust36.position = projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) - { - projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; - } - projectile.velocity = Vector2.Zero; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) - { - int storm = Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("Tornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); - Main.projectile[storm].minion = true; - Main.projectile[storm].melee = false; - } - if (projectile.localAI[1] >= 120f) - { - projectile.Kill(); - return; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Main.projectileTexture[projectile.type]; - Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); - Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Summon +{ + public class StormMarkSummon : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.timeLeft = 900; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.localNPCHitCooldown = 30 - + (NPC.downedGolemBoss ? 5 : 0) - + (NPC.downedMoonlord ? 5 : 0) - + (CalamityWorld.downedDoG ? 4 : 0) - + (CalamityWorld.downedYharon ? 3 : 0); + } + + public override void AI() + { + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + for (int num1134 = 0; num1134 < 1; num1134++) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default(Color), 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default(Vector2)).RotatedBy((double)projectile.rotation, default(Vector2)); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.Next(10) == 0) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default(Vector2)); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + int storm = Projectile.NewProjectile(projectile.Center, Vector2.Zero, mod.ProjectileType("Tornado"), projectile.damage, 2f, projectile.owner, 1f, 0f); + Main.projectile[storm].minion = true; + Main.projectile[storm].melee = false; + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Microsoft.Xna.Framework.Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Microsoft.Xna.Framework.Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/Urchin.cs b/Projectiles/Summon/Urchin.cs index 47f769350b..4a1146c8d6 100644 --- a/Projectiles/Summon/Urchin.cs +++ b/Projectiles/Summon/Urchin.cs @@ -1,142 +1,142 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class Urchin : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Urchin"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("Urchin"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.urchin) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.vUrchin = false; - } - if (modPlayer.vUrchin) - { - projectile.timeLeft = 2; - } - } - 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++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 179, 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 / - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * - Main.player[projectile.owner].minionDamage); - projectile.damage = damage2; - } - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - 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) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)((int)projectile.position.X); - projectile.position.Y = (float)((int)projectile.position.Y); - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool flag18 = false; - float num508 = 300f; - 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)) - { - num508 = num515; - flag18 = true; - } - } - } - if (flag18) - { - int num251 = Main.rand.Next(3, 7); - 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; - int spore = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("UrchinSpike"), projectile.damage, 1f, projectile.owner, 0f, 0f); - Main.projectile[spore].minion = true; - Main.projectile[spore].minionSlots = 0f; - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 42); - projectile.ai[0] = 60f; - } - } - } - - public override bool CanDamage() - { - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class Urchin : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Urchin"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("Urchin"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.urchin) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.vUrchin = false; + } + if (modPlayer.vUrchin) + { + projectile.timeLeft = 2; + } + } + 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++) + { + int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 179, 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 / + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + num395 *= 0.2f; + projectile.scale = num395 + 0.95f; + 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) + Main.player[projectile.owner].gfxOffY - 60f; + if (Main.player[projectile.owner].gravDir == -1f) + { + projectile.position.Y = projectile.position.Y + 120f; + projectile.rotation = 3.14f; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (float)((int)projectile.position.X); + projectile.position.Y = (float)((int)projectile.position.Y); + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + bool flag18 = false; + float num508 = 300f; + 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)) + { + num508 = num515; + flag18 = true; + } + } + } + if (flag18) + { + int num251 = Main.rand.Next(3, 7); + 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; + int spore = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("UrchinSpike"), projectile.damage, 1f, projectile.owner, 0f, 0f); + Main.projectile[spore].minion = true; + Main.projectile[spore].minionSlots = 0f; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 42); + projectile.ai[0] = 60f; + } + } + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/UrchinSpike.cs b/Projectiles/Summon/UrchinSpike.cs index 6f180fa425..e644b29f2b 100644 --- a/Projectiles/Summon/UrchinSpike.cs +++ b/Projectiles/Summon/UrchinSpike.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class UrchinSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Urchin Spike"); - } - - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class UrchinSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Urchin Spike"); + } + + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + } + } +} diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 042386a9cc..ad4e221e35 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -1,294 +1,294 @@ -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.Summon -{ - public class Valkyrie : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Valkyrie"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 90; - projectile.height = 90; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } - - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("Valkyrie"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!modPlayer.valkyrie) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.aValkyrie = false; - } - if (modPlayer.aValkyrie) - { - projectile.timeLeft = 2; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 30; - 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, 59, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - 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; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - float num633 = 700f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0f * num, 0.2f * num, 0.45f * num); - float num637 = 0.05f; - for (int num638 = 0; num638 < 1000; num638++) - { - bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Valkyrie")); - 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; - 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; - } - 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; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = 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.frameCounter++; - if (projectile.frameCounter > 14) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - 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 * 8f; - projectile.netUpdate = true; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - 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, 0f); - return false; - } - } -} \ No newline at end of file +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.Summon +{ + public class Valkyrie : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Valkyrie"); + Main.projFrames[projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 90; + projectile.height = 90; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("Valkyrie"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.valkyrie) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.aValkyrie = false; + } + if (modPlayer.aValkyrie) + { + projectile.timeLeft = 2; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 30; + 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, 59, 0f, 0f, 0, default(Color), 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + 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; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + float num633 = 700f; + float num634 = 800f; + float num635 = 1200f; + float num636 = 150f; + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(projectile.Center, 0f * num, 0.2f * num, 0.45f * num); + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("Valkyrie")); + 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; + 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; + } + 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; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = 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.frameCounter++; + if (projectile.frameCounter > 14) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + 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 * 8f; + projectile.netUpdate = true; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = (projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + 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, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/WaterSpearFriendly.cs b/Projectiles/Summon/WaterSpearFriendly.cs index a226e77a08..b828029723 100644 --- a/Projectiles/Summon/WaterSpearFriendly.cs +++ b/Projectiles/Summon/WaterSpearFriendly.cs @@ -1,94 +1,94 @@ -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.Summon -{ - public class WaterSpearFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.alpha = 255; - } - - public override void AI() - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - if (projectile.ai[1] == 0f) - { - 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.02f; - projectile.alpha += 30; - if (projectile.alpha >= 250) - { - projectile.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.02f; - projectile.alpha -= 30; - 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; - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - } - - 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 Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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.Summon +{ + public class WaterSpearFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + if (projectile.ai[1] == 0f) + { + 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; + } + } + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + 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; + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + } + + 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 Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/SunkenSea/AquaStream.cs b/Projectiles/SunkenSea/AquaStream.cs index 400b6e990d..133fcdd6fd 100644 --- a/Projectiles/SunkenSea/AquaStream.cs +++ b/Projectiles/SunkenSea/AquaStream.cs @@ -1,44 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.SunkenSea -{ - public class AquaStream : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aqua Stream"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.scale = 1f; - projectile.friendly = true; - projectile.alpha = 150; - projectile.penetrate = 1; - projectile.timeLeft = 14; - projectile.melee = true; - } - - public override void AI() - { - //projectile.ai[0] is the X increment while projectile.ai[1] is the Y increment - projectile.velocity.X += projectile.ai[0]; - projectile.velocity.Y += projectile.ai[1]; - if (Main.rand.NextFloat() < 1f) - { - Dust dust; - // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. - Vector2 position = projectile.Center; - dust = Terraria.Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 2.368421f); - dust.noGravity = true; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.SunkenSea +{ + public class AquaStream : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aqua Stream"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.scale = 1f; + projectile.friendly = true; + projectile.alpha = 150; + projectile.penetrate = 1; + projectile.timeLeft = 14; + projectile.melee = true; + } + + public override void AI() + { + //projectile.ai[0] is the X increment while projectile.ai[1] is the Y increment + projectile.velocity.X += projectile.ai[0]; + projectile.velocity.Y += projectile.ai[1]; + if (Main.rand.NextFloat() < 1f) + { + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = projectile.Center; + dust = Terraria.Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 2.368421f); + dust.noGravity = true; + } + } + } +} diff --git a/Projectiles/SunkenSea/AquamarineBolt.cs b/Projectiles/SunkenSea/AquamarineBolt.cs index d1b633e6bd..42e7a1845e 100644 --- a/Projectiles/SunkenSea/AquamarineBolt.cs +++ b/Projectiles/SunkenSea/AquamarineBolt.cs @@ -1,55 +1,55 @@ -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.SunkenSea -{ - public class AquamarineBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 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, 68, 0f, 0f, 100, default(Color), 1.5f); - 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, 68, 0f, 0f, 100, default(Color), 1f); - Main.dust[num157].velocity *= 0.25f; - 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; - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class AquamarineBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 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, 68, 0f, 0f, 100, default(Color), 1.5f); + 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, 68, 0f, 0f, 100, default(Color), 1f); + Main.dust[num157].velocity *= 0.25f; + 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; + } + } +} diff --git a/Projectiles/SunkenSea/Aquashard.cs b/Projectiles/SunkenSea/Aquashard.cs index 7a5ea80feb..c9daa65d5d 100644 --- a/Projectiles/SunkenSea/Aquashard.cs +++ b/Projectiles/SunkenSea/Aquashard.cs @@ -1,63 +1,63 @@ -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.SunkenSea -{ - public class Aquashard : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquashard"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 16; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.aiStyle = 1; - } - - public override void AI() - { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - int num251 = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("AquashardSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 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, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class Aquashard : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquashard"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 16; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.aiStyle = 1; + } + + public override void AI() + { + projectile.velocity.X *= 0.9995f; + projectile.velocity.Y = projectile.velocity.Y + 0.01f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int num251 = Main.rand.Next(2, 4); + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("AquashardSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 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, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/SunkenSea/AquashardSplit.cs b/Projectiles/SunkenSea/AquashardSplit.cs index d16a063cfb..f19395b266 100644 --- a/Projectiles/SunkenSea/AquashardSplit.cs +++ b/Projectiles/SunkenSea/AquashardSplit.cs @@ -1,44 +1,44 @@ -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.SunkenSea -{ - public class AquashardSplit : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquashard"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 16; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 3; - projectile.timeLeft = 180; - projectile.aiStyle = 1; - } - - public override void AI() - { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; - } - - 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, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class AquashardSplit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquashard"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 16; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 3; + projectile.timeLeft = 180; + projectile.aiStyle = 1; + } + + public override void AI() + { + projectile.velocity.X *= 0.9995f; + projectile.velocity.Y = projectile.velocity.Y + 0.01f; + } + + 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, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/SunkenSea/ClamCrusherFlail.cs b/Projectiles/SunkenSea/ClamCrusherFlail.cs index ce5f9570e1..8bc5055f70 100644 --- a/Projectiles/SunkenSea/ClamCrusherFlail.cs +++ b/Projectiles/SunkenSea/ClamCrusherFlail.cs @@ -1,209 +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.SunkenSea -{ - public class ClamCrusherFlail : ModProjectile - { - public int finalDamage; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Clam Crusher"); - } - - public override void SetDefaults() - { - projectile.width = 58; - projectile.height = 74; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.melee = true; - projectile.alpha = 255; - projectile.tileCollide = false; - projectile.GetGlobalProjectile(mod).trueMelee = true; - } - - public override void AI() - { - projectile.ai[1] += 1f; - if (projectile.ai[1] == 1f) - { - finalDamage = (int)(projectile.damage * 2.5f); - } - if (projectile.ai[1] >= 5f && (projectile.ai[1] <= 10f)) - { - for (int num105 = 0; num105 < 10; num105++) - { - float num99 = projectile.velocity.X / 3f * (float)num105; - float num100 = projectile.velocity.Y / 3f * (float)num105; - int num101 = 4; - int waterDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); - Main.dust[waterDust].noGravity = true; - Main.dust[waterDust].velocity *= 0.1f; - Main.dust[waterDust].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[waterDust]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; - Dust expr_4815_cp_0 = Main.dust[waterDust]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; - } - } - if (projectile.ai[1] == 5f) - { - projectile.tileCollide = true; - } - Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; - projectile.rotation = vector62.ToRotation() - 1.57f; - if (Main.player[projectile.owner].dead) - { - projectile.Kill(); - return; - } - Main.player[projectile.owner].itemAnimation = 10; - Main.player[projectile.owner].itemTime = 10; - float arg_1DC8F_0 = vector62.X; - if (vector62.X < 0f) - { - Main.player[projectile.owner].ChangeDir(1); - projectile.direction = 1; - } - else - { - Main.player[projectile.owner].ChangeDir(-1); - projectile.direction = -1; - } - Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); - projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); - if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) - { - projectile.velocity.Y += 1f; - projectile.velocity.X *= 0.995f; - projectile.damage = finalDamage; - } - if (projectile.ai[0] == 0f && vector62.Length() > 1000f) - { - projectile.ai[0] = 1f; - } - if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) - { - float num693 = vector62.Length(); - if (num693 > 1500f) - { - projectile.Kill(); - return; - } - if (num693 > 600f) - { - projectile.ai[0] = 2f; - } - projectile.tileCollide = false; - float num694 = 20f; - if (projectile.ai[0] == 2f) - { - num694 = 40f; - } - projectile.velocity = Vector2.Normalize(vector62) * num694; - if (vector62.Length() < num694) - { - projectile.Kill(); - return; - } - } - float[] var_2_1DE21_cp_0 = projectile.ai; - int var_2_1DE21_cp_1 = 1; - float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; - var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; - if (projectile.ai[1] > 5f) - { - projectile.alpha = 0; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.ai[1] >= 5f) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); - for (int num105 = 0; num105 < 50; num105++) - { - 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 waterDust = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width / 2, projectile.height / 2, 33, value15.X, value15.Y, 0, new Color(0, 142, 255), 1.5f); - Main.dust[waterDust].velocity *= 2f; - } - } - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; - Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/ClamCrusherChain"); - Vector2 vector17 = projectile.Center; - Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float num91 = (float)texture2D2.Height; - Vector2 vector18 = mountedCenter - vector17; - float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; - bool flag13 = true; - if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) - { - flag13 = false; - } - if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) - { - flag13 = false; - } - while (flag13) - { - if (vector18.Length() < num91 + 1f) - { - flag13 = false; - } - else - { - Vector2 value2 = vector18; - value2.Normalize(); - vector17 += value2 * num91; - vector18 = mountedCenter - vector17; - Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); - } - } - return true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (target.rarity != 2) - { - target.AddBuff(mod.BuffType("SilvaStun"), 60); - } - else if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) - { - target.AddBuff(mod.BuffType("SilvaStun"), 30); - } - } - projectile.ai[0] = 1f; - projectile.netUpdate = true; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class ClamCrusherFlail : ModProjectile + { + public int finalDamage; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clam Crusher"); + } + + public override void SetDefaults() + { + projectile.width = 58; + projectile.height = 74; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.melee = true; + projectile.alpha = 255; + projectile.tileCollide = false; + projectile.GetGlobalProjectile(mod).trueMelee = true; + } + + public override void AI() + { + projectile.ai[1] += 1f; + if (projectile.ai[1] == 1f) + { + finalDamage = (int)(projectile.damage * 2.5f); + } + if (projectile.ai[1] >= 5f && (projectile.ai[1] <= 10f)) + { + for (int num105 = 0; num105 < 10; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int waterDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); + Main.dust[waterDust].noGravity = true; + Main.dust[waterDust].velocity *= 0.1f; + Main.dust[waterDust].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[waterDust]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num99; + Dust expr_4815_cp_0 = Main.dust[waterDust]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num100; + } + } + if (projectile.ai[1] == 5f) + { + projectile.tileCollide = true; + } + Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center; + projectile.rotation = vector62.ToRotation() - 1.57f; + if (Main.player[projectile.owner].dead) + { + projectile.Kill(); + return; + } + Main.player[projectile.owner].itemAnimation = 10; + Main.player[projectile.owner].itemTime = 10; + float arg_1DC8F_0 = vector62.X; + if (vector62.X < 0f) + { + Main.player[projectile.owner].ChangeDir(1); + projectile.direction = 1; + } + else + { + Main.player[projectile.owner].ChangeDir(-1); + projectile.direction = -1; + } + Main.player[projectile.owner].itemRotation = (vector62 * -1f * (float)projectile.direction).ToRotation(); + projectile.spriteDirection = ((vector62.X > 0f) ? -1 : 1); + if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) + { + projectile.velocity.Y += 1f; + projectile.velocity.X *= 0.995f; + projectile.damage = finalDamage; + } + if (projectile.ai[0] == 0f && vector62.Length() > 1000f) + { + projectile.ai[0] = 1f; + } + if (projectile.ai[0] == 1f || projectile.ai[0] == 2f) + { + float num693 = vector62.Length(); + if (num693 > 1500f) + { + projectile.Kill(); + return; + } + if (num693 > 600f) + { + projectile.ai[0] = 2f; + } + projectile.tileCollide = false; + float num694 = 20f; + if (projectile.ai[0] == 2f) + { + num694 = 40f; + } + projectile.velocity = Vector2.Normalize(vector62) * num694; + if (vector62.Length() < num694) + { + projectile.Kill(); + return; + } + } + float[] var_2_1DE21_cp_0 = projectile.ai; + int var_2_1DE21_cp_1 = 1; + float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; + var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; + if (projectile.ai[1] > 5f) + { + projectile.alpha = 0; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.ai[1] >= 5f) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + projectile.ai[0] = 1f; + projectile.netUpdate = true; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); + for (int num105 = 0; num105 < 50; num105++) + { + 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 waterDust = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width / 2, projectile.height / 2, 33, value15.X, value15.Y, 0, new Color(0, 142, 255), 1.5f); + Main.dust[waterDust].velocity *= 2f; + } + } + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; + Texture2D texture2D2 = mod.GetTexture("ExtraTextures/Chains/ClamCrusherChain"); + Vector2 vector17 = projectile.Center; + Microsoft.Xna.Framework.Rectangle? sourceRectangle = null; + Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); + float num91 = (float)texture2D2.Height; + Vector2 vector18 = mountedCenter - vector17; + float rotation15 = (float)Math.Atan2((double)vector18.Y, (double)vector18.X) - 1.57f; + bool flag13 = true; + if (float.IsNaN(vector17.X) && float.IsNaN(vector17.Y)) + { + flag13 = false; + } + if (float.IsNaN(vector18.X) && float.IsNaN(vector18.Y)) + { + flag13 = false; + } + while (flag13) + { + if (vector18.Length() < num91 + 1f) + { + flag13 = false; + } + else + { + Vector2 value2 = vector18; + value2.Normalize(); + vector17 += value2 * num91; + vector18 = mountedCenter - vector17; + Microsoft.Xna.Framework.Color color17 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f)); + Main.spriteBatch.Draw(texture2D2, vector17 - Main.screenPosition, sourceRectangle, color17, rotation15, origin, 1f, SpriteEffects.None, 0f); + } + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (target.rarity != 2) + { + target.AddBuff(mod.BuffType("SilvaStun"), 60); + } + else if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) + { + target.AddBuff(mod.BuffType("SilvaStun"), 30); + } + } + projectile.ai[0] = 1f; + projectile.netUpdate = true; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); + } + } +} diff --git a/Projectiles/SunkenSea/ClamorRifleProj.cs b/Projectiles/SunkenSea/ClamorRifleProj.cs index e2ead23008..20921d7d1d 100644 --- a/Projectiles/SunkenSea/ClamorRifleProj.cs +++ b/Projectiles/SunkenSea/ClamorRifleProj.cs @@ -1,105 +1,105 @@ -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.SunkenSea -{ - public class ClamorRifleProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Energy Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.ranged = true; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 3f) - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 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, 68, 0f, 0f, 100, default(Color), 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += projectile.velocity * 0.5f; - } - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 300f; - bool homeIn = 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; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 18f; - 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 * 25f + num484) / 26f; - projectile.velocity.Y = (projectile.velocity.Y * 25f + num485) / 26f; - } - } - - 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) - { - int num251 = Main.rand.Next(2, 3); - if (projectile.owner == Main.myPlayer) - { - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("ClamorRifleProjSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 118); - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class ClamorRifleProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Energy Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.ranged = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 3f) + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 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, 68, 0f, 0f, 100, default(Color), 1f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 300f; + bool homeIn = 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; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 18f; + 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 * 25f + num484) / 26f; + projectile.velocity.Y = (projectile.velocity.Y * 25f + num485) / 26f; + } + } + + 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) + { + int num251 = Main.rand.Next(2, 3); + if (projectile.owner == Main.myPlayer) + { + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("ClamorRifleProjSplit"), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 118); + } + } +} diff --git a/Projectiles/SunkenSea/ClamorRifleProjSplit.cs b/Projectiles/SunkenSea/ClamorRifleProjSplit.cs index 8ad2d2e6be..94bb5ceacd 100644 --- a/Projectiles/SunkenSea/ClamorRifleProjSplit.cs +++ b/Projectiles/SunkenSea/ClamorRifleProjSplit.cs @@ -1,48 +1,48 @@ -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.SunkenSea -{ - public class ClamorRifleProjSplit : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Energy Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.ranged = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 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, 68, 0f, 0f, 100, default(Color), 1f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].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; - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class ClamorRifleProjSplit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Energy Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.ranged = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 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, 68, 0f, 0f, 100, default(Color), 1f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].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; + } + } +} diff --git a/Projectiles/SunkenSea/CoralBubble.cs b/Projectiles/SunkenSea/CoralBubble.cs index 02bc364e8b..16b5989288 100644 --- a/Projectiles/SunkenSea/CoralBubble.cs +++ b/Projectiles/SunkenSea/CoralBubble.cs @@ -1,98 +1,98 @@ -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.SunkenSea -{ - public class CoralBubble : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } - - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 360; - projectile.penetrate = 1; - } - - public override void AI() - { - if (projectile.localAI[0] > 2f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - else - { - projectile.localAI[0] += 1f; - } - if (projectile.ai[1] > 30f) - { - if (projectile.velocity.Y > -1.5f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - } - else - { - projectile.ai[1] += 1f; - } - if (projectile.wet) - { - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; - } - if (projectile.velocity.Y > -1f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - } - int closestPlayer = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 distance = Main.player[closestPlayer].Center - projectile.Center; - if (projectile.Distance(Main.player[closestPlayer].Center) < 14f) - { - Main.player[closestPlayer].AddBuff(BuffID.Gills, 90); - projectile.Kill(); - } - } - - 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(SoundID.Item54, projectile.position); - projectile.position = projectile.Center; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) - { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default(Color), 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; - } - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class CoralBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.friendly = true; + projectile.alpha = 255; + projectile.timeLeft = 360; + projectile.penetrate = 1; + } + + public override void AI() + { + if (projectile.localAI[0] > 2f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + else + { + projectile.localAI[0] += 1f; + } + if (projectile.ai[1] > 30f) + { + if (projectile.velocity.Y > -1.5f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + } + else + { + projectile.ai[1] += 1f; + } + if (projectile.wet) + { + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.98f; + } + if (projectile.velocity.Y > -1f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + } + int closestPlayer = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 distance = Main.player[closestPlayer].Center - projectile.Center; + if (projectile.Distance(Main.player[closestPlayer].Center) < 14f) + { + Main.player[closestPlayer].AddBuff(BuffID.Gills, 90); + projectile.Kill(); + } + } + + 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(SoundID.Item54, projectile.position); + projectile.position = projectile.Center; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num190 = Main.rand.Next(5, 9); + for (int num191 = 0; num191 < num190; num191++) + { + int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default(Color), 1.4f); + Main.dust[num192].velocity *= 0.8f; + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].noGravity = true; + } + } + } +} diff --git a/Projectiles/SunkenSea/CoralBubbleSmall.cs b/Projectiles/SunkenSea/CoralBubbleSmall.cs index 62ca3a4b2c..b0a7ff3d66 100644 --- a/Projectiles/SunkenSea/CoralBubbleSmall.cs +++ b/Projectiles/SunkenSea/CoralBubbleSmall.cs @@ -1,90 +1,90 @@ -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.SunkenSea -{ - public class CoralBubbleSmall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } - - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.scale = 0.5f; - projectile.friendly = true; - projectile.alpha = 255; - projectile.timeLeft = 360; - projectile.penetrate = 1; - } - - public override void AI() - { - if (projectile.localAI[0] > 2f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - else - { - projectile.localAI[0] += 1f; - } - if (projectile.ai[1] > 30f) - { - if (projectile.velocity.Y > -1.5f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.05f; - } - } - else - { - projectile.ai[1] += 1f; - } - if (projectile.wet) - { - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.98f; - } - if (projectile.velocity.Y > -1f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - } - int closestPlayer = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 distance = Main.player[closestPlayer].Center - projectile.Center; - if (projectile.Distance(Main.player[closestPlayer].Center) < 7f) - { - Main.player[closestPlayer].AddBuff(BuffID.Gills, 30); - projectile.Kill(); - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item54, projectile.position); - projectile.position = projectile.Center; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) - { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default(Color), 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; - } - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class CoralBubbleSmall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.scale = 0.5f; + projectile.friendly = true; + projectile.alpha = 255; + projectile.timeLeft = 360; + projectile.penetrate = 1; + } + + public override void AI() + { + if (projectile.localAI[0] > 2f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + else + { + projectile.localAI[0] += 1f; + } + if (projectile.ai[1] > 30f) + { + if (projectile.velocity.Y > -1.5f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.05f; + } + } + else + { + projectile.ai[1] += 1f; + } + if (projectile.wet) + { + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.98f; + } + if (projectile.velocity.Y > -1f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.2f; + } + } + int closestPlayer = (int)Player.FindClosest(projectile.Center, 1, 1); + Vector2 distance = Main.player[closestPlayer].Center - projectile.Center; + if (projectile.Distance(Main.player[closestPlayer].Center) < 7f) + { + Main.player[closestPlayer].AddBuff(BuffID.Gills, 30); + projectile.Kill(); + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item54, projectile.position); + projectile.position = projectile.Center; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num190 = Main.rand.Next(5, 9); + for (int num191 = 0; num191 < num190; num191++) + { + int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default(Color), 1.4f); + Main.dust[num192].velocity *= 0.8f; + Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); + Main.dust[num192].noGravity = true; + } + } + } +} diff --git a/Projectiles/SunkenSea/EutrophicScimitarProj.cs b/Projectiles/SunkenSea/EutrophicScimitarProj.cs index 7b10b7b5f6..0296db3d63 100644 --- a/Projectiles/SunkenSea/EutrophicScimitarProj.cs +++ b/Projectiles/SunkenSea/EutrophicScimitarProj.cs @@ -1,84 +1,84 @@ -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.SunkenSea -{ - class EutrophicScimitarProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scimitar Zap"); - Main.projFrames[projectile.type] = 3; - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.melee = true; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(127, 255, 253); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.rarity != 2 && !CalamityPlayer.areThereAnyDamnBosses) - { - target.AddBuff(mod.BuffType("SilvaStun"), 15); - } - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - 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); - } - if (Main.rand.Next(2) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 226, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.5f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - - public override void Kill(int timeLeft) - { - for (int i = 0; i <= 10; i++) - { - Dust dust; - Vector2 position = new Vector2(projectile.position.X - 4, projectile.position.Y - 4); - dust = Main.dust[Terraria.Dust.NewDust(position, 58, 58, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; - dust.noGravity = true; - dust.fadeIn = 0.9473684f; - } - } - } -} +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.SunkenSea +{ + class EutrophicScimitarProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scimitar Zap"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.melee = true; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(127, 255, 253); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.rarity != 2 && !CalamityPlayer.areThereAnyDamnBosses) + { + target.AddBuff(mod.BuffType("SilvaStun"), 15); + } + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + 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); + } + if (Main.rand.Next(2) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 226, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.5f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 10; i++) + { + Dust dust; + Vector2 position = new Vector2(projectile.position.X - 4, projectile.position.Y - 4); + dust = Main.dust[Terraria.Dust.NewDust(position, 58, 58, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.4605263f)]; + dust.noGravity = true; + dust.fadeIn = 0.9473684f; + } + } + } +} diff --git a/Projectiles/SunkenSea/EutrophicSpark.cs b/Projectiles/SunkenSea/EutrophicSpark.cs index e409ca76c8..81599ee18d 100644 --- a/Projectiles/SunkenSea/EutrophicSpark.cs +++ b/Projectiles/SunkenSea/EutrophicSpark.cs @@ -1,99 +1,99 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.SunkenSea -{ - public class EutrophicSpark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eutrophic Spark"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 30; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - 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; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 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, 206, 0f, 0f, 100, default(Color), 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; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.SunkenSea +{ + public class EutrophicSpark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eutrophic Spark"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.timeLeft = 30; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + 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; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 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, 206, 0f, 0f, 100, default(Color), 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; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} diff --git a/Projectiles/SunkenSea/PearlBurst.cs b/Projectiles/SunkenSea/PearlBurst.cs index 1bdd00a055..314f97251e 100644 --- a/Projectiles/SunkenSea/PearlBurst.cs +++ b/Projectiles/SunkenSea/PearlBurst.cs @@ -1,88 +1,88 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.SunkenSea -{ - public class PearlBurst : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pearl Burst"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 64; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - projectile.tileCollide = false; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); - } - 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; - projectile.alpha -= 6; - projectile.ai[1] += 1f; - if (projectile.ai[1] <= 20f) - { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; - } - else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) - { - projectile.velocity.X *= 1.05f; - projectile.velocity.Y *= 1.05f; - } - else if (projectile.ai[1] == 40f) - { - projectile.ai[1] = 0f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) - { - 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, 92, 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) - { - return new Color(255, 255, 255); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.SunkenSea +{ + public class PearlBurst : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pearl Burst"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 64; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.ignoreWater = true; + projectile.tileCollide = false; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + } + 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; + projectile.alpha -= 6; + projectile.ai[1] += 1f; + if (projectile.ai[1] <= 20f) + { + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + } + else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) + { + projectile.velocity.X *= 1.05f; + projectile.velocity.Y *= 1.05f; + } + else if (projectile.ai[1] == 40f) + { + projectile.ai[1] = 0f; + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 30f) + { + 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, 92, 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) + { + return new Color(255, 255, 255); + } + } +} diff --git a/Projectiles/SunkenSea/PearlRain.cs b/Projectiles/SunkenSea/PearlRain.cs index 7445bd1e2d..d8a0d6c72c 100644 --- a/Projectiles/SunkenSea/PearlRain.cs +++ b/Projectiles/SunkenSea/PearlRain.cs @@ -1,56 +1,56 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.SunkenSea -{ - public class PearlRain : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pearl Rain"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 64; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - projectile.tileCollide = false; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); - } - 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; - projectile.alpha -= 6; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.SunkenSea +{ + public class PearlRain : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pearl Rain"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 64; + projectile.hostile = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.ignoreWater = true; + projectile.tileCollide = false; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + } + 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; + projectile.alpha -= 6; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255); + } + } +} diff --git a/Projectiles/SunkenSea/PendantProjectile1.cs b/Projectiles/SunkenSea/PendantProjectile1.cs index cfb82dc735..8fa52f9e45 100644 --- a/Projectiles/SunkenSea/PendantProjectile1.cs +++ b/Projectiles/SunkenSea/PendantProjectile1.cs @@ -1,41 +1,41 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.SunkenSea -{ - public class PendantProjectile1 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prism Shard"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 600; - projectile.penetrate = 1; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - projectile.rotation += projectile.velocity.X * 1.25f; - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.SunkenSea +{ + public class PendantProjectile1 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism Shard"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 16; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 600; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + projectile.rotation += projectile.velocity.X * 1.25f; + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + } +} diff --git a/Projectiles/SunkenSea/PendantProjectile2.cs b/Projectiles/SunkenSea/PendantProjectile2.cs index f199f959a6..f888aacfc1 100644 --- a/Projectiles/SunkenSea/PendantProjectile2.cs +++ b/Projectiles/SunkenSea/PendantProjectile2.cs @@ -1,41 +1,41 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.SunkenSea -{ - public class PendantProjectile2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prism Shard"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 600; - projectile.penetrate = 1; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - projectile.rotation += projectile.velocity.X * 1.25f; - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.SunkenSea +{ + public class PendantProjectile2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism Shard"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 16; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 600; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + projectile.rotation += projectile.velocity.X * 1.25f; + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + } +} diff --git a/Projectiles/SunkenSea/PendantProjectile3.cs b/Projectiles/SunkenSea/PendantProjectile3.cs index 6a0b306f39..fe0407b3bc 100644 --- a/Projectiles/SunkenSea/PendantProjectile3.cs +++ b/Projectiles/SunkenSea/PendantProjectile3.cs @@ -1,41 +1,41 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.SunkenSea -{ - public class PendantProjectile3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prism Shard"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 26; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 600; - projectile.penetrate = 1; - projectile.magic = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); - projectile.rotation += projectile.velocity.X * 1.25f; - for (int num457 = 0; num457 < 5; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.SunkenSea +{ + public class PendantProjectile3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism Shard"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 26; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 600; + projectile.penetrate = 1; + projectile.magic = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.35f) / 255f); + projectile.rotation += projectile.velocity.X * 1.25f; + for (int num457 = 0; num457 < 5; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + } +} diff --git a/Projectiles/SunkenSea/PoseidonTyphoon.cs b/Projectiles/SunkenSea/PoseidonTyphoon.cs index 14ea92bdf4..7685265ae3 100644 --- a/Projectiles/SunkenSea/PoseidonTyphoon.cs +++ b/Projectiles/SunkenSea/PoseidonTyphoon.cs @@ -1,101 +1,101 @@ -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.SunkenSea -{ - public class PoseidonTyphoon : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Poseidon Typhoon"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 10; - projectile.timeLeft = 300; - projectile.tileCollide = true; - projectile.ignoreWater = true; - } - - public override void AI() - { - projectile.rotation += projectile.velocity.X * 0.05f; - 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 = 6f; - 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 * 30f + num484) / 31f; - projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 0); - } - - 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 +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.SunkenSea +{ + public class PoseidonTyphoon : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Poseidon Typhoon"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 10; + projectile.timeLeft = 300; + projectile.tileCollide = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + projectile.rotation += projectile.velocity.X * 0.05f; + 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 = 6f; + 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 * 30f + num484) / 31f; + projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, 0); + } + + 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; + } + } +} diff --git a/Projectiles/SunkenSea/Prismalline.cs b/Projectiles/SunkenSea/Prismalline.cs index fd1525c2fe..1e556f00db 100644 --- a/Projectiles/SunkenSea/Prismalline.cs +++ b/Projectiles/SunkenSea/Prismalline.cs @@ -1,91 +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.SunkenSea -{ - public class Prismalline : ModProjectile - { - public bool hitEnemy = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prismalline"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 113; - projectile.timeLeft = 180; - 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 (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] == 40f) - { - int numProj = 4; - int numSpecProj = 0; - 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) * 2f; - if (numSpecProj < 2 && !hitEnemy) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("Prismalline3"), (int)((double)projectile.damage * 1.25), projectile.knockBack, projectile.owner, 0f, 0f); - ++numSpecProj; - } - else - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("Prismalline2"), (int)((double)projectile.damage * 0.75), 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; - } - - 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, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - hitEnemy = true; - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class Prismalline : ModProjectile + { + public bool hitEnemy = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismalline"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.aiStyle = 113; + projectile.timeLeft = 180; + 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 (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + projectile.ai[1] += 1f; + if (projectile.ai[1] == 40f) + { + int numProj = 4; + int numSpecProj = 0; + 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) * 2f; + if (numSpecProj < 2 && !hitEnemy) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("Prismalline3"), (int)((double)projectile.damage * 1.25), projectile.knockBack, projectile.owner, 0f, 0f); + ++numSpecProj; + } + else + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("Prismalline2"), (int)((double)projectile.damage * 0.75), 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; + } + + 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, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + hitEnemy = true; + } + } +} diff --git a/Projectiles/SunkenSea/Prismalline2.cs b/Projectiles/SunkenSea/Prismalline2.cs index e35da0d5c8..e67d0ec158 100644 --- a/Projectiles/SunkenSea/Prismalline2.cs +++ b/Projectiles/SunkenSea/Prismalline2.cs @@ -1,54 +1,54 @@ -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.SunkenSea -{ - public class Prismalline2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prismalline"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 60; - 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 (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) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class Prismalline2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismalline"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 60; + 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 (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) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/SunkenSea/Prismalline3.cs b/Projectiles/SunkenSea/Prismalline3.cs index a9735c927a..48b20aa71c 100644 --- a/Projectiles/SunkenSea/Prismalline3.cs +++ b/Projectiles/SunkenSea/Prismalline3.cs @@ -1,86 +1,86 @@ -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.SunkenSea -{ - public class Prismalline3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prismalline"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - 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; - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 300f; - bool homeIn = 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; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 25f; - 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; - } - } - - 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, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class Prismalline3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismalline"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + 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; + } + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 300f; + bool homeIn = 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; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 25f; + 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; + } + } + + 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, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/SunkenSea/SeafoamBomb.cs b/Projectiles/SunkenSea/SeafoamBomb.cs index a1d2716f90..7879bdc2e6 100644 --- a/Projectiles/SunkenSea/SeafoamBomb.cs +++ b/Projectiles/SunkenSea/SeafoamBomb.cs @@ -1,76 +1,76 @@ -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.SunkenSea -{ - public class SeafoamBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seafoam Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 240; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.velocity.Y = projectile.velocity.Y + 0.15f; - 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); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SeafoamBubble"), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); - 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 = 128; - projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.Damage(); - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class SeafoamBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seafoam Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 240; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.velocity.Y = projectile.velocity.Y + 0.15f; + 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); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SeafoamBubble"), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); + 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 = 128; + projectile.height = 128; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.Damage(); + } + } +} diff --git a/Projectiles/SunkenSea/SeafoamBubble.cs b/Projectiles/SunkenSea/SeafoamBubble.cs index 2c872cbb8f..82fed33edb 100644 --- a/Projectiles/SunkenSea/SeafoamBubble.cs +++ b/Projectiles/SunkenSea/SeafoamBubble.cs @@ -1,71 +1,71 @@ -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.SunkenSea -{ - public class SeafoamBubble : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seafoam Bubble"); - } - - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 28; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 180; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.scale = 1f; - projectile.localNPCHitCooldown = 30; - projectile.GetGlobalProjectile(mod).rogue = true; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if(projectile.alpha < 50) - { - projectile.alpha = 50; - } - else if(projectile.alpha > 50) - { - projectile.alpha -= 10; - } - projectile.scale += 0.002f; - if( projectile.ai[0] % 60 == 0) - { - projectile.damage *= 2; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item54, projectile.position); - 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); - int num3; - for (int num246 = 0; num246 < 25; num246 = num3 + 1) - { - int num247 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 154, 0f, 0f, 0, default(Color), 1f); - Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; - Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - Main.dust[num247].velocity.Normalize(); - Dust dust = Main.dust[num247]; - dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; - Main.dust[num247].alpha = projectile.alpha; - num3 = num246; - } - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class SeafoamBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seafoam Bubble"); + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.timeLeft = 180; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.scale = 1f; + projectile.localNPCHitCooldown = 30; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if(projectile.alpha < 50) + { + projectile.alpha = 50; + } + else if(projectile.alpha > 50) + { + projectile.alpha -= 10; + } + projectile.scale += 0.002f; + if( projectile.ai[0] % 60 == 0) + { + projectile.damage *= 2; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item54, projectile.position); + 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); + int num3; + for (int num246 = 0; num246 < 25; num246 = num3 + 1) + { + int num247 = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 154, 0f, 0f, 0, default(Color), 1f); + Main.dust[num247].position = (Main.dust[num247].position + projectile.position) / 2f; + Main.dust[num247].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[num247].velocity.Normalize(); + Dust dust = Main.dust[num247]; + dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; + Main.dust[num247].alpha = projectile.alpha; + num3 = num246; + } + } + } +} diff --git a/Projectiles/SunkenSea/SeashineSwordProj.cs b/Projectiles/SunkenSea/SeashineSwordProj.cs index afb5cc2a31..08d28b2316 100644 --- a/Projectiles/SunkenSea/SeashineSwordProj.cs +++ b/Projectiles/SunkenSea/SeashineSwordProj.cs @@ -1,49 +1,49 @@ -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.SunkenSea -{ - class SeashineSwordProj : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = true; - projectile.melee = true; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(127, 255, 253); - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - if (Main.rand.Next(2) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 1.2f); - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X, projectile.oldVelocity.Y, 0, new Color(255, 255, 255), 1.5f); - } - } - } -} +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.SunkenSea +{ + class SeashineSwordProj : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.melee = true; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(127, 255, 253); + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + if (Main.rand.Next(2) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 1.2f); + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.oldVelocity.X, projectile.oldVelocity.Y, 0, new Color(255, 255, 255), 1.5f); + } + } + } +} diff --git a/Projectiles/SunkenSea/SerpentineBody.cs b/Projectiles/SunkenSea/SerpentineBody.cs index 91d7abfdcd..398926e3e3 100644 --- a/Projectiles/SunkenSea/SerpentineBody.cs +++ b/Projectiles/SunkenSea/SerpentineBody.cs @@ -1,99 +1,99 @@ -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.SunkenSea -{ - public class SerpentineBody : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Serpentine"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f); - int num1051 = 10; - Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = (int)projectile.ai[0]; - if (chase >= 0 && Main.projectile[chase].active) - { - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - for (int k = 0; k < 8; k++) - { - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default(Color), 1.25f); - Dust dust = Main.dust[num114]; - dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; - } - projectile.active = false; - projectile.Kill(); - return; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 40; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) - { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); - } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; - } - projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); - return; - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class SerpentineBody : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Serpentine"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 16; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.netImportant = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f); + int num1051 = 10; + Vector2 value68 = Vector2.Zero; + float num1064 = 0f; + float scaleFactor17 = 0f; + float scaleFactor18 = 1f; + if (projectile.ai[1] == 1f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + int chase = (int)projectile.ai[0]; + if (chase >= 0 && Main.projectile[chase].active) + { + value68 = Main.projectile[chase].Center; + Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; + num1064 = Main.projectile[chase].rotation; + scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + scaleFactor17 = 16f; + Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + } + else + { + for (int k = 0; k < 8; k++) + { + int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default(Color), 1.25f); + Dust dust = Main.dust[num114]; + dust.velocity *= 0.3f; + Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].noGravity = true; + } + projectile.active = false; + projectile.Kill(); + return; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 40; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - projectile.Center; + if (num1064 != projectile.rotation) + { + float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); + } + projectile.rotation = vector134.ToRotation() + 1.57079637f; + projectile.position = projectile.Center; + projectile.scale = scaleFactor18; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (vector134 != Vector2.Zero) + { + projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + } + projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); + return; + } + } +} diff --git a/Projectiles/SunkenSea/SerpentineHead.cs b/Projectiles/SunkenSea/SerpentineHead.cs index 0efb545a7d..b3cd8f584a 100644 --- a/Projectiles/SunkenSea/SerpentineHead.cs +++ b/Projectiles/SunkenSea/SerpentineHead.cs @@ -1,176 +1,176 @@ -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.SunkenSea -{ - public class SerpentineHead : ModProjectile - { - - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Serpentine"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 16; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.penetrate = 5; - projectile.timeLeft = 600; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f); - if (projectile.alpha > 0) - { - projectile.alpha -= 40; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default(Color), 1.25f); - Dust dust = Main.dust[num114]; - dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - int direction = projectile.direction; - projectile.direction = (projectile.spriteDirection = ((projectile.velocity.X > 0f) ? 1 : -1)); - if (direction != projectile.direction) - { - projectile.netUpdate = true; - } - float num1061 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); - projectile.position = projectile.Center; - projectile.scale = 1f + num1061 * 0.01f; - projectile.width = (projectile.height = (int)(10 * projectile.scale)); - projectile.Center = projectile.position; - - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 20f && projectile.ai[0] < 40f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.3f; - } - else if (projectile.ai[0] >= 40f && projectile.ai[0] < 60f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.3f; - } - else if (projectile.ai[0] >= 60f) - { - projectile.ai[0] = 0f; - } - if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) - { - if (Main.player[projectile.owner].channel) - { - float num115 = 18f; - Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; - } - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (num118 > num115) - { - num118 = num115 / num118; - num116 *= num118; - num117 *= num118; - int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); - int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); - if (num119 != num120 || num121 != num122) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - else - { - int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); - int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); - if (num123 != num124 || num125 != num126) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - } - else if (projectile.ai[0] <= 0f) - { - projectile.netUpdate = true; - float num127 = 12f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; - } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) - { - vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.Kill(); - } - projectile.ai[0] = 1f; - } - } - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int k = 0; k < 8; k++) - { - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default(Color), 1.25f); - Dust dust = Main.dust[num114]; - dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; - } - } - } -} +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.SunkenSea +{ + public class SerpentineHead : ModProjectile + { + + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Serpentine"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 16; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.netImportant = true; + projectile.penetrate = 5; + projectile.timeLeft = 600; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f, ((255 - projectile.alpha) * 0.55f) / 255f); + if (projectile.alpha > 0) + { + projectile.alpha -= 40; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default(Color), 1.25f); + Dust dust = Main.dust[num114]; + dust.velocity *= 0.3f; + Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].noGravity = true; + projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + int direction = projectile.direction; + projectile.direction = (projectile.spriteDirection = ((projectile.velocity.X > 0f) ? 1 : -1)); + if (direction != projectile.direction) + { + projectile.netUpdate = true; + } + float num1061 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); + projectile.position = projectile.Center; + projectile.scale = 1f + num1061 * 0.01f; + projectile.width = (projectile.height = (int)(10 * projectile.scale)); + projectile.Center = projectile.position; + + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 20f && projectile.ai[0] < 40f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.3f; + } + else if (projectile.ai[0] >= 40f && projectile.ai[0] < 60f) + { + projectile.velocity.Y = projectile.velocity.Y - 0.3f; + } + else if (projectile.ai[0] >= 60f) + { + projectile.ai[0] = 0f; + } + if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) + { + if (Main.player[projectile.owner].channel) + { + float num115 = 18f; + Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; + float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; + if (Main.player[projectile.owner].gravDir == -1f) + { + num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; + } + float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); + if (num118 > num115) + { + num118 = num115 / num118; + num116 *= num118; + num117 *= num118; + int num119 = (int)(num116 * 1000f); + int num120 = (int)(projectile.velocity.X * 1000f); + int num121 = (int)(num117 * 1000f); + int num122 = (int)(projectile.velocity.Y * 1000f); + if (num119 != num120 || num121 != num122) + { + projectile.netUpdate = true; + } + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + else + { + int num123 = (int)(num116 * 1000f); + int num124 = (int)(projectile.velocity.X * 1000f); + int num125 = (int)(num117 * 1000f); + int num126 = (int)(projectile.velocity.Y * 1000f); + if (num123 != num124 || num125 != num126) + { + projectile.netUpdate = true; + } + projectile.velocity.X = num116; + projectile.velocity.Y = num117; + } + } + else if (projectile.ai[0] <= 0f) + { + projectile.netUpdate = true; + float num127 = 12f; + Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; + float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; + if (Main.player[projectile.owner].gravDir == -1f) + { + num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; + } + float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + if (num130 == 0f || projectile.ai[0] < 0f) + { + vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); + num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; + num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; + num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); + } + num130 = num127 / num130; + num128 *= num130; + num129 *= num130; + projectile.velocity.X = num128; + projectile.velocity.Y = num129; + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.Kill(); + } + projectile.ai[0] = 1f; + } + } + if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int k = 0; k < 8; k++) + { + int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default(Color), 1.25f); + Dust dust = Main.dust[num114]; + dust.velocity *= 0.3f; + Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].noGravity = true; + } + } + } +} diff --git a/Projectiles/SunkenSea/SerpentineTail.cs b/Projectiles/SunkenSea/SerpentineTail.cs index 934df204fa..641776fb82 100644 --- a/Projectiles/SunkenSea/SerpentineTail.cs +++ b/Projectiles/SunkenSea/SerpentineTail.cs @@ -1,99 +1,99 @@ -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.SunkenSea -{ - public class SerpentineTail : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Serpentine"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.netImportant = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.magic = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - int num1051 = 10; - Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = (int)projectile.ai[0]; - if (chase >= 0 && Main.projectile[chase].active) - { - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - for (int k = 0; k < 8; k++) - { - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default(Color), 1.25f); - Dust dust = Main.dust[num114]; - dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; - } - projectile.active = false; - projectile.Kill(); - return; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 40; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (num1064 != projectile.rotation) - { - float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); - vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); - } - projectile.rotation = vector134.ToRotation() + 1.57079637f; - projectile.position = projectile.Center; - projectile.scale = scaleFactor18; - projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); - projectile.Center = projectile.position; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; - } - projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); - return; - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class SerpentineTail : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Serpentine"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.netImportant = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + int num1051 = 10; + Vector2 value68 = Vector2.Zero; + float num1064 = 0f; + float scaleFactor17 = 0f; + float scaleFactor18 = 1f; + if (projectile.ai[1] == 1f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + int chase = (int)projectile.ai[0]; + if (chase >= 0 && Main.projectile[chase].active) + { + value68 = Main.projectile[chase].Center; + Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; + num1064 = Main.projectile[chase].rotation; + scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); + scaleFactor17 = 16f; + Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; + } + else + { + for (int k = 0; k < 8; k++) + { + int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default(Color), 1.25f); + Dust dust = Main.dust[num114]; + dust.velocity *= 0.3f; + Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); + Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); + Main.dust[num114].noGravity = true; + } + projectile.active = false; + projectile.Kill(); + return; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 40; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + projectile.velocity = Vector2.Zero; + Vector2 vector134 = value68 - projectile.Center; + if (num1064 != projectile.rotation) + { + float num1068 = MathHelper.WrapAngle(num1064 - projectile.rotation); + vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); + } + projectile.rotation = vector134.ToRotation() + 1.57079637f; + projectile.position = projectile.Center; + projectile.scale = scaleFactor18; + projectile.width = (projectile.height = (int)((float)num1051 * projectile.scale)); + projectile.Center = projectile.position; + if (vector134 != Vector2.Zero) + { + projectile.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; + } + projectile.spriteDirection = ((vector134.X > 0f) ? 1 : -1); + return; + } + } +} diff --git a/Projectiles/SunkenSea/Shellfish.cs b/Projectiles/SunkenSea/Shellfish.cs index 7f18cf7479..f91882d05f 100644 --- a/Projectiles/SunkenSea/Shellfish.cs +++ b/Projectiles/SunkenSea/Shellfish.cs @@ -1,480 +1,480 @@ -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.SunkenSea -{ - public class Shellfish : ModProjectile - { - private int playerStill = 0; - private bool fly = false; - private bool spawnDust = true; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shellfish"); - Main.projFrames[projectile.type] = 2; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 28; - projectile.height = 24; - projectile.netImportant = true; - projectile.friendly = true; - projectile.minionSlots = 2; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { - fallThrough = false; - return true; - } - - public override void AI() - { - if (spawnDust) - { - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; - projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 20; - 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, 33, 0f, 0f, 0, default(Color), 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - spawnDust = false; - } - bool flag64 = projectile.type == mod.ProjectileType("Shellfish"); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - player.AddBuff(mod.BuffType("Shellfish"), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.shellfish = false; - } - if (modPlayer.shellfish) - { - projectile.timeLeft = 2; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - if (projectile.ai[0] == 0f) - { - projectile.damage = 70; - 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; - } - float[] var0 = projectile.ai; - int var1 = 1; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - Vector2 vector46 = projectile.position; - if (!fly) - { - projectile.tileCollide = true; - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2; - float playerDistance = vector48.Length(); - if (projectile.velocity.Y == 0f && (projectile.velocity.X != 0f || playerDistance > 200f)) - { - switch (Main.rand.Next(1, 3)) - { - - case 1: - projectile.velocity.Y -= 5f; - break; - - case 2: - projectile.velocity.Y -= 7.5f; - break; - - case 3: - projectile.velocity.Y -= 10f; - break; - } - } - projectile.velocity.Y += 0.3f; - float num633 = 1000f; - bool chaseNPC = false; - float npcPositionX = 0f; - for (int num645 = 0; num645 < 200; num645++) - { - NPC npcTarget = Main.npc[num645]; - if (npcTarget.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC)) - { - num633 = num646; - vector46 = npcTarget.Center; - npcPositionX = npcTarget.position.X; - chaseNPC = true; - } - } - } - if (chaseNPC) - { - if (npcPositionX - projectile.position.X > 0f) - { - switch (Main.rand.Next(1, 2)) - { - - case 1: - projectile.velocity.X += 0.15f; - break; - - case 2: - projectile.velocity.X += 0.20f; - break; - } - - if (projectile.velocity.X > 8f) - { - projectile.velocity.X = 8f; - } - } - else - { - switch (Main.rand.Next(1, 2)) - { - - case 1: - projectile.velocity.X -= 0.15f; - break; - - case 2: - projectile.velocity.X -= 0.20f; - break; - } - - if (projectile.velocity.X < -8f) - { - projectile.velocity.X = -8f; - } - } - } - else - { - if (playerDistance > 800f) - { - fly = true; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - projectile.tileCollide = false; - } - if (playerDistance > 200f) - { - if (player.position.X - projectile.position.X > 0f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X += 0.05f; - break; - - case 2: - projectile.velocity.X += 0.10f; - break; - - case 3: - projectile.velocity.X += 0.15f; - break; - } - - if (projectile.velocity.X > 6f) - { - projectile.velocity.X = 6f; - } - } - else - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X -= 0.05f; - break; - - case 2: - projectile.velocity.X -= 0.10f; - break; - - case 3: - projectile.velocity.X -= 0.15f; - break; - } - - if (projectile.velocity.X < -6f) - { - projectile.velocity.X = -6f; - } - } - } - if (playerDistance < 200f) - { - if (projectile.velocity.X != 0f) - { - if (projectile.velocity.X > 0.5f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X -= 0.05f; - break; - - case 2: - projectile.velocity.X -= 0.10f; - break; - - case 3: - projectile.velocity.X -= 0.15f; - break; - } - } - else if (projectile.velocity.X < -0.5f) - { - switch (Main.rand.Next(1, 3)) - { - case 1: - projectile.velocity.X += 0.05f; - break; - - case 2: - projectile.velocity.X += 0.10f; - break; - - case 3: - projectile.velocity.X += 0.15f; - break; - } - } - else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) - { - projectile.velocity.X = 0f; - } - } - } - } - } - else if (fly) - { - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); - float playerDistance = vector48.Length(); - vector48.Normalize(); - vector48 *= 14f; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - - projectile.rotation = projectile.velocity.X * 0.03f; - if (playerDistance > 1500f) - { - 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) - { - if (player.velocity.Y == 0f) - { - ++playerStill; - } - else - { - playerStill = 0; - } - if (playerStill > 30 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - fly = false; - projectile.tileCollide = true; - projectile.rotation = 0; - projectile.velocity.X *= 0.30f; - projectile.velocity.Y *= 0.30f; - } - } - } - if ((double)projectile.velocity.X > 0.25) - { - projectile.spriteDirection = -1; - } - else if ((double)projectile.velocity.X < -0.25) - { - projectile.spriteDirection = 1; - } - } - if (projectile.ai[0] == 1f) - { - projectile.rotation = 0; - projectile.tileCollide = false; - int num988 = 10; - bool flag54 = false; - bool flag55 = false; - float[] var0 = projectile.localAI; - int var1 = 0; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60000 * num988)) //tryna make it stay on there "forever" without glitching - { - flag54 = true; - } - else if (num989 < 0 || num989 >= 200) - { - flag54 = true; - } - 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; - if (flag55) - { - Main.npc[num989].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.ai[0] = 0f; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 200; i++) - { - 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)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool flag3; - if (Main.npc[i].type == 414) - { - Rectangle rect = Main.npc[i].getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (flag3) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 10; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < 1000; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.buffImmune[mod.BuffType("ShellfishEating")] = false; - if (target.type == mod.NPCType("CeaselessVoid") || target.type == mod.NPCType("EidolonWyrmHeadHuge")) - { - target.buffImmune[mod.BuffType("ShellfishEating")] = true; - } - target.AddBuff(mod.BuffType("ShellfishEating"), 600000); - } - } -} \ No newline at end of file +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.SunkenSea +{ + public class Shellfish : ModProjectile + { + private int playerStill = 0; + private bool fly = false; + private bool spawnDust = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shellfish"); + Main.projFrames[projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 24; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 2; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override void AI() + { + if (spawnDust) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num501 = 20; + 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, 33, 0f, 0f, 0, default(Color), 1f); + Main.dust[num503].velocity *= 2f; + Main.dust[num503].scale *= 1.15f; + } + spawnDust = false; + } + bool flag64 = projectile.type == mod.ProjectileType("Shellfish"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + player.AddBuff(mod.BuffType("Shellfish"), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.shellfish = false; + } + if (modPlayer.shellfish) + { + projectile.timeLeft = 2; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + { + projectile.frame = 0; + } + if (projectile.ai[0] == 0f) + { + projectile.damage = 70; + 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; + } + float[] var0 = projectile.ai; + int var1 = 1; + float num73 = var0[var1]; + var0[var1] = num73 + 1f; + Vector2 vector46 = projectile.position; + if (!fly) + { + projectile.tileCollide = true; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + if (projectile.velocity.Y == 0f && (projectile.velocity.X != 0f || playerDistance > 200f)) + { + switch (Main.rand.Next(1, 3)) + { + + case 1: + projectile.velocity.Y -= 5f; + break; + + case 2: + projectile.velocity.Y -= 7.5f; + break; + + case 3: + projectile.velocity.Y -= 10f; + break; + } + } + projectile.velocity.Y += 0.3f; + float num633 = 1000f; + bool chaseNPC = false; + float npcPositionX = 0f; + for (int num645 = 0; num645 < 200; num645++) + { + NPC npcTarget = Main.npc[num645]; + if (npcTarget.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC)) + { + num633 = num646; + vector46 = npcTarget.Center; + npcPositionX = npcTarget.position.X; + chaseNPC = true; + } + } + } + if (chaseNPC) + { + if (npcPositionX - projectile.position.X > 0f) + { + switch (Main.rand.Next(1, 2)) + { + + case 1: + projectile.velocity.X += 0.15f; + break; + + case 2: + projectile.velocity.X += 0.20f; + break; + } + + if (projectile.velocity.X > 8f) + { + projectile.velocity.X = 8f; + } + } + else + { + switch (Main.rand.Next(1, 2)) + { + + case 1: + projectile.velocity.X -= 0.15f; + break; + + case 2: + projectile.velocity.X -= 0.20f; + break; + } + + if (projectile.velocity.X < -8f) + { + projectile.velocity.X = -8f; + } + } + } + else + { + if (playerDistance > 800f) + { + fly = true; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + projectile.tileCollide = false; + } + if (playerDistance > 200f) + { + if (player.position.X - projectile.position.X > 0f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X += 0.05f; + break; + + case 2: + projectile.velocity.X += 0.10f; + break; + + case 3: + projectile.velocity.X += 0.15f; + break; + } + + if (projectile.velocity.X > 6f) + { + projectile.velocity.X = 6f; + } + } + else + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X -= 0.05f; + break; + + case 2: + projectile.velocity.X -= 0.10f; + break; + + case 3: + projectile.velocity.X -= 0.15f; + break; + } + + if (projectile.velocity.X < -6f) + { + projectile.velocity.X = -6f; + } + } + } + if (playerDistance < 200f) + { + if (projectile.velocity.X != 0f) + { + if (projectile.velocity.X > 0.5f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X -= 0.05f; + break; + + case 2: + projectile.velocity.X -= 0.10f; + break; + + case 3: + projectile.velocity.X -= 0.15f; + break; + } + } + else if (projectile.velocity.X < -0.5f) + { + switch (Main.rand.Next(1, 3)) + { + case 1: + projectile.velocity.X += 0.05f; + break; + + case 2: + projectile.velocity.X += 0.10f; + break; + + case 3: + projectile.velocity.X += 0.15f; + break; + } + } + else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + { + projectile.velocity.X = 0f; + } + } + } + } + } + else if (fly) + { + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); + float playerDistance = vector48.Length(); + vector48.Normalize(); + vector48 *= 14f; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + + projectile.rotation = projectile.velocity.X * 0.03f; + if (playerDistance > 1500f) + { + 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) + { + if (player.velocity.Y == 0f) + { + ++playerStill; + } + else + { + playerStill = 0; + } + if (playerStill > 30 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + fly = false; + projectile.tileCollide = true; + projectile.rotation = 0; + projectile.velocity.X *= 0.30f; + projectile.velocity.Y *= 0.30f; + } + } + } + if ((double)projectile.velocity.X > 0.25) + { + projectile.spriteDirection = -1; + } + else if ((double)projectile.velocity.X < -0.25) + { + projectile.spriteDirection = 1; + } + } + if (projectile.ai[0] == 1f) + { + projectile.rotation = 0; + projectile.tileCollide = false; + int num988 = 10; + bool flag54 = false; + bool flag55 = false; + float[] var0 = projectile.localAI; + int var1 = 0; + float num73 = var0[var1]; + var0[var1] = num73 + 1f; + if (projectile.localAI[0] % 30f == 0f) + { + flag55 = true; + } + int num989 = (int)projectile.ai[1]; + if (projectile.localAI[0] >= (float)(60000 * num988)) //tryna make it stay on there "forever" without glitching + { + flag54 = true; + } + else if (num989 < 0 || num989 >= 200) + { + flag54 = true; + } + 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; + if (flag55) + { + Main.npc[num989].HitEffect(0, 1.0); + } + } + else + { + flag54 = true; + } + if (flag54) + { + projectile.ai[0] = 0f; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 200; i++) + { + 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)) + { + if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + { + bool flag3; + if (Main.npc[i].type == 414) + { + Rectangle rect = Main.npc[i].getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + flag3 = projectile.Colliding(myRect, rect); + } + else + { + flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + } + if (flag3) + { + if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + { + Main.npc[i].ReflectProjectile(projectile.whoAmI); + return; + } + projectile.ai[0] = 1f; + projectile.ai[1] = (float)i; + projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; + projectile.netUpdate = true; + projectile.StatusNPC(i); + projectile.damage = 0; + int num28 = 10; + Point[] array2 = new Point[num28]; + int num29 = 0; + for (int l = 0; l < 1000; l++) + { + if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) + { + array2[num29++] = new Point(l, Main.projectile[l].timeLeft); + if (num29 >= array2.Length) + { + break; + } + } + } + if (num29 >= array2.Length) + { + int num30 = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[num30].Y) + { + num30 = m; + } + } + Main.projectile[array2[num30].X].Kill(); + } + } + } + } + } + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.buffImmune[mod.BuffType("ShellfishEating")] = false; + if (target.type == mod.NPCType("CeaselessVoid") || target.type == mod.NPCType("EidolonWyrmHeadHuge")) + { + target.buffImmune[mod.BuffType("ShellfishEating")] = true; + } + target.AddBuff(mod.BuffType("ShellfishEating"), 600000); + } + } +} diff --git a/Projectiles/SunkenSea/WhirlpoolProjectile.cs b/Projectiles/SunkenSea/WhirlpoolProjectile.cs index 6bb2ed6161..0ff9b51258 100644 --- a/Projectiles/SunkenSea/WhirlpoolProjectile.cs +++ b/Projectiles/SunkenSea/WhirlpoolProjectile.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.SunkenSea -{ - public class WhirlpoolProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Riptide"); - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.scale = 0.75f; - projectile.friendly = true; - projectile.alpha = 150; - projectile.penetrate = -1; - projectile.timeLeft = 99; - projectile.melee = true; - aiType = ProjectileID.Amarok; - projectile.CloneDefaults(ProjectileID.CorruptYoyo); - } - - public override void AI() - { - if (Main.rand.Next(1, 51) == 1) - { - switch (Main.rand.Next(1, 9)) - { - case 1: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0, -10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 1.2f/*X Increment*/, 0.2f/*Y Increment*/); - break; - case 2: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 5, -5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.7f/*X Increment*/, 0.7f/*Y Increment*/); - break; - case 3: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 10, 0, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.2f/*X Increment*/, 1.2f/*Y Increment*/); - break; - case 4: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 5, 5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.7f/*X Increment*/, 0.7f/*Y Increment*/); - break; - case 5: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0, 10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -1.2f/*X Increment*/, -0.2f/*Y Increment*/); - break; - case 6: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -5, 5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.7f/*X Increment*/, -0.7f/*Y Increment*/); - break; - case 7: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -10, -0, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.2f/*X Increment*/, -1.2f/*Y Increment*/); - break; - case 8: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -10, -10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.7f/*X Increment*/, -0.7f/*Y Increment*/); - break; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.SunkenSea +{ + public class WhirlpoolProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Riptide"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.scale = 0.75f; + projectile.friendly = true; + projectile.alpha = 150; + projectile.penetrate = -1; + projectile.timeLeft = 99; + projectile.melee = true; + aiType = ProjectileID.Amarok; + projectile.CloneDefaults(ProjectileID.CorruptYoyo); + } + + public override void AI() + { + if (Main.rand.Next(1, 51) == 1) + { + switch (Main.rand.Next(1, 9)) + { + case 1: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0, -10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 1.2f/*X Increment*/, 0.2f/*Y Increment*/); + break; + case 2: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 5, -5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.7f/*X Increment*/, 0.7f/*Y Increment*/); + break; + case 3: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 10, 0, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.2f/*X Increment*/, 1.2f/*Y Increment*/); + break; + case 4: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 5, 5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.7f/*X Increment*/, 0.7f/*Y Increment*/); + break; + case 5: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -0, 10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -1.2f/*X Increment*/, -0.2f/*Y Increment*/); + break; + case 6: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -5, 5, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.7f/*X Increment*/, -0.7f/*Y Increment*/); + break; + case 7: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -10, -0, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, -0.2f/*X Increment*/, -1.2f/*Y Increment*/); + break; + case 8: + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, -10, -10, mod.ProjectileType("AquaStream"), 4, 0.0f, projectile.owner, 0.7f/*X Increment*/, -0.7f/*Y Increment*/); + break; + } + } + } + } +} diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index 199036ac75..2a93784987 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -1,125 +1,125 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class AstralStar : ModProjectile - { - public int noTileHitCounter = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.alpha = 50; - projectile.penetrate = 1; - projectile.tileCollide = false; - } - - public override void AI() - { - if (projectile.ai[0] == 2f) - { - projectile.GetGlobalProjectile(mod).rogue = true; - } - int randomToSubtract = Main.rand.Next(1, 3); - 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.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - num58 = 0; - } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - 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, mod.DustType("AstralOrange"), 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 (Main.rand.Next(48) == 0) - { - int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[num60].velocity *= 0.66f; - Main.gore[num60].velocity += projectile.velocity * 0.3f; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.Next(10) == 0) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); - } - 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); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 100, 250, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.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 < 5; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.7f); - 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - for (int num480 = 0; num480 < 3; num480++) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class AstralStar : ModProjectile + { + public int noTileHitCounter = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.alpha = 50; + projectile.penetrate = 1; + projectile.tileCollide = false; + } + + public override void AI() + { + if (projectile.ai[0] == 2f) + { + projectile.GetGlobalProjectile(mod).rogue = true; + } + int randomToSubtract = Main.rand.Next(1, 3); + 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.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.localAI[0] += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + 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, mod.DustType("AstralOrange"), 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 (Main.rand.Next(48) == 0) + { + int num60 = Gore.NewGore(projectile.Center, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), 16, 1f); + Main.gore[num60].velocity *= 0.66f; + Main.gore[num60].velocity += projectile.velocity * 0.3f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + 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); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 100, 250, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.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 < 5; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.7f); + 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, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + for (int num480 = 0; num480 < 3; num480++) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + } + } + } +} diff --git a/Projectiles/Typeless/AtaxiaOrb.cs b/Projectiles/Typeless/AtaxiaOrb.cs index e7dcba6eae..b84843c633 100644 --- a/Projectiles/Typeless/AtaxiaOrb.cs +++ b/Projectiles/Typeless/AtaxiaOrb.cs @@ -1,73 +1,73 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class AtaxiaOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ataxia Orb"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.tileCollide = false; - projectile.timeLeft = 200; - } - - public override void AI() - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 9f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class AtaxiaOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ataxia Orb"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.tileCollide = false; + projectile.timeLeft = 200; + } + + public override void AI() + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 9f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 180); + } + } +} diff --git a/Projectiles/Typeless/BallisticPoisonCloud.cs b/Projectiles/Typeless/BallisticPoisonCloud.cs index bce776e5fe..a03ce42d8f 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class BallisticPoisonCloud : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BallisticPoisonCloud : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity *= 0.98f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + } + } +} diff --git a/Projectiles/Typeless/BallisticPoisonCloud2.cs b/Projectiles/Typeless/BallisticPoisonCloud2.cs index 86b3284436..c7422c98a3 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud2.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud2.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class BallisticPoisonCloud2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.99f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 150f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BallisticPoisonCloud2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity *= 0.99f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 150f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + } + } +} diff --git a/Projectiles/Typeless/BallisticPoisonCloud3.cs b/Projectiles/Typeless/BallisticPoisonCloud3.cs index ed549436cf..04d6baee18 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud3.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud3.cs @@ -1,76 +1,76 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class BallisticPoisonCloud3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.97f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BallisticPoisonCloud3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity *= 0.97f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 90f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 240); + } + } +} diff --git a/Projectiles/Typeless/BloodBomb.cs b/Projectiles/Typeless/BloodBomb.cs index cb1341838f..96dbc35e1a 100644 --- a/Projectiles/Typeless/BloodBomb.cs +++ b/Projectiles/Typeless/BloodBomb.cs @@ -1,52 +1,52 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class BloodBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bomb"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BloodBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BloodBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.4f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 3; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BloodBombExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Typeless/BloodBombExplosion.cs b/Projectiles/Typeless/BloodBombExplosion.cs index 6e0f79182f..c8e6120cc5 100644 --- a/Projectiles/Typeless/BloodBombExplosion.cs +++ b/Projectiles/Typeless/BloodBombExplosion.cs @@ -1,97 +1,97 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class BloodBombExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); - 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, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - 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, 5, 0f, 0f, 100, default(Color), 1.8f); - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BloodBombExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 250; + projectile.height = 250; + projectile.friendly = true; + projectile.ignoreWater = false; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 1f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 74); + 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, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + 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, 5, 0f, 0f, 100, default(Color), 1.8f); + 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; + } + } +} diff --git a/Projectiles/Typeless/ChaosBlaze.cs b/Projectiles/Typeless/ChaosBlaze.cs index 5596f51558..980c502d84 100644 --- a/Projectiles/Typeless/ChaosBlaze.cs +++ b/Projectiles/Typeless/ChaosBlaze.cs @@ -1,100 +1,100 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ChaosBlaze : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blaze"); - } - - public override void SetDefaults() - { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 80; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - } - - 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); - if (projectile.wet && !projectile.lavaWet) - { - projectile.Kill(); - } - 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, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - 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, 127, 0f, 0f, 100, default(Color), 1.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ChaosBlaze : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blaze"); + } + + public override void SetDefaults() + { + projectile.width = 250; + projectile.height = 250; + projectile.friendly = true; + projectile.ignoreWater = false; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 80; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + 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); + if (projectile.wet && !projectile.lavaWet) + { + projectile.Kill(); + } + 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, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + 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, 127, 0f, 0f, 100, default(Color), 1.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Projectiles/Typeless/ChaosFlare.cs b/Projectiles/Typeless/ChaosFlare.cs index 19340cb0af..38e2d73939 100644 --- a/Projectiles/Typeless/ChaosFlare.cs +++ b/Projectiles/Typeless/ChaosFlare.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ChaosFlare : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 6; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - 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) - { - float num483 = 15f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); - target.AddBuff(BuffID.OnFire, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ChaosFlare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 120; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 6; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + 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) + { + float num483 = 15f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BrimstoneFlames"), 180); + target.AddBuff(BuffID.OnFire, 180); + } + } +} diff --git a/Projectiles/Typeless/ChaosFlare2.cs b/Projectiles/Typeless/ChaosFlare2.cs index 096f7eb4f5..43d4e9130b 100644 --- a/Projectiles/Typeless/ChaosFlare2.cs +++ b/Projectiles/Typeless/ChaosFlare2.cs @@ -1,78 +1,78 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ChaosFlare2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.timeLeft = 300; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - for (int num457 = 0; num457 < 6; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - 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 = 11f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ChaosFlare2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 300; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + for (int num457 = 0; num457 < 6; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 500f; + 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 = 11f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 180); + } + } +} diff --git a/Projectiles/Typeless/ChaosGeyser.cs b/Projectiles/Typeless/ChaosGeyser.cs index 5d64479855..ff440dd40f 100644 --- a/Projectiles/Typeless/ChaosGeyser.cs +++ b/Projectiles/Typeless/ChaosGeyser.cs @@ -1,108 +1,108 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ChaosGeyser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Geyser"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 96; - projectile.friendly = true; - projectile.penetrate = 3; - projectile.timeLeft = 120; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } - - 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; - } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - } - projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 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 - 16f; - if (Main.rand.Next(2) == 0) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 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.8f; - } - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ChaosGeyser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Geyser"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 96; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.timeLeft = 120; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + 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; + } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 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 - 16f; + if (Main.rand.Next(2) == 0) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default(Color), 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.8f; + } + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 180); + } + } +} diff --git a/Projectiles/Typeless/DarkEnergySpawn.cs b/Projectiles/Typeless/DarkEnergySpawn.cs index f132466c4b..646fd4382c 100644 --- a/Projectiles/Typeless/DarkEnergySpawn.cs +++ b/Projectiles/Typeless/DarkEnergySpawn.cs @@ -1,43 +1,43 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class DarkEnergySpawn : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spawn"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.aiStyle = 1; - projectile.scale = 1f; - projectile.penetrate = 1; - projectile.timeLeft = 20; - projectile.tileCollide = false; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - projectile.ai[1]++; - - if (projectile.ai[1] >= 0) - { - NPC.NewNPC((int)projectile.Center.X - 200, (int)projectile.Center.Y - 200, mod.NPCType("DarkEnergy")); - NPC.NewNPC((int)projectile.Center.X + 200, (int)projectile.Center.Y - 200, mod.NPCType("DarkEnergy2")); - NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 200, mod.NPCType("DarkEnergy3")); - projectile.ai[1] = -30; - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class DarkEnergySpawn : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spawn"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.aiStyle = 1; + projectile.scale = 1f; + projectile.penetrate = 1; + projectile.timeLeft = 20; + projectile.tileCollide = false; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.ai[1]++; + + if (projectile.ai[1] >= 0) + { + NPC.NewNPC((int)projectile.Center.X - 200, (int)projectile.Center.Y - 200, mod.NPCType("DarkEnergy")); + NPC.NewNPC((int)projectile.Center.X + 200, (int)projectile.Center.Y - 200, mod.NPCType("DarkEnergy2")); + NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 200, mod.NPCType("DarkEnergy3")); + projectile.ai[1] = -30; + } + } + } +} diff --git a/Projectiles/Typeless/DragonDust.cs b/Projectiles/Typeless/DragonDust.cs index 31ab859dc2..aa317ceddd 100644 --- a/Projectiles/Typeless/DragonDust.cs +++ b/Projectiles/Typeless/DragonDust.cs @@ -1,94 +1,94 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class DragonDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 46; - projectile.height = 46; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 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] > 60f) - { - num461 -= (projectile.ai[0] - 60f) / 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(-8, 9); - float num464 = (float)Main.rand.Next(-8, 9); - float num465 = (float)Main.rand.Next(2, 7); - 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, 244, 0f, 0f, 100, default(Color), 1.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 0; - target.AddBuff(mod.BuffType("HolyLight"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class DragonDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 46; + projectile.height = 46; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 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] > 60f) + { + num461 -= (projectile.ai[0] - 60f) / 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(-8, 9); + float num464 = (float)Main.rand.Next(-8, 9); + float num465 = (float)Main.rand.Next(2, 7); + 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, 244, 0f, 0f, 100, default(Color), 1.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 0; + target.AddBuff(mod.BuffType("HolyLight"), 120); + } + } +} diff --git a/Projectiles/Typeless/FabsolDust.cs b/Projectiles/Typeless/FabsolDust.cs index f4e22d2cdd..66ccaef67c 100644 --- a/Projectiles/Typeless/FabsolDust.cs +++ b/Projectiles/Typeless/FabsolDust.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class FabsolDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 40; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class FabsolDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 40; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + } +} diff --git a/Projectiles/Typeless/FlareExplosion.cs b/Projectiles/Typeless/FlareExplosion.cs index 34e74bc141..b48ed8ac32 100644 --- a/Projectiles/Typeless/FlareExplosion.cs +++ b/Projectiles/Typeless/FlareExplosion.cs @@ -1,48 +1,48 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class FlareExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 100; - projectile.height = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 10; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class FlareExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 100; + projectile.height = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 10; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 3f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 5; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 60); + } + } +} diff --git a/Projectiles/Typeless/GhostlyBolt.cs b/Projectiles/Typeless/GhostlyBolt.cs index 1017294d77..537665aa71 100644 --- a/Projectiles/Typeless/GhostlyBolt.cs +++ b/Projectiles/Typeless/GhostlyBolt.cs @@ -1,59 +1,59 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GhostlyBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.timeLeft = 900; - projectile.ignoreWater = true; - projectile.tileCollide = false; - } - - public override void AI() - { - if (projectile.localAI[0] == 6f) - { - Main.PlaySound(SoundID.Item8, projectile.position); - for (int num151 = 0; num151 < 40; num151++) - { - int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 181, 0f, 0f, 100, default(Color), 1f); - Main.dust[num152].velocity *= 3f; - Main.dust[num152].velocity += projectile.velocity * 0.75f; - Main.dust[num152].scale *= 1.2f; - Main.dust[num152].noGravity = true; - } - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 6f) - { - for (int num153 = 0; num153 < 3; num153++) - { - int num154 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 181, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); - Main.dust[num154].velocity *= 0.6f; - Main.dust[num154].scale *= 1.4f; - Main.dust[num154].noGravity = true; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GhostlyBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + projectile.timeLeft = 900; + projectile.ignoreWater = true; + projectile.tileCollide = false; + } + + public override void AI() + { + if (projectile.localAI[0] == 6f) + { + Main.PlaySound(SoundID.Item8, projectile.position); + for (int num151 = 0; num151 < 40; num151++) + { + int num152 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 181, 0f, 0f, 100, default(Color), 1f); + Main.dust[num152].velocity *= 3f; + Main.dust[num152].velocity += projectile.velocity * 0.75f; + Main.dust[num152].scale *= 1.2f; + Main.dust[num152].noGravity = true; + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 6f) + { + for (int num153 = 0; num153 < 3; num153++) + { + int num154 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 181, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f); + Main.dust[num154].velocity *= 0.6f; + Main.dust[num154].scale *= 1.4f; + Main.dust[num154].noGravity = true; + } + } + } + } +} diff --git a/Projectiles/Typeless/GodKiller.cs b/Projectiles/Typeless/GodKiller.cs index b4411a0939..0087a963e3 100644 --- a/Projectiles/Typeless/GodKiller.cs +++ b/Projectiles/Typeless/GodKiller.cs @@ -1,138 +1,138 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GodKiller : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Killer"); - } - - public override void SetDefaults() - { - projectile.width = 22; - projectile.height = 22; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 180; - } - - public override void AI() - { - projectile.alpha -= 5; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[1] = 0f; - projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.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); - projectile.knockBack = 5f; - } - else - { - if (Math.Abs(projectile.velocity.X) >= 2f || Math.Abs(projectile.velocity.Y) >= 2f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 173, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 199, 0f, 0f, 100, default(Color), 0.1f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 35f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 89); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - 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, 199, 0f, 0f, 100, default(Color), 1.5f); - 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); - 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, 173, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GodKiller : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Killer"); + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 180; + } + + public override void AI() + { + projectile.alpha -= 5; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) + { + projectile.tileCollide = false; + projectile.ai[1] = 0f; + projectile.alpha = 255; + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.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); + projectile.knockBack = 5f; + } + else + { + if (Math.Abs(projectile.velocity.X) >= 2f || Math.Abs(projectile.velocity.Y) >= 2f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 173, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 199, 0f, 0f, 100, default(Color), 0.1f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 35f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 89); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 20; + projectile.height = 20; + 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, 199, 0f, 0f, 100, default(Color), 1.5f); + 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 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); + 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, 173, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); + } + } +} diff --git a/Projectiles/Typeless/GodSlayerBlaze.cs b/Projectiles/Typeless/GodSlayerBlaze.cs index 1d3f8bc0e7..3d320ece79 100644 --- a/Projectiles/Typeless/GodSlayerBlaze.cs +++ b/Projectiles/Typeless/GodSlayerBlaze.cs @@ -1,96 +1,96 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GodSlayerBlaze : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blaze"); - } - - public override void SetDefaults() - { - projectile.width = 250; - projectile.height = 250; - projectile.friendly = true; - projectile.ignoreWater = false; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 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(-30, 31); - float num464 = (float)Main.rand.Next(-30, 31); - float num465 = (float)Main.rand.Next(9, 27); - 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, 173, 0f, 0f, 100, default(Color), 1.5f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GodSlayerBlaze : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blaze"); + } + + public override void SetDefaults() + { + projectile.width = 250; + projectile.height = 250; + projectile.friendly = true; + projectile.ignoreWater = false; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 60; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.75f) / 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(-30, 31); + float num464 = (float)Main.rand.Next(-30, 31); + float num465 = (float)Main.rand.Next(9, 27); + 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, 173, 0f, 0f, 100, default(Color), 1.5f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } + } +} diff --git a/Projectiles/Typeless/GodSlayerOrb.cs b/Projectiles/Typeless/GodSlayerOrb.cs index 89b34552b1..965caaf21c 100644 --- a/Projectiles/Typeless/GodSlayerOrb.cs +++ b/Projectiles/Typeless/GodSlayerOrb.cs @@ -1,73 +1,73 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GodSlayerOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Orb"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 200; - projectile.extraUpdates = 1; - } - - public override void AI() - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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 = 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GodSlayerOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Orb"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 200; + projectile.extraUpdates = 1; + } + + public override void AI() + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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 = 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 180); + } + } +} diff --git a/Projectiles/Typeless/GodSlayerPhantom.cs b/Projectiles/Typeless/GodSlayerPhantom.cs index 8f2fe32247..30dead5aa6 100644 --- a/Projectiles/Typeless/GodSlayerPhantom.cs +++ b/Projectiles/Typeless/GodSlayerPhantom.cs @@ -1,154 +1,154 @@ -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 GodSlayerPhantom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Phantom"); - Main.projFrames[projectile.type] = 3; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.alpha = 100; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.penetrate = -1; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 0.5f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; - float num953 = 40f * projectile.ai[1]; //100 - float scaleFactor12 = 8f * projectile.ai[1]; //5 - float num954 = 600f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - return; - } - 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 = 15f; - 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 - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } - } - - 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) - { - 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } - - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = (projectile.height = 40); - 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 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 +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 GodSlayerPhantom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Phantom"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.alpha = 100; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.penetrate = -1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 2) + { + projectile.frame = 0; + } + int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default(Color), 0.5f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + Main.dust[num822].scale = 1.3f; + Main.dust[num822].noGravity = true; + float num953 = 40f * projectile.ai[1]; //100 + float scaleFactor12 = 8f * projectile.ai[1]; //5 + float num954 = 600f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0.9f); + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + { + Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + if (vector102.HasNaNs()) + { + vector102 = Vector2.UnitY; + } + projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + return; + } + 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 = 15f; + 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 + { + if (projectile.timeLeft > 30) + { + projectile.timeLeft = 30; + } + } + } + + 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) + { + 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 OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 40); + 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, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default(Color), 0.5f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + } +} diff --git a/Projectiles/Typeless/GodSlayerShrapnel.cs b/Projectiles/Typeless/GodSlayerShrapnel.cs index 4ddd7eeb20..52678420e6 100644 --- a/Projectiles/Typeless/GodSlayerShrapnel.cs +++ b/Projectiles/Typeless/GodSlayerShrapnel.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GodSlayerShrapnel : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 90; - } - - 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.type >= 326 && projectile.type <= 328) - { - 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, 173, 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, 173, 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GodSlayerShrapnel : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 90; + } + + 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.type >= 326 && projectile.type <= 328) + { + 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, 173, 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, 173, 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; + } + } +} diff --git a/Projectiles/Typeless/GodSlayerShrapnelRound.cs b/Projectiles/Typeless/GodSlayerShrapnelRound.cs index f4e6e6a04c..a9563a369d 100644 --- a/Projectiles/Typeless/GodSlayerShrapnelRound.cs +++ b/Projectiles/Typeless/GodSlayerShrapnelRound.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GodSlayerShrapnelRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); - projectile.localAI[0] += 1f; - } - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - int num251 = Main.rand.Next(4, 7); - 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("GodSlayerShrapnel"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GodSlayerShrapnelRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 3; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1.2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + int num251 = Main.rand.Next(4, 7); + 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(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, mod.ProjectileType("GodSlayerShrapnel"), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Typeless/GoldenGun.cs b/Projectiles/Typeless/GoldenGun.cs index 253bcab81b..9e7348ee61 100644 --- a/Projectiles/Typeless/GoldenGun.cs +++ b/Projectiles/Typeless/GoldenGun.cs @@ -1,141 +1,141 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GoldenGun : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Golden Round"); - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 300; - projectile.extraUpdates = 2; - } - - public override void AI() - { - if (projectile.localAI[0] < 5f) - { - projectile.localAI[0] += 1f; - return; - } - int num3; - for (int num586 = 0; num586 < 1; num586 = num3 + 1) - { - for (int num587 = 0; num587 < 6; num587 = num3 + 1) - { - float num588 = projectile.velocity.X / 6f * (float)num587; - float num589 = projectile.velocity.Y / 6f * (float)num587; - int num590 = 6; - int num591 = Dust.NewDust(new Vector2(projectile.position.X + (float)num590, projectile.position.Y + (float)num590), projectile.width - num590 * 2, projectile.height - num590 * 2, 170, 0f, 0f, 75, default(Color), 1.2f); - Dust dust; - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - Main.dust[num591].noGravity = true; - dust = Main.dust[num591]; - dust.velocity *= 0.3f; - dust = Main.dust[num591]; - dust.velocity += projectile.velocity * 0.5f; - Main.dust[num591].position = projectile.Center; - Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591]; - var_2_18F52_cp_0_cp_0.position.X = var_2_18F52_cp_0_cp_0.position.X - num588; - Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591]; - var_2_18F74_cp_0_cp_0.position.Y = var_2_18F74_cp_0_cp_0.position.Y - num589; - dust = Main.dust[num591]; - dust.velocity *= 0.2f; - num3 = num587; - } - if (Main.rand.Next(4) == 0) - { - int num592 = 6; - int num593 = Dust.NewDust(new Vector2(projectile.position.X + (float)num592, projectile.position.Y + (float)num592), projectile.width - num592 * 2, projectile.height - num592 * 2, 170, 0f, 0f, 75, default(Color), 0.65f); - Dust dust = Main.dust[num593]; - dust.velocity *= 0.5f; - dust = Main.dust[num593]; - dust.velocity += projectile.velocity * 0.5f; - } - num3 = num586; - } - } - - public override void Kill(int timeLeft) - { - projectile.velocity = projectile.oldVelocity * 0.2f; - int num3; - for (int num362 = 0; num362 < 100; num362 = num3 + 1) - { - int num363 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 75, default(Color), 1.2f); - Dust dust; - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.Next(2) == 0) - { - Main.dust[num363].scale = 0.6f; - } - else - { - Main.dust[num363].noGravity = true; - } - dust = Main.dust[num363]; - dust.velocity *= 0.3f; - dust = Main.dust[num363]; - dust.velocity += projectile.velocity; - dust = Main.dust[num363]; - dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; - Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363]; - expr_C6F7_cp_0_cp_0.velocity.X = expr_C6F7_cp_0_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.015f; - Dust expr_C726_cp_0_cp_0 = Main.dust[num363]; - expr_C726_cp_0_cp_0.velocity.Y = expr_C726_cp_0_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.015f; - Main.dust[num363].position = projectile.Center; - num3 = num362; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 600); - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GoldenGun : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Golden Round"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.extraUpdates = 2; + } + + public override void AI() + { + if (projectile.localAI[0] < 5f) + { + projectile.localAI[0] += 1f; + return; + } + int num3; + for (int num586 = 0; num586 < 1; num586 = num3 + 1) + { + for (int num587 = 0; num587 < 6; num587 = num3 + 1) + { + float num588 = projectile.velocity.X / 6f * (float)num587; + float num589 = projectile.velocity.Y / 6f * (float)num587; + int num590 = 6; + int num591 = Dust.NewDust(new Vector2(projectile.position.X + (float)num590, projectile.position.Y + (float)num590), projectile.width - num590 * 2, projectile.height - num590 * 2, 170, 0f, 0f, 75, default(Color), 1.2f); + Dust dust; + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num591]; + dust.alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num591]; + dust.alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num591]; + dust.alpha += 25; + } + Main.dust[num591].noGravity = true; + dust = Main.dust[num591]; + dust.velocity *= 0.3f; + dust = Main.dust[num591]; + dust.velocity += projectile.velocity * 0.5f; + Main.dust[num591].position = projectile.Center; + Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591]; + var_2_18F52_cp_0_cp_0.position.X = var_2_18F52_cp_0_cp_0.position.X - num588; + Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591]; + var_2_18F74_cp_0_cp_0.position.Y = var_2_18F74_cp_0_cp_0.position.Y - num589; + dust = Main.dust[num591]; + dust.velocity *= 0.2f; + num3 = num587; + } + if (Main.rand.Next(4) == 0) + { + int num592 = 6; + int num593 = Dust.NewDust(new Vector2(projectile.position.X + (float)num592, projectile.position.Y + (float)num592), projectile.width - num592 * 2, projectile.height - num592 * 2, 170, 0f, 0f, 75, default(Color), 0.65f); + Dust dust = Main.dust[num593]; + dust.velocity *= 0.5f; + dust = Main.dust[num593]; + dust.velocity += projectile.velocity * 0.5f; + } + num3 = num586; + } + } + + public override void Kill(int timeLeft) + { + projectile.velocity = projectile.oldVelocity * 0.2f; + int num3; + for (int num362 = 0; num362 < 100; num362 = num3 + 1) + { + int num363 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 170, 0f, 0f, 75, default(Color), 1.2f); + Dust dust; + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num363]; + dust.alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num363]; + dust.alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + dust = Main.dust[num363]; + dust.alpha += 25; + } + if (Main.rand.Next(2) == 0) + { + Main.dust[num363].scale = 0.6f; + } + else + { + Main.dust[num363].noGravity = true; + } + dust = Main.dust[num363]; + dust.velocity *= 0.3f; + dust = Main.dust[num363]; + dust.velocity += projectile.velocity; + dust = Main.dust[num363]; + dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; + Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363]; + expr_C6F7_cp_0_cp_0.velocity.X = expr_C6F7_cp_0_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.015f; + Dust expr_C726_cp_0_cp_0 = Main.dust[num363]; + expr_C726_cp_0_cp_0.velocity.Y = expr_C726_cp_0_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.015f; + Main.dust[num363].position = projectile.Center; + num3 = num362; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 600); + } + } +} diff --git a/Projectiles/Typeless/GrenadeRound.cs b/Projectiles/Typeless/GrenadeRound.cs index 3aad64e08e..6dace19431 100644 --- a/Projectiles/Typeless/GrenadeRound.cs +++ b/Projectiles/Typeless/GrenadeRound.cs @@ -1,111 +1,111 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GrenadeRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grenade Round"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 90; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BazookaRocket"), (int)projectile.position.X, (int)projectile.position.Y); - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 30f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.1f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (target.HitSound != SoundID.NPCHit1 && target.HitSound != SoundID.NPCHit6 && target.HitSound != SoundID.NPCHit7 && - target.HitSound != SoundID.NPCHit8 && target.HitSound != SoundID.NPCHit9 && target.HitSound != SoundID.NPCHit12 && - target.HitSound != SoundID.NPCHit13 && target.HitSound != SoundID.NPCHit14 && target.HitSound != SoundID.NPCHit18 && - target.HitSound != SoundID.NPCHit19 && target.HitSound != SoundID.NPCHit20 && target.HitSound != SoundID.NPCHit21 && - target.HitSound != SoundID.NPCHit22 && target.HitSound != SoundID.NPCHit23 && target.HitSound != SoundID.NPCHit24 && - target.HitSound != SoundID.NPCHit25 && target.HitSound != SoundID.NPCHit26 && target.HitSound != SoundID.NPCHit27 && - target.HitSound != SoundID.NPCHit28 && target.HitSound != SoundID.NPCHit29 && target.HitSound != SoundID.NPCHit31 && - target.HitSound != SoundID.NPCHit32 && target.HitSound != SoundID.NPCHit33 && target.HitSound != SoundID.NPCHit35 && - target.HitSound != SoundID.NPCHit37 && target.HitSound != SoundID.NPCHit38 && target.HitSound != SoundID.NPCHit40 && - target.HitSound != SoundID.NPCHit43 && target.HitSound != SoundID.NPCHit44 && target.HitSound != SoundID.NPCHit45 && - target.HitSound != SoundID.NPCHit46 && target.HitSound != SoundID.NPCHit47 && target.HitSound != SoundID.NPCHit48 && - target.HitSound != SoundID.NPCHit50 && target.HitSound != SoundID.NPCHit51 && target.HitSound != SoundID.NPCHit55 && - target.HitSound != SoundID.NPCHit56 && target.HitSound != SoundID.NPCHit57) - { - damage += target.lifeMax / 20; //500 + 200 = 700 + (100000 / 20 = 5000) = 5700 * 2 (explosion) = 11400 = 11.4% of boss HP - } - if (damage > target.lifeMax / 12 && CalamityPlayer.areThereAnyDamnBosses) - damage = target.lifeMax / 12; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 96); - 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 < 6; 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 < 60; 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GrenadeRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grenade Round"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 90; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BazookaRocket"), (int)projectile.position.X, (int)projectile.position.Y); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 30f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.1f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 1f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (target.HitSound != SoundID.NPCHit1 && target.HitSound != SoundID.NPCHit6 && target.HitSound != SoundID.NPCHit7 && + target.HitSound != SoundID.NPCHit8 && target.HitSound != SoundID.NPCHit9 && target.HitSound != SoundID.NPCHit12 && + target.HitSound != SoundID.NPCHit13 && target.HitSound != SoundID.NPCHit14 && target.HitSound != SoundID.NPCHit18 && + target.HitSound != SoundID.NPCHit19 && target.HitSound != SoundID.NPCHit20 && target.HitSound != SoundID.NPCHit21 && + target.HitSound != SoundID.NPCHit22 && target.HitSound != SoundID.NPCHit23 && target.HitSound != SoundID.NPCHit24 && + target.HitSound != SoundID.NPCHit25 && target.HitSound != SoundID.NPCHit26 && target.HitSound != SoundID.NPCHit27 && + target.HitSound != SoundID.NPCHit28 && target.HitSound != SoundID.NPCHit29 && target.HitSound != SoundID.NPCHit31 && + target.HitSound != SoundID.NPCHit32 && target.HitSound != SoundID.NPCHit33 && target.HitSound != SoundID.NPCHit35 && + target.HitSound != SoundID.NPCHit37 && target.HitSound != SoundID.NPCHit38 && target.HitSound != SoundID.NPCHit40 && + target.HitSound != SoundID.NPCHit43 && target.HitSound != SoundID.NPCHit44 && target.HitSound != SoundID.NPCHit45 && + target.HitSound != SoundID.NPCHit46 && target.HitSound != SoundID.NPCHit47 && target.HitSound != SoundID.NPCHit48 && + target.HitSound != SoundID.NPCHit50 && target.HitSound != SoundID.NPCHit51 && target.HitSound != SoundID.NPCHit55 && + target.HitSound != SoundID.NPCHit56 && target.HitSound != SoundID.NPCHit57) + { + damage += target.lifeMax / 20; //500 + 200 = 700 + (100000 / 20 = 5000) = 5700 * 2 (explosion) = 11400 = 11.4% of boss HP + } + if (damage > target.lifeMax / 12 && CalamityPlayer.areThereAnyDamnBosses) + damage = target.lifeMax / 12; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 96); + 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 < 6; 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 < 60; 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(); + } + } +} diff --git a/Projectiles/Typeless/HolyEruption.cs b/Projectiles/Typeless/HolyEruption.cs index 11424258a5..0fd94aded2 100644 --- a/Projectiles/Typeless/HolyEruption.cs +++ b/Projectiles/Typeless/HolyEruption.cs @@ -1,103 +1,103 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class HolyEruption : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eruption"); - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 96; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 360; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - 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, 244, 0f, 0f, 100, default(Color), 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 - 16f; - if (Main.rand.Next(2) == 0) - { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 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.8f; - } - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HolyEruption : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eruption"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 96; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 360; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + } + + 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, 244, 0f, 0f, 100, default(Color), 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 - 16f; + if (Main.rand.Next(2) == 0) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, default(Color), 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.8f; + } + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } +} diff --git a/Projectiles/Typeless/HolyExplosion.cs b/Projectiles/Typeless/HolyExplosion.cs index 3f1ee675fa..9d61bd4b72 100644 --- a/Projectiles/Typeless/HolyExplosion.cs +++ b/Projectiles/Typeless/HolyExplosion.cs @@ -1,57 +1,57 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class HolyExplosion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 3; - } - - public override void Kill(int timeLeft) - { - 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 = 20; - projectile.height = 20; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HolyExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 3; + } + + public override void Kill(int timeLeft) + { + 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 = 20; + projectile.height = 20; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Typeless/HolyExplosionSupreme.cs b/Projectiles/Typeless/HolyExplosionSupreme.cs index b3c09e4c21..d3fa62c76d 100644 --- a/Projectiles/Typeless/HolyExplosionSupreme.cs +++ b/Projectiles/Typeless/HolyExplosionSupreme.cs @@ -1,59 +1,59 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class HolyExplosionSupreme : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - } - - public override void Kill(int timeLeft) - { - 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 = 60; - 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 num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HolyExplosionSupreme : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 3; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void Kill(int timeLeft) + { + 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 = 60; + 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 num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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, 246, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Typeless/HolyFlameBomb.cs b/Projectiles/Typeless/HolyFlameBomb.cs index 2b9fb1860b..915a8ae1e6 100644 --- a/Projectiles/Typeless/HolyFlameBomb.cs +++ b/Projectiles/Typeless/HolyFlameBomb.cs @@ -1,83 +1,83 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class HolyFlameBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.ignoreWater = true; - } - - public override void AI() - { - projectile.velocity.Y *= 1.005f; - projectile.alpha -= 2; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.5f, 0.35f, 0f); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 50; - projectile.height = 50; - 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 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("HolyLight"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HolyFlameBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.ignoreWater = true; + } + + public override void AI() + { + projectile.velocity.Y *= 1.005f; + projectile.alpha -= 2; + if (projectile.alpha <= 0) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.5f, 0.35f, 0f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 50; + projectile.height = 50; + 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 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 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 < 35; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 300); + } + } +} diff --git a/Projectiles/Typeless/LunicBeam.cs b/Projectiles/Typeless/LunicBeam.cs index 4d29c80a35..4fc371ccfd 100644 --- a/Projectiles/Typeless/LunicBeam.cs +++ b/Projectiles/Typeless/LunicBeam.cs @@ -1,282 +1,282 @@ -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 LunicBeam : 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 = 300f; - 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[] - { - 246, - 244, - 229, - 262, - 247 - }); - int num34 = 259; - 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, 31, 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, 31, 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, 259, 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, 259, 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) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 300); - } - - public override void Kill(int timeLeft) - { - int num47 = Utils.SelectRandom(Main.rand, new int[] - { - 246, - 244, - 229, - 262, - 247 - }); - int num48 = 259; - int num49 = 259; - 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[] - { - 246, - 244, - 229, - 262, - 247 - }); - 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 +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 LunicBeam : 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 = 300f; + 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[] + { + 246, + 244, + 229, + 262, + 247 + }); + int num34 = 259; + 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, 31, 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, 31, 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, 259, 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, 259, 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) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 300); + } + + public override void Kill(int timeLeft) + { + int num47 = Utils.SelectRandom(Main.rand, new int[] + { + 246, + 244, + 229, + 262, + 247 + }); + int num48 = 259; + int num49 = 259; + 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[] + { + 246, + 244, + 229, + 262, + 247 + }); + 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; + } + } + } +} diff --git a/Projectiles/Typeless/MageHammerBoom.cs b/Projectiles/Typeless/MageHammerBoom.cs index 6c153fdcb4..b4a6a1150d 100644 --- a/Projectiles/Typeless/MageHammerBoom.cs +++ b/Projectiles/Typeless/MageHammerBoom.cs @@ -1,30 +1,30 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class MageHammerBoom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - projectile.width = 500; - projectile.height = 500; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class MageHammerBoom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 500; + projectile.height = 500; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + } + } +} diff --git a/Projectiles/Typeless/MagnumRound.cs b/Projectiles/Typeless/MagnumRound.cs index 2f356571eb..ee3a055c0c 100644 --- a/Projectiles/Typeless/MagnumRound.cs +++ b/Projectiles/Typeless/MagnumRound.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class MagnumRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magnum Round"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (target.HitSound != SoundID.NPCHit4 && target.HitSound != SoundID.NPCHit41 && target.HitSound != SoundID.NPCHit2 && - target.HitSound != SoundID.NPCHit5 && target.HitSound != SoundID.NPCHit11 && target.HitSound != SoundID.NPCHit30 && - target.HitSound != SoundID.NPCHit34 && target.HitSound != SoundID.NPCHit36 && target.HitSound != SoundID.NPCHit42 && - target.HitSound != SoundID.NPCHit49 && target.HitSound != SoundID.NPCHit52 && target.HitSound != SoundID.NPCHit53 && - target.HitSound != SoundID.NPCHit54 && target.HitSound != null) - { - damage += target.lifeMax / 25; //400 + 80 = 480 + (100000 / 25 = 4000) = 4480, if crit = 5600 = 5.6% of boss HP - } - if (damage > target.lifeMax / 15 && CalamityPlayer.areThereAnyDamnBosses) - damage = target.lifeMax / 15; - if (crit) - { - damage = (int)((double)damage * 1.25); - knockback *= 1.25f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class MagnumRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magnum Round"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 10; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (target.HitSound != SoundID.NPCHit4 && target.HitSound != SoundID.NPCHit41 && target.HitSound != SoundID.NPCHit2 && + target.HitSound != SoundID.NPCHit5 && target.HitSound != SoundID.NPCHit11 && target.HitSound != SoundID.NPCHit30 && + target.HitSound != SoundID.NPCHit34 && target.HitSound != SoundID.NPCHit36 && target.HitSound != SoundID.NPCHit42 && + target.HitSound != SoundID.NPCHit49 && target.HitSound != SoundID.NPCHit52 && target.HitSound != SoundID.NPCHit53 && + target.HitSound != SoundID.NPCHit54 && target.HitSound != null) + { + damage += target.lifeMax / 25; //400 + 80 = 480 + (100000 / 25 = 4000) = 4480, if crit = 5600 = 5.6% of boss HP + } + if (damage > target.lifeMax / 15 && CalamityPlayer.areThereAnyDamnBosses) + damage = target.lifeMax / 15; + if (crit) + { + damage = (int)((double)damage * 1.25); + knockback *= 1.25f; + } + } + } +} diff --git a/Projectiles/Typeless/MarkRound.cs b/Projectiles/Typeless/MarkRound.cs index 3ea7cd07cd..0defc334c0 100644 --- a/Projectiles/Typeless/MarkRound.cs +++ b/Projectiles/Typeless/MarkRound.cs @@ -1,114 +1,114 @@ -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 MarkRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - projectile.timeLeft = 300; - } - - public override void AI() - { - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0f, 0.7f); - float num55 = 30f; - float num56 = 2f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 0, 250, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 30f; - float scaleFactor = 2f; - if (projectile.ai[1] == 1f) - { - num162 = (float)((int)projectile.localAI[0]); - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override void Kill(int timeLeft) - { - int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) - { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 173, 0f, 0f, 100, default(Color), 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("MarkedforDeath"), 300); - } - } -} \ No newline at end of file +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 MarkRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 5; + projectile.height = 5; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.timeLeft = 300; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.5f, 0f, 0.7f); + float num55 = 30f; + float num56 = 2f; + if (projectile.ai[1] == 0f) + { + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } + else + { + projectile.localAI[0] -= num56; + if (projectile.localAI[0] <= 0f) + { + projectile.Kill(); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 0, 250, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + int num147 = 0; + int num148 = 0; + float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Microsoft.Xna.Framework.Rectangle value6 = new Microsoft.Xna.Framework.Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(value6)) + { + Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); + float num162 = 30f; + float scaleFactor = 2f; + if (projectile.ai[1] == 1f) + { + num162 = (float)((int)projectile.localAI[0]); + } + for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) + { + Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; + Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25); + color29 *= (num162 - (float)num163) / num162; + color29.A = 0; + Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public override void Kill(int timeLeft) + { + int num212 = Main.rand.Next(3, 7); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 173, 0f, 0f, 100, default(Color), 2.1f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("MarkedforDeath"), 300); + } + } +} diff --git a/Projectiles/Typeless/Nanotech.cs b/Projectiles/Typeless/Nanotech.cs index 8c278f5913..6aee63b523 100644 --- a/Projectiles/Typeless/Nanotech.cs +++ b/Projectiles/Typeless/Nanotech.cs @@ -1,116 +1,116 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class Nanotech : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanotech"); - } - - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.extraUpdates = 2; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.4f, 0.15f)); - projectile.rotation += projectile.velocity.X * 0.2f; - if (projectile.velocity.X > 0f) - { - projectile.rotation += 0.08f; - } - else - { - projectile.rotation -= 0.08f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] > 30f) - { - projectile.alpha += 5; - if (projectile.alpha >= 255) - { - projectile.alpha = 255; - projectile.Kill(); - return; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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; - return; - } - } - - public override void Kill(int timeLeft) - { - int num3; - for (int num191 = 0; num191 < 2; num191 = num3 + 1) - { - int num192 = (int)(10f * projectile.scale); - int num193 = Dust.NewDust(projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default(Color), 1f); - Dust dust20 = Main.dust[num193]; - Vector2 value8 = Vector2.Normalize(dust20.position - projectile.Center); - dust20.position = projectile.Center + value8 * (float)num192 * projectile.scale; - if (num191 < 30) - { - dust20.velocity = value8 * dust20.velocity.Length(); - } - else - { - dust20.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; - } - dust20.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); - dust20.color = Color.Lerp(dust20.color, Color.White, 0.3f); - dust20.noGravity = true; - dust20.scale = 0.7f; - num3 = num191; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 255 - projectile.alpha, 0, 0); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class Nanotech : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanotech"); + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.4f, 0.15f)); + projectile.rotation += projectile.velocity.X * 0.2f; + if (projectile.velocity.X > 0f) + { + projectile.rotation += 0.08f; + } + else + { + projectile.rotation -= 0.08f; + } + projectile.ai[1] += 1f; + if (projectile.ai[1] > 30f) + { + projectile.alpha += 5; + if (projectile.alpha >= 255) + { + projectile.alpha = 255; + projectile.Kill(); + return; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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; + return; + } + } + + public override void Kill(int timeLeft) + { + int num3; + for (int num191 = 0; num191 < 2; num191 = num3 + 1) + { + int num192 = (int)(10f * projectile.scale); + int num193 = Dust.NewDust(projectile.Center - Vector2.One * (float)num192, num192 * 2, num192 * 2, 107, 0f, 0f, 0, default(Color), 1f); + Dust dust20 = Main.dust[num193]; + Vector2 value8 = Vector2.Normalize(dust20.position - projectile.Center); + dust20.position = projectile.Center + value8 * (float)num192 * projectile.scale; + if (num191 < 30) + { + dust20.velocity = value8 * dust20.velocity.Length(); + } + else + { + dust20.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; + } + dust20.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); + dust20.color = Color.Lerp(dust20.color, Color.White, 0.3f); + dust20.noGravity = true; + dust20.scale = 0.7f; + num3 = num191; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(0, 255 - projectile.alpha, 0, 0); + } + } +} diff --git a/Projectiles/Typeless/NebulaDust.cs b/Projectiles/Typeless/NebulaDust.cs index 8f6d8ecd15..0cb8c5865d 100644 --- a/Projectiles/Typeless/NebulaDust.cs +++ b/Projectiles/Typeless/NebulaDust.cs @@ -1,69 +1,69 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class NebulaDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - } - - public override void AI() - { - projectile.rotation += projectile.velocity.X * 0.02f; - if (projectile.velocity.X < 0f) - { - projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; - } - else - { - projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; - } - projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 60f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class NebulaDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + + public override void AI() + { + projectile.rotation += projectile.velocity.X * 0.02f; + if (projectile.velocity.X < 0f) + { + projectile.rotation -= Math.Abs(projectile.velocity.Y) * 0.02f; + } + else + { + projectile.rotation += Math.Abs(projectile.velocity.Y) * 0.02f; + } + projectile.velocity *= 0.98f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 60f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + } +} diff --git a/Projectiles/Typeless/NebulaStar.cs b/Projectiles/Typeless/NebulaStar.cs index 6c399407da..6e43558d9b 100644 --- a/Projectiles/Typeless/NebulaStar.cs +++ b/Projectiles/Typeless/NebulaStar.cs @@ -1,195 +1,195 @@ -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 NebulaStar : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } - - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - 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) - { - if (projectile.owner == Main.myPlayer && projectile.ai[1] == 0f) - { - Vector2 value10 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value10.Normalize(); - value10 *= 0.3f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value10.X, value10.Y, mod.ProjectileType("NebulaDust"), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } - - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(17f, 17f); - spriteBatch.Draw(mod.GetTexture("Projectiles/Typeless/NebulaStarGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - } -} \ No newline at end of file +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 NebulaStar : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + 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) + { + if (projectile.owner == Main.myPlayer && projectile.ai[1] == 0f) + { + Vector2 value10 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + value10.Normalize(); + value10 *= 0.3f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value10.X, value10.Y, mod.ProjectileType("NebulaDust"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(17f, 17f); + spriteBatch.Draw(mod.GetTexture("Projectiles/Typeless/NebulaStarGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Projectiles/Typeless/NobodyKnows.cs b/Projectiles/Typeless/NobodyKnows.cs index 3412c24291..5fe21f10ee 100644 --- a/Projectiles/Typeless/NobodyKnows.cs +++ b/Projectiles/Typeless/NobodyKnows.cs @@ -1,26 +1,26 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class NobodyKnows : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nope"); - } - - public override void SetDefaults() - { - projectile.width = 2; - projectile.height = 2; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 1; - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class NobodyKnows : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nope"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 1; + } + } +} diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index 629aa1c01e..0cbc076114 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -1,230 +1,230 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; -using System; -using CalamityMod.World; - -namespace CalamityMod.Projectiles.Typeless -{ - public class OmegaBlueTentacle : ModProjectile - { - public bool initSegments = false; - public Vector2[] segment = new Vector2[6]; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omega Blue Tentacle"); - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.timeLeft = 6; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override bool PreAI() - { - if (!initSegments) - { - initSegments = true; - for (int i = 0; i < 6; i++) - { - segment[i] = projectile.Center; - //Main.NewText("init segment " + segment[i].X.ToString() + " " + segment[i].Y.ToString()); - } - } - return true; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - bool hentai = player.GetModPlayer().omegaBlueHentai; - if (player.active && player.GetModPlayer().omegaBlueSet) - projectile.timeLeft = 3; - - //tentacle head movement (homing) - Vector2 playerVel = player.position - player.oldPosition; - projectile.position += playerVel; - projectile.ai[0]++; - if (projectile.ai[0] >= 0f) - { - Vector2 home = player.Center + new Vector2(50, 0).RotatedBy(MathHelper.ToRadians(60) * projectile.ai[1]); - Vector2 distance = home - projectile.Center; - float range = distance.Length(); - distance.Normalize(); - if (projectile.ai[0] == 0f) - { - if (range > 13f) - { - projectile.ai[0] = -1f; //if in fast mode, stay fast until back in range - if (range > 1300f) - { - projectile.Kill(); - return; - } - } - else - { - if (hentai) - projectile.ai[0] = 120f;//45f + Main.rand.Next(45); - projectile.velocity.Normalize(); - projectile.velocity *= 3f + Main.rand.NextFloat(3f); - projectile.netUpdate = true; - } - } - else - { - distance /= 8f; - } - if (range > 120f) //switch to fast return mode - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - projectile.velocity += distance; - if (range > 30f) - projectile.velocity *= 0.96f; - - if (projectile.ai[0] > 120f) //attack nearby enemy - { - projectile.ai[0] = 10 + Main.rand.Next(10); - float maxDistance = hentai ? 900f : 600f; - int target = -1; - for (int i = 0; i < 200; i++) - { - NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile)) - { - float npcDistance = projectile.Distance(npc.Center); - if (npcDistance < maxDistance) - { - maxDistance = npcDistance; - target = i; - } - } - } - if (target != -1) - { - projectile.velocity = Main.npc[target].Center - projectile.Center; - projectile.velocity.Normalize(); - projectile.velocity *= 13f; - projectile.velocity += Main.npc[target].velocity / 2f; - projectile.velocity -= playerVel / 2f; - projectile.ai[0] *= -1f; - } - projectile.netUpdate = true; - } - } - - //tentacle segment updates - segment[0] = player.Center; - for (int i = 1; i < 5; i++) - { - MoveSegment(segment[i - 1], ref segment[i], segment[i + 1]); - } - MoveSegment(segment[4], ref segment[5], projectile.Center + projectile.velocity); - - if (hentai) - { - if (projectile.ai[0] != -1f) - projectile.ai[0]++; - projectile.position += projectile.velocity; - //SMOOTH ASS DUST - Vector2 dustPos = projectile.position + projectile.velocity; - Vector2 tickVel = dustPos - projectile.oldPosition; //playerVel + projectile.velocity * 2f; - dustPos += new Vector2(projectile.width / 2, 0).RotatedBy(projectile.rotation); - dustPos.X -= 4; - dustPos.X += projectile.width / 2; - dustPos.Y -= 4; - dustPos.Y += projectile.height / 2; - const float factor = 3f; - int limit = (int)(tickVel.Length() / factor); - if (limit == 0) - { - int d = Dust.NewDust(dustPos, 0, 0, 20, 0, 0, 100, Color.Transparent, 0.9f); - Main.dust[d].noGravity = true; - Main.dust[d].noLight = true; - Main.dust[d].fadeIn = 1f; - Main.dust[d].velocity = Vector2.Zero; - } - else - { - tickVel.Normalize(); - tickVel *= factor; - for (int i = 0; i <= limit; i++) - { - int d = Dust.NewDust(dustPos, 0, 0, 20, 0, 0, 100, Color.Transparent, 0.9f); - Main.dust[d].noGravity = true; - Main.dust[d].noLight = true; - Main.dust[d].fadeIn = 1f; - Main.dust[d].position -= tickVel * i; - Main.dust[d].velocity = Vector2.Zero; - } - } - } - } - - private static void MoveSegment(Vector2 previous, ref Vector2 current, Vector2 next) - { - current = previous + next; - current /= 2; - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (Main.player[projectile.owner].GetModPlayer().omegaBlueHentai) - crit = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer && Main.player[Main.myPlayer].lifeSteal > 0f && target.type != NPCID.TargetDummy) - { - int healAmount = 10 * damage / projectile.damage; //should always be around max, less if enemy has defense/DR - if (healAmount > 0) - { - Main.player[Main.myPlayer].lifeSteal -= healAmount; - if (Main.player[Main.myPlayer].GetModPlayer().omegaBlueHentai) //hentai always crits, this makes it have same lifesteal delay - Main.player[Main.myPlayer].lifeSteal += healAmount / 2; - /*Main.player[Main.myPlayer].statLife += healAmount; - if (Main.player[Main.myPlayer].statLife > Main.player[Main.myPlayer].statLifeMax2) - Main.player[Main.myPlayer].statLife = Main.player[Main.myPlayer].statLifeMax2; - Main.player[Main.myPlayer].HealEffect(healAmount, false);*/ - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.SpiritHeal, 0, 0f, projectile.owner, projectile.owner, healAmount); - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp/*.PointWrap*/, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); - - GameShaders.Armor.ApplySecondary(Main.player[projectile.owner].cBody, Main.player[projectile.owner], new DrawData?()); - projectile.rotation = (projectile.Center - segment[5]).ToRotation(); - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - Texture2D segmentSprite = mod.GetTexture("ExtraTextures/Chains/OmegaBlueTentacleSegment"); - for (int i = 0; i < 6; i++) - { - Main.spriteBatch.Draw(segmentSprite, segment[i] - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), segmentSprite.Bounds, projectile.GetAlpha(lightColor), 0f, segmentSprite.Bounds.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - } - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), texture2D13.Bounds, projectile.GetAlpha(lightColor), projectile.rotation, texture2D13.Bounds.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.Transform); - return false; - } - } -} +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; +using System; +using CalamityMod.World; + +namespace CalamityMod.Projectiles.Typeless +{ + public class OmegaBlueTentacle : ModProjectile + { + public bool initSegments = false; + public Vector2[] segment = new Vector2[6]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omega Blue Tentacle"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.timeLeft = 6; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override bool PreAI() + { + if (!initSegments) + { + initSegments = true; + for (int i = 0; i < 6; i++) + { + segment[i] = projectile.Center; + //Main.NewText("init segment " + segment[i].X.ToString() + " " + segment[i].Y.ToString()); + } + } + return true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + bool hentai = player.GetModPlayer().omegaBlueHentai; + if (player.active && player.GetModPlayer().omegaBlueSet) + projectile.timeLeft = 3; + + //tentacle head movement (homing) + Vector2 playerVel = player.position - player.oldPosition; + projectile.position += playerVel; + projectile.ai[0]++; + if (projectile.ai[0] >= 0f) + { + Vector2 home = player.Center + new Vector2(50, 0).RotatedBy(MathHelper.ToRadians(60) * projectile.ai[1]); + Vector2 distance = home - projectile.Center; + float range = distance.Length(); + distance.Normalize(); + if (projectile.ai[0] == 0f) + { + if (range > 13f) + { + projectile.ai[0] = -1f; //if in fast mode, stay fast until back in range + if (range > 1300f) + { + projectile.Kill(); + return; + } + } + else + { + if (hentai) + projectile.ai[0] = 120f;//45f + Main.rand.Next(45); + projectile.velocity.Normalize(); + projectile.velocity *= 3f + Main.rand.NextFloat(3f); + projectile.netUpdate = true; + } + } + else + { + distance /= 8f; + } + if (range > 120f) //switch to fast return mode + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + projectile.velocity += distance; + if (range > 30f) + projectile.velocity *= 0.96f; + + if (projectile.ai[0] > 120f) //attack nearby enemy + { + projectile.ai[0] = 10 + Main.rand.Next(10); + float maxDistance = hentai ? 900f : 600f; + int target = -1; + for (int i = 0; i < 200; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile)) + { + float npcDistance = projectile.Distance(npc.Center); + if (npcDistance < maxDistance) + { + maxDistance = npcDistance; + target = i; + } + } + } + if (target != -1) + { + projectile.velocity = Main.npc[target].Center - projectile.Center; + projectile.velocity.Normalize(); + projectile.velocity *= 13f; + projectile.velocity += Main.npc[target].velocity / 2f; + projectile.velocity -= playerVel / 2f; + projectile.ai[0] *= -1f; + } + projectile.netUpdate = true; + } + } + + //tentacle segment updates + segment[0] = player.Center; + for (int i = 1; i < 5; i++) + { + MoveSegment(segment[i - 1], ref segment[i], segment[i + 1]); + } + MoveSegment(segment[4], ref segment[5], projectile.Center + projectile.velocity); + + if (hentai) + { + if (projectile.ai[0] != -1f) + projectile.ai[0]++; + projectile.position += projectile.velocity; + //SMOOTH ASS DUST + Vector2 dustPos = projectile.position + projectile.velocity; + Vector2 tickVel = dustPos - projectile.oldPosition; //playerVel + projectile.velocity * 2f; + dustPos += new Vector2(projectile.width / 2, 0).RotatedBy(projectile.rotation); + dustPos.X -= 4; + dustPos.X += projectile.width / 2; + dustPos.Y -= 4; + dustPos.Y += projectile.height / 2; + const float factor = 3f; + int limit = (int)(tickVel.Length() / factor); + if (limit == 0) + { + int d = Dust.NewDust(dustPos, 0, 0, 20, 0, 0, 100, Color.Transparent, 0.9f); + Main.dust[d].noGravity = true; + Main.dust[d].noLight = true; + Main.dust[d].fadeIn = 1f; + Main.dust[d].velocity = Vector2.Zero; + } + else + { + tickVel.Normalize(); + tickVel *= factor; + for (int i = 0; i <= limit; i++) + { + int d = Dust.NewDust(dustPos, 0, 0, 20, 0, 0, 100, Color.Transparent, 0.9f); + Main.dust[d].noGravity = true; + Main.dust[d].noLight = true; + Main.dust[d].fadeIn = 1f; + Main.dust[d].position -= tickVel * i; + Main.dust[d].velocity = Vector2.Zero; + } + } + } + } + + private static void MoveSegment(Vector2 previous, ref Vector2 current, Vector2 next) + { + current = previous + next; + current /= 2; + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (Main.player[projectile.owner].GetModPlayer().omegaBlueHentai) + crit = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer && Main.player[Main.myPlayer].lifeSteal > 0f && target.type != NPCID.TargetDummy) + { + int healAmount = 10 * damage / projectile.damage; //should always be around max, less if enemy has defense/DR + if (healAmount > 0) + { + Main.player[Main.myPlayer].lifeSteal -= healAmount; + if (Main.player[Main.myPlayer].GetModPlayer().omegaBlueHentai) //hentai always crits, this makes it have same lifesteal delay + Main.player[Main.myPlayer].lifeSteal += healAmount / 2; + /*Main.player[Main.myPlayer].statLife += healAmount; + if (Main.player[Main.myPlayer].statLife > Main.player[Main.myPlayer].statLifeMax2) + Main.player[Main.myPlayer].statLife = Main.player[Main.myPlayer].statLifeMax2; + Main.player[Main.myPlayer].HealEffect(healAmount, false);*/ + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.SpiritHeal, 0, 0f, projectile.owner, projectile.owner, healAmount); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp/*.PointWrap*/, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + + GameShaders.Armor.ApplySecondary(Main.player[projectile.owner].cBody, Main.player[projectile.owner], new DrawData?()); + projectile.rotation = (projectile.Center - segment[5]).ToRotation(); + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + Texture2D segmentSprite = mod.GetTexture("ExtraTextures/Chains/OmegaBlueTentacleSegment"); + for (int i = 0; i < 6; i++) + { + Main.spriteBatch.Draw(segmentSprite, segment[i] - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), segmentSprite.Bounds, projectile.GetAlpha(lightColor), 0f, segmentSprite.Bounds.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + } + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), texture2D13.Bounds, projectile.GetAlpha(lightColor), projectile.rotation, texture2D13.Bounds.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.Transform); + return false; + } + } +} diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index 0f31a193d8..5ca8078b62 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class PoisonousSeawater : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seawater"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 6; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f); - int randomDust = Main.rand.Next(4); - if (randomDust == 0) - { - randomDust = 33; - } - else if (randomDust == 1) - { - randomDust = 33; - } - else if (randomDust == 2) - { - randomDust = 33; - } - else - { - randomDust = 89; - } - 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) - { - Main.dust[num469].scale *= 0.35f; - } - Main.dust[num469].velocity *= 0f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 120); - target.AddBuff(BuffID.Poisoned, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class PoisonousSeawater : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seawater"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 6; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.4f) / 255f); + int randomDust = Main.rand.Next(4); + if (randomDust == 0) + { + randomDust = 33; + } + else if (randomDust == 1) + { + randomDust = 33; + } + else if (randomDust == 2) + { + randomDust = 33; + } + else + { + randomDust = 89; + } + 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) + { + Main.dust[num469].scale *= 0.35f; + } + Main.dust[num469].velocity *= 0f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 120); + target.AddBuff(BuffID.Poisoned, 120); + } + } +} diff --git a/Projectiles/Typeless/ReaverBlast.cs b/Projectiles/Typeless/ReaverBlast.cs index 30e6bd1b2e..d001125dac 100644 --- a/Projectiles/Typeless/ReaverBlast.cs +++ b/Projectiles/Typeless/ReaverBlast.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ReaverBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 5; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.015f) / 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default(Color), 1f); - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 60); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ReaverBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 5; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.015f) / 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default(Color), 1f); + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 60); + } + } +} diff --git a/Projectiles/Typeless/Seashell.cs b/Projectiles/Typeless/Seashell.cs index ba389f1ece..e0e9e30101 100644 --- a/Projectiles/Typeless/Seashell.cs +++ b/Projectiles/Typeless/Seashell.cs @@ -1,41 +1,41 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class Seashell : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seashell"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.aiStyle = 3; - projectile.timeLeft = 300; - aiType = 52; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - 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 +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class Seashell : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seashell"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.aiStyle = 3; + projectile.timeLeft = 300; + aiType = 52; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + 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; + } + } +} diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index 5d4ec8614c..2cbe4be470 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -1,174 +1,174 @@ -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 SkyFlareFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - Main.projFrames[projectile.type] = 5; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.extraUpdates = 1; - projectile.penetrate = 1; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = projectile.velocity.X * 0.5f; - num248 = projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.3f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { - projectile.velocity *= 1.1f; - } - else if (Main.rand.Next(2) == 0) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 0.6f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - projectile.ai[0] = 10f; - 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; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - 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(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 = 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 num621 = 0; num621 < 4; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 12; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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; - } - } - } -} \ No newline at end of file +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 SkyFlareFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flare"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + projectile.frame = 0; + } + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + num247 = projectile.velocity.X * 0.5f; + num248 = projectile.velocity.Y * 0.5f; + } + int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num249].velocity *= 0.2f; + Main.dust[num249].noGravity = true; + num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default(Color), 0.3f); + Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num249].velocity *= 0.05f; + } + } + if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) + { + projectile.velocity *= 1.1f; + } + else if (Main.rand.Next(2) == 0) + { + int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + Main.rand.Next(2); + num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 0.6f); + Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[num252].noGravity = true; + Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f; + } + projectile.ai[0] += 1f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) + { + projectile.ai[0] = 10f; + 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; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + 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(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 = 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 num621 = 0; num621 < 4; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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 < 12; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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, 244, 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; + } + } + } +} diff --git a/Projectiles/Typeless/SparkInfernal.cs b/Projectiles/Typeless/SparkInfernal.cs index 42963e4b6d..c6c39de191 100644 --- a/Projectiles/Typeless/SparkInfernal.cs +++ b/Projectiles/Typeless/SparkInfernal.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class SparkInfernal : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spark"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } - - public override void AI() - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - - public override void Kill(int timeLeft) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("InfernadoMarkFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class SparkInfernal : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spark"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + + public override void Kill(int timeLeft) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("InfernadoMarkFriendly"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } +} diff --git a/Projectiles/Typeless/StandingFire.cs b/Projectiles/Typeless/StandingFire.cs index e4fc5afa0e..b44374400f 100644 --- a/Projectiles/Typeless/StandingFire.cs +++ b/Projectiles/Typeless/StandingFire.cs @@ -1,107 +1,107 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class StandingFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 240; - } - - 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.type >= 326 && projectile.type <= 328) - { - 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, 235, 0f, 0f, 100, default(Color), 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, 235, 0f, 0f, 100, default(Color), 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; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class StandingFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 240; + } + + 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.type >= 326 && projectile.type <= 328) + { + 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, 235, 0f, 0f, 100, default(Color), 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, 235, 0f, 0f, 100, default(Color), 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; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 7; + target.AddBuff(mod.BuffType("BrimstoneFlames"), 120); + } + } +} diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index cf76e7d7db..44dede07be 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -1,100 +1,100 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class StickyFeatherAero : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Feather"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.timeLeft = 360; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.aiStyle = 93; - aiType = 514; - } - - public override void AI() - { - if (projectile.timeLeft < 320) - { - projectile.tileCollide = true; - } - 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) - { - 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 void Kill(int timeLeft) - { - 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 = 50; - projectile.height = 50; - 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 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 1.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, 206, 0f, 0f, 100, default(Color), 1.7f); - 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, 206, 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class StickyFeatherAero : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.timeLeft = 360; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.aiStyle = 93; + aiType = 514; + } + + public override void AI() + { + if (projectile.timeLeft < 320) + { + projectile.tileCollide = true; + } + 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) + { + 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 void Kill(int timeLeft) + { + 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 = 50; + projectile.height = 50; + 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 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 1.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, 206, 0f, 0f, 100, default(Color), 1.7f); + 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, 206, 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Typeless/StormBolt.cs b/Projectiles/Typeless/StormBolt.cs index 9094a42858..409cceac78 100644 --- a/Projectiles/Typeless/StormBolt.cs +++ b/Projectiles/Typeless/StormBolt.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class StormBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.light = 1f; - projectile.timeLeft = 300; - } - - public override void AI() - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 16, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f); - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("StormMarkSummon"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class StormBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.light = 1f; + projectile.timeLeft = 300; + } + + public override void AI() + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 16, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f); + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("StormMarkSummon"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } +} diff --git a/Projectiles/Typeless/TarraEnergy.cs b/Projectiles/Typeless/TarraEnergy.cs index 8cac87bf3b..f448f66ef9 100644 --- a/Projectiles/Typeless/TarraEnergy.cs +++ b/Projectiles/Typeless/TarraEnergy.cs @@ -1,67 +1,67 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class TarraEnergy : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - } - - 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 k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } - - public override bool PreAI() - { - for (int num136 = 0; num136 < 3; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default(Color), 1f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - return false; - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class TarraEnergy : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Round"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 120; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + } + + 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 k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + + public override bool PreAI() + { + for (int num136 = 0; num136 < 3; num136++) + { + float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; + float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default(Color), 1f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); + float num139 = projectile.localAI[0]; + if (num139 == 0f) + { + projectile.localAI[0] = num138; + num139 = num138; + } + return false; + } + } +} diff --git a/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs b/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs index 8976bf40e3..b7dbcdbe19 100644 --- a/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs +++ b/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs @@ -200,4 +200,4 @@ namespace CalamityMod.Projectiles.Typeless projectile.Damage(); } } -} \ No newline at end of file +} diff --git a/Projectiles/Typeless/TrueBattleSpawn.cs b/Projectiles/Typeless/TrueBattleSpawn.cs index e7cfb57f3c..d77433effb 100644 --- a/Projectiles/Typeless/TrueBattleSpawn.cs +++ b/Projectiles/Typeless/TrueBattleSpawn.cs @@ -1,41 +1,41 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class TrueBattleSpawn : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spawn"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.aiStyle = 1; - projectile.scale = 1f; - projectile.penetrate = 1; - projectile.timeLeft = 20; - projectile.tileCollide = false; - aiType = ProjectileID.Bullet; - } - - public override void AI() - { - Player player = Main.player[projectile.owner]; - projectile.ai[1]++; - - if (projectile.ai[1] >= 0) - { - NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CalamitasRun3")); - projectile.ai[1] = -30; - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class TrueBattleSpawn : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spawn"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.aiStyle = 1; + projectile.scale = 1f; + projectile.penetrate = 1; + projectile.timeLeft = 20; + projectile.tileCollide = false; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.ai[1]++; + + if (projectile.ai[1] >= 0) + { + NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("CalamitasRun3")); + projectile.ai[1] = -30; + } + } + } +} diff --git a/Projectiles/Typeless/VanquisherArrow2.cs b/Projectiles/Typeless/VanquisherArrow2.cs index e57e89a9b0..8a96742f5d 100644 --- a/Projectiles/Typeless/VanquisherArrow2.cs +++ b/Projectiles/Typeless/VanquisherArrow2.cs @@ -1,82 +1,82 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class VanquisherArrow2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Arrow"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.arrow = true; - projectile.timeLeft = 90; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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; - } - } - - 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(0, 0, 0, 0); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class VanquisherArrow2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arrow"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.arrow = true; + projectile.timeLeft = 90; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + 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; + } + } + + 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(0, 0, 0, 0); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } + } +} diff --git a/Projectiles/Typeless/XerocBlast.cs b/Projectiles/Typeless/XerocBlast.cs index 698f9421af..087d5d0b33 100644 --- a/Projectiles/Typeless/XerocBlast.cs +++ b/Projectiles/Typeless/XerocBlast.cs @@ -1,95 +1,95 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class XerocBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 5; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 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(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 1f); - 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++; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.OnFire, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class XerocBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 5; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.35f) / 255f, ((255 - projectile.alpha) * 0.05f) / 255f, ((255 - projectile.alpha) * 0.25f) / 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(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 1f); + 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++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.OnFire, 120); + } + } +} diff --git a/Projectiles/Typeless/XerocBubble.cs b/Projectiles/Typeless/XerocBubble.cs index 27afaebfb9..2a8942fa5f 100644 --- a/Projectiles/Typeless/XerocBubble.cs +++ b/Projectiles/Typeless/XerocBubble.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class XerocBubble : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bubble"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.alpha = 100; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 200; - } - - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 1; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.CursedInferno, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class XerocBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bubble"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.alpha = 100; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 200; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 1; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 8f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.CursedInferno, 120); + } + } +} diff --git a/Projectiles/Typeless/XerocFire.cs b/Projectiles/Typeless/XerocFire.cs index 04ad308f63..bb3faa098c 100644 --- a/Projectiles/Typeless/XerocFire.cs +++ b/Projectiles/Typeless/XerocFire.cs @@ -1,102 +1,102 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class XerocFire : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - } - - 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, 58, 0f, 0f, 100, default(Color), 0.75f); - 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, 58, 0f, 0f, 100, default(Color), 0.75f); - 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; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.CursedInferno, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class XerocFire : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + } + + 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, 58, 0f, 0f, 100, default(Color), 0.75f); + 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, 58, 0f, 0f, 100, default(Color), 0.75f); + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.CursedInferno, 120); + } + } +} diff --git a/Projectiles/Typeless/XerocOrb.cs b/Projectiles/Typeless/XerocOrb.cs index 695cae85fd..fb0bcf3c5c 100644 --- a/Projectiles/Typeless/XerocOrb.cs +++ b/Projectiles/Typeless/XerocOrb.cs @@ -1,73 +1,73 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class XerocOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 200; - } - - public override void AI() - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 7f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.CursedInferno, 120); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class XerocOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 200; + } + + public override void AI() + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 7f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.CursedInferno, 120); + } + } +} diff --git a/Projectiles/Typeless/XerocStar.cs b/Projectiles/Typeless/XerocStar.cs index 646783e3c6..a462384b89 100644 --- a/Projectiles/Typeless/XerocStar.cs +++ b/Projectiles/Typeless/XerocStar.cs @@ -1,90 +1,90 @@ -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 XerocStar : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.alpha = 100; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - } - - public override void AI() - { - projectile.rotation += 0.25f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 1; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 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 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } - - public override 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.OnFire, 120); - target.AddBuff(BuffID.CursedInferno, 120); - } - } -} \ No newline at end of file +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 XerocStar : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.alpha = 100; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.rotation += 0.25f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 1; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default(Color), 2f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 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 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override 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.OnFire, 120); + target.AddBuff(BuffID.CursedInferno, 120); + } + } +} diff --git a/Sounds/Custom/AdrenalineBurnout1.cs b/Sounds/Custom/AdrenalineBurnout1.cs index 55cdea9707..33c772e1d8 100644 --- a/Sounds/Custom/AdrenalineBurnout1.cs +++ b/Sounds/Custom/AdrenalineBurnout1.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class AdrenalineBurnout1 : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AdrenalineBurnout1 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/AdrenalineBurnout2.cs b/Sounds/Custom/AdrenalineBurnout2.cs index 4231676f1a..a5c0654c83 100644 --- a/Sounds/Custom/AdrenalineBurnout2.cs +++ b/Sounds/Custom/AdrenalineBurnout2.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class AdrenalineBurnout2 : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AdrenalineBurnout2 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/AngryDogGrowl.cs b/Sounds/Custom/AngryDogGrowl.cs index 64ecfaa792..430385477b 100644 --- a/Sounds/Custom/AngryDogGrowl.cs +++ b/Sounds/Custom/AngryDogGrowl.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class AngryDogGrowl : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AngryDogGrowl : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/BazookaRocket.cs b/Sounds/Custom/BazookaRocket.cs index 6be8d4e9c6..54df22b756 100644 --- a/Sounds/Custom/BazookaRocket.cs +++ b/Sounds/Custom/BazookaRocket.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class BazookaRocket : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class BazookaRocket : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/CorvinaScream.cs b/Sounds/Custom/CorvinaScream.cs index e902d06701..31ee2cc0b8 100644 --- a/Sounds/Custom/CorvinaScream.cs +++ b/Sounds/Custom/CorvinaScream.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class CovirnaScream : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class CovirnaScream : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/DevilMaskBreak.cs b/Sounds/Custom/DevilMaskBreak.cs index 7c6368fe9d..9f3f229ebb 100644 --- a/Sounds/Custom/DevilMaskBreak.cs +++ b/Sounds/Custom/DevilMaskBreak.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class DevilMaskBreak : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class DevilMaskBreak : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/EidolonWyrmRoarClose.cs b/Sounds/Custom/EidolonWyrmRoarClose.cs index b585af18a6..1c06bd4829 100644 --- a/Sounds/Custom/EidolonWyrmRoarClose.cs +++ b/Sounds/Custom/EidolonWyrmRoarClose.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class EidolonWyrmRoarClose : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class EidolonWyrmRoarClose : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/FullAdrenaline.cs b/Sounds/Custom/FullAdrenaline.cs index f9b1c38153..9610af74a1 100644 --- a/Sounds/Custom/FullAdrenaline.cs +++ b/Sounds/Custom/FullAdrenaline.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class FullAdrenaline : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class FullAdrenaline : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/FullRage.cs b/Sounds/Custom/FullRage.cs index 30747d0056..832ba4ac46 100644 --- a/Sounds/Custom/FullRage.cs +++ b/Sounds/Custom/FullRage.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class FullRage : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class FullRage : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/GreatSandSharkRoar.cs b/Sounds/Custom/GreatSandSharkRoar.cs index 094df9b943..9aa101a651 100644 --- a/Sounds/Custom/GreatSandSharkRoar.cs +++ b/Sounds/Custom/GreatSandSharkRoar.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class GreatSandSharkRoar : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class GreatSandSharkRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/LegStomp.cs b/Sounds/Custom/LegStomp.cs index c566334f1f..19acea3f87 100644 --- a/Sounds/Custom/LegStomp.cs +++ b/Sounds/Custom/LegStomp.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class LegStomp : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class LegStomp : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/MaulerRoar.cs b/Sounds/Custom/MaulerRoar.cs index c932a0f70d..b863e0dd94 100644 --- a/Sounds/Custom/MaulerRoar.cs +++ b/Sounds/Custom/MaulerRoar.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class MaulerRoar : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class MaulerRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/ReaperEnragedRoar.cs b/Sounds/Custom/ReaperEnragedRoar.cs index 36c6c8ccc4..3f0aefb522 100644 --- a/Sounds/Custom/ReaperEnragedRoar.cs +++ b/Sounds/Custom/ReaperEnragedRoar.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class ReaperEnragedRoar : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class ReaperEnragedRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/ReaperSearchRoar.cs b/Sounds/Custom/ReaperSearchRoar.cs index 4aabdc7192..37ff2750eb 100644 --- a/Sounds/Custom/ReaperSearchRoar.cs +++ b/Sounds/Custom/ReaperSearchRoar.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class ReaperSearchRoar : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class ReaperSearchRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/RogueStealth.cs b/Sounds/Custom/RogueStealth.cs index 5c142c3338..38e8fb6923 100644 --- a/Sounds/Custom/RogueStealth.cs +++ b/Sounds/Custom/RogueStealth.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class RogueStealth : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class RogueStealth : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SilvaActivation.cs b/Sounds/Custom/SilvaActivation.cs index 20a2842ae3..2e4fd5829b 100644 --- a/Sounds/Custom/SilvaActivation.cs +++ b/Sounds/Custom/SilvaActivation.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class SilvaActivation : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class SilvaActivation : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SilvaDispel.cs b/Sounds/Custom/SilvaDispel.cs index a26a6e81fa..fca2f7596f 100644 --- a/Sounds/Custom/SilvaDispel.cs +++ b/Sounds/Custom/SilvaDispel.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class SilvaDispel : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class SilvaDispel : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/WyrmScream.cs b/Sounds/Custom/WyrmScream.cs index 35be3048ad..5a3d9c55c2 100644 --- a/Sounds/Custom/WyrmScream.cs +++ b/Sounds/Custom/WyrmScream.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class WyrmScream : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class WyrmScream : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/YharonRoar.cs b/Sounds/Custom/YharonRoar.cs index 33a8763e86..111acb76e0 100644 --- a/Sounds/Custom/YharonRoar.cs +++ b/Sounds/Custom/YharonRoar.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class YharonRoar : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class YharonRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/YharonRoarShort.cs b/Sounds/Custom/YharonRoarShort.cs index bc9c2a565e..fbb361c63a 100644 --- a/Sounds/Custom/YharonRoarShort.cs +++ b/Sounds/Custom/YharonRoarShort.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Custom -{ - public class YharonRoarShort : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class YharonRoarShort : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/BazookaFull.cs b/Sounds/Item/BazookaFull.cs index f0b1b62eba..706b192231 100644 --- a/Sounds/Item/BazookaFull.cs +++ b/Sounds/Item/BazookaFull.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class BazookaFull : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class BazookaFull : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/ClamImpact.cs b/Sounds/Item/ClamImpact.cs index 9fd8b71338..44221d8653 100644 --- a/Sounds/Item/ClamImpact.cs +++ b/Sounds/Item/ClamImpact.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class ClamImpact : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class ClamImpact : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/FlareSound.cs b/Sounds/Item/FlareSound.cs index e5f81945a1..ea8a8c2842 100644 --- a/Sounds/Item/FlareSound.cs +++ b/Sounds/Item/FlareSound.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class FlareSound : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class FlareSound : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/Hydra.cs b/Sounds/Item/Hydra.cs index 6c9a272856..65397a6c00 100644 --- a/Sounds/Item/Hydra.cs +++ b/Sounds/Item/Hydra.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class Hydra : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class Hydra : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/IronHeartDeath.cs b/Sounds/Item/IronHeartDeath.cs index 033fadadb3..c2a03a243f 100644 --- a/Sounds/Item/IronHeartDeath.cs +++ b/Sounds/Item/IronHeartDeath.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class IronHeartDeath : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class IronHeartDeath : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/KendraBark.cs b/Sounds/Item/KendraBark.cs index cf3e3e1422..e2316359b7 100644 --- a/Sounds/Item/KendraBark.cs +++ b/Sounds/Item/KendraBark.cs @@ -15,4 +15,4 @@ namespace CalamityMod.Sounds.Item return soundInstance; } } -} \ No newline at end of file +} diff --git a/Sounds/Item/LaserCannon.cs b/Sounds/Item/LaserCannon.cs index 7c04fe465f..a7f08b7159 100644 --- a/Sounds/Item/LaserCannon.cs +++ b/Sounds/Item/LaserCannon.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class LaserCannon : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class LaserCannon : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/Magnum.cs b/Sounds/Item/Magnum.cs index a3d8f4e9a8..01b9968393 100644 --- a/Sounds/Item/Magnum.cs +++ b/Sounds/Item/Magnum.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class Magnum : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class Magnum : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/OpalStrike.cs b/Sounds/Item/OpalStrike.cs index 0cf3a22fb7..a706d14c3a 100644 --- a/Sounds/Item/OpalStrike.cs +++ b/Sounds/Item/OpalStrike.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class OpalStrike : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class OpalStrike : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/PlasmaBlast.cs b/Sounds/Item/PlasmaBlast.cs index ebd4573c0d..bd773fa994 100644 --- a/Sounds/Item/PlasmaBlast.cs +++ b/Sounds/Item/PlasmaBlast.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class PlasmaBlast : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class PlasmaBlast : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/PlasmaBolt.cs b/Sounds/Item/PlasmaBolt.cs index bb4ca65ed9..64a791b559 100644 --- a/Sounds/Item/PlasmaBolt.cs +++ b/Sounds/Item/PlasmaBolt.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class PlasmaBolt : 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; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class PlasmaBolt : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/TankCannon.cs b/Sounds/Item/TankCannon.cs index 21e1f6194c..366b4b4367 100644 --- a/Sounds/Item/TankCannon.cs +++ b/Sounds/Item/TankCannon.cs @@ -1,19 +1,19 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.Item -{ - public class TankCannon : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1.85f; - soundInstance.Pan = pan; - soundInstance.Pitch = (float)Main.rand.Next(-25, 26) * 0.01f; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } -} +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class TankCannon : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1.85f; + soundInstance.Pan = pan; + soundInstance.Pitch = (float)Main.rand.Next(-25, 26) * 0.01f; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/NPCHit/AngryDogHit.cs b/Sounds/NPCHit/AngryDogHit.cs index dfdcf2e07f..e3392351a6 100644 --- a/Sounds/NPCHit/AngryDogHit.cs +++ b/Sounds/NPCHit/AngryDogHit.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.NPCHit -{ - public class AngryDogHit : 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 +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCHit +{ + public class AngryDogHit : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/NPCHit/AstrumAureusHit.cs b/Sounds/NPCHit/AstrumAureusHit.cs index c1f4f27b59..b80a42e753 100644 --- a/Sounds/NPCHit/AstrumAureusHit.cs +++ b/Sounds/NPCHit/AstrumAureusHit.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.NPCHit -{ - public class AstrumAureusHit : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 0.7f; - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCHit +{ + public class AstrumAureusHit : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 0.7f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/NPCKilled/Sunskater.cs b/Sounds/NPCKilled/Sunskater.cs index d26a4b2ad4..c4f86de266 100644 --- a/Sounds/NPCKilled/Sunskater.cs +++ b/Sounds/NPCKilled/Sunskater.cs @@ -1,18 +1,18 @@ -using Microsoft.Xna.Framework.Audio; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Sounds.NPCKilled -{ - public class Sunskater : ModSound - { - public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) - { - soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 2f; //1f - soundInstance.Pan = pan; - Main.PlaySoundInstance(soundInstance); - return soundInstance; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCKilled +{ + public class Sunskater : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 2f; //1f + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Tiles/AbyssGravel.cs b/Tiles/AbyssGravel.cs index a6cc2f6323..2152e512a0 100644 --- a/Tiles/AbyssGravel.cs +++ b/Tiles/AbyssGravel.cs @@ -1,32 +1,32 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class AbyssGravel : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("AbyssGravel"); - AddMapEntry(new Color(0, 0, 0)); - mineResist = 10f; - minPick = 65; - soundType = 21; - dustType = 33; - } - - public override bool CanExplode(int i, int j) - { - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class AbyssGravel : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("AbyssGravel"); + AddMapEntry(new Color(0, 0, 0)); + mineResist = 10f; + minPick = 65; + soundType = 21; + dustType = 33; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/AerialiteBrick.cs b/Tiles/AerialiteBrick.cs index f953908cf4..891a3b4594 100644 --- a/Tiles/AerialiteBrick.cs +++ b/Tiles/AerialiteBrick.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Tiles -{ - public class AerialiteBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; - Main.tileBlockLight[Type] = true; - TileID.Sets.NeedsGrassFraming[Type] = true; - soundType = 21; - minPick = 50; - drop = mod.ItemType("AerialiteBrick"); - AddMapEntry(new Color(68, 58, 145)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(119, 102, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles +{ + public class AerialiteBrick : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; + TileID.Sets.NeedsGrassFraming[Type] = true; + soundType = 21; + minPick = 50; + drop = mod.ItemType("AerialiteBrick"); + AddMapEntry(new Color(68, 58, 145)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + } +} diff --git a/Tiles/AerialiteOre.cs b/Tiles/AerialiteOre.cs index af8c1ff144..a6bb465c52 100644 --- a/Tiles/AerialiteOre.cs +++ b/Tiles/AerialiteOre.cs @@ -1,37 +1,37 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class AerialiteOre : ModTile - { - public override void SetDefaults() - { - Main.tileValue[Type] = 450; - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - dustType = mod.DustType("AHSparkle"); - drop = mod.ItemType("AerialiteOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Aerialite Ore"); - AddMapEntry(new Color(0, 255, 255), name); - mineResist = 2f; - minPick = 65; - soundType = 21; - Main.tileSpelunker[Type] = true; - } - - public override bool CanExplode(int i, int j) - { - return NPC.downedBoss2; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class AerialiteOre : ModTile + { + public override void SetDefaults() + { + Main.tileValue[Type] = 450; + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + dustType = mod.DustType("AHSparkle"); + drop = mod.ItemType("AerialiteOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Aerialite Ore"); + AddMapEntry(new Color(0, 255, 255), name); + mineResist = 2f; + minPick = 65; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + + public override bool CanExplode(int i, int j) + { + return NPC.downedBoss2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/ArenaTile.cs b/Tiles/ArenaTile.cs index 43f35ade25..9a94900f4f 100644 --- a/Tiles/ArenaTile.cs +++ b/Tiles/ArenaTile.cs @@ -1,53 +1,53 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Tiles -{ - public class ArenaTile : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Arena"); - AddMapEntry(new Color(128, 0, 0), name); - } - - public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { - return false; - } - - public override bool CanExplode(int i, int j) - { - return false; - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - if (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - WorldGen.KillTile(i, j, false, false, false); - if (!Main.tile[i, j].active() && Main.netMode != 0) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j, 0f, 0, 0, 0); - } - } - } - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = (float)Main.DiscoR / 255f; - g = 0f; - b = 0f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Tiles +{ + public class ArenaTile : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Arena"); + AddMapEntry(new Color(128, 0, 0), name); + } + + public override bool CanKillTile(int i, int j, ref bool blockDamaged) + { + return false; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + if (!NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) + { + WorldGen.KillTile(i, j, false, false, false); + if (!Main.tile[i, j].active() && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j, 0f, 0, 0, 0); + } + } + } + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = (float)Main.DiscoR / 255f; + g = 0f; + b = 0f; + } + } +} diff --git a/Tiles/Astral/AstralChestLocked.cs b/Tiles/Astral/AstralChestLocked.cs index 3a2102de5c..10597f637c 100644 --- a/Tiles/Astral/AstralChestLocked.cs +++ b/Tiles/Astral/AstralChestLocked.cs @@ -1,236 +1,236 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Terraria.GameInput; -using Terraria.GameContent.Achievements; -using CalamityMod.World; - -namespace CalamityMod.Tiles.Astral -{ - public class AstralChestLocked : ModTile - { - public override void SetDefaults() - { - Main.tileSpelunker[Type] = true; - Main.tileContainer[Type] = true; - Main.tileShine2[Type] = true; - Main.tileShine[Type] = 1200; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileValue[Type] = 500; - TileID.Sets.HasOutlines[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Astral Chest"); - AddMapEntry(new Color(174, 129, 92), name, MapChestName); - dustType = mod.DustType("AstralBasic"); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Astral Chest"; - chestDrop = mod.ItemType("AstralChest"); - } - - public override bool HasSmartInteract() - { - return true; - } - - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile == null) - { - return name; - } - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - string newName = name; - if (Chest.isLocked(left, top)) - { - newName = "Locked " + newName; - } - if (chest == -1 || Main.chest[chest].name == "") - { - return newName; - } - else - { - return newName + ": " + Main.chest[chest].name; - } - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = 1; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } - - public override void RightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == 1 && Main.tile[left, top].frameX < 72) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - if (Chest.isLocked(left, top)) - { - if (!CalamityWorld.downedAstrageldon) - { - return; - } - if (Chest.Unlock(left, top)) - { - AchievementsHelper.NotifyProgressionEvent(AchievementHelperID.Events.UnlockedBiomeChest); - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.Unlock, -1, -1, null, player.whoAmI, 1f, left, top); - } - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - if (PlayerInput.GrappleAndInteractAreShared) - { - PlayerInput.Triggers.JustPressed.Grapple = false; - } - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Astral Chest"; - if (player.showItemIconText == "Astral Chest") - { - player.showItemIcon2 = mod.ItemType("AstralChestLocked"); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } - - public override void MouseOverFar(int i, int j) - { - MouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.GameInput; +using Terraria.GameContent.Achievements; +using CalamityMod.World; + +namespace CalamityMod.Tiles.Astral +{ + public class AstralChestLocked : ModTile + { + public override void SetDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileValue[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Astral Chest"); + AddMapEntry(new Color(174, 129, 92), name, MapChestName); + dustType = mod.DustType("AstralBasic"); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Astral Chest"; + chestDrop = mod.ItemType("AstralChest"); + } + + public override bool HasSmartInteract() + { + return true; + } + + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + if (tile == null) + { + return name; + } + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + string newName = name; + if (Chest.isLocked(left, top)) + { + newName = "Locked " + newName; + } + if (chest == -1 || Main.chest[chest].name == "") + { + return newName; + } + else + { + return newName + ": " + Main.chest[chest].name; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = 1; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } + + public override void RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == 1 && Main.tile[left, top].frameX < 72) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + if (Chest.isLocked(left, top)) + { + if (!CalamityWorld.downedAstrageldon) + { + return; + } + if (Chest.Unlock(left, top)) + { + AchievementsHelper.NotifyProgressionEvent(AchievementHelperID.Events.UnlockedBiomeChest); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.Unlock, -1, -1, null, player.whoAmI, 1f, left, top); + } + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + if (PlayerInput.GrappleAndInteractAreShared) + { + PlayerInput.Triggers.JustPressed.Grapple = false; + } + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Astral Chest"; + if (player.showItemIconText == "Astral Chest") + { + player.showItemIcon2 = mod.ItemType("AstralChestLocked"); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } + + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + } +} diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index 4c6c9cd51f..41ec58b860 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -92,4 +92,4 @@ namespace CalamityMod.Tiles.Astral num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/Astral/AstralGrass.cs b/Tiles/Astral/AstralGrass.cs index 1a76198b79..86f9bf850e 100644 --- a/Tiles/Astral/AstralGrass.cs +++ b/Tiles/Astral/AstralGrass.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Tiles.Astral } } } -} \ No newline at end of file +} diff --git a/Tiles/Astral/AstralOre.cs b/Tiles/Astral/AstralOre.cs index 9ccc47acd1..be026c8742 100644 --- a/Tiles/Astral/AstralOre.cs +++ b/Tiles/Astral/AstralOre.cs @@ -72,4 +72,4 @@ namespace CalamityMod.Tiles.Astral return false; } } -} \ No newline at end of file +} diff --git a/Tiles/Astral/AstralStone.cs b/Tiles/Astral/AstralStone.cs index 9f4e954db0..fc3a7163c9 100644 --- a/Tiles/Astral/AstralStone.cs +++ b/Tiles/Astral/AstralStone.cs @@ -36,4 +36,4 @@ namespace CalamityMod.Tiles.Astral num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/Astral/AstralTreeSapling.cs b/Tiles/Astral/AstralTreeSapling.cs index 7df119f4ca..0b3de75046 100644 --- a/Tiles/Astral/AstralTreeSapling.cs +++ b/Tiles/Astral/AstralTreeSapling.cs @@ -68,4 +68,4 @@ namespace CalamityMod.Tiles.Astral } } } -} \ No newline at end of file +} diff --git a/Tiles/Astral/AstralVines.cs b/Tiles/Astral/AstralVines.cs index aaa78fc063..4db80bdf7d 100644 --- a/Tiles/Astral/AstralVines.cs +++ b/Tiles/Astral/AstralVines.cs @@ -31,4 +31,4 @@ namespace CalamityMod.Tiles.Astral } } } -} \ No newline at end of file +} diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index f6e870302b..cde1b714e6 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -1,142 +1,142 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.Graphics.Capture; - -namespace CalamityMod.Tiles -{ - public class AstralBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; - Main.tileBlockLight[Type] = true; - TileID.Sets.NeedsGrassFraming[Type] = true; - soundType = 21; - minPick = 150; - drop = mod.ItemType("AstralBrick"); - AddMapEntry(new Color(128, 128, 158)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("AstralBasic"), 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - int xPos = i % 2; - int yPos = j % 2; - int uniqueAnimationFrameX = 0; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 3; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * 288; - } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - int xOffset = 0; - int relativeXPos = i % 2; - int relativeYPos = j % 2; - switch (relativeXPos) - { - case 0: - switch (relativeYPos) - { - case 0: - xOffset = 0; - break; - case 1: - xOffset = 1; - break; - default: - xOffset = 0; - break; - } - break; - case 1: - switch (relativeYPos) - { - case 0: - xOffset = 1; - break; - case 1: - xOffset = 3; - break; - default: - xOffset = 0; - break; - } - break; - } - xOffset = xOffset * 288; - xPos += xOffset; - Texture2D glowmask = mod.GetTexture("Tiles/AstralBrick_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(50, 50, 50, 50), - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - } - - /// - /// Gets the offset in both axes that should be used for drawing the additions to the tile - /// - /// The pixel draw offset of the postdrawn sprite in both axes - private int GetDrawOffset() - { - int drawOffset = 0; - if (Main.screenWidth < 1664f) - { - drawOffset = 193; - } - else - { - drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); - } - return (drawOffset - 1); - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Terraria.Graphics.Capture; + +namespace CalamityMod.Tiles +{ + public class AstralBrick : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; + TileID.Sets.NeedsGrassFraming[Type] = true; + soundType = 21; + minPick = 150; + drop = mod.ItemType("AstralBrick"); + AddMapEntry(new Color(128, 128, 158)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("AstralBasic"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 2; + int yPos = j % 2; + int uniqueAnimationFrameX = 0; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 3; + break; + } + break; + } + frameXOffset = uniqueAnimationFrameX * 288; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + int xOffset = 0; + int relativeXPos = i % 2; + int relativeYPos = j % 2; + switch (relativeXPos) + { + case 0: + switch (relativeYPos) + { + case 0: + xOffset = 0; + break; + case 1: + xOffset = 1; + break; + default: + xOffset = 0; + break; + } + break; + case 1: + switch (relativeYPos) + { + case 0: + xOffset = 1; + break; + case 1: + xOffset = 3; + break; + default: + xOffset = 0; + break; + } + break; + } + xOffset = xOffset * 288; + xPos += xOffset; + Texture2D glowmask = mod.GetTexture("Tiles/AstralBrick_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(50, 50, 50, 50), + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + } + + /// + /// Gets the offset in both axes that should be used for drawing the additions to the tile + /// + /// The pixel draw offset of the postdrawn sprite in both axes + private int GetDrawOffset() + { + int drawOffset = 0; + if (Main.screenWidth < 1664f) + { + drawOffset = 193; + } + else + { + drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); + } + return (drawOffset - 1); + } + } +} diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index 95c517b064..7b62edc318 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -62,4 +62,4 @@ namespace CalamityMod.Tiles.AstralDesert return CalamityMod.AstralCactusTexture; } } -} \ No newline at end of file +} diff --git a/Tiles/AstralDesert/AstralSandstone.cs b/Tiles/AstralDesert/AstralSandstone.cs index f7e92234b5..65e54152d9 100644 --- a/Tiles/AstralDesert/AstralSandstone.cs +++ b/Tiles/AstralDesert/AstralSandstone.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Tiles.AstralDesert num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/AstralDesert/HardenedAstralSand.cs b/Tiles/AstralDesert/HardenedAstralSand.cs index 47d36c8153..ef0dc2a468 100644 --- a/Tiles/AstralDesert/HardenedAstralSand.cs +++ b/Tiles/AstralDesert/HardenedAstralSand.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Tiles.AstralDesert num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/AstralMonolith.cs b/Tiles/AstralMonolith.cs index bafe99a559..f93fc3835e 100644 --- a/Tiles/AstralMonolith.cs +++ b/Tiles/AstralMonolith.cs @@ -85,4 +85,4 @@ namespace CalamityMod.Tiles return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/AstralSnow/AstralIce.cs b/Tiles/AstralSnow/AstralIce.cs index 074f6333aa..2ab211c5a9 100644 --- a/Tiles/AstralSnow/AstralIce.cs +++ b/Tiles/AstralSnow/AstralIce.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Tiles.AstralSnow base.FloorVisuals(player); } } -} \ No newline at end of file +} diff --git a/Tiles/AuricOre.cs b/Tiles/AuricOre.cs index cc2dc65fef..7e5e174532 100644 --- a/Tiles/AuricOre.cs +++ b/Tiles/AuricOre.cs @@ -1,46 +1,46 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Tiles -{ - public class AuricOre : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileValue[Type] = 810; - dustType = 55; - drop = mod.ItemType("AuricOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Auric Ore"); - AddMapEntry(new Color(255, 200, 0), name); - mineResist = 10f; - minPick = 275; - soundType = 21; - Main.tileSpelunker[Type] = true; - } - - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedYharon; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.20f; - g = 0.16f; - b = 0.00f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Tiles +{ + public class AuricOre : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 810; + dustType = 55; + drop = mod.ItemType("AuricOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Auric Ore"); + AddMapEntry(new Color(255, 200, 0), name); + mineResist = 10f; + minPick = 275; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedYharon; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.20f; + g = 0.16f; + b = 0.00f; + } + } +} diff --git a/Tiles/BlueCandle.cs b/Tiles/BlueCandle.cs index 4d919c90d1..7d4c56ddda 100644 --- a/Tiles/BlueCandle.cs +++ b/Tiles/BlueCandle.cs @@ -1,55 +1,55 @@ -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 BlueCandle : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Weightless Candle"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 34; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("BlueSpeedCandle"), 20); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.35f; - g = 0.55f; - b = 0.85f; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BlueCandle")); - } - } -} +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 BlueCandle : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Weightless Candle"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 34; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("BlueSpeedCandle"), 20); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.35f; + g = 0.55f; + b = 0.85f; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BlueCandle")); + } + } +} diff --git a/Tiles/BossTrophy.cs b/Tiles/BossTrophy.cs index ab8294331b..689571c8ae 100644 --- a/Tiles/BossTrophy.cs +++ b/Tiles/BossTrophy.cs @@ -1,106 +1,106 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class BossTrophy : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.addTile(Type); - dustType = 7; - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Trophy"); - AddMapEntry(new Color(120, 85, 60), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - int item = 0; - switch (frameX / 54) - { - case 0: - item = mod.ItemType("DesertScourgeTrophy"); - break; - case 1: - item = mod.ItemType("PerforatorTrophy"); - break; - case 2: - item = mod.ItemType("SlimeGodTrophy"); - break; - case 3: - item = mod.ItemType("CryogenTrophy"); - break; - case 4: - item = mod.ItemType("PlaguebringerGoliathTrophy"); - break; - case 5: - item = mod.ItemType("LeviathanTrophy"); - break; - case 6: - item = mod.ItemType("ProvidenceTrophy"); - break; - case 7: - item = mod.ItemType("CalamitasTrophy"); - break; - case 8: - item = mod.ItemType("HiveMindTrophy"); - break; - case 9: - item = mod.ItemType("CrabulonTrophy"); - break; - case 10: - item = mod.ItemType("YharonTrophy"); - break; - case 11: - item = mod.ItemType("SignusTrophy"); - break; - case 12: - item = mod.ItemType("WeaverTrophy"); - break; - case 13: - item = mod.ItemType("CeaselessVoidTrophy"); - break; - case 14: - item = mod.ItemType("DevourerofGodsTrophy"); - break; - case 15: - item = mod.ItemType("CatastropheTrophy"); - break; - case 16: - item = mod.ItemType("CataclysmTrophy"); - break; - case 17: - item = mod.ItemType("PolterghastTrophy"); - break; - case 18: - item = mod.ItemType("BumblebirbTrophy"); - break; - case 19: - item = mod.ItemType("AstrageldonTrophy"); - break; - case 20: - item = mod.ItemType("AstrumDeusTrophy"); - break; - case 21: - item = mod.ItemType("BrimstoneElementalTrophy"); - break; - case 22: - item = mod.ItemType("RavagerTrophy"); - break; - } - if (item > 0) - { - Item.NewItem(i * 16, j * 16, 48, 48, item); - } - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class BossTrophy : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.addTile(Type); + dustType = 7; + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Trophy"); + AddMapEntry(new Color(120, 85, 60), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + int item = 0; + switch (frameX / 54) + { + case 0: + item = mod.ItemType("DesertScourgeTrophy"); + break; + case 1: + item = mod.ItemType("PerforatorTrophy"); + break; + case 2: + item = mod.ItemType("SlimeGodTrophy"); + break; + case 3: + item = mod.ItemType("CryogenTrophy"); + break; + case 4: + item = mod.ItemType("PlaguebringerGoliathTrophy"); + break; + case 5: + item = mod.ItemType("LeviathanTrophy"); + break; + case 6: + item = mod.ItemType("ProvidenceTrophy"); + break; + case 7: + item = mod.ItemType("CalamitasTrophy"); + break; + case 8: + item = mod.ItemType("HiveMindTrophy"); + break; + case 9: + item = mod.ItemType("CrabulonTrophy"); + break; + case 10: + item = mod.ItemType("YharonTrophy"); + break; + case 11: + item = mod.ItemType("SignusTrophy"); + break; + case 12: + item = mod.ItemType("WeaverTrophy"); + break; + case 13: + item = mod.ItemType("CeaselessVoidTrophy"); + break; + case 14: + item = mod.ItemType("DevourerofGodsTrophy"); + break; + case 15: + item = mod.ItemType("CatastropheTrophy"); + break; + case 16: + item = mod.ItemType("CataclysmTrophy"); + break; + case 17: + item = mod.ItemType("PolterghastTrophy"); + break; + case 18: + item = mod.ItemType("BumblebirbTrophy"); + break; + case 19: + item = mod.ItemType("AstrageldonTrophy"); + break; + case 20: + item = mod.ItemType("AstrumDeusTrophy"); + break; + case 21: + item = mod.ItemType("BrimstoneElementalTrophy"); + break; + case 22: + item = mod.ItemType("RavagerTrophy"); + break; + } + if (item > 0) + { + Item.NewItem(i * 16, j * 16, 48, 48, item); + } + } + } +} diff --git a/Tiles/BrimstoneSlag.cs b/Tiles/BrimstoneSlag.cs index 7c15659f35..aa65723791 100644 --- a/Tiles/BrimstoneSlag.cs +++ b/Tiles/BrimstoneSlag.cs @@ -1,42 +1,42 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class BrimstoneSlag : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileLighted[Type] = false; - drop = mod.ItemType("BrimstoneSlag"); - mineResist = 6f; - minPick = 180; - dustType = 53; - soundType = 21; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Brimstone Slag"); - AddMapEntry(new Color(20, 20, 20), name); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override bool CanExplode(int i, int j) - { - return false; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.50f; - g = 0.00f; - b = 0.00f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class BrimstoneSlag : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLighted[Type] = false; + drop = mod.ItemType("BrimstoneSlag"); + mineResist = 6f; + minPick = 180; + dustType = 53; + soundType = 21; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Brimstone Slag"); + AddMapEntry(new Color(20, 20, 20), name); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.50f; + g = 0.00f; + b = 0.00f; + } + } +} diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index ad43cca3c2..2154517566 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -1,556 +1,556 @@ -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.ModLoader; -using CalamityMod.World; -using CalamityMod.NPCs; - -namespace CalamityMod.Tiles -{ - public class CalamityGlobalTile : GlobalTile - { - public static ushort[] PlantTypes = new ushort[] - { - TileID.Plants, - TileID.CorruptPlants, - TileID.JunglePlants, - TileID.MushroomPlants, - TileID.Plants2, - TileID.JunglePlants2, - TileID.HallowedPlants, - TileID.HallowedPlants2, - TileID.FleshWeeds, - (ushort)CalamityMod.Instance.TileType("AstralShortPlants"), - (ushort)CalamityMod.Instance.TileType("AstralTallPlants") - }; - - public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) - { - for (int k = 0; k < PlantTypes.Length; k++) - { - if (PlantTypes[k] == type) - { - CustomTileFraming.CheckPlants(i, j); - return false; - } - } - if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == mod.TileType("AstralVines")) - { - CustomTileFraming.VineFrame(i, j); - return false; - } - return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); - } - - public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) - { - Tile tile = Main.tile[i, j]; - - if (type == TileID.Cactus) - { - //GRABBING VARIABLES FOR CERTAIN THINGS - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - zero = Vector2.Zero; - //TESTING STUFF - int frameX = tile.frameX; - int frameY = tile.frameY; - bool astralCactus = false; - if (!Main.canDrawColorTile(i, j)) - { - int xTile = i; - if (frameX == 36) - { - xTile--; - } - if (frameX == 54) - { - xTile++; - } - if (frameX == 108) - { - if (frameY == 18) - { - xTile--; - } - else - { - xTile++; - } - } - int yTile = j; - bool flag = false; - if (Main.tile[xTile, yTile].type == 80 && Main.tile[xTile, yTile].active()) - { - flag = true; - } - while (!Main.tile[xTile, yTile].active() || !Main.tileSolid[(int)Main.tile[xTile, yTile].type] || !flag) - { - if (Main.tile[xTile, yTile].type == 80 && Main.tile[xTile, yTile].active()) - { - flag = true; - } - yTile++; - if (yTile > i + 20) - { - break; - } - } - //CACTUS CHECK - if (Main.tile[xTile, yTile].type == (ushort)mod.TileType("AstralSand")) - { - astralCactus = true; - } - } - //Draw Glow - if (astralCactus) - { - spriteBatch.Draw(CalamityMod.AstralCactusGlowTexture, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); - } - return; - } - } - - public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) - { - if (Main.tile[i, j].type != mod.TileType("LumenylCrystals") && Main.tile[i, j].type != mod.TileType("SeaPrismCrystals") && Main.tileSolid[Main.tile[i, j].type]) - { - if (Main.tile[i + 1, j] != null) - { - if (Main.tile[i + 1, j].active()) - { - if (Main.tile[i + 1, j].type == mod.TileType("LumenylCrystals") || (Main.tile[i + 1, j].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) - { - WorldGen.KillTile(i + 1, j, false, false, false); - if (!Main.tile[i + 1, j].active() && Main.netMode != 0) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i + 1, (float)j, 0f, 0, 0, 0); - } - } - } - } - if (Main.tile[i - 1, j] != null) - { - if (Main.tile[i - 1, j].active()) - { - if (Main.tile[i - 1, j].type == mod.TileType("LumenylCrystals") || (Main.tile[i - 1, j].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) - { - WorldGen.KillTile(i - 1, j, false, false, false); - if (!Main.tile[i - 1, j].active() && Main.netMode != 0) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i - 1, (float)j, 0f, 0, 0, 0); - } - } - } - } - if (Main.tile[i, j + 1] != null) - { - if (Main.tile[i, j + 1].active()) - { - if (Main.tile[i, j + 1].type == mod.TileType("LumenylCrystals") || (Main.tile[i, j + 1].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) - { - WorldGen.KillTile(i, j + 1, false, false, false); - if (!Main.tile[i, j + 1].active() && Main.netMode != 0) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); - } - } - } - } - if (Main.tile[i, j - 1] != null) - { - if (Main.tile[i, j - 1].active()) - { - if (Main.tile[i, j - 1].type == mod.TileType("LumenylCrystals") || (Main.tile[i, j - 1].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) - { - WorldGen.KillTile(i, j - 1, false, false, false); - if (!Main.tile[i, j - 1].active() && Main.netMode != 0) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j - 1, 0f, 0, 0, 0); - } - } - } - } - } - } - - public override bool Drop(int i, int j, int type) - { - if (type == 28) - { - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int abyssChasmSteps = y / 4; - int abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.055)); //132 = 1932 large - if (y < 1500) - { - abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.095)); //114 = 1014 small - } - else if (y < 2100) - { - abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.0735)); //132 = 1482 medium - } - int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); - - bool abyssPosX = false; - bool sulphurPosX = false; - bool abyssPosY = (j <= abyssChasmY); - if (CalamityWorld.abyssSide) - { - if (i < 380) - { - sulphurPosX = true; - } - if (i < abyssChasmX + 80) - { - abyssPosX = true; - } - } - else - { - if (i > Main.maxTilesX - 380) - { - sulphurPosX = true; - } - if (i > abyssChasmX - 80) - { - abyssPosX = true; - } - } - if (abyssPosX && abyssPosY) - { - if (Main.rand.Next(10) == 0) - { - int expr_B64 = WorldGen.genRand.Next(15); - if (expr_B64 == 0) - { - Item.NewItem(i * 16, j * 16, 16, 16, 296, 1, false, 0, false, false); - } - if (expr_B64 == 1) - { - Item.NewItem(i * 16, j * 16, 16, 16, 294, 1, false, 0, false, false); - } - if (expr_B64 == 2) - { - Item.NewItem(i * 16, j * 16, 16, 16, 298, 1, false, 0, false, false); - } - if (expr_B64 == 3) - { - Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); - } - if (expr_B64 == 4) - { - Item.NewItem(i * 16, j * 16, 16, 16, 288, 1, false, 0, false, false); - } - if (expr_B64 == 5) - { - Item.NewItem(i * 16, j * 16, 16, 16, 305, 1, false, 0, false, false); - } - if (expr_B64 == 6) - { - Item.NewItem(i * 16, j * 16, 16, 16, 289, 1, false, 0, false, false); - } - if (expr_B64 == 7) - { - Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); - } - if (expr_B64 == 8) - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AnechoicCoating"), 1, false, 0, false, false); - } - if (expr_B64 == 9) - { - Item.NewItem(i * 16, j * 16, 16, 16, 291, 1, false, 0, false, false); - } - if (expr_B64 == 10) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2346, 1, false, 0, false, false); - } - if (expr_B64 == 11) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2323, 1, false, 0, false, false); - } - if (expr_B64 == 12) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2327, 1, false, 0, false, false); - } - if (expr_B64 == 13) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2345, 1, false, 0, false, false); - } - if (expr_B64 == 14) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2348, 1, false, 0, false, false); - } - } - else - { - int num9 = Main.rand.Next(10); //0 to 9 - if (num9 == 0) //spelunker glowsticks - { - int num10 = Main.rand.Next(2, 6); - if (Main.expertMode) - { - num10 += Main.rand.Next(1, 7); - } - Item.NewItem(i * 16, j * 16, 16, 16, 3002, num10, false, 0, false, false); - } - else if (num9 == 1) //hellfire arrows - { - int stack = Main.rand.Next(10, 21); - Item.NewItem(i * 16, j * 16, 16, 16, 265, stack, false, 0, false, false); - } - else if (num9 == 2) //stew - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("SunkenStew"), 1, false, 0, false, false); - } - else if (num9 == 3) //sticky dynamite - { - Item.NewItem(i * 16, j * 16, 16, 16, 2896, 1, false, 0, false, false); - } - else //money - { - float num13 = (float)(5000 + WorldGen.genRand.Next(-100, 101)); - while ((int)num13 > 0) - { - if (num13 > 1000000f) - { - int num14 = (int)(num13 / 1000000f); - if (num14 > 50 && Main.rand.Next(2) == 0) - { - num14 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num14 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(1000000 * num14); - Item.NewItem(i * 16, j * 16, 16, 16, 74, num14, false, 0, false, false); - } - else if (num13 > 10000f) - { - int num15 = (int)(num13 / 10000f); - if (num15 > 50 && Main.rand.Next(2) == 0) - { - num15 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num15 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(10000 * num15); - Item.NewItem(i * 16, j * 16, 16, 16, 73, num15, false, 0, false, false); - } - else if (num13 > 100f) - { - int num16 = (int)(num13 / 100f); - if (num16 > 50 && Main.rand.Next(2) == 0) - { - num16 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num16 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(100 * num16); - Item.NewItem(i * 16, j * 16, 16, 16, 72, num16, false, 0, false, false); - } - else - { - int num17 = (int)num13; - if (num17 > 50 && Main.rand.Next(2) == 0) - { - num17 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num17 /= Main.rand.Next(4) + 1; - } - if (num17 < 1) - { - num17 = 1; - } - num13 -= (float)num17; - Item.NewItem(i * 16, j * 16, 16, 16, 71, num17, false, 0, false, false); - } - } - } - } - } - else if (sulphurPosX) - { - if (Main.rand.Next(15) == 0) - { - int expr_B64 = WorldGen.genRand.Next(15); - if (expr_B64 == 0) - { - Item.NewItem(i * 16, j * 16, 16, 16, 296, 1, false, 0, false, false); - } - if (expr_B64 == 1) - { - Item.NewItem(i * 16, j * 16, 16, 16, 294, 1, false, 0, false, false); - } - if (expr_B64 == 2) - { - Item.NewItem(i * 16, j * 16, 16, 16, 298, 1, false, 0, false, false); - } - if (expr_B64 == 3) - { - Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); - } - if (expr_B64 == 4) - { - Item.NewItem(i * 16, j * 16, 16, 16, 288, 1, false, 0, false, false); - } - if (expr_B64 == 5) - { - Item.NewItem(i * 16, j * 16, 16, 16, 305, 1, false, 0, false, false); - } - if (expr_B64 == 6) - { - Item.NewItem(i * 16, j * 16, 16, 16, 289, 1, false, 0, false, false); - } - if (expr_B64 == 7) - { - Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); - } - if (expr_B64 == 8) - { - Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AnechoicCoating"), 1, false, 0, false, false); - } - if (expr_B64 == 9) - { - Item.NewItem(i * 16, j * 16, 16, 16, 291, 1, false, 0, false, false); - } - if (expr_B64 == 10) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2346, 1, false, 0, false, false); - } - if (expr_B64 == 11) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2323, 1, false, 0, false, false); - } - if (expr_B64 == 12) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2327, 1, false, 0, false, false); - } - if (expr_B64 == 13) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2345, 1, false, 0, false, false); - } - if (expr_B64 == 14) - { - Item.NewItem(i * 16, j * 16, 16, 16, 2348, 1, false, 0, false, false); - } - } - else - { - int num9 = Main.rand.Next(10); //0 to 9 - if (num9 == 0) //glowsticks - { - int num10 = Main.rand.Next(2, 6); - if (Main.expertMode) - { - num10 += Main.rand.Next(1, 7); - } - Item.NewItem(i * 16, j * 16, 16, 16, 282, num10, false, 0, false, false); - } - else if (num9 == 1) //jesters arrows - { - int stack = Main.rand.Next(10, 21); - Item.NewItem(i * 16, j * 16, 16, 16, 51, stack, false, 0, false, false); - } - else if (num9 == 2) //potion - { - Item.NewItem(i * 16, j * 16, 16, 16, 188, 1, false, 0, false, false); - } - else if (num9 == 3) //bomb - { - int stack = Main.rand.Next(5, 9); - Item.NewItem(i * 16, j * 16, 16, 16, 166, 1, false, 0, false, false); - } - else //money - { - float num13 = (float)(2500 + WorldGen.genRand.Next(-100, 101)); - while ((int)num13 > 0) - { - if (num13 > 1000000f) - { - int num14 = (int)(num13 / 1000000f); - if (num14 > 50 && Main.rand.Next(2) == 0) - { - num14 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num14 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(1000000 * num14); - Item.NewItem(i * 16, j * 16, 16, 16, 74, num14, false, 0, false, false); - } - else if (num13 > 10000f) - { - int num15 = (int)(num13 / 10000f); - if (num15 > 50 && Main.rand.Next(2) == 0) - { - num15 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num15 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(10000 * num15); - Item.NewItem(i * 16, j * 16, 16, 16, 73, num15, false, 0, false, false); - } - else if (num13 > 100f) - { - int num16 = (int)(num13 / 100f); - if (num16 > 50 && Main.rand.Next(2) == 0) - { - num16 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num16 /= Main.rand.Next(3) + 1; - } - num13 -= (float)(100 * num16); - Item.NewItem(i * 16, j * 16, 16, 16, 72, num16, false, 0, false, false); - } - else - { - int num17 = (int)num13; - if (num17 > 50 && Main.rand.Next(2) == 0) - { - num17 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num17 /= Main.rand.Next(4) + 1; - } - if (num17 < 1) - { - num17 = 1; - } - num13 -= (float)num17; - Item.NewItem(i * 16, j * 16, 16, 16, 71, num17, false, 0, false, false); - } - } - } - } - } - } - return true; - } - - public override bool PreHitWire(int i, int j, int type) - { - return !CalamityWorld.bossRushActive; - } - } -} +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.ModLoader; +using CalamityMod.World; +using CalamityMod.NPCs; + +namespace CalamityMod.Tiles +{ + public class CalamityGlobalTile : GlobalTile + { + public static ushort[] PlantTypes = new ushort[] + { + TileID.Plants, + TileID.CorruptPlants, + TileID.JunglePlants, + TileID.MushroomPlants, + TileID.Plants2, + TileID.JunglePlants2, + TileID.HallowedPlants, + TileID.HallowedPlants2, + TileID.FleshWeeds, + (ushort)CalamityMod.Instance.TileType("AstralShortPlants"), + (ushort)CalamityMod.Instance.TileType("AstralTallPlants") + }; + + public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) + { + for (int k = 0; k < PlantTypes.Length; k++) + { + if (PlantTypes[k] == type) + { + CustomTileFraming.CheckPlants(i, j); + return false; + } + } + if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == mod.TileType("AstralVines")) + { + CustomTileFraming.VineFrame(i, j); + return false; + } + return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); + } + + public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + + if (type == TileID.Cactus) + { + //GRABBING VARIABLES FOR CERTAIN THINGS + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + zero = Vector2.Zero; + //TESTING STUFF + int frameX = tile.frameX; + int frameY = tile.frameY; + bool astralCactus = false; + if (!Main.canDrawColorTile(i, j)) + { + int xTile = i; + if (frameX == 36) + { + xTile--; + } + if (frameX == 54) + { + xTile++; + } + if (frameX == 108) + { + if (frameY == 18) + { + xTile--; + } + else + { + xTile++; + } + } + int yTile = j; + bool flag = false; + if (Main.tile[xTile, yTile].type == 80 && Main.tile[xTile, yTile].active()) + { + flag = true; + } + while (!Main.tile[xTile, yTile].active() || !Main.tileSolid[(int)Main.tile[xTile, yTile].type] || !flag) + { + if (Main.tile[xTile, yTile].type == 80 && Main.tile[xTile, yTile].active()) + { + flag = true; + } + yTile++; + if (yTile > i + 20) + { + break; + } + } + //CACTUS CHECK + if (Main.tile[xTile, yTile].type == (ushort)mod.TileType("AstralSand")) + { + astralCactus = true; + } + } + //Draw Glow + if (astralCactus) + { + spriteBatch.Draw(CalamityMod.AstralCactusGlowTexture, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + } + return; + } + } + + public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) + { + if (Main.tile[i, j].type != mod.TileType("LumenylCrystals") && Main.tile[i, j].type != mod.TileType("SeaPrismCrystals") && Main.tileSolid[Main.tile[i, j].type]) + { + if (Main.tile[i + 1, j] != null) + { + if (Main.tile[i + 1, j].active()) + { + if (Main.tile[i + 1, j].type == mod.TileType("LumenylCrystals") || (Main.tile[i + 1, j].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) + { + WorldGen.KillTile(i + 1, j, false, false, false); + if (!Main.tile[i + 1, j].active() && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i + 1, (float)j, 0f, 0, 0, 0); + } + } + } + } + if (Main.tile[i - 1, j] != null) + { + if (Main.tile[i - 1, j].active()) + { + if (Main.tile[i - 1, j].type == mod.TileType("LumenylCrystals") || (Main.tile[i - 1, j].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) + { + WorldGen.KillTile(i - 1, j, false, false, false); + if (!Main.tile[i - 1, j].active() && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i - 1, (float)j, 0f, 0, 0, 0); + } + } + } + } + if (Main.tile[i, j + 1] != null) + { + if (Main.tile[i, j + 1].active()) + { + if (Main.tile[i, j + 1].type == mod.TileType("LumenylCrystals") || (Main.tile[i, j + 1].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) + { + WorldGen.KillTile(i, j + 1, false, false, false); + if (!Main.tile[i, j + 1].active() && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); + } + } + } + } + if (Main.tile[i, j - 1] != null) + { + if (Main.tile[i, j - 1].active()) + { + if (Main.tile[i, j - 1].type == mod.TileType("LumenylCrystals") || (Main.tile[i, j - 1].type == mod.TileType("SeaPrismCrystals") && CalamityWorld.downedDesertScourge)) + { + WorldGen.KillTile(i, j - 1, false, false, false); + if (!Main.tile[i, j - 1].active() && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j - 1, 0f, 0, 0, 0); + } + } + } + } + } + } + + public override bool Drop(int i, int j, int type) + { + if (type == 28) + { + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int abyssChasmSteps = y / 4; + int abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.055)); //132 = 1932 large + if (y < 1500) + { + abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.095)); //114 = 1014 small + } + else if (y < 2100) + { + abyssChasmY = ((y - abyssChasmSteps) + (int)((double)y * 0.0735)); //132 = 1482 medium + } + int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); + + bool abyssPosX = false; + bool sulphurPosX = false; + bool abyssPosY = (j <= abyssChasmY); + if (CalamityWorld.abyssSide) + { + if (i < 380) + { + sulphurPosX = true; + } + if (i < abyssChasmX + 80) + { + abyssPosX = true; + } + } + else + { + if (i > Main.maxTilesX - 380) + { + sulphurPosX = true; + } + if (i > abyssChasmX - 80) + { + abyssPosX = true; + } + } + if (abyssPosX && abyssPosY) + { + if (Main.rand.Next(10) == 0) + { + int expr_B64 = WorldGen.genRand.Next(15); + if (expr_B64 == 0) + { + Item.NewItem(i * 16, j * 16, 16, 16, 296, 1, false, 0, false, false); + } + if (expr_B64 == 1) + { + Item.NewItem(i * 16, j * 16, 16, 16, 294, 1, false, 0, false, false); + } + if (expr_B64 == 2) + { + Item.NewItem(i * 16, j * 16, 16, 16, 298, 1, false, 0, false, false); + } + if (expr_B64 == 3) + { + Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); + } + if (expr_B64 == 4) + { + Item.NewItem(i * 16, j * 16, 16, 16, 288, 1, false, 0, false, false); + } + if (expr_B64 == 5) + { + Item.NewItem(i * 16, j * 16, 16, 16, 305, 1, false, 0, false, false); + } + if (expr_B64 == 6) + { + Item.NewItem(i * 16, j * 16, 16, 16, 289, 1, false, 0, false, false); + } + if (expr_B64 == 7) + { + Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); + } + if (expr_B64 == 8) + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AnechoicCoating"), 1, false, 0, false, false); + } + if (expr_B64 == 9) + { + Item.NewItem(i * 16, j * 16, 16, 16, 291, 1, false, 0, false, false); + } + if (expr_B64 == 10) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2346, 1, false, 0, false, false); + } + if (expr_B64 == 11) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2323, 1, false, 0, false, false); + } + if (expr_B64 == 12) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2327, 1, false, 0, false, false); + } + if (expr_B64 == 13) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2345, 1, false, 0, false, false); + } + if (expr_B64 == 14) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2348, 1, false, 0, false, false); + } + } + else + { + int num9 = Main.rand.Next(10); //0 to 9 + if (num9 == 0) //spelunker glowsticks + { + int num10 = Main.rand.Next(2, 6); + if (Main.expertMode) + { + num10 += Main.rand.Next(1, 7); + } + Item.NewItem(i * 16, j * 16, 16, 16, 3002, num10, false, 0, false, false); + } + else if (num9 == 1) //hellfire arrows + { + int stack = Main.rand.Next(10, 21); + Item.NewItem(i * 16, j * 16, 16, 16, 265, stack, false, 0, false, false); + } + else if (num9 == 2) //stew + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("SunkenStew"), 1, false, 0, false, false); + } + else if (num9 == 3) //sticky dynamite + { + Item.NewItem(i * 16, j * 16, 16, 16, 2896, 1, false, 0, false, false); + } + else //money + { + float num13 = (float)(5000 + WorldGen.genRand.Next(-100, 101)); + while ((int)num13 > 0) + { + if (num13 > 1000000f) + { + int num14 = (int)(num13 / 1000000f); + if (num14 > 50 && Main.rand.Next(2) == 0) + { + num14 /= Main.rand.Next(3) + 1; + } + if (Main.rand.Next(2) == 0) + { + num14 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(1000000 * num14); + Item.NewItem(i * 16, j * 16, 16, 16, 74, num14, false, 0, false, false); + } + else if (num13 > 10000f) + { + int num15 = (int)(num13 / 10000f); + if (num15 > 50 && Main.rand.Next(2) == 0) + { + num15 /= Main.rand.Next(3) + 1; + } + if (Main.rand.Next(2) == 0) + { + num15 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(10000 * num15); + Item.NewItem(i * 16, j * 16, 16, 16, 73, num15, false, 0, false, false); + } + else if (num13 > 100f) + { + int num16 = (int)(num13 / 100f); + if (num16 > 50 && Main.rand.Next(2) == 0) + { + num16 /= Main.rand.Next(3) + 1; + } + if (Main.rand.Next(2) == 0) + { + num16 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(100 * num16); + Item.NewItem(i * 16, j * 16, 16, 16, 72, num16, false, 0, false, false); + } + else + { + int num17 = (int)num13; + if (num17 > 50 && Main.rand.Next(2) == 0) + { + num17 /= Main.rand.Next(3) + 1; + } + if (Main.rand.Next(2) == 0) + { + num17 /= Main.rand.Next(4) + 1; + } + if (num17 < 1) + { + num17 = 1; + } + num13 -= (float)num17; + Item.NewItem(i * 16, j * 16, 16, 16, 71, num17, false, 0, false, false); + } + } + } + } + } + else if (sulphurPosX) + { + if (Main.rand.Next(15) == 0) + { + int expr_B64 = WorldGen.genRand.Next(15); + if (expr_B64 == 0) + { + Item.NewItem(i * 16, j * 16, 16, 16, 296, 1, false, 0, false, false); + } + if (expr_B64 == 1) + { + Item.NewItem(i * 16, j * 16, 16, 16, 294, 1, false, 0, false, false); + } + if (expr_B64 == 2) + { + Item.NewItem(i * 16, j * 16, 16, 16, 298, 1, false, 0, false, false); + } + if (expr_B64 == 3) + { + Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); + } + if (expr_B64 == 4) + { + Item.NewItem(i * 16, j * 16, 16, 16, 288, 1, false, 0, false, false); + } + if (expr_B64 == 5) + { + Item.NewItem(i * 16, j * 16, 16, 16, 305, 1, false, 0, false, false); + } + if (expr_B64 == 6) + { + Item.NewItem(i * 16, j * 16, 16, 16, 289, 1, false, 0, false, false); + } + if (expr_B64 == 7) + { + Item.NewItem(i * 16, j * 16, 16, 16, 302, 1, false, 0, false, false); + } + if (expr_B64 == 8) + { + Item.NewItem(i * 16, j * 16, 16, 16, mod.ItemType("AnechoicCoating"), 1, false, 0, false, false); + } + if (expr_B64 == 9) + { + Item.NewItem(i * 16, j * 16, 16, 16, 291, 1, false, 0, false, false); + } + if (expr_B64 == 10) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2346, 1, false, 0, false, false); + } + if (expr_B64 == 11) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2323, 1, false, 0, false, false); + } + if (expr_B64 == 12) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2327, 1, false, 0, false, false); + } + if (expr_B64 == 13) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2345, 1, false, 0, false, false); + } + if (expr_B64 == 14) + { + Item.NewItem(i * 16, j * 16, 16, 16, 2348, 1, false, 0, false, false); + } + } + else + { + int num9 = Main.rand.Next(10); //0 to 9 + if (num9 == 0) //glowsticks + { + int num10 = Main.rand.Next(2, 6); + if (Main.expertMode) + { + num10 += Main.rand.Next(1, 7); + } + Item.NewItem(i * 16, j * 16, 16, 16, 282, num10, false, 0, false, false); + } + else if (num9 == 1) //jesters arrows + { + int stack = Main.rand.Next(10, 21); + Item.NewItem(i * 16, j * 16, 16, 16, 51, stack, false, 0, false, false); + } + else if (num9 == 2) //potion + { + Item.NewItem(i * 16, j * 16, 16, 16, 188, 1, false, 0, false, false); + } + else if (num9 == 3) //bomb + { + int stack = Main.rand.Next(5, 9); + Item.NewItem(i * 16, j * 16, 16, 16, 166, 1, false, 0, false, false); + } + else //money + { + float num13 = (float)(2500 + WorldGen.genRand.Next(-100, 101)); + while ((int)num13 > 0) + { + if (num13 > 1000000f) + { + int num14 = (int)(num13 / 1000000f); + if (num14 > 50 && Main.rand.Next(2) == 0) + { + num14 /= Main.rand.Next(3) + 1; + } + if (Main.rand.Next(2) == 0) + { + num14 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(1000000 * num14); + Item.NewItem(i * 16, j * 16, 16, 16, 74, num14, false, 0, false, false); + } + else if (num13 > 10000f) + { + int num15 = (int)(num13 / 10000f); + if (num15 > 50 && Main.rand.Next(2) == 0) + { + num15 /= Main.rand.Next(3) + 1; + } + if (Main.rand.Next(2) == 0) + { + num15 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(10000 * num15); + Item.NewItem(i * 16, j * 16, 16, 16, 73, num15, false, 0, false, false); + } + else if (num13 > 100f) + { + int num16 = (int)(num13 / 100f); + if (num16 > 50 && Main.rand.Next(2) == 0) + { + num16 /= Main.rand.Next(3) + 1; + } + if (Main.rand.Next(2) == 0) + { + num16 /= Main.rand.Next(3) + 1; + } + num13 -= (float)(100 * num16); + Item.NewItem(i * 16, j * 16, 16, 16, 72, num16, false, 0, false, false); + } + else + { + int num17 = (int)num13; + if (num17 > 50 && Main.rand.Next(2) == 0) + { + num17 /= Main.rand.Next(3) + 1; + } + if (Main.rand.Next(2) == 0) + { + num17 /= Main.rand.Next(4) + 1; + } + if (num17 < 1) + { + num17 = 1; + } + num13 -= (float)num17; + Item.NewItem(i * 16, j * 16, 16, 16, 71, num17, false, 0, false, false); + } + } + } + } + } + } + return true; + } + + public override bool PreHitWire(int i, int j, int type) + { + return !CalamityWorld.bossRushActive; + } + } +} diff --git a/Tiles/ChaosCandle.cs b/Tiles/ChaosCandle.cs index 63a388cadc..055c6274a9 100644 --- a/Tiles/ChaosCandle.cs +++ b/Tiles/ChaosCandle.cs @@ -1,65 +1,65 @@ -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 ChaosCandle : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.StyleOnTable1x1); - TileObjectData.addTile(Type); - drop = mod.ItemType("ChaosCandle"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Chaos Candle"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 20; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 4) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("ChaosCandle"); - } - - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("ChaosCandle"), 20); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.85f; - g = 0.25f; - b = 0.25f; - } - - /*public override void RightClick(int i, int j) - { - Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("ChaosCandle")); - ?? KillTile( i, j); - }*/ - } -} +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 ChaosCandle : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.StyleOnTable1x1); + TileObjectData.addTile(Type); + drop = mod.ItemType("ChaosCandle"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Chaos Candle"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 20; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 4) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("ChaosCandle"); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("ChaosCandle"), 20); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.85f; + g = 0.25f; + b = 0.25f; + } + + /*public override void RightClick(int i, int j) + { + Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("ChaosCandle")); + ?? KillTile( i, j); + }*/ + } +} diff --git a/Tiles/ChaoticBrick.cs b/Tiles/ChaoticBrick.cs index 304762d615..5444bca4a3 100644 --- a/Tiles/ChaoticBrick.cs +++ b/Tiles/ChaoticBrick.cs @@ -1,36 +1,36 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class ChaoticBrick : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileSolid[Type] = true; - Main.tileBlendAll[this.Type] = true; - Main.tileBlockLight[Type] = true; - dustType = 105; - drop = mod.ItemType("ChaoticBrick"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Chaotic Brick"); - AddMapEntry(new Color(255, 0, 0), name); - soundType = 21; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.04f; - g = 0.00f; - b = 0.00f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class ChaoticBrick : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlendAll[this.Type] = true; + Main.tileBlockLight[Type] = true; + dustType = 105; + drop = mod.ItemType("ChaoticBrick"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Chaotic Brick"); + AddMapEntry(new Color(255, 0, 0), name); + soundType = 21; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.04f; + g = 0.00f; + b = 0.00f; + } + } +} diff --git a/Tiles/ChaoticOre.cs b/Tiles/ChaoticOre.cs index 2e72be167e..96d722b57d 100644 --- a/Tiles/ChaoticOre.cs +++ b/Tiles/ChaoticOre.cs @@ -1,74 +1,74 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class ChaoticOre : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - 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(); - name.SetDefault("Chaotic Ore"); - AddMapEntry(new Color(255, 0, 0), name); - mineResist = 4f; - minPick = 210; - soundType = 21; - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (!closer && j < Main.maxTilesY - 205) - { - if (Main.tile[i, j].liquid <= 0) - { - Main.tile[i, j].liquid = 255; - Main.tile[i, j].lava(false); - } - } - if (Main.gamePaused) - { - return; - } - if (closer && Main.rand.Next(300) == 0) - { - int tileLocationY = j + 1; - if (Main.tile[i, tileLocationY] != null) - { - if (!Main.tile[i, tileLocationY].active()) - { - if (Main.netMode != 1) - { - Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, 0.1f, mod.ProjectileType("LavaChunk"), 25, 2f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - - public override bool CanExplode(int i, int j) - { - return NPC.downedGolemBoss; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.04f; - g = 0.00f; - b = 0.00f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class ChaoticOre : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + 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(); + name.SetDefault("Chaotic Ore"); + AddMapEntry(new Color(255, 0, 0), name); + mineResist = 4f; + minPick = 210; + soundType = 21; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (!closer && j < Main.maxTilesY - 205) + { + if (Main.tile[i, j].liquid <= 0) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + if (Main.gamePaused) + { + return; + } + if (closer && Main.rand.Next(300) == 0) + { + int tileLocationY = j + 1; + if (Main.tile[i, tileLocationY] != null) + { + if (!Main.tile[i, tileLocationY].active()) + { + if (Main.netMode != 1) + { + Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, 0.1f, mod.ProjectileType("LavaChunk"), 25, 2f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + + public override bool CanExplode(int i, int j) + { + return NPC.downedGolemBoss; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.04f; + g = 0.00f; + b = 0.00f; + } + } +} diff --git a/Tiles/CharredOre.cs b/Tiles/CharredOre.cs index 58ea1bf6c8..6b406e5426 100644 --- a/Tiles/CharredOre.cs +++ b/Tiles/CharredOre.cs @@ -1,44 +1,44 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class CharredOre : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileLighted[Type] = true; - Main.tileValue[Type] = 710; - drop = mod.ItemType("CharredOre"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Charred Ore"); - AddMapEntry(new Color(128, 0, 0), name); - mineResist = 6f; - minPick = 200; - soundType = 21; - dustType = 235; - Main.tileSpelunker[Type] = true; - } - - public override bool CanExplode(int i, int j) - { - return NPC.downedPlantBoss; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 1.00f; - g = 0.00f; - b = 0.00f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class CharredOre : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLighted[Type] = true; + Main.tileValue[Type] = 710; + drop = mod.ItemType("CharredOre"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Charred Ore"); + AddMapEntry(new Color(128, 0, 0), name); + mineResist = 6f; + minPick = 200; + soundType = 21; + dustType = 235; + Main.tileSpelunker[Type] = true; + } + + public override bool CanExplode(int i, int j) + { + return NPC.downedPlantBoss; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 1.00f; + g = 0.00f; + b = 0.00f; + } + } +} diff --git a/Tiles/Cinderplate.cs b/Tiles/Cinderplate.cs index 1e824f8f67..5ecd72eff4 100644 --- a/Tiles/Cinderplate.cs +++ b/Tiles/Cinderplate.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class Cinderplate : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileValue[Type] = 750; - - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Cinderplate"); - AddMapEntry(new Color(97, 22, 57), name); - - drop = mod.ItemType("Cinderplate"); - base.SetDefaults(); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 2 : 4; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.19f; - g = 0.043f; - b = 0.111f; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class Cinderplate : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 750; + + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Cinderplate"); + AddMapEntry(new Color(97, 22, 57), name); + + drop = mod.ItemType("Cinderplate"); + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 2 : 4; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.19f; + g = 0.043f; + b = 0.111f; + } + } +} diff --git a/Tiles/CorruptionEffigy.cs b/Tiles/CorruptionEffigy.cs index 6a05198464..4b8d3d4a35 100644 --- a/Tiles/CorruptionEffigy.cs +++ b/Tiles/CorruptionEffigy.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Tiles Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CorruptionEffigy")); } } -} \ No newline at end of file +} diff --git a/Tiles/CrimsonEffigy.cs b/Tiles/CrimsonEffigy.cs index e78b9a1c83..72049880dc 100644 --- a/Tiles/CrimsonEffigy.cs +++ b/Tiles/CrimsonEffigy.cs @@ -35,4 +35,4 @@ namespace CalamityMod.Tiles Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CrimsonEffigy")); } } -} \ No newline at end of file +} diff --git a/Tiles/CryonicBrick.cs b/Tiles/CryonicBrick.cs index da80a5feed..991655f1e0 100644 --- a/Tiles/CryonicBrick.cs +++ b/Tiles/CryonicBrick.cs @@ -1,35 +1,35 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class CryonicBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - soundType = 21; - minPick = 100; - drop = mod.ItemType("CryonicBrick"); - AddMapEntry(new Color(99, 131, 199)); - animationFrameHeight = 270; - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 176, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - int xPos = i % 2; - int yPos = j % 4; - frameXOffset = xPos * 288; - frameYOffset = yPos * animationFrameHeight; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class CryonicBrick : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + soundType = 21; + minPick = 100; + drop = mod.ItemType("CryonicBrick"); + AddMapEntry(new Color(99, 131, 199)); + animationFrameHeight = 270; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 176, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 2; + int yPos = j % 4; + frameXOffset = xPos * 288; + frameYOffset = yPos * animationFrameHeight; + } + } +} diff --git a/Tiles/CryonicOre.cs b/Tiles/CryonicOre.cs index 54801928b9..61a8c48101 100644 --- a/Tiles/CryonicOre.cs +++ b/Tiles/CryonicOre.cs @@ -1,46 +1,46 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Tiles -{ - public class CryonicOre : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - 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(); - name.SetDefault("Cryonic Ore"); - AddMapEntry(new Color(0, 0, 150), name); - mineResist = 3f; - minPick = 180; - soundType = 21; - Main.tileSpelunker[Type] = true; - } - - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedCryogen; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.02f; - g = 0.02f; - b = 0.06f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Tiles +{ + public class CryonicOre : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + 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(); + name.SetDefault("Cryonic Ore"); + AddMapEntry(new Color(0, 0, 150), name); + mineResist = 3f; + minPick = 180; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedCryogen; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.02f; + g = 0.02f; + b = 0.06f; + } + } +} diff --git a/Tiles/DraedonsForge.cs b/Tiles/DraedonsForge.cs index 2f7e27da5d..ba1d022c81 100644 --- a/Tiles/DraedonsForge.cs +++ b/Tiles/DraedonsForge.cs @@ -1,54 +1,54 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class DraedonsForge : ModTile - { - public override void SetDefaults() - { - animationFrameHeight = 36; - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Draedon's Forge"); - AddMapEntry(new Color(0, 255, 0), name); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Anvils, TileID.Furnaces, TileID.WorkBenches, TileID.LunarCraftingStation, - TileID.MythrilAnvil, TileID.AdamantiteForge, TileID.Hellforge }; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("DraedonsForge")); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = (float)Main.DiscoR / 255f; - g = (float)Main.DiscoG / 255f; - b = (float)Main.DiscoB / 255f; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter > 12) - { - frameCounter = 0; - frame++; - if (frame > 3) - { - frame = 0; - } - } - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class DraedonsForge : ModTile + { + public override void SetDefaults() + { + animationFrameHeight = 36; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.CoordinateHeights = new int[]{ 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Draedon's Forge"); + AddMapEntry(new Color(0, 255, 0), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Anvils, TileID.Furnaces, TileID.WorkBenches, TileID.LunarCraftingStation, + TileID.MythrilAnvil, TileID.AdamantiteForge, TileID.Hellforge }; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("DraedonsForge")); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = (float)Main.DiscoR / 255f; + g = (float)Main.DiscoG / 255f; + b = (float)Main.DiscoB / 255f; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter > 12) + { + frameCounter = 0; + frame++; + if (frame > 3) + { + frame = 0; + } + } + } + } +} diff --git a/Tiles/ExodiumOre.cs b/Tiles/ExodiumOre.cs index 446ce96f90..dd899e5060 100644 --- a/Tiles/ExodiumOre.cs +++ b/Tiles/ExodiumOre.cs @@ -1,37 +1,37 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class ExodiumOre : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Exodium Ore"); - AddMapEntry(new Color(51, 48, 68), name); - mineResist = 5f; - minPick = 225; - soundType = 21; - Main.tileValue[Type] = 760; - Main.tileSpelunker[Type] = true; - drop = mod.ItemType("ExodiumClusterOre"); - base.SetDefaults(); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 2 : 4; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class ExodiumOre : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Exodium Ore"); + AddMapEntry(new Color(51, 48, 68), name); + mineResist = 5f; + minPick = 225; + soundType = 21; + Main.tileValue[Type] = 760; + Main.tileSpelunker[Type] = true; + drop = mod.ItemType("ExodiumClusterOre"); + base.SetDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 2 : 4; + } + } +} diff --git a/Tiles/FurnitureAbyss/AbyssBed.cs b/Tiles/FurnitureAbyss/AbyssBed.cs index 19d8cb73b7..398663b0fc 100644 --- a/Tiles/FurnitureAbyss/AbyssBed.cs +++ b/Tiles/FurnitureAbyss/AbyssBed.cs @@ -79,4 +79,4 @@ namespace CalamityMod.Tiles.FurnitureAbyss player.showItemIcon2 = mod.ItemType("AbyssBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAbyss/AbyssChair.cs b/Tiles/FurnitureAbyss/AbyssChair.cs index 588a53f3b5..d7534d8e09 100644 --- a/Tiles/FurnitureAbyss/AbyssChair.cs +++ b/Tiles/FurnitureAbyss/AbyssChair.cs @@ -49,4 +49,4 @@ namespace CalamityMod.Tiles.FurnitureAbyss Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AbyssChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAbyss/AbyssChest.cs b/Tiles/FurnitureAbyss/AbyssChest.cs index 66bce9fc2a..fec83cdeb0 100644 --- a/Tiles/FurnitureAbyss/AbyssChest.cs +++ b/Tiles/FurnitureAbyss/AbyssChest.cs @@ -203,4 +203,4 @@ namespace CalamityMod.Tiles.FurnitureAbyss } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAbyss/AbyssClock.cs b/Tiles/FurnitureAbyss/AbyssClock.cs index 9b92ecb7c2..25f5af4402 100644 --- a/Tiles/FurnitureAbyss/AbyssClock.cs +++ b/Tiles/FurnitureAbyss/AbyssClock.cs @@ -118,4 +118,4 @@ namespace CalamityMod.Tiles.FurnitureAbyss Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AbyssClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs index ec4728e88a..5c2a17e18b 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs @@ -76,4 +76,4 @@ namespace CalamityMod.Tiles.FurnitureAbyss player.showItemIcon2 = mod.ItemType("AbyssDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs index fe0575cdf0..f036ba9171 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs @@ -96,4 +96,4 @@ namespace CalamityMod.Tiles.FurnitureAbyss player.showItemIcon2 = mod.ItemType("AbyssDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAbyss/AbyssTorch.cs b/Tiles/FurnitureAbyss/AbyssTorch.cs index b4153a1acb..a980b8af9d 100644 --- a/Tiles/FurnitureAbyss/AbyssTorch.cs +++ b/Tiles/FurnitureAbyss/AbyssTorch.cs @@ -100,4 +100,4 @@ namespace CalamityMod.Tiles.FurnitureAbyss } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAbyss/AbyssWorkbench.cs b/Tiles/FurnitureAbyss/AbyssWorkbench.cs index d37200fe3e..27180da965 100644 --- a/Tiles/FurnitureAbyss/AbyssWorkbench.cs +++ b/Tiles/FurnitureAbyss/AbyssWorkbench.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Tiles.FurnitureAbyss Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AbyssWorkbench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs index 8c67aacdec..a125706de1 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravel.cs @@ -24,4 +24,4 @@ namespace CalamityMod.Tiles.FurnitureAbyss return false; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index 6f9957e46f..074e281934 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -51,4 +51,4 @@ namespace CalamityMod.Tiles.FurnitureAbyss num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAncient/AncientBed.cs b/Tiles/FurnitureAncient/AncientBed.cs index abe5998753..060c162052 100644 --- a/Tiles/FurnitureAncient/AncientBed.cs +++ b/Tiles/FurnitureAncient/AncientBed.cs @@ -80,4 +80,4 @@ namespace CalamityMod.Tiles.FurnitureAncient player.showItemIcon2 = mod.ItemType("AncientBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAncient/AncientChair.cs b/Tiles/FurnitureAncient/AncientChair.cs index 38605d3bf9..6627d1cdf2 100644 --- a/Tiles/FurnitureAncient/AncientChair.cs +++ b/Tiles/FurnitureAncient/AncientChair.cs @@ -51,4 +51,4 @@ namespace CalamityMod.Tiles.FurnitureAncient Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AncientChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAncient/AncientDoorClosed.cs b/Tiles/FurnitureAncient/AncientDoorClosed.cs index 83032193b8..6e31b33063 100644 --- a/Tiles/FurnitureAncient/AncientDoorClosed.cs +++ b/Tiles/FurnitureAncient/AncientDoorClosed.cs @@ -76,4 +76,4 @@ namespace CalamityMod.Tiles.FurnitureAncient player.showItemIcon2 = mod.ItemType("AncientDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAncient/AncientDoorOpen.cs b/Tiles/FurnitureAncient/AncientDoorOpen.cs index 0ad845f303..97ca227c7a 100644 --- a/Tiles/FurnitureAncient/AncientDoorOpen.cs +++ b/Tiles/FurnitureAncient/AncientDoorOpen.cs @@ -96,4 +96,4 @@ namespace CalamityMod.Tiles.FurnitureAncient player.showItemIcon2 = mod.ItemType("AncientDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAncient/AncientMonolith.cs b/Tiles/FurnitureAncient/AncientMonolith.cs index 675776fb33..730a518130 100644 --- a/Tiles/FurnitureAncient/AncientMonolith.cs +++ b/Tiles/FurnitureAncient/AncientMonolith.cs @@ -152,4 +152,4 @@ namespace CalamityMod.Tiles.FurnitureAncient Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("AncientMonolith")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAncient/AncientWorkbench.cs b/Tiles/FurnitureAncient/AncientWorkbench.cs index 16713ae189..8b4a316af1 100644 --- a/Tiles/FurnitureAncient/AncientWorkbench.cs +++ b/Tiles/FurnitureAncient/AncientWorkbench.cs @@ -44,4 +44,4 @@ namespace CalamityMod.Tiles.FurnitureAncient Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AncientWorkbench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/AshenBed.cs b/Tiles/FurnitureAshen/AshenBed.cs index 9b8199eddc..4fe2122bd4 100644 --- a/Tiles/FurnitureAshen/AshenBed.cs +++ b/Tiles/FurnitureAshen/AshenBed.cs @@ -80,4 +80,4 @@ namespace CalamityMod.Tiles.FurnitureAshen player.showItemIcon2 = mod.ItemType("AshenBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/AshenChair.cs b/Tiles/FurnitureAshen/AshenChair.cs index f92ad1d3de..64125c9525 100644 --- a/Tiles/FurnitureAshen/AshenChair.cs +++ b/Tiles/FurnitureAshen/AshenChair.cs @@ -51,4 +51,4 @@ namespace CalamityMod.Tiles.FurnitureAshen Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("AshenChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/AshenChest.cs b/Tiles/FurnitureAshen/AshenChest.cs index edb64dac6d..2d17693616 100644 --- a/Tiles/FurnitureAshen/AshenChest.cs +++ b/Tiles/FurnitureAshen/AshenChest.cs @@ -204,4 +204,4 @@ namespace CalamityMod.Tiles.FurnitureAshen } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/AshenChestLocked.cs b/Tiles/FurnitureAshen/AshenChestLocked.cs index 565e0f9aae..d4914855fd 100644 --- a/Tiles/FurnitureAshen/AshenChestLocked.cs +++ b/Tiles/FurnitureAshen/AshenChestLocked.cs @@ -206,4 +206,4 @@ namespace CalamityMod.Tiles.FurnitureAshen } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/AshenDoorClosed.cs b/Tiles/FurnitureAshen/AshenDoorClosed.cs index 10bad5da25..b1742c4e05 100644 --- a/Tiles/FurnitureAshen/AshenDoorClosed.cs +++ b/Tiles/FurnitureAshen/AshenDoorClosed.cs @@ -77,4 +77,4 @@ namespace CalamityMod.Tiles.FurnitureAshen player.showItemIcon2 = mod.ItemType("AshenDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/AshenDoorOpen.cs b/Tiles/FurnitureAshen/AshenDoorOpen.cs index 756364a0d4..6a427a77c7 100644 --- a/Tiles/FurnitureAshen/AshenDoorOpen.cs +++ b/Tiles/FurnitureAshen/AshenDoorOpen.cs @@ -96,4 +96,4 @@ namespace CalamityMod.Tiles.FurnitureAshen player.showItemIcon2 = mod.ItemType("AshenDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/AshenMonolith.cs b/Tiles/FurnitureAshen/AshenMonolith.cs index 2d2ac774a4..72ccf00907 100644 --- a/Tiles/FurnitureAshen/AshenMonolith.cs +++ b/Tiles/FurnitureAshen/AshenMonolith.cs @@ -288,4 +288,4 @@ namespace CalamityMod.Tiles.FurnitureAshen return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/AshenPlatform.cs b/Tiles/FurnitureAshen/AshenPlatform.cs index d432436217..04b800029a 100644 --- a/Tiles/FurnitureAshen/AshenPlatform.cs +++ b/Tiles/FurnitureAshen/AshenPlatform.cs @@ -53,4 +53,4 @@ namespace CalamityMod.Tiles.FurnitureAshen num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 27c91cd5ad..1ccd8330f1 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -664,4 +664,4 @@ namespace CalamityMod.Tiles.FurnitureAshen return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/AshenWorkbench.cs b/Tiles/FurnitureAshen/AshenWorkbench.cs index 0216838426..bd65fcf655 100644 --- a/Tiles/FurnitureAshen/AshenWorkbench.cs +++ b/Tiles/FurnitureAshen/AshenWorkbench.cs @@ -44,4 +44,4 @@ namespace CalamityMod.Tiles.FurnitureAshen Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("AshenWorkbench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs index ffe0bd8ed5..a8f003bb37 100644 --- a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -74,4 +74,4 @@ namespace CalamityMod.Tiles.FurnitureAshen return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureBotanic/BotanicBed.cs b/Tiles/FurnitureBotanic/BotanicBed.cs index cdca55c62a..b929f795ac 100644 --- a/Tiles/FurnitureBotanic/BotanicBed.cs +++ b/Tiles/FurnitureBotanic/BotanicBed.cs @@ -80,4 +80,4 @@ namespace CalamityMod.Tiles.FurnitureBotanic player.showItemIcon2 = mod.ItemType("BotanicBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureBotanic/BotanicChair.cs b/Tiles/FurnitureBotanic/BotanicChair.cs index f3c2961339..f7460ea307 100644 --- a/Tiles/FurnitureBotanic/BotanicChair.cs +++ b/Tiles/FurnitureBotanic/BotanicChair.cs @@ -51,4 +51,4 @@ namespace CalamityMod.Tiles.FurnitureBotanic Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("BotanicChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureBotanic/BotanicChest.cs b/Tiles/FurnitureBotanic/BotanicChest.cs index ca9a4c0f53..90242053ed 100644 --- a/Tiles/FurnitureBotanic/BotanicChest.cs +++ b/Tiles/FurnitureBotanic/BotanicChest.cs @@ -204,4 +204,4 @@ namespace CalamityMod.Tiles.FurnitureBotanic } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureBotanic/BotanicClock.cs b/Tiles/FurnitureBotanic/BotanicClock.cs index 9fcf173246..5aedc728a9 100644 --- a/Tiles/FurnitureBotanic/BotanicClock.cs +++ b/Tiles/FurnitureBotanic/BotanicClock.cs @@ -120,4 +120,4 @@ namespace CalamityMod.Tiles.FurnitureBotanic Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("BotanicClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureBotanic/BotanicDoorClosed.cs b/Tiles/FurnitureBotanic/BotanicDoorClosed.cs index 78afa679bb..633e27e495 100644 --- a/Tiles/FurnitureBotanic/BotanicDoorClosed.cs +++ b/Tiles/FurnitureBotanic/BotanicDoorClosed.cs @@ -77,4 +77,4 @@ namespace CalamityMod.Tiles.FurnitureBotanic player.showItemIcon2 = mod.ItemType("BotanicDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureBotanic/BotanicDoorOpen.cs b/Tiles/FurnitureBotanic/BotanicDoorOpen.cs index 4b2e953fd5..f74cdf4c88 100644 --- a/Tiles/FurnitureBotanic/BotanicDoorOpen.cs +++ b/Tiles/FurnitureBotanic/BotanicDoorOpen.cs @@ -97,4 +97,4 @@ namespace CalamityMod.Tiles.FurnitureBotanic player.showItemIcon2 = mod.ItemType("BotanicDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureBotanic/BotanicPlatform.cs b/Tiles/FurnitureBotanic/BotanicPlatform.cs index 4ba8062484..46bb0c94f4 100644 --- a/Tiles/FurnitureBotanic/BotanicPlatform.cs +++ b/Tiles/FurnitureBotanic/BotanicPlatform.cs @@ -53,4 +53,4 @@ namespace CalamityMod.Tiles.FurnitureBotanic num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureBotanic/BotanicWorkBench.cs b/Tiles/FurnitureBotanic/BotanicWorkBench.cs index 4c6b6c6f85..d5e93c13dc 100644 --- a/Tiles/FurnitureBotanic/BotanicWorkBench.cs +++ b/Tiles/FurnitureBotanic/BotanicWorkBench.cs @@ -44,4 +44,4 @@ namespace CalamityMod.Tiles.FurnitureBotanic Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("BotanicWorkBench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureCosmilite/CosmiliteBed.cs b/Tiles/FurnitureCosmilite/CosmiliteBed.cs index a29709fd8c..ba79460d2d 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBed.cs @@ -79,4 +79,4 @@ namespace CalamityMod.Tiles.FurnitureCosmilite player.showItemIcon2 = mod.ItemType("CosmiliteBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs index ffe27e65fc..56a361fba3 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs @@ -77,4 +77,4 @@ namespace CalamityMod.Tiles.FurnitureCosmilite return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureCosmilite/CosmiliteChair.cs b/Tiles/FurnitureCosmilite/CosmiliteChair.cs index effacde3e9..f920a50a40 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChair.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChair.cs @@ -50,4 +50,4 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("CosmiliteChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureCosmilite/CosmiliteChest.cs b/Tiles/FurnitureCosmilite/CosmiliteChest.cs index 9d2aefa119..032bb21cc3 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChest.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChest.cs @@ -204,4 +204,4 @@ namespace CalamityMod.Tiles.FurnitureCosmilite } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureCosmilite/CosmiliteClock.cs b/Tiles/FurnitureCosmilite/CosmiliteClock.cs index 3fac201263..a3ef35aa1c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteClock.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteClock.cs @@ -119,4 +119,4 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CosmiliteClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs index 099a5a450e..4f7cf0552d 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs @@ -76,4 +76,4 @@ namespace CalamityMod.Tiles.FurnitureCosmilite player.showItemIcon2 = mod.ItemType("CosmiliteDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs index 2cbcc60463..34f9878729 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs @@ -96,4 +96,4 @@ namespace CalamityMod.Tiles.FurnitureCosmilite player.showItemIcon2 = mod.ItemType("CosmiliteDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs index 4e2a2eb230..46f7b4898b 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs @@ -53,4 +53,4 @@ namespace CalamityMod.Tiles.FurnitureCosmilite num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs b/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs index a751d3f1bc..74fa62ff18 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Tiles.FurnitureCosmilite Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("CosmiliteWorkbench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureEutrophic/EutrophicBed.cs b/Tiles/FurnitureEutrophic/EutrophicBed.cs index 656464aedb..340c023a20 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBed.cs @@ -79,4 +79,4 @@ namespace CalamityMod.Tiles.FurnitureEutrophic player.showItemIcon2 = mod.ItemType("EutrophicBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureEutrophic/EutrophicChair.cs b/Tiles/FurnitureEutrophic/EutrophicChair.cs index d533c6dac3..13e4a121be 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChair.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChair.cs @@ -50,4 +50,4 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("EutrophicChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureEutrophic/EutrophicChest.cs b/Tiles/FurnitureEutrophic/EutrophicChest.cs index 95fec22eb5..91bce35b8c 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChest.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChest.cs @@ -203,4 +203,4 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureEutrophic/EutrophicClock.cs b/Tiles/FurnitureEutrophic/EutrophicClock.cs index d5a742af78..a97b015944 100644 --- a/Tiles/FurnitureEutrophic/EutrophicClock.cs +++ b/Tiles/FurnitureEutrophic/EutrophicClock.cs @@ -136,4 +136,4 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("EutrophicClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs b/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs index 5bff80a149..4f7dc9ac09 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs @@ -76,4 +76,4 @@ namespace CalamityMod.Tiles.FurnitureEutrophic player.showItemIcon2 = mod.ItemType("EutrophicDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs b/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs index 1f211b4da1..050a64b12d 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs +++ b/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs @@ -96,4 +96,4 @@ namespace CalamityMod.Tiles.FurnitureEutrophic player.showItemIcon2 = mod.ItemType("EutrophicDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs b/Tiles/FurnitureEutrophic/EutrophicPlatform.cs index aad2fae617..f0bdd23bfe 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Tiles/FurnitureEutrophic/EutrophicPlatform.cs @@ -52,4 +52,4 @@ namespace CalamityMod.Tiles.FurnitureEutrophic num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs b/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs index beeb29767a..a66ed9741a 100644 --- a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("EutrophicWorkBench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureEutrophic/SmoothNavystone.cs b/Tiles/FurnitureEutrophic/SmoothNavystone.cs index eda1ec8125..1b569fd782 100644 --- a/Tiles/FurnitureEutrophic/SmoothNavystone.cs +++ b/Tiles/FurnitureEutrophic/SmoothNavystone.cs @@ -23,4 +23,4 @@ namespace CalamityMod.Tiles.FurnitureEutrophic return false; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureOccult/OccultBed.cs b/Tiles/FurnitureOccult/OccultBed.cs index b105f3cae5..415a6ea3f8 100644 --- a/Tiles/FurnitureOccult/OccultBed.cs +++ b/Tiles/FurnitureOccult/OccultBed.cs @@ -80,4 +80,4 @@ namespace CalamityMod.Tiles.FurnitureOccult player.showItemIcon2 = mod.ItemType("OccultBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureOccult/OccultChair.cs b/Tiles/FurnitureOccult/OccultChair.cs index 7839369fbb..1a395238cf 100644 --- a/Tiles/FurnitureOccult/OccultChair.cs +++ b/Tiles/FurnitureOccult/OccultChair.cs @@ -51,4 +51,4 @@ namespace CalamityMod.Tiles.FurnitureOccult Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("OccultChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureOccult/OccultChest.cs b/Tiles/FurnitureOccult/OccultChest.cs index 060b91a666..e8a27074dd 100644 --- a/Tiles/FurnitureOccult/OccultChest.cs +++ b/Tiles/FurnitureOccult/OccultChest.cs @@ -204,4 +204,4 @@ namespace CalamityMod.Tiles.FurnitureOccult } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureOccult/OccultClock.cs b/Tiles/FurnitureOccult/OccultClock.cs index d8b66d6201..7aea0e240e 100644 --- a/Tiles/FurnitureOccult/OccultClock.cs +++ b/Tiles/FurnitureOccult/OccultClock.cs @@ -120,4 +120,4 @@ namespace CalamityMod.Tiles.FurnitureOccult Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("OccultClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureOccult/OccultDoorClosed.cs b/Tiles/FurnitureOccult/OccultDoorClosed.cs index ad39020593..43750ddf4e 100644 --- a/Tiles/FurnitureOccult/OccultDoorClosed.cs +++ b/Tiles/FurnitureOccult/OccultDoorClosed.cs @@ -77,4 +77,4 @@ namespace CalamityMod.Tiles.FurnitureOccult player.showItemIcon2 = mod.ItemType("OccultDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureOccult/OccultDoorOpen.cs b/Tiles/FurnitureOccult/OccultDoorOpen.cs index 64291a8891..c6b71dc4f4 100644 --- a/Tiles/FurnitureOccult/OccultDoorOpen.cs +++ b/Tiles/FurnitureOccult/OccultDoorOpen.cs @@ -97,4 +97,4 @@ namespace CalamityMod.Tiles.FurnitureOccult player.showItemIcon2 = mod.ItemType("OccultDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureOccult/OccultPlatform.cs b/Tiles/FurnitureOccult/OccultPlatform.cs index 52634552f2..d59370f6f5 100644 --- a/Tiles/FurnitureOccult/OccultPlatform.cs +++ b/Tiles/FurnitureOccult/OccultPlatform.cs @@ -53,4 +53,4 @@ namespace CalamityMod.Tiles.FurnitureOccult num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureOccult/OccultStone.cs b/Tiles/FurnitureOccult/OccultStone.cs index 0f21846b79..40d90b4849 100644 --- a/Tiles/FurnitureOccult/OccultStone.cs +++ b/Tiles/FurnitureOccult/OccultStone.cs @@ -584,4 +584,4 @@ namespace CalamityMod.Tiles.FurnitureOccult return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureOccult/OccultWorkbench.cs b/Tiles/FurnitureOccult/OccultWorkbench.cs index eaf7b629cc..18f49f41a9 100644 --- a/Tiles/FurnitureOccult/OccultWorkbench.cs +++ b/Tiles/FurnitureOccult/OccultWorkbench.cs @@ -44,4 +44,4 @@ namespace CalamityMod.Tiles.FurnitureOccult Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("OccultWorkBench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs index 70d878a4fc..0b613cab86 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs @@ -80,4 +80,4 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index d9d8788420..4f42aac31c 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -77,4 +77,4 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate player.showItemIcon2 = mod.ItemType("PlaguedPlateBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs index 8c70975fb6..1b95693d1a 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -49,4 +49,4 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PlaguedPlateChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs index bf1f049e9f..6c0bee73a5 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -203,4 +203,4 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } } } -} \ No newline at end of file +} diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs index 340276fd60..8f1b4ceef7 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -118,4 +118,4 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("PlaguedPlateClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs index c955087edb..dde6c97b2e 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs @@ -75,4 +75,4 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate player.showItemIcon2 = mod.ItemType("PlaguedPlateDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs index ad8fd8fdb6..eff750279d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs @@ -95,4 +95,4 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate player.showItemIcon2 = mod.ItemType("PlaguedPlateDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs index 66d1a43961..276c271903 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs @@ -52,4 +52,4 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Main.tileNoSunLight[Type] = false; } } -} \ No newline at end of file +} diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs index 4229036474..a26e30cfe8 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs @@ -42,4 +42,4 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("PlaguedPlateWorkbench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedBed.cs b/Tiles/FurnitureProfaned/ProfanedBed.cs index dd243346e0..d62170d741 100644 --- a/Tiles/FurnitureProfaned/ProfanedBed.cs +++ b/Tiles/FurnitureProfaned/ProfanedBed.cs @@ -79,4 +79,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned player.showItemIcon2 = mod.ItemType("ProfanedBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedChair.cs b/Tiles/FurnitureProfaned/ProfanedChair.cs index 390238a06a..49c98f91bb 100644 --- a/Tiles/FurnitureProfaned/ProfanedChair.cs +++ b/Tiles/FurnitureProfaned/ProfanedChair.cs @@ -50,4 +50,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("ProfanedChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedChest.cs b/Tiles/FurnitureProfaned/ProfanedChest.cs index b3cbb67a09..7256be202a 100644 --- a/Tiles/FurnitureProfaned/ProfanedChest.cs +++ b/Tiles/FurnitureProfaned/ProfanedChest.cs @@ -204,4 +204,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedClock.cs b/Tiles/FurnitureProfaned/ProfanedClock.cs index 4bfe77e6e3..8680a940aa 100644 --- a/Tiles/FurnitureProfaned/ProfanedClock.cs +++ b/Tiles/FurnitureProfaned/ProfanedClock.cs @@ -119,4 +119,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("ProfanedClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedCrystal.cs b/Tiles/FurnitureProfaned/ProfanedCrystal.cs index 00b24dd550..1259cd398b 100644 --- a/Tiles/FurnitureProfaned/ProfanedCrystal.cs +++ b/Tiles/FurnitureProfaned/ProfanedCrystal.cs @@ -32,4 +32,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned frameYOffset = (j % 3) * animationFrameHeight; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs index 3467cdc80b..e5ff62f9a2 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs @@ -76,4 +76,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned player.showItemIcon2 = mod.ItemType("ProfanedDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs index a0f38a254b..f31abeb618 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs @@ -96,4 +96,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned player.showItemIcon2 = mod.ItemType("ProfanedDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedPlatform.cs b/Tiles/FurnitureProfaned/ProfanedPlatform.cs index 600d892687..cd255b4161 100644 --- a/Tiles/FurnitureProfaned/ProfanedPlatform.cs +++ b/Tiles/FurnitureProfaned/ProfanedPlatform.cs @@ -53,4 +53,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned Main.tileNoSunLight[Type] = false; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedRock.cs b/Tiles/FurnitureProfaned/ProfanedRock.cs index 244066e6c9..1ff52bd914 100644 --- a/Tiles/FurnitureProfaned/ProfanedRock.cs +++ b/Tiles/FurnitureProfaned/ProfanedRock.cs @@ -255,4 +255,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedSlab.cs b/Tiles/FurnitureProfaned/ProfanedSlab.cs index 3de7c3f7de..51a615f76d 100644 --- a/Tiles/FurnitureProfaned/ProfanedSlab.cs +++ b/Tiles/FurnitureProfaned/ProfanedSlab.cs @@ -125,4 +125,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned // } //} } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/ProfanedWorkbench.cs b/Tiles/FurnitureProfaned/ProfanedWorkbench.cs index eab897b255..37621cc5a1 100644 --- a/Tiles/FurnitureProfaned/ProfanedWorkbench.cs +++ b/Tiles/FurnitureProfaned/ProfanedWorkbench.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("ProfanedWorkbench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs index cd0f57e650..a7e15fd036 100644 --- a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs @@ -34,4 +34,4 @@ namespace CalamityMod.Tiles.FurnitureProfaned frameYOffset = (j % 3) * animationFrameHeight; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureSilva/SilvaBed.cs b/Tiles/FurnitureSilva/SilvaBed.cs index 4a4aba3a73..c2c1963bc6 100644 --- a/Tiles/FurnitureSilva/SilvaBed.cs +++ b/Tiles/FurnitureSilva/SilvaBed.cs @@ -80,4 +80,4 @@ namespace CalamityMod.Tiles.FurnitureSilva player.showItemIcon2 = mod.ItemType("SilvaBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureSilva/SilvaChair.cs b/Tiles/FurnitureSilva/SilvaChair.cs index e7bebc4b34..8115ce8ad9 100644 --- a/Tiles/FurnitureSilva/SilvaChair.cs +++ b/Tiles/FurnitureSilva/SilvaChair.cs @@ -51,4 +51,4 @@ namespace CalamityMod.Tiles.FurnitureSilva Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("SilvaChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureSilva/SilvaChest.cs b/Tiles/FurnitureSilva/SilvaChest.cs index 368ce20386..d1a28f3967 100644 --- a/Tiles/FurnitureSilva/SilvaChest.cs +++ b/Tiles/FurnitureSilva/SilvaChest.cs @@ -204,4 +204,4 @@ namespace CalamityMod.Tiles.FurnitureSilva } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureSilva/SilvaClock.cs b/Tiles/FurnitureSilva/SilvaClock.cs index 6f1c5c4dd8..02f35c39a0 100644 --- a/Tiles/FurnitureSilva/SilvaClock.cs +++ b/Tiles/FurnitureSilva/SilvaClock.cs @@ -120,4 +120,4 @@ namespace CalamityMod.Tiles.FurnitureSilva Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("SilvaClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureSilva/SilvaCrystal.cs b/Tiles/FurnitureSilva/SilvaCrystal.cs index 3bb8bbecf7..4b078828a3 100644 --- a/Tiles/FurnitureSilva/SilvaCrystal.cs +++ b/Tiles/FurnitureSilva/SilvaCrystal.cs @@ -27,4 +27,4 @@ namespace CalamityMod.Tiles.FurnitureSilva return false; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureSilva/SilvaDoorClosed.cs b/Tiles/FurnitureSilva/SilvaDoorClosed.cs index 8da6d7f008..c9a3f1186f 100644 --- a/Tiles/FurnitureSilva/SilvaDoorClosed.cs +++ b/Tiles/FurnitureSilva/SilvaDoorClosed.cs @@ -77,4 +77,4 @@ namespace CalamityMod.Tiles.FurnitureSilva player.showItemIcon2 = mod.ItemType("SilvaDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureSilva/SilvaDoorOpen.cs b/Tiles/FurnitureSilva/SilvaDoorOpen.cs index 8a6a1e637c..5cb6721a06 100644 --- a/Tiles/FurnitureSilva/SilvaDoorOpen.cs +++ b/Tiles/FurnitureSilva/SilvaDoorOpen.cs @@ -97,4 +97,4 @@ namespace CalamityMod.Tiles.FurnitureSilva player.showItemIcon2 = mod.ItemType("SilvaDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureSilva/SilvaPlatform.cs b/Tiles/FurnitureSilva/SilvaPlatform.cs index 42d6680f8c..73dc37a770 100644 --- a/Tiles/FurnitureSilva/SilvaPlatform.cs +++ b/Tiles/FurnitureSilva/SilvaPlatform.cs @@ -53,4 +53,4 @@ namespace CalamityMod.Tiles.FurnitureSilva num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureSilva/SilvaWorkBench.cs b/Tiles/FurnitureSilva/SilvaWorkBench.cs index 066c5cf324..332682dfdf 100644 --- a/Tiles/FurnitureSilva/SilvaWorkBench.cs +++ b/Tiles/FurnitureSilva/SilvaWorkBench.cs @@ -44,4 +44,4 @@ namespace CalamityMod.Tiles.FurnitureSilva Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("SilvaWorkBench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStatigel/StatigelBed.cs b/Tiles/FurnitureStatigel/StatigelBed.cs index cbf0a4886e..45596c5bc2 100644 --- a/Tiles/FurnitureStatigel/StatigelBed.cs +++ b/Tiles/FurnitureStatigel/StatigelBed.cs @@ -78,4 +78,4 @@ namespace CalamityMod.Tiles.FurnitureStatigel player.showItemIcon2 = mod.ItemType("StatigelBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStatigel/StatigelBlock.cs b/Tiles/FurnitureStatigel/StatigelBlock.cs index c91bfa634d..a2809c16bf 100644 --- a/Tiles/FurnitureStatigel/StatigelBlock.cs +++ b/Tiles/FurnitureStatigel/StatigelBlock.cs @@ -21,4 +21,4 @@ namespace CalamityMod.Tiles.FurnitureStatigel return false; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStatigel/StatigelChair.cs b/Tiles/FurnitureStatigel/StatigelChair.cs index 8fa0d118d8..c11ce43b3e 100644 --- a/Tiles/FurnitureStatigel/StatigelChair.cs +++ b/Tiles/FurnitureStatigel/StatigelChair.cs @@ -49,4 +49,4 @@ namespace CalamityMod.Tiles.FurnitureStatigel Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StatigelChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStatigel/StatigelChest.cs b/Tiles/FurnitureStatigel/StatigelChest.cs index 72fe8c4dd4..c3c30028df 100644 --- a/Tiles/FurnitureStatigel/StatigelChest.cs +++ b/Tiles/FurnitureStatigel/StatigelChest.cs @@ -203,4 +203,4 @@ namespace CalamityMod.Tiles.FurnitureStatigel } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStatigel/StatigelClock.cs b/Tiles/FurnitureStatigel/StatigelClock.cs index b30b63f5a5..99ee00239d 100644 --- a/Tiles/FurnitureStatigel/StatigelClock.cs +++ b/Tiles/FurnitureStatigel/StatigelClock.cs @@ -117,4 +117,4 @@ namespace CalamityMod.Tiles.FurnitureStatigel Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("StatigelClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStatigel/StatigelDoorClosed.cs b/Tiles/FurnitureStatigel/StatigelDoorClosed.cs index 5ec1bf879a..f295d17c6e 100644 --- a/Tiles/FurnitureStatigel/StatigelDoorClosed.cs +++ b/Tiles/FurnitureStatigel/StatigelDoorClosed.cs @@ -75,4 +75,4 @@ namespace CalamityMod.Tiles.FurnitureStatigel player.showItemIcon2 = mod.ItemType("StatigelDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStatigel/StatigelDoorOpen.cs b/Tiles/FurnitureStatigel/StatigelDoorOpen.cs index 4694346f81..37dea2d8eb 100644 --- a/Tiles/FurnitureStatigel/StatigelDoorOpen.cs +++ b/Tiles/FurnitureStatigel/StatigelDoorOpen.cs @@ -95,4 +95,4 @@ namespace CalamityMod.Tiles.FurnitureStatigel player.showItemIcon2 = mod.ItemType("StatigelDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStatigel/StatigelPlatform.cs b/Tiles/FurnitureStatigel/StatigelPlatform.cs index a37f1988e2..a987ddb0dd 100644 --- a/Tiles/FurnitureStatigel/StatigelPlatform.cs +++ b/Tiles/FurnitureStatigel/StatigelPlatform.cs @@ -51,4 +51,4 @@ namespace CalamityMod.Tiles.FurnitureStatigel num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStatigel/StatigelWorkbench.cs b/Tiles/FurnitureStatigel/StatigelWorkbench.cs index e047f3ac8b..87ee9502fe 100644 --- a/Tiles/FurnitureStatigel/StatigelWorkbench.cs +++ b/Tiles/FurnitureStatigel/StatigelWorkbench.cs @@ -42,4 +42,4 @@ namespace CalamityMod.Tiles.FurnitureStatigel Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("StatigelWorkbench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStratus/StratusBed.cs b/Tiles/FurnitureStratus/StratusBed.cs index 10c8201332..50eee25444 100644 --- a/Tiles/FurnitureStratus/StratusBed.cs +++ b/Tiles/FurnitureStratus/StratusBed.cs @@ -78,4 +78,4 @@ namespace CalamityMod.Tiles.FurnitureStratus player.showItemIcon2 = mod.ItemType("StratusBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStratus/StratusBricks.cs b/Tiles/FurnitureStratus/StratusBricks.cs index 0fd5d4d096..fca0c3a1f8 100644 --- a/Tiles/FurnitureStratus/StratusBricks.cs +++ b/Tiles/FurnitureStratus/StratusBricks.cs @@ -77,4 +77,4 @@ namespace CalamityMod.Tiles.FurnitureStratus return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStratus/StratusChair.cs b/Tiles/FurnitureStratus/StratusChair.cs index 8e95f132d3..2784776140 100644 --- a/Tiles/FurnitureStratus/StratusChair.cs +++ b/Tiles/FurnitureStratus/StratusChair.cs @@ -50,4 +50,4 @@ namespace CalamityMod.Tiles.FurnitureStratus Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("StratusChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStratus/StratusChest.cs b/Tiles/FurnitureStratus/StratusChest.cs index 04cd26680f..bd85b9bf75 100644 --- a/Tiles/FurnitureStratus/StratusChest.cs +++ b/Tiles/FurnitureStratus/StratusChest.cs @@ -204,4 +204,4 @@ namespace CalamityMod.Tiles.FurnitureStratus } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStratus/StratusClock.cs b/Tiles/FurnitureStratus/StratusClock.cs index 432f13c7c2..14aa9062bf 100644 --- a/Tiles/FurnitureStratus/StratusClock.cs +++ b/Tiles/FurnitureStratus/StratusClock.cs @@ -119,4 +119,4 @@ namespace CalamityMod.Tiles.FurnitureStratus Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("StratusClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStratus/StratusDoorClosed.cs b/Tiles/FurnitureStratus/StratusDoorClosed.cs index c9a38d3bdd..9f2aaffd39 100644 --- a/Tiles/FurnitureStratus/StratusDoorClosed.cs +++ b/Tiles/FurnitureStratus/StratusDoorClosed.cs @@ -76,4 +76,4 @@ namespace CalamityMod.Tiles.FurnitureStratus player.showItemIcon2 = mod.ItemType("StratusDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStratus/StratusDoorOpen.cs b/Tiles/FurnitureStratus/StratusDoorOpen.cs index a43288b6da..4e935518a0 100644 --- a/Tiles/FurnitureStratus/StratusDoorOpen.cs +++ b/Tiles/FurnitureStratus/StratusDoorOpen.cs @@ -96,4 +96,4 @@ namespace CalamityMod.Tiles.FurnitureStratus player.showItemIcon2 = mod.ItemType("StratusDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStratus/StratusPlatform.cs b/Tiles/FurnitureStratus/StratusPlatform.cs index b256f0fc86..2bc3d1f3ca 100644 --- a/Tiles/FurnitureStratus/StratusPlatform.cs +++ b/Tiles/FurnitureStratus/StratusPlatform.cs @@ -53,4 +53,4 @@ namespace CalamityMod.Tiles.FurnitureStratus num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureStratus/StratusWorkbench.cs b/Tiles/FurnitureStratus/StratusWorkbench.cs index b5dc0a59a7..ac9025e9cc 100644 --- a/Tiles/FurnitureStratus/StratusWorkbench.cs +++ b/Tiles/FurnitureStratus/StratusWorkbench.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Tiles.FurnitureStratus Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("StratusWorkbench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.cs b/Tiles/FurnitureVoid/SmoothVoidstone.cs index 07a20c4ad7..b391fceab4 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstone.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstone.cs @@ -253,4 +253,4 @@ namespace CalamityMod.Tiles.FurnitureVoid return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs index d76962c5ec..629f7dc825 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs @@ -52,4 +52,4 @@ namespace CalamityMod.Tiles.FurnitureVoid num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/VoidBed.cs b/Tiles/FurnitureVoid/VoidBed.cs index bf2ebfd800..27eb51a7a7 100644 --- a/Tiles/FurnitureVoid/VoidBed.cs +++ b/Tiles/FurnitureVoid/VoidBed.cs @@ -79,4 +79,4 @@ namespace CalamityMod.Tiles.FurnitureVoid player.showItemIcon2 = mod.ItemType("VoidBed"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/VoidChair.cs b/Tiles/FurnitureVoid/VoidChair.cs index d356a7cb80..09eff605db 100644 --- a/Tiles/FurnitureVoid/VoidChair.cs +++ b/Tiles/FurnitureVoid/VoidChair.cs @@ -50,4 +50,4 @@ namespace CalamityMod.Tiles.FurnitureVoid Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidChair")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/VoidChest.cs b/Tiles/FurnitureVoid/VoidChest.cs index c823c5a287..42b3a15d62 100644 --- a/Tiles/FurnitureVoid/VoidChest.cs +++ b/Tiles/FurnitureVoid/VoidChest.cs @@ -203,4 +203,4 @@ namespace CalamityMod.Tiles.FurnitureVoid } } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/VoidClock.cs b/Tiles/FurnitureVoid/VoidClock.cs index c07d293d60..300ebcf758 100644 --- a/Tiles/FurnitureVoid/VoidClock.cs +++ b/Tiles/FurnitureVoid/VoidClock.cs @@ -129,4 +129,4 @@ namespace CalamityMod.Tiles.FurnitureVoid Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("VoidClock")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/VoidCondenser.cs b/Tiles/FurnitureVoid/VoidCondenser.cs index bd6815b4da..8052e262a2 100644 --- a/Tiles/FurnitureVoid/VoidCondenser.cs +++ b/Tiles/FurnitureVoid/VoidCondenser.cs @@ -51,4 +51,4 @@ namespace CalamityMod.Tiles.FurnitureVoid Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("VoidCondenser")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/VoidDoorClosed.cs b/Tiles/FurnitureVoid/VoidDoorClosed.cs index db786933bc..600d714d7c 100644 --- a/Tiles/FurnitureVoid/VoidDoorClosed.cs +++ b/Tiles/FurnitureVoid/VoidDoorClosed.cs @@ -76,4 +76,4 @@ namespace CalamityMod.Tiles.FurnitureVoid player.showItemIcon2 = mod.ItemType("VoidDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/VoidDoorOpen.cs b/Tiles/FurnitureVoid/VoidDoorOpen.cs index 7107b60701..4d4cfe625a 100644 --- a/Tiles/FurnitureVoid/VoidDoorOpen.cs +++ b/Tiles/FurnitureVoid/VoidDoorOpen.cs @@ -96,4 +96,4 @@ namespace CalamityMod.Tiles.FurnitureVoid player.showItemIcon2 = mod.ItemType("VoidDoor"); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/VoidWorkbench.cs b/Tiles/FurnitureVoid/VoidWorkbench.cs index d5e0ee616c..a1203c3a50 100644 --- a/Tiles/FurnitureVoid/VoidWorkbench.cs +++ b/Tiles/FurnitureVoid/VoidWorkbench.cs @@ -43,4 +43,4 @@ namespace CalamityMod.Tiles.FurnitureVoid Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("VoidWorkbench")); } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureVoid/VoidstoneSlab.cs b/Tiles/FurnitureVoid/VoidstoneSlab.cs index c88cab65f4..61e5ccfce5 100644 --- a/Tiles/FurnitureVoid/VoidstoneSlab.cs +++ b/Tiles/FurnitureVoid/VoidstoneSlab.cs @@ -196,4 +196,4 @@ namespace CalamityMod.Tiles.FurnitureVoid return (drawOffset - 1); } } -} \ No newline at end of file +} diff --git a/Tiles/LumenylCrystals.cs b/Tiles/LumenylCrystals.cs index 07a17daab1..69f0a7cf4e 100644 --- a/Tiles/LumenylCrystals.cs +++ b/Tiles/LumenylCrystals.cs @@ -1,72 +1,72 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class LumenylCrystals : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Lumenyl"); - AddMapEntry(new Color(0, 150, 200), name); +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class LumenylCrystals : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Lumenyl"); + AddMapEntry(new Color(0, 150, 200), name); soundType = 2; - soundStyle = 27; - dustType = 67; - drop = mod.ItemType("Lumenite"); - Main.tileSpelunker[Type] = true; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.00f; - g = 0.3f; - b = 0.4f; - } - - public override bool CanPlace(int i, int j) - { - if (Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - return true; - if (Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - return true; - if (Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - return true; - if (Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - return true; - return false; - } - - public override void PlaceInWorld(int i, int j, Item item) - { - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(0 * 18); - } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(1 * 18); - } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(2 * 18); - } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(3 * 18); - } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); - } - } -} \ No newline at end of file + soundStyle = 27; + dustType = 67; + drop = mod.ItemType("Lumenite"); + Main.tileSpelunker[Type] = true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.00f; + g = 0.3f; + b = 0.4f; + } + + public override bool CanPlace(int i, int j) + { + if (Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + return true; + if (Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + return true; + if (Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + return true; + if (Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + return true; + return false; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(0 * 18); + } + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(1 * 18); + } + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(2 * 18); + } + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(3 * 18); + } + Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + } + } +} diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 749899241b..a0fa2d758e 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -1,714 +1,714 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class MonsterBanner : ModTile - { - public override void SetDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleWrapLimit = 111; - TileObjectData.addTile(Type); - dustType = -1; - disableSmartCursor = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Banner"); - AddMapEntry(new Color(13, 88, 130), name); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - int style = frameX / 18; - string item; - switch (style) - { - case 0: - item = "AquaticParasiteBanner"; - break; - case 1: - item = "FlounderBanner"; - break; - case 2: - item = "GnasherBanner"; - break; - case 3: - item = "TrasherBanner"; - break; - case 4: - item = "CatfishBanner"; - break; - case 5: - item = "MaulerBanner"; - break; - case 6: - item = "AquaticSeekerBanner"; - break; - case 7: - item = "AquaticUrchinBanner"; - break; - case 8: - item = "FrogfishBanner"; - break; - case 9: - item = "MantisShrimpBanner"; - break; - case 10: - item = "AquaticAberrationBanner"; - break; - case 11: - item = "ParaseaBanner"; - break; - case 12: - item = "SeaUrchinBanner"; - break; - case 13: - item = "BoxJellyfishBanner"; - break; - case 14: - item = "MorayEelBanner"; - break; - case 15: - item = "DevilFishBanner"; - break; - case 16: - item = "CuttlefishBanner"; - break; - case 17: - item = "ToxicMinnowBanner"; - break; - case 18: - item = "ViperfishBanner"; - break; - case 19: - item = "LuminousCorvinaBanner"; - break; - case 20: - item = "GiantSquidBanner"; - break; - case 21: - item = "LaserfishBanner"; - break; - case 22: - item = "OarfishBanner"; - break; - case 23: - item = "ColossalSquidBanner"; - break; - case 24: - item = "MirageJellyBanner"; - break; - case 25: - item = "EidolistBanner"; - break; - case 26: - item = "GulperEelBanner"; - break; - case 27: - item = "EidolonWyrmJuvenileBanner"; - break; - case 28: - item = "BloatfishBanner"; - break; - case 29: - item = "BobbitWormBanner"; - break; - case 30: - item = "ChaoticPufferBanner"; - break; - case 31: - item = "AstralProbeBanner"; - break; - case 32: - item = "SmallSightseerBanner"; - break; - case 33: - item = "BigSightseerBanner"; - break; - case 34: - item = "AriesBanner"; - break; - case 35: - item = "AstralSlimeBanner"; - break; - case 36: - item = "AtlasBanner"; - break; - case 37: - item = "MantisBanner"; - break; - case 38: - item = "NovaBanner"; - break; - case 39: - item = "AstralachneaBanner"; - break; - case 40: - item = "HiveBanner"; - break; - case 41: - item = "StellarCullexBanner"; - break; - case 42: - item = "FusionFeederBanner"; - break; - case 43: - item = "HadarianBanner"; - break; - case 44: - item = "HeatSpiritBanner"; - break; - case 45: - item = "ScryllarBanner"; - break; - case 46: - item = "DespairStoneBanner"; - break; - case 47: - item = "SoulSlurperBanner"; - break; - case 48: - item = "ImpiousImmolatorBanner"; - break; - case 49: - item = "ScornEaterBanner"; - break; - case 50: - item = "ProfanedEnergyBanner"; - break; - case 51: - item = "WulfrumSlimeBanner"; - break; - case 52: - item = "WulfrumDroneBanner"; - break; - case 53: - item = "PitbullBanner"; - break; - case 54: - item = "BlightedEyeBanner"; - break; - case 55: - item = "CalamityEyeBanner"; - break; - case 56: - item = "SunskaterBanner"; - break; - case 57: - item = "ShockstormShuttleBanner"; - break; - case 58: - item = "CloudElementalBanner"; - break; - case 59: - item = "AngryDogBanner"; - break; - case 60: - item = "CryonBanner"; - break; - case 61: - item = "IceClasperBanner"; - break; - case 62: - item = "StormlionBanner"; - break; - case 63: - item = "CnidrionBanner"; - break; - case 64: - item = "SandTortoiseBanner"; - break; - case 65: - item = "GreatSandSharkBanner"; - break; - case 66: - item = "AmethystCrawlerBanner"; - break; - case 67: - item = "TopazCrawlerBanner"; - break; - case 68: - item = "SapphireCrawlerBanner"; - break; - case 69: - item = "EmeraldCrawlerBanner"; - break; - case 70: - item = "RubyCrawlerBanner"; - break; - case 71: - item = "DiamondCrawlerBanner"; - break; - case 72: - item = "AmberCrawlerBanner"; - break; - case 73: - item = "CrystalCrawlerBanner"; - break; - case 74: - item = "SunBatBanner"; - break; - case 75: - item = "CosmicElementalBanner"; - break; - case 76: - item = "EarthElementalBanner"; - break; - case 77: - item = "ArmoredDiggerBanner"; - break; - case 78: - item = "MelterBanner"; - break; - case 79: - item = "PestilentSlimeBanner"; - break; - case 80: - item = "PlagueshellBanner"; - break; - case 81: - item = "PlagueChargerBanner"; - break; - case 82: - item = "VirulingBanner"; - break; - case 83: - item = "PlaguebringerBanner"; - break; - case 84: - item = "PhantomSpiritBanner"; - break; - case 85: - item = "OverloadedSoldierBanner"; - break; - case 86: - item = "PhantomDebrisBanner"; - break; - case 87: - item = "BOHLDOHRBanner"; - break; - case 88: - item = "EbonianBlightSlimeBanner"; - break; - case 89: - item = "CrimulanBlightSlimeBanner"; - break; - case 90: - item = "AeroSlimeBanner"; - break; - case 91: - item = "CryoSlimeBanner"; - break; - case 92: - item = "PerennialSlimeBanner"; - break; - case 93: - item = "CharredSlimeBanner"; - break; - case 94: - item = "BloomSlimeBanner"; - break; - case 95: - item = "CultistAssassinBanner"; - break; - case 96: - item = "ReaperSharkBanner"; - break; - case 97: - item = "IrradiatedSlimeBanner"; - break; - case 98: - item = "PrismTurtleBanner"; - break; - case 99: - item = "ClamBanner"; - break; - case 100: - item = "EutrophicRayBanner"; - break; - case 101: - item = "GhostBellBanner"; - break; - case 102: - item = "GhostBellSmallBanner"; - break; - case 103: - item = "SeaFloatyBanner"; - break; - case 104: - item = "BlindedAnglerBanner"; - break; - case 105: - item = "SeaMinnowBanner"; - break; - case 106: - item = "SeaSerpentBanner"; - break; - case 107: - item = "GiantClamBanner"; - break; - default: - return; - } - Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType(item)); - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - Player player = Main.LocalPlayer; - int style = Main.tile[i, j].frameX / 18; - string type; - switch (style) - { - case 0: - type = "AquaticParasite"; - break; - case 1: - type = "Flounder"; - break; - case 2: - type = "Gnasher"; - break; - case 3: - type = "Trasher"; - break; - case 4: - type = "Catfish"; - break; - case 5: - type = "Mauler"; - break; - case 6: - type = "AquaticSeekerHead"; - break; - case 7: - type = "AquaticUrchin"; - break; - case 8: - type = "Frogfish"; - break; - case 9: - type = "MantisShrimp"; - break; - case 10: - type = "AquaticAberration"; - break; - case 11: - type = "Parasea"; - break; - case 12: - type = "SeaUrchin"; - break; - case 13: - type = "BoxJellyfish"; - break; - case 14: - type = "MorayEel"; - break; - case 15: - type = "DevilFish"; - break; - case 16: - type = "Cuttlefish"; - break; - case 17: - type = "ToxicMinnow"; - break; - case 18: - type = "Viperfish"; - break; - case 19: - type = "LuminousCorvina"; - break; - case 20: - type = "GiantSquid"; - break; - case 21: - type = "Laserfish"; - break; - case 22: - type = "OarfishHead"; - break; - case 23: - type = "ColossalSquid"; - break; - case 24: - type = "MirageJelly"; - break; - case 25: - type = "Eidolist"; - break; - case 26: - type = "GulperEelHead"; - break; - case 27: - type = "EidolonWyrmHead"; - break; - case 28: - type = "Bloatfish"; - break; - case 29: - type = "BobbitWormHead"; - break; - case 30: - type = "ChaoticPuffer"; - break; - case 31: - type = "AstralProbe"; - break; - case 32: - type = "SmallSightseer"; - break; - case 33: - type = "BigSightseer"; - break; - case 34: - type = "Aries"; - break; - case 35: - type = "AstralSlime"; - break; - case 36: - type = "Atlas"; - break; - case 37: - type = "Mantis"; - break; - case 38: - type = "Nova"; - break; - case 39: - type = "AstralachneaGround"; - break; - case 40: - type = "Hive"; - break; - case 41: - type = "StellarCulex"; - break; - case 42: - type = "FusionFeeder"; - break; - case 43: - type = "Hadarian"; - break; - case 44: - type = "HeatSpirit"; - break; - case 45: - type = "Scryllar"; - break; - case 46: - type = "DespairStone"; - break; - case 47: - type = "SoulSlurper"; - break; - case 48: - type = "ImpiousImmolator"; - break; - case 49: - type = "ScornEater"; - break; - case 50: - type = "ProfanedEnergyBody"; - break; - case 51: - type = "WulfrumSlime"; - break; - case 52: - type = "WulfrumDrone"; - break; - case 53: - type = "Pitbull"; - break; - case 54: - type = "BlightedEye"; - break; - case 55: - type = "CalamityEye"; - break; - case 56: - type = "Sunskater"; - break; - case 57: - type = "ShockstormShuttle"; - break; - case 58: - type = "ThiccWaifu"; - break; - case 59: - type = "AngryDog"; - break; - case 60: - type = "Cryon"; - break; - case 61: - type = "IceClasper"; - break; - case 62: - type = "StormlionCharger"; - break; - case 63: - type = "Cnidrion"; - break; - case 64: - type = "SandTortoise"; - break; - case 65: - type = "GreatSandShark"; - break; - case 66: - type = "CrawlerAmethyst"; - break; - case 67: - type = "CrawlerTopaz"; - break; - case 68: - type = "CrawlerSapphire"; - break; - case 69: - type = "CrawlerEmerald"; - break; - case 70: - type = "CrawlerRuby"; - break; - case 71: - type = "CrawlerDiamond"; - break; - case 72: - type = "CrawlerAmber"; - break; - case 73: - type = "CrawlerCrystal"; - break; - case 74: - type = "SunBat"; - break; - case 75: - type = "CosmicElemental"; - break; - case 76: - type = "Horse"; - break; - case 77: - type = "ArmoredDiggerHead"; - break; - case 78: - type = "PlaguedFlyingFox"; - break; - case 79: - type = "PlaguedJungleSlime"; - break; - case 80: - type = "PlaguedTortoise"; - break; - case 81: - type = "PlagueBee"; - break; - case 82: - type = "PlaguedDerpling"; - break; - case 83: - type = "PlaguebringerShade"; - break; - case 84: - type = "PhantomSpirit"; - break; - case 85: - type = "OverloadedSoldier"; - break; - case 86: - type = "PhantomDebris"; - break; - case 87: - type = "Bohldohr"; - break; - case 88: - type = "EbonianBlightSlime"; - break; - case 89: - type = "CrimulanBlightSlime"; - break; - case 90: - type = "AeroSlime"; - break; - case 91: - type = "CryoSlime"; - break; - case 92: - type = "PerennialSlime"; - break; - case 93: - type = "CharredSlime"; - break; - case 94: - type = "BloomSlime"; - break; - case 95: - type = "CultistAssassin"; - break; - case 96: - type = "Reaper"; - break; - case 97: - type = "IrradiatedSlime"; - break; - case 98: - type = "PrismTurtle"; - break; - case 99: - type = "Clam"; - break; - case 100: - type = "EutrophicRay"; - break; - case 101: - type = "GhostBell"; - break; - case 102: - type = "GhostBellSmall"; - break; - case 103: - type = "SeaFloaty"; - break; - case 104: - type = "BlindedAngler"; - break; - case 105: - type = "SeaMinnow"; - break; - case 106: - type = "SeaSerpent1"; - break; - case 107: - type = "GiantClam"; - break; - default: - return; - } - player.NPCBannerBuff[mod.NPCType(type)] = true; - player.hasBanner = true; - } - } - - public override void SetSpriteEffects(int i, int j, ref SpriteEffects spriteEffects) - { - if (i % 2 == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class MonsterBanner : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 111; + TileObjectData.addTile(Type); + dustType = -1; + disableSmartCursor = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Banner"); + AddMapEntry(new Color(13, 88, 130), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + int style = frameX / 18; + string item; + switch (style) + { + case 0: + item = "AquaticParasiteBanner"; + break; + case 1: + item = "FlounderBanner"; + break; + case 2: + item = "GnasherBanner"; + break; + case 3: + item = "TrasherBanner"; + break; + case 4: + item = "CatfishBanner"; + break; + case 5: + item = "MaulerBanner"; + break; + case 6: + item = "AquaticSeekerBanner"; + break; + case 7: + item = "AquaticUrchinBanner"; + break; + case 8: + item = "FrogfishBanner"; + break; + case 9: + item = "MantisShrimpBanner"; + break; + case 10: + item = "AquaticAberrationBanner"; + break; + case 11: + item = "ParaseaBanner"; + break; + case 12: + item = "SeaUrchinBanner"; + break; + case 13: + item = "BoxJellyfishBanner"; + break; + case 14: + item = "MorayEelBanner"; + break; + case 15: + item = "DevilFishBanner"; + break; + case 16: + item = "CuttlefishBanner"; + break; + case 17: + item = "ToxicMinnowBanner"; + break; + case 18: + item = "ViperfishBanner"; + break; + case 19: + item = "LuminousCorvinaBanner"; + break; + case 20: + item = "GiantSquidBanner"; + break; + case 21: + item = "LaserfishBanner"; + break; + case 22: + item = "OarfishBanner"; + break; + case 23: + item = "ColossalSquidBanner"; + break; + case 24: + item = "MirageJellyBanner"; + break; + case 25: + item = "EidolistBanner"; + break; + case 26: + item = "GulperEelBanner"; + break; + case 27: + item = "EidolonWyrmJuvenileBanner"; + break; + case 28: + item = "BloatfishBanner"; + break; + case 29: + item = "BobbitWormBanner"; + break; + case 30: + item = "ChaoticPufferBanner"; + break; + case 31: + item = "AstralProbeBanner"; + break; + case 32: + item = "SmallSightseerBanner"; + break; + case 33: + item = "BigSightseerBanner"; + break; + case 34: + item = "AriesBanner"; + break; + case 35: + item = "AstralSlimeBanner"; + break; + case 36: + item = "AtlasBanner"; + break; + case 37: + item = "MantisBanner"; + break; + case 38: + item = "NovaBanner"; + break; + case 39: + item = "AstralachneaBanner"; + break; + case 40: + item = "HiveBanner"; + break; + case 41: + item = "StellarCullexBanner"; + break; + case 42: + item = "FusionFeederBanner"; + break; + case 43: + item = "HadarianBanner"; + break; + case 44: + item = "HeatSpiritBanner"; + break; + case 45: + item = "ScryllarBanner"; + break; + case 46: + item = "DespairStoneBanner"; + break; + case 47: + item = "SoulSlurperBanner"; + break; + case 48: + item = "ImpiousImmolatorBanner"; + break; + case 49: + item = "ScornEaterBanner"; + break; + case 50: + item = "ProfanedEnergyBanner"; + break; + case 51: + item = "WulfrumSlimeBanner"; + break; + case 52: + item = "WulfrumDroneBanner"; + break; + case 53: + item = "PitbullBanner"; + break; + case 54: + item = "BlightedEyeBanner"; + break; + case 55: + item = "CalamityEyeBanner"; + break; + case 56: + item = "SunskaterBanner"; + break; + case 57: + item = "ShockstormShuttleBanner"; + break; + case 58: + item = "CloudElementalBanner"; + break; + case 59: + item = "AngryDogBanner"; + break; + case 60: + item = "CryonBanner"; + break; + case 61: + item = "IceClasperBanner"; + break; + case 62: + item = "StormlionBanner"; + break; + case 63: + item = "CnidrionBanner"; + break; + case 64: + item = "SandTortoiseBanner"; + break; + case 65: + item = "GreatSandSharkBanner"; + break; + case 66: + item = "AmethystCrawlerBanner"; + break; + case 67: + item = "TopazCrawlerBanner"; + break; + case 68: + item = "SapphireCrawlerBanner"; + break; + case 69: + item = "EmeraldCrawlerBanner"; + break; + case 70: + item = "RubyCrawlerBanner"; + break; + case 71: + item = "DiamondCrawlerBanner"; + break; + case 72: + item = "AmberCrawlerBanner"; + break; + case 73: + item = "CrystalCrawlerBanner"; + break; + case 74: + item = "SunBatBanner"; + break; + case 75: + item = "CosmicElementalBanner"; + break; + case 76: + item = "EarthElementalBanner"; + break; + case 77: + item = "ArmoredDiggerBanner"; + break; + case 78: + item = "MelterBanner"; + break; + case 79: + item = "PestilentSlimeBanner"; + break; + case 80: + item = "PlagueshellBanner"; + break; + case 81: + item = "PlagueChargerBanner"; + break; + case 82: + item = "VirulingBanner"; + break; + case 83: + item = "PlaguebringerBanner"; + break; + case 84: + item = "PhantomSpiritBanner"; + break; + case 85: + item = "OverloadedSoldierBanner"; + break; + case 86: + item = "PhantomDebrisBanner"; + break; + case 87: + item = "BOHLDOHRBanner"; + break; + case 88: + item = "EbonianBlightSlimeBanner"; + break; + case 89: + item = "CrimulanBlightSlimeBanner"; + break; + case 90: + item = "AeroSlimeBanner"; + break; + case 91: + item = "CryoSlimeBanner"; + break; + case 92: + item = "PerennialSlimeBanner"; + break; + case 93: + item = "CharredSlimeBanner"; + break; + case 94: + item = "BloomSlimeBanner"; + break; + case 95: + item = "CultistAssassinBanner"; + break; + case 96: + item = "ReaperSharkBanner"; + break; + case 97: + item = "IrradiatedSlimeBanner"; + break; + case 98: + item = "PrismTurtleBanner"; + break; + case 99: + item = "ClamBanner"; + break; + case 100: + item = "EutrophicRayBanner"; + break; + case 101: + item = "GhostBellBanner"; + break; + case 102: + item = "GhostBellSmallBanner"; + break; + case 103: + item = "SeaFloatyBanner"; + break; + case 104: + item = "BlindedAnglerBanner"; + break; + case 105: + item = "SeaMinnowBanner"; + break; + case 106: + item = "SeaSerpentBanner"; + break; + case 107: + item = "GiantClamBanner"; + break; + default: + return; + } + Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType(item)); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Player player = Main.LocalPlayer; + int style = Main.tile[i, j].frameX / 18; + string type; + switch (style) + { + case 0: + type = "AquaticParasite"; + break; + case 1: + type = "Flounder"; + break; + case 2: + type = "Gnasher"; + break; + case 3: + type = "Trasher"; + break; + case 4: + type = "Catfish"; + break; + case 5: + type = "Mauler"; + break; + case 6: + type = "AquaticSeekerHead"; + break; + case 7: + type = "AquaticUrchin"; + break; + case 8: + type = "Frogfish"; + break; + case 9: + type = "MantisShrimp"; + break; + case 10: + type = "AquaticAberration"; + break; + case 11: + type = "Parasea"; + break; + case 12: + type = "SeaUrchin"; + break; + case 13: + type = "BoxJellyfish"; + break; + case 14: + type = "MorayEel"; + break; + case 15: + type = "DevilFish"; + break; + case 16: + type = "Cuttlefish"; + break; + case 17: + type = "ToxicMinnow"; + break; + case 18: + type = "Viperfish"; + break; + case 19: + type = "LuminousCorvina"; + break; + case 20: + type = "GiantSquid"; + break; + case 21: + type = "Laserfish"; + break; + case 22: + type = "OarfishHead"; + break; + case 23: + type = "ColossalSquid"; + break; + case 24: + type = "MirageJelly"; + break; + case 25: + type = "Eidolist"; + break; + case 26: + type = "GulperEelHead"; + break; + case 27: + type = "EidolonWyrmHead"; + break; + case 28: + type = "Bloatfish"; + break; + case 29: + type = "BobbitWormHead"; + break; + case 30: + type = "ChaoticPuffer"; + break; + case 31: + type = "AstralProbe"; + break; + case 32: + type = "SmallSightseer"; + break; + case 33: + type = "BigSightseer"; + break; + case 34: + type = "Aries"; + break; + case 35: + type = "AstralSlime"; + break; + case 36: + type = "Atlas"; + break; + case 37: + type = "Mantis"; + break; + case 38: + type = "Nova"; + break; + case 39: + type = "AstralachneaGround"; + break; + case 40: + type = "Hive"; + break; + case 41: + type = "StellarCulex"; + break; + case 42: + type = "FusionFeeder"; + break; + case 43: + type = "Hadarian"; + break; + case 44: + type = "HeatSpirit"; + break; + case 45: + type = "Scryllar"; + break; + case 46: + type = "DespairStone"; + break; + case 47: + type = "SoulSlurper"; + break; + case 48: + type = "ImpiousImmolator"; + break; + case 49: + type = "ScornEater"; + break; + case 50: + type = "ProfanedEnergyBody"; + break; + case 51: + type = "WulfrumSlime"; + break; + case 52: + type = "WulfrumDrone"; + break; + case 53: + type = "Pitbull"; + break; + case 54: + type = "BlightedEye"; + break; + case 55: + type = "CalamityEye"; + break; + case 56: + type = "Sunskater"; + break; + case 57: + type = "ShockstormShuttle"; + break; + case 58: + type = "ThiccWaifu"; + break; + case 59: + type = "AngryDog"; + break; + case 60: + type = "Cryon"; + break; + case 61: + type = "IceClasper"; + break; + case 62: + type = "StormlionCharger"; + break; + case 63: + type = "Cnidrion"; + break; + case 64: + type = "SandTortoise"; + break; + case 65: + type = "GreatSandShark"; + break; + case 66: + type = "CrawlerAmethyst"; + break; + case 67: + type = "CrawlerTopaz"; + break; + case 68: + type = "CrawlerSapphire"; + break; + case 69: + type = "CrawlerEmerald"; + break; + case 70: + type = "CrawlerRuby"; + break; + case 71: + type = "CrawlerDiamond"; + break; + case 72: + type = "CrawlerAmber"; + break; + case 73: + type = "CrawlerCrystal"; + break; + case 74: + type = "SunBat"; + break; + case 75: + type = "CosmicElemental"; + break; + case 76: + type = "Horse"; + break; + case 77: + type = "ArmoredDiggerHead"; + break; + case 78: + type = "PlaguedFlyingFox"; + break; + case 79: + type = "PlaguedJungleSlime"; + break; + case 80: + type = "PlaguedTortoise"; + break; + case 81: + type = "PlagueBee"; + break; + case 82: + type = "PlaguedDerpling"; + break; + case 83: + type = "PlaguebringerShade"; + break; + case 84: + type = "PhantomSpirit"; + break; + case 85: + type = "OverloadedSoldier"; + break; + case 86: + type = "PhantomDebris"; + break; + case 87: + type = "Bohldohr"; + break; + case 88: + type = "EbonianBlightSlime"; + break; + case 89: + type = "CrimulanBlightSlime"; + break; + case 90: + type = "AeroSlime"; + break; + case 91: + type = "CryoSlime"; + break; + case 92: + type = "PerennialSlime"; + break; + case 93: + type = "CharredSlime"; + break; + case 94: + type = "BloomSlime"; + break; + case 95: + type = "CultistAssassin"; + break; + case 96: + type = "Reaper"; + break; + case 97: + type = "IrradiatedSlime"; + break; + case 98: + type = "PrismTurtle"; + break; + case 99: + type = "Clam"; + break; + case 100: + type = "EutrophicRay"; + break; + case 101: + type = "GhostBell"; + break; + case 102: + type = "GhostBellSmall"; + break; + case 103: + type = "SeaFloaty"; + break; + case 104: + type = "BlindedAngler"; + break; + case 105: + type = "SeaMinnow"; + break; + case 106: + type = "SeaSerpent1"; + break; + case 107: + type = "GiantClam"; + break; + default: + return; + } + player.NPCBannerBuff[mod.NPCType(type)] = true; + player.hasBanner = true; + } + } + + public override void SetSpriteEffects(int i, int j, ref SpriteEffects spriteEffects) + { + if (i % 2 == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + } + } +} diff --git a/Tiles/PerennialBrick.cs b/Tiles/PerennialBrick.cs index 41354fe072..8f5a4d430a 100644 --- a/Tiles/PerennialBrick.cs +++ b/Tiles/PerennialBrick.cs @@ -1,38 +1,38 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.Graphics.Capture; - -namespace CalamityMod.Tiles -{ - public class PerennialBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; - Main.tileBlockLight[Type] = true; - drop = mod.ItemType("PerennialBrick"); - soundType = 21; - minPick = 150; - AddMapEntry(new Color(17, 133, 46)); - animationFrameHeight = 90; - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 128, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - int xPos = i % 4; - int yPos = j % 4; - frameXOffset = xPos * 234; - frameYOffset = yPos * animationFrameHeight; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.Graphics.Capture; + +namespace CalamityMod.Tiles +{ + public class PerennialBrick : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; + drop = mod.ItemType("PerennialBrick"); + soundType = 21; + minPick = 150; + AddMapEntry(new Color(17, 133, 46)); + animationFrameHeight = 90; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 128, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 4; + int yPos = j % 4; + frameXOffset = xPos * 234; + frameYOffset = yPos * animationFrameHeight; + } + } +} diff --git a/Tiles/PerennialOre.cs b/Tiles/PerennialOre.cs index aae6f1be66..29525f8fda 100644 --- a/Tiles/PerennialOre.cs +++ b/Tiles/PerennialOre.cs @@ -1,45 +1,45 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class PerennialOre : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - 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(); - name.SetDefault("Perennial Ore"); - AddMapEntry(new Color(200, 250, 100), name); - mineResist = 3f; - minPick = 200; - soundType = 21; - Main.tileSpelunker[Type] = true; - } - - public override bool CanExplode(int i, int j) - { - return NPC.downedPlantBoss; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.04f; - g = 0.10f; - b = 0.02f; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class PerennialOre : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + 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(); + name.SetDefault("Perennial Ore"); + AddMapEntry(new Color(200, 250, 100), name); + mineResist = 3f; + minPick = 200; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + + public override bool CanExplode(int i, int j) + { + return NPC.downedPlantBoss; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.04f; + g = 0.10f; + b = 0.02f; + } + } +} diff --git a/Tiles/PinkCandle.cs b/Tiles/PinkCandle.cs index 183fb9a965..e2e1f395c2 100644 --- a/Tiles/PinkCandle.cs +++ b/Tiles/PinkCandle.cs @@ -1,55 +1,55 @@ -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 PinkCandle : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Vigorous Candle"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 34; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("PinkHealthCandle"), 20); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.75f; - g = 0.35f; - b = 0.65f; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PinkCandle")); - } - } -} +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 PinkCandle : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Vigorous Candle"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 34; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("PinkHealthCandle"), 20); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.75f; + g = 0.35f; + b = 0.65f; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PinkCandle")); + } + } +} diff --git a/Tiles/PlantyMush.cs b/Tiles/PlantyMush.cs index b10e22a944..9b14238c71 100644 --- a/Tiles/PlantyMush.cs +++ b/Tiles/PlantyMush.cs @@ -1,84 +1,84 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class PlantyMush : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - dustType = 2; - drop = mod.ItemType("PlantyMush"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Planty Mush"); - AddMapEntry(new Color(0, 120, 0), name); - mineResist = 1f; - soundType = 0; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (!closer && j < Main.maxTilesY - 205) - { - if (Main.tile[i, j].liquid <= 0) - { - Main.tile[i, j].liquid = 255; - Main.tile[i, j].lava(false); - } - } - } - - public override void RandomUpdate(int i, int j) - { - int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); - if (Main.tile[i, j + 1] != null) - { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)mod.TileType("ViperVines")) - { - if (Main.tile[i, j + 1].liquid == 255 && - (Main.tile[i, j + 1].wall == (ushort)mod.WallType("MossyGravelWall") || - Main.tile[i, j + 1].wall == (ushort)mod.WallType("AbyssGravelWall")) && - !Main.tile[i, j + 1].lava()) - { - bool flag13 = false; - for (int num52 = num8; num52 > num8 - 10; num52--) - { - if (Main.tile[i, num52].bottomSlope()) - { - flag13 = false; - break; - } - if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) - { - flag13 = true; - break; - } - } - if (flag13) - { - int num53 = i; - int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)mod.TileType("ViperVines"); - Main.tile[num53, num54].active(true); - WorldGen.SquareTileFrame(num53, num54, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); - } - } - } - } - } - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class PlantyMush : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + dustType = 2; + drop = mod.ItemType("PlantyMush"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Planty Mush"); + AddMapEntry(new Color(0, 120, 0), name); + mineResist = 1f; + soundType = 0; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (!closer && j < Main.maxTilesY - 205) + { + if (Main.tile[i, j].liquid <= 0) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + } + + public override void RandomUpdate(int i, int j) + { + int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); + if (Main.tile[i, j + 1] != null) + { + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)mod.TileType("ViperVines")) + { + if (Main.tile[i, j + 1].liquid == 255 && + (Main.tile[i, j + 1].wall == (ushort)mod.WallType("MossyGravelWall") || + Main.tile[i, j + 1].wall == (ushort)mod.WallType("AbyssGravelWall")) && + !Main.tile[i, j + 1].lava()) + { + bool flag13 = false; + for (int num52 = num8; num52 > num8 - 10; num52--) + { + if (Main.tile[i, num52].bottomSlope()) + { + flag13 = false; + break; + } + if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) + { + flag13 = true; + break; + } + } + if (flag13) + { + int num53 = i; + int num54 = j + 1; + Main.tile[num53, num54].type = (ushort)mod.TileType("ViperVines"); + Main.tile[num53, num54].active(true); + WorldGen.SquareTileFrame(num53, num54, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); + } + } + } + } + } + } + } +} diff --git a/Tiles/PurpleCandle.cs b/Tiles/PurpleCandle.cs index 33ffe5d17a..3e510a544d 100644 --- a/Tiles/PurpleCandle.cs +++ b/Tiles/PurpleCandle.cs @@ -1,55 +1,55 @@ -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 PurpleCandle : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Resilient Candle"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 34; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("PurpleDefenseCandle"), 20); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.65f; - g = 0.35f; - b = 0.85f; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PurpleCandle")); - } - } -} +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 PurpleCandle : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Resilient Candle"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 34; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("PurpleDefenseCandle"), 20); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.65f; + g = 0.35f; + b = 0.85f; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("PurpleCandle")); + } + } +} diff --git a/Tiles/SulphurousSand.cs b/Tiles/SulphurousSand.cs index af49a81f8e..e93eed4020 100644 --- a/Tiles/SulphurousSand.cs +++ b/Tiles/SulphurousSand.cs @@ -1,184 +1,184 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class SulphurousSand : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - dustType = 32; - drop = mod.ItemType("SulphurousSand"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sulphurous Sand"); - AddMapEntry(new Color(150, 100, 50), name); - mineResist = 1f; - minPick = 55; - soundType = 0; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (i < 250 && i > 150) - { - if (!closer) - { - if (Main.tile[i - 1, j] != null) - { - if (!Main.tile[i - 1, j].active()) - { - if (Main.tile[i - 1, j].liquid <= 128) - { - Main.tile[i - 1, j].liquid = 255; - Main.tile[i - 1, j].lava(false); - } - } - } - if (Main.tile[i - 2, j] != null) - { - if (!Main.tile[i - 2, j].active()) - { - if (Main.tile[i - 2, j].liquid <= 128) - { - Main.tile[i - 2, j].liquid = 255; - Main.tile[i - 2, j].lava(false); - } - } - } - if (Main.tile[i - 3, j] != null) - { - if (!Main.tile[i - 3, j].active()) - { - if (Main.tile[i - 3, j].liquid <= 128) - { - Main.tile[i - 3, j].liquid = 255; - Main.tile[i - 3, j].lava(false); - } - } - } - } - } - else if (i > Main.maxTilesX - 250 && i < Main.maxTilesX - 150) - { - if (!closer) - { - if (Main.tile[i + 1, j] != null) - { - if (!Main.tile[i + 1, j].active()) - { - if (Main.tile[i + 1, j].liquid <= 128) - { - Main.tile[i + 1, j].liquid = 255; - Main.tile[i + 1, j].lava(false); - } - } - } - if (Main.tile[i + 2, j] != null) - { - if (!Main.tile[i + 2, j].active()) - { - if (Main.tile[i + 2, j].liquid <= 128) - { - Main.tile[i + 2, j].liquid = 255; - Main.tile[i + 2, j].lava(false); - } - } - } - if (Main.tile[i + 3, j] != null) - { - if (!Main.tile[i + 3, j].active()) - { - if (Main.tile[i + 3, j].liquid <= 128) - { - Main.tile[i + 3, j].liquid = 255; - Main.tile[i + 3, j].lava(false); - } - } - } - } - } - } - - public override void RandomUpdate(int i, int j) - { - int tileLocationY = j - 1; - if (Main.tile[i, tileLocationY] != null) - { - if (!Main.tile[i, tileLocationY].active()) - { - if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && - Main.tile[i, tileLocationY - 2].liquid == 255 && Main.netMode != 1) - { - Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("SulphuricAcidCannon"), 0, 2f, Main.myPlayer, 0f, 0f); - } - if (i < 250 || i > Main.maxTilesX - 250) - { - if (Main.rand.Next(400) == 0) - { - if (Main.tile[i, tileLocationY].liquid == 255) - { - int num13 = 7; - int num14 = 6; - int num15 = 0; - for (int l = i - num13; l <= i + num13; l++) - { - for (int m = tileLocationY - num13; m <= tileLocationY + num13; m++) - { - if (Main.tile[l, m].active() && Main.tile[l, m].type == 81) - { - num15++; - } - } - } - if (num15 < num14 && Main.tile[i, tileLocationY - 1].liquid == 255 && - Main.tile[i, tileLocationY - 2].liquid == 255 && Main.tile[i, tileLocationY - 3].liquid == 255 && - Main.tile[i, tileLocationY - 4].liquid == 255) - { - WorldGen.PlaceTile(i, tileLocationY, 81, true, false, -1, 0); - if (Main.netMode == 2 && Main.tile[i, tileLocationY].active()) - { - NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); - } - } - } - else if (Main.tile[i, tileLocationY].liquid == 0) - { - int num13 = 7; - int num14 = 6; - int num15 = 0; - for (int l = i - num13; l <= i + num13; l++) - { - for (int m = tileLocationY - num13; m <= tileLocationY + num13; m++) - { - if (Main.tile[l, m].active() && Main.tile[l, m].type == 324) - { - num15++; - } - } - } - if (num15 < num14) - { - WorldGen.PlaceTile(i, tileLocationY, 324, true, false, -1, Main.rand.Next(2)); - if (Main.netMode == 2 && Main.tile[i, tileLocationY].active()) - { - NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); - } - } - } - } - } - } - } - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class SulphurousSand : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + dustType = 32; + drop = mod.ItemType("SulphurousSand"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sulphurous Sand"); + AddMapEntry(new Color(150, 100, 50), name); + mineResist = 1f; + minPick = 55; + soundType = 0; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (i < 250 && i > 150) + { + if (!closer) + { + if (Main.tile[i - 1, j] != null) + { + if (!Main.tile[i - 1, j].active()) + { + if (Main.tile[i - 1, j].liquid <= 128) + { + Main.tile[i - 1, j].liquid = 255; + Main.tile[i - 1, j].lava(false); + } + } + } + if (Main.tile[i - 2, j] != null) + { + if (!Main.tile[i - 2, j].active()) + { + if (Main.tile[i - 2, j].liquid <= 128) + { + Main.tile[i - 2, j].liquid = 255; + Main.tile[i - 2, j].lava(false); + } + } + } + if (Main.tile[i - 3, j] != null) + { + if (!Main.tile[i - 3, j].active()) + { + if (Main.tile[i - 3, j].liquid <= 128) + { + Main.tile[i - 3, j].liquid = 255; + Main.tile[i - 3, j].lava(false); + } + } + } + } + } + else if (i > Main.maxTilesX - 250 && i < Main.maxTilesX - 150) + { + if (!closer) + { + if (Main.tile[i + 1, j] != null) + { + if (!Main.tile[i + 1, j].active()) + { + if (Main.tile[i + 1, j].liquid <= 128) + { + Main.tile[i + 1, j].liquid = 255; + Main.tile[i + 1, j].lava(false); + } + } + } + if (Main.tile[i + 2, j] != null) + { + if (!Main.tile[i + 2, j].active()) + { + if (Main.tile[i + 2, j].liquid <= 128) + { + Main.tile[i + 2, j].liquid = 255; + Main.tile[i + 2, j].lava(false); + } + } + } + if (Main.tile[i + 3, j] != null) + { + if (!Main.tile[i + 3, j].active()) + { + if (Main.tile[i + 3, j].liquid <= 128) + { + Main.tile[i + 3, j].liquid = 255; + Main.tile[i + 3, j].lava(false); + } + } + } + } + } + } + + public override void RandomUpdate(int i, int j) + { + int tileLocationY = j - 1; + if (Main.tile[i, tileLocationY] != null) + { + if (!Main.tile[i, tileLocationY].active()) + { + if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && + Main.tile[i, tileLocationY - 2].liquid == 255 && Main.netMode != 1) + { + Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("SulphuricAcidCannon"), 0, 2f, Main.myPlayer, 0f, 0f); + } + if (i < 250 || i > Main.maxTilesX - 250) + { + if (Main.rand.Next(400) == 0) + { + if (Main.tile[i, tileLocationY].liquid == 255) + { + int num13 = 7; + int num14 = 6; + int num15 = 0; + for (int l = i - num13; l <= i + num13; l++) + { + for (int m = tileLocationY - num13; m <= tileLocationY + num13; m++) + { + if (Main.tile[l, m].active() && Main.tile[l, m].type == 81) + { + num15++; + } + } + } + if (num15 < num14 && Main.tile[i, tileLocationY - 1].liquid == 255 && + Main.tile[i, tileLocationY - 2].liquid == 255 && Main.tile[i, tileLocationY - 3].liquid == 255 && + Main.tile[i, tileLocationY - 4].liquid == 255) + { + WorldGen.PlaceTile(i, tileLocationY, 81, true, false, -1, 0); + if (Main.netMode == 2 && Main.tile[i, tileLocationY].active()) + { + NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); + } + } + } + else if (Main.tile[i, tileLocationY].liquid == 0) + { + int num13 = 7; + int num14 = 6; + int num15 = 0; + for (int l = i - num13; l <= i + num13; l++) + { + for (int m = tileLocationY - num13; m <= tileLocationY + num13; m++) + { + if (Main.tile[l, m].active() && Main.tile[l, m].type == 324) + { + num15++; + } + } + } + if (num15 < num14) + { + WorldGen.PlaceTile(i, tileLocationY, 324, true, false, -1, Main.rand.Next(2)); + if (Main.netMode == 2 && Main.tile[i, tileLocationY].active()) + { + NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); + } + } + } + } + } + } + } + } + } +} diff --git a/Tiles/SunkenSea/BrainCoral.cs b/Tiles/SunkenSea/BrainCoral.cs index 8bd74248c9..c7dcbd89e1 100644 --- a/Tiles/SunkenSea/BrainCoral.cs +++ b/Tiles/SunkenSea/BrainCoral.cs @@ -13,44 +13,44 @@ namespace CalamityMod.Tiles.SunkenSea { public override void SetDefaults() { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(Type); + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Brain Coral"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Brain Coral"); AddMapEntry(new Color(0, 0, 80)); - mineResist = 3f; - + mineResist = 3f; + base.SetDefaults(); - } - + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - if (Main.rand.Next(300) == 0) - { - int tileLocationY = j - 1; - if (Main.tile[i, tileLocationY] != null) - { - if (!Main.tile[i, tileLocationY].active()) - { - if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && Main.tile[i, tileLocationY - 2].liquid == 255) - { - if (Main.netMode != 1) - Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("CoralBubble"), 0, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + if (Main.rand.Next(300) == 0) + { + int tileLocationY = j - 1; + if (Main.tile[i, tileLocationY] != null) + { + if (!Main.tile[i, tileLocationY].active()) + { + if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && Main.tile[i, tileLocationY - 2].liquid == 255) + { + if (Main.netMode != 1) + Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("CoralBubble"), 0, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + } } } diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index e33e5ebbc0..c3f13afed7 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -1,39 +1,39 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Tiles.SunkenSea -{ - public class EutrophicSand : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - dustType = 108; - drop = mod.ItemType("EutrophicSand"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Eutrophic Sand"); - AddMapEntry(new Color(100, 100, 150), name); - mineResist = 2f; - } - +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class EutrophicSand : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + dustType = 108; + drop = mod.ItemType("EutrophicSand"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Eutrophic Sand"); + AddMapEntry(new Color(100, 100, 150), name); + mineResist = 2f; + } + public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { + { return CalamityWorld.downedDesertScourge; - } - - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedDesertScourge; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file + } + + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedDesertScourge; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/SunkenSea/FanCoral.cs b/Tiles/SunkenSea/FanCoral.cs index 167f956bd3..d9db634ec2 100644 --- a/Tiles/SunkenSea/FanCoral.cs +++ b/Tiles/SunkenSea/FanCoral.cs @@ -15,30 +15,30 @@ namespace CalamityMod.Tiles.SunkenSea { public override void SetDefaults() { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileLighted[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Fan Coral"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Fan Coral"); AddMapEntry(new Color(0, 0, 80)); mineResist = 3f; - + base.SetDefaults(); - } - + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.3f; - g = 0.75f; - b = 0.75f; - } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.3f; + g = 0.75f; + b = 0.75f; + } } } diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index e19eea941f..50a662aa61 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -1,98 +1,98 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Tiles.SunkenSea -{ - public class Navystone : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - dustType = 96; - drop = mod.ItemType("Navystone"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Navystone"); - AddMapEntry(new Color(0, 50, 50), name); - mineResist = 2f; - minPick = 55; - soundType = 21; - } - +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class Navystone : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + dustType = 96; + drop = mod.ItemType("Navystone"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Navystone"); + AddMapEntry(new Color(0, 50, 50), name); + mineResist = 2f; + minPick = 55; + soundType = 21; + } + public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { + { return CalamityWorld.downedDesertScourge; - } - - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedDesertScourge; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void RandomUpdate(int i, int j) - { - if (Main.rand.Next(40) == 0) - { - int random = WorldGen.genRand.Next(4); - if (random == 0) - { - i++; - } - if (random == 1) - { - i--; - } - if (random == 2) - { - j++; - } - if (random == 3) - { - j--; - } - if (Main.tile[i, j] != null) - { - if (!Main.tile[i, j].active()) - { - if (!Main.tile[i, j].lava() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick()) - { - Main.tile[i, j].type = (ushort)mod.TileType("SeaPrismCrystals"); - Main.tile[i, j].active(true); - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(0 * 18); - } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(1 * 18); - } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(2 * 18); - } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(3 * 18); - } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); - WorldGen.SquareTileFrame(i, j, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); - } - } - } - } - } - } - } -} \ No newline at end of file + } + + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedDesertScourge; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void RandomUpdate(int i, int j) + { + if (Main.rand.Next(40) == 0) + { + int random = WorldGen.genRand.Next(4); + if (random == 0) + { + i++; + } + if (random == 1) + { + i--; + } + if (random == 2) + { + j++; + } + if (random == 3) + { + j--; + } + if (Main.tile[i, j] != null) + { + if (!Main.tile[i, j].active()) + { + if (!Main.tile[i, j].lava() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick()) + { + Main.tile[i, j].type = (ushort)mod.TileType("SeaPrismCrystals"); + Main.tile[i, j].active(true); + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(0 * 18); + } + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(1 * 18); + } + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(2 * 18); + } + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(3 * 18); + } + Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + WorldGen.SquareTileFrame(i, j, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); + } + } + } + } + } + } + } +} diff --git a/Tiles/SunkenSea/SeaAnemone.cs b/Tiles/SunkenSea/SeaAnemone.cs index 5b3b04e3b8..a678b55bad 100644 --- a/Tiles/SunkenSea/SeaAnemone.cs +++ b/Tiles/SunkenSea/SeaAnemone.cs @@ -15,37 +15,37 @@ namespace CalamityMod.Tiles.SunkenSea { public override void SetDefaults() { - animationFrameHeight = 36; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); + animationFrameHeight = 36; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sea Anemone"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sea Anemone"); AddMapEntry(new Color(0, 0, 80)); mineResist = 2f; - + base.SetDefaults(); - } - + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter > 12) - { - frameCounter = 0; - frame++; - if (frame > 5) - { - frame = 0; - } - } - } + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter > 12) + { + frameCounter = 0; + frame++; + if (frame > 5) + { + frame = 0; + } + } + } } } diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 5056dc822a..672cee991c 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -1,99 +1,99 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Tiles.SunkenSea -{ - public class SeaPrism : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - dustType = 33; - drop = mod.ItemType("SeaPrism"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sea Prism"); - AddMapEntry(new Color(0, 150, 200), name); - mineResist = 3f; - minPick = 55; - soundType = 21; - Main.tileSpelunker[Type] = true; - } - +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class SeaPrism : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + dustType = 33; + drop = mod.ItemType("SeaPrism"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sea Prism"); + AddMapEntry(new Color(0, 150, 200), name); + mineResist = 3f; + minPick = 55; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { + { return CalamityWorld.downedDesertScourge; - } - - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedDesertScourge; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void RandomUpdate(int i, int j) - { - if (Main.rand.Next(10) == 0) - { - int random = WorldGen.genRand.Next(4); - if (random == 0) - { - i++; - } - if (random == 1) - { - i--; - } - if (random == 2) - { - j++; - } - if (random == 3) - { - j--; - } - if (Main.tile[i, j] != null) - { - if (!Main.tile[i, j].active()) - { - if (!Main.tile[i, j].lava() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick()) - { - Main.tile[i, j].type = (ushort)mod.TileType("SeaPrismCrystals"); - Main.tile[i, j].active(true); - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(0 * 18); - } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(1 * 18); - } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(2 * 18); - } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(3 * 18); - } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); - WorldGen.SquareTileFrame(i, j, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); - } - } - } - } - } - } - } -} \ No newline at end of file + } + + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedDesertScourge; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void RandomUpdate(int i, int j) + { + if (Main.rand.Next(10) == 0) + { + int random = WorldGen.genRand.Next(4); + if (random == 0) + { + i++; + } + if (random == 1) + { + i--; + } + if (random == 2) + { + j++; + } + if (random == 3) + { + j--; + } + if (Main.tile[i, j] != null) + { + if (!Main.tile[i, j].active()) + { + if (!Main.tile[i, j].lava() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick()) + { + Main.tile[i, j].type = (ushort)mod.TileType("SeaPrismCrystals"); + Main.tile[i, j].active(true); + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(0 * 18); + } + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(1 * 18); + } + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(2 * 18); + } + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(3 * 18); + } + Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + WorldGen.SquareTileFrame(i, j, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); + } + } + } + } + } + } + } +} diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs index 3963b4f33e..ef9914e556 100644 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ b/Tiles/SunkenSea/SeaPrismCrystals.cs @@ -1,83 +1,83 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Tiles.SunkenSea -{ - public class SeaPrismCrystals : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileObsidianKill[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Sea Prism Crystal"); - AddMapEntry(new Color(0, 150, 200), name); +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class SeaPrismCrystals : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sea Prism Crystal"); + AddMapEntry(new Color(0, 150, 200), name); soundType = 2; - soundStyle = 27; - dustType = 67; - drop = mod.ItemType("PrismShard"); - Main.tileSpelunker[Type] = true; - } - + soundStyle = 27; + dustType = 67; + drop = mod.ItemType("PrismShard"); + Main.tileSpelunker[Type] = true; + } + public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { + { return CalamityWorld.downedDesertScourge; - } - - public override bool CanExplode(int i, int j) - { - return CalamityWorld.downedDesertScourge; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.2f; - g = 0.5f; - b = 0.5f; - } - - public override bool CanPlace(int i, int j) - { - if (Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - return true; - if (Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - return true; - if (Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - return true; - if (Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - return true; - return false; - } - - public override void PlaceInWorld(int i, int j, Item item) - { - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(0 * 18); - } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(1 * 18); - } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(2 * 18); - } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(3 * 18); - } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); - } - } -} \ No newline at end of file + } + + public override bool CanExplode(int i, int j) + { + return CalamityWorld.downedDesertScourge; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.2f; + g = 0.5f; + b = 0.5f; + } + + public override bool CanPlace(int i, int j) + { + if (Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + return true; + if (Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + return true; + if (Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + return true; + if (Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + return true; + return false; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(0 * 18); + } + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(1 * 18); + } + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(2 * 18); + } + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(3 * 18); + } + Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + } + } +} diff --git a/Tiles/SunkenSea/SmallBrainCoral.cs b/Tiles/SunkenSea/SmallBrainCoral.cs index 478bce88d7..ba4e8a6d7d 100644 --- a/Tiles/SunkenSea/SmallBrainCoral.cs +++ b/Tiles/SunkenSea/SmallBrainCoral.cs @@ -13,44 +13,44 @@ namespace CalamityMod.Tiles.SunkenSea { public override void SetDefaults() { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Small Brain Coral"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Small Brain Coral"); AddMapEntry(new Color(0, 0, 80)); mineResist = 3f; - + base.SetDefaults(); - } - + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - public override void NearbyEffects(int i, int j, bool closer) - { - if (closer) - { - if (Main.rand.Next(300) == 0) - { - int tileLocationY = j - 1; - if (Main.tile[i, tileLocationY] != null) - { - if (!Main.tile[i, tileLocationY].active()) - { - if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && Main.tile[i, tileLocationY - 2].liquid == 255) - { - if (Main.netMode != 1) - Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("CoralBubbleSmall"), 0, 1f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + if (Main.rand.Next(300) == 0) + { + int tileLocationY = j - 1; + if (Main.tile[i, tileLocationY] != null) + { + if (!Main.tile[i, tileLocationY].active()) + { + if (Main.tile[i, tileLocationY].liquid == 255 && Main.tile[i, tileLocationY - 1].liquid == 255 && Main.tile[i, tileLocationY - 2].liquid == 255) + { + if (Main.netMode != 1) + Projectile.NewProjectile((float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, mod.ProjectileType("CoralBubbleSmall"), 0, 1f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + } } } diff --git a/Tiles/SunkenSea/SmallTubeCoral.cs b/Tiles/SunkenSea/SmallTubeCoral.cs index 1087a8e515..5b58a2e5f1 100644 --- a/Tiles/SunkenSea/SmallTubeCoral.cs +++ b/Tiles/SunkenSea/SmallTubeCoral.cs @@ -15,19 +15,19 @@ namespace CalamityMod.Tiles.SunkenSea { public override void SetDefaults() { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.addTile(Type); + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Small Tube Coral"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Small Tube Coral"); AddMapEntry(new Color(0, 0, 80)); mineResist = 3f; - + base.SetDefaults(); - } - + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/SunkenSea/TableCoral.cs b/Tiles/SunkenSea/TableCoral.cs index 6c8043f089..a66c10a7a1 100644 --- a/Tiles/SunkenSea/TableCoral.cs +++ b/Tiles/SunkenSea/TableCoral.cs @@ -15,22 +15,22 @@ namespace CalamityMod.Tiles.SunkenSea { public override void SetDefaults() { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; Main.tileSolidTop[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); - TileObjectData.addAlternate(1); - TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); - TileObjectData.addTile(Type); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.addAlternate(1); + TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.addTile(Type); dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Table Coral"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Table Coral"); AddMapEntry(new Color(0, 0, 80)); mineResist = 3f; - + base.SetDefaults(); } diff --git a/Tiles/SunkenSea/TubeCoral.cs b/Tiles/SunkenSea/TubeCoral.cs index 7a6ab76103..8d13cc3f80 100644 --- a/Tiles/SunkenSea/TubeCoral.cs +++ b/Tiles/SunkenSea/TubeCoral.cs @@ -15,26 +15,26 @@ namespace CalamityMod.Tiles.SunkenSea { public override void SetDefaults() { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new[] - { - 16, - 16, - 16 - }; - TileObjectData.addTile(Type); + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new[] + { + 16, + 16, + 16 + }; + TileObjectData.addTile(Type); dustType = 253; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Tube Coral"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Tube Coral"); AddMapEntry(new Color(0, 0, 80)); mineResist = 3f; - + base.SetDefaults(); - } - + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/Tenebris.cs b/Tiles/Tenebris.cs index d4ecbc3703..e48078b7a1 100644 --- a/Tiles/Tenebris.cs +++ b/Tiles/Tenebris.cs @@ -1,87 +1,87 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.World; - -namespace CalamityMod.Tiles -{ - public class Tenebris : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - dustType = 44; - drop = mod.ItemType("Tenebris"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Tenebris"); - AddMapEntry(new Color(0, 100, 100), name); - mineResist = 3f; - minPick = 200; - soundType = 21; - } - - public override bool CanExplode(int i, int j) - { - return NPC.downedPlantBoss || CalamityWorld.downedCalamitas; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (!closer && j < Main.maxTilesY - 205) - { - if (Main.tile[i, j].liquid <= 0) - { - Main.tile[i, j].liquid = 255; - Main.tile[i, j].lava(false); - } - } - } - - public override void RandomUpdate(int i, int j) - { - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - int random = WorldGen.genRand.Next(4); - if (random == 0) - { - i++; - } - if (random == 1) - { - i--; - } - if (random == 2) - { - j++; - } - if (random == 3) - { - j--; - } - if (Main.tile[i, j] != null) - { - if (Main.tile[i, j].active()) - { - if (Main.tile[i, j].type == mod.TileType("PlantyMush") && WorldGen.genRand.Next(5) == 0 && !Main.tile[i, j].lava()) - { - Main.tile[i, j].type = (ushort)mod.TileType("Tenebris"); - WorldGen.SquareTileFrame(i, j, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); - } - } - } - } - } - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Tiles +{ + public class Tenebris : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + dustType = 44; + drop = mod.ItemType("Tenebris"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Tenebris"); + AddMapEntry(new Color(0, 100, 100), name); + mineResist = 3f; + minPick = 200; + soundType = 21; + } + + public override bool CanExplode(int i, int j) + { + return NPC.downedPlantBoss || CalamityWorld.downedCalamitas; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (!closer && j < Main.maxTilesY - 205) + { + if (Main.tile[i, j].liquid <= 0) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + } + + public override void RandomUpdate(int i, int j) + { + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + int random = WorldGen.genRand.Next(4); + if (random == 0) + { + i++; + } + if (random == 1) + { + i--; + } + if (random == 2) + { + j++; + } + if (random == 3) + { + j--; + } + if (Main.tile[i, j] != null) + { + if (Main.tile[i, j].active()) + { + if (Main.tile[i, j].type == mod.TileType("PlantyMush") && WorldGen.genRand.Next(5) == 0 && !Main.tile[i, j].lava()) + { + Main.tile[i, j].type = (ushort)mod.TileType("Tenebris"); + WorldGen.SquareTileFrame(i, j, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); + } + } + } + } + } + } + } +} diff --git a/Tiles/TranquilityCandle.cs b/Tiles/TranquilityCandle.cs index 9f5f0bc509..8585482aa8 100644 --- a/Tiles/TranquilityCandle.cs +++ b/Tiles/TranquilityCandle.cs @@ -1,65 +1,65 @@ -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 TranquilityCandle : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.StyleOnTable1x1); - TileObjectData.addTile(Type); - drop = mod.ItemType("TranquilityCandle"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Tranquility Candle"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 20; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 4) - { - frame = (frame + 1) % 10; - frameCounter = 0; - } - } - - public override void MouseOver(int i, int j) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.showItemIcon = true; - player.showItemIcon2 = mod.ItemType("TranquilityCandle"); - } - - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - player.AddBuff(mod.BuffType("TranquilityCandle"), 20); - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.55f; - g = 0.055f; - b = 0.55f; - } - - /*public override void RightClick(int i, int j) - { - Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("TranquilityCandle")); - ?? KillTile( i, j); - }*/ - } -} \ No newline at end of file +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 TranquilityCandle : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.StyleOnTable1x1); + TileObjectData.addTile(Type); + drop = mod.ItemType("TranquilityCandle"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Tranquility Candle"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 20; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 4) + { + frame = (frame + 1) % 10; + frameCounter = 0; + } + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = mod.ItemType("TranquilityCandle"); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("TranquilityCandle"), 20); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.55f; + g = 0.055f; + b = 0.55f; + } + + /*public override void RightClick(int i, int j) + { + Item.NewItem(i * 16, j * 16, 8, 8, mod.ItemType("TranquilityCandle")); + ?? KillTile( i, j); + }*/ + } +} diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index cbfb24aded..e994407191 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -1,592 +1,592 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ObjectData; -using Terraria.ModLoader; -using Terraria.Graphics.Capture; - -namespace CalamityMod.Tiles -{ - public class UelibloomBrick : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = false; - Main.tileBlockLight[Type] = true; - soundType = 21; - minPick = 200; - drop = mod.ItemType("UelibloomBrick"); - AddMapEntry(new Color(174, 108, 46)); - animationFrameHeight = 90; - } - int animationFrameWidth = 234; - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 39, 0, 0, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0, 0, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - Main.tile[i, j].color(0); - return true; - } - - public override bool Slope(int i, int j) - { - return false; - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - //I'm so sorry about this section - //This selects the particular pattern to draw, instead of based on just position also being based on relation to an edge. - int uniqueAnimationFrameX = i % 3; - int uniqueAnimationFrameY = Main.tileFrame[Type] + j; - if (Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick")) - { - //Row 1 and Row 10 - if ((Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 2, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 2, j - 2].type != mod.TileType("UelibloomBrick"))) - { - //Row 10 - uniqueAnimationFrameY = 9; - } - else - { - //Row 1 - uniqueAnimationFrameY = 0; - } - } - else if ((Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) || - (Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick")) || - (Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick"))) - { - //Row 1 and Row 7 - if (Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") || - ((Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") || - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && - !(Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick"))) || - ((Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") || - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) && - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && - !(Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick")))) - { - //Row 1 - uniqueAnimationFrameY = 0; - } - else - { - //Row 7 - uniqueAnimationFrameY = 6; - } - } - else if ((Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick"))) - { - //Row 3 and Row 8 - if (Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 2].type == mod.TileType("UelibloomBrick")) - { - //Row 3 - uniqueAnimationFrameY = 2; - } - else - { - //Row 8 - uniqueAnimationFrameY = 7; - } - } - else if ((Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick"))) - { - //Row 5 and Row 9 - if (Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type == mod.TileType("UelibloomBrick")) - { - //Row 5 - uniqueAnimationFrameY = 4; - } - else - { - //Row 9 - uniqueAnimationFrameY = 8; - } - } - else if ((Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 2].type != mod.TileType("UelibloomBrick")) || - - (((Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && - (Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick") || - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick"))) || - (Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick")) && - (Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") || - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick")))) || - - (Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick"))) - { - //Row 2 - uniqueAnimationFrameY = 1; - } - else if ((Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick"))) - { - //Row 4 - uniqueAnimationFrameY = 3; - } - else if ((Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick"))) - { - //Row 6 - uniqueAnimationFrameY = 5; - } - else - { - uniqueAnimationFrameX = 1; - uniqueAnimationFrameY = 1; - } - - frameXOffset = uniqueAnimationFrameX * animationFrameWidth; - frameYOffset = uniqueAnimationFrameY * animationFrameHeight; - } - - public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) - { - Main.specX[nextSpecialDrawIndex] = i; - Main.specY[nextSpecialDrawIndex] = j; - nextSpecialDrawIndex++; - } - - 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()); - //string debug = "Main.screenWidth: " + Main.screenWidth.ToString(); - //string debug2 = "Tile Position: (" + (i * 16).ToString() + ", " + (j * 16).ToString() + ")"; - //string debug3 = "Draw Position: (" + (i * 16 - Main.screenPosition.X + (Main.screenWidth / 30)).ToString() + ", " + (j * 16 - Main.screenPosition.Y + (Main.screenWidth / 30)).ToString() + ")"; - //string debug5 = "Draw Position to screen width: (" + ((i * 16 - Main.screenPosition.X + (Main.screenWidth / 30)) / Main.screenWidth).ToString() + ", " + ((j * 16 - Main.screenPosition.Y + (Main.screenWidth / 30)) / Main.screenWidth).ToString() + ")"; - //string debug4 = "Tile Screen Position: (" + (i * 16 - Main.screenPosition.X).ToString() + ", " + (j * 16 - Main.screenPosition.Y).ToString() + ")"; - //Main.NewText(debug, Color.White); - //Main.NewText(debug3, Color.White); - //Main.NewText(debug5, Color.White); - - if (CaptureManager.Instance.IsCapturing) - { - drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y); - } - Texture2D cloth = mod.GetTexture("Tiles/UelibloomBrick_Leaves"); - //Left - if ((Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("OccultStone") && - Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick"))) - { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset - new Vector2(16, 0), - new Rectangle(0, 0, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset - new Vector2(16, 0), - new Rectangle(0, 36, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset - new Vector2(16, 0), - new Rectangle(0, 72, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } - } - //Right - if ((Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("OccultStone")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("OccultStone") && - Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick"))) - { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 0), - new Rectangle(36, 0, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 0), - new Rectangle(36, 36, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 0), - new Rectangle(36, 72, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } - } - //Bottom Left - if (((Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 2, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 2, j - 1].type == mod.TileType("UelibloomBrick"))) && - Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone")) - { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(-16, 16), - new Rectangle(0, 18, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(-16, 16), - new Rectangle(0, 54, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(-16, 16), - new Rectangle(0, 90, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } - } - //Bottom Right - if (((Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 2, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 2, j - 1].type == mod.TileType("UelibloomBrick"))) && - Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone")) - { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 16), - new Rectangle(36, 18, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 16), - new Rectangle(36, 54, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(16, 16), - new Rectangle(36, 90, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } - } - //Bottom - if ((Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick") && - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick")) || - (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && - Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && - (Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") || - Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) && - Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && - Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick"))) - { - //xPos must be based on the occult stone tile pos, not this tile - int xPos = i % 3; - //We also want to make sure that these sections reflect the colour of the light being cast upon the tile - Color lightColor = GetDrawColour(i, j); - switch (xPos) - { - case 0: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(0, 16), - new Rectangle(18, 18, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 1: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(0, 16), - new Rectangle(18, 54, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - case 2: - spriteBatch.Draw - ( - cloth, - drawOffset + new Vector2(0, 16), - new Rectangle(18, 90, 16, 16), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - break; - } - } - } - - /// - /// Gets the colour that should be used for drawing the additions to the tile - /// - /// The x index of the tile - /// The y index of the tile - /// - private Color GetDrawColour(int i, int j) - { - Color lightColour = Lighting.GetColor(i, j); - //Color paintColour = WorldGen.paintColor(Main.tile[i, j].color()); - //Color drawColour = Color.White; - //drawColour = lightColour; - //drawColour.R = (byte)((paintColour.R / 255) * lightColour.R); - //drawColour.G = (byte)((paintColour.G / 255) * lightColour.G); - //drawColour.B = (byte)((paintColour.B / 255) * lightColour.B); - return (lightColour); - } - - /// - /// Gets the offset in both axes that should be used for drawing the additions to the tile - /// - /// The pixel draw offset of the postdrawn sprite in both axes - private int GetDrawOffset() - { - int drawOffset = 0; - if (Main.screenWidth < 1664f) - { - drawOffset = 193; - } - else - { - drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); - } - return (drawOffset - 1); - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ObjectData; +using Terraria.ModLoader; +using Terraria.Graphics.Capture; + +namespace CalamityMod.Tiles +{ + public class UelibloomBrick : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; + soundType = 21; + minPick = 200; + drop = mod.ItemType("UelibloomBrick"); + AddMapEntry(new Color(174, 108, 46)); + animationFrameHeight = 90; + } + int animationFrameWidth = 234; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 39, 0, 0, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0, 0, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Main.tile[i, j].color(0); + return true; + } + + public override bool Slope(int i, int j) + { + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + //I'm so sorry about this section + //This selects the particular pattern to draw, instead of based on just position also being based on relation to an edge. + int uniqueAnimationFrameX = i % 3; + int uniqueAnimationFrameY = Main.tileFrame[Type] + j; + if (Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick")) + { + //Row 1 and Row 10 + if ((Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick")) || + (Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 2].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 2, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 2, j - 2].type != mod.TileType("UelibloomBrick"))) + { + //Row 10 + uniqueAnimationFrameY = 9; + } + else + { + //Row 1 + uniqueAnimationFrameY = 0; + } + } + else if ((Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick")) || + (Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) || + (Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick")) || + (Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick"))) + { + //Row 1 and Row 7 + if (Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") || + ((Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") || + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) && + Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && + !(Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick"))) || + ((Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") || + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) && + Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && + !(Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick")))) + { + //Row 1 + uniqueAnimationFrameY = 0; + } + else + { + //Row 7 + uniqueAnimationFrameY = 6; + } + } + else if ((Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick"))) + { + //Row 3 and Row 8 + if (Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 2].type == mod.TileType("UelibloomBrick")) + { + //Row 3 + uniqueAnimationFrameY = 2; + } + else + { + //Row 8 + uniqueAnimationFrameY = 7; + } + } + else if ((Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick"))) + { + //Row 5 and Row 9 + if (Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 2].type == mod.TileType("UelibloomBrick")) + { + //Row 5 + uniqueAnimationFrameY = 4; + } + else + { + //Row 9 + uniqueAnimationFrameY = 8; + } + } + else if ((Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 2].type != mod.TileType("UelibloomBrick")) || + + (((Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && + (Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick") || + Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick"))) || + (Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick")) && + (Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") || + Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick")))) || + + (Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick"))) + { + //Row 2 + uniqueAnimationFrameY = 1; + } + else if ((Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 2].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick"))) + { + //Row 4 + uniqueAnimationFrameY = 3; + } + else if ((Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 2].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 2].type == mod.TileType("UelibloomBrick"))) + { + //Row 6 + uniqueAnimationFrameY = 5; + } + else + { + uniqueAnimationFrameX = 1; + uniqueAnimationFrameY = 1; + } + + frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameYOffset = uniqueAnimationFrameY * animationFrameHeight; + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) + { + Main.specX[nextSpecialDrawIndex] = i; + Main.specY[nextSpecialDrawIndex] = j; + nextSpecialDrawIndex++; + } + + 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()); + //string debug = "Main.screenWidth: " + Main.screenWidth.ToString(); + //string debug2 = "Tile Position: (" + (i * 16).ToString() + ", " + (j * 16).ToString() + ")"; + //string debug3 = "Draw Position: (" + (i * 16 - Main.screenPosition.X + (Main.screenWidth / 30)).ToString() + ", " + (j * 16 - Main.screenPosition.Y + (Main.screenWidth / 30)).ToString() + ")"; + //string debug5 = "Draw Position to screen width: (" + ((i * 16 - Main.screenPosition.X + (Main.screenWidth / 30)) / Main.screenWidth).ToString() + ", " + ((j * 16 - Main.screenPosition.Y + (Main.screenWidth / 30)) / Main.screenWidth).ToString() + ")"; + //string debug4 = "Tile Screen Position: (" + (i * 16 - Main.screenPosition.X).ToString() + ", " + (j * 16 - Main.screenPosition.Y).ToString() + ")"; + //Main.NewText(debug, Color.White); + //Main.NewText(debug3, Color.White); + //Main.NewText(debug5, Color.White); + + if (CaptureManager.Instance.IsCapturing) + { + drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y); + } + Texture2D cloth = mod.GetTexture("Tiles/UelibloomBrick_Leaves"); + //Left + if ((Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type != mod.TileType("OccultStone")) || + (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type != mod.TileType("OccultStone") && + Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick"))) + { + //xPos must be based on the occult stone tile pos, not this tile + int xPos = i % 3; + //We also want to make sure that these sections reflect the colour of the light being cast upon the tile + Color lightColor = GetDrawColour(i, j); + switch (xPos) + { + case 0: + spriteBatch.Draw + ( + cloth, + drawOffset - new Vector2(16, 0), + new Rectangle(0, 0, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + case 1: + spriteBatch.Draw + ( + cloth, + drawOffset - new Vector2(16, 0), + new Rectangle(0, 36, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + case 2: + spriteBatch.Draw + ( + cloth, + drawOffset - new Vector2(16, 0), + new Rectangle(0, 72, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + } + } + //Right + if ((Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type != mod.TileType("OccultStone")) || + (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type != mod.TileType("OccultStone") && + Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick"))) + { + //xPos must be based on the occult stone tile pos, not this tile + int xPos = i % 3; + //We also want to make sure that these sections reflect the colour of the light being cast upon the tile + Color lightColor = GetDrawColour(i, j); + switch (xPos) + { + case 0: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(16, 0), + new Rectangle(36, 0, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + case 1: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(16, 0), + new Rectangle(36, 36, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + case 2: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(16, 0), + new Rectangle(36, 72, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + } + } + //Bottom Left + if (((Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick")) || + (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick")) || + (Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 2, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 2, j - 1].type == mod.TileType("UelibloomBrick"))) && + Main.tile[i + 1, j - 1].type != mod.TileType("OccultStone")) + { + //xPos must be based on the occult stone tile pos, not this tile + int xPos = i % 3; + //We also want to make sure that these sections reflect the colour of the light being cast upon the tile + Color lightColor = GetDrawColour(i, j); + switch (xPos) + { + case 0: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(-16, 16), + new Rectangle(0, 18, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + case 1: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(-16, 16), + new Rectangle(0, 54, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + case 2: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(-16, 16), + new Rectangle(0, 90, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + } + } + //Bottom Right + if (((Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick")) || + (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick")) || + (Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 2, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 2, j - 1].type == mod.TileType("UelibloomBrick"))) && + Main.tile[i - 1, j - 1].type != mod.TileType("OccultStone")) + { + //xPos must be based on the occult stone tile pos, not this tile + int xPos = i % 3; + //We also want to make sure that these sections reflect the colour of the light being cast upon the tile + Color lightColor = GetDrawColour(i, j); + switch (xPos) + { + case 0: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(16, 16), + new Rectangle(36, 18, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + case 1: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(16, 16), + new Rectangle(36, 54, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + case 2: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(16, 16), + new Rectangle(36, 90, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + } + } + //Bottom + if ((Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type != mod.TileType("UelibloomBrick")) || + (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick")) || + (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j].type != mod.TileType("UelibloomBrick") && + Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type == mod.TileType("UelibloomBrick")) || + (Main.tile[i, j].type == mod.TileType("UelibloomBrick") && + Main.tile[i, j - 1].type == mod.TileType("UelibloomBrick") && + (Main.tile[i - 1, j].type == mod.TileType("UelibloomBrick") || + Main.tile[i + 1, j].type == mod.TileType("UelibloomBrick")) && + Main.tile[i - 1, j - 1].type != mod.TileType("UelibloomBrick") && + Main.tile[i + 1, j - 1].type != mod.TileType("UelibloomBrick"))) + { + //xPos must be based on the occult stone tile pos, not this tile + int xPos = i % 3; + //We also want to make sure that these sections reflect the colour of the light being cast upon the tile + Color lightColor = GetDrawColour(i, j); + switch (xPos) + { + case 0: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(0, 16), + new Rectangle(18, 18, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + case 1: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(0, 16), + new Rectangle(18, 54, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + case 2: + spriteBatch.Draw + ( + cloth, + drawOffset + new Vector2(0, 16), + new Rectangle(18, 90, 16, 16), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + break; + } + } + } + + /// + /// Gets the colour that should be used for drawing the additions to the tile + /// + /// The x index of the tile + /// The y index of the tile + /// + private Color GetDrawColour(int i, int j) + { + Color lightColour = Lighting.GetColor(i, j); + //Color paintColour = WorldGen.paintColor(Main.tile[i, j].color()); + //Color drawColour = Color.White; + //drawColour = lightColour; + //drawColour.R = (byte)((paintColour.R / 255) * lightColour.R); + //drawColour.G = (byte)((paintColour.G / 255) * lightColour.G); + //drawColour.B = (byte)((paintColour.B / 255) * lightColour.B); + return (lightColour); + } + + /// + /// Gets the offset in both axes that should be used for drawing the additions to the tile + /// + /// The pixel draw offset of the postdrawn sprite in both axes + private int GetDrawOffset() + { + int drawOffset = 0; + if (Main.screenWidth < 1664f) + { + drawOffset = 193; + } + else + { + drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); + } + return (drawOffset - 1); + } + } +} diff --git a/Tiles/UelibloomOre.cs b/Tiles/UelibloomOre.cs index 3628602b22..e8c156355a 100644 --- a/Tiles/UelibloomOre.cs +++ b/Tiles/UelibloomOre.cs @@ -1,37 +1,37 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class UelibloomOre : ModTile - { - public override void SetDefaults() - { - 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(); - name.SetDefault("Uelibloom Ore"); - AddMapEntry(new Color(0, 255, 0), name); - mineResist = 5f; - minPick = 250; - soundType = 21; - Main.tileSpelunker[Type] = true; - } - - public override bool CanExplode(int i, int j) - { - return NPC.downedMoonlord; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class UelibloomOre : ModTile + { + public override void SetDefaults() + { + 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(); + name.SetDefault("Uelibloom Ore"); + AddMapEntry(new Color(0, 255, 0), name); + mineResist = 5f; + minPick = 250; + soundType = 21; + Main.tileSpelunker[Type] = true; + } + + public override bool CanExplode(int i, int j) + { + return NPC.downedMoonlord; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/ViperVines.cs b/Tiles/ViperVines.cs index b46ef5fe8a..d529f0e522 100644 --- a/Tiles/ViperVines.cs +++ b/Tiles/ViperVines.cs @@ -1,30 +1,30 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles -{ - public class ViperVines : ModTile - { - public override void SetDefaults() - { - Main.tileCut[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileNoFail[Type] = true; - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Viper Vines"); - AddMapEntry(new Color(0, 50, 0), name); - soundType = 6; - dustType = 2; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class ViperVines : ModTile + { + public override void SetDefaults() + { + Main.tileCut[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileNoFail[Type] = true; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Viper Vines"); + AddMapEntry(new Color(0, 50, 0), name); + soundType = 6; + dustType = 2; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { //GIVE VINE ROPE IF SPECIAL VINE BOOK @@ -32,65 +32,65 @@ namespace CalamityMod.Tiles { Item.NewItem(new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope); } - if (Main.tile[i, j + 1] != null) - { - if (Main.tile[i, j + 1].active()) - { - if (Main.tile[i, j + 1].type == mod.TileType("ViperVines")) - { - WorldGen.KillTile(i, j + 1, false, false, false); - if (!Main.tile[i, j + 1].active() && Main.netMode != 0) - { - NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); - } - } - } - } - } - - public override void RandomUpdate(int i, int j) - { - if (Main.tile[i, j + 1] != null) - { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)mod.TileType("ViperVines")) - { - if (Main.tile[i, j + 1].liquid >= 128 && !Main.tile[i, j + 1].lava()) - { - bool flag13 = false; - for (int num52 = j; num52 > j - 10; j--) - { - if (Main.tile[i, num52].bottomSlope()) - { - flag13 = false; - break; - } - if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) - { - flag13 = true; - break; - } - } - if (flag13) - { - int num53 = i; - int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)mod.TileType("ViperVines"); - Main.tile[num53, num54].frameX = (short)(WorldGen.genRand.Next(8) * 18); - Main.tile[num53, num54].frameY = (short)(4 * 18); - Main.tile[num53, num54 - 1].frameX = (short)(WorldGen.genRand.Next(12) * 18); - Main.tile[num53, num54 - 1].frameY = (short)(WorldGen.genRand.Next(4) * 18); - Main.tile[num53, num54].active(true); - WorldGen.SquareTileFrame(num53, num54, true); - WorldGen.SquareTileFrame(num53, num54 - 1, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); - NetMessage.SendTileSquare(-1, num53, num54 - 1, 3, TileChangeType.None); - } - } - } - } - } - } - } -} \ No newline at end of file + if (Main.tile[i, j + 1] != null) + { + if (Main.tile[i, j + 1].active()) + { + if (Main.tile[i, j + 1].type == mod.TileType("ViperVines")) + { + WorldGen.KillTile(i, j + 1, false, false, false); + if (!Main.tile[i, j + 1].active() && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); + } + } + } + } + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j + 1] != null) + { + if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)mod.TileType("ViperVines")) + { + if (Main.tile[i, j + 1].liquid >= 128 && !Main.tile[i, j + 1].lava()) + { + bool flag13 = false; + for (int num52 = j; num52 > j - 10; j--) + { + if (Main.tile[i, num52].bottomSlope()) + { + flag13 = false; + break; + } + if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) + { + flag13 = true; + break; + } + } + if (flag13) + { + int num53 = i; + int num54 = j + 1; + Main.tile[num53, num54].type = (ushort)mod.TileType("ViperVines"); + Main.tile[num53, num54].frameX = (short)(WorldGen.genRand.Next(8) * 18); + Main.tile[num53, num54].frameY = (short)(4 * 18); + Main.tile[num53, num54 - 1].frameX = (short)(WorldGen.genRand.Next(12) * 18); + Main.tile[num53, num54 - 1].frameY = (short)(WorldGen.genRand.Next(4) * 18); + Main.tile[num53, num54].active(true); + WorldGen.SquareTileFrame(num53, num54, true); + WorldGen.SquareTileFrame(num53, num54 - 1, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); + NetMessage.SendTileSquare(-1, num53, num54 - 1, 3, TileChangeType.None); + } + } + } + } + } + } + } +} diff --git a/Tiles/Voidstone.cs b/Tiles/Voidstone.cs index 2fb738ca24..bd8cc90c82 100644 --- a/Tiles/Voidstone.cs +++ b/Tiles/Voidstone.cs @@ -1,331 +1,331 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Graphics.Capture; -using CalamityMod.World; - -namespace CalamityMod.Tiles -{ - public class Voidstone : ModTile - { - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - soundType = 21; - mineResist = 10f; - minPick = 180; - dustType = 187; - drop = mod.ItemType("Voidstone"); - AddMapEntry(new Color(10, 10, 10)); - } - - public override bool CanExplode(int i, int j) - { - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (!closer && j < Main.maxTilesY - 205) - { - if (Main.tile[i, j].liquid <= 0) - { - Main.tile[i, j].liquid = 255; - Main.tile[i, j].lava(false); - } - } - } - - public override void RandomUpdate(int i, int j) - { - if (Main.rand.Next(20) == 0) - { - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - int random = WorldGen.genRand.Next(4); - if (random == 0) - { - i++; - } - if (random == 1) - { - i--; - } - if (random == 2) - { - j++; - } - if (random == 3) - { - j--; - } - if (Main.tile[i, j] != null) - { - if (!Main.tile[i, j].active()) - { - if (!Main.tile[i, j].lava() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick()) - { - Main.tile[i, j].type = (ushort)mod.TileType("LumenylCrystals"); - Main.tile[i, j].active(true); - if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(0 * 18); - } - else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) - { - Main.tile[i, j].frameY = (short)(1 * 18); - } - else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(2 * 18); - } - else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) - { - Main.tile[i, j].frameY = (short)(3 * 18); - } - Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); - WorldGen.SquareTileFrame(i, j, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); - } - } - } - } - } - } - } - - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - int uniqueAnimationFrameX = 0; - int xPos = i % 4; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 0; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 2; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 2: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 2; - break; - case 1: - uniqueAnimationFrameX = 0; - break; - case 2: - uniqueAnimationFrameX = 1; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - case 3: - switch (yPos) - { - case 0: - uniqueAnimationFrameX = 1; - break; - case 1: - uniqueAnimationFrameX = 2; - break; - case 2: - uniqueAnimationFrameX = 0; - break; - case 3: - uniqueAnimationFrameX = 2; - break; - default: - uniqueAnimationFrameX = 2; - break; - } - break; - } - frameXOffset = uniqueAnimationFrameX * 288; - } - - 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; - int relativeXPos = i % 4; - int relativeYPos = j % 4; - switch (relativeXPos) - { - case 0: - switch (relativeYPos) - { - case 0: - xOffset = 0; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 1: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 2; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 2: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 3: - switch (relativeYPos) - { - case 0: - xOffset = 1; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 0; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - } - xOffset = xOffset * 288; - xPos += xOffset; - Texture2D glowmask = mod.GetTexture("Tiles/Voidstone_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 - ); - } - - private int GetDrawOffset() - { - int drawOffset = 0; - if (Main.screenWidth < 1664f) - { - drawOffset = 193; - } - else - { - drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); - } - return (drawOffset - 1); - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Capture; +using CalamityMod.World; + +namespace CalamityMod.Tiles +{ + public class Voidstone : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + soundType = 21; + mineResist = 10f; + minPick = 180; + dustType = 187; + drop = mod.ItemType("Voidstone"); + AddMapEntry(new Color(10, 10, 10)); + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (!closer && j < Main.maxTilesY - 205) + { + if (Main.tile[i, j].liquid <= 0) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + } + + public override void RandomUpdate(int i, int j) + { + if (Main.rand.Next(20) == 0) + { + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + int random = WorldGen.genRand.Next(4); + if (random == 0) + { + i++; + } + if (random == 1) + { + i--; + } + if (random == 2) + { + j++; + } + if (random == 3) + { + j--; + } + if (Main.tile[i, j] != null) + { + if (!Main.tile[i, j].active()) + { + if (!Main.tile[i, j].lava() && Main.tile[i, j].slope() == 0 && !Main.tile[i, j].halfBrick()) + { + Main.tile[i, j].type = (ushort)mod.TileType("LumenylCrystals"); + Main.tile[i, j].active(true); + if (Main.tile[i, j + 1].active() && Main.tileSolid[Main.tile[i, j + 1].type] && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(0 * 18); + } + else if (Main.tile[i, j - 1].active() && Main.tileSolid[Main.tile[i, j - 1].type] && Main.tile[i, j - 1].slope() == 0 && !Main.tile[i, j - 1].halfBrick()) + { + Main.tile[i, j].frameY = (short)(1 * 18); + } + else if (Main.tile[i + 1, j].active() && Main.tileSolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && !Main.tile[i + 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(2 * 18); + } + else if (Main.tile[i - 1, j].active() && Main.tileSolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && !Main.tile[i - 1, j].halfBrick()) + { + Main.tile[i, j].frameY = (short)(3 * 18); + } + Main.tile[i, j].frameX = (short)(WorldGen.genRand.Next(18) * 18); + WorldGen.SquareTileFrame(i, j, true); + if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); + } + } + } + } + } + } + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int uniqueAnimationFrameX = 0; + int xPos = i % 4; + int yPos = j % 4; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 2; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 2: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 3: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 0; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + } + frameXOffset = uniqueAnimationFrameX * 288; + } + + 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; + int relativeXPos = i % 4; + int relativeYPos = j % 4; + switch (relativeXPos) + { + case 0: + switch (relativeYPos) + { + case 0: + xOffset = 0; + break; + case 1: + xOffset = 2; + break; + case 2: + xOffset = 1; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + case 1: + switch (relativeYPos) + { + case 0: + xOffset = 2; + break; + case 1: + xOffset = 0; + break; + case 2: + xOffset = 2; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + case 2: + switch (relativeYPos) + { + case 0: + xOffset = 2; + break; + case 1: + xOffset = 0; + break; + case 2: + xOffset = 1; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + case 3: + switch (relativeYPos) + { + case 0: + xOffset = 1; + break; + case 1: + xOffset = 2; + break; + case 2: + xOffset = 0; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + } + xOffset = xOffset * 288; + xPos += xOffset; + Texture2D glowmask = mod.GetTexture("Tiles/Voidstone_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 + ); + } + + private int GetDrawOffset() + { + int drawOffset = 0; + if (Main.screenWidth < 1664f) + { + drawOffset = 193; + } + else + { + drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); + } + return (drawOffset - 1); + } + } +} diff --git a/Tiles/YellowCandle.cs b/Tiles/YellowCandle.cs index ab0916f22c..9608761388 100644 --- a/Tiles/YellowCandle.cs +++ b/Tiles/YellowCandle.cs @@ -1,72 +1,72 @@ -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 YellowCandle : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Spiteful Candle"); - AddMapEntry(new Color(238, 145, 105), name); - animationFrameHeight = 34; - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter >= 6) - { - frame = (frame + 1) % 6; - frameCounter = 0; - } - } - - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (!player.dead && player.active) - { - player.AddBuff(mod.BuffType("YellowDamageCandle"), 20); - if (Main.netMode != 1) - { - for (int m = 0; m < 200; m++) - { - if (Main.npc[m].active && !Main.npc[m].friendly) - { - Main.npc[m].buffImmune[mod.BuffType("YellowDamageCandle")] = false; - if (Main.npc[m].type == mod.NPCType("CeaselessVoid") || Main.npc[m].type == mod.NPCType("EidolonWyrmHeadHuge")) - { - Main.npc[m].buffImmune[mod.BuffType("YellowDamageCandle")] = true; - } - Main.npc[m].AddBuff(mod.BuffType("YellowDamageCandle"), 20, false); - } - } - } - } - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.75f; - g = 0.75f; - b = 0.35f; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("YellowCandle")); - } - } -} +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 YellowCandle : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Spiteful Candle"); + AddMapEntry(new Color(238, 145, 105), name); + animationFrameHeight = 34; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + { + player.AddBuff(mod.BuffType("YellowDamageCandle"), 20); + if (Main.netMode != 1) + { + for (int m = 0; m < 200; m++) + { + if (Main.npc[m].active && !Main.npc[m].friendly) + { + Main.npc[m].buffImmune[mod.BuffType("YellowDamageCandle")] = false; + if (Main.npc[m].type == mod.NPCType("CeaselessVoid") || Main.npc[m].type == mod.NPCType("EidolonWyrmHeadHuge")) + { + Main.npc[m].buffImmune[mod.BuffType("YellowDamageCandle")] = true; + } + Main.npc[m].AddBuff(mod.BuffType("YellowDamageCandle"), 20, false); + } + } + } + } + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.75f; + g = 0.75f; + b = 0.35f; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, mod.ItemType("YellowCandle")); + } + } +} diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs index 7d126e965b..e01fe3cb84 100644 --- a/UI/AstralArcanumUI.cs +++ b/UI/AstralArcanumUI.cs @@ -1,204 +1,204 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -using CalamityMod.World; - -using ReLogic.Graphics; - -namespace CalamityMod.UI -{ - public static class AstralArcanumUI - { - enum CircleStyle - { - Normal, - Selected - } - - private const int WindowBorder = 50; - private const int CircleTextureSize = 40; //don't change unless textures change size - private const int CircleOffset = 36; - - private static Vector2 CenterPoint; - private static bool Open; - - private static Texture2D CircleTextures; - private static string[] CircleNames; - - private static int LastHovered; - - public static void Load(Mod mod) - { - CircleTextures = mod.GetTexture("ExtraTextures/UI/AstralArcanumCircles"); - CircleNames = new string[] - { - "Underworld", - "Dungeon", - "Jungle", - "Random" - }; - } - - public static void Unload() - { - CircleNames = null; - CircleTextures = null; - } - - public static void Toggle() - { - Open = !Open; - - if (Open) - { - CenterPoint = new Vector2(Main.mouseX, Main.mouseY); - //Clamp center so UI doesn't go off screen - CenterPoint.X = MathHelper.Clamp(CenterPoint.X, WindowBorder, Main.screenWidth - WindowBorder); - CenterPoint.Y = MathHelper.Clamp(CenterPoint.Y, WindowBorder, Main.screenHeight - WindowBorder); - } - else - { - //Closed, do stuff in here if need be - } - } - - public static void UpdateAndDraw(SpriteBatch sb) - { - //Don't do anything if not open - bool forceOpenAndTeleport = CalamityWorld.bossRushStage == 12 && !NPCs.CalamityGlobalNPC.AnyBossNPCS() && !Main.player[Main.myPlayer].ZoneUnderworldHeight; - if (forceOpenAndTeleport) - { - Open = true; - } - else if (CalamityWorld.bossRushActive) Open = false; - if (!Open) return; - - //Draw center circle - DrawCircle(sb, CenterPoint, 0, CircleStyle.Normal); - - Vector2 centerToMouse = Main.MouseScreen - CenterPoint; - float rotation = centerToMouse.ToRotation(); - - //Draw the arrow that points towards the mouse - sb.Draw(CircleTextures, CenterPoint, new Rectangle(0, CircleTextureSize, 24, 10), Color.White, rotation, new Vector2(12, 5f), 1f, SpriteEffects.None, 0f); - - int current = 0; - int selectedCircle = -1; - for (int x = 0; x < 2; x++) - { - for (int y = 0; y < 2; y++) - { - Vector2 center = new Vector2( - CenterPoint.X - CircleOffset + x * CircleOffset * 2, - CenterPoint.Y - CircleOffset + y * CircleOffset * 2); - - Circle c = new Circle(center, CircleTextureSize / 2); - - CircleStyle style = CircleStyle.Normal; - - //If the mouse is in the circle - if (c.Contains(Main.MouseScreen) || forceOpenAndTeleport) - { - style = CircleStyle.Selected; - - Main.LocalPlayer.mouseInterface = true; - - if (forceOpenAndTeleport) - { - current = 0; - } - - selectedCircle = current; - - //If left clicked - if ((Main.mouseLeft && Main.mouseLeftRelease) || forceOpenAndTeleport) - { - Main.mouseLeftRelease = false; - Main.mouseLeft = false; - - DoTeleportation(current); - } - } - - DrawCircle(sb, center, 1 + current, style); - - current++; - } - } - - //Literally so the sound plays - if (LastHovered != selectedCircle) - { - LastHovered = selectedCircle; - if (LastHovered != -1) - Main.PlaySound(12, -1, -1, 1, 1f, 0f); - } - - string text = "Select"; - if (selectedCircle != -1) - { - text = CircleNames[selectedCircle]; - } - - Vector2 size = Main.fontMouseText.MeasureString(text); - Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, text, CenterPoint.X - size.X / 2f, CenterPoint.Y + CircleOffset + CircleTextureSize / 2 + 4, Color.White, Color.Black, default(Vector2)); - } - - public static void DoTeleportation(int circle) - { - Open = false; - - Player p = Main.LocalPlayer; - - if (circle == 3) - { - if (Main.netMode == 0) - { - p.TeleportationPotion(); - Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 6, 1f, 0f); - } - else if (Main.netMode == 1) - { - NetMessage.SendData(73, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else - { - Main.player[Main.myPlayer].GetModPlayer(ModLoader.GetMod("CalamityMod")).HandleTeleport(circle, false, 0); - } - } - - private static void DrawCircle(SpriteBatch sb, Vector2 center, int circle, CircleStyle style) - { - sb.Draw(CircleTextures, center, new Rectangle(circle * CircleTextureSize, (int)style * CircleTextureSize, CircleTextureSize, CircleTextureSize), Color.White, 0f, new Vector2(CircleTextureSize / 2), 1f, SpriteEffects.None, 0f); - } - - private class Circle - { - public Vector2 Center; - public float Radius; - public Circle(Vector2 C, float R) - { - this.Center = C; - this.Radius = R; - } - public bool Contains(Vector2 point) - { - return Vector2.Distance(Center, point) < Radius; - } - public bool Contains(Point point) - { - return Contains(point.ToVector2()); - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +using CalamityMod.World; + +using ReLogic.Graphics; + +namespace CalamityMod.UI +{ + public static class AstralArcanumUI + { + enum CircleStyle + { + Normal, + Selected + } + + private const int WindowBorder = 50; + private const int CircleTextureSize = 40; //don't change unless textures change size + private const int CircleOffset = 36; + + private static Vector2 CenterPoint; + private static bool Open; + + private static Texture2D CircleTextures; + private static string[] CircleNames; + + private static int LastHovered; + + public static void Load(Mod mod) + { + CircleTextures = mod.GetTexture("ExtraTextures/UI/AstralArcanumCircles"); + CircleNames = new string[] + { + "Underworld", + "Dungeon", + "Jungle", + "Random" + }; + } + + public static void Unload() + { + CircleNames = null; + CircleTextures = null; + } + + public static void Toggle() + { + Open = !Open; + + if (Open) + { + CenterPoint = new Vector2(Main.mouseX, Main.mouseY); + //Clamp center so UI doesn't go off screen + CenterPoint.X = MathHelper.Clamp(CenterPoint.X, WindowBorder, Main.screenWidth - WindowBorder); + CenterPoint.Y = MathHelper.Clamp(CenterPoint.Y, WindowBorder, Main.screenHeight - WindowBorder); + } + else + { + //Closed, do stuff in here if need be + } + } + + public static void UpdateAndDraw(SpriteBatch sb) + { + //Don't do anything if not open + bool forceOpenAndTeleport = CalamityWorld.bossRushStage == 12 && !NPCs.CalamityGlobalNPC.AnyBossNPCS() && !Main.player[Main.myPlayer].ZoneUnderworldHeight; + if (forceOpenAndTeleport) + { + Open = true; + } + else if (CalamityWorld.bossRushActive) Open = false; + if (!Open) return; + + //Draw center circle + DrawCircle(sb, CenterPoint, 0, CircleStyle.Normal); + + Vector2 centerToMouse = Main.MouseScreen - CenterPoint; + float rotation = centerToMouse.ToRotation(); + + //Draw the arrow that points towards the mouse + sb.Draw(CircleTextures, CenterPoint, new Rectangle(0, CircleTextureSize, 24, 10), Color.White, rotation, new Vector2(12, 5f), 1f, SpriteEffects.None, 0f); + + int current = 0; + int selectedCircle = -1; + for (int x = 0; x < 2; x++) + { + for (int y = 0; y < 2; y++) + { + Vector2 center = new Vector2( + CenterPoint.X - CircleOffset + x * CircleOffset * 2, + CenterPoint.Y - CircleOffset + y * CircleOffset * 2); + + Circle c = new Circle(center, CircleTextureSize / 2); + + CircleStyle style = CircleStyle.Normal; + + //If the mouse is in the circle + if (c.Contains(Main.MouseScreen) || forceOpenAndTeleport) + { + style = CircleStyle.Selected; + + Main.LocalPlayer.mouseInterface = true; + + if (forceOpenAndTeleport) + { + current = 0; + } + + selectedCircle = current; + + //If left clicked + if ((Main.mouseLeft && Main.mouseLeftRelease) || forceOpenAndTeleport) + { + Main.mouseLeftRelease = false; + Main.mouseLeft = false; + + DoTeleportation(current); + } + } + + DrawCircle(sb, center, 1 + current, style); + + current++; + } + } + + //Literally so the sound plays + if (LastHovered != selectedCircle) + { + LastHovered = selectedCircle; + if (LastHovered != -1) + Main.PlaySound(12, -1, -1, 1, 1f, 0f); + } + + string text = "Select"; + if (selectedCircle != -1) + { + text = CircleNames[selectedCircle]; + } + + Vector2 size = Main.fontMouseText.MeasureString(text); + Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, text, CenterPoint.X - size.X / 2f, CenterPoint.Y + CircleOffset + CircleTextureSize / 2 + 4, Color.White, Color.Black, default(Vector2)); + } + + public static void DoTeleportation(int circle) + { + Open = false; + + Player p = Main.LocalPlayer; + + if (circle == 3) + { + if (Main.netMode == 0) + { + p.TeleportationPotion(); + Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 6, 1f, 0f); + } + else if (Main.netMode == 1) + { + NetMessage.SendData(73, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else + { + Main.player[Main.myPlayer].GetModPlayer(ModLoader.GetMod("CalamityMod")).HandleTeleport(circle, false, 0); + } + } + + private static void DrawCircle(SpriteBatch sb, Vector2 center, int circle, CircleStyle style) + { + sb.Draw(CircleTextures, center, new Rectangle(circle * CircleTextureSize, (int)style * CircleTextureSize, CircleTextureSize, CircleTextureSize), Color.White, 0f, new Vector2(CircleTextureSize / 2), 1f, SpriteEffects.None, 0f); + } + + private class Circle + { + public Vector2 Center; + public float Radius; + public Circle(Vector2 C, float R) + { + this.Center = C; + this.Radius = R; + } + public bool Contains(Vector2 point) + { + return Vector2.Distance(Center, point) < Radius; + } + public bool Contains(Point point) + { + return Contains(point.ToVector2()); + } + } + } +} diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 9e8d1e9b6e..065aaec2fe 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -1,1076 +1,1076 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using ReLogic.Graphics; - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent.Events; - -namespace CalamityMod.UI -{ - /* - Heyo! Here's some things you might need to know about this class and where to change things: - - In the "Load" method is where the "OneToMany" dictionary is updated. - If an NPC is made up of multiple segments (such as EoW, etc.) that all have separate health but would be considered a single boss, you can update the dictionary. - The boss health bar will automatically keep track of all segments of that type and add up the health. - - The "SetupExclusionList" method allows you to check for if certain mods are loaded and setup the exclusion list based on what mods are loaded. - For now I've had to load calamity separately, you might want to change that by just passing in Calamity itself etc. - - If you need to add a special kind of health bar, like the EoW one which counts the number of segments left, let me know. - I may need to dive into the spaghetti to add it. - - There's a few readonly fields at the top of both classes that you can edit should you deem it fit to. Change the animation lengths, etc. - The bar uses those and shouldn't have any problems dealing with the new values - (although the flickering in the start animation will always happen in the first 20 frames or so) - - As for toggling, in the Mod File, you can simply add a boolean check and not draw or update the health bar manager. - There is a "SHOULD_DRAW_SMALLTEXT_HEALTH" field below here which is public, if that's false then the smalltext won't draw. - - That should be it -- ask if you have any questions! - */ - - internal static class BossHealthBarManager - { - private static readonly int MAX_BARS = 4; //4 - - public static bool SHOULD_DRAW_SMALLTEXT_HEALTH = true; - - private static List Bars; - - private static DynamicSpriteFont HPBarFont; - private static Texture2D BossMainHPBar; - private static Texture2D BossComboHPBar; - private static Texture2D BossSeperatorBar; - - private static Dictionary OneToMany; - private static List ExclusionList; - private static List MinibossHPBarList; - - public static void Load(Mod mod) - { - Bars = new List(); - - if (!Main.dedServ) - { - BossMainHPBar = mod.GetTexture("ExtraTextures/UI/BossHPMainBar"); - BossComboHPBar = mod.GetTexture("ExtraTextures/UI/BossHPComboBar"); - BossSeperatorBar = mod.GetTexture("ExtraTextures/UI/BossHPSeperatorBar"); - - PlatformID id = Environment.OSVersion.Platform; - if (id == PlatformID.Win32NT && !Environment.Is64BitProcess) - { - HPBarFont = mod.GetFont("Fonts/HPBarFont"); - } - else - { - HPBarFont = Main.fontMouseText; - } - } - - OneToMany = new Dictionary(); - int[] EoW = new int[] { NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail }; - OneToMany[NPCID.EaterofWorldsHead] = EoW; - OneToMany[NPCID.EaterofWorldsBody] = EoW; - OneToMany[NPCID.EaterofWorldsTail] = EoW; - - int[] BoC = new int[] { NPCID.BrainofCthulhu, NPCID.Creeper }; - OneToMany[NPCID.BrainofCthulhu] = BoC; - OneToMany[NPCID.Creeper] = BoC; - - int[] Skele = new int[] { NPCID.SkeletronHead, NPCID.SkeletronHand }; - OneToMany[NPCID.SkeletronHead] = Skele; - OneToMany[NPCID.SkeletronHand] = Skele; - - int[] SkelePrime = new int[] { NPCID.SkeletronPrime, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeCannon, NPCID.PrimeLaser }; - OneToMany[NPCID.SkeletronPrime] = SkelePrime; - OneToMany[NPCID.PrimeSaw] = SkelePrime; - OneToMany[NPCID.PrimeVice] = SkelePrime; - OneToMany[NPCID.PrimeCannon] = SkelePrime; - OneToMany[NPCID.PrimeLaser] = SkelePrime; - - int[] Saucer = new int[] { NPCID.MartianSaucerCore, NPCID.MartianSaucerTurret, NPCID.MartianSaucerCannon }; - OneToMany[NPCID.MartianSaucerCore] = Saucer; - OneToMany[NPCID.MartianSaucerTurret] = Saucer; - OneToMany[NPCID.MartianSaucerCannon] = Saucer; - - int[] Ship = new int[] { NPCID.PirateShip, NPCID.PirateShipCannon }; - OneToMany[NPCID.PirateShip] = Ship; - OneToMany[NPCID.PirateShipCannon] = Ship; - - int[] MoonLord = new int[] { NPCID.MoonLordHead, NPCID.MoonLordHand, NPCID.MoonLordCore }; - OneToMany[NPCID.MoonLordHead] = MoonLord; - OneToMany[NPCID.MoonLordHand] = MoonLord; - OneToMany[NPCID.MoonLordCore] = MoonLord; - - int[] StarWorm = new int[] { mod.NPCType("AstrumDeusHeadSpectral"), mod.NPCType("AstrumDeusHead") }; - OneToMany[mod.NPCType("AstrumDeusHeadSpectral")] = StarWorm; - OneToMany[mod.NPCType("AstrumDeusHead")] = StarWorm; - - int[] Cal = new int[] { mod.NPCType("CalamitasRun3"), mod.NPCType("CalamitasRun"), mod.NPCType("CalamitasRun2") }; - OneToMany[mod.NPCType("CalamitasRun3")] = Cal; - OneToMany[mod.NPCType("CalamitasRun")] = Cal; - OneToMany[mod.NPCType("CalamitasRun2")] = Cal; - - int[] Void = new int[] { mod.NPCType("CeaselessVoid"), mod.NPCType("DarkEnergy"), mod.NPCType("DarkEnergy2"), mod.NPCType("DarkEnergy3") }; - OneToMany[mod.NPCType("CeaselessVoid")] = Void; - OneToMany[mod.NPCType("DarkEnergy")] = Void; - OneToMany[mod.NPCType("DarkEnergy2")] = Void; - OneToMany[mod.NPCType("DarkEnergy3")] = Void; - - int[] Perfs = new int[] { mod.NPCType("PerforatorHive"), mod.NPCType("PerforatorHeadSmall"), mod.NPCType("PerforatorHeadMedium"), - mod.NPCType("PerforatorHeadLarge") }; - OneToMany[mod.NPCType("PerforatorHive")] = Perfs; - OneToMany[mod.NPCType("PerforatorHeadSmall")] = Perfs; - OneToMany[mod.NPCType("PerforatorHeadMedium")] = Perfs; - OneToMany[mod.NPCType("PerforatorHeadLarge")] = Perfs; - - int[] Rav = new int[] { mod.NPCType("ScavengerBody"), mod.NPCType("ScavengerClawRight"), mod.NPCType("ScavengerClawLeft"), - mod.NPCType("ScavengerLegRight"), mod.NPCType("ScavengerLegLeft"), mod.NPCType("ScavengerHead") }; - OneToMany[mod.NPCType("ScavengerBody")] = Rav; - OneToMany[mod.NPCType("ScavengerClawRight")] = Rav; - OneToMany[mod.NPCType("ScavengerClawLeft")] = Rav; - OneToMany[mod.NPCType("ScavengerLegRight")] = Rav; - OneToMany[mod.NPCType("ScavengerLegLeft")] = Rav; - OneToMany[mod.NPCType("ScavengerHead")] = Rav; - - int[] Slimes = new int[] { mod.NPCType("SlimeGodCore"), mod.NPCType("SlimeGod"), mod.NPCType("SlimeGodSplit"), - mod.NPCType("SlimeGodRun"), mod.NPCType("SlimeGodRunSplit") }; - OneToMany[mod.NPCType("SlimeGodCore")] = Slimes; - OneToMany[mod.NPCType("SlimeGod")] = Slimes; - OneToMany[mod.NPCType("SlimeGodSplit")] = Slimes; - OneToMany[mod.NPCType("SlimeGodRun")] = Slimes; - OneToMany[mod.NPCType("SlimeGodRunSplit")] = Slimes; - - SetupExclusionList(); - SetupMinibossHPBarList(); - } - - private static void SetupExclusionList() - { - ExclusionList = new List(); - - ExclusionList.Add(NPCID.MoonLordFreeEye); - ExclusionList.Add(NPCID.MoonLordHead); - ExclusionList.Add(NPCID.MoonLordHand); - ExclusionList.Add(NPCID.MoonLordCore); - - Mod calamity = ModLoader.GetMod("CalamityMod"); - if (calamity != null) - { - ExclusionList.Add(calamity.NPCType("AquaticScourgeBody")); - ExclusionList.Add(calamity.NPCType("AquaticScourgeBodyAlt")); - ExclusionList.Add(calamity.NPCType("AquaticScourgeTail")); - ExclusionList.Add(calamity.NPCType("AstrumDeusBodySpectral")); - ExclusionList.Add(calamity.NPCType("AstrumDeusTailSpectral")); - ExclusionList.Add(calamity.NPCType("DesertScourgeBody")); - ExclusionList.Add(calamity.NPCType("DesertScourgeTail")); - ExclusionList.Add(calamity.NPCType("StormWeaverHead")); - ExclusionList.Add(calamity.NPCType("StormWeaverBody")); - ExclusionList.Add(calamity.NPCType("StormWeaverTail")); - ExclusionList.Add(calamity.NPCType("StormWeaverBodyNaked")); - ExclusionList.Add(calamity.NPCType("StormWeaverTailNaked")); - ExclusionList.Add(calamity.NPCType("DevourerofGodsBody")); - ExclusionList.Add(calamity.NPCType("DevourerofGodsTail")); - ExclusionList.Add(calamity.NPCType("DevourerofGodsBodyS")); - ExclusionList.Add(calamity.NPCType("DevourerofGodsTailS")); - } - } - - private static void SetupMinibossHPBarList() - { - MinibossHPBarList = new List(); - - //DD2 Event - MinibossHPBarList.Add(NPCID.DD2Betsy); - MinibossHPBarList.Add(NPCID.DD2OgreT2); - MinibossHPBarList.Add(NPCID.DD2OgreT3); - MinibossHPBarList.Add(NPCID.DD2DarkMageT1); //800 HP - MinibossHPBarList.Add(NPCID.DD2DarkMageT3); - - //Prehardmode - MinibossHPBarList.Add(NPCID.DungeonGuardian); - - //Hardmode - MinibossHPBarList.Add(NPCID.GoblinSummoner); //2000 HP - MinibossHPBarList.Add(NPCID.Paladin); - MinibossHPBarList.Add(NPCID.IceGolem); - MinibossHPBarList.Add(NPCID.SandElemental); - MinibossHPBarList.Add(NPCID.BigMimicCorruption); - MinibossHPBarList.Add(NPCID.BigMimicCrimson); - MinibossHPBarList.Add(NPCID.BigMimicHallow); - - //Moon Events - MinibossHPBarList.Add(NPCID.MourningWood); - MinibossHPBarList.Add(NPCID.Pumpking); - MinibossHPBarList.Add(NPCID.Everscream); - MinibossHPBarList.Add(NPCID.SantaNK1); - MinibossHPBarList.Add(NPCID.IceQueen); - - //Eclipse - MinibossHPBarList.Add(NPCID.Mothron); - - Mod calamity = ModLoader.GetMod("CalamityMod"); - if (calamity != null) - { - //Prehardmode - MinibossHPBarList.Add(calamity.NPCType("GiantClam")); - - //Hardmode - MinibossHPBarList.Add(calamity.NPCType("ThiccWaifu")); - MinibossHPBarList.Add(calamity.NPCType("Horse")); - MinibossHPBarList.Add(calamity.NPCType("GreatSandShark")); - MinibossHPBarList.Add(calamity.NPCType("PlaguebringerShade")); - MinibossHPBarList.Add(calamity.NPCType("ArmoredDiggerHead")); - - //Abyss - MinibossHPBarList.Add(calamity.NPCType("EidolonWyrmHeadHuge")); - - //Post-ML - MinibossHPBarList.Add(calamity.NPCType("SupremeCataclysm")); - MinibossHPBarList.Add(calamity.NPCType("SupremeCatastrophe")); - MinibossHPBarList.Add(calamity.NPCType("ProvSpawnDefense")); - MinibossHPBarList.Add(calamity.NPCType("ProvSpawnOffense")); - MinibossHPBarList.Add(calamity.NPCType("ProvSpawnHealer")); - } - } - - public static void Unload() - { - BossMainHPBar = null; - BossComboHPBar = null; - BossSeperatorBar = null; - HPBarFont = null; - Bars = null; - ExclusionList = null; - MinibossHPBarList = null; - OneToMany = null; - } - - public static void Update() - { - for (int i = 0; i < Main.npc.Length; i++) - { - //Is NPC active - if (!Main.npc[i].active) continue; - - //Is npc in exclusion list - int type = Main.npc[i].type; - if (Main.npc[i].type == NPCID.MoonLordCore) - { - AttemptAddBar(i, NPCID.MoonLordCore); - } - if (ExclusionList.Contains(type)) continue; - - if (Main.npc[i].type == NPCID.BrainofCthulhu) - { - AttemptAddBar(i, NPCID.BrainofCthulhu); - } - else if (Main.npc[i].type == NPCID.SkeletronHead) - { - AttemptAddBar(i, NPCID.SkeletronHead); - } - else if (Main.npc[i].type == NPCID.SkeletronPrime) - { - AttemptAddBar(i, NPCID.SkeletronPrime); - } - else if (Main.npc[i].type == NPCID.MartianSaucerCore) - { - AttemptAddBar(i, NPCID.MartianSaucerCore); - } - else if (Main.npc[i].type == NPCID.PirateShip) - { - AttemptAddBar(i, NPCID.PirateShip); - } - else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusHeadSpectral")) - { - AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusHeadSpectral")); - } - else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3")) - { - AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3")); - } - else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("CeaselessVoid")) - { - AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("CeaselessVoid")); - } - else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorHive")) - { - AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("PerforatorHive")); - } - else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("ScavengerBody")) - { - AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("ScavengerBody")); - } - else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("SlimeGodCore")) - { - AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("SlimeGodCore")); - } - else if (Main.npc[i].boss || MinibossHPBarList.Contains(type)) - { - AttemptAddBar(i); - } - //If, specifically, they're the eater of worlds head - if (Main.npc[i].type == NPCID.EaterofWorldsHead) - { - AttemptAddBar(i, NPCID.EaterofWorldsHead); - } - } - - for (int i = 0; i < Bars.Count; i++) - { - BossHPUI ui = Bars[i]; - //Update the bar - ui.Update(); - //Is the NPC the bar is attached to dead? - if (ui.IsDead()) - { - //begin closing anim of the UI - ui.StartClosing(); - } - if (ui.ShouldClose()) - { - //remove this bar - Bars.RemoveAt(i); - i--; - } - } - } - - private static void AttemptAddBar(int index, int type = -1) - { - //Limit the number of bars. - if (Bars.Count >= MAX_BARS) return; - - bool hasBar = false; - - foreach (BossHPUI ui in Bars) - { - int id = ui.GetNPCID(); - if (id == index) - { - hasBar = true; - break; - } - //Sort out the eater of worlds splitting into multiple segments and multiple of them being heads - if (type == NPCID.EaterofWorldsHead) - { - if (Main.npc[id].type == NPCID.EaterofWorldsHead) - { - hasBar = true; - } - } - } - - if (!hasBar) - { - BossHPUI newUI = new BossHPUI(index); - - if (type != -1) - { - newUI.SetupForType(type); - } - - Bars.Add(newUI); - } - } - - public static void Draw(SpriteBatch sb) - { - int startHeight = 100; //100 - int heightPerOne = 70; //70 - - int y = Main.screenHeight - startHeight; - int x = Main.screenWidth - 420 + ((Main.playerInventory || Main.invasionType > 0 || Main.pumpkinMoon || Main.snowMoon || DD2Event.Ongoing) ? -250 : 0); - - foreach (BossHPUI ui in Bars) - { - ui.Draw(sb, x, y); - y -= heightPerOne; - } - } - - //Actual UI handling class - internal class BossHPUI - { - private static readonly Color OrangeColour = new Color(229, 189, 62); - private static readonly Color OrangeBorderColour = new Color(197, 127, 46); - - private static readonly int MainBarYOffset = 28; - private static readonly int SepBarYOffset = 18; - private static readonly int BarMaxWidth = 400; - private static readonly int OpenAnimTime = 80; - private static readonly int CloseAnimTime = 120; - - enum SpecialType : byte - { - None, - EaterOfWorlds, - Creep, - Skelet, - SkeletPrime, - MartSaucer, - PirShip, - Astrum - } - - enum SpecialType2 : byte - { - None, - Calam, - Ceaseless, - Perforator, - Ravage, - SlimeCore, - MoonCore - } - - private int _npcLocation; - private SpecialType _special = SpecialType.None; - private SpecialType2 _special2 = SpecialType2.None; - private int[] _specialData = new int[7]; - private int[] _specialData2 = new int[7]; - private float _maxHealth; - private int _prevLife; - private bool _inCombo = false; - private int _comboStartHealth; - private int _damageCountdown; - private NPC _npc - { - get - { - return Main.npc[_npcLocation]; - } - } - - private string _lastName = ""; - - private bool _oneToMany = false; - private int[] _arrayOfIds; - - //EDITABLE - public void SetupForType(int type) - { - if (type == NPCID.MoonLordCore) - { - _special2 = SpecialType2.MoonCore; - } - else if (type == ModLoader.GetMod("CalamityMod").NPCType("SlimeGodCore")) - { - _special2 = SpecialType2.SlimeCore; - } - else if (type == ModLoader.GetMod("CalamityMod").NPCType("ScavengerBody")) - { - _special2 = SpecialType2.Ravage; - } - else if (type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorHive")) - { - _special2 = SpecialType2.Perforator; - } - else if (type == ModLoader.GetMod("CalamityMod").NPCType("CeaselessVoid")) - { - _special2 = SpecialType2.Ceaseless; - } - else if (type == ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3")) - { - _special2 = SpecialType2.Calam; - } - else if (type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusHeadSpectral")) - { - _special = SpecialType.Astrum; - } - else - { - switch (type) - { - case NPCID.EaterofWorldsHead: - _special = SpecialType.EaterOfWorlds; - break; - case NPCID.BrainofCthulhu: - _special = SpecialType.Creep; - break; - case NPCID.SkeletronHead: - _special = SpecialType.Skelet; - break; - case NPCID.SkeletronPrime: - _special = SpecialType.SkeletPrime; - break; - case NPCID.MartianSaucerCore: - _special = SpecialType.MartSaucer; - break; - case NPCID.PirateShip: - _special = SpecialType.PirShip; - break; - } - } - } - - //ANIMATION FIELDS - private int _openAnimCounter = OpenAnimTime; - private int _closeAnimCounter; - - public BossHPUI(int id) - { - _npcLocation = id; - - _maxHealth = Main.npc[id].lifeMax; - - if (OneToMany.ContainsKey(Main.npc[id].type)) - { - _oneToMany = true; - _arrayOfIds = OneToMany[Main.npc[id].type]; - } - } - - public int GetNPCID() - { - return _npcLocation; - } - public bool ShouldClose() - { - return _closeAnimCounter >= CloseAnimTime; - } - public void StartClosing() - { - if (_closeAnimCounter == 0) - _closeAnimCounter = 1; - } - - public bool IsDead() - { - bool dead = false; - - if (_npc == null) - dead = true; - - int life = _npc.life; - if (life < 0 || !_npc.active || _npc.lifeMax < 800) - dead = true; - - if (_oneToMany) - { - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].life > 0 && _arrayOfIds.Contains(Main.npc[i].type)) - { - dead = false; - } - } - } - - if (dead && _lastName == "") - { - _lastName = _npc.FullName; - } - - return dead; - } - - public void Update() - { - if (_closeAnimCounter != 0) return; - - int currentLife = _npc.life; - - //Calculate current life based all types that are available and considered part of one boss - if (_oneToMany) - { - currentLife = 0; - int maxLife = 0; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].life > 0 && _arrayOfIds.Contains(Main.npc[i].type)) - { - if ((Main.npc[i].type == NPCID.MoonLordHead || Main.npc[i].type == NPCID.MoonLordHand || Main.npc[i].type == NPCID.MoonLordCore) && - Main.npc[i].ai[0] == -2f) continue; - currentLife += Main.npc[i].life; - maxLife += Main.npc[i].lifeMax; - } - } - if (maxLife > _maxHealth) - { - _maxHealth = maxLife; - } - } - - //Damage countdown - if (_damageCountdown > 0) - { - _damageCountdown--; - if (_damageCountdown == 0) - { - //This means we need to finish the combo - _comboStartHealth = 0; - _inCombo = false; - } - } - //If the current life is not eqaul to the previous frame of life (_prevLife != 0 ensures it's not on it's first frame) - if (currentLife != _prevLife && _prevLife != 0) - { - //If there's no ongoing combo - if (!_inCombo) - { - //This means we need to start a combo - _comboStartHealth = _prevLife; - _inCombo = true; - } - _damageCountdown = 30; //60 - } - _prevLife = currentLife; - - switch (_special) - { - default: - break; - case SpecialType.EaterOfWorlds: - //Count the segments of the EoW - int count = 0; - for (int i = 0; i < Main.npc.Length; i++) - { - if (IsEoW(i)) - { - count++; - } - } - _specialData[0] = count; - break; - case SpecialType.Creep: - int count2 = NPC.CountNPCS(NPCID.Creeper); - _specialData[1] = count2; - break; - case SpecialType.Skelet: - int count3 = NPC.CountNPCS(NPCID.SkeletronHand); - _specialData[2] = count3; - break; - case SpecialType.SkeletPrime: - int count4 = NPC.CountNPCS(NPCID.PrimeVice) + NPC.CountNPCS(NPCID.PrimeCannon) + - NPC.CountNPCS(NPCID.PrimeSaw) + NPC.CountNPCS(NPCID.PrimeLaser); - _specialData[3] = count4; - break; - case SpecialType.MartSaucer: - int count5 = NPC.CountNPCS(NPCID.MartianSaucerTurret) + NPC.CountNPCS(NPCID.MartianSaucerCannon); - _specialData[4] = count5; - break; - case SpecialType.PirShip: - int count6 = NPC.CountNPCS(NPCID.PirateShipCannon); - _specialData[5] = count6; - break; - case SpecialType.Astrum: - int count7 = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusHead")); - _specialData[6] = count7; - break; - } - - switch (_special2) - { - default: - break; - case SpecialType2.Calam: - int count = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun2")); - _specialData2[0] = count; - break; - case SpecialType2.Ceaseless: - int count2 = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("DarkEnergy")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("DarkEnergy2")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("DarkEnergy3")); - _specialData2[1] = count2; - break; - case SpecialType2.Perforator: - int count3 = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("PerforatorHeadSmall")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("PerforatorHeadMedium")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("PerforatorHeadLarge")); - _specialData2[2] = count3; - break; - case SpecialType2.Ravage: - int count4 = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("ScavengerClawRight")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("ScavengerClawLeft")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("ScavengerLegRight")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("ScavengerLegLeft")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("ScavengerHead")); - _specialData2[3] = count4; - break; - case SpecialType2.SlimeCore: - int count5 = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("SlimeGod")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("SlimeGodSplit")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("SlimeGodRun")) + - NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("SlimeGodRunSplit")); - _specialData2[4] = count5; - break; - case SpecialType2.MoonCore: - if (NPC.CountNPCS(NPCID.MoonLordFreeEye) > 3) - { - int count6 = NPC.CountNPCS(NPCID.MoonLordFreeEye) - 3; - _specialData2[5] = count6; - } - break; - } - } - public void Draw(SpriteBatch sb, int x, int y) - { - //Draw the respective animations. - //Easier to separate them, even if it does result in more copy pasted code overall. - if (_openAnimCounter > 0) - { - DrawOpenAnim(sb, x, y); - return; - } - - if (_closeAnimCounter > 0) - { - DrawCloseAnim(sb, x, y); - return; - } - - float percentHealth = (_prevLife / _maxHealth); - int mainBarWidth = (int)(BarMaxWidth * percentHealth); - - if (_inCombo) - { - //DRAW COMBO HEALTH BAR - int comboBarWidth = (int)(BarMaxWidth * (_comboStartHealth / _maxHealth)) - mainBarWidth; - float alpha = 1f; - if (_damageCountdown < 6) - { - float val = _damageCountdown * 0.166f; - alpha *= val; - comboBarWidth = (int)(comboBarWidth * val); - } - - sb.Draw(BossComboHPBar, new Rectangle(x + mainBarWidth, y + MainBarYOffset, comboBarWidth, 15), Color.White * alpha); - } - - //DRAW MAIN HEALTH BAR - sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, 15), Color.White); - - //DRAW WHITE(ISH) LINE - sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), new Color(240, 240, 255)); - - //DRAW TEXT - string percentHealthText = (percentHealth * 100).ToString("N1") + "%"; - if (_prevLife == _maxHealth) percentHealthText = "100%"; - Vector2 textSize = HPBarFont.MeasureString(percentHealthText); - DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour, OrangeBorderColour * 0.25f); - - string name = _npc.FullName; - Vector2 nameSize = Main.fontMouseText.MeasureString(name); - DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White, Color.Black * 0.2f); - - //TODO: Make this toggleable - if (SHOULD_DRAW_SMALLTEXT_HEALTH) - { - float textScale = 0.75f; - - switch (_special) - { - default: - break; - case SpecialType.EaterOfWorlds: - string count = "(Segments left: " + _specialData[0] + ")"; - Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; - float countX = Math.Max(x, x + mainBarWidth - countSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.Creep: - string count2 = "(Creepers left: " + _specialData[1] + ")"; - Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; - float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.Skelet: - string count3 = "(Hands left: " + _specialData[2] + ")"; - Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; - float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.SkeletPrime: - string count4 = "(Arms left: " + _specialData[3] + ")"; - Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; - float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.MartSaucer: - string count5 = "(Guns left: " + _specialData[4] + ")"; - Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; - float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.PirShip: - string count6 = "(Cannons left: " + _specialData[5] + ")"; - Vector2 countSize6 = Main.fontItemStack.MeasureString(count6) * textScale; - float countX6 = Math.Max(x, x + mainBarWidth - countSize6.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count6, new Vector2(countX6, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.Astrum: - string count7 = "(Small Worms left: " + _specialData[6] + ")"; - Vector2 countSize7 = Main.fontItemStack.MeasureString(count7) * textScale; - float countX7 = Math.Max(x, x + mainBarWidth - countSize7.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count7, new Vector2(countX7, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - } - - switch (_special2) - { - default: - break; - case SpecialType2.Calam: - string count = "(Brothers left: " + _specialData2[0] + ")"; - Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; - float countX = Math.Max(x, x + mainBarWidth - countSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType2.Ceaseless: - string count2 = "(Dark Energy left: " + _specialData2[1] + ")"; - Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; - float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType2.Perforator: - string count3 = "(Worms left: " + _specialData2[2] + ")"; - Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; - float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType2.Ravage: - string count4 = "(Body Parts left: " + _specialData2[3] + ")"; - Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; - float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType2.SlimeCore: - string count5 = "(Large Slimes left: " + _specialData2[4] + ")"; - Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; - float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType2.MoonCore: - string count7 = "(Vulnerable Eyes left: " + _specialData2[5] + ")"; - Vector2 countSize7 = Main.fontItemStack.MeasureString(count7) * textScale; - float countX7 = Math.Max(x, x + mainBarWidth - countSize7.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count7, new Vector2(countX7, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - } - - string actualLife = "(" + _npc.life + " / " + _npc.lifeMax + ")"; - Vector2 lifeSize = Main.fontItemStack.MeasureString(actualLife) * textScale; - float lifeX = Math.Max(x, x + mainBarWidth - lifeSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, actualLife, new Vector2(lifeX, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - } - } - public void DrawOpenAnim(SpriteBatch sb, int x, int y) - { - float percentThroughAnim = (OpenAnimTime - _openAnimCounter) / (float)OpenAnimTime; - int mainBarWidth = (int)(BarMaxWidth * MathHelper.SmoothStep(0f, 1f, percentThroughAnim)); - - float flickerValue = percentThroughAnim; - //FLICKER 3 TIMES, QUICK AND DIRTY METHOD - if (_openAnimCounter == OpenAnimTime - 4 || _openAnimCounter == OpenAnimTime - 8 || _openAnimCounter == OpenAnimTime - 16) - { - flickerValue = Main.rand.NextFloat(0.7f, 0.8f); - } - else if (_openAnimCounter == OpenAnimTime - 5 || _openAnimCounter == OpenAnimTime - 9 || _openAnimCounter == OpenAnimTime - 17) - { - flickerValue = Main.rand.NextFloat(0.4f, 0.5f); - } - - //DRAW MAIN HEALTH BAR - sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, 15), Color.White * flickerValue); - - //DRAW WHITE(ISH) LINE - sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), new Color(240, 240, 255) * flickerValue); - - //DRAW TEXT - string percentHealthText = "100%"; - Vector2 textSize = HPBarFont.MeasureString(percentHealthText); - DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour * flickerValue, OrangeBorderColour * 0.25f * flickerValue); - - string name = _npc.FullName; - Vector2 nameSize = Main.fontMouseText.MeasureString(name); - DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White * flickerValue, Color.Black * 0.2f * flickerValue); - - //TODO: Make this toggleable - if (SHOULD_DRAW_SMALLTEXT_HEALTH) - { - float textScale = 0.75f; - - switch (_special) - { - default: - break; - case SpecialType.EaterOfWorlds: - string count = "(Segments left: " + _specialData[0] + ")"; - Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; - float countX = Math.Max(x, x + mainBarWidth - countSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.Creep: - string count2 = "(Creepers left: " + _specialData[1] + ")"; - Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; - float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.Skelet: - string count3 = "(Hands left: " + _specialData[2] + ")"; - Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; - float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.SkeletPrime: - string count4 = "(Arms left: " + _specialData[3] + ")"; - Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; - float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.MartSaucer: - string count5 = "(Guns left: " + _specialData[4] + ")"; - Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; - float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.PirShip: - string count6 = "(Cannons left: " + _specialData[5] + ")"; - Vector2 countSize6 = Main.fontItemStack.MeasureString(count6) * textScale; - float countX6 = Math.Max(x, x + mainBarWidth - countSize6.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count6, new Vector2(countX6, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.Astrum: - string count7 = "(Small Worms left: " + _specialData[6] + ")"; - Vector2 countSize7 = Main.fontItemStack.MeasureString(count7) * textScale; - float countX7 = Math.Max(x, x + mainBarWidth - countSize7.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count7, new Vector2(countX7, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - } - - switch (_special2) - { - default: - break; - case SpecialType2.Calam: - string count = "(Brothers left: " + _specialData2[0] + ")"; - Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; - float countX = Math.Max(x, x + mainBarWidth - countSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType2.Ceaseless: - string count2 = "(Dark Energy left: " + _specialData2[1] + ")"; - Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; - float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType2.Perforator: - string count3 = "(Worms left: " + _specialData2[2] + ")"; - Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; - float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType2.Ravage: - string count4 = "(Body Parts left: " + _specialData2[3] + ")"; - Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; - float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType2.SlimeCore: - string count5 = "(Large Slimes left: " + _specialData2[4] + ")"; - Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; - float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType2.MoonCore: - string count7 = "(Vulnerable Eyes left: " + _specialData2[5] + ")"; - Vector2 countSize7 = Main.fontItemStack.MeasureString(count7) * textScale; - float countX7 = Math.Max(x, x + mainBarWidth - countSize7.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count7, new Vector2(countX7, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - } - - string actualLife = "(" + _npc.life + " / " + _npc.lifeMax + ")"; - Vector2 lifeSize = Main.fontItemStack.MeasureString(actualLife) * textScale; - float lifeX = Math.Max(x, x + mainBarWidth - lifeSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, actualLife, new Vector2(lifeX, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - } - - _openAnimCounter--; - } - public void DrawCloseAnim(SpriteBatch sb, int x, int y) - { - float percentThroughAnim = _closeAnimCounter / (float)CloseAnimTime; - float reversePercent = 1f - percentThroughAnim; - - float percentHealth = (_prevLife / _maxHealth); - if (percentHealth < 0) percentHealth = 0; - - int mainBarWidth = (int)(BarMaxWidth * MathHelper.SmoothStep(0f, 1f, reversePercent) * percentHealth); - - //DRAW MAIN HEALTH BAR - sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, 15), Color.White * reversePercent); - - //DRAW WHITE(ISH) LINE - sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), new Color(240, 240, 255) * reversePercent); - - //DRAW TEXT - string percentHealthText = (percentHealth * 100).ToString("N1") + "%"; - if (_prevLife <= 0) percentHealthText = "0%"; - if (_prevLife == _maxHealth) percentHealthText = "100%"; - - Vector2 textSize = HPBarFont.MeasureString(percentHealthText); - DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour * reversePercent, OrangeBorderColour * 0.25f * reversePercent); - - string name = _lastName; - Vector2 nameSize = Main.fontMouseText.MeasureString(name); - DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White * reversePercent, Color.Black * 0.2f * reversePercent); - - _closeAnimCounter++; - } - - //UTILS - private void DrawBorderStringEightWay(SpriteBatch sb, DynamicSpriteFont font, string text, Vector2 position, Color main, Color border, float scale = 1f) - { - for (int x = -1; x <= 1; x++) - { - for (int y = -1; y <= 1; y++) - { - Vector2 pos = position + new Vector2(x, y); - if (x == 0 && y == 0) - { - continue; - } - - DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, pos, border, 0f, default(Vector2), scale, SpriteEffects.None, 0f); - } - } - DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, position, main, 0f, default(Vector2), scale, SpriteEffects.None, 0f); - } - private bool IsEoW(int id) - { - NPC n = Main.npc[id]; - - if (!n.active || n.life <= 0) return false; - - return n.type == NPCID.EaterofWorldsHead || - n.type == NPCID.EaterofWorldsBody || - n.type == NPCID.EaterofWorldsTail; - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using ReLogic.Graphics; + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent.Events; + +namespace CalamityMod.UI +{ + /* + Heyo! Here's some things you might need to know about this class and where to change things: + + In the "Load" method is where the "OneToMany" dictionary is updated. + If an NPC is made up of multiple segments (such as EoW, etc.) that all have separate health but would be considered a single boss, you can update the dictionary. + The boss health bar will automatically keep track of all segments of that type and add up the health. + + The "SetupExclusionList" method allows you to check for if certain mods are loaded and setup the exclusion list based on what mods are loaded. + For now I've had to load calamity separately, you might want to change that by just passing in Calamity itself etc. + + If you need to add a special kind of health bar, like the EoW one which counts the number of segments left, let me know. + I may need to dive into the spaghetti to add it. + + There's a few readonly fields at the top of both classes that you can edit should you deem it fit to. Change the animation lengths, etc. + The bar uses those and shouldn't have any problems dealing with the new values + (although the flickering in the start animation will always happen in the first 20 frames or so) + + As for toggling, in the Mod File, you can simply add a boolean check and not draw or update the health bar manager. + There is a "SHOULD_DRAW_SMALLTEXT_HEALTH" field below here which is public, if that's false then the smalltext won't draw. + + That should be it -- ask if you have any questions! + */ + + internal static class BossHealthBarManager + { + private static readonly int MAX_BARS = 4; //4 + + public static bool SHOULD_DRAW_SMALLTEXT_HEALTH = true; + + private static List Bars; + + private static DynamicSpriteFont HPBarFont; + private static Texture2D BossMainHPBar; + private static Texture2D BossComboHPBar; + private static Texture2D BossSeperatorBar; + + private static Dictionary OneToMany; + private static List ExclusionList; + private static List MinibossHPBarList; + + public static void Load(Mod mod) + { + Bars = new List(); + + if (!Main.dedServ) + { + BossMainHPBar = mod.GetTexture("ExtraTextures/UI/BossHPMainBar"); + BossComboHPBar = mod.GetTexture("ExtraTextures/UI/BossHPComboBar"); + BossSeperatorBar = mod.GetTexture("ExtraTextures/UI/BossHPSeperatorBar"); + + PlatformID id = Environment.OSVersion.Platform; + if (id == PlatformID.Win32NT && !Environment.Is64BitProcess) + { + HPBarFont = mod.GetFont("Fonts/HPBarFont"); + } + else + { + HPBarFont = Main.fontMouseText; + } + } + + OneToMany = new Dictionary(); + int[] EoW = new int[] { NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail }; + OneToMany[NPCID.EaterofWorldsHead] = EoW; + OneToMany[NPCID.EaterofWorldsBody] = EoW; + OneToMany[NPCID.EaterofWorldsTail] = EoW; + + int[] BoC = new int[] { NPCID.BrainofCthulhu, NPCID.Creeper }; + OneToMany[NPCID.BrainofCthulhu] = BoC; + OneToMany[NPCID.Creeper] = BoC; + + int[] Skele = new int[] { NPCID.SkeletronHead, NPCID.SkeletronHand }; + OneToMany[NPCID.SkeletronHead] = Skele; + OneToMany[NPCID.SkeletronHand] = Skele; + + int[] SkelePrime = new int[] { NPCID.SkeletronPrime, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeCannon, NPCID.PrimeLaser }; + OneToMany[NPCID.SkeletronPrime] = SkelePrime; + OneToMany[NPCID.PrimeSaw] = SkelePrime; + OneToMany[NPCID.PrimeVice] = SkelePrime; + OneToMany[NPCID.PrimeCannon] = SkelePrime; + OneToMany[NPCID.PrimeLaser] = SkelePrime; + + int[] Saucer = new int[] { NPCID.MartianSaucerCore, NPCID.MartianSaucerTurret, NPCID.MartianSaucerCannon }; + OneToMany[NPCID.MartianSaucerCore] = Saucer; + OneToMany[NPCID.MartianSaucerTurret] = Saucer; + OneToMany[NPCID.MartianSaucerCannon] = Saucer; + + int[] Ship = new int[] { NPCID.PirateShip, NPCID.PirateShipCannon }; + OneToMany[NPCID.PirateShip] = Ship; + OneToMany[NPCID.PirateShipCannon] = Ship; + + int[] MoonLord = new int[] { NPCID.MoonLordHead, NPCID.MoonLordHand, NPCID.MoonLordCore }; + OneToMany[NPCID.MoonLordHead] = MoonLord; + OneToMany[NPCID.MoonLordHand] = MoonLord; + OneToMany[NPCID.MoonLordCore] = MoonLord; + + int[] StarWorm = new int[] { mod.NPCType("AstrumDeusHeadSpectral"), mod.NPCType("AstrumDeusHead") }; + OneToMany[mod.NPCType("AstrumDeusHeadSpectral")] = StarWorm; + OneToMany[mod.NPCType("AstrumDeusHead")] = StarWorm; + + int[] Cal = new int[] { mod.NPCType("CalamitasRun3"), mod.NPCType("CalamitasRun"), mod.NPCType("CalamitasRun2") }; + OneToMany[mod.NPCType("CalamitasRun3")] = Cal; + OneToMany[mod.NPCType("CalamitasRun")] = Cal; + OneToMany[mod.NPCType("CalamitasRun2")] = Cal; + + int[] Void = new int[] { mod.NPCType("CeaselessVoid"), mod.NPCType("DarkEnergy"), mod.NPCType("DarkEnergy2"), mod.NPCType("DarkEnergy3") }; + OneToMany[mod.NPCType("CeaselessVoid")] = Void; + OneToMany[mod.NPCType("DarkEnergy")] = Void; + OneToMany[mod.NPCType("DarkEnergy2")] = Void; + OneToMany[mod.NPCType("DarkEnergy3")] = Void; + + int[] Perfs = new int[] { mod.NPCType("PerforatorHive"), mod.NPCType("PerforatorHeadSmall"), mod.NPCType("PerforatorHeadMedium"), + mod.NPCType("PerforatorHeadLarge") }; + OneToMany[mod.NPCType("PerforatorHive")] = Perfs; + OneToMany[mod.NPCType("PerforatorHeadSmall")] = Perfs; + OneToMany[mod.NPCType("PerforatorHeadMedium")] = Perfs; + OneToMany[mod.NPCType("PerforatorHeadLarge")] = Perfs; + + int[] Rav = new int[] { mod.NPCType("ScavengerBody"), mod.NPCType("ScavengerClawRight"), mod.NPCType("ScavengerClawLeft"), + mod.NPCType("ScavengerLegRight"), mod.NPCType("ScavengerLegLeft"), mod.NPCType("ScavengerHead") }; + OneToMany[mod.NPCType("ScavengerBody")] = Rav; + OneToMany[mod.NPCType("ScavengerClawRight")] = Rav; + OneToMany[mod.NPCType("ScavengerClawLeft")] = Rav; + OneToMany[mod.NPCType("ScavengerLegRight")] = Rav; + OneToMany[mod.NPCType("ScavengerLegLeft")] = Rav; + OneToMany[mod.NPCType("ScavengerHead")] = Rav; + + int[] Slimes = new int[] { mod.NPCType("SlimeGodCore"), mod.NPCType("SlimeGod"), mod.NPCType("SlimeGodSplit"), + mod.NPCType("SlimeGodRun"), mod.NPCType("SlimeGodRunSplit") }; + OneToMany[mod.NPCType("SlimeGodCore")] = Slimes; + OneToMany[mod.NPCType("SlimeGod")] = Slimes; + OneToMany[mod.NPCType("SlimeGodSplit")] = Slimes; + OneToMany[mod.NPCType("SlimeGodRun")] = Slimes; + OneToMany[mod.NPCType("SlimeGodRunSplit")] = Slimes; + + SetupExclusionList(); + SetupMinibossHPBarList(); + } + + private static void SetupExclusionList() + { + ExclusionList = new List(); + + ExclusionList.Add(NPCID.MoonLordFreeEye); + ExclusionList.Add(NPCID.MoonLordHead); + ExclusionList.Add(NPCID.MoonLordHand); + ExclusionList.Add(NPCID.MoonLordCore); + + Mod calamity = ModLoader.GetMod("CalamityMod"); + if (calamity != null) + { + ExclusionList.Add(calamity.NPCType("AquaticScourgeBody")); + ExclusionList.Add(calamity.NPCType("AquaticScourgeBodyAlt")); + ExclusionList.Add(calamity.NPCType("AquaticScourgeTail")); + ExclusionList.Add(calamity.NPCType("AstrumDeusBodySpectral")); + ExclusionList.Add(calamity.NPCType("AstrumDeusTailSpectral")); + ExclusionList.Add(calamity.NPCType("DesertScourgeBody")); + ExclusionList.Add(calamity.NPCType("DesertScourgeTail")); + ExclusionList.Add(calamity.NPCType("StormWeaverHead")); + ExclusionList.Add(calamity.NPCType("StormWeaverBody")); + ExclusionList.Add(calamity.NPCType("StormWeaverTail")); + ExclusionList.Add(calamity.NPCType("StormWeaverBodyNaked")); + ExclusionList.Add(calamity.NPCType("StormWeaverTailNaked")); + ExclusionList.Add(calamity.NPCType("DevourerofGodsBody")); + ExclusionList.Add(calamity.NPCType("DevourerofGodsTail")); + ExclusionList.Add(calamity.NPCType("DevourerofGodsBodyS")); + ExclusionList.Add(calamity.NPCType("DevourerofGodsTailS")); + } + } + + private static void SetupMinibossHPBarList() + { + MinibossHPBarList = new List(); + + //DD2 Event + MinibossHPBarList.Add(NPCID.DD2Betsy); + MinibossHPBarList.Add(NPCID.DD2OgreT2); + MinibossHPBarList.Add(NPCID.DD2OgreT3); + MinibossHPBarList.Add(NPCID.DD2DarkMageT1); //800 HP + MinibossHPBarList.Add(NPCID.DD2DarkMageT3); + + //Prehardmode + MinibossHPBarList.Add(NPCID.DungeonGuardian); + + //Hardmode + MinibossHPBarList.Add(NPCID.GoblinSummoner); //2000 HP + MinibossHPBarList.Add(NPCID.Paladin); + MinibossHPBarList.Add(NPCID.IceGolem); + MinibossHPBarList.Add(NPCID.SandElemental); + MinibossHPBarList.Add(NPCID.BigMimicCorruption); + MinibossHPBarList.Add(NPCID.BigMimicCrimson); + MinibossHPBarList.Add(NPCID.BigMimicHallow); + + //Moon Events + MinibossHPBarList.Add(NPCID.MourningWood); + MinibossHPBarList.Add(NPCID.Pumpking); + MinibossHPBarList.Add(NPCID.Everscream); + MinibossHPBarList.Add(NPCID.SantaNK1); + MinibossHPBarList.Add(NPCID.IceQueen); + + //Eclipse + MinibossHPBarList.Add(NPCID.Mothron); + + Mod calamity = ModLoader.GetMod("CalamityMod"); + if (calamity != null) + { + //Prehardmode + MinibossHPBarList.Add(calamity.NPCType("GiantClam")); + + //Hardmode + MinibossHPBarList.Add(calamity.NPCType("ThiccWaifu")); + MinibossHPBarList.Add(calamity.NPCType("Horse")); + MinibossHPBarList.Add(calamity.NPCType("GreatSandShark")); + MinibossHPBarList.Add(calamity.NPCType("PlaguebringerShade")); + MinibossHPBarList.Add(calamity.NPCType("ArmoredDiggerHead")); + + //Abyss + MinibossHPBarList.Add(calamity.NPCType("EidolonWyrmHeadHuge")); + + //Post-ML + MinibossHPBarList.Add(calamity.NPCType("SupremeCataclysm")); + MinibossHPBarList.Add(calamity.NPCType("SupremeCatastrophe")); + MinibossHPBarList.Add(calamity.NPCType("ProvSpawnDefense")); + MinibossHPBarList.Add(calamity.NPCType("ProvSpawnOffense")); + MinibossHPBarList.Add(calamity.NPCType("ProvSpawnHealer")); + } + } + + public static void Unload() + { + BossMainHPBar = null; + BossComboHPBar = null; + BossSeperatorBar = null; + HPBarFont = null; + Bars = null; + ExclusionList = null; + MinibossHPBarList = null; + OneToMany = null; + } + + public static void Update() + { + for (int i = 0; i < Main.npc.Length; i++) + { + //Is NPC active + if (!Main.npc[i].active) continue; + + //Is npc in exclusion list + int type = Main.npc[i].type; + if (Main.npc[i].type == NPCID.MoonLordCore) + { + AttemptAddBar(i, NPCID.MoonLordCore); + } + if (ExclusionList.Contains(type)) continue; + + if (Main.npc[i].type == NPCID.BrainofCthulhu) + { + AttemptAddBar(i, NPCID.BrainofCthulhu); + } + else if (Main.npc[i].type == NPCID.SkeletronHead) + { + AttemptAddBar(i, NPCID.SkeletronHead); + } + else if (Main.npc[i].type == NPCID.SkeletronPrime) + { + AttemptAddBar(i, NPCID.SkeletronPrime); + } + else if (Main.npc[i].type == NPCID.MartianSaucerCore) + { + AttemptAddBar(i, NPCID.MartianSaucerCore); + } + else if (Main.npc[i].type == NPCID.PirateShip) + { + AttemptAddBar(i, NPCID.PirateShip); + } + else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusHeadSpectral")) + { + AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusHeadSpectral")); + } + else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3")) + { + AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3")); + } + else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("CeaselessVoid")) + { + AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("CeaselessVoid")); + } + else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorHive")) + { + AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("PerforatorHive")); + } + else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("ScavengerBody")) + { + AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("ScavengerBody")); + } + else if (Main.npc[i].type == ModLoader.GetMod("CalamityMod").NPCType("SlimeGodCore")) + { + AttemptAddBar(i, ModLoader.GetMod("CalamityMod").NPCType("SlimeGodCore")); + } + else if (Main.npc[i].boss || MinibossHPBarList.Contains(type)) + { + AttemptAddBar(i); + } + //If, specifically, they're the eater of worlds head + if (Main.npc[i].type == NPCID.EaterofWorldsHead) + { + AttemptAddBar(i, NPCID.EaterofWorldsHead); + } + } + + for (int i = 0; i < Bars.Count; i++) + { + BossHPUI ui = Bars[i]; + //Update the bar + ui.Update(); + //Is the NPC the bar is attached to dead? + if (ui.IsDead()) + { + //begin closing anim of the UI + ui.StartClosing(); + } + if (ui.ShouldClose()) + { + //remove this bar + Bars.RemoveAt(i); + i--; + } + } + } + + private static void AttemptAddBar(int index, int type = -1) + { + //Limit the number of bars. + if (Bars.Count >= MAX_BARS) return; + + bool hasBar = false; + + foreach (BossHPUI ui in Bars) + { + int id = ui.GetNPCID(); + if (id == index) + { + hasBar = true; + break; + } + //Sort out the eater of worlds splitting into multiple segments and multiple of them being heads + if (type == NPCID.EaterofWorldsHead) + { + if (Main.npc[id].type == NPCID.EaterofWorldsHead) + { + hasBar = true; + } + } + } + + if (!hasBar) + { + BossHPUI newUI = new BossHPUI(index); + + if (type != -1) + { + newUI.SetupForType(type); + } + + Bars.Add(newUI); + } + } + + public static void Draw(SpriteBatch sb) + { + int startHeight = 100; //100 + int heightPerOne = 70; //70 + + int y = Main.screenHeight - startHeight; + int x = Main.screenWidth - 420 + ((Main.playerInventory || Main.invasionType > 0 || Main.pumpkinMoon || Main.snowMoon || DD2Event.Ongoing) ? -250 : 0); + + foreach (BossHPUI ui in Bars) + { + ui.Draw(sb, x, y); + y -= heightPerOne; + } + } + + //Actual UI handling class + internal class BossHPUI + { + private static readonly Color OrangeColour = new Color(229, 189, 62); + private static readonly Color OrangeBorderColour = new Color(197, 127, 46); + + private static readonly int MainBarYOffset = 28; + private static readonly int SepBarYOffset = 18; + private static readonly int BarMaxWidth = 400; + private static readonly int OpenAnimTime = 80; + private static readonly int CloseAnimTime = 120; + + enum SpecialType : byte + { + None, + EaterOfWorlds, + Creep, + Skelet, + SkeletPrime, + MartSaucer, + PirShip, + Astrum + } + + enum SpecialType2 : byte + { + None, + Calam, + Ceaseless, + Perforator, + Ravage, + SlimeCore, + MoonCore + } + + private int _npcLocation; + private SpecialType _special = SpecialType.None; + private SpecialType2 _special2 = SpecialType2.None; + private int[] _specialData = new int[7]; + private int[] _specialData2 = new int[7]; + private float _maxHealth; + private int _prevLife; + private bool _inCombo = false; + private int _comboStartHealth; + private int _damageCountdown; + private NPC _npc + { + get + { + return Main.npc[_npcLocation]; + } + } + + private string _lastName = ""; + + private bool _oneToMany = false; + private int[] _arrayOfIds; + + //EDITABLE + public void SetupForType(int type) + { + if (type == NPCID.MoonLordCore) + { + _special2 = SpecialType2.MoonCore; + } + else if (type == ModLoader.GetMod("CalamityMod").NPCType("SlimeGodCore")) + { + _special2 = SpecialType2.SlimeCore; + } + else if (type == ModLoader.GetMod("CalamityMod").NPCType("ScavengerBody")) + { + _special2 = SpecialType2.Ravage; + } + else if (type == ModLoader.GetMod("CalamityMod").NPCType("PerforatorHive")) + { + _special2 = SpecialType2.Perforator; + } + else if (type == ModLoader.GetMod("CalamityMod").NPCType("CeaselessVoid")) + { + _special2 = SpecialType2.Ceaseless; + } + else if (type == ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun3")) + { + _special2 = SpecialType2.Calam; + } + else if (type == ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusHeadSpectral")) + { + _special = SpecialType.Astrum; + } + else + { + switch (type) + { + case NPCID.EaterofWorldsHead: + _special = SpecialType.EaterOfWorlds; + break; + case NPCID.BrainofCthulhu: + _special = SpecialType.Creep; + break; + case NPCID.SkeletronHead: + _special = SpecialType.Skelet; + break; + case NPCID.SkeletronPrime: + _special = SpecialType.SkeletPrime; + break; + case NPCID.MartianSaucerCore: + _special = SpecialType.MartSaucer; + break; + case NPCID.PirateShip: + _special = SpecialType.PirShip; + break; + } + } + } + + //ANIMATION FIELDS + private int _openAnimCounter = OpenAnimTime; + private int _closeAnimCounter; + + public BossHPUI(int id) + { + _npcLocation = id; + + _maxHealth = Main.npc[id].lifeMax; + + if (OneToMany.ContainsKey(Main.npc[id].type)) + { + _oneToMany = true; + _arrayOfIds = OneToMany[Main.npc[id].type]; + } + } + + public int GetNPCID() + { + return _npcLocation; + } + public bool ShouldClose() + { + return _closeAnimCounter >= CloseAnimTime; + } + public void StartClosing() + { + if (_closeAnimCounter == 0) + _closeAnimCounter = 1; + } + + public bool IsDead() + { + bool dead = false; + + if (_npc == null) + dead = true; + + int life = _npc.life; + if (life < 0 || !_npc.active || _npc.lifeMax < 800) + dead = true; + + if (_oneToMany) + { + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].life > 0 && _arrayOfIds.Contains(Main.npc[i].type)) + { + dead = false; + } + } + } + + if (dead && _lastName == "") + { + _lastName = _npc.FullName; + } + + return dead; + } + + public void Update() + { + if (_closeAnimCounter != 0) return; + + int currentLife = _npc.life; + + //Calculate current life based all types that are available and considered part of one boss + if (_oneToMany) + { + currentLife = 0; + int maxLife = 0; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].life > 0 && _arrayOfIds.Contains(Main.npc[i].type)) + { + if ((Main.npc[i].type == NPCID.MoonLordHead || Main.npc[i].type == NPCID.MoonLordHand || Main.npc[i].type == NPCID.MoonLordCore) && + Main.npc[i].ai[0] == -2f) continue; + currentLife += Main.npc[i].life; + maxLife += Main.npc[i].lifeMax; + } + } + if (maxLife > _maxHealth) + { + _maxHealth = maxLife; + } + } + + //Damage countdown + if (_damageCountdown > 0) + { + _damageCountdown--; + if (_damageCountdown == 0) + { + //This means we need to finish the combo + _comboStartHealth = 0; + _inCombo = false; + } + } + //If the current life is not eqaul to the previous frame of life (_prevLife != 0 ensures it's not on it's first frame) + if (currentLife != _prevLife && _prevLife != 0) + { + //If there's no ongoing combo + if (!_inCombo) + { + //This means we need to start a combo + _comboStartHealth = _prevLife; + _inCombo = true; + } + _damageCountdown = 30; //60 + } + _prevLife = currentLife; + + switch (_special) + { + default: + break; + case SpecialType.EaterOfWorlds: + //Count the segments of the EoW + int count = 0; + for (int i = 0; i < Main.npc.Length; i++) + { + if (IsEoW(i)) + { + count++; + } + } + _specialData[0] = count; + break; + case SpecialType.Creep: + int count2 = NPC.CountNPCS(NPCID.Creeper); + _specialData[1] = count2; + break; + case SpecialType.Skelet: + int count3 = NPC.CountNPCS(NPCID.SkeletronHand); + _specialData[2] = count3; + break; + case SpecialType.SkeletPrime: + int count4 = NPC.CountNPCS(NPCID.PrimeVice) + NPC.CountNPCS(NPCID.PrimeCannon) + + NPC.CountNPCS(NPCID.PrimeSaw) + NPC.CountNPCS(NPCID.PrimeLaser); + _specialData[3] = count4; + break; + case SpecialType.MartSaucer: + int count5 = NPC.CountNPCS(NPCID.MartianSaucerTurret) + NPC.CountNPCS(NPCID.MartianSaucerCannon); + _specialData[4] = count5; + break; + case SpecialType.PirShip: + int count6 = NPC.CountNPCS(NPCID.PirateShipCannon); + _specialData[5] = count6; + break; + case SpecialType.Astrum: + int count7 = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("AstrumDeusHead")); + _specialData[6] = count7; + break; + } + + switch (_special2) + { + default: + break; + case SpecialType2.Calam: + int count = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("CalamitasRun2")); + _specialData2[0] = count; + break; + case SpecialType2.Ceaseless: + int count2 = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("DarkEnergy")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("DarkEnergy2")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("DarkEnergy3")); + _specialData2[1] = count2; + break; + case SpecialType2.Perforator: + int count3 = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("PerforatorHeadSmall")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("PerforatorHeadMedium")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("PerforatorHeadLarge")); + _specialData2[2] = count3; + break; + case SpecialType2.Ravage: + int count4 = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("ScavengerClawRight")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("ScavengerClawLeft")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("ScavengerLegRight")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("ScavengerLegLeft")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("ScavengerHead")); + _specialData2[3] = count4; + break; + case SpecialType2.SlimeCore: + int count5 = NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("SlimeGod")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("SlimeGodSplit")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("SlimeGodRun")) + + NPC.CountNPCS(ModLoader.GetMod("CalamityMod").NPCType("SlimeGodRunSplit")); + _specialData2[4] = count5; + break; + case SpecialType2.MoonCore: + if (NPC.CountNPCS(NPCID.MoonLordFreeEye) > 3) + { + int count6 = NPC.CountNPCS(NPCID.MoonLordFreeEye) - 3; + _specialData2[5] = count6; + } + break; + } + } + public void Draw(SpriteBatch sb, int x, int y) + { + //Draw the respective animations. + //Easier to separate them, even if it does result in more copy pasted code overall. + if (_openAnimCounter > 0) + { + DrawOpenAnim(sb, x, y); + return; + } + + if (_closeAnimCounter > 0) + { + DrawCloseAnim(sb, x, y); + return; + } + + float percentHealth = (_prevLife / _maxHealth); + int mainBarWidth = (int)(BarMaxWidth * percentHealth); + + if (_inCombo) + { + //DRAW COMBO HEALTH BAR + int comboBarWidth = (int)(BarMaxWidth * (_comboStartHealth / _maxHealth)) - mainBarWidth; + float alpha = 1f; + if (_damageCountdown < 6) + { + float val = _damageCountdown * 0.166f; + alpha *= val; + comboBarWidth = (int)(comboBarWidth * val); + } + + sb.Draw(BossComboHPBar, new Rectangle(x + mainBarWidth, y + MainBarYOffset, comboBarWidth, 15), Color.White * alpha); + } + + //DRAW MAIN HEALTH BAR + sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, 15), Color.White); + + //DRAW WHITE(ISH) LINE + sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), new Color(240, 240, 255)); + + //DRAW TEXT + string percentHealthText = (percentHealth * 100).ToString("N1") + "%"; + if (_prevLife == _maxHealth) percentHealthText = "100%"; + Vector2 textSize = HPBarFont.MeasureString(percentHealthText); + DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour, OrangeBorderColour * 0.25f); + + string name = _npc.FullName; + Vector2 nameSize = Main.fontMouseText.MeasureString(name); + DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White, Color.Black * 0.2f); + + //TODO: Make this toggleable + if (SHOULD_DRAW_SMALLTEXT_HEALTH) + { + float textScale = 0.75f; + + switch (_special) + { + default: + break; + case SpecialType.EaterOfWorlds: + string count = "(Segments left: " + _specialData[0] + ")"; + Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; + float countX = Math.Max(x, x + mainBarWidth - countSize.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType.Creep: + string count2 = "(Creepers left: " + _specialData[1] + ")"; + Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; + float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType.Skelet: + string count3 = "(Hands left: " + _specialData[2] + ")"; + Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; + float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType.SkeletPrime: + string count4 = "(Arms left: " + _specialData[3] + ")"; + Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; + float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType.MartSaucer: + string count5 = "(Guns left: " + _specialData[4] + ")"; + Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; + float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType.PirShip: + string count6 = "(Cannons left: " + _specialData[5] + ")"; + Vector2 countSize6 = Main.fontItemStack.MeasureString(count6) * textScale; + float countX6 = Math.Max(x, x + mainBarWidth - countSize6.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count6, new Vector2(countX6, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType.Astrum: + string count7 = "(Small Worms left: " + _specialData[6] + ")"; + Vector2 countSize7 = Main.fontItemStack.MeasureString(count7) * textScale; + float countX7 = Math.Max(x, x + mainBarWidth - countSize7.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count7, new Vector2(countX7, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + } + + switch (_special2) + { + default: + break; + case SpecialType2.Calam: + string count = "(Brothers left: " + _specialData2[0] + ")"; + Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; + float countX = Math.Max(x, x + mainBarWidth - countSize.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType2.Ceaseless: + string count2 = "(Dark Energy left: " + _specialData2[1] + ")"; + Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; + float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType2.Perforator: + string count3 = "(Worms left: " + _specialData2[2] + ")"; + Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; + float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType2.Ravage: + string count4 = "(Body Parts left: " + _specialData2[3] + ")"; + Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; + float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType2.SlimeCore: + string count5 = "(Large Slimes left: " + _specialData2[4] + ")"; + Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; + float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + case SpecialType2.MoonCore: + string count7 = "(Vulnerable Eyes left: " + _specialData2[5] + ")"; + Vector2 countSize7 = Main.fontItemStack.MeasureString(count7) * textScale; + float countX7 = Math.Max(x, x + mainBarWidth - countSize7.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count7, new Vector2(countX7, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + return; + } + + string actualLife = "(" + _npc.life + " / " + _npc.lifeMax + ")"; + Vector2 lifeSize = Main.fontItemStack.MeasureString(actualLife) * textScale; + float lifeX = Math.Max(x, x + mainBarWidth - lifeSize.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, actualLife, new Vector2(lifeX, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); + } + } + public void DrawOpenAnim(SpriteBatch sb, int x, int y) + { + float percentThroughAnim = (OpenAnimTime - _openAnimCounter) / (float)OpenAnimTime; + int mainBarWidth = (int)(BarMaxWidth * MathHelper.SmoothStep(0f, 1f, percentThroughAnim)); + + float flickerValue = percentThroughAnim; + //FLICKER 3 TIMES, QUICK AND DIRTY METHOD + if (_openAnimCounter == OpenAnimTime - 4 || _openAnimCounter == OpenAnimTime - 8 || _openAnimCounter == OpenAnimTime - 16) + { + flickerValue = Main.rand.NextFloat(0.7f, 0.8f); + } + else if (_openAnimCounter == OpenAnimTime - 5 || _openAnimCounter == OpenAnimTime - 9 || _openAnimCounter == OpenAnimTime - 17) + { + flickerValue = Main.rand.NextFloat(0.4f, 0.5f); + } + + //DRAW MAIN HEALTH BAR + sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, 15), Color.White * flickerValue); + + //DRAW WHITE(ISH) LINE + sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), new Color(240, 240, 255) * flickerValue); + + //DRAW TEXT + string percentHealthText = "100%"; + Vector2 textSize = HPBarFont.MeasureString(percentHealthText); + DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour * flickerValue, OrangeBorderColour * 0.25f * flickerValue); + + string name = _npc.FullName; + Vector2 nameSize = Main.fontMouseText.MeasureString(name); + DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White * flickerValue, Color.Black * 0.2f * flickerValue); + + //TODO: Make this toggleable + if (SHOULD_DRAW_SMALLTEXT_HEALTH) + { + float textScale = 0.75f; + + switch (_special) + { + default: + break; + case SpecialType.EaterOfWorlds: + string count = "(Segments left: " + _specialData[0] + ")"; + Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; + float countX = Math.Max(x, x + mainBarWidth - countSize.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType.Creep: + string count2 = "(Creepers left: " + _specialData[1] + ")"; + Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; + float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType.Skelet: + string count3 = "(Hands left: " + _specialData[2] + ")"; + Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; + float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType.SkeletPrime: + string count4 = "(Arms left: " + _specialData[3] + ")"; + Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; + float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType.MartSaucer: + string count5 = "(Guns left: " + _specialData[4] + ")"; + Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; + float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType.PirShip: + string count6 = "(Cannons left: " + _specialData[5] + ")"; + Vector2 countSize6 = Main.fontItemStack.MeasureString(count6) * textScale; + float countX6 = Math.Max(x, x + mainBarWidth - countSize6.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count6, new Vector2(countX6, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType.Astrum: + string count7 = "(Small Worms left: " + _specialData[6] + ")"; + Vector2 countSize7 = Main.fontItemStack.MeasureString(count7) * textScale; + float countX7 = Math.Max(x, x + mainBarWidth - countSize7.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count7, new Vector2(countX7, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + } + + switch (_special2) + { + default: + break; + case SpecialType2.Calam: + string count = "(Brothers left: " + _specialData2[0] + ")"; + Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; + float countX = Math.Max(x, x + mainBarWidth - countSize.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType2.Ceaseless: + string count2 = "(Dark Energy left: " + _specialData2[1] + ")"; + Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; + float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType2.Perforator: + string count3 = "(Worms left: " + _specialData2[2] + ")"; + Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; + float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType2.Ravage: + string count4 = "(Body Parts left: " + _specialData2[3] + ")"; + Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; + float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType2.SlimeCore: + string count5 = "(Large Slimes left: " + _specialData2[4] + ")"; + Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; + float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + case SpecialType2.MoonCore: + string count7 = "(Vulnerable Eyes left: " + _specialData2[5] + ")"; + Vector2 countSize7 = Main.fontItemStack.MeasureString(count7) * textScale; + float countX7 = Math.Max(x, x + mainBarWidth - countSize7.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, count7, new Vector2(countX7, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + _openAnimCounter--; + return; + } + + string actualLife = "(" + _npc.life + " / " + _npc.lifeMax + ")"; + Vector2 lifeSize = Main.fontItemStack.MeasureString(actualLife) * textScale; + float lifeX = Math.Max(x, x + mainBarWidth - lifeSize.X); + DrawBorderStringEightWay(sb, Main.fontItemStack, actualLife, new Vector2(lifeX, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); + } + + _openAnimCounter--; + } + public void DrawCloseAnim(SpriteBatch sb, int x, int y) + { + float percentThroughAnim = _closeAnimCounter / (float)CloseAnimTime; + float reversePercent = 1f - percentThroughAnim; + + float percentHealth = (_prevLife / _maxHealth); + if (percentHealth < 0) percentHealth = 0; + + int mainBarWidth = (int)(BarMaxWidth * MathHelper.SmoothStep(0f, 1f, reversePercent) * percentHealth); + + //DRAW MAIN HEALTH BAR + sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, 15), Color.White * reversePercent); + + //DRAW WHITE(ISH) LINE + sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), new Color(240, 240, 255) * reversePercent); + + //DRAW TEXT + string percentHealthText = (percentHealth * 100).ToString("N1") + "%"; + if (_prevLife <= 0) percentHealthText = "0%"; + if (_prevLife == _maxHealth) percentHealthText = "100%"; + + Vector2 textSize = HPBarFont.MeasureString(percentHealthText); + DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour * reversePercent, OrangeBorderColour * 0.25f * reversePercent); + + string name = _lastName; + Vector2 nameSize = Main.fontMouseText.MeasureString(name); + DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White * reversePercent, Color.Black * 0.2f * reversePercent); + + _closeAnimCounter++; + } + + //UTILS + private void DrawBorderStringEightWay(SpriteBatch sb, DynamicSpriteFont font, string text, Vector2 position, Color main, Color border, float scale = 1f) + { + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + Vector2 pos = position + new Vector2(x, y); + if (x == 0 && y == 0) + { + continue; + } + + DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, pos, border, 0f, default(Vector2), scale, SpriteEffects.None, 0f); + } + } + DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, position, main, 0f, default(Vector2), scale, SpriteEffects.None, 0f); + } + private bool IsEoW(int id) + { + NPC n = Main.npc[id]; + + if (!n.active || n.life <= 0) return false; + + return n.type == NPCID.EaterofWorldsHead || + n.type == NPCID.EaterofWorldsBody || + n.type == NPCID.EaterofWorldsTail; + } + } + } +} diff --git a/UI/UIBar.cs b/UI/UIBar.cs index ad389641e3..4e706c3088 100644 --- a/UI/UIBar.cs +++ b/UI/UIBar.cs @@ -1,147 +1,147 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -using Terraria; -using Terraria.GameContent.UI.Elements; -using Terraria.UI; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.UI -{ - public class UIBar : UIState - { - public UIElement backPanel, barPanel; //the 'panels' of each part of the UI. - public int barWidth = 150; //the exact width of the bar texture/panel. - public Func getValue; //the func used to get the value displayed. - public int valueMax = 1, barOffset = 0; //the maximum value of the value displayed :: the offset used to draw the bar inwards. - - public UIBar(Texture2D imageBack, Texture2D imageBar, int barOff) : this(imageBack, imageBar, barOff, 10000, GetTickedValue) //uses textures and the test ticker for drawing - { - } - - public UIBar(Texture2D imageBack, Texture2D imageBar, int barOff, int valMax, Func gValue) : this(valMax, gValue) //uses textures - { - backPanel = new UIImage(imageBack); - barOffset = barOff; - barPanel = new UIImage(imageBar); - barWidth = (int)barPanel.Width.Pixels; - } - - public UIBar() : this(10000, GetTickedValue) //for testing purposes - { - } - - public UIBar(int valMax, Func gValue) : base() //uses panels for drawing instead of textures - { - valueMax = valMax; - getValue = gValue; - } - - public static int tick; //for testing - public static int GetTickedValue() //ditto - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - tick = Main.player[Main.myPlayer].GetModPlayer(calamity).stress; - return tick; - } - - public override void OnInitialize() - { - float posX = (float)Config.RageMeterXPos, posY = (float)Config.RageMeterYPos; //CHANGE THESE TWO TO CHANGE WHERE IT STARTS ON SCREEN! - if (backPanel == null) //if not using textures set up panels - { - backPanel = new UIPanel(); - ((UIPanel)backPanel).SetPadding(0); - backPanel.Left.Set(posX, 0f); - backPanel.Top.Set(posY, 0f); - backPanel.Width.Set(barWidth + 20f, 0f); - backPanel.Height.Set(50f, 0f); - ((UIPanel)backPanel).BackgroundColor = new Color(73, 94, 171); - - backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); - backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); - - barPanel = new UIPanel(); - ((UIPanel)barPanel).SetPadding(0); - barPanel.Left.Set(10f, 0f); - barPanel.Top.Set(10f, 0f); - barPanel.Width.Set(barWidth, 0f); - barPanel.Height.Set(30f, 0f); - ((UIPanel)barPanel).BackgroundColor = new Color(200, 0, 0); - backPanel.Append(barPanel); - } - else //otherwise using images so just move it into position - { - backPanel.Left.Set(posX, 0f); - backPanel.Top.Set(posY, 0f); - backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); - backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); - - barPanel.Left.Set(barOffset, 0f); - barPanel.Top.Set(0f, 0f); - - backPanel.Append(barPanel); - } - - base.Append(backPanel); - } - - public float GetPercentile() - { - return ((float)getValue() / Math.Max(1, ((float)valueMax - 1))); - } - - Vector2 offset; - public bool dragging = false; - private void DragStart(UIMouseEvent evt, UIElement listeningElement) - { - offset = new Vector2(evt.MousePosition.X - backPanel.Left.Pixels, evt.MousePosition.Y - backPanel.Top.Pixels); - dragging = true; - } - - private void DragEnd(UIMouseEvent evt, UIElement listeningElement) - { - Vector2 end = evt.MousePosition; - dragging = false; - - backPanel.Left.Set(end.X - offset.X, 0f); - backPanel.Top.Set(end.Y - offset.Y, 0f); - - Recalculate(); - } - - public override void Update(GameTime gameTime) - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - base.Update(gameTime); - Recalculate(); //THIS IS IMPORTANT! IDK why but when this is included it updates the drawing every tick. - tick = Main.player[Main.myPlayer].GetModPlayer(calamity).stress; //updates the testing tick - if (tick >= 10000) - { - tick = 10000; - } - barPanel.Width.Set((GetPercentile() * barWidth), 0f); //set the bar's width to the given percentile. - } - - protected override void DrawSelf(SpriteBatch spriteBatch) - { - Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); - if (backPanel.ContainsPoint(MousePosition)) - { - Main.LocalPlayer.mouseInterface = true; - Main.instance.MouseText("Rage: " + getValue() + "/" + valueMax + "", 0, 0, -1, -1, -1, -1); //only way I got this to show up consistently, otherwise it fucked up and showed up anywhere onscreen lol. - } - if (dragging) - { - backPanel.Left.Set(MousePosition.X - offset.X, 0f); - backPanel.Top.Set(MousePosition.Y - offset.Y, 0f); - Recalculate(); - } - } - } -} \ No newline at end of file +using System; +using System.Linq; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.GameContent.UI.Elements; +using Terraria.UI; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class UIBar : UIState + { + public UIElement backPanel, barPanel; //the 'panels' of each part of the UI. + public int barWidth = 150; //the exact width of the bar texture/panel. + public Func getValue; //the func used to get the value displayed. + public int valueMax = 1, barOffset = 0; //the maximum value of the value displayed :: the offset used to draw the bar inwards. + + public UIBar(Texture2D imageBack, Texture2D imageBar, int barOff) : this(imageBack, imageBar, barOff, 10000, GetTickedValue) //uses textures and the test ticker for drawing + { + } + + public UIBar(Texture2D imageBack, Texture2D imageBar, int barOff, int valMax, Func gValue) : this(valMax, gValue) //uses textures + { + backPanel = new UIImage(imageBack); + barOffset = barOff; + barPanel = new UIImage(imageBar); + barWidth = (int)barPanel.Width.Pixels; + } + + public UIBar() : this(10000, GetTickedValue) //for testing purposes + { + } + + public UIBar(int valMax, Func gValue) : base() //uses panels for drawing instead of textures + { + valueMax = valMax; + getValue = gValue; + } + + public static int tick; //for testing + public static int GetTickedValue() //ditto + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + tick = Main.player[Main.myPlayer].GetModPlayer(calamity).stress; + return tick; + } + + public override void OnInitialize() + { + float posX = (float)Config.RageMeterXPos, posY = (float)Config.RageMeterYPos; //CHANGE THESE TWO TO CHANGE WHERE IT STARTS ON SCREEN! + if (backPanel == null) //if not using textures set up panels + { + backPanel = new UIPanel(); + ((UIPanel)backPanel).SetPadding(0); + backPanel.Left.Set(posX, 0f); + backPanel.Top.Set(posY, 0f); + backPanel.Width.Set(barWidth + 20f, 0f); + backPanel.Height.Set(50f, 0f); + ((UIPanel)backPanel).BackgroundColor = new Color(73, 94, 171); + + backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); + backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); + + barPanel = new UIPanel(); + ((UIPanel)barPanel).SetPadding(0); + barPanel.Left.Set(10f, 0f); + barPanel.Top.Set(10f, 0f); + barPanel.Width.Set(barWidth, 0f); + barPanel.Height.Set(30f, 0f); + ((UIPanel)barPanel).BackgroundColor = new Color(200, 0, 0); + backPanel.Append(barPanel); + } + else //otherwise using images so just move it into position + { + backPanel.Left.Set(posX, 0f); + backPanel.Top.Set(posY, 0f); + backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); + backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); + + barPanel.Left.Set(barOffset, 0f); + barPanel.Top.Set(0f, 0f); + + backPanel.Append(barPanel); + } + + base.Append(backPanel); + } + + public float GetPercentile() + { + return ((float)getValue() / Math.Max(1, ((float)valueMax - 1))); + } + + Vector2 offset; + public bool dragging = false; + private void DragStart(UIMouseEvent evt, UIElement listeningElement) + { + offset = new Vector2(evt.MousePosition.X - backPanel.Left.Pixels, evt.MousePosition.Y - backPanel.Top.Pixels); + dragging = true; + } + + private void DragEnd(UIMouseEvent evt, UIElement listeningElement) + { + Vector2 end = evt.MousePosition; + dragging = false; + + backPanel.Left.Set(end.X - offset.X, 0f); + backPanel.Top.Set(end.Y - offset.Y, 0f); + + Recalculate(); + } + + public override void Update(GameTime gameTime) + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + base.Update(gameTime); + Recalculate(); //THIS IS IMPORTANT! IDK why but when this is included it updates the drawing every tick. + tick = Main.player[Main.myPlayer].GetModPlayer(calamity).stress; //updates the testing tick + if (tick >= 10000) + { + tick = 10000; + } + barPanel.Width.Set((GetPercentile() * barWidth), 0f); //set the bar's width to the given percentile. + } + + protected override void DrawSelf(SpriteBatch spriteBatch) + { + Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); + if (backPanel.ContainsPoint(MousePosition)) + { + Main.LocalPlayer.mouseInterface = true; + Main.instance.MouseText("Rage: " + getValue() + "/" + valueMax + "", 0, 0, -1, -1, -1, -1); //only way I got this to show up consistently, otherwise it fucked up and showed up anywhere onscreen lol. + } + if (dragging) + { + backPanel.Left.Set(MousePosition.X - offset.X, 0f); + backPanel.Top.Set(MousePosition.Y - offset.Y, 0f); + Recalculate(); + } + } + } +} diff --git a/UI/UIBar2.cs b/UI/UIBar2.cs index 1f41044156..fbf779a6bd 100644 --- a/UI/UIBar2.cs +++ b/UI/UIBar2.cs @@ -1,147 +1,147 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -using Terraria; -using Terraria.GameContent.UI.Elements; -using Terraria.UI; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.UI -{ - public class UIBar2 : UIState - { - public UIElement backPanel, barPanel; //the 'panels' of each part of the UI. - public int barWidth = 150; //the exact width of the bar texture/panel. - public Func getValue; //the func used to get the value displayed. - public int valueMax = 1, barOffset = 0; //the maximum value of the value displayed :: the offset used to draw the bar inwards. - - public UIBar2(Texture2D imageBack, Texture2D imageBar, int barOff) : this(imageBack, imageBar, barOff, 10000, GetTickedValue) //uses textures and the test ticker for drawing - { - } - - public UIBar2(Texture2D imageBack, Texture2D imageBar, int barOff, int valMax, Func gValue) : this(valMax, gValue) //uses textures - { - backPanel = new UIImage(imageBack); - barOffset = barOff; - barPanel = new UIImage(imageBar); - barWidth = (int)barPanel.Width.Pixels; - } - - public UIBar2() : this(10000, GetTickedValue) //for testing purposes - { - } - - public UIBar2(int valMax, Func gValue) : base() //uses panels for drawing instead of textures - { - valueMax = valMax; - getValue = gValue; - } - - public static int tick; //for testing - public static int GetTickedValue() //ditto - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - tick = Main.player[Main.myPlayer].GetModPlayer(calamity).adrenaline; - return tick; - } - - public override void OnInitialize() - { - float posX = (float)Config.AdrenalineMeterXPos, posY = (float)Config.AdrenalineMeterYPos; //CHANGE THESE TWO TO CHANGE WHERE IT STARTS ON SCREEN! - if (backPanel == null) //if not using textures set up panels - { - backPanel = new UIPanel(); - ((UIPanel)backPanel).SetPadding(0); - backPanel.Left.Set(posX, 0f); - backPanel.Top.Set(posY, 0f); - backPanel.Width.Set(barWidth + 20f, 0f); - backPanel.Height.Set(50f, 0f); - ((UIPanel)backPanel).BackgroundColor = new Color(73, 94, 171); - - backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); - backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); - - barPanel = new UIPanel(); - ((UIPanel)barPanel).SetPadding(0); - barPanel.Left.Set(10f, 0f); - barPanel.Top.Set(10f, 0f); - barPanel.Width.Set(barWidth, 0f); - barPanel.Height.Set(30f, 0f); - ((UIPanel)barPanel).BackgroundColor = new Color(0, 0, 200); - backPanel.Append(barPanel); - } - else //otherwise using images so just move it into position - { - backPanel.Left.Set(posX, 0f); - backPanel.Top.Set(posY, 0f); - backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); - backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); - - barPanel.Left.Set(barOffset, 0f); - barPanel.Top.Set(0f, 0f); - - backPanel.Append(barPanel); - } - - base.Append(backPanel); - } - - public float GetPercentile() - { - return ((float)getValue() / Math.Max(1, ((float)valueMax - 1))); - } - - Vector2 offset; - public bool dragging = false; - private void DragStart(UIMouseEvent evt, UIElement listeningElement) - { - offset = new Vector2(evt.MousePosition.X - backPanel.Left.Pixels, evt.MousePosition.Y - backPanel.Top.Pixels); - dragging = true; - } - - private void DragEnd(UIMouseEvent evt, UIElement listeningElement) - { - Vector2 end = evt.MousePosition; - dragging = false; - - backPanel.Left.Set(end.X - offset.X, 0f); - backPanel.Top.Set(end.Y - offset.Y, 0f); - - Recalculate(); - } - - public override void Update(GameTime gameTime) - { - Mod calamity = ModLoader.GetMod("CalamityMod"); - base.Update(gameTime); - Recalculate(); //THIS IS IMPORTANT! IDK why but when this is included it updates the drawing every tick. - tick = Main.player[Main.myPlayer].GetModPlayer(calamity).adrenaline; //updates the testing tick - if (tick >= 10000) - { - tick = 10000; - } - barPanel.Width.Set((GetPercentile() * barWidth), 0f); //set the bar's width to the given percentile. - } - - protected override void DrawSelf(SpriteBatch spriteBatch) - { - Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); - if (backPanel.ContainsPoint(MousePosition)) - { - Main.LocalPlayer.mouseInterface = true; - Main.instance.MouseText("Adrenaline: " + getValue() + "/" + valueMax + "", 0, 0, -1, -1, -1, -1); //only way I got this to show up consistently, otherwise it fucked up and showed up anywhere onscreen lol. - } - if (dragging) - { - backPanel.Left.Set(MousePosition.X - offset.X, 0f); - backPanel.Top.Set(MousePosition.Y - offset.Y, 0f); - Recalculate(); - } - } - } -} \ No newline at end of file +using System; +using System.Linq; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.GameContent.UI.Elements; +using Terraria.UI; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class UIBar2 : UIState + { + public UIElement backPanel, barPanel; //the 'panels' of each part of the UI. + public int barWidth = 150; //the exact width of the bar texture/panel. + public Func getValue; //the func used to get the value displayed. + public int valueMax = 1, barOffset = 0; //the maximum value of the value displayed :: the offset used to draw the bar inwards. + + public UIBar2(Texture2D imageBack, Texture2D imageBar, int barOff) : this(imageBack, imageBar, barOff, 10000, GetTickedValue) //uses textures and the test ticker for drawing + { + } + + public UIBar2(Texture2D imageBack, Texture2D imageBar, int barOff, int valMax, Func gValue) : this(valMax, gValue) //uses textures + { + backPanel = new UIImage(imageBack); + barOffset = barOff; + barPanel = new UIImage(imageBar); + barWidth = (int)barPanel.Width.Pixels; + } + + public UIBar2() : this(10000, GetTickedValue) //for testing purposes + { + } + + public UIBar2(int valMax, Func gValue) : base() //uses panels for drawing instead of textures + { + valueMax = valMax; + getValue = gValue; + } + + public static int tick; //for testing + public static int GetTickedValue() //ditto + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + tick = Main.player[Main.myPlayer].GetModPlayer(calamity).adrenaline; + return tick; + } + + public override void OnInitialize() + { + float posX = (float)Config.AdrenalineMeterXPos, posY = (float)Config.AdrenalineMeterYPos; //CHANGE THESE TWO TO CHANGE WHERE IT STARTS ON SCREEN! + if (backPanel == null) //if not using textures set up panels + { + backPanel = new UIPanel(); + ((UIPanel)backPanel).SetPadding(0); + backPanel.Left.Set(posX, 0f); + backPanel.Top.Set(posY, 0f); + backPanel.Width.Set(barWidth + 20f, 0f); + backPanel.Height.Set(50f, 0f); + ((UIPanel)backPanel).BackgroundColor = new Color(73, 94, 171); + + backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); + backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); + + barPanel = new UIPanel(); + ((UIPanel)barPanel).SetPadding(0); + barPanel.Left.Set(10f, 0f); + barPanel.Top.Set(10f, 0f); + barPanel.Width.Set(barWidth, 0f); + barPanel.Height.Set(30f, 0f); + ((UIPanel)barPanel).BackgroundColor = new Color(0, 0, 200); + backPanel.Append(barPanel); + } + else //otherwise using images so just move it into position + { + backPanel.Left.Set(posX, 0f); + backPanel.Top.Set(posY, 0f); + backPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); + backPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); + + barPanel.Left.Set(barOffset, 0f); + barPanel.Top.Set(0f, 0f); + + backPanel.Append(barPanel); + } + + base.Append(backPanel); + } + + public float GetPercentile() + { + return ((float)getValue() / Math.Max(1, ((float)valueMax - 1))); + } + + Vector2 offset; + public bool dragging = false; + private void DragStart(UIMouseEvent evt, UIElement listeningElement) + { + offset = new Vector2(evt.MousePosition.X - backPanel.Left.Pixels, evt.MousePosition.Y - backPanel.Top.Pixels); + dragging = true; + } + + private void DragEnd(UIMouseEvent evt, UIElement listeningElement) + { + Vector2 end = evt.MousePosition; + dragging = false; + + backPanel.Left.Set(end.X - offset.X, 0f); + backPanel.Top.Set(end.Y - offset.Y, 0f); + + Recalculate(); + } + + public override void Update(GameTime gameTime) + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + base.Update(gameTime); + Recalculate(); //THIS IS IMPORTANT! IDK why but when this is included it updates the drawing every tick. + tick = Main.player[Main.myPlayer].GetModPlayer(calamity).adrenaline; //updates the testing tick + if (tick >= 10000) + { + tick = 10000; + } + barPanel.Width.Set((GetPercentile() * barWidth), 0f); //set the bar's width to the given percentile. + } + + protected override void DrawSelf(SpriteBatch spriteBatch) + { + Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); + if (backPanel.ContainsPoint(MousePosition)) + { + Main.LocalPlayer.mouseInterface = true; + Main.instance.MouseText("Adrenaline: " + getValue() + "/" + valueMax + "", 0, 0, -1, -1, -1, -1); //only way I got this to show up consistently, otherwise it fucked up and showed up anywhere onscreen lol. + } + if (dragging) + { + backPanel.Left.Set(MousePosition.X - offset.X, 0f); + backPanel.Top.Set(MousePosition.Y - offset.Y, 0f); + Recalculate(); + } + } + } +} diff --git a/UI/UIImage.cs b/UI/UIImage.cs index f80f0dca4f..d96a3b1f16 100644 --- a/UI/UIImage.cs +++ b/UI/UIImage.cs @@ -1,36 +1,36 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -using Terraria; -using Terraria.GameContent.UI.Elements; -using Terraria.UI; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.UI -{ - public class UIImage : UIElement - { - public Texture2D texture = null; - - public UIImage(Texture2D tex, int width = -1, int height = -1) : base() - { - texture = tex; - this.Width.Set(width == -1 ? tex.Width : width, 0f); - this.Height.Set(height == -1 ? tex.Height : height, 0f); - } - - protected override void DrawSelf(SpriteBatch spriteBatch) - { - CalculatedStyle dimensions = base.GetDimensions(); - Color color = Color.White; - //base.IsMouseHovering ? Color.White : Color.Silver; //uncomment this to produce it getting brighter if hovered over. - int width = (int)dimensions.Width, height = (int)dimensions.Height; - spriteBatch.Draw(texture, new Rectangle((int)dimensions.X, (int)dimensions.Y, width, height), new Rectangle(0, 0, width, height), color); - } - } -} \ No newline at end of file +using System; +using System.Linq; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.GameContent.UI.Elements; +using Terraria.UI; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class UIImage : UIElement + { + public Texture2D texture = null; + + public UIImage(Texture2D tex, int width = -1, int height = -1) : base() + { + texture = tex; + this.Width.Set(width == -1 ? tex.Width : width, 0f); + this.Height.Set(height == -1 ? tex.Height : height, 0f); + } + + protected override void DrawSelf(SpriteBatch spriteBatch) + { + CalculatedStyle dimensions = base.GetDimensions(); + Color color = Color.White; + //base.IsMouseHovering ? Color.White : Color.Silver; //uncomment this to produce it getting brighter if hovered over. + int width = (int)dimensions.Width, height = (int)dimensions.Height; + spriteBatch.Draw(texture, new Rectangle((int)dimensions.X, (int)dimensions.Y, width, height), new Rectangle(0, 0, width, height), color); + } + } +} diff --git a/UIHandler.cs b/UIHandler.cs index cee41c5042..a9611f0601 100644 --- a/UIHandler.cs +++ b/UIHandler.cs @@ -1,69 +1,69 @@ -using System; -using System.Reflection; -using System.Collections.Generic; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -using Terraria; -using Terraria.UI.Chat; -using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.UI; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Terraria.Localization; -using Terraria.GameContent.UI; - -using CalamityMod.UI; - -namespace CalamityMod -{ - public class UIHandler - { - public static UserInterface userBar; - public static UserInterface userBar2; - public static UIBar uiBar; - public static UIBar2 uiBar2; - - //call this in mod.Load() - public static void OnLoad(Mod mod) - { - Texture2D borderTex = mod.GetTexture("ExtraTextures/UI/BarStressBorder"), barTex = mod.GetTexture("ExtraTextures/UI/BarStress"); //replace 'null' with your textures. - uiBar = new UIBar(borderTex, barTex, 4); //the 4 is how many pixels inwards to stick the bar, which in this case is 4. - userBar = new UserInterface(); - userBar.SetState(uiBar); - - Texture2D borderTex2 = mod.GetTexture("ExtraTextures/UI/BarAdrenalineBorder"), barTex2 = mod.GetTexture("ExtraTextures/UI/BarAdrenaline"); //replace 'null' with your textures. - uiBar2 = new UIBar2(borderTex2, barTex2, 4); //the 4 is how many pixels inwards to stick the bar, which in this case is 4. - userBar2 = new UserInterface(); - userBar2.SetState(uiBar2); - } - - //call this in mod.ModifyInterfaceLayers() - public static void ModifyInterfaceLayers(Mod mod, List layers) - { - AddInterfaceLayer(mod, layers, userBar, uiBar, "Calamity: Stress Bar", "Vanilla: Mouse Text", true); - AddInterfaceLayer(mod, layers, userBar2, uiBar2, "Calamity: Adrenaline Bar", "Vanilla: Mouse Text", true); - } - - public static void AddInterfaceLayer(Mod mod, List list, UserInterface uInterface, UIElement uElement, string layerName, string parent, bool first) - { - GameInterfaceLayer item = new LegacyGameInterfaceLayer(mod.Name + ":" + layerName, delegate - { - uInterface.Update(Main._drawInterfaceGameTime); - uElement.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.UI); - - int insertAt = -1; - for (int m = 0; m < list.Count; m++) - { - GameInterfaceLayer dl = list[m]; - if (dl.Name.Contains(parent)) { insertAt = m; break; } - } - if (insertAt == -1) list.Add(item); else list.Insert(first ? insertAt : insertAt + 1, item); - } - } -} \ No newline at end of file +using System; +using System.Reflection; +using System.Collections.Generic; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Terraria; +using Terraria.UI.Chat; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.UI; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Terraria.Localization; +using Terraria.GameContent.UI; + +using CalamityMod.UI; + +namespace CalamityMod +{ + public class UIHandler + { + public static UserInterface userBar; + public static UserInterface userBar2; + public static UIBar uiBar; + public static UIBar2 uiBar2; + + //call this in mod.Load() + public static void OnLoad(Mod mod) + { + Texture2D borderTex = mod.GetTexture("ExtraTextures/UI/BarStressBorder"), barTex = mod.GetTexture("ExtraTextures/UI/BarStress"); //replace 'null' with your textures. + uiBar = new UIBar(borderTex, barTex, 4); //the 4 is how many pixels inwards to stick the bar, which in this case is 4. + userBar = new UserInterface(); + userBar.SetState(uiBar); + + Texture2D borderTex2 = mod.GetTexture("ExtraTextures/UI/BarAdrenalineBorder"), barTex2 = mod.GetTexture("ExtraTextures/UI/BarAdrenaline"); //replace 'null' with your textures. + uiBar2 = new UIBar2(borderTex2, barTex2, 4); //the 4 is how many pixels inwards to stick the bar, which in this case is 4. + userBar2 = new UserInterface(); + userBar2.SetState(uiBar2); + } + + //call this in mod.ModifyInterfaceLayers() + public static void ModifyInterfaceLayers(Mod mod, List layers) + { + AddInterfaceLayer(mod, layers, userBar, uiBar, "Calamity: Stress Bar", "Vanilla: Mouse Text", true); + AddInterfaceLayer(mod, layers, userBar2, uiBar2, "Calamity: Adrenaline Bar", "Vanilla: Mouse Text", true); + } + + public static void AddInterfaceLayer(Mod mod, List list, UserInterface uInterface, UIElement uElement, string layerName, string parent, bool first) + { + GameInterfaceLayer item = new LegacyGameInterfaceLayer(mod.Name + ":" + layerName, delegate + { + uInterface.Update(Main._drawInterfaceGameTime); + uElement.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.UI); + + int insertAt = -1; + for (int m = 0; m < list.Count; m++) + { + GameInterfaceLayer dl = list[m]; + if (dl.Name.Contains(parent)) { insertAt = m; break; } + } + if (insertAt == -1) list.Add(item); else list.Insert(first ? insertAt : insertAt + 1, item); + } + } +} diff --git a/Walls/AbyssGravelWall.cs b/Walls/AbyssGravelWall.cs index c00bba5202..fec5fbb8a2 100644 --- a/Walls/AbyssGravelWall.cs +++ b/Walls/AbyssGravelWall.cs @@ -1,38 +1,38 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class AbyssGravelWall : ModWall - { - public override void SetDefaults() - { - dustType = 33; - } - - public override void RandomUpdate(int i, int j) - { - if (Main.tile[i, j].liquid <= 0 && j < Main.maxTilesY - 205) - { - Main.tile[i, j].liquid = 255; - Main.tile[i, j].lava(false); - } - } - - public override void KillWall(int i, int j, ref bool fail) - { - fail = true; - } - - public override bool CanExplode(int i, int j) - { - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class AbyssGravelWall : ModWall + { + public override void SetDefaults() + { + dustType = 33; + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j].liquid <= 0 && j < Main.maxTilesY - 205) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + + public override void KillWall(int i, int j, ref bool fail) + { + fail = true; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/AerialiteBrickWall.cs b/Walls/AerialiteBrickWall.cs index 94832b0214..14d4d8bcfe 100644 --- a/Walls/AerialiteBrickWall.cs +++ b/Walls/AerialiteBrickWall.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class AerialiteBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("AerialiteBrickWall"); - AddMapEntry(new Color(51, 45, 97)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(119, 102, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class AerialiteBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("AerialiteBrickWall"); + AddMapEntry(new Color(51, 45, 97)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/AshenSlabWall.cs b/Walls/AshenSlabWall.cs index 541c5090f4..bc11903ca0 100644 --- a/Walls/AshenSlabWall.cs +++ b/Walls/AshenSlabWall.cs @@ -87,4 +87,4 @@ namespace CalamityMod.Walls return (drawOffset - 9); } } -} \ No newline at end of file +} diff --git a/Walls/AstralBrickWall.cs b/Walls/AstralBrickWall.cs index a2eeb59fbe..c6ebbc69c6 100644 --- a/Walls/AstralBrickWall.cs +++ b/Walls/AstralBrickWall.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class AstralBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - Main.wallLargeFrames[Type] = 2; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("AstralBrickWall"); - AddMapEntry(new Color(74, 74, 97)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("AstralBasic"), 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class AstralBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + Main.wallLargeFrames[Type] = 2; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("AstralBrickWall"); + AddMapEntry(new Color(74, 74, 97)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("AstralBasic"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/AstralMonolithWall.cs b/Walls/AstralMonolithWall.cs index 3afcdbd5b4..ab37791bb8 100644 --- a/Walls/AstralMonolithWall.cs +++ b/Walls/AstralMonolithWall.cs @@ -86,4 +86,4 @@ namespace CalamityMod.Walls return (drawOffset - 9); } } -} \ No newline at end of file +} diff --git a/Walls/BrimstoneSlagWall.cs b/Walls/BrimstoneSlagWall.cs index a905a9c2f9..80a3f9edad 100644 --- a/Walls/BrimstoneSlagWall.cs +++ b/Walls/BrimstoneSlagWall.cs @@ -1,26 +1,26 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class BrimstoneSlagWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - drop = mod.ItemType("BrimstoneSlagWall"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Brimstone Slag Wall"); - AddMapEntry(new Color(20, 20, 20), name); - dustType = 53; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class BrimstoneSlagWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = mod.ItemType("BrimstoneSlagWall"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Brimstone Slag Wall"); + AddMapEntry(new Color(20, 20, 20), name); + dustType = 53; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/ChaoticBrickWall.cs b/Walls/ChaoticBrickWall.cs index 78921613bc..daf40f1d10 100644 --- a/Walls/ChaoticBrickWall.cs +++ b/Walls/ChaoticBrickWall.cs @@ -1,26 +1,26 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class ChaoticBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - drop = mod.ItemType("ChaoticBrickWall"); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Chaotic Brick Wall"); - AddMapEntry(new Color(255, 0, 0), name); - dustType = 105; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 2; - } - } -} \ No newline at end of file +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ChaoticBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = mod.ItemType("ChaoticBrickWall"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Chaotic Brick Wall"); + AddMapEntry(new Color(255, 0, 0), name); + dustType = 105; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Walls/CinderplateWall.cs b/Walls/CinderplateWall.cs index f01c855f65..430bc5e46f 100644 --- a/Walls/CinderplateWall.cs +++ b/Walls/CinderplateWall.cs @@ -1,22 +1,22 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class CinderplateWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("CinderplateWall"); - AddMapEntry(new Color(5, 5, 5)); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class CinderplateWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("CinderplateWall"); + AddMapEntry(new Color(5, 5, 5)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/CosmiliteBrickWall.cs b/Walls/CosmiliteBrickWall.cs index a29a3d1d8b..d6920efe2a 100644 --- a/Walls/CosmiliteBrickWall.cs +++ b/Walls/CosmiliteBrickWall.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class CosmiliteBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("CosmiliteBrickWall"); - AddMapEntry(new Color(34, 33, 59)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class CosmiliteBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("CosmiliteBrickWall"); + AddMapEntry(new Color(34, 33, 59)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/CryonicBrickWall.cs b/Walls/CryonicBrickWall.cs index e832255e04..fd8a61c814 100644 --- a/Walls/CryonicBrickWall.cs +++ b/Walls/CryonicBrickWall.cs @@ -1,128 +1,128 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.Graphics.Capture; - -namespace CalamityMod.Walls -{ - public class CryonicBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("CryonicBrickWall"); - AddMapEntry(new Color(72, 75, 122)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 176, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - bool drawWall = true; - if (Main.tile[i, j].wall == mod.WallType("CryonicBrickWall")) - { - drawWall = false; - Texture2D sprite = mod.GetTexture("Walls/CryonicBrickWall"); - Color lightColor = Lighting.GetColor(i, j); - //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 - 8, j * 16 - Main.screenPosition.Y - 8); - } - int[] sheetOffset = CreatePattern(i, j); - spriteBatch.Draw - ( - sprite, - drawOffset, - new Rectangle(sheetOffset[0] + Main.tile[i, j].wallFrameX(), sheetOffset[1] + Main.tile[i, j].wallFrameY(), 32, 32), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - } - return drawWall; - } - - public int[] CreatePattern(int i, int j) - { - int[] sheetOffset = new int[2] { i % 2, j % 4 }; - int xPos = i % 2; - int yPos = j % 4; - switch (xPos) - { - case 0: - switch (yPos) - { - case 0: - sheetOffset = new int[2] { 0, 0 }; - break; - case 1: - sheetOffset = new int[2] { 0, 1 }; - break; - case 2: - sheetOffset = new int[2] { 1, 0 }; - break; - case 3: - sheetOffset = new int[2] { 1, 1 }; - break; - } - break; - case 1: - switch (yPos) - { - case 0: - sheetOffset = new int[2] { 1, 0 }; - break; - case 1: - sheetOffset = new int[2] { 1, 1 }; - break; - case 2: - sheetOffset = new int[2] { 0, 0 }; - break; - case 3: - sheetOffset = new int[2] { 1, 0 }; - break; - } - break; - } - sheetOffset[0] = sheetOffset[0] * 468; - sheetOffset[1] = sheetOffset[1] * 180; - return (sheetOffset); - } - - /// - /// Gets the offset in both axes that should be used for drawing the additions to the tile - /// - /// The pixel draw offset of the postdrawn sprite in both axes - private int GetDrawOffset() - { - int drawOffset = 0; - if (Main.screenWidth < 1664f) - { - drawOffset = 193; - } - else - { - drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); - } - return (drawOffset - 9); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.Graphics.Capture; + +namespace CalamityMod.Walls +{ + public class CryonicBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("CryonicBrickWall"); + AddMapEntry(new Color(72, 75, 122)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 176, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + bool drawWall = true; + if (Main.tile[i, j].wall == mod.WallType("CryonicBrickWall")) + { + drawWall = false; + Texture2D sprite = mod.GetTexture("Walls/CryonicBrickWall"); + Color lightColor = Lighting.GetColor(i, j); + //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 - 8, j * 16 - Main.screenPosition.Y - 8); + } + int[] sheetOffset = CreatePattern(i, j); + spriteBatch.Draw + ( + sprite, + drawOffset, + new Rectangle(sheetOffset[0] + Main.tile[i, j].wallFrameX(), sheetOffset[1] + Main.tile[i, j].wallFrameY(), 32, 32), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + } + return drawWall; + } + + public int[] CreatePattern(int i, int j) + { + int[] sheetOffset = new int[2] { i % 2, j % 4 }; + int xPos = i % 2; + int yPos = j % 4; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + sheetOffset = new int[2] { 0, 0 }; + break; + case 1: + sheetOffset = new int[2] { 0, 1 }; + break; + case 2: + sheetOffset = new int[2] { 1, 0 }; + break; + case 3: + sheetOffset = new int[2] { 1, 1 }; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + sheetOffset = new int[2] { 1, 0 }; + break; + case 1: + sheetOffset = new int[2] { 1, 1 }; + break; + case 2: + sheetOffset = new int[2] { 0, 0 }; + break; + case 3: + sheetOffset = new int[2] { 1, 0 }; + break; + } + break; + } + sheetOffset[0] = sheetOffset[0] * 468; + sheetOffset[1] = sheetOffset[1] * 180; + return (sheetOffset); + } + + /// + /// Gets the offset in both axes that should be used for drawing the additions to the tile + /// + /// The pixel draw offset of the postdrawn sprite in both axes + private int GetDrawOffset() + { + int drawOffset = 0; + if (Main.screenWidth < 1664f) + { + drawOffset = 193; + } + else + { + drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); + } + return (drawOffset - 9); + } + } +} diff --git a/Walls/EutrophicSandWall.cs b/Walls/EutrophicSandWall.cs index 874d78454b..56bbfe4b7a 100644 --- a/Walls/EutrophicSandWall.cs +++ b/Walls/EutrophicSandWall.cs @@ -1,28 +1,28 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class EutrophicSandWall : ModWall - { - public override void SetDefaults() - { - dustType = 108; - } - - 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; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class EutrophicSandWall : ModWall + { + public override void SetDefaults() + { + dustType = 108; + } + + 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/EutrophicSandWallSafe.cs b/Walls/EutrophicSandWallSafe.cs index 0057c8cdc8..508ba8bfff 100644 --- a/Walls/EutrophicSandWallSafe.cs +++ b/Walls/EutrophicSandWallSafe.cs @@ -21,4 +21,4 @@ namespace CalamityMod.Walls num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Walls/MossyGravelWall.cs b/Walls/MossyGravelWall.cs index 0a9c182ace..7172a7d955 100644 --- a/Walls/MossyGravelWall.cs +++ b/Walls/MossyGravelWall.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class MossyGravelWall : ModWall - { - public override void SetDefaults() - { - dustType = 2; - } - - public override void KillWall(int i, int j, ref bool fail) - { - fail = true; - } - - public override bool CanExplode(int i, int j) - { - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class MossyGravelWall : ModWall + { + public override void SetDefaults() + { + dustType = 2; + } + + public override void KillWall(int i, int j, ref bool fail) + { + fail = true; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/NavystoneWall.cs b/Walls/NavystoneWall.cs index 21cce0c4cf..00b42edc7c 100644 --- a/Walls/NavystoneWall.cs +++ b/Walls/NavystoneWall.cs @@ -1,19 +1,19 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class NavystoneWall : ModWall - { - public override void SetDefaults() - { - dustType = 96; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class NavystoneWall : ModWall + { + public override void SetDefaults() + { + dustType = 96; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/NavystoneWallSafe.cs b/Walls/NavystoneWallSafe.cs index 13e5e27a76..d83b39d5f5 100644 --- a/Walls/NavystoneWallSafe.cs +++ b/Walls/NavystoneWallSafe.cs @@ -21,4 +21,4 @@ namespace CalamityMod.Walls num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Walls/OccultStoneWall.cs b/Walls/OccultStoneWall.cs index 584be78755..6a9b42d6be 100644 --- a/Walls/OccultStoneWall.cs +++ b/Walls/OccultStoneWall.cs @@ -25,4 +25,4 @@ namespace CalamityMod.Walls return false; } } -} \ No newline at end of file +} diff --git a/Walls/PerennialBrickWall.cs b/Walls/PerennialBrickWall.cs index 4d67d88c4d..e23257eb46 100644 --- a/Walls/PerennialBrickWall.cs +++ b/Walls/PerennialBrickWall.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.Graphics.Capture; - -namespace CalamityMod.Walls -{ - public class PerennialBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("PerennialBrickWall"); - AddMapEntry(new Color(64, 116, 43)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 128, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - bool drawWall = true; - if (Main.tile[i, j].wall == mod.WallType("PerennialBrickWall")) - { - drawWall = false; - Texture2D sprite = mod.GetTexture("Walls/PerennialBrickWall"); - Color lightColor = Lighting.GetColor(i, j); - //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 - 8, j * 16 - Main.screenPosition.Y - 8); - } - int[] sheetOffset = CreatePattern(i, j); - spriteBatch.Draw - ( - sprite, - drawOffset, - new Rectangle(sheetOffset[0] + Main.tile[i, j].wallFrameX(), sheetOffset[1] + Main.tile[i, j].wallFrameY(), 32, 32), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - } - return drawWall; - } - - public int[] CreatePattern(int i, int j) - { - int[] sheetOffset = new int[2] { i % 4, j % 4 }; - sheetOffset[0] = sheetOffset[0] * 468; - sheetOffset[1] = sheetOffset[1] * 180; - return (sheetOffset); - } - - /// - /// Gets the offset in both axes that should be used for drawing the additions to the tile - /// - /// The pixel draw offset of the postdrawn sprite in both axes - private int GetDrawOffset() - { - int drawOffset = 0; - if (Main.screenWidth < 1664f) - { - drawOffset = 193; - } - else - { - drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); - } - return (drawOffset - 9); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.Graphics.Capture; + +namespace CalamityMod.Walls +{ + public class PerennialBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("PerennialBrickWall"); + AddMapEntry(new Color(64, 116, 43)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 128, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + bool drawWall = true; + if (Main.tile[i, j].wall == mod.WallType("PerennialBrickWall")) + { + drawWall = false; + Texture2D sprite = mod.GetTexture("Walls/PerennialBrickWall"); + Color lightColor = Lighting.GetColor(i, j); + //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 - 8, j * 16 - Main.screenPosition.Y - 8); + } + int[] sheetOffset = CreatePattern(i, j); + spriteBatch.Draw + ( + sprite, + drawOffset, + new Rectangle(sheetOffset[0] + Main.tile[i, j].wallFrameX(), sheetOffset[1] + Main.tile[i, j].wallFrameY(), 32, 32), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + } + return drawWall; + } + + public int[] CreatePattern(int i, int j) + { + int[] sheetOffset = new int[2] { i % 4, j % 4 }; + sheetOffset[0] = sheetOffset[0] * 468; + sheetOffset[1] = sheetOffset[1] * 180; + return (sheetOffset); + } + + /// + /// Gets the offset in both axes that should be used for drawing the additions to the tile + /// + /// The pixel draw offset of the postdrawn sprite in both axes + private int GetDrawOffset() + { + int drawOffset = 0; + if (Main.screenWidth < 1664f) + { + drawOffset = 193; + } + else + { + drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); + } + return (drawOffset - 9); + } + } +} diff --git a/Walls/PlaguedPlateWall.cs b/Walls/PlaguedPlateWall.cs index 0e67df5f17..3ef23fd095 100644 --- a/Walls/PlaguedPlateWall.cs +++ b/Walls/PlaguedPlateWall.cs @@ -25,4 +25,4 @@ namespace CalamityMod.Walls return false; } } -} \ No newline at end of file +} diff --git a/Walls/ProfanedCrystalWall.cs b/Walls/ProfanedCrystalWall.cs index 4e33b6ca0c..8f34dbb285 100644 --- a/Walls/ProfanedCrystalWall.cs +++ b/Walls/ProfanedCrystalWall.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class ProfanedCrystalWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - soundType = 13; - drop = mod.ItemType("ProfanedCrystalWall"); - AddMapEntry(new Color(125, 97, 123)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 205, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ProfanedCrystalWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + soundType = 13; + drop = mod.ItemType("ProfanedCrystalWall"); + AddMapEntry(new Color(125, 97, 123)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 205, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/ProfanedRockWall.cs b/Walls/ProfanedRockWall.cs index 0255093b7e..aa95478ef9 100644 --- a/Walls/ProfanedRockWall.cs +++ b/Walls/ProfanedRockWall.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class ProfanedRockWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("ProfanedRockWall"); - AddMapEntry(new Color(41, 25, 31)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("ProfanedTileRock"), 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ProfanedRockWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("ProfanedRockWall"); + AddMapEntry(new Color(41, 25, 31)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 246, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("ProfanedTileRock"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/ProfanedSlabWall.cs b/Walls/ProfanedSlabWall.cs index f80bb573a2..8493ca3d65 100644 --- a/Walls/ProfanedSlabWall.cs +++ b/Walls/ProfanedSlabWall.cs @@ -1,28 +1,28 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class ProfanedSlabWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("ProfanedSlabWall"); - AddMapEntry(new Color(59, 27, 23)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("ProfanedTileRock"), 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ProfanedSlabWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("ProfanedSlabWall"); + AddMapEntry(new Color(59, 27, 23)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("ProfanedTileRock"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/RunicProfanedBrickWall.cs b/Walls/RunicProfanedBrickWall.cs index 0728c1578d..d08c0c3ab3 100644 --- a/Walls/RunicProfanedBrickWall.cs +++ b/Walls/RunicProfanedBrickWall.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.Graphics.Capture; - -namespace CalamityMod.Walls -{ - public class RunicProfanedBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("RunicProfanedBrickWall"); - AddMapEntry(new Color(43, 22, 27)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 205, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("ProfanedTileRock"), 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - bool drawWall = true; - if (Main.tile[i, j].wall == mod.WallType("RunicProfanedBrickWall")) - { - drawWall = false; - Texture2D sprite = mod.GetTexture("Walls/RunicProfanedBrickWall"); - Color lightColor = Lighting.GetColor(i, j); - //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 - 8, j * 16 - Main.screenPosition.Y - 8); - } - int[] sheetOffset = CreatePattern(i, j); - spriteBatch.Draw - ( - sprite, - drawOffset, - new Rectangle(sheetOffset[0] + Main.tile[i, j].wallFrameX(), sheetOffset[1] + Main.tile[i, j].wallFrameY(), 32, 32), - lightColor, - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); - } - return drawWall; - } - - public int[] CreatePattern(int i, int j) - { - int[] sheetOffset = new int[2] { i % 2, j % 2 }; - sheetOffset[0] = sheetOffset[0] * 468; - sheetOffset[1] = sheetOffset[1] * 180; - return (sheetOffset); - } - - /// - /// Gets the offset in both axes that should be used for drawing the additions to the tile - /// - /// The pixel draw offset of the postdrawn sprite in both axes - private int GetDrawOffset() - { - int drawOffset = 0; - if (Main.screenWidth < 1664f) - { - drawOffset = 193; - } - else - { - drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); - } - return (drawOffset - 9); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.Graphics.Capture; + +namespace CalamityMod.Walls +{ + public class RunicProfanedBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("RunicProfanedBrickWall"); + AddMapEntry(new Color(43, 22, 27)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 205, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, mod.DustType("ProfanedTileRock"), 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + bool drawWall = true; + if (Main.tile[i, j].wall == mod.WallType("RunicProfanedBrickWall")) + { + drawWall = false; + Texture2D sprite = mod.GetTexture("Walls/RunicProfanedBrickWall"); + Color lightColor = Lighting.GetColor(i, j); + //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 - 8, j * 16 - Main.screenPosition.Y - 8); + } + int[] sheetOffset = CreatePattern(i, j); + spriteBatch.Draw + ( + sprite, + drawOffset, + new Rectangle(sheetOffset[0] + Main.tile[i, j].wallFrameX(), sheetOffset[1] + Main.tile[i, j].wallFrameY(), 32, 32), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + } + return drawWall; + } + + public int[] CreatePattern(int i, int j) + { + int[] sheetOffset = new int[2] { i % 2, j % 2 }; + sheetOffset[0] = sheetOffset[0] * 468; + sheetOffset[1] = sheetOffset[1] * 180; + return (sheetOffset); + } + + /// + /// Gets the offset in both axes that should be used for drawing the additions to the tile + /// + /// The pixel draw offset of the postdrawn sprite in both axes + private int GetDrawOffset() + { + int drawOffset = 0; + if (Main.screenWidth < 1664f) + { + drawOffset = 193; + } + else + { + drawOffset = (int)(-0.5f * (float)Main.screenWidth + 1025f); + } + return (drawOffset - 9); + } + } +} diff --git a/Walls/SilvaWall.cs b/Walls/SilvaWall.cs index 88e03c17fb..3c113ee59f 100644 --- a/Walls/SilvaWall.cs +++ b/Walls/SilvaWall.cs @@ -26,4 +26,4 @@ namespace CalamityMod.Walls num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Walls/SmoothAbyssGravelWall.cs b/Walls/SmoothAbyssGravelWall.cs index 74b2d2318e..356e5c6233 100644 --- a/Walls/SmoothAbyssGravelWall.cs +++ b/Walls/SmoothAbyssGravelWall.cs @@ -1,28 +1,28 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class SmoothAbyssGravelWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SmoothAbyssGravelWall"); - AddMapEntry(new Color(28, 32, 44)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class SmoothAbyssGravelWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("SmoothAbyssGravelWall"); + AddMapEntry(new Color(28, 32, 44)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/SmoothBrimstoneSlagWall.cs b/Walls/SmoothBrimstoneSlagWall.cs index 88102479b3..84a9c01485 100644 --- a/Walls/SmoothBrimstoneSlagWall.cs +++ b/Walls/SmoothBrimstoneSlagWall.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class SmoothBrimstoneSlagWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SmoothBrimstoneSlagWall"); - AddMapEntry(new Color(30, 18, 36)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class SmoothBrimstoneSlagWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("SmoothBrimstoneSlagWall"); + AddMapEntry(new Color(30, 18, 36)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/SmoothNavystoneWall.cs b/Walls/SmoothNavystoneWall.cs index 9a0ea215f7..353be13fb4 100644 --- a/Walls/SmoothNavystoneWall.cs +++ b/Walls/SmoothNavystoneWall.cs @@ -25,4 +25,4 @@ namespace CalamityMod.Walls num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Walls/SmoothVoidstoneWall.cs b/Walls/SmoothVoidstoneWall.cs index 291b07ba78..c3ab55143a 100644 --- a/Walls/SmoothVoidstoneWall.cs +++ b/Walls/SmoothVoidstoneWall.cs @@ -1,28 +1,28 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class SmoothVoidstoneWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("SmoothVoidstoneWall"); - AddMapEntry(new Color(11, 11, 13)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class SmoothVoidstoneWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("SmoothVoidstoneWall"); + AddMapEntry(new Color(11, 11, 13)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/StatigelWall.cs b/Walls/StatigelWall.cs index fb226820ba..45f17fd3ca 100644 --- a/Walls/StatigelWall.cs +++ b/Walls/StatigelWall.cs @@ -1,28 +1,28 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class StatigelWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("StatigelWall"); - AddMapEntry(new Color(162, 54, 90)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class StatigelWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("StatigelWall"); + AddMapEntry(new Color(162, 54, 90)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 243, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/StratusWall.cs b/Walls/StratusWall.cs index 7c8a27179c..0cf5e081f5 100644 --- a/Walls/StratusWall.cs +++ b/Walls/StratusWall.cs @@ -26,4 +26,4 @@ namespace CalamityMod.Walls num = fail ? 1 : 3; } } -} \ No newline at end of file +} diff --git a/Walls/UelibloomBrickWall.cs b/Walls/UelibloomBrickWall.cs index 9f04472c74..305cdbff79 100644 --- a/Walls/UelibloomBrickWall.cs +++ b/Walls/UelibloomBrickWall.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class UelibloomBrickWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("UelibloomBrickWall"); - AddMapEntry(new Color(97, 59, 35)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 39, 0f, 0f, 1, new Color(255, 255, 255), 1f); - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class UelibloomBrickWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("UelibloomBrickWall"); + AddMapEntry(new Color(97, 59, 35)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 39, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 10, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/VoidstoneSlabWall.cs b/Walls/VoidstoneSlabWall.cs index 56a013193f..6c0effcece 100644 --- a/Walls/VoidstoneSlabWall.cs +++ b/Walls/VoidstoneSlabWall.cs @@ -133,4 +133,4 @@ namespace CalamityMod.Walls return (drawOffset - 9); } } -} \ No newline at end of file +} diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index 6846cb9dd6..906c2d673b 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -1,30 +1,30 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Microsoft.Xna.Framework.Graphics; - -namespace CalamityMod.Walls -{ - public class VoidstoneWall : ModWall - { - public override void SetDefaults() - { - Main.wallHouse[Type] = true; - dustType = mod.DustType("Sparkle"); - drop = mod.ItemType("VoidstoneWall"); - AddMapEntry(new Color(5, 5, 5)); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Walls +{ + public class VoidstoneWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + dustType = mod.DustType("Sparkle"); + drop = mod.ItemType("VoidstoneWall"); + AddMapEntry(new Color(5, 5, 5)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index 716f22a3d2..b91ef859f1 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -1,38 +1,38 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class VoidstoneWallUnsafe : ModWall - { - public override void SetDefaults() - { - dustType = 187; - } - - public override void RandomUpdate(int i, int j) - { - if (Main.tile[i, j].liquid <= 0 && j < Main.maxTilesY - 205) - { - Main.tile[i, j].liquid = 255; - Main.tile[i, j].lava(false); - } - } - - public override void KillWall(int i, int j, ref bool fail) - { - fail = true; - } - - public override bool CanExplode(int i, int j) - { - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class VoidstoneWallUnsafe : ModWall + { + public override void SetDefaults() + { + dustType = 187; + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j].liquid <= 0 && j < Main.maxTilesY - 205) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + + public override void KillWall(int i, int j, ref bool fail) + { + fail = true; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs index 0599e1b8c0..9b4ee5bc98 100644 --- a/Waters/AbyssWater.cs +++ b/Waters/AbyssWater.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class AbyssWater : ModWaterStyle - { - public override bool ChooseWaterStyle() - { - return Main.LocalPlayer.GetModPlayer(mod).ZoneAbyss; - } - - public override int ChooseWaterfallStyle() - { - return mod.GetWaterfallStyleSlot("AbyssWaterflow"); - } - - public override int GetSplashDust() - { - return 33; - } - - public override int GetDropletGore() - { - return 713; - } - - public override Color BiomeHairColor() - { - return Color.Blue; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class AbyssWater : ModWaterStyle + { + public override bool ChooseWaterStyle() + { + return Main.LocalPlayer.GetModPlayer(mod).ZoneAbyss; + } + + public override int ChooseWaterfallStyle() + { + return mod.GetWaterfallStyleSlot("AbyssWaterflow"); + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.Blue; + } + } +} diff --git a/Waters/AbyssWaterflow.cs b/Waters/AbyssWaterflow.cs index cb8ea57f8a..1d4a251ded 100644 --- a/Waters/AbyssWaterflow.cs +++ b/Waters/AbyssWaterflow.cs @@ -1,10 +1,10 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class AbyssWaterflow : ModWaterfallStyle - { - - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class AbyssWaterflow : ModWaterfallStyle + { + + } +} diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index e336646bcc..16a16de244 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -1,29 +1,29 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Waters -{ - public class AstralWater : ModWaterStyle - { - public override bool ChooseWaterStyle() - { - return Main.LocalPlayer.GetModPlayer(mod).ZoneAstral; - } - public override int ChooseWaterfallStyle() - { - return mod.GetWaterfallStyleSlot("AstralWaterflow"); - } - public override int GetSplashDust() - { - return 52; //corruption water? - } - public override int GetDropletGore() - { - return mod.GetGoreSlot("Gores/AstralWaterDroplet"); - } - public override Color BiomeHairColor() - { - return Color.MediumPurple; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Waters +{ + public class AstralWater : ModWaterStyle + { + public override bool ChooseWaterStyle() + { + return Main.LocalPlayer.GetModPlayer(mod).ZoneAstral; + } + public override int ChooseWaterfallStyle() + { + return mod.GetWaterfallStyleSlot("AstralWaterflow"); + } + public override int GetSplashDust() + { + return 52; //corruption water? + } + public override int GetDropletGore() + { + return mod.GetGoreSlot("Gores/AstralWaterDroplet"); + } + public override Color BiomeHairColor() + { + return Color.MediumPurple; + } + } +} diff --git a/Waters/AstralWaterflow.cs b/Waters/AstralWaterflow.cs index 72665416b5..c8a2220ca2 100644 --- a/Waters/AstralWaterflow.cs +++ b/Waters/AstralWaterflow.cs @@ -1,8 +1,8 @@ -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Waters -{ - public class AstralWaterflow : ModWaterfallStyle - { - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Waters +{ + public class AstralWaterflow : ModWaterfallStyle + { + } +} diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 9253fa28e3..d31917d5cf 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class SulphuricWater : ModWaterStyle - { - public override bool ChooseWaterStyle() - { - return Main.LocalPlayer.GetModPlayer(mod).ZoneSulphur; - } - - public override int ChooseWaterfallStyle() - { - return mod.GetWaterfallStyleSlot("SulphuricWaterflow"); - } - - public override int GetSplashDust() - { - return 102; - } - - public override int GetDropletGore() - { - return 711; - } - - public override Color BiomeHairColor() - { - return Color.Yellow; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SulphuricWater : ModWaterStyle + { + public override bool ChooseWaterStyle() + { + return Main.LocalPlayer.GetModPlayer(mod).ZoneSulphur; + } + + public override int ChooseWaterfallStyle() + { + return mod.GetWaterfallStyleSlot("SulphuricWaterflow"); + } + + public override int GetSplashDust() + { + return 102; + } + + public override int GetDropletGore() + { + return 711; + } + + public override Color BiomeHairColor() + { + return Color.Yellow; + } + } +} diff --git a/Waters/SulphuricWaterflow.cs b/Waters/SulphuricWaterflow.cs index 79a9ca1e69..4736435fac 100644 --- a/Waters/SulphuricWaterflow.cs +++ b/Waters/SulphuricWaterflow.cs @@ -1,10 +1,10 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class SulphuricWaterflow : ModWaterfallStyle - { - - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SulphuricWaterflow : ModWaterfallStyle + { + + } +} diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaWater.cs index c9cd17d18c..6e48f381fa 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaWater.cs @@ -1,34 +1,34 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class SunkenSeaWater : ModWaterStyle - { - public override bool ChooseWaterStyle() - { - return Main.LocalPlayer.GetModPlayer(mod).ZoneSunkenSea; - } - - public override int ChooseWaterfallStyle() - { - return mod.GetWaterfallStyleSlot("SunkenSeaWaterflow"); - } - - public override int GetSplashDust() - { - return 33; - } - - public override int GetDropletGore() - { - return 713; - } - - public override Color BiomeHairColor() - { - return Color.Blue; - } - } -} \ No newline at end of file +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SunkenSeaWater : ModWaterStyle + { + public override bool ChooseWaterStyle() + { + return Main.LocalPlayer.GetModPlayer(mod).ZoneSunkenSea; + } + + public override int ChooseWaterfallStyle() + { + return mod.GetWaterfallStyleSlot("SunkenSeaWaterflow"); + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.Blue; + } + } +} diff --git a/Waters/SunkenSeaWaterflow.cs b/Waters/SunkenSeaWaterflow.cs index 631c9cf0ee..9aaac20a9d 100644 --- a/Waters/SunkenSeaWaterflow.cs +++ b/Waters/SunkenSeaWaterflow.cs @@ -1,10 +1,10 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Waters -{ - public class SunkenSeaWaterflow : ModWaterfallStyle - { - - } -} \ No newline at end of file +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SunkenSeaWaterflow : ModWaterfallStyle + { + + } +} diff --git a/WeakReferenceSupport.cs b/WeakReferenceSupport.cs index 064caf01f1..7da4705cf0 100644 --- a/WeakReferenceSupport.cs +++ b/WeakReferenceSupport.cs @@ -1,65 +1,65 @@ -using System; -using Terraria; -using Terraria.ModLoader; - -using CalamityMod.World; - -namespace CalamityMod -{ - internal class WeakReferenceSupport - { - public static void Setup() - { - BossChecklistSupport(); - CensusSupport(); - } - - private static void BossChecklistSupport() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Mod bossChecklist = ModLoader.GetMod("BossChecklist"); - - if (bossChecklist != null) - { - // 14 is moonlord, 12 is duke fishron - bossChecklist.Call("AddBossWithInfo", "Desert Scourge", 1.5f, (Func)(() => CalamityWorld.downedDesertScourge), "Use a [i:" + mod.ItemType("DriedSeafood") + "] in the Desert Biome"); //1 - bossChecklist.Call("AddBossWithInfo", "Crabulon", 2.5f, (Func)(() => CalamityWorld.downedCrabulon), "Use a [i:" + mod.ItemType("DecapoditaSprout") + "] in the Mushroom Biome"); //1.5 - bossChecklist.Call("AddBossWithInfo", "Hive Mind / Perforator", 3.5f, (Func)(() => (CalamityWorld.downedPerforator || CalamityWorld.downedHiveMind)), "By killing a Cyst in the World's Evil Biome"); //2 - bossChecklist.Call("AddBossWithInfo", "Slime God", 5.5f, (Func)(() => CalamityWorld.downedSlimeGod), "Use an [i:" + mod.ItemType("OverloadedSludge") + "]"); //4 - bossChecklist.Call("AddBossWithInfo", "Cryogen", 6.5f, (Func)(() => CalamityWorld.downedCryogen), "Use a [i:" + mod.ItemType("CryoKey") + "] in the Snow Biome"); //5 - bossChecklist.Call("AddBossWithInfo", "Brimstone Elemental", 7.5f, (Func)(() => CalamityWorld.downedBrimstoneElemental), "Use a [i:" + mod.ItemType("CharredIdol") + "] in the Hell Crag"); //6 - bossChecklist.Call("AddBossWithInfo", "Aquatic Scourge", 8.5f, (Func)(() => CalamityWorld.downedAquaticScourge), "Use a [i:" + mod.ItemType("Seafood") + "] in the Sulphuric Sea or wait for it to spawn in the Sulphuric Sea"); //6 - bossChecklist.Call("AddBossWithInfo", "Calamitas", 9.7f, (Func)(() => CalamityWorld.downedCalamitas), "Use an [i:" + mod.ItemType("BlightedEyeball") + "] at Night"); //7 - bossChecklist.Call("AddBossWithInfo", "Leviathan", 10.5f, (Func)(() => CalamityWorld.downedLeviathan), "By killing an unknown entity in the Ocean Biome"); //8 - bossChecklist.Call("AddBossWithInfo", "Astrum Aureus", 10.6f, (Func)(() => CalamityWorld.downedAstrageldon), "Use an [i:" + mod.ItemType("AstralChunk") + "] at Night"); //8.5 - bossChecklist.Call("AddBossWithInfo", "Plaguebringer Goliath", 11.5f, (Func)(() => CalamityWorld.downedPlaguebringer), "Use an [i:" + mod.ItemType("Abomination") + "] in the Jungle Biome"); //9 - bossChecklist.Call("AddBossWithInfo", "Ravager", 12.5f, (Func)(() => CalamityWorld.downedScavenger), "Use an [i:" + mod.ItemType("AncientMedallion") + "]"); //9.5 - bossChecklist.Call("AddBossWithInfo", "Astrum Deus", 13.5f, (Func)(() => CalamityWorld.downedStarGod), "Use a [i:" + mod.ItemType("Starcore") + "] at Night"); //9.6 - //bossChecklist.Call("AddBossWithInfo", "The Old Duke", 13.6f, (Func)(() => CalamityWorld.downedOldDuke), "Fishing with some type of bait in the Sulphuric Sea"); //9.7 - bossChecklist.Call("AddBossWithInfo", "Profaned Guardians", 14.5f, (Func)(() => CalamityWorld.downedGuardians), "Use a [i:" + mod.ItemType("ProfanedShard") + "] in the Hallow or Underworld Biomes"); //10 - bossChecklist.Call("AddBossWithInfo", "Bumblebirb", 14.6f, (Func)(() => CalamityWorld.downedBumble), "Use [i:" + mod.ItemType("BirbPheromones") + "] in the Jungle Biome"); //16 - bossChecklist.Call("AddBossWithInfo", "Providence", 15f, (Func)(() => CalamityWorld.downedProvidence), "Use a [i:" + mod.ItemType("ProfanedCore") + "] in the Hallow or Underworld Biomes"); //11 - bossChecklist.Call("AddBossWithInfo", "Ceaseless Void", 15.1f, (Func)(() => CalamityWorld.downedSentinel1), "Use a [i:" + mod.ItemType("RuneofCos") + "] in the Dungeon"); //12 - bossChecklist.Call("AddBossWithInfo", "Storm Weaver", 15.2f, (Func)(() => CalamityWorld.downedSentinel2), "Use a [i:" + mod.ItemType("RuneofCos") + "] in Space"); //13 - bossChecklist.Call("AddBossWithInfo", "Signus", 15.3f, (Func)(() => CalamityWorld.downedSentinel3), "Use a [i:" + mod.ItemType("RuneofCos") + "] in the Underworld"); //14 - bossChecklist.Call("AddBossWithInfo", "Polterghast", 15.5f, (Func)(() => CalamityWorld.downedPolterghast), "Use a [i:" + mod.ItemType("NecroplasmicBeacon") + "] in the Dungeon or kill 30 phantom spirits"); //11 - bossChecklist.Call("AddBossWithInfo", "Devourer of Gods", 16f, (Func)(() => CalamityWorld.downedDoG), "Use a [i:" + mod.ItemType("CosmicWorm") + "]"); //15 - bossChecklist.Call("AddBossWithInfo", "Yharon", 17f, (Func)(() => CalamityWorld.downedYharon), "Use a [i:" + mod.ItemType("ChickenEgg") + "] in the Jungle Biome"); //17 - bossChecklist.Call("AddBossWithInfo", "Supreme Calamitas", 18f, (Func)(() => CalamityWorld.downedSCal), "Use an [i:" + mod.ItemType("EyeofExtinction") + "]"); //18 - //bossChecklist.Call("AddBossWithInfo", "MEME GOD", 19f, (Func)(() => CalamityWorld.downedLORDE), "Use [i:" + mod.ItemType("NO") + "]"); //19 - } - } - - private static void CensusSupport() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Mod censusMod = ModLoader.GetMod("Census"); - if (censusMod != null) - { - censusMod.Call("TownNPCCondition", mod.NPCType("SEAHOE"), "Defeat a Giant Clam"); - censusMod.Call("TownNPCCondition", mod.NPCType("FAP"), "Have [i:" + mod.ItemType("FabsolsVodka") + "] in your inventory in Hardmode"); - censusMod.Call("TownNPCCondition", mod.NPCType("DILF"), "Defeat Cryogen"); - } - } - } +using System; +using Terraria; +using Terraria.ModLoader; + +using CalamityMod.World; + +namespace CalamityMod +{ + internal class WeakReferenceSupport + { + public static void Setup() + { + BossChecklistSupport(); + CensusSupport(); + } + + private static void BossChecklistSupport() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Mod bossChecklist = ModLoader.GetMod("BossChecklist"); + + if (bossChecklist != null) + { + // 14 is moonlord, 12 is duke fishron + bossChecklist.Call("AddBossWithInfo", "Desert Scourge", 1.5f, (Func)(() => CalamityWorld.downedDesertScourge), "Use a [i:" + mod.ItemType("DriedSeafood") + "] in the Desert Biome"); //1 + bossChecklist.Call("AddBossWithInfo", "Crabulon", 2.5f, (Func)(() => CalamityWorld.downedCrabulon), "Use a [i:" + mod.ItemType("DecapoditaSprout") + "] in the Mushroom Biome"); //1.5 + bossChecklist.Call("AddBossWithInfo", "Hive Mind / Perforator", 3.5f, (Func)(() => (CalamityWorld.downedPerforator || CalamityWorld.downedHiveMind)), "By killing a Cyst in the World's Evil Biome"); //2 + bossChecklist.Call("AddBossWithInfo", "Slime God", 5.5f, (Func)(() => CalamityWorld.downedSlimeGod), "Use an [i:" + mod.ItemType("OverloadedSludge") + "]"); //4 + bossChecklist.Call("AddBossWithInfo", "Cryogen", 6.5f, (Func)(() => CalamityWorld.downedCryogen), "Use a [i:" + mod.ItemType("CryoKey") + "] in the Snow Biome"); //5 + bossChecklist.Call("AddBossWithInfo", "Brimstone Elemental", 7.5f, (Func)(() => CalamityWorld.downedBrimstoneElemental), "Use a [i:" + mod.ItemType("CharredIdol") + "] in the Hell Crag"); //6 + bossChecklist.Call("AddBossWithInfo", "Aquatic Scourge", 8.5f, (Func)(() => CalamityWorld.downedAquaticScourge), "Use a [i:" + mod.ItemType("Seafood") + "] in the Sulphuric Sea or wait for it to spawn in the Sulphuric Sea"); //6 + bossChecklist.Call("AddBossWithInfo", "Calamitas", 9.7f, (Func)(() => CalamityWorld.downedCalamitas), "Use an [i:" + mod.ItemType("BlightedEyeball") + "] at Night"); //7 + bossChecklist.Call("AddBossWithInfo", "Leviathan", 10.5f, (Func)(() => CalamityWorld.downedLeviathan), "By killing an unknown entity in the Ocean Biome"); //8 + bossChecklist.Call("AddBossWithInfo", "Astrum Aureus", 10.6f, (Func)(() => CalamityWorld.downedAstrageldon), "Use an [i:" + mod.ItemType("AstralChunk") + "] at Night"); //8.5 + bossChecklist.Call("AddBossWithInfo", "Plaguebringer Goliath", 11.5f, (Func)(() => CalamityWorld.downedPlaguebringer), "Use an [i:" + mod.ItemType("Abomination") + "] in the Jungle Biome"); //9 + bossChecklist.Call("AddBossWithInfo", "Ravager", 12.5f, (Func)(() => CalamityWorld.downedScavenger), "Use an [i:" + mod.ItemType("AncientMedallion") + "]"); //9.5 + bossChecklist.Call("AddBossWithInfo", "Astrum Deus", 13.5f, (Func)(() => CalamityWorld.downedStarGod), "Use a [i:" + mod.ItemType("Starcore") + "] at Night"); //9.6 + //bossChecklist.Call("AddBossWithInfo", "The Old Duke", 13.6f, (Func)(() => CalamityWorld.downedOldDuke), "Fishing with some type of bait in the Sulphuric Sea"); //9.7 + bossChecklist.Call("AddBossWithInfo", "Profaned Guardians", 14.5f, (Func)(() => CalamityWorld.downedGuardians), "Use a [i:" + mod.ItemType("ProfanedShard") + "] in the Hallow or Underworld Biomes"); //10 + bossChecklist.Call("AddBossWithInfo", "Bumblebirb", 14.6f, (Func)(() => CalamityWorld.downedBumble), "Use [i:" + mod.ItemType("BirbPheromones") + "] in the Jungle Biome"); //16 + bossChecklist.Call("AddBossWithInfo", "Providence", 15f, (Func)(() => CalamityWorld.downedProvidence), "Use a [i:" + mod.ItemType("ProfanedCore") + "] in the Hallow or Underworld Biomes"); //11 + bossChecklist.Call("AddBossWithInfo", "Ceaseless Void", 15.1f, (Func)(() => CalamityWorld.downedSentinel1), "Use a [i:" + mod.ItemType("RuneofCos") + "] in the Dungeon"); //12 + bossChecklist.Call("AddBossWithInfo", "Storm Weaver", 15.2f, (Func)(() => CalamityWorld.downedSentinel2), "Use a [i:" + mod.ItemType("RuneofCos") + "] in Space"); //13 + bossChecklist.Call("AddBossWithInfo", "Signus", 15.3f, (Func)(() => CalamityWorld.downedSentinel3), "Use a [i:" + mod.ItemType("RuneofCos") + "] in the Underworld"); //14 + bossChecklist.Call("AddBossWithInfo", "Polterghast", 15.5f, (Func)(() => CalamityWorld.downedPolterghast), "Use a [i:" + mod.ItemType("NecroplasmicBeacon") + "] in the Dungeon or kill 30 phantom spirits"); //11 + bossChecklist.Call("AddBossWithInfo", "Devourer of Gods", 16f, (Func)(() => CalamityWorld.downedDoG), "Use a [i:" + mod.ItemType("CosmicWorm") + "]"); //15 + bossChecklist.Call("AddBossWithInfo", "Yharon", 17f, (Func)(() => CalamityWorld.downedYharon), "Use a [i:" + mod.ItemType("ChickenEgg") + "] in the Jungle Biome"); //17 + bossChecklist.Call("AddBossWithInfo", "Supreme Calamitas", 18f, (Func)(() => CalamityWorld.downedSCal), "Use an [i:" + mod.ItemType("EyeofExtinction") + "]"); //18 + //bossChecklist.Call("AddBossWithInfo", "MEME GOD", 19f, (Func)(() => CalamityWorld.downedLORDE), "Use [i:" + mod.ItemType("NO") + "]"); //19 + } + } + + private static void CensusSupport() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Mod censusMod = ModLoader.GetMod("Census"); + if (censusMod != null) + { + censusMod.Call("TownNPCCondition", mod.NPCType("SEAHOE"), "Defeat a Giant Clam"); + censusMod.Call("TownNPCCondition", mod.NPCType("FAP"), "Have [i:" + mod.ItemType("FabsolsVodka") + "] in your inventory in Hardmode"); + censusMod.Call("TownNPCCondition", mod.NPCType("DILF"), "Defeat Cryogen"); + } + } + } } diff --git a/World/CustomActions.cs b/World/CustomActions.cs index 31fb7d88fb..866966cad2 100644 --- a/World/CustomActions.cs +++ b/World/CustomActions.cs @@ -1,129 +1,129 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.ID; -using Terraria.World.Generation; - -namespace CalamityMod.World -{ - public static class CustomActions - { - public class SolidScanner : GenAction - { - private int _count; - - public SolidScanner() { } - - public int GetCount() - { - return _count; - } - - public override bool Apply(Point origin, int x, int y, params object[] args) - { - Tile tile = GenBase._tiles[x, y]; - if (tile.active() && Main.tileSolid[tile.type]) - { - _count++; - } - return base.UnitApply(origin, x, y, args); - } - } - - public class PlaceTree : GenAction - { - public PlaceTree() { } - public override bool Apply(Point origin, int x, int y, params object[] args) - { - return WorldGen.GrowTree(x, y); - } - } - - public class JungleGrass : GenAction - { - private bool _tryMushrooms; - public JungleGrass(bool mush) - { - _tryMushrooms = mush; - } - public override bool Apply(Point origin, int x, int y, params object[] args) - { - if (GenBase._tiles[x, y].active() || GenBase._tiles[x, y - 1].active()) - { - return false; - } - if (_tiles[x, y + 1].type == TileID.JungleGrass) - { - WorldGen.PlaceTile(x, y, _random.Next(new ushort[] { TileID.JunglePlants, TileID.JunglePlants2 }), true, false, -1, 0); - } - else if (_tryMushrooms && _tiles[x, y+1].type == TileID.MushroomGrass) - { - WorldGen.PlaceTile(x, y, TileID.MushroomPlants); - } - return base.UnitApply(origin, x, y, args); - } - } - - public class RandomFrom : GenAction - { - private GenAction[] _actions; - private float[] _weights; - public RandomFrom(GenAction[] actions, float[] weights) - { - _actions = actions; - _weights = new float[weights.Length]; - for (int i = 0; i < weights.Length; i++) - { - if (i == 0) - { - _weights[0] = weights[0]; - continue; - } - _weights[i] = _weights[i - 1] + weights[i]; - } - } - - public override bool Apply(Point origin, int x, int y, params object[] args) - { - float number = _random.NextFloat(0f, 1f); - int index = 0; - while (number > _weights[index]) - { - index++; - } - return _actions[index].Apply(origin, x, y, args); - } - } - public class DistanceFromOrigin : GenAction - { - private float _distance; - private bool _greaterThan; - - public DistanceFromOrigin(bool greater, float distance) - { - _greaterThan = greater; - _distance = distance; - } - - public override bool Apply(Point origin, int x, int y, params object[] args) - { - Vector2 worldOrigin = origin.ToWorldCoordinates(); - float distance = Vector2.Distance(worldOrigin, new Vector2(x * 16 + 8, y * 16 + 8)); - if (_greaterThan && distance > _distance) - { - return base.UnitApply(origin, x, y, args); - } - else if(distance < _distance) - { - return base.UnitApply(origin, x, y, args); - } - return false; - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.ID; +using Terraria.World.Generation; + +namespace CalamityMod.World +{ + public static class CustomActions + { + public class SolidScanner : GenAction + { + private int _count; + + public SolidScanner() { } + + public int GetCount() + { + return _count; + } + + public override bool Apply(Point origin, int x, int y, params object[] args) + { + Tile tile = GenBase._tiles[x, y]; + if (tile.active() && Main.tileSolid[tile.type]) + { + _count++; + } + return base.UnitApply(origin, x, y, args); + } + } + + public class PlaceTree : GenAction + { + public PlaceTree() { } + public override bool Apply(Point origin, int x, int y, params object[] args) + { + return WorldGen.GrowTree(x, y); + } + } + + public class JungleGrass : GenAction + { + private bool _tryMushrooms; + public JungleGrass(bool mush) + { + _tryMushrooms = mush; + } + public override bool Apply(Point origin, int x, int y, params object[] args) + { + if (GenBase._tiles[x, y].active() || GenBase._tiles[x, y - 1].active()) + { + return false; + } + if (_tiles[x, y + 1].type == TileID.JungleGrass) + { + WorldGen.PlaceTile(x, y, _random.Next(new ushort[] { TileID.JunglePlants, TileID.JunglePlants2 }), true, false, -1, 0); + } + else if (_tryMushrooms && _tiles[x, y+1].type == TileID.MushroomGrass) + { + WorldGen.PlaceTile(x, y, TileID.MushroomPlants); + } + return base.UnitApply(origin, x, y, args); + } + } + + public class RandomFrom : GenAction + { + private GenAction[] _actions; + private float[] _weights; + public RandomFrom(GenAction[] actions, float[] weights) + { + _actions = actions; + _weights = new float[weights.Length]; + for (int i = 0; i < weights.Length; i++) + { + if (i == 0) + { + _weights[0] = weights[0]; + continue; + } + _weights[i] = _weights[i - 1] + weights[i]; + } + } + + public override bool Apply(Point origin, int x, int y, params object[] args) + { + float number = _random.NextFloat(0f, 1f); + int index = 0; + while (number > _weights[index]) + { + index++; + } + return _actions[index].Apply(origin, x, y, args); + } + } + public class DistanceFromOrigin : GenAction + { + private float _distance; + private bool _greaterThan; + + public DistanceFromOrigin(bool greater, float distance) + { + _greaterThan = greater; + _distance = distance; + } + + public override bool Apply(Point origin, int x, int y, params object[] args) + { + Vector2 worldOrigin = origin.ToWorldCoordinates(); + float distance = Vector2.Distance(worldOrigin, new Vector2(x * 16 + 8, y * 16 + 8)); + if (_greaterThan && distance > _distance) + { + return base.UnitApply(origin, x, y, args); + } + else if(distance < _distance) + { + return base.UnitApply(origin, x, y, args); + } + return false; + } + } + } +} diff --git a/World/CustomConditions.cs b/World/CustomConditions.cs index 63734ff67c..3f7e73499e 100644 --- a/World/CustomConditions.cs +++ b/World/CustomConditions.cs @@ -1,54 +1,54 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Microsoft.Xna.Framework; - -using Terraria; -using Terraria.World.Generation; - -namespace CalamityMod.World -{ - public static class CustomConditions - { - public class RandomChance : GenCondition - { - private float oneInThisValue; - - public RandomChance(float chance) - { - oneInThisValue = chance; - } - - protected override bool CheckValidity(int x, int y) - { - return _random.NextFloat(oneInThisValue) <= 1f; - } - } - public class IsNotTouchingAir : GenCondition - { - private bool _useDiagonals; - public IsNotTouchingAir(bool diagonals) - { - _useDiagonals = diagonals; - } - protected override bool CheckValidity(int x, int y) - { - for (int i = x - 1; i <= x + 1; i++) - { - for (int j = y - 1; j <= y + 1; j++) - { - if (j != y && i != x && !_useDiagonals) continue; - if (!WorldGen.InWorld(i, j)) continue; - if (!_tiles[i, j].active()) - { - return false; - } - } - } - return true; - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.Xna.Framework; + +using Terraria; +using Terraria.World.Generation; + +namespace CalamityMod.World +{ + public static class CustomConditions + { + public class RandomChance : GenCondition + { + private float oneInThisValue; + + public RandomChance(float chance) + { + oneInThisValue = chance; + } + + protected override bool CheckValidity(int x, int y) + { + return _random.NextFloat(oneInThisValue) <= 1f; + } + } + public class IsNotTouchingAir : GenCondition + { + private bool _useDiagonals; + public IsNotTouchingAir(bool diagonals) + { + _useDiagonals = diagonals; + } + protected override bool CheckValidity(int x, int y) + { + for (int i = x - 1; i <= x + 1; i++) + { + for (int j = y - 1; j <= y + 1; j++) + { + if (j != y && i != x && !_useDiagonals) continue; + if (!WorldGen.InWorld(i, j)) continue; + if (!_tiles[i, j].active()) + { + return false; + } + } + } + return true; + } + } + } +} diff --git a/World/Planets/GrassPlanet.cs b/World/Planets/GrassPlanet.cs index 68291dd91f..01f8d7c3b9 100644 --- a/World/Planets/GrassPlanet.cs +++ b/World/Planets/GrassPlanet.cs @@ -1,281 +1,281 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using Microsoft.Xna.Framework; - -using CalamityMod.MiscImplementation; - -namespace CalamityMod.World.Planets -{ - /// - /// Comfy planet, the typical one you'd expect from planetoids. - /// Has the opposite ore from the world. Has a chance to spawn with things like a campsite on top ( for adventurous campers 0_0 ) - /// Has trees, flowers - /// - public class GrassPlanet : Planetoid - { - private ushort[] oreTypes = new ushort[] - { - (WorldGen.CopperTierOre == TileID.Copper ? TileID.Tin : TileID.Copper), - (WorldGen.IronTierOre == TileID.Iron ? TileID.Lead : TileID.Iron), - (WorldGen.SilverTierOre== TileID.Silver ? TileID.Tungsten : TileID.Silver), - (WorldGen.GoldTierOre == TileID.Gold ? TileID.Platinum : TileID.Gold) - }; - - public override bool Place(Point origin, StructureMap structures) - { - int radius = _random.Next(16, 24); - - if (!CheckIfPlaceable(origin, radius, structures)) - { - return false; - } - - PlacePlanet(origin, radius, _random.Next(oreTypes)); - - return base.Place(origin, structures); - } - - public void PlacePlanet(Point origin, int radius, ushort oreType) - { - Circle planetoid = new Circle(origin.ToVector2() * 16f + new Vector2(8f), radius * 16f); - - ShapeData crust = new ShapeData(); - ShapeData core = new ShapeData(); - - int outerRadius = (int)(radius * WorldGen.genRand.NextFloat(0.74f, 0.82f)); - - //Create shapes for each layer - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(origin, new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - blotchMod.Output(crust) - })); - WorldUtils.Gen(origin, new Shapes.Circle(outerRadius), Actions.Chain(new GenAction[] - { - blotchMod.Output(core) - })); - - //Subtract the inner shapes from outer ones - crust.Subtract(core, origin, origin); - - //Place layers - WorldUtils.Gen(origin, new ModShapes.All(core), Actions.Chain(new GenAction[] - { - new Actions.PlaceTile(TileID.Stone), - new Actions.PlaceWall(WallID.Cave2Unsafe) - })); - WorldUtils.Gen(origin, new ModShapes.All(crust), Actions.Chain(new GenAction[] - { - new Actions.PlaceTile(TileID.Dirt), - new Actions.PlaceWall(WallID.DirtUnsafe) - })); - - //Place random dirt/stone - int randDirt = (int)(radius * 0.4f); - int randStone = (int)(randDirt * 0.6f); - for (int i = 0; i < randStone; i++) - { - int x = origin.X; - int y = origin.Y; - while (Vector2.Distance(origin.ToVector2(), new Vector2(x, y)) < outerRadius) - { - x = _random.Next(origin.X - radius, origin.X + radius + 1); - y = _random.Next(origin.Y - radius, origin.Y + radius + 1); - } - WorldGen.TileRunner(x, y, _random.NextFloat(4.6f, 7.6f), _random.Next(7, 16), TileID.Stone); - } - for (int i = 0; i < randDirt; i++) - { - int x = _random.Next(origin.X - outerRadius, origin.X + outerRadius + 1); - int y = _random.Next(origin.Y - outerRadius, origin.Y + outerRadius + 1); - - WorldGen.TileRunner(x, y, _random.NextFloat(5f, 8f), _random.Next(8, 18), TileID.Dirt); - } - - //Bezier Curves for placing ore - int numStrokes = radius > 20 ? 3 : 2; - for (int i = 0; i < numStrokes; i++) - { - //GET POINTS FOR CURVE - Vector2 start = planetoid.RandomPointOnCircleEdge(); - //end is opposite side - Vector2 end = planetoid.Center - (start - planetoid.Center); - Vector2 control = planetoid.RandomPointOnCircleEdge(); - float min = radius * 0.6f * 16f; - while (Vector2.Distance(control, start) < min || Vector2.Distance(control, end) < min) - { - control = planetoid.RandomPointOnCircleEdge(); - } - - BezierCurve curve = new BezierCurve(start, control, end); - - int strokeSteps = 50; - double baseStrength = (double)_random.NextFloat(1.2f, 2.4f); - - List tilePoints = curve.GetPoints(strokeSteps); - for (int k = 0; k < strokeSteps; k++) - { - float progress = k / (float)strokeSteps * (float)Math.PI; - double strengthMultiplier = 1.0 + Math.Sin(progress) * baseStrength * 1.1f; - - Vector2 nextPoint = tilePoints[k]; - int x = (int)(nextPoint.X / 16f); - int y = (int)(nextPoint.Y / 16f); - - WorldGen.OreRunner(x, y, baseStrength * strengthMultiplier, 1, oreType); - } - } - - //Boffin's funtime 2 -- Small shrine - #region Boffin's funtime 2 - bool boffsFuntime2 = _random.Next(10) == 0; - if (boffsFuntime2) - { - int topLayer = origin.Y - radius - 4; - for (; topLayer < origin.Y; topLayer++) - { - for (int x = origin.X - radius; x < origin.X + radius; x++) - { - if (_tiles[x, topLayer].active() && Main.tileSolid[_tiles[x, topLayer].type]) - { - //We've found the highest tile - goto TopLayerFound; - } - } - } - TopLayerFound: - - ushort brickType = TileID.StoneSlab; - int shrineDepth = _random.Next(8, 13); - int startX = origin.X - 3; - int endX = origin.X + 3; - for (int y = topLayer; y <= topLayer + shrineDepth; y++) - { - for (int x = startX; x <= endX; x++) - { - _tiles[x, y].active(true); - _tiles[x, y].type = brickType; - if (y == topLayer) - { - _tiles[x, y].wall = WallID.None; - } - } - if ((y - topLayer + 1) % 2 == 0) - { - startX--; - endX++; - } - } - WorldGen.PlaceTile(origin.X, topLayer - 1, 187, true, false, -1, 17); - WorldGen.PlaceTile(origin.X - 3, topLayer - 1, 93, true, false, -1, 14); - WorldGen.PlaceTile(origin.X + 3, topLayer - 1, 93, true, false, -1, 14); - } - #endregion - - //Place grass - WorldUtils.Gen(origin, new ModShapes.InnerOutline(crust), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(new ushort[] { TileID.Dirt }), - new Modifiers.IsTouchingAir(true), - new Actions.SetTile(TileID.Grass, false, true), - new Actions.ClearWall(false), - new Actions.SetFrames(true), - new Modifiers.Conditions(new CustomConditions.RandomChance(4)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - //Clear dirt walls on outer edge because of stone / ore - WorldUtils.Gen(origin, new ModShapes.InnerOutline(crust), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(new ushort[] { TileID.Stone, oreType }), - new Modifiers.IsTouchingAir(true), - new Modifiers.OnlyWalls(WallID.DirtUnsafe), - new Actions.ClearWall(true) - })); - - //Boffin's funtime 1 -- Campsite if possible - #region Boffin's funtime 1 - if (!boffsFuntime2) - { - int campX = origin.X; - int campY = origin.Y - radius - 3; - while (!Main.tile[campX, campY].active() || !Main.tileSolid[_tiles[campX, campY].type]) - { - campY++; - } - campY--; - - int startCampX = campX; - while ((!_tiles[startCampX, campY].active() || !Main.tileSolid[_tiles[startCampX, campY].type]) && - _tiles[startCampX, campY + 1].active()) - { - startCampX--; - } - int endCampX = campX; - while ((!_tiles[endCampX, campY].active() || !Main.tileSolid[_tiles[endCampX, campY].type]) && - _tiles[endCampX, campY + 1].active()) - { - endCampX++; - } - //if enough room for tent and campfire - int distance = (int)MathHelper.Distance(++startCampX, --endCampX); - - if (distance >= 8) - { - int extra = distance - 8; - if (extra > 0) - { - extra = _random.Next(extra + 1); - } - - bool tentOnLeft = _random.NextBool(); - if (tentOnLeft) - { - WorldGen.Place3x2(startCampX + 1 + extra, campY, TileID.LargePiles2, 26); - WorldGen.Place3x2(startCampX + 5 + extra, campY, TileID.Campfire); - } - else - { - WorldGen.Place3x2(endCampX - 1 - extra, campY, TileID.LargePiles2, 26); - WorldGen.Place3x2(endCampX - 5 - extra, campY, TileID.Campfire); - } - } - } - #endregion - - //Place breakable grass and trees - WorldUtils.Gen(origin, new ModShapes.All(crust), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(new ushort[] { TileID.Grass }), - new Modifiers.Offset(0, -1), - new ActionGrass(), - new Modifiers.Conditions(new CustomConditions.RandomChance(2.5f)), - new Modifiers.Offset(0, 1), - new CustomActions.PlaceTree() - })); - - //Place vines - WorldUtils.Gen(origin, new ModShapes.All(crust), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(new ushort[] { TileID.Grass }), - new Modifiers.Conditions(new CustomConditions.RandomChance(2)), - new Modifiers.Offset(0, 1), - new CustomActions.RandomFrom(new GenAction[] - { - new ActionVines(3, 7, TileID.Vines), - new ActionVines(7, 12, TileID.VineFlowers) - }, - new float[] { 0.85f, 0.15f }) - })); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using Microsoft.Xna.Framework; + +using CalamityMod.MiscImplementation; + +namespace CalamityMod.World.Planets +{ + /// + /// Comfy planet, the typical one you'd expect from planetoids. + /// Has the opposite ore from the world. Has a chance to spawn with things like a campsite on top ( for adventurous campers 0_0 ) + /// Has trees, flowers + /// + public class GrassPlanet : Planetoid + { + private ushort[] oreTypes = new ushort[] + { + (WorldGen.CopperTierOre == TileID.Copper ? TileID.Tin : TileID.Copper), + (WorldGen.IronTierOre == TileID.Iron ? TileID.Lead : TileID.Iron), + (WorldGen.SilverTierOre== TileID.Silver ? TileID.Tungsten : TileID.Silver), + (WorldGen.GoldTierOre == TileID.Gold ? TileID.Platinum : TileID.Gold) + }; + + public override bool Place(Point origin, StructureMap structures) + { + int radius = _random.Next(16, 24); + + if (!CheckIfPlaceable(origin, radius, structures)) + { + return false; + } + + PlacePlanet(origin, radius, _random.Next(oreTypes)); + + return base.Place(origin, structures); + } + + public void PlacePlanet(Point origin, int radius, ushort oreType) + { + Circle planetoid = new Circle(origin.ToVector2() * 16f + new Vector2(8f), radius * 16f); + + ShapeData crust = new ShapeData(); + ShapeData core = new ShapeData(); + + int outerRadius = (int)(radius * WorldGen.genRand.NextFloat(0.74f, 0.82f)); + + //Create shapes for each layer + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(origin, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + blotchMod.Output(crust) + })); + WorldUtils.Gen(origin, new Shapes.Circle(outerRadius), Actions.Chain(new GenAction[] + { + blotchMod.Output(core) + })); + + //Subtract the inner shapes from outer ones + crust.Subtract(core, origin, origin); + + //Place layers + WorldUtils.Gen(origin, new ModShapes.All(core), Actions.Chain(new GenAction[] + { + new Actions.PlaceTile(TileID.Stone), + new Actions.PlaceWall(WallID.Cave2Unsafe) + })); + WorldUtils.Gen(origin, new ModShapes.All(crust), Actions.Chain(new GenAction[] + { + new Actions.PlaceTile(TileID.Dirt), + new Actions.PlaceWall(WallID.DirtUnsafe) + })); + + //Place random dirt/stone + int randDirt = (int)(radius * 0.4f); + int randStone = (int)(randDirt * 0.6f); + for (int i = 0; i < randStone; i++) + { + int x = origin.X; + int y = origin.Y; + while (Vector2.Distance(origin.ToVector2(), new Vector2(x, y)) < outerRadius) + { + x = _random.Next(origin.X - radius, origin.X + radius + 1); + y = _random.Next(origin.Y - radius, origin.Y + radius + 1); + } + WorldGen.TileRunner(x, y, _random.NextFloat(4.6f, 7.6f), _random.Next(7, 16), TileID.Stone); + } + for (int i = 0; i < randDirt; i++) + { + int x = _random.Next(origin.X - outerRadius, origin.X + outerRadius + 1); + int y = _random.Next(origin.Y - outerRadius, origin.Y + outerRadius + 1); + + WorldGen.TileRunner(x, y, _random.NextFloat(5f, 8f), _random.Next(8, 18), TileID.Dirt); + } + + //Bezier Curves for placing ore + int numStrokes = radius > 20 ? 3 : 2; + for (int i = 0; i < numStrokes; i++) + { + //GET POINTS FOR CURVE + Vector2 start = planetoid.RandomPointOnCircleEdge(); + //end is opposite side + Vector2 end = planetoid.Center - (start - planetoid.Center); + Vector2 control = planetoid.RandomPointOnCircleEdge(); + float min = radius * 0.6f * 16f; + while (Vector2.Distance(control, start) < min || Vector2.Distance(control, end) < min) + { + control = planetoid.RandomPointOnCircleEdge(); + } + + BezierCurve curve = new BezierCurve(start, control, end); + + int strokeSteps = 50; + double baseStrength = (double)_random.NextFloat(1.2f, 2.4f); + + List tilePoints = curve.GetPoints(strokeSteps); + for (int k = 0; k < strokeSteps; k++) + { + float progress = k / (float)strokeSteps * (float)Math.PI; + double strengthMultiplier = 1.0 + Math.Sin(progress) * baseStrength * 1.1f; + + Vector2 nextPoint = tilePoints[k]; + int x = (int)(nextPoint.X / 16f); + int y = (int)(nextPoint.Y / 16f); + + WorldGen.OreRunner(x, y, baseStrength * strengthMultiplier, 1, oreType); + } + } + + //Boffin's funtime 2 -- Small shrine + #region Boffin's funtime 2 + bool boffsFuntime2 = _random.Next(10) == 0; + if (boffsFuntime2) + { + int topLayer = origin.Y - radius - 4; + for (; topLayer < origin.Y; topLayer++) + { + for (int x = origin.X - radius; x < origin.X + radius; x++) + { + if (_tiles[x, topLayer].active() && Main.tileSolid[_tiles[x, topLayer].type]) + { + //We've found the highest tile + goto TopLayerFound; + } + } + } + TopLayerFound: + + ushort brickType = TileID.StoneSlab; + int shrineDepth = _random.Next(8, 13); + int startX = origin.X - 3; + int endX = origin.X + 3; + for (int y = topLayer; y <= topLayer + shrineDepth; y++) + { + for (int x = startX; x <= endX; x++) + { + _tiles[x, y].active(true); + _tiles[x, y].type = brickType; + if (y == topLayer) + { + _tiles[x, y].wall = WallID.None; + } + } + if ((y - topLayer + 1) % 2 == 0) + { + startX--; + endX++; + } + } + WorldGen.PlaceTile(origin.X, topLayer - 1, 187, true, false, -1, 17); + WorldGen.PlaceTile(origin.X - 3, topLayer - 1, 93, true, false, -1, 14); + WorldGen.PlaceTile(origin.X + 3, topLayer - 1, 93, true, false, -1, 14); + } + #endregion + + //Place grass + WorldUtils.Gen(origin, new ModShapes.InnerOutline(crust), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(new ushort[] { TileID.Dirt }), + new Modifiers.IsTouchingAir(true), + new Actions.SetTile(TileID.Grass, false, true), + new Actions.ClearWall(false), + new Actions.SetFrames(true), + new Modifiers.Conditions(new CustomConditions.RandomChance(4)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + //Clear dirt walls on outer edge because of stone / ore + WorldUtils.Gen(origin, new ModShapes.InnerOutline(crust), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(new ushort[] { TileID.Stone, oreType }), + new Modifiers.IsTouchingAir(true), + new Modifiers.OnlyWalls(WallID.DirtUnsafe), + new Actions.ClearWall(true) + })); + + //Boffin's funtime 1 -- Campsite if possible + #region Boffin's funtime 1 + if (!boffsFuntime2) + { + int campX = origin.X; + int campY = origin.Y - radius - 3; + while (!Main.tile[campX, campY].active() || !Main.tileSolid[_tiles[campX, campY].type]) + { + campY++; + } + campY--; + + int startCampX = campX; + while ((!_tiles[startCampX, campY].active() || !Main.tileSolid[_tiles[startCampX, campY].type]) && + _tiles[startCampX, campY + 1].active()) + { + startCampX--; + } + int endCampX = campX; + while ((!_tiles[endCampX, campY].active() || !Main.tileSolid[_tiles[endCampX, campY].type]) && + _tiles[endCampX, campY + 1].active()) + { + endCampX++; + } + //if enough room for tent and campfire + int distance = (int)MathHelper.Distance(++startCampX, --endCampX); + + if (distance >= 8) + { + int extra = distance - 8; + if (extra > 0) + { + extra = _random.Next(extra + 1); + } + + bool tentOnLeft = _random.NextBool(); + if (tentOnLeft) + { + WorldGen.Place3x2(startCampX + 1 + extra, campY, TileID.LargePiles2, 26); + WorldGen.Place3x2(startCampX + 5 + extra, campY, TileID.Campfire); + } + else + { + WorldGen.Place3x2(endCampX - 1 - extra, campY, TileID.LargePiles2, 26); + WorldGen.Place3x2(endCampX - 5 - extra, campY, TileID.Campfire); + } + } + } + #endregion + + //Place breakable grass and trees + WorldUtils.Gen(origin, new ModShapes.All(crust), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(new ushort[] { TileID.Grass }), + new Modifiers.Offset(0, -1), + new ActionGrass(), + new Modifiers.Conditions(new CustomConditions.RandomChance(2.5f)), + new Modifiers.Offset(0, 1), + new CustomActions.PlaceTree() + })); + + //Place vines + WorldUtils.Gen(origin, new ModShapes.All(crust), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(new ushort[] { TileID.Grass }), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Modifiers.Offset(0, 1), + new CustomActions.RandomFrom(new GenAction[] + { + new ActionVines(3, 7, TileID.Vines), + new ActionVines(7, 12, TileID.VineFlowers) + }, + new float[] { 0.85f, 0.15f }) + })); + } + } +} diff --git a/World/Planets/HeartPlanet.cs b/World/Planets/HeartPlanet.cs index 1bb0ef50fd..f28d12c2a8 100644 --- a/World/Planets/HeartPlanet.cs +++ b/World/Planets/HeartPlanet.cs @@ -1,92 +1,92 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Terraria.World.Generation; -using Terraria.ID; -using Terraria; - -namespace CalamityMod.World.Planets -{ - public class HeartPlanet : Planetoid - { - private ushort[] mossTypes = new ushort[] - { - TileID.BlueMoss, - TileID.GreenMoss, - TileID.PurpleMoss, - TileID.RedMoss - }; - - public override bool Place(Point origin, StructureMap structures) - { - int radius = _random.Next(6, 10); - - if (!CheckIfPlaceable(origin, radius, structures)) - { - return false; - } - - PlacePlanet(origin, radius); - - return base.Place(origin, structures); - } - - public void PlacePlanet(Point origin, int radius) - { - ShapeData mainArea = new ShapeData(); - - //Create main shape - WorldUtils.Gen(origin, new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - new Modifiers.Blotches(2, 0.3), - new Actions.ClearTile(true), - new Actions.PlaceWall(WallID.Cave3Unsafe), - new Actions.PlaceTile(TileID.Stone).Output(mainArea) - })); - - //Place gems - ushort gemType = _random.Next(new ushort[] { TileID.Amethyst, TileID.Emerald, TileID.Topaz, TileID.Ruby, TileID.Sapphire, TileID.Diamond }); - //Using Tile Runner as it has a wider spread - WorldGen.TileRunner(origin.X, origin.Y, _random.NextFloat(6f, 9f), _random.Next(8, 18), gemType); - - //Create Smoothness and moss - ushort mossType = _random.Next(mossTypes); - WorldUtils.Gen(origin, new ModShapes.OuterOutline(mainArea), Actions.Chain(new GenAction[] - { - new Actions.SetTile(mossType, true, false), - new Modifiers.Conditions(new CustomConditions.RandomChance(2)), - new Actions.Smooth(true), - new Actions.SetFrames(true) - })); - - //Place Heart Crystal in center - //## - //## - // X - //Place heart crystal at X, it'll appear at # - - ShapeData room = new ShapeData(); - - int width = _random.Next(3, 5) * 2; - int height = _random.Next(5, 8); - Point roomTopLeft = new Point(origin.X - width / 2, origin.Y - height / 2); - bool gold = _random.NextBool(); - ushort tile = gold ? TileID.GoldBrick : TileID.PlatinumBrick; - byte wall = gold ? WallID.GoldBrick : WallID.PlatinumBrick; - WorldUtils.Gen(roomTopLeft, new Shapes.Rectangle(width, height), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(true), - new Actions.PlaceWall(wall).Output(room) - })); - WorldUtils.Gen(roomTopLeft, new ModShapes.InnerOutline(room), Actions.Chain(new GenAction[] - { - new Actions.PlaceTile(tile) - })); - - //Add LC - WorldGen.AddLifeCrystal(origin.X, origin.Y + 2); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Terraria.World.Generation; +using Terraria.ID; +using Terraria; + +namespace CalamityMod.World.Planets +{ + public class HeartPlanet : Planetoid + { + private ushort[] mossTypes = new ushort[] + { + TileID.BlueMoss, + TileID.GreenMoss, + TileID.PurpleMoss, + TileID.RedMoss + }; + + public override bool Place(Point origin, StructureMap structures) + { + int radius = _random.Next(6, 10); + + if (!CheckIfPlaceable(origin, radius, structures)) + { + return false; + } + + PlacePlanet(origin, radius); + + return base.Place(origin, structures); + } + + public void PlacePlanet(Point origin, int radius) + { + ShapeData mainArea = new ShapeData(); + + //Create main shape + WorldUtils.Gen(origin, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.3), + new Actions.ClearTile(true), + new Actions.PlaceWall(WallID.Cave3Unsafe), + new Actions.PlaceTile(TileID.Stone).Output(mainArea) + })); + + //Place gems + ushort gemType = _random.Next(new ushort[] { TileID.Amethyst, TileID.Emerald, TileID.Topaz, TileID.Ruby, TileID.Sapphire, TileID.Diamond }); + //Using Tile Runner as it has a wider spread + WorldGen.TileRunner(origin.X, origin.Y, _random.NextFloat(6f, 9f), _random.Next(8, 18), gemType); + + //Create Smoothness and moss + ushort mossType = _random.Next(mossTypes); + WorldUtils.Gen(origin, new ModShapes.OuterOutline(mainArea), Actions.Chain(new GenAction[] + { + new Actions.SetTile(mossType, true, false), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Actions.Smooth(true), + new Actions.SetFrames(true) + })); + + //Place Heart Crystal in center + //## + //## + // X + //Place heart crystal at X, it'll appear at # + + ShapeData room = new ShapeData(); + + int width = _random.Next(3, 5) * 2; + int height = _random.Next(5, 8); + Point roomTopLeft = new Point(origin.X - width / 2, origin.Y - height / 2); + bool gold = _random.NextBool(); + ushort tile = gold ? TileID.GoldBrick : TileID.PlatinumBrick; + byte wall = gold ? WallID.GoldBrick : WallID.PlatinumBrick; + WorldUtils.Gen(roomTopLeft, new Shapes.Rectangle(width, height), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(true), + new Actions.PlaceWall(wall).Output(room) + })); + WorldUtils.Gen(roomTopLeft, new ModShapes.InnerOutline(room), Actions.Chain(new GenAction[] + { + new Actions.PlaceTile(tile) + })); + + //Add LC + WorldGen.AddLifeCrystal(origin.X, origin.Y + 2); + } + } +} diff --git a/World/Planets/MainPlanet.cs b/World/Planets/MainPlanet.cs index eecebef6dc..444f01e0c5 100644 --- a/World/Planets/MainPlanet.cs +++ b/World/Planets/MainPlanet.cs @@ -1,357 +1,357 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using Microsoft.Xna.Framework; - -using CalamityMod.MiscImplementation; - -namespace CalamityMod.World.Planets -{ - public class MainPlanet : Planetoid - { - public override bool Place(Point origin, StructureMap structures) - { - float scale = (float)Main.maxTilesX / 4200f; - int radius = (int)((float)_random.Next(30, 36) * scale); //50 to 65 - - if (!CheckIfPlaceable(origin, radius, structures)) - { - return false; - } - - PlacePlanet(origin, radius); - - return base.Place(origin, structures); - } - - public void PlacePlanet(Point origin, int radius) - { - Circle planetoid = new Circle(origin.ToVector2() * 16f + new Vector2(8f), radius * 16f); - - ushort LabTile = TileID.StoneSlab; - byte LabWall = WallID.StoneSlab; - bool labLeftSide = _random.NextBool(); - int corridorLength = (int)(radius * _random.NextFloat(0.7f, 0.8f)); - - //PLACE DIRT AND WALL - ShapeData mainShape = new ShapeData(); - WorldUtils.Gen(origin, new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - new Modifiers.Blotches(2, 0.6).Output(mainShape), - new Actions.SetTile(TileID.Dirt, true), - new Actions.PlaceWall(WallID.DirtUnsafe) - })); - - //PLACE STONE AND WALL - float outerRadiusPercentage = _random.NextFloat(0.75f, 0.85f); - Circle outerCore = new Circle(planetoid.Center, planetoid.Radius * outerRadiusPercentage); - ShapeData outerCoreShape = new ShapeData(); - WorldUtils.Gen(origin, new Shapes.Circle((int)(radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] - { - new Modifiers.Blotches(2, 0.45).Output(outerCoreShape), - new Actions.SetTile(TileID.Stone, true), - new Actions.ClearWall(), - new Actions.PlaceWall(WallID.CaveUnsafe) - })); - - //PLACE STONE THEN DIRT PATCHES - int numStone = _random.Next(30, 40); - while (numStone > 0) - { - Point p = outerCore.RandomPointOnCircleEdge().ToTileCoordinates(); - WorldGen.TileRunner(p.X, p.Y, _random.NextFloat(3f, 6f), _random.Next(5, 15), TileID.Stone); - numStone--; - } - int numDirt = _random.Next(80, 110); - while (numDirt > 0) - { - Point p = outerCore.RandomPointInCircle().ToTileCoordinates(); - WorldGen.TileRunner(p.X, p.Y, _random.NextFloat(3f, 6f), _random.Next(7, 17), TileID.Dirt); - numDirt--; - } - - //PLACE CAVES - int caveCount = _random.Next(8, 14); - while (caveCount > 0) - { - caveCount--; - - Point tileCoords = planetoid.RandomPointInCircle().ToTileCoordinates(); - - WorldGen.TileRunner(tileCoords.X, tileCoords.Y, _random.NextFloat(5f, 10f), _random.Next(64, 91), -1); - } - WorldGen.TileRunner(origin.X + (labLeftSide ? corridorLength : -corridorLength), origin.Y, _random.NextFloat(11f, 15f), _random.Next(3, 5), -1); - - mainShape.Subtract(outerCoreShape, origin, origin); - - //PLACE GRASS - Vector2 worldCenter = origin.ToWorldCoordinates(); - WorldUtils.Gen(origin, new ModShapes.OuterOutline(mainShape, true, true), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(new ushort[] { TileID.Dirt }), - new Modifiers.IsTouchingAir(true), - new Actions.SetTile(TileID.Grass, false, true), - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Actions.ClearWall(false), - new Actions.SetFrames(true), - new Modifiers.Conditions(new CustomConditions.RandomChance(4)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - - //PLACE WALL TO SURROUND CINDERPLATE - ShapeData buildingData = new ShapeData(); - int cinderRadius = (int)(radius * _random.NextFloat(0.15f, 0.17f)); - WorldUtils.Gen(origin, new Shapes.Circle(cinderRadius + 9), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(true).Output(buildingData), - new Actions.ClearWall(), - new Actions.PlaceWall(LabWall) - })); - - //PLACE CINDERPLATE - ShapeData cinderPlateBlob = new ShapeData(); - WorldUtils.Gen(origin, new Shapes.Circle(cinderRadius), Actions.Chain(new GenAction[] - { - new Actions.SetTile((ushort)CalamityMod.Instance.TileType("Cinderplate"), true).Output(cinderPlateBlob), - new Actions.ClearWall(), - new Actions.PlaceWall(WallID.LavaUnsafe2) - })); - - //PLACE LAVA IN CENTER - WorldUtils.Gen(origin, new Shapes.Circle((int)(cinderRadius * 0.4f)), Actions.Chain(new GenAction[] - { - new Modifiers.Blotches(2, 0.5), - new Actions.ClearTile(true), - new Actions.SetLiquid(1, 255), - new Actions.SetFrames(true) - })); - - outerCoreShape.Subtract(buildingData, origin, origin); - buildingData.Subtract(cinderPlateBlob, origin, origin); - - //PLACE TILES FOR BUILDING - ShapeData bottomTiles = new ShapeData(); - WorldUtils.Gen(origin, new ModShapes.InnerOutline(buildingData, true), Actions.Chain(new GenAction[] - { - new Actions.ClearWall(), - new Actions.PlaceTile(LabTile), - new CustomActions.DistanceFromOrigin(true, cinderRadius * 16 + 64).Output(bottomTiles) - })); - - int doPillarEveryXBlocks = 5; - ushort BeamType = TileID.WoodenBeam; - - //PLACE BEAMS BELOW CIRCLE - HashSet bottomMostTiles = bottomTiles.GetData(); - foreach(Point16 p in bottomMostTiles) - { - int tileX = origin.X + p.X; - int tileY = origin.Y + p.Y; - if (!_tiles[tileX, tileY + 1].active() && tileX % doPillarEveryXBlocks == 0) - { - PlaceBeams(BeamType, tileX, tileY + 1, worldCenter, radius, LabWall); - } - } - - //PLACE HORIZONTAL CORRIDORS - for (int x = origin.X - corridorLength; x <= origin.X + corridorLength; x++) - { - for (int y = origin.Y - 4; y <= origin.Y + 4; y++) - { - int distFromOriginX = Math.Abs(origin.X - x); - if (distFromOriginX <= cinderRadius + 1) continue; - - if (x == origin.X - corridorLength || x == origin.X + corridorLength) - { - _tiles[x, y].active(true); - _tiles[x, y].type = LabTile; - } - else if (y == origin.Y - 4 || y == origin.Y + 4) - { - bool bottom = y == origin.Y + 4; - if (distFromOriginX < cinderRadius + 9 && !_tiles[x, y].active()) - { - _tiles[x, y].active(false); - if (bottom) WorldGen.PlaceTile(x, y, TileID.Platforms, true); - } - else - { - _tiles[x, y].active(true); - _tiles[x, y].type = LabTile; - //IF NECESSARY TO PLACE SUPPORT BEAMS (EVERY X BLOCKS) - if (bottom && !_tiles[x, y + 1].active() && x % doPillarEveryXBlocks == 0) - { - PlaceBeams(BeamType, x, y + 1, worldCenter, radius, LabWall); - } - } - } - else - { - _tiles[x, y].active(false); - _tiles[x, y].wall = LabWall; - } - } - } - - //PLACE LAB ROOM - int doorX = labLeftSide ? origin.X - corridorLength + 14 : origin.X + corridorLength - 14; - for (int y3 = origin.Y - 3; y3 <= origin.Y; y3++) - { - Main.tile[doorX, y3].active(true); - Main.tile[doorX, y3].type = TileID.StoneSlab; - } - WorldGen.PlaceDoor(doorX, origin.Y + 2, TileID.ClosedDoor, 14); - int lanternX = labLeftSide ? doorX - 7 : doorX + 7; - int chest = -1; - if (labLeftSide) - { - //Lantern, alchemy table, heavy work bench - WorldGen.Place1x2Top(lanternX, origin.Y - 3, TileID.HangingLanterns, 14); - chest = WorldGen.PlaceChest(doorX - 12, origin.Y + 3); - WorldGen.Place3x3(doorX - 8, origin.Y + 3, TileID.HeavyWorkBench); - //switch - WorldGen.PlaceTile(doorX - 1, origin.Y, TileID.Switches, true); - //wire - for (int x = doorX - 1; x >= doorX - 7; x--) - { - Main.tile[x, origin.Y].wire(true); - if (x == doorX - 7) - { - for (int y = origin.Y - 2; y < origin.Y; y++) - { - Main.tile[x, y].wire(true); - } - } - } - } - else - { - //Lantern, alchemy table, heavy work bench - WorldGen.Place1x2Top(lanternX, origin.Y - 3, TileID.HangingLanterns, 14); - WorldGen.Place3x3(doorX + 8, origin.Y + 3, TileID.HeavyWorkBench); - chest = WorldGen.PlaceChest(doorX + 11, origin.Y + 3); - //switch - WorldGen.PlaceTile(doorX + 1, origin.Y, TileID.Switches, true); - //wire - for (int x = doorX + 1; x <= doorX + 7; x++) - { - Main.tile[x, origin.Y].wire(true); - if (x == doorX + 7) - { - for (int y = origin.Y - 2; y < origin.Y; y++) - { - Main.tile[x, y].wire(true); - } - } - } - } - //Fill new chest with herb bags and planter boxes - #region Chest shit - int index = 0; - Main.chest[chest].item[index].SetDefaults(ItemID.HerbBag); - Main.chest[chest].item[index++].stack = Main.rand.Next(12, 18); - - Main.chest[chest].item[index].SetDefaults(ItemID.BlinkrootPlanterBox); - Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); - - Main.chest[chest].item[index].SetDefaults(ItemID.CorruptPlanterBox); - Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); - - Main.chest[chest].item[index].SetDefaults(ItemID.CrimsonPlanterBox); - Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); - - Main.chest[chest].item[index].SetDefaults(ItemID.DayBloomPlanterBox); - Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); - - Main.chest[chest].item[index].SetDefaults(ItemID.FireBlossomPlanterBox); - Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); - - Main.chest[chest].item[index].SetDefaults(ItemID.MoonglowPlanterBox); - Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); - - Main.chest[chest].item[index].SetDefaults(ItemID.ShiverthornPlanterBox); - Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); - - Main.chest[chest].item[index].SetDefaults(ItemID.WaterleafPlanterBox); - Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); - #endregion - //Turn off the lantern - for (int y = origin.Y - 3; y <= origin.Y - 2; y++) - { - _tiles[lanternX, y].frameX = 18; - } - int leftPlats = labLeftSide ? doorX - 5 : doorX + 2; - int rightPlats = labLeftSide ? doorX - 2 : doorX + 5; - for (int x = leftPlats; x <= rightPlats; x++) - { - for (int y = origin.Y - 1; y <= origin.Y + 1; y += 2) - { - WorldGen.PlaceTile(x, y, TileID.Platforms); - if (_random.NextFloat(1f) <= 0.85f) - { - WorldGen.PlaceTile(x, y - 1, TileID.Bottles, true, false, -1, _random.Next(3)); - } - } - } - - //PLACE ENTRANCE DOOR - int entranceDoorX = labLeftSide ? origin.X + corridorLength : origin.X - corridorLength; - for (int i = origin.Y + 1; i <= origin.Y + 3; i++) - { - Main.tile[entranceDoorX, i].active(false); - } - WorldGen.PlaceDoor(entranceDoorX, origin.Y + 2, TileID.ClosedDoor, 14); - - //PLACE BREAKABLE GRASS AND TREES - WorldUtils.Gen(origin, new ModShapes.OuterOutline(mainShape, true, true), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(new ushort[] { TileID.Grass }), - new Modifiers.Offset(0, -1), - new ActionGrass(), - new Modifiers.Conditions(new CustomConditions.RandomChance(1.5f)), - new Modifiers.Offset(0, 1), - new CustomActions.PlaceTree() - })); - - //PLACE VINES - WorldUtils.Gen(origin, new ModShapes.OuterOutline(mainShape, true, true), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(new ushort[] { TileID.Grass }), - new Modifiers.Conditions(new CustomConditions.RandomChance(2)), - new Modifiers.Offset(0, 1), - new CustomActions.RandomFrom(new GenAction[] - { - new ActionVines(7, 12, TileID.Vines), - new ActionVines(11, 17, TileID.VineFlowers) - }, - new float[] { 0.85f, 0.15f }) - })); - } - - public void PlaceBeams(ushort beamType, int x, int startY, Vector2 planetCenter, int radius, params ushort[] ignoreWalls) - { - //lazy quick fix - List walls = ignoreWalls.ToList(); - while (!_tiles[x, startY].active() && !walls.Contains(_tiles[x, startY].wall)) - { - _tiles[x, startY].active(true); - _tiles[x, startY].type = beamType; - startY++; - if (Vector2.Distance(planetCenter, new Vector2(x * 16 + 8, startY * 16 + 8)) > radius * 16f - 64) - { - _tiles[x, startY].active(true); - _tiles[x, startY].type = TileID.Stone; - } - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using Microsoft.Xna.Framework; + +using CalamityMod.MiscImplementation; + +namespace CalamityMod.World.Planets +{ + public class MainPlanet : Planetoid + { + public override bool Place(Point origin, StructureMap structures) + { + float scale = (float)Main.maxTilesX / 4200f; + int radius = (int)((float)_random.Next(30, 36) * scale); //50 to 65 + + if (!CheckIfPlaceable(origin, radius, structures)) + { + return false; + } + + PlacePlanet(origin, radius); + + return base.Place(origin, structures); + } + + public void PlacePlanet(Point origin, int radius) + { + Circle planetoid = new Circle(origin.ToVector2() * 16f + new Vector2(8f), radius * 16f); + + ushort LabTile = TileID.StoneSlab; + byte LabWall = WallID.StoneSlab; + bool labLeftSide = _random.NextBool(); + int corridorLength = (int)(radius * _random.NextFloat(0.7f, 0.8f)); + + //PLACE DIRT AND WALL + ShapeData mainShape = new ShapeData(); + WorldUtils.Gen(origin, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.6).Output(mainShape), + new Actions.SetTile(TileID.Dirt, true), + new Actions.PlaceWall(WallID.DirtUnsafe) + })); + + //PLACE STONE AND WALL + float outerRadiusPercentage = _random.NextFloat(0.75f, 0.85f); + Circle outerCore = new Circle(planetoid.Center, planetoid.Radius * outerRadiusPercentage); + ShapeData outerCoreShape = new ShapeData(); + WorldUtils.Gen(origin, new Shapes.Circle((int)(radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.45).Output(outerCoreShape), + new Actions.SetTile(TileID.Stone, true), + new Actions.ClearWall(), + new Actions.PlaceWall(WallID.CaveUnsafe) + })); + + //PLACE STONE THEN DIRT PATCHES + int numStone = _random.Next(30, 40); + while (numStone > 0) + { + Point p = outerCore.RandomPointOnCircleEdge().ToTileCoordinates(); + WorldGen.TileRunner(p.X, p.Y, _random.NextFloat(3f, 6f), _random.Next(5, 15), TileID.Stone); + numStone--; + } + int numDirt = _random.Next(80, 110); + while (numDirt > 0) + { + Point p = outerCore.RandomPointInCircle().ToTileCoordinates(); + WorldGen.TileRunner(p.X, p.Y, _random.NextFloat(3f, 6f), _random.Next(7, 17), TileID.Dirt); + numDirt--; + } + + //PLACE CAVES + int caveCount = _random.Next(8, 14); + while (caveCount > 0) + { + caveCount--; + + Point tileCoords = planetoid.RandomPointInCircle().ToTileCoordinates(); + + WorldGen.TileRunner(tileCoords.X, tileCoords.Y, _random.NextFloat(5f, 10f), _random.Next(64, 91), -1); + } + WorldGen.TileRunner(origin.X + (labLeftSide ? corridorLength : -corridorLength), origin.Y, _random.NextFloat(11f, 15f), _random.Next(3, 5), -1); + + mainShape.Subtract(outerCoreShape, origin, origin); + + //PLACE GRASS + Vector2 worldCenter = origin.ToWorldCoordinates(); + WorldUtils.Gen(origin, new ModShapes.OuterOutline(mainShape, true, true), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(new ushort[] { TileID.Dirt }), + new Modifiers.IsTouchingAir(true), + new Actions.SetTile(TileID.Grass, false, true), + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Actions.ClearWall(false), + new Actions.SetFrames(true), + new Modifiers.Conditions(new CustomConditions.RandomChance(4)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + //PLACE WALL TO SURROUND CINDERPLATE + ShapeData buildingData = new ShapeData(); + int cinderRadius = (int)(radius * _random.NextFloat(0.15f, 0.17f)); + WorldUtils.Gen(origin, new Shapes.Circle(cinderRadius + 9), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(true).Output(buildingData), + new Actions.ClearWall(), + new Actions.PlaceWall(LabWall) + })); + + //PLACE CINDERPLATE + ShapeData cinderPlateBlob = new ShapeData(); + WorldUtils.Gen(origin, new Shapes.Circle(cinderRadius), Actions.Chain(new GenAction[] + { + new Actions.SetTile((ushort)CalamityMod.Instance.TileType("Cinderplate"), true).Output(cinderPlateBlob), + new Actions.ClearWall(), + new Actions.PlaceWall(WallID.LavaUnsafe2) + })); + + //PLACE LAVA IN CENTER + WorldUtils.Gen(origin, new Shapes.Circle((int)(cinderRadius * 0.4f)), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.5), + new Actions.ClearTile(true), + new Actions.SetLiquid(1, 255), + new Actions.SetFrames(true) + })); + + outerCoreShape.Subtract(buildingData, origin, origin); + buildingData.Subtract(cinderPlateBlob, origin, origin); + + //PLACE TILES FOR BUILDING + ShapeData bottomTiles = new ShapeData(); + WorldUtils.Gen(origin, new ModShapes.InnerOutline(buildingData, true), Actions.Chain(new GenAction[] + { + new Actions.ClearWall(), + new Actions.PlaceTile(LabTile), + new CustomActions.DistanceFromOrigin(true, cinderRadius * 16 + 64).Output(bottomTiles) + })); + + int doPillarEveryXBlocks = 5; + ushort BeamType = TileID.WoodenBeam; + + //PLACE BEAMS BELOW CIRCLE + HashSet bottomMostTiles = bottomTiles.GetData(); + foreach(Point16 p in bottomMostTiles) + { + int tileX = origin.X + p.X; + int tileY = origin.Y + p.Y; + if (!_tiles[tileX, tileY + 1].active() && tileX % doPillarEveryXBlocks == 0) + { + PlaceBeams(BeamType, tileX, tileY + 1, worldCenter, radius, LabWall); + } + } + + //PLACE HORIZONTAL CORRIDORS + for (int x = origin.X - corridorLength; x <= origin.X + corridorLength; x++) + { + for (int y = origin.Y - 4; y <= origin.Y + 4; y++) + { + int distFromOriginX = Math.Abs(origin.X - x); + if (distFromOriginX <= cinderRadius + 1) continue; + + if (x == origin.X - corridorLength || x == origin.X + corridorLength) + { + _tiles[x, y].active(true); + _tiles[x, y].type = LabTile; + } + else if (y == origin.Y - 4 || y == origin.Y + 4) + { + bool bottom = y == origin.Y + 4; + if (distFromOriginX < cinderRadius + 9 && !_tiles[x, y].active()) + { + _tiles[x, y].active(false); + if (bottom) WorldGen.PlaceTile(x, y, TileID.Platforms, true); + } + else + { + _tiles[x, y].active(true); + _tiles[x, y].type = LabTile; + //IF NECESSARY TO PLACE SUPPORT BEAMS (EVERY X BLOCKS) + if (bottom && !_tiles[x, y + 1].active() && x % doPillarEveryXBlocks == 0) + { + PlaceBeams(BeamType, x, y + 1, worldCenter, radius, LabWall); + } + } + } + else + { + _tiles[x, y].active(false); + _tiles[x, y].wall = LabWall; + } + } + } + + //PLACE LAB ROOM + int doorX = labLeftSide ? origin.X - corridorLength + 14 : origin.X + corridorLength - 14; + for (int y3 = origin.Y - 3; y3 <= origin.Y; y3++) + { + Main.tile[doorX, y3].active(true); + Main.tile[doorX, y3].type = TileID.StoneSlab; + } + WorldGen.PlaceDoor(doorX, origin.Y + 2, TileID.ClosedDoor, 14); + int lanternX = labLeftSide ? doorX - 7 : doorX + 7; + int chest = -1; + if (labLeftSide) + { + //Lantern, alchemy table, heavy work bench + WorldGen.Place1x2Top(lanternX, origin.Y - 3, TileID.HangingLanterns, 14); + chest = WorldGen.PlaceChest(doorX - 12, origin.Y + 3); + WorldGen.Place3x3(doorX - 8, origin.Y + 3, TileID.HeavyWorkBench); + //switch + WorldGen.PlaceTile(doorX - 1, origin.Y, TileID.Switches, true); + //wire + for (int x = doorX - 1; x >= doorX - 7; x--) + { + Main.tile[x, origin.Y].wire(true); + if (x == doorX - 7) + { + for (int y = origin.Y - 2; y < origin.Y; y++) + { + Main.tile[x, y].wire(true); + } + } + } + } + else + { + //Lantern, alchemy table, heavy work bench + WorldGen.Place1x2Top(lanternX, origin.Y - 3, TileID.HangingLanterns, 14); + WorldGen.Place3x3(doorX + 8, origin.Y + 3, TileID.HeavyWorkBench); + chest = WorldGen.PlaceChest(doorX + 11, origin.Y + 3); + //switch + WorldGen.PlaceTile(doorX + 1, origin.Y, TileID.Switches, true); + //wire + for (int x = doorX + 1; x <= doorX + 7; x++) + { + Main.tile[x, origin.Y].wire(true); + if (x == doorX + 7) + { + for (int y = origin.Y - 2; y < origin.Y; y++) + { + Main.tile[x, y].wire(true); + } + } + } + } + //Fill new chest with herb bags and planter boxes + #region Chest shit + int index = 0; + Main.chest[chest].item[index].SetDefaults(ItemID.HerbBag); + Main.chest[chest].item[index++].stack = Main.rand.Next(12, 18); + + Main.chest[chest].item[index].SetDefaults(ItemID.BlinkrootPlanterBox); + Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); + + Main.chest[chest].item[index].SetDefaults(ItemID.CorruptPlanterBox); + Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); + + Main.chest[chest].item[index].SetDefaults(ItemID.CrimsonPlanterBox); + Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); + + Main.chest[chest].item[index].SetDefaults(ItemID.DayBloomPlanterBox); + Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); + + Main.chest[chest].item[index].SetDefaults(ItemID.FireBlossomPlanterBox); + Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); + + Main.chest[chest].item[index].SetDefaults(ItemID.MoonglowPlanterBox); + Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); + + Main.chest[chest].item[index].SetDefaults(ItemID.ShiverthornPlanterBox); + Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); + + Main.chest[chest].item[index].SetDefaults(ItemID.WaterleafPlanterBox); + Main.chest[chest].item[index++].stack = Main.rand.Next(5, 10); + #endregion + //Turn off the lantern + for (int y = origin.Y - 3; y <= origin.Y - 2; y++) + { + _tiles[lanternX, y].frameX = 18; + } + int leftPlats = labLeftSide ? doorX - 5 : doorX + 2; + int rightPlats = labLeftSide ? doorX - 2 : doorX + 5; + for (int x = leftPlats; x <= rightPlats; x++) + { + for (int y = origin.Y - 1; y <= origin.Y + 1; y += 2) + { + WorldGen.PlaceTile(x, y, TileID.Platforms); + if (_random.NextFloat(1f) <= 0.85f) + { + WorldGen.PlaceTile(x, y - 1, TileID.Bottles, true, false, -1, _random.Next(3)); + } + } + } + + //PLACE ENTRANCE DOOR + int entranceDoorX = labLeftSide ? origin.X + corridorLength : origin.X - corridorLength; + for (int i = origin.Y + 1; i <= origin.Y + 3; i++) + { + Main.tile[entranceDoorX, i].active(false); + } + WorldGen.PlaceDoor(entranceDoorX, origin.Y + 2, TileID.ClosedDoor, 14); + + //PLACE BREAKABLE GRASS AND TREES + WorldUtils.Gen(origin, new ModShapes.OuterOutline(mainShape, true, true), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(new ushort[] { TileID.Grass }), + new Modifiers.Offset(0, -1), + new ActionGrass(), + new Modifiers.Conditions(new CustomConditions.RandomChance(1.5f)), + new Modifiers.Offset(0, 1), + new CustomActions.PlaceTree() + })); + + //PLACE VINES + WorldUtils.Gen(origin, new ModShapes.OuterOutline(mainShape, true, true), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(new ushort[] { TileID.Grass }), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Modifiers.Offset(0, 1), + new CustomActions.RandomFrom(new GenAction[] + { + new ActionVines(7, 12, TileID.Vines), + new ActionVines(11, 17, TileID.VineFlowers) + }, + new float[] { 0.85f, 0.15f }) + })); + } + + public void PlaceBeams(ushort beamType, int x, int startY, Vector2 planetCenter, int radius, params ushort[] ignoreWalls) + { + //lazy quick fix + List walls = ignoreWalls.ToList(); + while (!_tiles[x, startY].active() && !walls.Contains(_tiles[x, startY].wall)) + { + _tiles[x, startY].active(true); + _tiles[x, startY].type = beamType; + startY++; + if (Vector2.Distance(planetCenter, new Vector2(x * 16 + 8, startY * 16 + 8)) > radius * 16f - 64) + { + _tiles[x, startY].active(true); + _tiles[x, startY].type = TileID.Stone; + } + } + } + } +} diff --git a/World/Planets/MudPlanet.cs b/World/Planets/MudPlanet.cs index 669c13f657..c5a28d5065 100644 --- a/World/Planets/MudPlanet.cs +++ b/World/Planets/MudPlanet.cs @@ -1,281 +1,281 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using Microsoft.Xna.Framework; - -using CalamityMod.MiscImplementation; - -namespace CalamityMod.World.Planets -{ - public class MudPlanet : Planetoid - { - public override bool Place(Point origin, StructureMap structures) - { - int radius = _random.Next(12, 19); - - if (!CheckIfPlaceable(origin, radius, structures)) - { - return false; - } - - PlacePlanet(origin, radius); - - return base.Place(origin, structures); - } - - public void PlacePlanet(Point origin, int radius) - { - ShapeData shape = new ShapeData(); - - //Create shapes for each layer - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(origin, new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - blotchMod.Output(shape) - })); - - //Place layers - WorldUtils.Gen(origin, new ModShapes.All(shape), Actions.Chain(new GenAction[] - { - new Actions.PlaceTile(TileID.Mud), - new Actions.PlaceWall(WallID.MudUnsafe) - })); - - //Place stone - int numStone = _random.Next(3, 9); - for (int i = 0; i < numStone; i++) - { - int x = _random.Next(origin.X - radius + 3, origin.X + radius - 2); - int y = _random.Next(origin.Y - radius + 3, origin.Y + radius - 2); - WorldGen.TileRunner(x, y, (double)_random.NextFloat(5f, 9f), _random.Next(5, 15), TileID.Stone); - } - - //Place grass, remove wall and occasionally smooth - WorldUtils.Gen(origin, new ModShapes.InnerOutline(shape), Actions.Chain(new GenAction[] - { - new Actions.ClearWall(true), - new Modifiers.OnlyTiles(new ushort[] { TileID.Mud }), - new Modifiers.IsTouchingAir(true), - new Actions.SetTile(TileID.JungleGrass, false, true), - new Modifiers.Conditions(new CustomConditions.RandomChance(3)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - - if (_random.NextBool()) - { - //Make a beehive in the planet. - //To do this, we need to create a shape, outline it with hive blocks (we'll need to do this twice to create a nice shape) - ShapeData hive = new ShapeData(); - int blobs = _random.Next(3, 6); - float smallerRadius = radius * 0.55f; - int minSize = (int)(radius * 0.4f); - int maxSize = (int)(radius * 0.6f); - for (int k = 0; k < blobs; k++) - { - int moveX = _random.Next(-(int)smallerRadius, (int)smallerRadius); - int moveY = _random.Next(-(int)smallerRadius, (int)smallerRadius); - WorldUtils.Gen(origin, - new Shapes.Circle(_random.Next(minSize, maxSize), _random.Next(minSize, maxSize)), - Actions.Chain(new GenAction[] - { - new Modifiers.Offset(moveX, moveY), - new Modifiers.Blotches(2, 0.12), - new Actions.ClearTile(true).Output(hive), - new Actions.PlaceWall(WallID.HiveUnsafe) - }) - ); - } - ShapeData hiveOutline = new ShapeData(); - WorldUtils.Gen(origin, new ModShapes.InnerOutline(hive, true), Actions.Chain(new GenAction[] - { - new Actions.PlaceTile(TileID.Hive), - new Actions.ClearWall().Output(hiveOutline), - new Modifiers.Conditions(new CustomConditions.IsNotTouchingAir(false)), - new Actions.PlaceWall(WallID.MudUnsafe) - })); - hive.Subtract(hiveOutline, origin, origin); - WorldUtils.Gen(origin, new ModShapes.InnerOutline(hive, true), new Actions.PlaceTile(TileID.Hive).Output(hiveOutline)); - hive.Subtract(hiveOutline, origin, origin); - WorldUtils.Gen(origin, new ModShapes.All(hive), Actions.Chain(new GenAction[] - { - new Modifiers.Conditions(new CustomConditions.RandomChance(7)), - new Actions.SetLiquid(2, 255) - })); - bool placedSpawner = false; - while(!placedSpawner) - { - int testX = origin.X + _random.Next(-(int)radius, (int)radius); - int testY = origin.Y + _random.Next(-(int)radius, (int)radius); - if (WorldGen.EmptyTileCheck(testX - 1, testX + 1, testY - 1, testY + 1) && _tiles[testX, testY].wall == WallID.HiveUnsafe) - { - for (int floorX = testX - 1; floorX <= testX + 1; floorX++) - { - _tiles[floorX, testY + 2].active(true); - _tiles[floorX, testY + 2].type = TileID.Hive; - WorldGen.SquareTileFrame(floorX, testY + 2); - } - bool placed = WorldGen.PlaceTile(testX, testY + 1, TileID.Larva, true, false); - if (placed) placedSpawner = true; - } - } - } - else if (_random.Next(4) <= 2) - { - //Create a small "cavern" inside of the planet. Filled with water and has a water chest (CUSTOM LOOT?) - ShapeData cavernData = new ShapeData(); - float waterChance = _random.NextFloat(2.2f, 3.5f); - WorldUtils.Gen(origin, new Shapes.Circle((int)(radius * _random.NextFloat(0.35f, 0.5f))), Actions.Chain(new GenAction[] - { - new Modifiers.Blotches(), - new Actions.ClearTile().Output(cavernData), - new Modifiers.Conditions(new CustomConditions.RandomChance(waterChance)), - new Actions.SetLiquid(0, 255) - })); - shape.Subtract(cavernData, origin, origin); - int chestY = origin.Y; - while(!_tiles[origin.X, chestY].active()) - { - chestY++; - } - for (int x = origin.X; x <= origin.X + 1; x++) - { - for (int y = chestY - 2; y <= chestY - 1; y++) - { - WorldGen.KillTile(x, y); - } - } - //PLACE TILES BENEATH CHEST, IN CASE - _tiles[origin.X, chestY].active(true); - _tiles[origin.X, chestY].type = TileID.Mud; - _tiles[origin.X + 1, chestY].active(true); - _tiles[origin.X + 1, chestY].type = TileID.Mud; - //Place chest - int chestID = WorldGen.PlaceChest(origin.X, chestY - 1, 21, false, 17); - FillChest(chestID); - } - else - { - //Glowing mushroom planetoid - WorldUtils.Gen(origin, new ModShapes.All(shape), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(new ushort[] { TileID.JungleGrass }), - new Actions.SetTile(TileID.MushroomGrass, true, true) - })); - } - - //Place breakable grass and trees - WorldUtils.Gen(origin, new ModShapes.All(shape), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(new ushort[] { TileID.JungleGrass, TileID.MushroomGrass }), - new Modifiers.Offset(0, -1), - new CustomActions.JungleGrass(true), - new Modifiers.Conditions(new CustomConditions.RandomChance(3.5f)), - new Modifiers.Offset(0, 1), - new CustomActions.PlaceTree() - })); - - //Place vines - WorldUtils.Gen(origin, new ModShapes.All(shape), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(new ushort[] { TileID.JungleGrass }), - new Modifiers.Conditions(new CustomConditions.RandomChance(2)), - new Modifiers.Offset(0, 1), - new ActionVines(3, 7, TileID.JungleVines) - })); - } - - //--------------------- - //WATER CHEST STUFF - //--------------------- - - private int[] FocusLoot = new int[] - { - ItemID.Flipper, - ItemID.DivingHelmet, - ItemID.Trident - }; - - private int[] PotionLoot = new int[] - { - ItemID.FlipperPotion, - ItemID.RegenerationPotion, - ItemID.WaterWalkingPotion, - ItemID.NightOwlPotion, - ItemID.GravitationPotion, - ItemID.EndurancePotion - }; - - private int[] BarLoot = new int[] - { - WorldGen.SilverTierOre == TileID.Silver ? ItemID.SilverBar : ItemID.TungstenBar, - WorldGen.GoldTierOre == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar - }; - - private void FillChest(int id) - { - Chest chest = Main.chest[id]; - int index = 0; - - //Focus loot - chest.item[index++].SetDefaults(_random.Next(FocusLoot)); - - //Bars - if (_random.Next(3) <= 1) - { - chest.item[index].SetDefaults(_random.Next(BarLoot)); - chest.item[index].SetDefaults(_random.Next(7, 15)); - } - else - { - chest.item[index].SetDefaults(ItemID.GoldCoin); - chest.item[index++].stack = _random.Next(2, 4); //2 or 3 gold coins - } - - //Potion loot - if (_random.Next(2) == 0) - { - chest.item[index].SetDefaults(_random.Next(PotionLoot)); - chest.item[index++].stack = _random.Next(1, 4); - } - else //Healing potion - { - chest.item[index].SetDefaults(ItemID.HealingPotion); - chest.item[index++].stack = _random.Next(3, 7); - } - - //Weaponry - if (_random.Next(2) == 0) - { - chest.item[index].SetDefaults(_random.Next(new int[] { ItemID.Shuriken, ItemID.ThrowingKnife })); - chest.item[index++].stack = _random.Next(50, 100); - } - else - { - chest.item[index].SetDefaults(_random.Next(new int[] { ItemID.Grenade, ItemID.Bomb })); - chest.item[index++].stack = _random.Next(5, 10); - } - - //Recall potion - if (_random.Next(2) == 0) - { - chest.item[index].SetDefaults(ItemID.RecallPotion); - chest.item[index++].stack = _random.Next(1, 4); - } - else //glowsticks - { - chest.item[index].SetDefaults(ItemID.Glowstick); - chest.item[index++].stack = _random.Next(18, 36); - } - - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using Microsoft.Xna.Framework; + +using CalamityMod.MiscImplementation; + +namespace CalamityMod.World.Planets +{ + public class MudPlanet : Planetoid + { + public override bool Place(Point origin, StructureMap structures) + { + int radius = _random.Next(12, 19); + + if (!CheckIfPlaceable(origin, radius, structures)) + { + return false; + } + + PlacePlanet(origin, radius); + + return base.Place(origin, structures); + } + + public void PlacePlanet(Point origin, int radius) + { + ShapeData shape = new ShapeData(); + + //Create shapes for each layer + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(origin, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + blotchMod.Output(shape) + })); + + //Place layers + WorldUtils.Gen(origin, new ModShapes.All(shape), Actions.Chain(new GenAction[] + { + new Actions.PlaceTile(TileID.Mud), + new Actions.PlaceWall(WallID.MudUnsafe) + })); + + //Place stone + int numStone = _random.Next(3, 9); + for (int i = 0; i < numStone; i++) + { + int x = _random.Next(origin.X - radius + 3, origin.X + radius - 2); + int y = _random.Next(origin.Y - radius + 3, origin.Y + radius - 2); + WorldGen.TileRunner(x, y, (double)_random.NextFloat(5f, 9f), _random.Next(5, 15), TileID.Stone); + } + + //Place grass, remove wall and occasionally smooth + WorldUtils.Gen(origin, new ModShapes.InnerOutline(shape), Actions.Chain(new GenAction[] + { + new Actions.ClearWall(true), + new Modifiers.OnlyTiles(new ushort[] { TileID.Mud }), + new Modifiers.IsTouchingAir(true), + new Actions.SetTile(TileID.JungleGrass, false, true), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + if (_random.NextBool()) + { + //Make a beehive in the planet. + //To do this, we need to create a shape, outline it with hive blocks (we'll need to do this twice to create a nice shape) + ShapeData hive = new ShapeData(); + int blobs = _random.Next(3, 6); + float smallerRadius = radius * 0.55f; + int minSize = (int)(radius * 0.4f); + int maxSize = (int)(radius * 0.6f); + for (int k = 0; k < blobs; k++) + { + int moveX = _random.Next(-(int)smallerRadius, (int)smallerRadius); + int moveY = _random.Next(-(int)smallerRadius, (int)smallerRadius); + WorldUtils.Gen(origin, + new Shapes.Circle(_random.Next(minSize, maxSize), _random.Next(minSize, maxSize)), + Actions.Chain(new GenAction[] + { + new Modifiers.Offset(moveX, moveY), + new Modifiers.Blotches(2, 0.12), + new Actions.ClearTile(true).Output(hive), + new Actions.PlaceWall(WallID.HiveUnsafe) + }) + ); + } + ShapeData hiveOutline = new ShapeData(); + WorldUtils.Gen(origin, new ModShapes.InnerOutline(hive, true), Actions.Chain(new GenAction[] + { + new Actions.PlaceTile(TileID.Hive), + new Actions.ClearWall().Output(hiveOutline), + new Modifiers.Conditions(new CustomConditions.IsNotTouchingAir(false)), + new Actions.PlaceWall(WallID.MudUnsafe) + })); + hive.Subtract(hiveOutline, origin, origin); + WorldUtils.Gen(origin, new ModShapes.InnerOutline(hive, true), new Actions.PlaceTile(TileID.Hive).Output(hiveOutline)); + hive.Subtract(hiveOutline, origin, origin); + WorldUtils.Gen(origin, new ModShapes.All(hive), Actions.Chain(new GenAction[] + { + new Modifiers.Conditions(new CustomConditions.RandomChance(7)), + new Actions.SetLiquid(2, 255) + })); + bool placedSpawner = false; + while(!placedSpawner) + { + int testX = origin.X + _random.Next(-(int)radius, (int)radius); + int testY = origin.Y + _random.Next(-(int)radius, (int)radius); + if (WorldGen.EmptyTileCheck(testX - 1, testX + 1, testY - 1, testY + 1) && _tiles[testX, testY].wall == WallID.HiveUnsafe) + { + for (int floorX = testX - 1; floorX <= testX + 1; floorX++) + { + _tiles[floorX, testY + 2].active(true); + _tiles[floorX, testY + 2].type = TileID.Hive; + WorldGen.SquareTileFrame(floorX, testY + 2); + } + bool placed = WorldGen.PlaceTile(testX, testY + 1, TileID.Larva, true, false); + if (placed) placedSpawner = true; + } + } + } + else if (_random.Next(4) <= 2) + { + //Create a small "cavern" inside of the planet. Filled with water and has a water chest (CUSTOM LOOT?) + ShapeData cavernData = new ShapeData(); + float waterChance = _random.NextFloat(2.2f, 3.5f); + WorldUtils.Gen(origin, new Shapes.Circle((int)(radius * _random.NextFloat(0.35f, 0.5f))), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(), + new Actions.ClearTile().Output(cavernData), + new Modifiers.Conditions(new CustomConditions.RandomChance(waterChance)), + new Actions.SetLiquid(0, 255) + })); + shape.Subtract(cavernData, origin, origin); + int chestY = origin.Y; + while(!_tiles[origin.X, chestY].active()) + { + chestY++; + } + for (int x = origin.X; x <= origin.X + 1; x++) + { + for (int y = chestY - 2; y <= chestY - 1; y++) + { + WorldGen.KillTile(x, y); + } + } + //PLACE TILES BENEATH CHEST, IN CASE + _tiles[origin.X, chestY].active(true); + _tiles[origin.X, chestY].type = TileID.Mud; + _tiles[origin.X + 1, chestY].active(true); + _tiles[origin.X + 1, chestY].type = TileID.Mud; + //Place chest + int chestID = WorldGen.PlaceChest(origin.X, chestY - 1, 21, false, 17); + FillChest(chestID); + } + else + { + //Glowing mushroom planetoid + WorldUtils.Gen(origin, new ModShapes.All(shape), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(new ushort[] { TileID.JungleGrass }), + new Actions.SetTile(TileID.MushroomGrass, true, true) + })); + } + + //Place breakable grass and trees + WorldUtils.Gen(origin, new ModShapes.All(shape), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(new ushort[] { TileID.JungleGrass, TileID.MushroomGrass }), + new Modifiers.Offset(0, -1), + new CustomActions.JungleGrass(true), + new Modifiers.Conditions(new CustomConditions.RandomChance(3.5f)), + new Modifiers.Offset(0, 1), + new CustomActions.PlaceTree() + })); + + //Place vines + WorldUtils.Gen(origin, new ModShapes.All(shape), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(new ushort[] { TileID.JungleGrass }), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Modifiers.Offset(0, 1), + new ActionVines(3, 7, TileID.JungleVines) + })); + } + + //--------------------- + //WATER CHEST STUFF + //--------------------- + + private int[] FocusLoot = new int[] + { + ItemID.Flipper, + ItemID.DivingHelmet, + ItemID.Trident + }; + + private int[] PotionLoot = new int[] + { + ItemID.FlipperPotion, + ItemID.RegenerationPotion, + ItemID.WaterWalkingPotion, + ItemID.NightOwlPotion, + ItemID.GravitationPotion, + ItemID.EndurancePotion + }; + + private int[] BarLoot = new int[] + { + WorldGen.SilverTierOre == TileID.Silver ? ItemID.SilverBar : ItemID.TungstenBar, + WorldGen.GoldTierOre == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar + }; + + private void FillChest(int id) + { + Chest chest = Main.chest[id]; + int index = 0; + + //Focus loot + chest.item[index++].SetDefaults(_random.Next(FocusLoot)); + + //Bars + if (_random.Next(3) <= 1) + { + chest.item[index].SetDefaults(_random.Next(BarLoot)); + chest.item[index].SetDefaults(_random.Next(7, 15)); + } + else + { + chest.item[index].SetDefaults(ItemID.GoldCoin); + chest.item[index++].stack = _random.Next(2, 4); //2 or 3 gold coins + } + + //Potion loot + if (_random.Next(2) == 0) + { + chest.item[index].SetDefaults(_random.Next(PotionLoot)); + chest.item[index++].stack = _random.Next(1, 4); + } + else //Healing potion + { + chest.item[index].SetDefaults(ItemID.HealingPotion); + chest.item[index++].stack = _random.Next(3, 7); + } + + //Weaponry + if (_random.Next(2) == 0) + { + chest.item[index].SetDefaults(_random.Next(new int[] { ItemID.Shuriken, ItemID.ThrowingKnife })); + chest.item[index++].stack = _random.Next(50, 100); + } + else + { + chest.item[index].SetDefaults(_random.Next(new int[] { ItemID.Grenade, ItemID.Bomb })); + chest.item[index++].stack = _random.Next(5, 10); + } + + //Recall potion + if (_random.Next(2) == 0) + { + chest.item[index].SetDefaults(ItemID.RecallPotion); + chest.item[index++].stack = _random.Next(1, 4); + } + else //glowsticks + { + chest.item[index].SetDefaults(ItemID.Glowstick); + chest.item[index++].stack = _random.Next(18, 36); + } + + } + } +} diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index b81c32ed41..f980e6bd9c 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.World.Generation; -using Terraria.GameContent.Generation; -using Microsoft.Xna.Framework; - -namespace CalamityMod.World.Planets -{ - public class Planetoid : MicroBiome - { - private Rectangle _area; - - public bool CheckIfPlaceable(Point origin, int radius, StructureMap structures) - { - //Fluff is used to create padding between the planets. this is the minimum distance between planets (they can't be within "fluff" blocks) - int fluff = 10; - int myRadius = radius + fluff; - int diameter = myRadius * 2; - _area = new Rectangle(origin.X - myRadius, origin.Y - myRadius, diameter, diameter); - - Mod varia = ModLoader.GetMod("Varia"); - for (int i = _area.Left; i < _area.Right; i++) - { - for (int j = _area.Top; j < _area.Bottom; j++) - { - if (Main.tile[i, j].type == TileID.Cloud || Main.tile[i, j].type == TileID.RainCloud || Main.tile[i, j].type == TileID.Sunplate) - { - return false; - } - if (varia != null) - { - if (Main.tile[i, j].type == varia.TileType("StarplateBrick") || Main.tile[i, j].type == varia.TileType("ForgottenCloud")) - { - return false; - } - } - } - } - - if (!structures.CanPlace(_area)) - { - return false; - } - - Dictionary dict = new Dictionary(); - CustomActions.SolidScanner scanner = new CustomActions.SolidScanner(); - WorldUtils.Gen(_area.Location, new Shapes.Rectangle(_area.Width, _area.Height), scanner); - if (scanner.GetCount() > 2) - { - return false; - } - return true; - } - - public override bool Place(Point origin, StructureMap structures) - { - structures.AddStructure(_area); - - //Optional, add the planetoid's center to a list, do something else etc. - //Just have this option available - - return true; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using Microsoft.Xna.Framework; + +namespace CalamityMod.World.Planets +{ + public class Planetoid : MicroBiome + { + private Rectangle _area; + + public bool CheckIfPlaceable(Point origin, int radius, StructureMap structures) + { + //Fluff is used to create padding between the planets. this is the minimum distance between planets (they can't be within "fluff" blocks) + int fluff = 10; + int myRadius = radius + fluff; + int diameter = myRadius * 2; + _area = new Rectangle(origin.X - myRadius, origin.Y - myRadius, diameter, diameter); + + Mod varia = ModLoader.GetMod("Varia"); + for (int i = _area.Left; i < _area.Right; i++) + { + for (int j = _area.Top; j < _area.Bottom; j++) + { + if (Main.tile[i, j].type == TileID.Cloud || Main.tile[i, j].type == TileID.RainCloud || Main.tile[i, j].type == TileID.Sunplate) + { + return false; + } + if (varia != null) + { + if (Main.tile[i, j].type == varia.TileType("StarplateBrick") || Main.tile[i, j].type == varia.TileType("ForgottenCloud")) + { + return false; + } + } + } + } + + if (!structures.CanPlace(_area)) + { + return false; + } + + Dictionary dict = new Dictionary(); + CustomActions.SolidScanner scanner = new CustomActions.SolidScanner(); + WorldUtils.Gen(_area.Location, new Shapes.Rectangle(_area.Width, _area.Height), scanner); + if (scanner.GetCount() > 2) + { + return false; + } + return true; + } + + public override bool Place(Point origin, StructureMap structures) + { + structures.AddStructure(_area); + + //Optional, add the planetoid's center to a list, do something else etc. + //Just have this option available + + return true; + } + } +} diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 5c0e4f3a81..f69edd5ff2 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -1,610 +1,610 @@ -using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -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; - -namespace CalamityMod.World -{ - public class SunkenSea : ModWorld - { - private struct Hub - { - public Vector2 Position; - - public Hub(Vector2 position) - { - this.Position = position; - } - - public Hub(float x, float y) - { - this.Position = new Vector2(x, y); - } - } - - private class Cluster : List - { - } - - private class ClusterGroup : List - { - public int Width; - - public int Height; - - private void SearchForCluster(bool[,] hubMap, List pointCluster, int x, int y, int level = 2) - { - pointCluster.Add(new Point(x, y)); - hubMap[x, y] = false; - level--; - if (level == -1) - { - return; - } - if (x > 0 && hubMap[x - 1, y]) - { - this.SearchForCluster(hubMap, pointCluster, x - 1, y, level); - } - if (x < hubMap.GetLength(0) - 1 && hubMap[x + 1, y]) - { - this.SearchForCluster(hubMap, pointCluster, x + 1, y, level); - } - if (y > 0 && hubMap[x, y - 1]) - { - this.SearchForCluster(hubMap, pointCluster, x, y - 1, level); - } - if (y < hubMap.GetLength(1) - 1 && hubMap[x, y + 1]) - { - this.SearchForCluster(hubMap, pointCluster, x, y + 1, level); - } - } - - private void AttemptClaim(int x, int y, int[,] clusterIndexMap, List> pointClusters, int index) //Attempts to create a cluster - { - int num = clusterIndexMap[x, y]; - if (num != -1 && num != index) - { - int num2 = (WorldGen.genRand.Next(2) == 0) ? -1 : index; - foreach (Point current in pointClusters[num]) - { - clusterIndexMap[current.X, current.Y] = num2; - } - } - } - - public void Generate(int width, int height) //Creates clusters for cluster group - { - this.Width = width; - this.Height = height; - base.Clear(); - bool[,] array = new bool[width, height]; - int num = (width >> 1) - 1; - int num2 = (height >> 1) - 1; - int num3 = (num + 1) * (num + 1); - Point point = new Point(num, num2); - for (int i = point.Y - num2; i <= point.Y + num2; i++) - { - float num4 = (float)num / (float)num2 * (float)(i - point.Y); - int num5 = Math.Min(num, (int)Math.Sqrt((double)((float)num3 - num4 * num4))); - for (int j = point.X - num5; j <= point.X + num5; j++) - { - array[j, i] = (WorldGen.genRand.Next(2) == 0); - } - } - List> list = new List>(); - for (int k = 0; k < array.GetLength(0); k++) - { - for (int l = 0; l < array.GetLength(1); l++) - { - if (array[k, l] && WorldGen.genRand.Next(2) == 0) - { - List list2 = new List(); - this.SearchForCluster(array, list2, k, l, 2); - if (list2.Count > 2) - { - list.Add(list2); - } - } - } - } - int[,] array2 = new int[array.GetLength(0), array.GetLength(1)]; - for (int m = 0; m < array2.GetLength(0); m++) - { - for (int n = 0; n < array2.GetLength(1); n++) - { - array2[m, n] = -1; - } - } - for (int num6 = 0; num6 < list.Count; num6++) - { - foreach (Point current in list[num6]) - { - array2[current.X, current.Y] = num6; - } - } - for (int num7 = 0; num7 < list.Count; num7++) - { - foreach (Point expr_205 in list[num7]) - { - int x = expr_205.X; - int y = expr_205.Y; - if (array2[x, y] == -1) - { - break; - } - int index = array2[x, y]; - if (x > 0) - { - this.AttemptClaim(x - 1, y, array2, list, index); - } - if (x < array2.GetLength(0) - 1) - { - this.AttemptClaim(x + 1, y, array2, list, index); - } - if (y > 0) - { - this.AttemptClaim(x, y - 1, array2, list, index); - } - if (y < array2.GetLength(1) - 1) - { - this.AttemptClaim(x, y + 1, array2, list, index); - } - } - } - using (List>.Enumerator enumerator2 = list.GetEnumerator()) - { - while (enumerator2.MoveNext()) - { - enumerator2.Current.Clear(); - } - } - for (int num8 = 0; num8 < array2.GetLength(0); num8++) - { - for (int num9 = 0; num9 < array2.GetLength(1); num9++) - { - if (array2[num8, num9] != -1) - { - list[array2[num8, num9]].Add(new Point(num8, num9)); - } - } - } - foreach (List current2 in list) - { - if (current2.Count < 4) - { - current2.Clear(); - } - } - foreach (List current3 in list) - { - SunkenSea.Cluster cluster = new SunkenSea.Cluster(); - if (current3.Count > 0) - { - foreach (Point current4 in current3) - { - cluster.Add(new SunkenSea.Hub((float)current4.X + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f, (float)current4.Y + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f)); - } - base.Add(cluster); - } - } - } - } - - private static void PlaceClusters(SunkenSea.ClusterGroup clusters, Point start, Vector2 scale) //Places tile/wall clusters in Sunken Sea area - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int num = (int)(scale.X * (float)clusters.Width); - int num2 = (int)(scale.Y * (float)clusters.Height); - Vector2 value = new Vector2((float)num, (float)num2); - Vector2 value2 = new Vector2((float)clusters.Width, (float)clusters.Height); - for (int i = -20; i < num + 20; i++) - { - for (int j = -20; j < num2 + 20; j++) - { - float num3 = 0f; - int num4 = -1; - float num5 = 0f; - int num6 = i + start.X; - int num7 = j + start.Y; - Vector2 vector = new Vector2((float)i, (float)j) / value * value2; - float num8 = (new Vector2((float)i, (float)j) / value * 2f - Vector2.One).Length(); - for (int k = 0; k < clusters.Count; k++) - { - SunkenSea.Cluster cluster = clusters[k]; - if (Math.Abs(cluster[0].Position.X - vector.X) <= 10f && Math.Abs(cluster[0].Position.Y - vector.Y) <= 10f) - { - float num9 = 0f; - foreach (SunkenSea.Hub current in cluster) - { - num9 += 1f / Vector2.DistanceSquared(current.Position, vector); - } - if (num9 > num3) - { - if (num3 > num5) - { - num5 = num3; - } - num3 = num9; - num4 = k; - } - else if (num9 > num5) - { - num5 = num9; - } - } - } - float num10 = num3 + num5; - Tile tile = Main.tile[num6, num7]; - bool flag = num8 >= 0.8f; - if (num10 > 3.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent - { - tile.ClearEverything(); - tile.wall = (ushort)mod.WallType("NavystoneWall"); - tile.liquid = 192; - if (num4 % 15 == 2) - { - tile.ResetToType((ushort)mod.TileType("Navystone")); - tile.active(true); - tile.liquid = 0; - } - Tile.SmoothSlope(num6, num7, true); - } - else if (num10 > 1.8f) - { - tile.wall = (ushort)mod.WallType("NavystoneWall"); - tile.liquid = 192; - if (!flag || tile.active()) - { - tile.ResetToType((ushort)mod.TileType("Navystone")); - tile.active(true); - Tile.SmoothSlope(num6, num7, true); - tile.liquid = 0; - } - } - else if (num10 > 0.7f || !flag) - { - tile.liquid = 192; - if (!flag || tile.active()) - { - tile.ResetToType((ushort)mod.TileType("EutrophicSand")); - tile.active(true); - Tile.SmoothSlope(num6, num7, true); - tile.liquid = 0; - } - tile.wall = (ushort)mod.WallType("EutrophicSandWall"); - } - else if (num10 > 0.25f) - { - float num11 = (num10 - 0.25f) / 0.45f; - if (WorldGen.genRand.NextFloat() < num11) - { - if (tile.active()) - { - tile.ResetToType((ushort)mod.TileType("EutrophicSand")); - tile.active(true); - Tile.SmoothSlope(num6, num7, true); - tile.wall = (ushort)mod.WallType("EutrophicSandWall"); - tile.liquid = 0; - } - else - { - tile.wall = (ushort)mod.WallType("NavystoneWall"); - tile.liquid = 192; - } - } - } - } - } - } - - private static void AddTileVariance(SunkenSea.ClusterGroup clusters, Point start, Vector2 scale, float size) /*Adds tile variation to the generated tile clusters and generates open areas with sea prism ore; - Generates sea prism crystals on prism ore and occasionally on navystone*/ - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int num = (int)(scale.X * (float)clusters.Width); - int num2 = (int)(scale.Y * (float)clusters.Height); - bool genCentalHole = true; - Rectangle rectangle = default(Rectangle); - int radius = (int)(((float)WorldGen.genRand.Next(24, 28)) * size); //Radius of the generated hole - int diameter = radius * 2; - Point point = new Point(WorldGen.UndergroundDesertLocation.Left + (WorldGen.UndergroundDesertLocation.Width / 2), - WorldGen.UndergroundDesertLocation.Bottom + (WorldGen.UndergroundDesertLocation.Height / 3)); //Around the center of the Sunken Sea area - ShapeData holeShape = new ShapeData(); - int radiusSmall = 0; - float outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(40, 56) * 0.01); //Small radius for ore patch to fit inside holes - int sunkenSeaBottom = WorldGen.UndergroundDesertLocation.Bottom + (int)((double)WorldGen.UndergroundDesertLocation.Height * 0.7); - int smallHoles = 0; - int amt = (int)(4f * size); //Scale amount of holes with world size - for (int i = -20; i < num + 20; i++) - { - for (int j = -20; j < num2 + 20; j++) - { - if (genCentalHole) - { - genCentalHole = false; - rectangle = new Rectangle(WorldGen.UndergroundDesertLocation.Left + (WorldGen.UndergroundDesertLocation.Width / 2) - radius, - WorldGen.UndergroundDesertLocation.Bottom + (WorldGen.UndergroundDesertLocation.Height / 3) - radius, diameter, diameter); - - WorldUtils.Gen(point, new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - new Modifiers.Blotches(2, 0.6).Output(holeShape), //Adds uneven shape to the outer tiles - new Actions.ClearTile(true), //Clear all tiles - new Actions.SetLiquid(0, 192) //Leave some air pockets - })); - - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth the outer parts - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(4)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 6 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.SetTile((ushort)mod.TileType("Navystone"), true) //Place outer shell - })); - - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(3)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 4 - { - new Modifiers.Blotches(2, 0.3), - new Actions.SetTile((ushort)mod.TileType("SeaPrism"), true) //Place prism - })); - - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 2 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.ClearTile(true), //Clear all tiles - new Actions.SetLiquid(0, 255) - })); - - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(2)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - } - 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)) - { - smallHoles++; - radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * size); - WorldUtils.Gen(point, new Shapes.Circle(radiusSmall), Actions.Chain(new GenAction[] - { - new Modifiers.Blotches(2, 0.45).Output(holeShape), - new Actions.ClearTile(true), - new Actions.SetLiquid(0, 192) - })); - - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] - { - new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(3)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - - outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(65, 81) * 0.01); - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 4 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.SetTile((ushort)mod.TileType("Navystone"), true) //Place outer shell - })); - - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell - { - new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(3)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 2 - { - new Modifiers.Blotches(2, 0.3), - new Actions.SetTile((ushort)mod.TileType("SeaPrism"), true) //Place prism - })); - - WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1 - { - new Modifiers.Blotches(2, 0.3).Output(holeShape), - new Actions.ClearTile(true), //Clear center - new Actions.SetLiquid(0, 255) - })); - - WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell - { - new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), - new Modifiers.Conditions(new CustomConditions.RandomChance(2)), - new Actions.Smooth(), - new Actions.SetFrames(true) - })); - } - int num3 = i + start.X; - int num4 = j + start.Y; - Tile tile = Main.tile[num3, num4]; - Tile testTile = Main.tile[num3, num4 + 1]; - Tile testTile2 = Main.tile[num3, num4 + 2]; - if (tile.type == mod.TileType("EutrophicSand") && (!WorldGen.SolidTile(testTile) || !WorldGen.SolidTile(testTile2))) //Tile variation - { - tile.type = (ushort)mod.TileType("Navystone"); - } - } - } - for (int k = -20; k < num + 20; k++) - { - for (int l = -20; l < num2 + 20; l++) - { - int num5 = k + start.X; - int num6 = l + start.Y; - Tile tile2 = Main.tile[num5, num6]; - if (tile2.active() && (tile2.type == mod.TileType("SeaPrism") || tile2.type == mod.TileType("Navystone"))) - { - bool flag = true; - for (int m = -1; m >= -3; m--) - { - if (Main.tile[num5, num6 + m].active()) - { - flag = false; - break; - } - } - bool flag2 = true; - for (int n = 1; n <= 3; n++) - { - if (Main.tile[num5, num6 + n].active()) - { - flag2 = false; - break; - } - } - bool flag3 = true; - for (int o = -1; o >= -3; o--) - { - if (Main.tile[num5 + o, num6].active()) - { - flag3 = false; - break; - } - } - bool flag4 = true; - for (int p = 1; p <= 3; p++) - { - if (Main.tile[num5 + p, num6].active()) - { - flag4 = false; - break; - } - } - if (tile2.type == mod.TileType("SeaPrism") || (tile2.type == mod.TileType("Navystone") && WorldGen.genRand.Next(8) == 0)) - { - if (flag3 ^ flag4) - { - if (tile2.slope() == 0 && !tile2.halfBrick()) - { - Tile tile3 = Main.tile[num5 + (flag3 ? -1 : 1), num6]; - tile3.type = (ushort)mod.TileType("SeaPrismCrystals"); - if (Main.tile[num5 - 1, num6].type == mod.TileType("SeaPrismCrystals")) - { - Main.tile[num5 - 1, num6].frameY = (short)(2 * 18); - } - else if (Main.tile[num5 + 1, num6].type == mod.TileType("SeaPrismCrystals")) - { - Main.tile[num5 + 1, num6].frameY = (short)(3 * 18); - } - tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); - tile3.active(true); - } - } - if (flag ^ flag2) - { - if (tile2.slope() == 0 && !tile2.halfBrick()) - { - Tile tile3 = Main.tile[num5, num6 + (flag ? -1 : 1)]; - tile3.type = (ushort)mod.TileType("SeaPrismCrystals"); - if (Main.tile[num5, num6 - 1].type == mod.TileType("SeaPrismCrystals")) - { - Main.tile[num5, num6 - 1].frameY = (short)(0 * 18); - } - else if (Main.tile[num5, num6 + 1].type == mod.TileType("SeaPrismCrystals")) - { - Main.tile[num5, num6 + 1].frameY = (short)(1 * 18); - } - tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); - tile3.active(true); - } - } - } - } - if (!tile2.active()) - { - if (tile2.wall == mod.WallType("NavystoneWall") || tile2.wall == mod.WallType("EutrophicSandWall")) - { - if (WorldGen.genRand.Next(5) == 0) - { - WorldGenerationMethods.PlaceTit(num5, num6, (ushort)mod.TileType("SunkenSeaStalactite")); - } - if (WorldGen.genRand.Next(8) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("BrainCoral"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SmallBrainCoral"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(10) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("FanCoral"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SeaAnemone"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(8) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("TubeCoral"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SmallTubeCoral"), true, false, -1, 0); - } - if (WorldGen.genRand.Next(4) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("TableCoral"), true, false, -1, 0); - } - } - } - } - } - } - - public static bool Place(Point origin) - { - float scale = (float)Main.maxTilesX / 4200f; - int sunkenSeaAreaX = (int)(80f * scale); //80f - int sunkenSeaAreaY = (int)((WorldGen.genRand.NextFloat() + 1f) * 60f * scale); //80f - float radius = (float)WorldGen.genRand.Next(6, 10); - Vector2 vector = new Vector2(4f, 2f); //4, 2 - SunkenSea.ClusterGroup clusterGroup = new SunkenSea.ClusterGroup(); - clusterGroup.Generate(sunkenSeaAreaX, sunkenSeaAreaY); - SunkenSea.PlaceClusters(clusterGroup, origin, vector); - SunkenSea.AddTileVariance(clusterGroup, origin, vector, scale); - int num4 = (int)(vector.X * (float)clusterGroup.Width); - int num5 = (int)(vector.Y * (float)clusterGroup.Height); - for (int i = -40; i < num4 + 40; i++) //40 - { - for (int j = -40; j < num5 + 40; j++) //40 - { - if (i + origin.X > 0 && i + origin.X < Main.maxTilesX - 1 && j + origin.Y > 0 && j + origin.Y < Main.maxTilesY - 1) - { - WorldGen.SquareWallFrame(i + origin.X, j + origin.Y, true); - WorldUtils.TileFrame(i + origin.X, j + origin.Y, true); - } - } - } - return true; - } - } -} +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +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; + +namespace CalamityMod.World +{ + public class SunkenSea : ModWorld + { + private struct Hub + { + public Vector2 Position; + + public Hub(Vector2 position) + { + this.Position = position; + } + + public Hub(float x, float y) + { + this.Position = new Vector2(x, y); + } + } + + private class Cluster : List + { + } + + private class ClusterGroup : List + { + public int Width; + + public int Height; + + private void SearchForCluster(bool[,] hubMap, List pointCluster, int x, int y, int level = 2) + { + pointCluster.Add(new Point(x, y)); + hubMap[x, y] = false; + level--; + if (level == -1) + { + return; + } + if (x > 0 && hubMap[x - 1, y]) + { + this.SearchForCluster(hubMap, pointCluster, x - 1, y, level); + } + if (x < hubMap.GetLength(0) - 1 && hubMap[x + 1, y]) + { + this.SearchForCluster(hubMap, pointCluster, x + 1, y, level); + } + if (y > 0 && hubMap[x, y - 1]) + { + this.SearchForCluster(hubMap, pointCluster, x, y - 1, level); + } + if (y < hubMap.GetLength(1) - 1 && hubMap[x, y + 1]) + { + this.SearchForCluster(hubMap, pointCluster, x, y + 1, level); + } + } + + private void AttemptClaim(int x, int y, int[,] clusterIndexMap, List> pointClusters, int index) //Attempts to create a cluster + { + int num = clusterIndexMap[x, y]; + if (num != -1 && num != index) + { + int num2 = (WorldGen.genRand.Next(2) == 0) ? -1 : index; + foreach (Point current in pointClusters[num]) + { + clusterIndexMap[current.X, current.Y] = num2; + } + } + } + + public void Generate(int width, int height) //Creates clusters for cluster group + { + this.Width = width; + this.Height = height; + base.Clear(); + bool[,] array = new bool[width, height]; + int num = (width >> 1) - 1; + int num2 = (height >> 1) - 1; + int num3 = (num + 1) * (num + 1); + Point point = new Point(num, num2); + for (int i = point.Y - num2; i <= point.Y + num2; i++) + { + float num4 = (float)num / (float)num2 * (float)(i - point.Y); + int num5 = Math.Min(num, (int)Math.Sqrt((double)((float)num3 - num4 * num4))); + for (int j = point.X - num5; j <= point.X + num5; j++) + { + array[j, i] = (WorldGen.genRand.Next(2) == 0); + } + } + List> list = new List>(); + for (int k = 0; k < array.GetLength(0); k++) + { + for (int l = 0; l < array.GetLength(1); l++) + { + if (array[k, l] && WorldGen.genRand.Next(2) == 0) + { + List list2 = new List(); + this.SearchForCluster(array, list2, k, l, 2); + if (list2.Count > 2) + { + list.Add(list2); + } + } + } + } + int[,] array2 = new int[array.GetLength(0), array.GetLength(1)]; + for (int m = 0; m < array2.GetLength(0); m++) + { + for (int n = 0; n < array2.GetLength(1); n++) + { + array2[m, n] = -1; + } + } + for (int num6 = 0; num6 < list.Count; num6++) + { + foreach (Point current in list[num6]) + { + array2[current.X, current.Y] = num6; + } + } + for (int num7 = 0; num7 < list.Count; num7++) + { + foreach (Point expr_205 in list[num7]) + { + int x = expr_205.X; + int y = expr_205.Y; + if (array2[x, y] == -1) + { + break; + } + int index = array2[x, y]; + if (x > 0) + { + this.AttemptClaim(x - 1, y, array2, list, index); + } + if (x < array2.GetLength(0) - 1) + { + this.AttemptClaim(x + 1, y, array2, list, index); + } + if (y > 0) + { + this.AttemptClaim(x, y - 1, array2, list, index); + } + if (y < array2.GetLength(1) - 1) + { + this.AttemptClaim(x, y + 1, array2, list, index); + } + } + } + using (List>.Enumerator enumerator2 = list.GetEnumerator()) + { + while (enumerator2.MoveNext()) + { + enumerator2.Current.Clear(); + } + } + for (int num8 = 0; num8 < array2.GetLength(0); num8++) + { + for (int num9 = 0; num9 < array2.GetLength(1); num9++) + { + if (array2[num8, num9] != -1) + { + list[array2[num8, num9]].Add(new Point(num8, num9)); + } + } + } + foreach (List current2 in list) + { + if (current2.Count < 4) + { + current2.Clear(); + } + } + foreach (List current3 in list) + { + SunkenSea.Cluster cluster = new SunkenSea.Cluster(); + if (current3.Count > 0) + { + foreach (Point current4 in current3) + { + cluster.Add(new SunkenSea.Hub((float)current4.X + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f, (float)current4.Y + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f)); + } + base.Add(cluster); + } + } + } + } + + private static void PlaceClusters(SunkenSea.ClusterGroup clusters, Point start, Vector2 scale) //Places tile/wall clusters in Sunken Sea area + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int num = (int)(scale.X * (float)clusters.Width); + int num2 = (int)(scale.Y * (float)clusters.Height); + Vector2 value = new Vector2((float)num, (float)num2); + Vector2 value2 = new Vector2((float)clusters.Width, (float)clusters.Height); + for (int i = -20; i < num + 20; i++) + { + for (int j = -20; j < num2 + 20; j++) + { + float num3 = 0f; + int num4 = -1; + float num5 = 0f; + int num6 = i + start.X; + int num7 = j + start.Y; + Vector2 vector = new Vector2((float)i, (float)j) / value * value2; + float num8 = (new Vector2((float)i, (float)j) / value * 2f - Vector2.One).Length(); + for (int k = 0; k < clusters.Count; k++) + { + SunkenSea.Cluster cluster = clusters[k]; + if (Math.Abs(cluster[0].Position.X - vector.X) <= 10f && Math.Abs(cluster[0].Position.Y - vector.Y) <= 10f) + { + float num9 = 0f; + foreach (SunkenSea.Hub current in cluster) + { + num9 += 1f / Vector2.DistanceSquared(current.Position, vector); + } + if (num9 > num3) + { + if (num3 > num5) + { + num5 = num3; + } + num3 = num9; + num4 = k; + } + else if (num9 > num5) + { + num5 = num9; + } + } + } + float num10 = num3 + num5; + Tile tile = Main.tile[num6, num7]; + bool flag = num8 >= 0.8f; + if (num10 > 3.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent + { + tile.ClearEverything(); + tile.wall = (ushort)mod.WallType("NavystoneWall"); + tile.liquid = 192; + if (num4 % 15 == 2) + { + tile.ResetToType((ushort)mod.TileType("Navystone")); + tile.active(true); + tile.liquid = 0; + } + Tile.SmoothSlope(num6, num7, true); + } + else if (num10 > 1.8f) + { + tile.wall = (ushort)mod.WallType("NavystoneWall"); + tile.liquid = 192; + if (!flag || tile.active()) + { + tile.ResetToType((ushort)mod.TileType("Navystone")); + tile.active(true); + Tile.SmoothSlope(num6, num7, true); + tile.liquid = 0; + } + } + else if (num10 > 0.7f || !flag) + { + tile.liquid = 192; + if (!flag || tile.active()) + { + tile.ResetToType((ushort)mod.TileType("EutrophicSand")); + tile.active(true); + Tile.SmoothSlope(num6, num7, true); + tile.liquid = 0; + } + tile.wall = (ushort)mod.WallType("EutrophicSandWall"); + } + else if (num10 > 0.25f) + { + float num11 = (num10 - 0.25f) / 0.45f; + if (WorldGen.genRand.NextFloat() < num11) + { + if (tile.active()) + { + tile.ResetToType((ushort)mod.TileType("EutrophicSand")); + tile.active(true); + Tile.SmoothSlope(num6, num7, true); + tile.wall = (ushort)mod.WallType("EutrophicSandWall"); + tile.liquid = 0; + } + else + { + tile.wall = (ushort)mod.WallType("NavystoneWall"); + tile.liquid = 192; + } + } + } + } + } + } + + private static void AddTileVariance(SunkenSea.ClusterGroup clusters, Point start, Vector2 scale, float size) /*Adds tile variation to the generated tile clusters and generates open areas with sea prism ore; + Generates sea prism crystals on prism ore and occasionally on navystone*/ + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int num = (int)(scale.X * (float)clusters.Width); + int num2 = (int)(scale.Y * (float)clusters.Height); + bool genCentalHole = true; + Rectangle rectangle = default(Rectangle); + int radius = (int)(((float)WorldGen.genRand.Next(24, 28)) * size); //Radius of the generated hole + int diameter = radius * 2; + Point point = new Point(WorldGen.UndergroundDesertLocation.Left + (WorldGen.UndergroundDesertLocation.Width / 2), + WorldGen.UndergroundDesertLocation.Bottom + (WorldGen.UndergroundDesertLocation.Height / 3)); //Around the center of the Sunken Sea area + ShapeData holeShape = new ShapeData(); + int radiusSmall = 0; + float outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(40, 56) * 0.01); //Small radius for ore patch to fit inside holes + int sunkenSeaBottom = WorldGen.UndergroundDesertLocation.Bottom + (int)((double)WorldGen.UndergroundDesertLocation.Height * 0.7); + int smallHoles = 0; + int amt = (int)(4f * size); //Scale amount of holes with world size + for (int i = -20; i < num + 20; i++) + { + for (int j = -20; j < num2 + 20; j++) + { + if (genCentalHole) + { + genCentalHole = false; + rectangle = new Rectangle(WorldGen.UndergroundDesertLocation.Left + (WorldGen.UndergroundDesertLocation.Width / 2) - radius, + WorldGen.UndergroundDesertLocation.Bottom + (WorldGen.UndergroundDesertLocation.Height / 3) - radius, diameter, diameter); + + WorldUtils.Gen(point, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.6).Output(holeShape), //Adds uneven shape to the outer tiles + new Actions.ClearTile(true), //Clear all tiles + new Actions.SetLiquid(0, 192) //Leave some air pockets + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth the outer parts + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(4)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 6 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.SetTile((ushort)mod.TileType("Navystone"), true) //Place outer shell + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 4 + { + new Modifiers.Blotches(2, 0.3), + new Actions.SetTile((ushort)mod.TileType("SeaPrism"), true) //Place prism + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 2 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.ClearTile(true), //Clear all tiles + new Actions.SetLiquid(0, 255) + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + } + 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)) + { + smallHoles++; + radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * size); + WorldUtils.Gen(point, new Shapes.Circle(radiusSmall), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.45).Output(holeShape), + new Actions.ClearTile(true), + new Actions.SetLiquid(0, 192) + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] + { + new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(65, 81) * 0.01); + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 4 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.SetTile((ushort)mod.TileType("Navystone"), true) //Place outer shell + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell + { + new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 2 + { + new Modifiers.Blotches(2, 0.3), + new Actions.SetTile((ushort)mod.TileType("SeaPrism"), true) //Place prism + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.ClearTile(true), //Clear center + new Actions.SetLiquid(0, 255) + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + } + int num3 = i + start.X; + int num4 = j + start.Y; + Tile tile = Main.tile[num3, num4]; + Tile testTile = Main.tile[num3, num4 + 1]; + Tile testTile2 = Main.tile[num3, num4 + 2]; + if (tile.type == mod.TileType("EutrophicSand") && (!WorldGen.SolidTile(testTile) || !WorldGen.SolidTile(testTile2))) //Tile variation + { + tile.type = (ushort)mod.TileType("Navystone"); + } + } + } + for (int k = -20; k < num + 20; k++) + { + for (int l = -20; l < num2 + 20; l++) + { + int num5 = k + start.X; + int num6 = l + start.Y; + Tile tile2 = Main.tile[num5, num6]; + if (tile2.active() && (tile2.type == mod.TileType("SeaPrism") || tile2.type == mod.TileType("Navystone"))) + { + bool flag = true; + for (int m = -1; m >= -3; m--) + { + if (Main.tile[num5, num6 + m].active()) + { + flag = false; + break; + } + } + bool flag2 = true; + for (int n = 1; n <= 3; n++) + { + if (Main.tile[num5, num6 + n].active()) + { + flag2 = false; + break; + } + } + bool flag3 = true; + for (int o = -1; o >= -3; o--) + { + if (Main.tile[num5 + o, num6].active()) + { + flag3 = false; + break; + } + } + bool flag4 = true; + for (int p = 1; p <= 3; p++) + { + if (Main.tile[num5 + p, num6].active()) + { + flag4 = false; + break; + } + } + if (tile2.type == mod.TileType("SeaPrism") || (tile2.type == mod.TileType("Navystone") && WorldGen.genRand.Next(8) == 0)) + { + if (flag3 ^ flag4) + { + if (tile2.slope() == 0 && !tile2.halfBrick()) + { + Tile tile3 = Main.tile[num5 + (flag3 ? -1 : 1), num6]; + tile3.type = (ushort)mod.TileType("SeaPrismCrystals"); + if (Main.tile[num5 - 1, num6].type == mod.TileType("SeaPrismCrystals")) + { + Main.tile[num5 - 1, num6].frameY = (short)(2 * 18); + } + else if (Main.tile[num5 + 1, num6].type == mod.TileType("SeaPrismCrystals")) + { + Main.tile[num5 + 1, num6].frameY = (short)(3 * 18); + } + tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); + tile3.active(true); + } + } + if (flag ^ flag2) + { + if (tile2.slope() == 0 && !tile2.halfBrick()) + { + Tile tile3 = Main.tile[num5, num6 + (flag ? -1 : 1)]; + tile3.type = (ushort)mod.TileType("SeaPrismCrystals"); + if (Main.tile[num5, num6 - 1].type == mod.TileType("SeaPrismCrystals")) + { + Main.tile[num5, num6 - 1].frameY = (short)(0 * 18); + } + else if (Main.tile[num5, num6 + 1].type == mod.TileType("SeaPrismCrystals")) + { + Main.tile[num5, num6 + 1].frameY = (short)(1 * 18); + } + tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); + tile3.active(true); + } + } + } + } + if (!tile2.active()) + { + if (tile2.wall == mod.WallType("NavystoneWall") || tile2.wall == mod.WallType("EutrophicSandWall")) + { + if (WorldGen.genRand.Next(5) == 0) + { + WorldGenerationMethods.PlaceTit(num5, num6, (ushort)mod.TileType("SunkenSeaStalactite")); + } + if (WorldGen.genRand.Next(8) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("BrainCoral"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SmallBrainCoral"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(10) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("FanCoral"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SeaAnemone"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(8) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("TubeCoral"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("SmallTubeCoral"), true, false, -1, 0); + } + if (WorldGen.genRand.Next(4) == 0) + { + WorldGen.PlaceTile(num5, num6, (ushort)mod.TileType("TableCoral"), true, false, -1, 0); + } + } + } + } + } + } + + public static bool Place(Point origin) + { + float scale = (float)Main.maxTilesX / 4200f; + int sunkenSeaAreaX = (int)(80f * scale); //80f + int sunkenSeaAreaY = (int)((WorldGen.genRand.NextFloat() + 1f) * 60f * scale); //80f + float radius = (float)WorldGen.genRand.Next(6, 10); + Vector2 vector = new Vector2(4f, 2f); //4, 2 + SunkenSea.ClusterGroup clusterGroup = new SunkenSea.ClusterGroup(); + clusterGroup.Generate(sunkenSeaAreaX, sunkenSeaAreaY); + SunkenSea.PlaceClusters(clusterGroup, origin, vector); + SunkenSea.AddTileVariance(clusterGroup, origin, vector, scale); + int num4 = (int)(vector.X * (float)clusterGroup.Width); + int num5 = (int)(vector.Y * (float)clusterGroup.Height); + for (int i = -40; i < num4 + 40; i++) //40 + { + for (int j = -40; j < num5 + 40; j++) //40 + { + if (i + origin.X > 0 && i + origin.X < Main.maxTilesX - 1 && j + origin.Y > 0 && j + origin.Y < Main.maxTilesY - 1) + { + WorldGen.SquareWallFrame(i + origin.X, j + origin.Y, true); + WorldUtils.TileFrame(i + origin.X, j + origin.Y, true); + } + } + } + return true; + } + } +} diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index 75db255038..9d1b8ddded 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -3243,4 +3243,4 @@ namespace CalamityMod.World } #endregion } -} \ No newline at end of file +} diff --git a/build.txt b/build.txt index d68db3db9f..f97b6902f7 100644 --- a/build.txt +++ b/build.txt @@ -1,9 +1,9 @@ -author = MountainDrew -version = 1.4.2.102 -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 -hideCode = true -hideResources = true -includeSource = false -includePDB = false \ No newline at end of file +author = MountainDrew +version = 1.4.2.102 +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 +hideCode = true +hideResources = true +includeSource = false +includePDB = false diff --git a/description.txt b/description.txt index 616411e1de..ba6633cf82 100644 --- a/description.txt +++ b/description.txt @@ -1,10 +1,10 @@ -This mod was created with the purpose of adding additional content to Terraria. -It currently contains: -8 new mineable ores -24 new bosses -4 new modes for extra challenge -3 new biomes -275+ new enemy NPCs -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 +This mod was created with the purpose of adding additional content to Terraria. +It currently contains: +8 new mineable ores +24 new bosses +4 new modes for extra challenge +3 new biomes +275+ new enemy NPCs +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!